aboutsummaryrefslogtreecommitdiff
path: root/modules/core/module-system.js
diff options
context:
space:
mode:
authorAgando <roduccomm@gmail.com>2026-06-18 06:00:40 +0200
committerAgando <roduccomm@gmail.com>2026-06-18 06:00:40 +0200
commitfba6df22dae297c89fa0df065628dddded66c69c (patch)
treef954a04ee1effe56361282a16444deaa93bd0151 /modules/core/module-system.js
parenta02db2f506dec15c0c89dd4f8f21f975f627e4fe (diff)
auto: 2026-06-18_06:00 changes
Diffstat (limited to 'modules/core/module-system.js')
-rw-r--r--modules/core/module-system.js139
1 files changed, 131 insertions, 8 deletions
diff --git a/modules/core/module-system.js b/modules/core/module-system.js
index f7da981..9dee38c 100644
--- a/modules/core/module-system.js
+++ b/modules/core/module-system.js
@@ -16,8 +16,9 @@
'doctor': 'doctor — Run all health checks, rank issues, show top 3 warnings',
'bug-report': 'bug-report — Generate a markdown bug report to /tmp/ for debugging',
'preview': 'preview <file.html> — Render an HTML file from the VFS in a preview pane',
- 'factory-reset': 'factory-reset [--confirm] — Wipe all webx11_ data (VFS, config, AI profile, mindmaps, themes, all localStorage)',
- 'reset-vfs': 'reset-vfs [--confirm] — Clear virtual filesystem and auto-session backups (keeps settings, modules, AI profile)',
+ 'reset': 'reset [mem|vfs|config|all] — Global reset command (default: mem)',
+ 'factory-reset': 'factory-reset — Alias for reset all',
+ 'reset-vfs': 'reset-vfs — Alias for reset vfs',
'logs': 'logs [n] [LEVEL] — Show last n log entries (optionally filtered by level: INFO/WARN/ERROR)',
'logrotate': 'logrotate — Rotate current.log to a dated archive (auto-cleans old)',
'health-check': 'health-check — Audit VFS size, modules, logs, trash, skills, tool failures',
@@ -305,7 +306,13 @@
};
this.commands['preview'] = (args) => this.terminal.openPreview(args);
- this.commands['factory-reset'] = (args) => {
+
+ // v4.5.64: reset — unified reset command superseding factory-reset, reset-vfs, reset-mem, config-reset
+ this.commands['reset'] = (args) => this._globalReset(args);
+ this.commands['factory-reset'] = (args) => this._globalReset(['all', ...args]);
+ this.commands['reset-vfs'] = (args) => this._globalReset(['vfs', ...args]);
+
+ this.commands['factory-reset-old'] = (args) => {
if (!args[0] || args[0] !== '--confirm') {
this.terminal.print('⚠️ FACTORY RESET will clear all data:', 'error');
this.terminal.print(' • Filesystem (all files + directories)', 'warning');
@@ -448,6 +455,122 @@
}
};
}
+
+ // v4.5.64: Unified reset — subcommands: mem, vfs, config, all
+ _globalReset(args) {
+ const scope = (args[0] || 'mem').toLowerCase();
+ const confirmed = args.includes('--confirm') || args.includes('-y');
+
+ const scopes = {
+ mem: {
+ title: 'AI MEMORY',
+ items: ['AI conversation context', 'AI patterns & guardrails', 'AI user profile', 'AI system prompt', 'VaultMind token', 'AI internal logs (tool calls, heap stats)'],
+ keys: ['webx11_ai_context', 'webx11_ai_config', 'webx11_ai_patterns', 'webx11_ai_system_prompt', 'webx11_user_profile', 'webx11_guardrail_policy', 'vaultmind_token'],
+ desc: 'Clears AI state only. VFS, settings, modules, and config are untouched.'
+ },
+ vfs: {
+ title: 'VIRTUAL FILESYSTEM',
+ items: ['All files and directories', 'Session backups', 'VFS metadata', 'Neural VFS index'],
+ desc: 'Clears the VFS to empty root. Settings, modules, AI profile, and config are preserved.'
+ },
+ config: {
+ title: 'CONFIGURATION',
+ items: ['All webx11_config_* keys', 'Ollama endpoint & model', 'Security settings', 'Terminal config', 'Font size', 'Theme'],
+ keys: null, // prefix-based wipe
+ desc: 'Resets all configuration to defaults. VFS and AI memory are untouched.'
+ },
+ all: {
+ title: 'EVERYTHING',
+ items: ['VFS (all files)', 'AI memory & profile', 'All config & settings', 'Module registry & disabled list', 'Terminal history', 'Themes', 'Chat settings', 'Cron jobs', 'Floating elements', 'Aliases', 'Tutorial state', 'Server list', 'Orchestrator config', 'Secret vault keys', 'Neural VFS config'],
+ desc: 'Complete wipe. The system will reload as if first visit.'
+ }
+ };
+
+ const s = scopes[scope];
+ if (!s) {
+ this.terminal.print(`Usage: reset [mem|vfs|config|all] [--confirm]`, 'warning');
+ this.terminal.print(` reset mem — Clear AI memory (default)`, 'info');
+ this.terminal.print(` reset vfs — Clear virtual filesystem`, 'info');
+ this.terminal.print(` reset config — Reset all config to defaults`, 'info');
+ this.terminal.print(` reset all — Wipe everything (nuclear)`, 'info');
+ this.terminal.print(``, 'info');
+ this.terminal.print(`Aliases: factory-reset = reset all, reset-vfs = reset vfs`, 'info');
+ return;
+ }
+
+ if (!confirmed) {
+ this.terminal.print(`⚠️ RESET ${s.title} will clear:`, 'error');
+ s.items.forEach(item => this.terminal.print(` • ${item}`, 'warning'));
+ this.terminal.print(``, 'info');
+ this.terminal.print(s.desc, 'info');
+ this.terminal.print(``, 'info');
+ this.terminal.print(`Type: reset ${scope} --confirm`, 'error');
+ return;
+ }
+
+ // Execute reset
+ if (scope === 'mem') {
+ this._resetMem();
+ } else if (scope === 'vfs') {
+ this._resetVfs();
+ } else if (scope === 'config') {
+ this._resetConfig();
+ } else if (scope === 'all') {
+ this._resetAll();
+ }
+
+ localStorage.setItem('webx11_last_reset', Date.now().toString());
+ this.terminal.print(`✅ ${s.title} reset complete. Reloading...`, 'success');
+ setTimeout(() => location.reload(), 1000);
+ }
+
+ _resetMem() {
+ const keys = ['webx11_ai_context', 'webx11_ai_config', 'webx11_ai_patterns', 'webx11_ai_system_prompt', 'webx11_user_profile', 'webx11_guardrail_policy', 'vaultmind_token'];
+ keys.forEach(k => localStorage.removeItem(k));
+ // Also clear AI logs in VFS
+ try { this.terminal.fs.deleteFile('/logs/ai-tool-log.json'); } catch (e) {}
+ }
+
+ _resetVfs() {
+ this.terminal.fs.root = { type: 'dir', content: {} };
+ this.terminal.fs.currentPath = [];
+ try {
+ this.terminal.fs.deleteFile('_sessions/_auto.json');
+ this.terminal.fs.deleteFile('_sessions/_auto-context.json');
+ } catch (e) {}
+ this.terminal.fs.saveToStorage();
+ }
+
+ _resetConfig() {
+ // Wipe all webx11_config_* keys
+ const toRemove = [];
+ for (let i = localStorage.length - 1; i >= 0; i--) {
+ const key = localStorage.key(i);
+ if (key && (key.startsWith('webx11_config_') || key === 'webx11_ollama_endpoint' || key === 'webx11_ollama_model' || key.startsWith('webx11_security_') || key === 'webx11_terminal_config' || key === 'webx11_font_size' || key === 'webx11_active_theme' || key === 'webx11_themes' || key === 'webx11_model_params' || key.startsWith('webx11_validator_') || key === 'webx11_optimization_enabled' || key === 'webx11_stream_enabled' || key === 'webx11_smart_prompt' || key === 'webx11_config_ai_sound' || key === 'webx11_welcome_dismissed')) {
+ toRemove.push(key);
+ }
+ }
+ toRemove.forEach(k => localStorage.removeItem(k));
+ }
+
+ _resetAll() {
+ // Delete session backups so they don't resurrect
+ try {
+ this.terminal.fs.deleteFile('_sessions/_auto.json');
+ this.terminal.fs.deleteFile('_sessions/_auto-context.json');
+ this.terminal.fs.reset();
+ } catch (e) { console.warn('reset all FS cleanup:', e); }
+ // Wipe ALL webx11_ prefixed keys
+ for (let i = localStorage.length - 1; i >= 0; i--) {
+ const key = localStorage.key(i);
+ if (key && key.startsWith('webx11_')) localStorage.removeItem(key);
+ }
+ // Also wipe non-prefixed keys used by modules
+ const extraKeys = ['vaultmind_token', 'cslite_messages', 'webx11_chat_settings', 'webx11_chat_logs', 'webx11_chat_api'];
+ extraKeys.forEach(k => localStorage.removeItem(k));
+ this.terminal.outputContainer.innerHTML = '';
+ }
+
_autoRotateLogs(force = false) {
try {
const content = this.terminal.fs.readFile('/logs/current.log') || '';
@@ -570,7 +693,7 @@
FileSystemModule: '📁 Filesystem',
WebX11AIAssistantModule: '🤖 AI',
WebXAIAliasModule: '🌐 WebX',
- DuckDuckGoModule: '🔍 Search & Web',
+
SearXNGModule: '🔍 Search & Web',
WebFetcherModule: '🔍 Search & Web',
AliasModule: '🔧 Tools',
@@ -595,18 +718,18 @@
NeuralVFSModule: '🧠 Neural VFS',
SkillPackCoreModule: '📚 Skills',
ConfigManagerModule: '⚙️ Config',
- ModuleIOModule: '🔌 I/O',
+
SandboxModule: '🏖️ Sandbox',
- MyModule: '💾 Data',
+
WebDAVModule: '🧰 Extras',
ChatStudioModule: '🧰 Extras',
SimpleGUIModule: '🖥️ GUI',
SecretVault: '🔒 Vault',
OrchestratorModule: '🧠 Orchestrator',
PredictorModule: '🔮 Prediction',
- SmartContextModule: '🧠 Context',
+
MemoryGraphModule: '📊 Memory',
- DynamicPromptsModule: '💬 Prompts',
+
WorldModelModule: '🌍 World',
LeaseModule: '🔐 Leases',
AgentRegistryModule: '🤖 Agents',