clawd-code-sdk 1.2.7__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.
Files changed (97) hide show
  1. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/PKG-INFO +1 -1
  2. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/pyproject.toml +1 -1
  3. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/client.py +20 -0
  4. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/__init__.py +2 -0
  5. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/control.py +12 -0
  6. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/messages.py +2 -0
  7. clawd_code_sdk-1.2.9/tests/test_session_title.py +51 -0
  8. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/.gitignore +0 -0
  9. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/LICENSE +0 -0
  10. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/README.md +0 -0
  11. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/__init__.py +0 -0
  12. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_bundled/.gitignore +0 -0
  13. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_errors.py +0 -0
  14. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_internal/__init__.py +0 -0
  15. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_internal/mcp_compat.py +0 -0
  16. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_internal/query.py +0 -0
  17. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_internal/sdk_mcp_bridge.py +0 -0
  18. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_internal/session_mutations.py +0 -0
  19. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_internal/sessions.py +0 -0
  20. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_internal/transport/__init__.py +0 -0
  21. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_internal/transport/subprocess_cli.py +0 -0
  22. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_internal/transport/subprocess_utils.py +0 -0
  23. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/_version.py +0 -0
  24. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/anthropic_stream.py +0 -0
  25. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/instrumentation.py +0 -0
  26. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/list_sessions.py +0 -0
  27. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/mcp_utils.py +0 -0
  28. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/agents.py +0 -0
  29. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/anthropic_types.py +0 -0
  30. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/base.py +0 -0
  31. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/content_blocks.py +0 -0
  32. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/context_usage.py +0 -0
  33. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/hooks.py +0 -0
  34. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/input_types.py +0 -0
  35. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/mcp.py +0 -0
  36. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/options.py +0 -0
  37. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/output_types.py +0 -0
  38. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/permissions.py +0 -0
  39. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/prompt_requests.py +0 -0
  40. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/prompts.py +0 -0
  41. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/server_info.py +0 -0
  42. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/session.py +0 -0
  43. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/settings.py +0 -0
  44. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/system_messages.py +0 -0
  45. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/thinking.py +0 -0
  46. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/models/usage.py +0 -0
  47. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/py.typed +0 -0
  48. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/session.py +0 -0
  49. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/storage/ARCHITECTURE.md +0 -0
  50. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/storage/__init__.py +0 -0
  51. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/storage/helpers.py +0 -0
  52. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/storage/models.py +0 -0
  53. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/src/clawd_code_sdk/storage/replay.py +0 -0
  54. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/__init__.py +0 -0
  55. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/conftest.py +0 -0
  56. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/e2e/__init__.py +0 -0
  57. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/e2e/test_agents_and_settings.py +0 -0
  58. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/e2e/test_dynamic_control.py +0 -0
  59. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/e2e/test_hook_events.py +0 -0
  60. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/e2e/test_hooks.py +0 -0
  61. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/e2e/test_include_partial_messages.py +0 -0
  62. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/e2e/test_mcp_resources.py +0 -0
  63. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/e2e/test_mcp_tools.py +0 -0
  64. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/e2e/test_sdk_mcp_resources.py +0 -0
  65. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/e2e/test_sdk_mcp_tools.py +0 -0
  66. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/e2e/test_slash_commands.py +0 -0
  67. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/e2e/test_stderr_callback.py +0 -0
  68. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/e2e/test_storage_parsing.py +0 -0
  69. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/e2e/test_structured_output.py +0 -0
  70. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/e2e/test_subagent_invocation.py +0 -0
  71. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/e2e/test_tool_permissions.py +0 -0
  72. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/mcp_server.py +0 -0
  73. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/mock_claude_server.py +0 -0
  74. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/test_api_content_blocks.py +0 -0
  75. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/test_apply_flag_settings.py +0 -0
  76. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/test_changelog.py +0 -0
  77. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/test_client.py +0 -0
  78. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/test_elicitation_mcp_conversion.py +0 -0
  79. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/test_errors.py +0 -0
  80. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/test_get_usage.py +0 -0
  81. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/test_image.png +0 -0
  82. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/test_integration.py +0 -0
  83. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/test_line_framing.py +0 -0
  84. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/test_message_parser.py +0 -0
  85. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/test_result_error.py +0 -0
  86. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/test_sandbox_settings.py +0 -0
  87. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/test_sdk_0_3_types.py +0 -0
  88. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/test_sdk_mcp_integration.py +0 -0
  89. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/test_session.py +0 -0
  90. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/test_session_mutations.py +0 -0
  91. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/test_sessions.py +0 -0
  92. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/test_steer.py +0 -0
  93. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/test_streaming_client.py +0 -0
  94. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/test_subprocess_buffering.py +0 -0
  95. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/test_tool_callbacks.py +0 -0
  96. {clawd_code_sdk-1.2.7 → clawd_code_sdk-1.2.9}/tests/test_transport.py +0 -0
  97. {clawd_code_sdk-1.2.7 → 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.7
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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "clawd-code-sdk"
3
- version = "1.2.7"
3
+ version = "1.2.9"
4
4
  description = "Python SDK for Claude Code"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -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
@@ -530,6 +530,8 @@ class BaseResultMessage(BaseMessage):
530
530
  """UUID of the user message that started this turn."""
531
531
  user_message_uuids: list[str] | None = None
532
532
  """UUIDs of all user messages handled in this turn."""
533
+ begun_message_ids: list[str] | None = None
534
+ """API message IDs (``msg_...``) the turn began (undocumented, CLI 2.1.330+)."""
533
535
  resume_reason: str | None = None
534
536
  result_index: int | None = None
535
537
  credential_expires_at: str | None = None
@@ -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