fix: respect toolsEnabled config for CLI backends [AI-assisted]

Add `toolsEnabled` option to `CliBackendConfig` that controls whether
the "Tools are disabled" system prompt is injected for CLI backends.

When `toolsEnabled: true`, the backend is assumed to have its own tool
handling (e.g., Claude CLI with --allowedTools), so we skip the
misleading "Tools are disabled" message.

Default behavior is unchanged (toolsEnabled defaults to false).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Ryan McMillan 2026-01-28 13:54:04 -06:00
parent 109ac1c549
commit 801bf9e6a8
2 changed files with 4 additions and 1 deletions

View File

@ -65,7 +65,8 @@ export async function runCliAgent(params: {
const extraSystemPrompt = [
params.extraSystemPrompt?.trim(),
"Tools are disabled in this session. Do not call tools.",
// Only add "tools disabled" message if tools aren't enabled for this backend
backend.toolsEnabled ? undefined : "Tools are disabled in this session. Do not call tools.",
]
.filter(Boolean)
.join("\n");

View File

@ -89,6 +89,8 @@ export type CliBackendConfig = {
imageMode?: "repeat" | "list";
/** Serialize runs for this CLI. */
serialize?: boolean;
/** Whether tools are enabled for this CLI backend (default: false). */
toolsEnabled?: boolean;
};
export type AgentDefaultsConfig = {