claude-agent-sdk 0.0.23__py3-none-any.whl → 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of claude-agent-sdk might be problematic. Click here for more details.
- claude_agent_sdk/_internal/transport/subprocess_cli.py +11 -14
- claude_agent_sdk/_version.py +1 -1
- claude_agent_sdk/types.py +1 -0
- {claude_agent_sdk-0.0.23.dist-info → claude_agent_sdk-0.1.0.dist-info}/METADATA +1 -1
- {claude_agent_sdk-0.0.23.dist-info → claude_agent_sdk-0.1.0.dist-info}/RECORD +7 -7
- {claude_agent_sdk-0.0.23.dist-info → claude_agent_sdk-0.1.0.dist-info}/WHEEL +0 -0
- {claude_agent_sdk-0.0.23.dist-info → claude_agent_sdk-0.1.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -24,7 +24,7 @@ from . import Transport
|
|
|
24
24
|
|
|
25
25
|
logger = logging.getLogger(__name__)
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
_DEFAULT_MAX_BUFFER_SIZE = 1024 * 1024 # 1MB buffer limit
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
class SubprocessCLITransport(Transport):
|
|
@@ -48,6 +48,11 @@ class SubprocessCLITransport(Transport):
|
|
|
48
48
|
self._stderr_task_group: anyio.abc.TaskGroup | None = None
|
|
49
49
|
self._ready = False
|
|
50
50
|
self._exit_error: Exception | None = None # Track process exit errors
|
|
51
|
+
self._max_buffer_size = (
|
|
52
|
+
options.max_buffer_size
|
|
53
|
+
if options.max_buffer_size is not None
|
|
54
|
+
else _DEFAULT_MAX_BUFFER_SIZE
|
|
55
|
+
)
|
|
51
56
|
|
|
52
57
|
def _find_cli(self) -> str:
|
|
53
58
|
"""Find Claude Code CLI binary."""
|
|
@@ -66,15 +71,6 @@ class SubprocessCLITransport(Transport):
|
|
|
66
71
|
if path.exists() and path.is_file():
|
|
67
72
|
return str(path)
|
|
68
73
|
|
|
69
|
-
node_installed = shutil.which("node") is not None
|
|
70
|
-
|
|
71
|
-
if not node_installed:
|
|
72
|
-
error_msg = "Claude Code requires Node.js, which is not installed.\n\n"
|
|
73
|
-
error_msg += "Install Node.js from: https://nodejs.org/\n"
|
|
74
|
-
error_msg += "\nAfter installing Node.js, install Claude Code:\n"
|
|
75
|
-
error_msg += " npm install -g @anthropic-ai/claude-code"
|
|
76
|
-
raise CLINotFoundError(error_msg)
|
|
77
|
-
|
|
78
74
|
raise CLINotFoundError(
|
|
79
75
|
"Claude Code not found. Install with:\n"
|
|
80
76
|
" npm install -g @anthropic-ai/claude-code\n"
|
|
@@ -411,12 +407,13 @@ class SubprocessCLITransport(Transport):
|
|
|
411
407
|
# Keep accumulating partial JSON until we can parse it
|
|
412
408
|
json_buffer += json_line
|
|
413
409
|
|
|
414
|
-
if len(json_buffer) >
|
|
410
|
+
if len(json_buffer) > self._max_buffer_size:
|
|
411
|
+
buffer_length = len(json_buffer)
|
|
415
412
|
json_buffer = ""
|
|
416
413
|
raise SDKJSONDecodeError(
|
|
417
|
-
f"JSON message exceeded maximum buffer size of {
|
|
414
|
+
f"JSON message exceeded maximum buffer size of {self._max_buffer_size} bytes",
|
|
418
415
|
ValueError(
|
|
419
|
-
f"Buffer size {
|
|
416
|
+
f"Buffer size {buffer_length} exceeds limit {self._max_buffer_size}"
|
|
420
417
|
),
|
|
421
418
|
)
|
|
422
419
|
|
|
@@ -427,7 +424,7 @@ class SubprocessCLITransport(Transport):
|
|
|
427
424
|
except json.JSONDecodeError:
|
|
428
425
|
# We are speculatively decoding the buffer until we get
|
|
429
426
|
# a full JSON object. If there is an actual issue, we
|
|
430
|
-
# raise an error after
|
|
427
|
+
# raise an error after exceeding the configured limit.
|
|
431
428
|
continue
|
|
432
429
|
|
|
433
430
|
except anyio.ClosedResourceError:
|
claude_agent_sdk/_version.py
CHANGED
claude_agent_sdk/types.py
CHANGED
|
@@ -320,6 +320,7 @@ class ClaudeAgentOptions:
|
|
|
320
320
|
extra_args: dict[str, str | None] = field(
|
|
321
321
|
default_factory=dict
|
|
322
322
|
) # Pass arbitrary CLI flags
|
|
323
|
+
max_buffer_size: int | None = None # Max bytes when buffering CLI stdout
|
|
323
324
|
debug_stderr: Any = (
|
|
324
325
|
sys.stderr
|
|
325
326
|
) # Deprecated: File-like object for debug output. Use stderr callback instead.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: claude-agent-sdk
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 0.1.0
|
|
4
4
|
Summary: Python SDK for Claude Code
|
|
5
5
|
Project-URL: Homepage, https://github.com/anthropics/claude-agent-sdk-python
|
|
6
6
|
Project-URL: Documentation, https://docs.anthropic.com/en/docs/claude-code/sdk
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
claude_agent_sdk/__init__.py,sha256=ZwJ2YpPdvDRdg1j73TGmK5FEfriv00MbgB5GbEkgqEs,11584
|
|
2
2
|
claude_agent_sdk/_errors.py,sha256=nSdJNNeszvXG1PfnXd2sQpVNORqMct-MfPaiM3XeJL4,1579
|
|
3
|
-
claude_agent_sdk/_version.py,sha256=
|
|
3
|
+
claude_agent_sdk/_version.py,sha256=y3fGkmFOHX0HMqiV3jjJZcCsNcfH9UfbiJ_Kp0cc-Eo,71
|
|
4
4
|
claude_agent_sdk/client.py,sha256=je82F2J_BtB9Gh4PRUcjeTI1wrYVENMsAasOaUkO-3Y,13613
|
|
5
5
|
claude_agent_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
claude_agent_sdk/query.py,sha256=WebhztsMZPdaxyy1LBEZv4_j23vjp_ceX9DtrBsZqCA,4530
|
|
7
|
-
claude_agent_sdk/types.py,sha256=
|
|
7
|
+
claude_agent_sdk/types.py,sha256=xYpyg3_nTXAHclsitZI7wr2pLbbjWTwJ5gPYrBOwjaQ,10525
|
|
8
8
|
claude_agent_sdk/_internal/__init__.py,sha256=zDdgjqp8SI9mTnwZbP2Be-w4LWlv4a3kA-TS2i75jsM,39
|
|
9
9
|
claude_agent_sdk/_internal/client.py,sha256=Z06Fj4t5mHkKHKBUwxmHMTEo7lzs3X4_D_c-xq6Wg4I,4603
|
|
10
10
|
claude_agent_sdk/_internal/message_parser.py,sha256=xxpOU3E8X21FCoy2OtLWKfEQr3AFYM454qJt6Xa0tmc,6475
|
|
11
11
|
claude_agent_sdk/_internal/query.py,sha256=G2CxNrMhrmae2V9oh8ctJsWIFOCU2VEkBQvH1-nXC6w,20721
|
|
12
12
|
claude_agent_sdk/_internal/transport/__init__.py,sha256=sv8Iy1b9YmPlXu4XsdN98gJIlyrLtwq8PKQyF4qnQLk,1978
|
|
13
|
-
claude_agent_sdk/_internal/transport/subprocess_cli.py,sha256
|
|
14
|
-
claude_agent_sdk-0.0.
|
|
15
|
-
claude_agent_sdk-0.0.
|
|
16
|
-
claude_agent_sdk-0.0.
|
|
17
|
-
claude_agent_sdk-0.0.
|
|
13
|
+
claude_agent_sdk/_internal/transport/subprocess_cli.py,sha256=-0SeZihO871cS10GmK7QDjrrbBHK_COFvbWGL25_0pY,17229
|
|
14
|
+
claude_agent_sdk-0.1.0.dist-info/METADATA,sha256=O8QGZfCu-C7SzZAAgjdFQwgKkjB_Tx0LviP0Cdt1KuA,9241
|
|
15
|
+
claude_agent_sdk-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
16
|
+
claude_agent_sdk-0.1.0.dist-info/licenses/LICENSE,sha256=zr3eio-57lnl6q7RlXi_gIWqcEdWIlnDHzjyJcJvaBI,1070
|
|
17
|
+
claude_agent_sdk-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|