Readable errors for non-JSON API responses; gitignore test transcripts

This commit is contained in:
Ian Gulliver
2026-10-14 23:02:38 -07:00
parent f5333586fe
commit fbfc3d1923
13 changed files with 12 additions and 111 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
# Claude Code stream-json protocol
How `internal/claude` drives the `claude` CLI. Worked out from the Agent SDKs (`@anthropic-ai/claude-agent-sdk` on npm, `claude-agent-sdk` on PyPI); the Python SDK's `_internal/query.py` and `_internal/transport/subprocess_cli.py` are the most readable references. The CLI version the tests last passed against is in the `system`/`init` event of any transcript under `internal/claude/testdata/transcripts/` (`claude_code_version`).
How `internal/claude` drives the `claude` CLI. Worked out from the Agent SDKs (`@anthropic-ai/claude-agent-sdk` on npm, `claude-agent-sdk` on PyPI); the Python SDK's `_internal/query.py` and `_internal/transport/subprocess_cli.py` are the most readable references. Each test run writes its transcripts to `internal/claude/testdata/transcripts/` (gitignored); the CLI version that run used is `claude_code_version` in the `system`/`init` event of any of them.
Transcripts (`Options.Transcript`) record every line in both directions as `{"dir":"send"|"recv","msg":...}`. The account email from the `initialize` response is replaced with `[redacted]` everywhere it appears.