fix(cli): add model guard and explicit tools:[] for /btw command

Explicitly pass tools:[] to generateContent to prevent tool invocation
in side questions. Add model undefined guard for defensive safety.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Shaojin Wen 2026-03-14 16:44:13 +08:00
parent d285c4409a
commit ed9a4edc40
2 changed files with 32 additions and 2 deletions

View file

@ -45,7 +45,7 @@ async function askBtw(
],
},
],
{},
{ tools: [] },
abortSignal,
model,
);
@ -97,6 +97,14 @@ export const btwCommand: SlashCommand = {
const geminiClient = config.getGeminiClient();
const model = config.getModel();
if (!model) {
return {
type: 'message',
messageType: 'error',
content: t('No model configured.'),
};
}
// ACP mode: return a stream_messages async generator
if (executionMode === 'acp') {
const messages = async function* () {