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 +4 -4
- data/lib/ask/agent/tool_executor.rb +17 -2
- data/lib/ask/agent/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6f7551eb8363ce20ed2ff19787553ddfc28dc1815236d42c905213dcffad520a
|
|
4
|
+
data.tar.gz: 7347fad9ea7f88713c9de21d501d656418b12b5d479a85c3b91e06f682cf918c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
data/lib/ask/agent/version.rb
CHANGED