clawd-code-sdk 1.2.8__tar.gz → 1.2.10__tar.gz
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.
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/PKG-INFO +1 -1
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/pyproject.toml +1 -1
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/__init__.py +1 -1
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/client.py +20 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/models/__init__.py +2 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/models/base.py +3 -1
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/models/control.py +12 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/models/input_types.py +6 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/models/messages.py +16 -1
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/models/output_types.py +16 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/models/system_messages.py +4 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/test_sdk_0_3_types.py +57 -0
- clawd_code_sdk-1.2.10/tests/test_session_title.py +51 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/.gitignore +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/LICENSE +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/README.md +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/_bundled/.gitignore +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/_errors.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/_internal/__init__.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/_internal/mcp_compat.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/_internal/query.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/_internal/sdk_mcp_bridge.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/_internal/session_mutations.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/_internal/sessions.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/_internal/transport/__init__.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/_internal/transport/subprocess_cli.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/_internal/transport/subprocess_utils.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/_version.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/anthropic_stream.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/instrumentation.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/list_sessions.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/mcp_utils.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/models/agents.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/models/anthropic_types.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/models/content_blocks.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/models/context_usage.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/models/hooks.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/models/mcp.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/models/options.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/models/permissions.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/models/prompt_requests.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/models/prompts.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/models/server_info.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/models/session.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/models/settings.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/models/thinking.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/models/usage.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/py.typed +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/session.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/storage/ARCHITECTURE.md +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/storage/__init__.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/storage/helpers.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/storage/models.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/storage/replay.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/__init__.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/conftest.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/e2e/__init__.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/e2e/test_agents_and_settings.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/e2e/test_dynamic_control.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/e2e/test_hook_events.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/e2e/test_hooks.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/e2e/test_include_partial_messages.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/e2e/test_mcp_resources.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/e2e/test_mcp_tools.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/e2e/test_sdk_mcp_resources.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/e2e/test_sdk_mcp_tools.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/e2e/test_slash_commands.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/e2e/test_stderr_callback.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/e2e/test_storage_parsing.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/e2e/test_structured_output.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/e2e/test_subagent_invocation.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/e2e/test_tool_permissions.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/mcp_server.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/mock_claude_server.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/test_api_content_blocks.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/test_apply_flag_settings.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/test_changelog.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/test_client.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/test_elicitation_mcp_conversion.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/test_errors.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/test_get_usage.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/test_image.png +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/test_integration.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/test_line_framing.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/test_message_parser.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/test_result_error.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/test_sandbox_settings.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/test_sdk_mcp_integration.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/test_session.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/test_session_mutations.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/test_sessions.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/test_steer.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/test_streaming_client.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/test_subprocess_buffering.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/test_tool_callbacks.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/test_transport.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/tests/test_transport_close.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: clawd-code-sdk
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.10
|
|
4
4
|
Summary: Python SDK for Claude Code
|
|
5
5
|
Project-URL: Documentation, https://github.com/phil65/claude-agent-sdk-python
|
|
6
6
|
Project-URL: Homepage, https://github.com/phil65/claude-agent-sdk-python
|
|
@@ -32,6 +32,7 @@ from clawd_code_sdk.models import (
|
|
|
32
32
|
SDKControlChannelEnableRequest,
|
|
33
33
|
SDKControlClaudeOAuthWaitForCompletionRequest,
|
|
34
34
|
SDKControlEndSessionRequest,
|
|
35
|
+
SDKControlGenerateSessionTitleRequest,
|
|
35
36
|
SDKControlGetBinaryVersionRequest,
|
|
36
37
|
SDKControlGetContextUsageRequest,
|
|
37
38
|
SDKControlGetContextUsageResponse,
|
|
@@ -534,6 +535,25 @@ class ClaudeSDKClient:
|
|
|
534
535
|
request = SDKControlMcpToggleRequest(server_name=server_name, enabled=enabled)
|
|
535
536
|
await query._send_control_request(request)
|
|
536
537
|
|
|
538
|
+
async def generate_session_title(
|
|
539
|
+
self, description: str, *, persist: bool = False
|
|
540
|
+
) -> str | None:
|
|
541
|
+
"""Generate a session title from ``description`` with the CLI's title model.
|
|
542
|
+
|
|
543
|
+
Args:
|
|
544
|
+
description: Text to title (the CLI reads its trailing ~1000 characters).
|
|
545
|
+
persist: Store it as the current session's title; a session that has a title
|
|
546
|
+
already returns that one.
|
|
547
|
+
|
|
548
|
+
Returns:
|
|
549
|
+
The title, or None when the text is too short to title.
|
|
550
|
+
"""
|
|
551
|
+
query = self._ensure_connected()
|
|
552
|
+
request = SDKControlGenerateSessionTitleRequest(description=description, persist=persist)
|
|
553
|
+
result = await query._send_control_request(request)
|
|
554
|
+
title = (result or {}).get("title")
|
|
555
|
+
return title if isinstance(title, str) and title else None
|
|
556
|
+
|
|
537
557
|
async def end_session(self) -> None:
|
|
538
558
|
"""End the current session."""
|
|
539
559
|
query = self._ensure_connected()
|
|
@@ -101,6 +101,7 @@ from .control import (
|
|
|
101
101
|
SDKControlClaudeOAuthWaitForCompletionRequest,
|
|
102
102
|
SDKControlElicitationRequest,
|
|
103
103
|
SDKControlEndSessionRequest,
|
|
104
|
+
SDKControlGenerateSessionTitleRequest,
|
|
104
105
|
SDKControlInitializeRequest,
|
|
105
106
|
SDKControlInterruptRequest,
|
|
106
107
|
SDKControlMcpMessageRequest,
|
|
@@ -767,6 +768,7 @@ __all__ = [
|
|
|
767
768
|
"SDKControlElicitationRequest",
|
|
768
769
|
"SDKControlEndSessionRequest",
|
|
769
770
|
"SDKControlFileSuggestionsRequest",
|
|
771
|
+
"SDKControlGenerateSessionTitleRequest",
|
|
770
772
|
"SDKControlGetBinaryVersionRequest",
|
|
771
773
|
"SDKControlGetContextUsageRequest",
|
|
772
774
|
"SDKControlGetContextUsageResponse",
|
|
@@ -94,7 +94,7 @@ ToolName = Literal[
|
|
|
94
94
|
"PowerShell",
|
|
95
95
|
"Projects",
|
|
96
96
|
"propose_skills",
|
|
97
|
-
"ProposeGoal",
|
|
97
|
+
"ProposeGoal", # Before CLI 2.1.330, which names it SetGoal
|
|
98
98
|
"PushNotification",
|
|
99
99
|
"Read",
|
|
100
100
|
"ReadMcpResourceDirTool",
|
|
@@ -107,6 +107,7 @@ ToolName = Literal[
|
|
|
107
107
|
"SendMessage",
|
|
108
108
|
"SendUserFile",
|
|
109
109
|
"SendUserMessage",
|
|
110
|
+
"SetGoal",
|
|
110
111
|
"ShareOnboardingGuide",
|
|
111
112
|
"ShowOnboardingRolePicker",
|
|
112
113
|
"Skill",
|
|
@@ -193,6 +194,7 @@ StartupFailureReason = Literal[
|
|
|
193
194
|
"initialize_not_first",
|
|
194
195
|
"config_file_invalid",
|
|
195
196
|
"managed_settings_not_delivered",
|
|
197
|
+
"initialize_fields_not_delivered",
|
|
196
198
|
]
|
|
197
199
|
IS_DEV = "pytest" in sys.modules
|
|
198
200
|
SYSTEM_PROMPT_DYNAMIC_BOUNDARY = "__SYSTEM_PROMPT_DYNAMIC_BOUNDARY__"
|
|
@@ -336,6 +336,17 @@ class SDKControlRenameSessionRequest(_ControlBase):
|
|
|
336
336
|
session_id: str | None = None
|
|
337
337
|
|
|
338
338
|
|
|
339
|
+
class SDKControlGenerateSessionTitleRequest(_ControlBase):
|
|
340
|
+
"""Generates a title for a session from a description of it."""
|
|
341
|
+
|
|
342
|
+
subtype: Literal["generate_session_title"] = "generate_session_title"
|
|
343
|
+
description: str
|
|
344
|
+
"""Text to title, e.g. the conversation's latest user and assistant text."""
|
|
345
|
+
persist: bool | None = None
|
|
346
|
+
"""Store the title as the current session's title. A session that has one already
|
|
347
|
+
(the CLI titles new sessions itself) returns it instead of generating another."""
|
|
348
|
+
|
|
349
|
+
|
|
339
350
|
class SDKControlMcpAuthenticateRequest(_ControlBase):
|
|
340
351
|
"""Authenticates with an MCP server."""
|
|
341
352
|
|
|
@@ -824,6 +835,7 @@ OutgoingControlRequest = Annotated[
|
|
|
824
835
|
| SDKControlMcpToggleRequest
|
|
825
836
|
| SDKControlChannelEnableRequest
|
|
826
837
|
| SDKControlRenameSessionRequest
|
|
838
|
+
| SDKControlGenerateSessionTitleRequest
|
|
827
839
|
| SDKControlEndSessionRequest
|
|
828
840
|
| SDKControlMcpAuthenticateRequest
|
|
829
841
|
| SDKControlMcpClearAuthRequest
|
|
@@ -409,6 +409,12 @@ class ReportFindingsFinding(TypedDict):
|
|
|
409
409
|
|
|
410
410
|
"correctness", "simplification", "efficiency", "test-coverage"
|
|
411
411
|
"""
|
|
412
|
+
severity: NotRequired[Literal["important", "pre_existing", "nit"]]
|
|
413
|
+
"""Set when the review instructions ask for it.
|
|
414
|
+
|
|
415
|
+
important: a bug the change adds or makes worse; pre_existing: a bug that was there
|
|
416
|
+
before the change; nit: a minor issue
|
|
417
|
+
"""
|
|
412
418
|
verdict: NotRequired[Literal["CONFIRMED", "PLAUSIBLE"]]
|
|
413
419
|
"""Set when a verify pass ran; absent on inline-only reviews"""
|
|
414
420
|
outcome: NotRequired[Literal["fixed", "skipped", "no_change_needed"]]
|
|
@@ -121,7 +121,14 @@ class TaskNotificationMessageOrigin(ClaudeCodeBaseModel):
|
|
|
121
121
|
|
|
122
122
|
kind: Literal["task-notification"] = "task-notification"
|
|
123
123
|
subkind: (
|
|
124
|
-
Literal[
|
|
124
|
+
Literal[
|
|
125
|
+
"scheduled-trigger",
|
|
126
|
+
"peer-send-message",
|
|
127
|
+
"projects-relay",
|
|
128
|
+
"session-inbox",
|
|
129
|
+
"external-event",
|
|
130
|
+
]
|
|
131
|
+
| None
|
|
125
132
|
) = None
|
|
126
133
|
fire_reason: str | None = None
|
|
127
134
|
run_id: str | None = None
|
|
@@ -572,6 +579,11 @@ class ResultSuccessMessage(BaseResultMessage):
|
|
|
572
579
|
time_to_request_ms: float | None = None
|
|
573
580
|
time_to_request_from_spawn_ms: float | None = None
|
|
574
581
|
request_sent_wall_ms: float | None = None
|
|
582
|
+
first_request_input_tokens: int | None = None
|
|
583
|
+
"""Input tokens (cache reads and writes included) of the model call sent at
|
|
584
|
+
``request_sent_wall_ms``; only with it, and only when above zero (internal, CLI 2.1.330+)."""
|
|
585
|
+
first_request_cache_read_input_tokens: int | None = None
|
|
586
|
+
"""The cache-read part of ``first_request_input_tokens`` (internal, CLI 2.1.330+)."""
|
|
575
587
|
ttft_ms: float | None = None
|
|
576
588
|
ttft_stream_ms: float | None = None
|
|
577
589
|
first_content_frame_ms: float | None = None
|
|
@@ -612,6 +624,9 @@ class StreamEvent(BaseMessage):
|
|
|
612
624
|
"""ID of the API message this event belongs to (undocumented)."""
|
|
613
625
|
thinking_display: str | None = None
|
|
614
626
|
"""Active thinking display mode (undocumented)."""
|
|
627
|
+
owed_rows: list[str] | None = None
|
|
628
|
+
"""Uuids of transcript rows the turn wrote before its first model request that change
|
|
629
|
+
what Claude holds of a claude.ai Project or an attached PDF (internal, CLI 2.1.330+)."""
|
|
615
630
|
|
|
616
631
|
@classmethod
|
|
617
632
|
def block_stop(cls, *, index: int, session_id: str, uuid: str) -> StreamEvent:
|
|
@@ -1066,6 +1066,7 @@ class ArtifactUrlOutput(TypedDict):
|
|
|
1066
1066
|
faviconSent: NotRequired[Literal[True]]
|
|
1067
1067
|
iconDropped: NotRequired[Literal[True]]
|
|
1068
1068
|
audience: NotRequired[str]
|
|
1069
|
+
folder_audience: NotRequired[Literal["others", "unknown"]]
|
|
1069
1070
|
seq: NotRequired[float]
|
|
1070
1071
|
unchanged: NotRequired[Literal[True]]
|
|
1071
1072
|
liveSubscription: NotRequired[str]
|
|
@@ -1750,6 +1751,9 @@ class MonitorOutput(TypedDict):
|
|
|
1750
1751
|
"""Timeout deadline in milliseconds (0 when persistent)."""
|
|
1751
1752
|
persistent: NotRequired[bool]
|
|
1752
1753
|
"""No timeout — runs until TaskStop or session end."""
|
|
1754
|
+
keptInSandboxByCheck: NotRequired[bool]
|
|
1755
|
+
"""True when the command ran in the sandbox only because its permission check relied on
|
|
1756
|
+
the sandbox; the settings would otherwise have exempted it."""
|
|
1753
1757
|
|
|
1754
1758
|
|
|
1755
1759
|
class ProposeSkillsOutput(TypedDict):
|
|
@@ -1809,6 +1813,14 @@ class WorkflowOutput(TypedDict):
|
|
|
1809
1813
|
"""Set if syntax check failed"""
|
|
1810
1814
|
|
|
1811
1815
|
|
|
1816
|
+
class CronCreateOneShot(TypedDict):
|
|
1817
|
+
"""``otherOneShots`` entry of CronCreate."""
|
|
1818
|
+
|
|
1819
|
+
id: str
|
|
1820
|
+
humanSchedule: str
|
|
1821
|
+
prompt: str
|
|
1822
|
+
|
|
1823
|
+
|
|
1812
1824
|
class CronCreateOutput(TypedDict):
|
|
1813
1825
|
"""Output of the CronCreate tool."""
|
|
1814
1826
|
|
|
@@ -1818,6 +1830,10 @@ class CronCreateOutput(TypedDict):
|
|
|
1818
1830
|
durable: NotRequired[bool]
|
|
1819
1831
|
nextFireAt: NotRequired[float]
|
|
1820
1832
|
"""Epoch ms of the job's next run, the scheduler's per-job offset included"""
|
|
1833
|
+
maxAgeMs: NotRequired[float]
|
|
1834
|
+
"""Age at which a recurring job ends; 0 = never"""
|
|
1835
|
+
otherOneShots: NotRequired[list[CronCreateOneShot]]
|
|
1836
|
+
"""Other session-only one-shot tasks that have yet to fire"""
|
|
1821
1837
|
|
|
1822
1838
|
|
|
1823
1839
|
class CronDeleteOutput(TypedDict):
|
|
@@ -264,6 +264,8 @@ class InitSystemMessage(BaseSystemMessage):
|
|
|
264
264
|
"""Whether requests are served by Anthropic directly (undocumented)."""
|
|
265
265
|
startup_timing: dict[str, Any] | None = None
|
|
266
266
|
"""Startup timing diagnostics (undocumented, nested phase timings)."""
|
|
267
|
+
user_message_uuids: list[str] | None = None
|
|
268
|
+
"""Client uuids of the user messages the turn takes in (undocumented, CLI 2.1.330+)."""
|
|
267
269
|
|
|
268
270
|
|
|
269
271
|
class HookStartedSystemMessage(BaseSystemMessage):
|
|
@@ -283,6 +285,8 @@ class StatusSystemMessage(BaseSystemMessage):
|
|
|
283
285
|
permission_mode: PermissionMode | None = Field(None, validation_alias="permissionMode")
|
|
284
286
|
compact_result: Literal["success", "failed"] | None = None
|
|
285
287
|
compact_error: str | None = None
|
|
288
|
+
user_message_uuids: list[str] | None = None
|
|
289
|
+
"""Client uuids of the user messages the turn takes in (undocumented, CLI 2.1.330+)."""
|
|
286
290
|
|
|
287
291
|
|
|
288
292
|
class PreservedSegment(TypedDict):
|
|
@@ -18,6 +18,8 @@ from clawd_code_sdk.models import (
|
|
|
18
18
|
ResultSuccessMessage,
|
|
19
19
|
ResumeSession,
|
|
20
20
|
SdkPluginConfig,
|
|
21
|
+
StatusSystemMessage,
|
|
22
|
+
StreamEvent,
|
|
21
23
|
ThinkingTokensMessage,
|
|
22
24
|
UserMessage,
|
|
23
25
|
message_adapter,
|
|
@@ -185,3 +187,58 @@ def test_new_cli_option_flags() -> None:
|
|
|
185
187
|
assert args[args.index("--permission-prompts") + 1] == "none"
|
|
186
188
|
assert "--project-config-root=/repo" in args
|
|
187
189
|
assert args[args.index("--plugin-dir-no-mcp") + 1] == "/p"
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def test_status_message_carries_user_message_uuids() -> None:
|
|
193
|
+
"""CLI 2.1.330 sends ``user_message_uuids`` on status (and init) messages."""
|
|
194
|
+
data = {
|
|
195
|
+
"type": "system",
|
|
196
|
+
"subtype": "status",
|
|
197
|
+
"status": "requesting",
|
|
198
|
+
"user_message_uuids": ["m1"],
|
|
199
|
+
**BASE,
|
|
200
|
+
}
|
|
201
|
+
message = message_adapter.validate_python(data)
|
|
202
|
+
assert isinstance(message, StatusSystemMessage)
|
|
203
|
+
assert message.user_message_uuids == ["m1"]
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def test_stream_event_carries_owed_rows() -> None:
|
|
207
|
+
"""CLI 2.1.330 sends the internal ``owed_rows`` on stream events."""
|
|
208
|
+
data = {
|
|
209
|
+
"type": "stream_event",
|
|
210
|
+
"event": {"type": "message_stop"},
|
|
211
|
+
"parent_tool_use_id": None,
|
|
212
|
+
"user_message_uuids": ["m1"],
|
|
213
|
+
"owed_rows": [],
|
|
214
|
+
**BASE,
|
|
215
|
+
}
|
|
216
|
+
message = message_adapter.validate_python(data)
|
|
217
|
+
assert isinstance(message, StreamEvent)
|
|
218
|
+
assert message.owed_rows == []
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
def test_result_carries_first_request_tokens() -> None:
|
|
222
|
+
"""CLI 2.1.330 reports the first model call's prompt size on success results."""
|
|
223
|
+
data = {
|
|
224
|
+
"type": "result",
|
|
225
|
+
"subtype": "success",
|
|
226
|
+
"duration_ms": 10,
|
|
227
|
+
"duration_api_ms": 8,
|
|
228
|
+
"is_error": False,
|
|
229
|
+
"num_turns": 1,
|
|
230
|
+
"result": "ok",
|
|
231
|
+
"total_cost_usd": 0.0,
|
|
232
|
+
"stop_reason": "end_turn",
|
|
233
|
+
"usage": {"input_tokens": 1, "output_tokens": 1, "service_tier": "standard"},
|
|
234
|
+
"request_sent_wall_ms": 1795000000000,
|
|
235
|
+
"first_request_input_tokens": 51568,
|
|
236
|
+
"first_request_cache_read_input_tokens": 41324,
|
|
237
|
+
**BASE,
|
|
238
|
+
}
|
|
239
|
+
message = message_adapter.validate_python(data)
|
|
240
|
+
assert isinstance(message, ResultSuccessMessage)
|
|
241
|
+
assert (message.first_request_input_tokens, message.first_request_cache_read_input_tokens) == (
|
|
242
|
+
51568,
|
|
243
|
+
41324,
|
|
244
|
+
)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"""The generate_session_title control request."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, cast
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
|
|
9
|
+
from clawd_code_sdk import ClaudeAgentOptions, ClaudeSDKClient
|
|
10
|
+
from clawd_code_sdk.models import SDKControlGenerateSessionTitleRequest
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class _TitleQuery:
|
|
14
|
+
def __init__(self, response: dict[str, Any]) -> None:
|
|
15
|
+
self.response = response
|
|
16
|
+
self.requests: list[Any] = []
|
|
17
|
+
|
|
18
|
+
async def _send_control_request(self, request: Any) -> dict[str, Any]:
|
|
19
|
+
self.requests.append(request)
|
|
20
|
+
return self.response
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@pytest.mark.parametrize(
|
|
24
|
+
("response", "expected"),
|
|
25
|
+
[
|
|
26
|
+
(
|
|
27
|
+
{"title": "ACP subprocess tests hanging on Windows CI"},
|
|
28
|
+
"ACP subprocess tests hanging on Windows CI",
|
|
29
|
+
),
|
|
30
|
+
({"title": None}, None), # The text was too short to title
|
|
31
|
+
({"title": ""}, None),
|
|
32
|
+
],
|
|
33
|
+
)
|
|
34
|
+
async def test_generate_session_title(response: dict[str, Any], expected: str | None) -> None:
|
|
35
|
+
client = ClaudeSDKClient(ClaudeAgentOptions())
|
|
36
|
+
query = _TitleQuery(response)
|
|
37
|
+
client._query = cast(Any, query)
|
|
38
|
+
|
|
39
|
+
title = await client.generate_session_title("Our CI fails on Windows ...")
|
|
40
|
+
|
|
41
|
+
assert title == expected
|
|
42
|
+
assert query.requests == [
|
|
43
|
+
SDKControlGenerateSessionTitleRequest(
|
|
44
|
+
description="Our CI fails on Windows ...", persist=False
|
|
45
|
+
)
|
|
46
|
+
]
|
|
47
|
+
assert query.requests[0].model_dump(by_alias=True, exclude_none=True) == {
|
|
48
|
+
"subtype": "generate_session_title",
|
|
49
|
+
"description": "Our CI fails on Windows ...",
|
|
50
|
+
"persist": False,
|
|
51
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/_internal/sdk_mcp_bridge.py
RENAMED
|
File without changes
|
{clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/_internal/session_mutations.py
RENAMED
|
File without changes
|
|
File without changes
|
{clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.10}/src/clawd_code_sdk/_internal/transport/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|