//#region src/computer-use/action.d.ts /** * Computer-use action schema — single source of truth. * * The sidecar's REST/MCP routes accept this union; provider translators * (Anthropic `computer`, OpenAI `computer_use_preview`) emit it. Keeping * the type, validator, and key alias table in one place prevents the * three-way drift that previously existed across sidecar + claude-code * provider + ad-hoc dispatchers. */ type MouseButton = "left" | "middle" | "right"; type ComputerUseAction = { type: "screenshot"; } | { type: "cursor_position"; } | { type: "click"; x: number; y: number; button?: MouseButton; } | { type: "double_click"; x: number; y: number; } | { type: "move"; x: number; y: number; } | { type: "drag"; from: { x: number; y: number; }; to: { x: number; y: number; }; } | { type: "type"; text: string; delayMs?: number; } | { type: "keypress"; keys: string[]; } | { type: "scroll"; x: number; y: number; deltaY?: number; deltaX?: number; } | { type: "wait"; ms: number; }; type ComputerUseActionType = ComputerUseAction["type"]; declare class ComputerUseError extends Error { readonly code: string; constructor(message: string, code?: string); } /** * Provider-agnostic translation error. Both the Anthropic and OpenAI * translators throw this; the sandbox API and MCP server catch it * with `instanceof` to surface the failure as a tool result rather * than a 5xx. */ declare class ComputerActionTranslationError extends Error { readonly code: string; constructor(message: string, code?: string); } /** * Parse and validate an unknown payload into a typed ComputerUseAction. * Throws ComputerUseError with COMPUTER_USE_INVALID_ACTION on any * structural problem. */ declare function parseAction(input: unknown): ComputerUseAction; declare function normalizeKey(key: string): string; //#endregion //#region src/computer-use/anthropic.d.ts interface AnthropicComputerInput { action: string; coordinate?: [number, number]; start_coordinate?: [number, number]; text?: string; scroll_direction?: "up" | "down" | "left" | "right"; scroll_amount?: number; duration?: number; } /** * Translate an Anthropic `computer` tool input into the sidecar action. * Throws `ComputerActionTranslationError` for malformed inputs or * unrecognized action names; the caller should surface the error as a * tool_result with `is_error: true` so the model can react. */ declare function translateAnthropicComputerAction(input: AnthropicComputerInput): ComputerUseAction; //#endregion //#region src/computer-use/openai.d.ts interface OpenAIComputerInput { type: string; x?: number; y?: number; button?: string; text?: string; keys?: string[]; path?: Array<{ x: number; y: number; }>; scroll_x?: number; scroll_y?: number; ms?: number; duration?: number; } /** * Translate an OpenAI `computer_use_preview` action into the sidecar * action. Throws `ComputerActionTranslationError` for unsupported * variants (wheel/back/forward buttons) or malformed inputs. */ declare function translateOpenAIComputerAction(input: OpenAIComputerInput): ComputerUseAction; //#endregion export { type AnthropicComputerInput, ComputerActionTranslationError, type ComputerUseAction, type ComputerUseActionType, ComputerUseError, type MouseButton, type OpenAIComputerInput, normalizeKey, parseAction, translateAnthropicComputerAction, translateOpenAIComputerAction }; //# sourceMappingURL=index.d.ts.map