/** * SDK query options builder. * * Centralizes the construction of query() options, eliminating duplication * between the streaming and non-streaming paths in server.ts. */ import type { Options, SettingSource } from "@anthropic-ai/claude-agent-sdk"; import { createPassthroughMcpServer } from "./passthroughTools"; export interface QueryContext { /** The prompt to send (text or async iterable for multimodal) */ prompt: string | AsyncIterable; /** Resolved Claude model name */ model: string; /** SDK subprocess working directory — must exist on the proxy host. */ workingDirectory: string; /** * Client-local working directory (as reported in the request). May not * exist on the proxy host. When this differs from workingDirectory the * system prompt is augmented with a note directing the model to refer * to file paths using the client's path rather than the proxy's. */ clientWorkingDirectory?: string; /** System context text (may be empty) */ systemContext: string; /** Path to Claude executable */ claudeExecutable: string; /** Whether passthrough mode is enabled */ passthrough: boolean; /** Whether this is a streaming request */ stream: boolean; /** SDK agent definitions extracted from tool descriptions */ sdkAgents: Record; /** Passthrough MCP server (if passthrough mode + tools present) */ passthroughMcp?: ReturnType; /** Cleaned environment variables (API keys stripped) */ cleanEnv: Record; /** Whether any passthrough tools use deferred loading */ hasDeferredTools: boolean; /** SDK session ID for resume (if continuing a session) */ resumeSessionId?: string; /** Whether this is an undo operation */ isUndo: boolean; /** UUID to rollback to for undo operations */ undoRollbackUuid?: string; /** SDK hooks (PreToolUse etc.) */ sdkHooks?: any; /** Blocked SDK built-in tools (from pipeline) */ blockedTools: readonly string[]; /** Agent-incompatible tools (from pipeline) */ incompatibleTools: readonly string[]; /** MCP server name for this adapter */ mcpServerName: string; /** Allowed MCP tools (from pipeline) */ allowedMcpTools: readonly string[]; /** Callback to receive stderr lines from the Claude subprocess */ onStderr?: (line: string) => void; /** Effort level — controls thinking depth (low/medium/high/max) */ effort?: 'low' | 'medium' | 'high' | 'max'; /** Thinking configuration — adaptive, enabled with budget, or disabled */ thinking?: { type: 'adaptive'; } | { type: 'enabled'; budgetTokens?: number; } | { type: 'disabled'; }; /** API-side task budget in tokens — model paces tool use within this limit */ taskBudget?: { total: number; }; /** Beta features to enable */ betas?: string[]; /** SDK setting sources — controls CLAUDE.md and user settings loading */ settingSources?: SettingSource[]; /** Use the Claude Code system prompt preset */ codeSystemPrompt?: boolean; /** Include the client agent's system prompt */ clientSystemPrompt?: boolean; /** Enable auto-memory (read + write across sessions) */ memory?: boolean; /** Enable background memory consolidation (dreaming) */ dreaming?: boolean; /** Share memory directory with Claude Code (~/.claude) */ sharedMemory?: boolean; /** Per-request cost cap in USD */ maxBudgetUsd?: number; /** Fallback model when primary fails */ fallbackModel?: string; /** Enable SDK debug logging */ sdkDebug?: boolean; /** Additional directories Claude can access */ additionalDirectories?: string[]; /** Advisor model for server-side advisor tool support */ advisorModel?: string; } /** * Build the options object for the Claude Agent SDK query() call. * This is called identically from both streaming and non-streaming paths, * with the only difference being `includePartialMessages` for streaming. */ export interface BuildQueryResult { prompt: QueryContext["prompt"]; options: Options; } /** * Build an addendum that tells the model which path belongs to the real user. * Applied when the SDK subprocess runs in one directory on the proxy host but * the client is working in a different directory on their own machine * (typical of a remote Claude Code → network-proxy setup). Without this note * the SDK's env block leaks `sdkCwd` into the model's context and Claude * reports that as its working directory. */ export declare function buildCwdNote(sdkCwd: string, clientCwd?: string): string; export declare function buildQueryOptions(ctx: QueryContext): BuildQueryResult; //# sourceMappingURL=query.d.ts.map