Files
gnoma/internal/provider/subprocess/testdata/claude.jsonl
T
vikingowl 44d0bdc032 feat(provider): subprocess CLI provider for claude, gemini, vibe
Adds internal/provider/subprocess — a provider.Provider that spawns CLI
agents (claude, gemini, vibe) as subprocesses and streams their output.

- FormatParser interface + three parsers for claude-stream-json,
  gemini-stream-json, and vibe-streaming formats; fixtures captured from
  real binaries
- subprocessStream: pull-based stream.Stream over subprocess stdout with
  bounded stderr capture (8KB) and guarded reap() to prevent double-Wait
- DiscoverCLIAgents: parallel PATH scan with 10s timeout, stable ordering
- Provider: only the last user message is passed as --prompt; all other
  request fields (history, tools, system prompt) are intentionally ignored
  (see package doc)
- main.go: discover and register CLI arms at startup; TODO(P0c) for
  tier-based routing to enforce preference order explicitly
2026-05-07 14:29:34 +02:00

5 lines
1.3 KiB
JSON

{"type":"system","subtype":"init","cwd":"/home/user/project","session_id":"8ae89dc8","tools":["Bash","Read"],"mcp_servers":[],"model":"claude-sonnet-4-6","permissionMode":"default","apiKeySource":"none","claude_code_version":"2.1.131","uuid":"549e7847"}
{"type":"assistant","message":{"model":"claude-sonnet-4-6","id":"msg_01SRH","type":"message","role":"assistant","content":[{"type":"text","text":"hi"}],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":3,"cache_creation_input_tokens":11062,"cache_read_input_tokens":12372,"output_tokens":1,"service_tier":"standard"},"context_management":null},"parent_tool_use_id":null,"session_id":"8ae89dc8","uuid":"97ab5bd6"}
{"type":"rate_limit_event","rate_limit_info":{"status":"allowed_warning","rateLimitType":"seven_day","utilization":0.76},"uuid":"12249404","session_id":"8ae89dc8"}
{"type":"result","subtype":"success","is_error":false,"duration_ms":1989,"duration_api_ms":1856,"num_turns":1,"result":"hi","stop_reason":"end_turn","session_id":"8ae89dc8","total_cost_usd":0.045,"usage":{"input_tokens":3,"cache_creation_input_tokens":11062,"cache_read_input_tokens":12372,"output_tokens":4,"service_tier":"standard"},"modelUsage":{"claude-sonnet-4-6":{"inputTokens":3,"outputTokens":4}},"terminal_reason":"completed","uuid":"cd4fcb02"}