Commit graph

12 commits

Author SHA1 Message Date
Lina Tawfik
8233533148
Add comment explaining JSON buffer accumulation logic 2025-06-30 23:00:54 -07:00
Lina Tawfik
1791031d20
chore: Remove obvious comments from code
Removed redundant comments that simply restate what the code is doing.
Kept only comments that provide valuable context or explain complex behavior.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-30 22:27:48 -07:00
Lina Tawfik
3ab62b617d
fix: Pass proper Exception to CLIJSONDecodeError
The CLIJSONDecodeError constructor expects an Exception as the second
argument, not None. Changed to pass a ValueError with details about
the buffer size limit being exceeded.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-30 22:02:02 -07:00
Lina Tawfik
977bf6438b
style: apply ruff formatting 2025-06-30 21:58:37 -07:00
Lina Tawfik
24295417ac
fix: handle JSON messages split across multiple stream reads
Adds buffering to accumulate incomplete JSON messages that are split
across multiple stream reads due to asyncio's 64KB default buffer limit.

- Implement 1MB buffer to accumulate partial JSON
- Clear buffer on successful parse or size limit exceeded
- Add comprehensive tests for split JSON scenarios

Fixes CLIJSONDecodeError when reading large minified JSON files.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-30 21:55:06 -07:00
Lina Tawfik
91e02f1a0a
chore: bump version to 0.0.13
- Updated version in pyproject.toml
- Updated version in src/claude_code_sdk/__init__.py

This version has been published to PyPI.
2025-06-27 18:21:23 -07:00
Lina Tawfik
9bda4e8982
Merge pull request #5 from Bradley-Butcher/fix/subprocess-buffering-issue
fix multi-line buffering issue
2025-06-27 15:33:29 -07:00
Dickson Tsai
242c7197b6
Update MCP types to align with what Claude Code expects 2025-06-25 00:59:44 -07:00
Bradley-Butcher
87e2699f6a
fix multi-line buffering issue
Signed-off-by: Bradley-Butcher <brad@phoebe.ai>
2025-06-19 11:39:44 +01:00
Lina Tawfik
6cc5b34d54
Fix: Remove cost_usd field and handle GeneratorExit
The CLI only sends total_cost_usd, not cost_usd. This PR:

- Removes the non-existent cost_usd field from ResultMessage
- Makes total_cost_usd optional since it may be missing
- Handles GeneratorExit gracefully in subprocess transport
- Removes unnecessary cancel scope call

Fixes the error users were experiencing:
- KeyError: 'cost_usd'
- Field required [type=missing, input_value=...]

The anyio cancel scope error still appears in logs but doesn't affect functionality.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-17 16:38:52 -07:00
Lina Tawfik
63ef121e18
Fix code formatting for CI 2025-06-12 00:20:28 -07:00
Lina Tawfik
6ca3514261
Initial Python SDK import 2025-06-12 00:16:19 -07:00