"""CloudCode adapter — transport-ready stub for Bridge V1.1. WHY REAL MODE IS UNAVAILABLE: Claude Code CLI requires an interactive terminal session and Anthropic API credentials bound to a running Claude Code process. There is no stable programmatic transport (HTTP/IPC) for local Claude Code invocation exposed by the CLI in V1.1. A subprocess approach would require `claude` on PATH with a valid session token, which cannot be assumed in this environment. STUB MODE: Returns a deterministic response that describes what would be sent. The execute() contract is identical to all other adapters, so this can be swapped to a real implementation by replacing the body of execute() once a transport is available (e.g. MCP server, HTTP sidecar, or subprocess). REAL MODE PREREQUISITES (future): - `claude` binary on PATH with active session - OR an HTTP MCP server exposing Claude Code - OR Claude API key with claude-sonnet-4-6 and tool calls """ from __future__ import annotations from adapters.base import AdapterResult MODE = "stub" _UNAVAILABLE_REASON = ( "Claude Code transport not available: no stable programmatic API " "for local Claude Code invocation in V1.1 environment" ) def execute(prompt: str) -> AdapterResult: print("=== THIS ADAPTER IS USED: cloudcode_adapter ===") return AdapterResult( response=( f"[cloudcode-stub] Transport unavailable. " f"Would send {len(prompt)} chars to Claude Code. " f"Reason: {_UNAVAILABLE_REASON}" ), error=None, exit_code=0, mode=MODE, ) def mode() -> str: return MODE def unavailable_reason() -> str: return _UNAVAILABLE_REASON