@botbotgo/agent-harness 0.0.148 → 0.0.149
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export declare const AGENT_HARNESS_VERSION = "0.0.148";
|
package/dist/package-version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export const AGENT_HARNESS_VERSION = "0.0.148";
|
|
@@ -59,8 +59,16 @@ export async function requestApprovalAndEmitEvent(runtime, threadId, runId, inpu
|
|
|
59
59
|
return { approval, event };
|
|
60
60
|
}
|
|
61
61
|
export async function emitSyntheticFallbackEvent(runtime, threadId, runId, selectedAgentId, error, sequence = 3) {
|
|
62
|
+
const payload = typeof error === "object" && error !== null && "reason" in error
|
|
63
|
+
? {
|
|
64
|
+
...error,
|
|
65
|
+
selectedAgentId,
|
|
66
|
+
}
|
|
67
|
+
: {
|
|
68
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
69
|
+
selectedAgentId,
|
|
70
|
+
};
|
|
62
71
|
await emitHarnessEvent(runtime, threadId, runId, sequence, "runtime.synthetic_fallback", {
|
|
63
|
-
|
|
64
|
-
selectedAgentId,
|
|
72
|
+
...payload,
|
|
65
73
|
});
|
|
66
74
|
}
|
|
@@ -46,6 +46,7 @@ export async function* streamHarnessRun(options) {
|
|
|
46
46
|
let nonUpstreamStreamActivityObserved = false;
|
|
47
47
|
let currentAgentId = options.selectedAgentId;
|
|
48
48
|
let delegationChain = [options.selectedAgentId];
|
|
49
|
+
let syntheticFallback;
|
|
49
50
|
try {
|
|
50
51
|
const [priorHistory, acquiredReleaseRunSlot] = await Promise.all([
|
|
51
52
|
priorHistoryPromise,
|
|
@@ -237,6 +238,13 @@ export async function* streamHarnessRun(options) {
|
|
|
237
238
|
return;
|
|
238
239
|
}
|
|
239
240
|
try {
|
|
241
|
+
syntheticFallback = {
|
|
242
|
+
strategy: "stream-to-invoke",
|
|
243
|
+
sourceStage: "stream",
|
|
244
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
245
|
+
outcome: "recovered",
|
|
246
|
+
};
|
|
247
|
+
await options.emitSyntheticFallback(options.threadId, options.runId, options.selectedAgentId, syntheticFallback);
|
|
240
248
|
const actual = await options.invokeWithHistory(options.binding, options.input, options.threadId, options.runId);
|
|
241
249
|
await options.appendAssistantMessage(options.threadId, options.runId, actual.output);
|
|
242
250
|
if (Array.isArray(actual.contentBlocks) && actual.contentBlocks.length > 0) {
|
|
@@ -249,6 +257,10 @@ export async function* streamHarnessRun(options) {
|
|
|
249
257
|
threadId: options.threadId,
|
|
250
258
|
runId: options.runId,
|
|
251
259
|
agentId: currentAgentId,
|
|
260
|
+
metadata: {
|
|
261
|
+
...(actual.metadata ?? {}),
|
|
262
|
+
syntheticFallback,
|
|
263
|
+
},
|
|
252
264
|
},
|
|
253
265
|
};
|
|
254
266
|
yield {
|
|
@@ -260,7 +272,13 @@ export async function* streamHarnessRun(options) {
|
|
|
260
272
|
return;
|
|
261
273
|
}
|
|
262
274
|
catch (invokeError) {
|
|
263
|
-
|
|
275
|
+
syntheticFallback = {
|
|
276
|
+
strategy: "stream-to-invoke",
|
|
277
|
+
sourceStage: "stream",
|
|
278
|
+
reason: invokeError instanceof Error ? invokeError.message : String(invokeError),
|
|
279
|
+
outcome: "failed",
|
|
280
|
+
};
|
|
281
|
+
await options.emitSyntheticFallback(options.threadId, options.runId, options.selectedAgentId, syntheticFallback);
|
|
264
282
|
const runtimeFailure = renderRuntimeFailure(invokeError);
|
|
265
283
|
yield {
|
|
266
284
|
type: "event",
|
|
@@ -285,6 +303,9 @@ export async function* streamHarnessRun(options) {
|
|
|
285
303
|
state: "failed",
|
|
286
304
|
output: runtimeFailure,
|
|
287
305
|
finalMessageText: runtimeFailure,
|
|
306
|
+
metadata: {
|
|
307
|
+
syntheticFallback,
|
|
308
|
+
},
|
|
288
309
|
},
|
|
289
310
|
};
|
|
290
311
|
return;
|