clawd-code-sdk 0.5.2__tar.gz → 0.5.4__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-0.5.2 → clawd_code_sdk-0.5.4}/PKG-INFO +1 -1
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/pyproject.toml +1 -1
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/client.py +8 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/models/__init__.py +2 -1
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/.gitignore +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/LICENSE +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/README.md +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/__init__.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/_bundled/.gitignore +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/_errors.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/_internal/__init__.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/_internal/message_parser.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/_internal/query.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/_internal/transport/__init__.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/_internal/transport/subprocess_cli.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/_version.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/anthropic_types.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/list_sessions.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/mcp_utils.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/models/agents.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/models/base.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/models/content_blocks.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/models/control.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/models/hooks.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/models/input_types.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/models/mcp.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/models/messages.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/models/options.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/models/output_types.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/models/permissions.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/models/prompt_requests.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/models/prompts.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/models/sandbox.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/models/server_info.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/models/system_messages.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/models/thinking.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/py.typed +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/query.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/session.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/storage/ARCHITECTURE.md +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/storage/__init__.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/storage/helpers.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/storage/models.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/storage/replay.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/usage.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/__init__.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/conftest.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/e2e/__init__.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/e2e/test_agents_and_settings.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/e2e/test_dynamic_control.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/e2e/test_hook_events.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/e2e/test_hooks.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/e2e/test_include_partial_messages.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/e2e/test_mcp_tools.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/e2e/test_sdk_mcp_tools.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/e2e/test_slash_commands.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/e2e/test_stderr_callback.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/e2e/test_structured_output.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/e2e/test_subagent_invocation.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/e2e/test_tool_permissions.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/mcp_server.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/mock_claude_server.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/test_changelog.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/test_client.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/test_errors.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/test_image.png +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/test_integration.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/test_message_parser.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/test_sdk_mcp_integration.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/test_session.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/test_streaming_client.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/test_subprocess_buffering.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/test_tool_callbacks.py +0 -0
- {clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/tests/test_transport.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: clawd-code-sdk
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.4
|
|
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
|
|
@@ -71,6 +71,10 @@ class ClaudeSDKClient:
|
|
|
71
71
|
"""Cumulative token usage across all queries in this session."""
|
|
72
72
|
self.query_usage: AccumulatedUsage = AccumulatedUsage()
|
|
73
73
|
"""Token usage for the current/last query only (reset on each query() call)."""
|
|
74
|
+
self.session_cost: float = 0.0
|
|
75
|
+
"""Cumulative cost in USD across all queries in this session."""
|
|
76
|
+
self.query_cost: float = 0.0
|
|
77
|
+
"""Cost in USD for the current/last query only (reset on each query() call)."""
|
|
74
78
|
self.status: Literal["compacting"] | None = None
|
|
75
79
|
"""Current client status, or None when idle."""
|
|
76
80
|
|
|
@@ -165,6 +169,9 @@ class ClaudeSDKClient:
|
|
|
165
169
|
case ResultSuccessMessage() | ResultErrorMessage():
|
|
166
170
|
self.query_usage.accumulate(message.usage)
|
|
167
171
|
self.session_usage.accumulate(message.usage)
|
|
172
|
+
# total_cost_usd is cumulative; derive per-query cost as delta
|
|
173
|
+
self.query_cost = message.total_cost_usd - self.session_cost
|
|
174
|
+
self.session_cost = message.total_cost_usd
|
|
168
175
|
yield message
|
|
169
176
|
|
|
170
177
|
async def query(
|
|
@@ -183,6 +190,7 @@ class ClaudeSDKClient:
|
|
|
183
190
|
parent_tool_use_id: If responding to a tool use, the tool_use block ID.
|
|
184
191
|
"""
|
|
185
192
|
self.query_usage.reset()
|
|
193
|
+
self.query_cost = 0.0
|
|
186
194
|
self._ensure_connected()
|
|
187
195
|
if not self._transport:
|
|
188
196
|
raise CLIConnectionError("Not connected. Call connect() first.")
|
|
@@ -283,7 +283,7 @@ from .permissions import (
|
|
|
283
283
|
ToolPermissionContext,
|
|
284
284
|
)
|
|
285
285
|
from .sandbox import SandboxIgnoreViolations, SandboxNetworkConfig, SandboxSettings
|
|
286
|
-
from .server_info import ClaudeCodeAgentInfo, ClaudeCodeServerInfo
|
|
286
|
+
from .server_info import ClaudeCodeAgentInfo, ClaudeCodeServerInfo, ClaudeCodeCommandInfo
|
|
287
287
|
from .system_messages import (
|
|
288
288
|
system_message_adapter,
|
|
289
289
|
TriggerMetadata,
|
|
@@ -347,6 +347,7 @@ __all__ = [
|
|
|
347
347
|
"CanUseTool",
|
|
348
348
|
"ClaudeAgentOptions",
|
|
349
349
|
"ClaudeCodeAgentInfo",
|
|
350
|
+
"ClaudeCodeCommandInfo",
|
|
350
351
|
"ClaudeCodeServerInfo",
|
|
351
352
|
"CommandHookHandler",
|
|
352
353
|
"CompactBoundarySystemMessage",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/src/clawd_code_sdk/_internal/message_parser.py
RENAMED
|
File without changes
|
|
File without changes
|
{clawd_code_sdk-0.5.2 → clawd_code_sdk-0.5.4}/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
|