claude_agent 0.7.8 → 0.7.10

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