claude_agent 0.7.8 → 0.7.9

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9304128d18cec59aa0b0221f199b2674d60a5a2813141562b9df51b88057987
4
- data.tar.gz: 8bd6696b854f8660e21744bc02d178e3e402a734119554c2869cc4fbb188a75d
3
+ metadata.gz: 90d9094d4e4428fc7dfc1e452759403a92f2e4badf5d1ac5f2f90e950c511255
4
+ data.tar.gz: fd2a8407c794aa672a4b03a774a6573dac3682bc09b8fe666170b90f5bd9f79a
5
5
  SHA512:
6
- metadata.gz: 8ad2321250e0967d302d41d23724fe6f368f3e8fe6cb4461f483f6d13d3b9b35368189cce06dd28f5fa427013a9a272c6a4e1b3e94ee75b8a38dd7ed422c5068
7
- data.tar.gz: d17257cfcabecbb033ce1427a0237456e5ecbeb0c1c3bedb9bc21dac1336be6a21b96a85ffc96919f7c4774a3f51498a4876f31d11249a05f327966af23f0ae8
6
+ metadata.gz: ce7d705ebe01a38ad1ac86a8caeaabd700831e200e73f134c9adef507b6f7b695effece63ae902849ee408714c3ae576930012dbbefe2b05da403d0de8549317
7
+ data.tar.gz: 7f06c5b0b5ed5ad798442672ad8ca969a0fdefc414a4c273e86911df0e171d24d5a378b9a88117bd3c60092a6affb5219d06cc58dd0107245643b571e2236440
data/CHANGELOG.md CHANGED
@@ -7,6 +7,63 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.7.9] - 2026-02-25
11
+
12
+ ### Added
13
+ - `Conversation` — high-level wrapper managing the full conversation lifecycle with auto-connect, multi-turn history, callbacks, and tool activity timeline
14
+ - `Conversation#say(prompt)` — send a message and receive a `TurnResult`, auto-connecting on first call
15
+ - `Conversation.open { |c| ... }` — block form with automatic cleanup
16
+ - `Conversation.resume(session_id)` — resume a previous conversation
17
+ - `Conversation` callbacks: `on_text`, `on_stream`, `on_tool_use`, `on_tool_result`, `on_thinking`, `on_result`, `on_message`, `on_permission`
18
+ - `Conversation#total_cost`, `#session_id`, `#usage`, `#pending_permission`, `#pending_permissions?` — convenience accessors
19
+ - `ClaudeAgent.conversation(**kwargs)` and `ClaudeAgent.resume_conversation(session_id)` — module-level convenience methods
20
+ - `ToolActivity` — immutable `Data.define` pairing a `ToolUseBlock` with its `ToolResultBlock`, turn index, and timing; delegates `name`, `display_label`, `summary`, `file_path`, `id` to the tool use block
21
+ - `Conversation#tool_activity` — unified timeline of all tool executions across turns with duration tracking
22
+ - `PermissionRequest` — deferred permission promise that can be resolved from any thread via `allow!` / `deny!`, with `defer!` for hybrid callback/queue mode
23
+ - `PermissionQueue` — thread-safe queue of pending `PermissionRequest` objects with `poll`, `pop(timeout:)`, and `drain!`
24
+ - `Client#permission_queue` — returns the queue; always available on connected clients
25
+ - `Client#pending_permission` — non-blocking poll for the next pending permission request
26
+ - `Client#pending_permissions?` — check if any permission requests are waiting
27
+ - `Options#permission_queue` — set to `true` to enable queue-based permissions (auto-sets `permission_prompt_tool_name: "stdio"`)
28
+ - `ToolPermissionContext#request` — access the `PermissionRequest` from within a `can_use_tool` callback for hybrid defer mode
29
+ - `ControlProtocol` now supports three permission modes: synchronous callback, queue-based, and hybrid (callback with selective `defer!`)
30
+ - `TurnResult` — represents a complete agent turn, accumulating all messages between sending a prompt and receiving the `ResultMessage`
31
+ - `TurnResult#text`, `#thinking` — concatenated text/thinking across all assistant messages
32
+ - `TurnResult#tool_uses`, `#tool_results`, `#tool_executions` — tool use blocks, result blocks, and matched use/result pairs
33
+ - `TurnResult#usage`, `#cost`, `#duration_ms`, `#session_id`, `#model`, `#success?`, `#error?` — convenient accessors from the result
34
+ - `Client#send_and_receive(content)` — send a message and receive the complete `TurnResult` in one call
35
+ - `Client#receive_turn` — like `receive_response` but returns a `TurnResult` instead of yielding raw messages
36
+ - `ClaudeAgent.query_turn(prompt:)` — one-shot query returning a `TurnResult`
37
+ - `EventHandler` — register typed event callbacks (`:text`, `:thinking`, `:tool_use`, `:tool_result`, `:result`, `:message`) instead of writing `case` statements over raw messages
38
+ - `Client#on(event, &block)` and `#on_text`, `#on_tool_use`, `#on_tool_result`, `#on_result`, etc. — register persistent event handlers that fire during `receive_turn` and `send_and_receive`
39
+ - `ClaudeAgent.query_turn` now accepts `events:` parameter for standalone `EventHandler` use
40
+ - `TaskProgressMessage` for real-time background task (subagent) progress reporting (TypeScript SDK v0.2.51 parity)
41
+ - `mcp_authenticate` control request on `ControlProtocol` and `Client` for MCP server OAuth authentication (TypeScript SDK v0.2.52 parity)
42
+ - `mcp_clear_auth` control request on `ControlProtocol` and `Client` for clearing MCP server credentials (TypeScript SDK v0.2.52 parity)
43
+ - RBS signatures for all new types and methods
44
+ - `CumulativeUsage` — built-in cumulative usage tracking across conversation turns; automatically updated by `Client` as `ResultMessage`s are received
45
+ - `Client#cumulative_usage` — returns the usage accumulator with `input_tokens`, `output_tokens`, `cache_read_input_tokens`, `cache_creation_input_tokens`, `total_cost_usd`, `num_turns`, `duration_ms`, `duration_api_ms`
46
+ - `GenericMessage` type — wraps unknown top-level message types instead of raising `MessageParseError`, with dynamic field access via `[]` and `method_missing`
47
+ - `GenericBlock` type — wraps unknown content block types instead of returning raw Hashes, with dynamic field access via `[]` and `method_missing`
48
+ - `ToolUseBlock#file_path` — returns the file path for file-based tools (`Read`, `Write`, `Edit`, `NotebookEdit`), nil otherwise
49
+ - `ToolUseBlock#display_label` — one-line human-readable label (e.g. `"Read lib/foo.rb"`, `"Bash: git status"`, `"WebFetch: example.com"`)
50
+ - `ToolUseBlock#summary(max:)` — detailed summary with truncation (e.g. `"Write: /path.rb (3 lines)"`, `"Grep: pattern in /path (*.rb)"`)
51
+ - `ServerToolUseBlock#file_path`, `#display_label`, `#summary(max:)` — same interface with server context (e.g. `"server_name/tool_name"`)
52
+
53
+ ### Changed
54
+ - `BaseHookInput.define_input` — declarative macro for generating hook input subclasses from a single declaration; replaces 18 hand-written classes with one-line definitions
55
+ - `MessageParser` now uses a registry pattern (`MessageParser.register`) instead of nested `case` statements for message routing; adding a new message type is one `register` call
56
+ - `MessageParser#parse` no longer raises `MessageParseError` for unknown message types; returns `GenericMessage` instead
57
+ - `MessageParser#parse_content_block` no longer returns raw Hashes for unknown content block types; returns `GenericBlock` instead
58
+ - All parsed message hashes now use snake_case symbol keys throughout (e.g. `msg.usage[:input_tokens]`, `event.files.first[:filename]`, `event.event[:type]`)
59
+ - `MessageParser#parse` applies a single `deep_transform_keys` pass that normalizes camelCase→snake_case and string→symbol for the entire hash tree
60
+ - `can_use_tool` callbacks receive symbol-keyed `input` hashes
61
+ - Hook callbacks receive symbol-keyed `input` hashes
62
+ - MCP tool handlers receive symbol-keyed `arguments` hashes
63
+
64
+ ### Removed
65
+ - `MessageParser#fetch_dual` — no longer needed now that keys are normalized at the entry point
66
+
10
67
  ## [0.7.8] - 2026-02-22
11
68
 
12
69
  ### Added