ask-agent 0.40.28 → 0.40.29

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: af8d2bd0d675ffdced29db02c1a37c4fc9c3ca96e8b051b5ebed5f55fd07433f
4
- data.tar.gz: c84dc5c902cf4cef1c301c556123b7f435b16b257b68cd7ed1595708dfe836c9
3
+ metadata.gz: b55a3e7db1b87fa2e915014f6e8a787b24fe60df99602b14b95da3bb06fdf3a5
4
+ data.tar.gz: 57017799b4dfb6ab2f842212ba9eed1321bcd61c3872b92a5347a85e98f5ace7
5
5
  SHA512:
6
- metadata.gz: f4fca625ea3ab60981b20319e7451a3b18222cdf5d7c40f3b68bde5e7642091f1e645404430f6c96d52655707363bf86f385642e1c37b602b4c0b6934040067f
7
- data.tar.gz: 3be6afd9ec87a5550bc3a276be875e61e7cb1aa4998ab0d88c1081fe970538e16a668a3625fe1b5ee1aff451fa07d9e60f79951fd3114f0ab80ec0b2e2382792
6
+ metadata.gz: ef7705c41d359caed21b9424f09ec1aaf6164b3f0d773b78fdbfe0173a7f56dc1bff0af819d6aedb237fb45bdf990246282c2bfa4e1a64864df2d639f6c6d8e3
7
+ data.tar.gz: '08aed23b7e951f35182a683d52ae2c67d534fb2ccf97d2c1a6fc99ec505e49ce88be55225b9250eae6a1fb8d18e6aaaeb17994cb0ddf11b207a9a34fa14231c9'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ### Added
4
+
5
+ - **`Session#run(runtime_event_sink:)` forwards ask-runtime tool lifecycle events** through the agent loop and recursive turns to `ToolExecutor#execute_batch`.
6
+
3
7
  ### Fixed
4
8
 
5
9
  - **`SessionAdapter.resume` surfaces every ask-session miss as
data/README.md CHANGED
@@ -34,6 +34,24 @@ session.on_event do |event|
34
34
  end
35
35
  ```
36
36
 
37
+ To also record provider-neutral ask-runtime tool lifecycle events, pass an
38
+ event sink to `Session#run`. For example, when using ask-session:
39
+
40
+ ```ruby
41
+ require "ask-session"
42
+
43
+ host = Ask::Session::Host.new
44
+ host.create(id: session.id)
45
+ runtime_sink = host.sink(session.id)
46
+ session.run("What files are here?", runtime_event_sink: runtime_sink)
47
+ ```
48
+
49
+ The sink receives tool start and terminal events, including failures,
50
+ cancellations, and timeouts. Leave `runtime_event_sink` unset if you do not
51
+ need this additional lifecycle stream. Integrations that already persist
52
+ protocol-facing tool events should avoid attaching a second sink to the same
53
+ host for those executions.
54
+
37
55
  ## Declarative Agents
38
56
 
39
57
  Agents follow a file convention. Each agent lives in a directory under
@@ -75,7 +93,7 @@ in `agents/<name>/skills/`, shared skills in `agents/shared/skills/`.
75
93
  | Entry point | Purpose |
76
94
  |---|---|
77
95
  | `Ask::Agent::Session.new(model:, tools: [], max_turns: 25, ...)` | Full agent loop: message, tool calls, results, follow-up |
78
- | `session.run(message)` | Run the loop for one message |
96
+ | `session.run(message, runtime_event_sink: nil)` | Run the loop for one message; optionally emit ask-runtime tool lifecycle events to a sink |
79
97
  | `session.on_event { \|e\| }` | Stream `Ask::Agent::Events` (text deltas, tool execution, evaluation) |
80
98
  | `Ask::Agent.new("name")` | Build a session from a declarative agent definition |
81
99
  | `Ask.chat(message)` | One-shot chat without instantiating a Session |
@@ -17,7 +17,7 @@ module Ask
17
17
  @max_consecutive_tool_turns = max_consecutive_tool_turns
18
18
  end
19
19
 
