diff options
Diffstat (limited to 'modules/core/module-aiassist.js')
| -rw-r--r-- | modules/core/module-aiassist.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/core/module-aiassist.js b/modules/core/module-aiassist.js index 73078d0..e134d69 100644 --- a/modules/core/module-aiassist.js +++ b/modules/core/module-aiassist.js @@ -2259,7 +2259,10 @@ buildSystemPrompt() { const originalPrint = this.terminal.print.bind(this.terminal); let output = ''; this.terminal.print = (text, type) => { output += text + '\n'; }; - try { await this.terminal.security.checkAndRun(cmd); } finally { this.terminal.print = originalPrint; } + // Flag security so unknown commands return an error instead of routing back to AI (loop guard) + const prevAiFlag = this.terminal.security._aiToolCall; + this.terminal.security._aiToolCall = true; + try { await this.terminal.security.checkAndRun(cmd); } finally { this.terminal.security._aiToolCall = prevAiFlag; this.terminal.print = originalPrint; } // 📸 Diff and append shadow report const shadowDiff = this._diffShadowVFS(); if (shadowDiff && shadowDiff.length > 0) { |