ask-agent 0.4.3 → 0.4.4

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: 23e169387a3dfe5b2f74e623ebe467d11a51518f7258aff69467955d7cd8b006
4
- data.tar.gz: 1953b7ad69838440837864b8d39b56cced33ab4959eea3ffdc5eaa479dc8946a
3
+ metadata.gz: 6f7551eb8363ce20ed2ff19787553ddfc28dc1815236d42c905213dcffad520a
4
+ data.tar.gz: 7347fad9ea7f88713c9de21d501d656418b12b5d479a85c3b91e06f682cf918c
5
5
  SHA512:
6
- metadata.gz: be8d999d26b967e996b8f3b72e5a1bbdf34b79446d3903e91e3d2ff1e65ba102cdd63a77a5abf40bcbbb5b9855b969cd79e6509c42c491ef749c0e2437474ed6
7
- data.tar.gz: 3e96cd7d4bbebddf7ef7131a7adae6f086fd57c84740f88c50f21175f482e6d29a366936c174953e4217302721d565cb1b7f1dfeaf83206d3652202527cb4333
6
+ metadata.gz: 29a170ef718d85603ce3a418e59f6b333aab3138cbd1e1702f78509adb268de512495b17341baf406b8e8ccfb0d89eff3b918d0a206b567a3a71385d57396685
7
+ data.tar.gz: 86907835ee0101ecdf499811f13ff5c23e29d6a8ed8e3e8ab293e968bdf45018abcdf2055e65a19239da24a0946100f0f27891fb4fa23123684e71c53293c38d
@@ -55,6 +55,10 @@ module Ask
55
55
  if result[:critical_failure]
56
56
  sibling_abort.abort!
57
57
  end
58
+
59
+ if result[:halted]
60
+ sibling_abort.abort!
61
+ end
58
62
  rescue => e
59
63
  mutex.synchronize do
60
64
  results[id] = {
@@ -79,6 +83,7 @@ module Ask
79
83
  result = execute_single_tool(tool_call, tools, hooks, event_emitter, sibling_abort)
80
84
  results << result
81
85
  break if result[:critical_failure]
86
+ break if result[:halted]
82
87
  end
83
88
  results
84
89
  end
@@ -128,6 +133,11 @@ module Ask
128
133
 
129
134
  is_error = result[:is_error] == true
130
135
  critical = is_error && critical_error?(result[:error])
136
+ halted = result[:halted] == true
137
+
138
+ if halted
139
+ abort_controller&.abort!
140
+ end
131
141
 
132
142
  if is_error && @telemetry
133
143
  @telemetry.log(:tool_error, session_id: @session_id, tool_name: tool_call.name, error_class: result[:error] || "RuntimeError", error_message: result[:result].to_s)
@@ -156,7 +166,8 @@ module Ask
156
166
  message: message,
157
167
  status: is_error ? "error" : "success",
158
168
  result: result,
159
- critical_failure: critical
169
+ critical_failure: critical,
170
+ halted: halted
160
171
  }
161
172
  end
162
173
 
@@ -176,7 +187,11 @@ module Ask
176
187
 
177
188
  def try_call(tool, args, abort_controller = nil)
178
189
  result = tool.call(args, abort_controller: abort_controller)
179
- { result: result, is_error: false }
190
+ hash = { result: result, is_error: false }
191
+ if result.respond_to?(:metadata) && result.metadata&.dig(:halted)
192
+ hash[:halted] = true
193
+ end
194
+ hash
180
195
  rescue => e
181
196
  { result: e.message, is_error: true, error: e.class.name }
182
197
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ask
4
4
  module Agent
5
- VERSION = "0.4.3"
5
+ VERSION = "0.4.4"
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.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto