ask-agent 0.25.5 → 0.25.6

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: d6b698047e4a92d613f1d6f21b7c82ab46a02ee12886f9625913feb701b67b1a
4
- data.tar.gz: 6f2bd64156cafdeea1b8bdbcaca0b5eca9470250e1f3e65ead20ea2f1098a451
3
+ metadata.gz: b0ae07fe535ce2c8f33a24f145440bee62e70869d1d1f5cd0eb0cf71cb4b4e2f
4
+ data.tar.gz: ecb0c237a7b068f854547081b58c659e9b6735cc8d1d1c3f00936f3e0d24037e
5
5
  SHA512:
6
- metadata.gz: 76e12be0f0ab184371e8253f4abfa0f1f8c80106ea905050afc3a6d7d7a07df4a71230d4ed42a2309359327956022b6728edc4f0c50a8f2fdbfe9b2d39237abc
7
- data.tar.gz: 99b18d89c18690ebb314a2e7871fc05bb4c0d79ced8e87c630de1fe6b558eb18954f253eafac80dfdda45bcc38e44efbd461cab0089c7813df37ca7da1899e5c
6
+ metadata.gz: a3d254d5ff2f50ad781e98b087b54c4d085ff36c360970d64106ed1adcbbea926cf07e1f7603bb3a538d9ae7e72a1f2f781b1f0951510258eced384ab797a09d
7
+ data.tar.gz: 7be070f08f92a3c8db2897730bbf833d8942f82c154be0f23b6fd6be28a27764ddc56313c1fce837646eb551786876eaff2d1d7e846ea27da4102704d7e58100
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## [0.25.6] - 2026-08-05
2
+
3
+ ### Added
4
+
5
+ - **The agent loop honors `Session#abort` (barge-in).** Aborting a running
6
+ session now stops the loop as soon as the in-flight LLM call ends: no
7
+ tool execution, no follow-up turns, and recursion stops after a tool
8
+ turn. Voice callers who interrupt the agent get their new turn processed
9
+ immediately instead of waiting for the stale answer to finish. Emitters
10
+ without `abort_requested?` (plain stubs) are treated as never aborted.
11
+
1
12
  ## [0.25.5] - 2026-08-05
2
13
 
3
14
  ### Changed
@@ -50,6 +50,14 @@ module Ask
50
50
  event_emitter.emit(Events::MessageEnd.new(tool_calls: response.tool_call?))
51
51
  @turn_count += 1
52
52
 
53
+ # Barge-in abort: stop as soon as the in-flight LLM call ends — no
54
+ # tool execution, no follow-up turns. The reply so far is returned
55
+ # (the caller has already moved on).
56
+ if aborted?(event_emitter)
57
+ @consecutive_tool_turns = 0
58
+ return response.content.to_s
59
+ end
60
+
53
61
  # Check if there are any tool calls (user-executed or provider-executed)
54
62
  has_tool_calls = response.tool_call? || (response.tool_results&.any? == true)
55
63
 
@@ -120,6 +128,9 @@ module Ask
120
128
 
121
129
  raise MaxTurnsExceeded if @turn_count >= @max_turns
122
130
 
131
+ # Aborted while tools ran? Skip the follow-up LLM call.
132
+ return response.content.to_s if aborted?(event_emitter)
133
+
123
134
  # Recursive call — LLM processes tool results
124
135
  run_turn(
125
136
  chat: chat,
@@ -142,6 +153,12 @@ module Ask
142
153
 
143
154
  private
144
155
 
156
+ # Whether the session asked the loop to stop (barge-in). Emitters that
157
+ # don't support aborting (plain stubs) are treated as never aborted.
158
+ def aborted?(event_emitter)
159
+ event_emitter.respond_to?(:abort_requested?) && event_emitter.abort_requested?
160
+ end
161
+
145
162
  # Truncate a string for summaries without depending on ActiveSupport's
146
163
  # String#truncate (which is not loaded by a bare `require "ask-agent"`).
147
164
  def truncate(text, length)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ask
4
4
  module Agent
5
- VERSION = "0.25.5"
5
+ VERSION = "0.25.6"
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.25.5
4
+ version: 0.25.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto