/** * Claude Code, logged in on this machine, as a provider (2026-11-13, the person: an option to use Claude logged in * locally, picked in the AI assistant like any other model). For development: the dev server only, on the account of * whoever logged in the `claude` CLI here -- never a product's server, which has neither (aiProviderAvailable). * * Called as an API is: our system prompt alone (Claude Code's own replaced), no Claude Code tools, no settings, no * memory, a fresh empty folder, no session kept -- one stateless request per call. Pictures are not carried. * * ── How a tool is called (2026-11-14) ────────────────────────────────────────────────────────────────────────────── * The CLI has no request with tools in it, as an API has. Two ways stand in for it, and the loop sees no difference: * * native (the default) The turn's tools are listed to the CLI by an MCP server that runs none of them * (claude-code-tools-mcp.ts). The model calls them as it calls any tool; its first turn is read from the * stream and the request ends there (--max-turns 1). What a call does is the loop's business. * schema Without MCP -- chosen (toolCalls: 'schema', or AI_CLAUDE_CODE_TOOL_CALLS=schema), or when the tool server * does not connect. The answer is held to a JSON schema: the calls to make and the words to say. * * Measured on the dock's own prompt and tools, opus, sonnet and haiku, 8 requests each (2026-11-14): native 24 of 24, * 3-4 s a turn; schema 17 of 24, 8-16 s -- held to the schema, the model still tried to call the listed tools itself, * was told there were none, and answered that it could not look. Asked for JSON in the prompt alone (the way before), * it wrote its calls in prose, in tags, as a bare list: each one a call lost and an empty bubble. */ import { type ChildProcessWithoutNullStreams } from 'child_process'; import type { AIClient, AIClientConfig } from '../types.js'; export interface ClaudeCodeRunner { (args: string[], input: string, cwd: string, signal?: AbortSignal): Promise; } /** * The `claude` CLI started in a folder, as every caller on this server starts it -- this provider, and the figure agent * that runs it with the figure MCP server (figure-service). */ export declare function startClaudeCode(args: string[], cwd: string, env?: NodeJS.ProcessEnv): ChildProcessWithoutNullStreams; /** * Offered only where it can answer and where it belongs: a development server whose machine has the `claude` CLI * logged in. A production server is never one (NODE_ENV production), and has no logged-in CLI either. */ export declare function claudeCodeAvailable(): boolean; export declare function createClaudeCodeClient(config: AIClientConfig, runner?: ClaudeCodeRunner): AIClient;