diff options
Diffstat (limited to 'modules/core/core-bundle.js')
| -rw-r--r-- | modules/core/core-bundle.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/modules/core/core-bundle.js b/modules/core/core-bundle.js index fcf1505..9682596 100644 --- a/modules/core/core-bundle.js +++ b/modules/core/core-bundle.js @@ -2788,6 +2788,11 @@ Only output XML function calls for tool tasks. If no tool is needed, answer norm return null; } async checkAndRun(rawInput) { + // v4.6.130: keep the untokenised line for the command itself. _parseArgs turns + // quote characters into delimiters and drops them, so `js "abc".toUpperCase()` + // reaches the module as `abc.toUpperCase()` and every string literal dies. + // Security classification still runs on the tokenised form below. + this._currentRaw = rawInput; const badOp = this.detectComposition(rawInput); if (badOp) { this.terminal.print('⚠️ No shell here — `' + badOp + '` is not interpreted. ' + @@ -2870,7 +2875,7 @@ Only output XML function calls for tool tasks. If no tool is needed, answer norm return this._dispatch(cmd, args); } async _dispatch(cmd, args) { - return this.terminal.dispatchCommand(cmd, args); + return this.terminal.dispatchCommand(cmd, args, this._currentRaw || null); } async _tryAIRoute(rawInput) { // AI routing cooldown guard @@ -4215,7 +4220,10 @@ Only output XML function calls for tool tasks. If no tool is needed, answer norm } return trimmed; } - async dispatchCommand(cmd, args) { + // rawText (v4.6.130): the untokenised command line, when the call came from the + // terminal. Commands that need their delimiters (`js`, `node -e`) read it; every + // other command keeps using `args` and ignores the extra parameter. + async dispatchCommand(cmd, args, rawText) { if (cmd === 'clear') { this.clearOutput(); return; } if (cmd === 'expand') { this.toggleExpand(); return; } if (cmd === 'sysmsg') { this.toggleSystemMessages(args[0]); return; } @@ -4522,7 +4530,7 @@ Only output XML function calls for tool tasks. If no tool is needed, answer norm if (typeof _m.onCommandStart === 'function') { try { _m.onCommandStart(cmd, args); } catch (_e) {} } } } - try { await mod.commands[cmd](args); + try { await mod.commands[cmd](args, rawText); if (cmd !== 'tutorial' && cmd !== 'course') { for (const _m of Object.values(this.moduleManager.modules)) { if (typeof _m.onCommandExecuted === 'function') { try { _m.onCommandExecuted(cmd, args); } catch (_e) {} } |