aboutsummaryrefslogtreecommitdiff
path: root/modules/core/module-aiassist.js
diff options
context:
space:
mode:
authorAgando <roduccomm@gmail.com>2026-06-18 18:00:54 +0200
committerAgando <roduccomm@gmail.com>2026-06-18 18:00:54 +0200
commit0eca39021874a673933ebb82b973002b682e7a4b (patch)
treedbfbb685e40d10e6255e68629b72194b23709854 /modules/core/module-aiassist.js
parentfba6df22dae297c89fa0df065628dddded66c69c (diff)
auto: 2026-06-18_18:00 changes
Diffstat (limited to 'modules/core/module-aiassist.js')
-rw-r--r--modules/core/module-aiassist.js46
1 files changed, 33 insertions, 13 deletions
diff --git a/modules/core/module-aiassist.js b/modules/core/module-aiassist.js
index ee36789..c58bab3 100644
--- a/modules/core/module-aiassist.js
+++ b/modules/core/module-aiassist.js
@@ -82,7 +82,8 @@ buildSystemPrompt() {
+ 'VFS→Modules→AI. nvfs-index for commands. Tool→Observe→Answer. nvfs-resolve. Destructive cmds need confirm.\n'
+ 'FS: list/read/write/delete | NVFS: nvfs-resolve | Web: search/fetch [POST=method+body] | Mod: view/edit/test/reload | Config | Skills | VaultMind: vaultmind_connect(network) — connect wallet, vaultmind_status — check session, vaultmind_query(ep,msg,agent) — Hyperliquid prices/portfolio/chat | wallet_lookup(address) — read-only portfolio for any wallet\n'
+ 'web_fetch tool: GET for normal pages (returns title+content+word_count), POST for JSON APIs like Hyperliquid /info (pass method="POST" and body as JSON string).\n'
- + 'Other: floating, webdav, cron, vault, sandbox, agents, wpm, mindmap, memgraph, guardrail, wget, tar, secret-* — discoverable via help';
+ + 'Other: floating, webdav, cron, vault, sandbox, agents, wpm, mindmap, memgraph, guardrail, wget, tar, secret-* — discoverable via help. '
+ + 'JS: node <file.js> executes JS from VFS (alias for js-run), node -e "expr" for inline eval. No real Node.js runtime — browser JS only.';
if (profilePrompt) {
base = profilePrompt + '\n\n' + base;
}
@@ -507,6 +508,8 @@ buildSystemPrompt() {
'ai-stop': 'ai-stop — Cancel current AI operation',
'ai-model': 'ai-model [model] — Show or set AI model',
'ai-config': 'ai-config [key] [value] — View or set AI loop config (max-turns, max-context, confirm-timeout(0=disabled))',
+ 'debug': 'debug — Toggle system debug console (logs, fetch, errors)',
+ 'debug-ai': 'debug-ai — Toggle AI tool-call debug panel',
'mem-debug': 'mem-debug — Show memory breakdown by component',
'reset-mem': 'reset-mem — Reset AI memory (logs, context, profile, guardrails) without losing VFS or config',
'vaultmind-connect': 'vaultmind-connect [testnet|mainnet] — Connect VaultMind wallet using hyperliquid_key from SecretVault',
@@ -526,7 +529,8 @@ buildSystemPrompt() {
this.commands['ai-model'] = (args) => this.showModel(args);
this.commands['ai-compress'] = () => this._manualCompress();
this.commands['ai-config'] = (args) => this.aiConfig(args);
- this.commands['debug'] = () => this.toggleDebug();
+ this.commands['debug'] = () => this.toggleDebugPanel();
+ this.commands['debug-ai'] = () => this.toggleDebug();
this.commands['guardrail'] = (args) => this.guardrailCmd(args);
this.commands['guardrail-add'] = (args) => this.guardrailCmd(['add', ...args]);
this.commands['guardrail-remove'] = (args) => this.guardrailCmd(['remove', ...args]);
@@ -692,7 +696,7 @@ buildSystemPrompt() {
}
_updateDebugPanel() {
if (!this._debugPanelEnabled) return;
- const panel = document.getElementById('debug-panel');
+ const panel = document.getElementById('debug-ai-panel');
if (!panel) return;
const recent = this._toolCallLog.slice(-20);
let html = '';
@@ -713,7 +717,7 @@ buildSystemPrompt() {
'<button onclick="var m=webx11.moduleManager.modules.WebX11AIAssistantModule;if(m){var t=m._toolCallLog.map(function(e){return\'#\'+e.turn+\' \'+e.name+\' (\'+e.duration+\'s)\'+(e.error?\' ⚠️\':\'\')+\'\\n\'+JSON.stringify(e.args).substring(0,80)}).join(\'\\n\\n\');navigator.clipboard.writeText(t).then(function(){m.terminal&&m.terminal.print(\'📋 Debug log copied to clipboard\',\'success\')}).catch(function(){prompt(\'Copy debug log:\',t)})}" style="background:var(--bg-tertiary);border:1px solid var(--border-color);color:var(--text-color);padding:2px 6px;border-radius:3px;cursor:pointer;font-size:0.75em;min-height:24px;">📋</button>' +
'<button onclick="var m=webx11.moduleManager.modules.WebX11AIAssistantModule;if(m){var json=JSON.stringify(m._toolCallLog,null,2);var b=new Blob([json],{type:\'application/json\'});var u=URL.createObjectURL(b);var a=document.createElement(\'a\');a.href=u;a.download=\'debug-log-\'+new Date().toISOString().slice(0,19)+\'.json\';document.body.appendChild(a);a.click();setTimeout(function(){document.body.removeChild(a);URL.revokeObjectURL(u)},2000);m.terminal&&m.terminal.print(\'📥 Debug log exported\',\'success\')}" style="background:var(--bg-tertiary);border:1px solid var(--border-color);color:var(--text-color);padding:2px 6px;border-radius:3px;cursor:pointer;font-size:0.75em;min-height:24px;">📥</button>' +
'<button onclick="var m=webx11.moduleManager.modules.WebX11AIAssistantModule;if(m){var existing=[];var raw=m.terminal.fs.readFile(\'/debug.log\');if(raw){try{existing=JSON.parse(raw);}catch(e){}}var log=m._toolCallLog;var seen={};existing.forEach(function(e){seen[e.turn]=true;});log.forEach(function(e){if(!seen[e.turn]){existing.push(e);seen[e.turn]=true;}});var json=JSON.stringify(existing,null,2);m.terminal.fs.writeFile(\'/debug.log\',json);m.terminal.print(\'💾 Debug log appended — \'+existing.length+\' entries total\',\'success\')}" style="background:var(--bg-tertiary);border:1px solid var(--border-color);color:var(--text-color);padding:2px 6px;border-radius:3px;cursor:pointer;font-size:0.75em;min-height:24px;">💾</button>' +
- '<span style="cursor:pointer;color:var(--text-muted);font-size:1.1em;touch-action:manipulation;" onclick="var p=document.getElementById(\'debug-panel\');if(p)p.style.display=\'none\';var a=window.webx11&&webx11.moduleManager&&webx11.moduleManager.modules&&webx11.moduleManager.modules.WebX11AIAssistantModule;if(a)a._debugPanelEnabled=false;">✕</span>' +
+ '<span style="cursor:pointer;color:var(--text-muted);font-size:1.1em;touch-action:manipulation;" onclick="var p=document.getElementById(\'debug-ai-panel\');if(p)p.style.display=\'none\';var a=window.webx11&&webx11.moduleManager&&webx11.moduleManager.modules&&webx11.moduleManager.modules.WebX11AIAssistantModule;if(a)a._debugPanelEnabled=false;">✕</span>' +
'</span></div>' + html;
}
_isToolError(result) {
@@ -1145,24 +1149,32 @@ buildSystemPrompt() {
// Immediately reset UI so user knows it stopped
this.terminal.setAiBusy(false);
}
+ toggleDebugPanel() {
+ const mod = this.terminal.moduleManager.modules['DebugPanel'];
+ if (mod) {
+ mod.terminal = this.terminal;
+ if (!mod._seeded) {
+ mod._seeded = true;
+ mod.seed();
+ }
+ mod.toggle();
+ } else {
+ this.terminal.print('Debug panel not loaded. Run: module load debug-panel', 'warning');
+ }
+ }
toggleDebug() {
this._debugPanelEnabled = !this._debugPanelEnabled;
- let panel = document.getElementById('debug-panel');
+ let panel = document.getElementById('debug-ai-panel');
if (!panel) {
- // Create the debug panel
panel = document.createElement('div');
- panel.id = 'debug-panel';
+ panel.id = 'debug-ai-panel';
panel.style.cssText = 'position:fixed;right:10px;top:50px;width:340px;max-height:350px;overflow-y:auto;background:#0a0a0a;border:1px solid #333;border-radius:6px;z-index:100;font-family:monospace;font-size:0.75em;display:none;';
document.body.appendChild(panel);
- // Add close button handler
- panel.addEventListener('click', function() {
- // Toggle collapsed/expanded state
- });
}
panel.style.display = this._debugPanelEnabled ? 'block' : 'none';
if (this._debugPanelEnabled) {
this._updateDebugPanel();
- this.terminal.print('🔧 Debug panel enabled — shows tool call log in bottom-right corner. Close with: debug', 'info');
+ this.terminal.print('🔧 AI debug panel enabled — shows tool call log. Close with: debug-ai', 'info');
} else {
this.terminal.print('🔧 Debug panel disabled', 'info');
}
@@ -1444,7 +1456,15 @@ buildSystemPrompt() {
'system-health','modules','listmods','modules-list','get-help-info','alias',
'nvfs-index','nvfs-status','nvfs-resolve','nvfs-tree','nvfs-config','nvfs-alias','nvfs-sync',
'floating-add','floating-remove','floating-list','floating-pos','floating-clear','floating-toggle',
- 'mem-debug','reset-mem']);
+ 'debug','debug-ai','session-new','mem-debug','reset-mem',
+ // Node bridge — alias for js-run
+ 'node',
+ // Synced from terminal whitelist — read-only orchestration/A2A/agent commands
+ 'orchestrate','orchestrate-parallel','orchestrate-decompose','orchestrate-result',
+ 'orchestrator-status','orchestrator-list','orchestrator-config','orchestrator-restart-policy',
+ 'a2a-list','a2a-status','a2a-poll',
+ 'consensus','consensus-status','consensus-history',
+ 'pipeline','agent-list','agent-status','contract-list']);
return !safeRead.has(cmd);
}
return ['write_file','delete_file','make_directory','edit_module','delegate_task','spawn_agent','create_skill','patch_skill','wpm_install','user_set','session_save'].includes(name);