20
- def run_turn(chat:, message:, tools:, tool_executor:, compactor:, hooks:, event_emitter:, session_id: nil, persist: nil, tool_call_repair: nil, steer_source: nil, attachments: nil)
20
+ def run_turn(chat:, message:, tools:, tool_executor:, compactor:, hooks:, event_emitter:, session_id: nil, persist: nil, tool_call_repair: nil, steer_source: nil, attachments: nil, runtime_event_sink: nil)
21
21
  raise MaxTurnsExceeded if @turn_count >= @max_turns
22
22
 
23
23
  event_emitter.emit(Events::TurnStart.new)
@@ -104,6 +104,7 @@ module Ask
104
104
  user_results = tool_executor.execute(
105
105
  user_tool_calls, tools, hooks: hooks, event_emitter: event_emitter,
106
106
  session_id: session_id, turn: @turn_count,
107
+ runtime_event_sink: runtime_event_sink,
107
108
  result_callback: lambda do |tool_call_id, result|
108
109
  tc = user_tool_calls[tool_call_id]
109
110
  next unless tc
@@ -175,7 +176,8 @@ module Ask
175
176
  session_id: session_id,
176
177
  persist: persist,
177
178
  tool_call_repair: tool_call_repair,
178
- steer_source: steer_source
179
+ steer_source: steer_source,
180
+ runtime_event_sink: runtime_event_sink
179
181
  )
180
182
  end
181
183
 
@@ -288,7 +288,7 @@ module Ask
288
288
  # (only when the +artifacts:+ option is enabled)
289
289
  attr_reader :artifact_store
290
290
 
291
- def run(message, tools: nil, reset: true, attachments: nil)
291
+ def run(message, tools: nil, reset: true, attachments: nil, runtime_event_sink: nil)
292
292
  raise "Session deleted" if @deleted
293
293
  raise "Session already running" if @running
294
294
 
@@ -331,7 +331,8 @@ module Ask
331
331
  session_id: @id,
332
332
  tool_call_repair: @tool_call_repair,
333
333
  steer_source: method(:drain_one_steer),
334
- persist: @state ? method(:persist!) : nil
334
+ persist: @state ? method(:persist!) : nil,
335
+ runtime_event_sink: runtime_event_sink
335
336
  )
336
337
 
337
338
  @total_input_tokens += @loop.last_input_tokens.to_i
@@ -409,7 +410,8 @@ module Ask
409
410
  hooks: @hooks,
410
411
  event_emitter: self,
411
412
  session_id: @id,
412
- tool_call_repair: @tool_call_repair
413
+ tool_call_repair: @tool_call_repair,
414
+ runtime_event_sink: runtime_event_sink
413
415
  )
414
416
 
415
417
  @total_input_tokens += @loop.last_input_tokens.to_i
@@ -449,7 +451,8 @@ module Ask
449
451
  hooks: @hooks,
450
452
  event_emitter: self,
451
453
  session_id: @id,
452
- tool_call_repair: @tool_call_repair
454
+ tool_call_repair: @tool_call_repair,
455
+ runtime_event_sink: runtime_event_sink
453
456
  )
454
457
 
455
458
  @total_input_tokens += @loop.last_input_tokens.to_i
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ask
4
4
  module Agent
5
- VERSION = "0.40.28"
5
+ VERSION = "0.40.29"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ask-agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.40.28
4
+ version: 0.40.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto
@@ -127,14 +127,14 @@ dependencies:
127
127
  requirements:
128
128
  - - ">="
129
129
  - !ruby/object:Gem::Version
130
- version: 0.1.1
130
+ version: 0.1.2
131
131
  type: :runtime
132
132
  prerelease: false
133
133
  version_requirements: !ruby/object:Gem::Requirement
134
134
  requirements:
135
135
  - - ">="
136
136
  - !ruby/object:Gem::Version
137
- version: 0.1.1
137
+ version: 0.1.2
138
138
  - !ruby/object:Gem::Dependency
139
139
  name: minitest
140
140
  requirement: !ruby/object:Gem::Requirement