clawd-code-sdk 1.2.8__tar.gz → 1.2.9__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.9}/PKG-INFO +1 -1
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/pyproject.toml +1 -1
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/client.py +20 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/__init__.py +2 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/control.py +12 -0
- clawd_code_sdk-1.2.9/tests/test_session_title.py +51 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/.gitignore +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/LICENSE +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/README.md +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/__init__.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_bundled/.gitignore +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_errors.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_internal/__init__.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_internal/mcp_compat.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_internal/query.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_internal/sdk_mcp_bridge.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_internal/session_mutations.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_internal/sessions.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_internal/transport/__init__.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_internal/transport/subprocess_cli.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_internal/transport/subprocess_utils.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_version.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/anthropic_stream.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/instrumentation.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/list_sessions.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/mcp_utils.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/agents.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/anthropic_types.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/base.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/content_blocks.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/context_usage.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/hooks.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/input_types.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/mcp.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/messages.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/options.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/output_types.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/permissions.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/prompt_requests.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/prompts.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/server_info.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/session.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/settings.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/system_messages.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/thinking.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/usage.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/py.typed +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/session.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/storage/ARCHITECTURE.md +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/storage/__init__.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/storage/helpers.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/storage/models.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/storage/replay.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/__init__.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/conftest.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/e2e/__init__.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/e2e/test_agents_and_settings.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/e2e/test_dynamic_control.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/e2e/test_hook_events.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/e2e/test_hooks.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/e2e/test_include_partial_messages.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/e2e/test_mcp_resources.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/e2e/test_mcp_tools.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/e2e/test_sdk_mcp_resources.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/e2e/test_sdk_mcp_tools.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/e2e/test_slash_commands.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/e2e/test_stderr_callback.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/e2e/test_storage_parsing.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/e2e/test_structured_output.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/e2e/test_subagent_invocation.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/e2e/test_tool_permissions.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/mcp_server.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/mock_claude_server.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/test_api_content_blocks.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/test_apply_flag_settings.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/test_changelog.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/test_client.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/test_elicitation_mcp_conversion.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/test_errors.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/test_get_usage.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/test_image.png +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/test_integration.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/test_line_framing.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/test_message_parser.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/test_result_error.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/test_sandbox_settings.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/test_sdk_0_3_types.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/test_sdk_mcp_integration.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/test_session.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/test_session_mutations.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/test_sessions.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/test_steer.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/test_streaming_client.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/test_subprocess_buffering.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/test_tool_callbacks.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/tests/test_transport.py +0 -0
- {clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/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.9
|
|
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",
|
|
@@ -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
|
|
@@ -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
|
|
File without changes
|
{clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_internal/sdk_mcp_bridge.py
RENAMED
|
File without changes
|
{clawd_code_sdk-1.2.8 → clawd_code_sdk-1.2.9}/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.9}/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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|