@botbotgo/agent-harness 0.0.368 → 0.0.371
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.
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/runtime/adapter/flow/stream-runtime.js +19 -2
- package/dist/runtime/agent-runtime-adapter.d.ts +1 -0
- package/dist/runtime/agent-runtime-adapter.js +75 -27
- package/dist/runtime/parsing/output-tool-args.js +10 -0
- package/package.json +4 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export declare const AGENT_HARNESS_VERSION = "0.0.371";
|
|
2
2
|
export declare const AGENT_HARNESS_RELEASE_DATE = "2026-04-30";
|
package/dist/package-version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export const AGENT_HARNESS_VERSION = "0.0.371";
|
|
2
2
|
export const AGENT_HARNESS_RELEASE_DATE = "2026-04-30";
|
|
@@ -12,6 +12,13 @@ export class ExecutionReconciliationError extends Error {
|
|
|
12
12
|
this.name = "ExecutionReconciliationError";
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
+
const CLOSE_REQUIRED_PLAN_RECOVERY_INSTRUCTION = [
|
|
16
|
+
"The current required todo board still has unfinished work.",
|
|
17
|
+
"Do not broaden the investigation, restart planning, or ask the user what to do next.",
|
|
18
|
+
"Use the existing tool evidence already available in this run.",
|
|
19
|
+
"Your next action must be write_todos: update every remaining pending or in_progress item to completed if evidence was gathered, or failed if it cannot be completed with the available tools.",
|
|
20
|
+
"After that write_todos call, provide the final answer required by the agent response format.",
|
|
21
|
+
].join("\n");
|
|
15
22
|
function toVisibleContent(value) {
|
|
16
23
|
const extracted = extractVisibleOutput(value);
|
|
17
24
|
return extracted ? sanitizeVisibleText(extracted) : "";
|
|
@@ -528,10 +535,15 @@ export async function* streamRuntimeExecution(options) {
|
|
|
528
535
|
const streamedExecutionEvidence = buildExecutionRecoveryEvidence({ projectionState });
|
|
529
536
|
const streamedDelegatedRecoveryInstruction = resolveDelegatedExecutionRecoveryInstruction(streamedExecutionEvidence);
|
|
530
537
|
const streamedDelegationOnlyRecoveryInstruction = resolveDelegationOnlyRecoveryInstruction(options.binding, streamedExecutionEvidence);
|
|
538
|
+
const streamedIncompletePlanRecoveryInstruction = requiresPlanEvidence(options.binding) && streamedExecutionEvidence.hasIncompletePlanState
|
|
539
|
+
? CLOSE_REQUIRED_PLAN_RECOVERY_INSTRUCTION
|
|
540
|
+
: null;
|
|
531
541
|
const delegatedExecutionRecoveryInstruction = !emittedUnsafeStreamSideEffects || streamedDelegatedRecoveryInstruction
|
|
532
542
|
? streamedDelegatedRecoveryInstruction
|
|
533
543
|
: null;
|
|
534
|
-
if (hasUnresolvedExecution(streamedExecutionEvidence)
|
|
544
|
+
if (hasUnresolvedExecution(streamedExecutionEvidence)
|
|
545
|
+
&& !delegatedExecutionRecoveryInstruction
|
|
546
|
+
&& !streamedIncompletePlanRecoveryInstruction) {
|
|
535
547
|
throw createUnresolvedExecutionError(streamedExecutionEvidence);
|
|
536
548
|
}
|
|
537
549
|
const executionWithoutToolEvidenceInstruction = projectionState.emittedOutput
|
|
@@ -557,6 +569,7 @@ export async function* streamRuntimeExecution(options) {
|
|
|
557
569
|
const retryInstruction = !emittedUnsafeStreamSideEffects && sawRetrySafeInvalidToolSelectionError
|
|
558
570
|
? INVALID_TOOL_SELECTION_RECOVERY_INSTRUCTION
|
|
559
571
|
: delegatedExecutionRecoveryInstruction
|
|
572
|
+
?? streamedIncompletePlanRecoveryInstruction
|
|
560
573
|
?? streamedRuntimeFailureRecoveryInstruction
|
|
561
574
|
?? missingPlanRecoveryInstruction
|
|
562
575
|
?? streamedDelegationOnlyRecoveryInstruction
|
|
@@ -776,7 +789,11 @@ export async function* streamRuntimeExecution(options) {
|
|
|
776
789
|
})
|
|
777
790
|
: null;
|
|
778
791
|
const invokeFallbackDelegationOnlyRecoveryInstruction = resolveDelegationOnlyRecoveryInstruction(options.binding, invokeExecutionEvidence);
|
|
779
|
-
const
|
|
792
|
+
const invokeFallbackIncompletePlanRecoveryInstruction = requiresPlanEvidence(options.binding) && invokeExecutionEvidence.hasIncompletePlanState
|
|
793
|
+
? CLOSE_REQUIRED_PLAN_RECOVERY_INSTRUCTION
|
|
794
|
+
: null;
|
|
795
|
+
const effectiveInvokeFallbackRecoveryInstruction = invokeFallbackIncompletePlanRecoveryInstruction
|
|
796
|
+
?? invokeFallbackMissingPlanRecoveryInstruction
|
|
780
797
|
?? invokeFallbackDelegationOnlyRecoveryInstruction
|
|
781
798
|
?? invokeFallbackRecoveryInstruction;
|
|
782
799
|
if (effectiveInvokeFallbackRecoveryInstruction) {
|
|
@@ -59,6 +59,7 @@ export declare class AgentRuntimeAdapter {
|
|
|
59
59
|
}): Promise<RequestResult>;
|
|
60
60
|
private tryDelegateWithCompactRouter;
|
|
61
61
|
private buildCompactDelegationReport;
|
|
62
|
+
private formatCompactDelegationReportForDisplay;
|
|
62
63
|
private streamDelegateWithCompactRouter;
|
|
63
64
|
stream(binding: CompiledAgentBinding, input: MessageContent, sessionId: string, history?: TranscriptMessage[], options?: {
|
|
64
65
|
context?: Record<string, unknown>;
|
|
@@ -1139,6 +1139,39 @@ export class AgentRuntimeAdapter {
|
|
|
1139
1139
|
report,
|
|
1140
1140
|
};
|
|
1141
1141
|
}
|
|
1142
|
+
formatCompactDelegationReportForDisplay(report) {
|
|
1143
|
+
const readStringArray = (key) => {
|
|
1144
|
+
const value = report[key];
|
|
1145
|
+
return Array.isArray(value)
|
|
1146
|
+
? value.filter((item) => typeof item === "string" && item.trim().length > 0)
|
|
1147
|
+
: [];
|
|
1148
|
+
};
|
|
1149
|
+
const lines = [];
|
|
1150
|
+
const reportText = typeof report.report === "string" ? report.report.trim() : "";
|
|
1151
|
+
if (reportText) {
|
|
1152
|
+
lines.push(reportText);
|
|
1153
|
+
}
|
|
1154
|
+
const sections = [
|
|
1155
|
+
["Routing", readStringArray("routing")],
|
|
1156
|
+
["TODO Trace", readStringArray("todoTrace")],
|
|
1157
|
+
["Step Results", readStringArray("stepResults")],
|
|
1158
|
+
["Summary", readStringArray("summary")],
|
|
1159
|
+
["Findings", readStringArray("findings")],
|
|
1160
|
+
["Blockers", readStringArray("blockers")],
|
|
1161
|
+
["Next Actions", readStringArray("nextActions")],
|
|
1162
|
+
];
|
|
1163
|
+
for (const [title, items] of sections) {
|
|
1164
|
+
if (items.length === 0 || (items.length === 1 && items[0]?.toLowerCase() === "none")) {
|
|
1165
|
+
continue;
|
|
1166
|
+
}
|
|
1167
|
+
if (lines.length > 0) {
|
|
1168
|
+
lines.push("");
|
|
1169
|
+
}
|
|
1170
|
+
lines.push(`## ${title}`);
|
|
1171
|
+
lines.push(...items.map((item) => `- ${item}`));
|
|
1172
|
+
}
|
|
1173
|
+
return lines.join("\n");
|
|
1174
|
+
}
|
|
1142
1175
|
async *streamDelegateWithCompactRouter(binding, input, sessionId, requestId, options = {}) {
|
|
1143
1176
|
if (!isDelegationOnlyDeepAgentBinding(binding) || !this.options.bindingResolver) {
|
|
1144
1177
|
return null;
|
|
@@ -1263,18 +1296,38 @@ export class AgentRuntimeAdapter {
|
|
|
1263
1296
|
agentId: selectedBinding.agent.id,
|
|
1264
1297
|
};
|
|
1265
1298
|
const childRequestId = `${requestId}:${subagentType}`;
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
context: options.context,
|
|
1269
|
-
state: options.state,
|
|
1270
|
-
files: options.files,
|
|
1271
|
-
memoryContext: options.memoryContext,
|
|
1272
|
-
});
|
|
1299
|
+
const executedToolResults = [];
|
|
1300
|
+
let output = "";
|
|
1273
1301
|
try {
|
|
1274
|
-
|
|
1302
|
+
for await (const chunk of this.stream(selectedBinding, requestText, sessionId, [], {
|
|
1303
|
+
context: options.context,
|
|
1304
|
+
state: options.state,
|
|
1305
|
+
files: options.files,
|
|
1306
|
+
requestId: childRequestId,
|
|
1307
|
+
memoryContext: options.memoryContext,
|
|
1308
|
+
profiling: options.profiling,
|
|
1309
|
+
toolRuntimeContext: options.toolRuntimeContext,
|
|
1310
|
+
})) {
|
|
1311
|
+
if (typeof chunk === "string") {
|
|
1312
|
+
output += chunk;
|
|
1313
|
+
continue;
|
|
1314
|
+
}
|
|
1315
|
+
if (chunk.kind === "content") {
|
|
1316
|
+
output += chunk.content ?? "";
|
|
1317
|
+
continue;
|
|
1318
|
+
}
|
|
1319
|
+
if (chunk.kind === "tool-result") {
|
|
1320
|
+
executedToolResults.push({
|
|
1321
|
+
toolName: chunk.toolName,
|
|
1322
|
+
output: chunk.output,
|
|
1323
|
+
...(chunk.isError !== undefined ? { isError: chunk.isError } : {}),
|
|
1324
|
+
});
|
|
1325
|
+
}
|
|
1326
|
+
yield { ...chunk, agentId: chunk.agentId ?? selectedBinding.agent.id };
|
|
1327
|
+
}
|
|
1275
1328
|
}
|
|
1276
1329
|
catch (error) {
|
|
1277
|
-
|
|
1330
|
+
output = error instanceof Error ? error.message : String(error);
|
|
1278
1331
|
return {
|
|
1279
1332
|
toolOutput: output,
|
|
1280
1333
|
delegatedSubagentType: subagentType,
|
|
@@ -1285,24 +1338,19 @@ export class AgentRuntimeAdapter {
|
|
|
1285
1338
|
state: "failed",
|
|
1286
1339
|
output,
|
|
1287
1340
|
finalMessageText: output,
|
|
1341
|
+
metadata: { executedToolResults },
|
|
1288
1342
|
},
|
|
1289
1343
|
};
|
|
1290
1344
|
}
|
|
1291
|
-
const
|
|
1292
|
-
|
|
1293
|
-
:
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
toolName: toolResult.toolName,
|
|
1301
|
-
output: toolResult.output,
|
|
1302
|
-
...(toolResult.isError !== undefined ? { isError: toolResult.isError } : {}),
|
|
1303
|
-
agentId: selectedBinding.agent.id,
|
|
1304
|
-
};
|
|
1305
|
-
}
|
|
1345
|
+
const delegatedResult = {
|
|
1346
|
+
sessionId,
|
|
1347
|
+
requestId: childRequestId,
|
|
1348
|
+
agentId: selectedBinding.agent.id,
|
|
1349
|
+
state: "completed",
|
|
1350
|
+
output: sanitizeVisibleText(output),
|
|
1351
|
+
finalMessageText: sanitizeVisibleText(output),
|
|
1352
|
+
metadata: { executedToolResults },
|
|
1353
|
+
};
|
|
1306
1354
|
return {
|
|
1307
1355
|
toolOutput: resolveDelegatedResultOutput(delegatedResult),
|
|
1308
1356
|
delegatedSubagentType: subagentType,
|
|
@@ -1343,9 +1391,9 @@ export class AgentRuntimeAdapter {
|
|
|
1343
1391
|
};
|
|
1344
1392
|
yield {
|
|
1345
1393
|
kind: "content",
|
|
1346
|
-
content:
|
|
1347
|
-
? compactDelegation.toolOutput
|
|
1348
|
-
: compactReport),
|
|
1394
|
+
content: compactDelegation.delegatedSubagentType === null
|
|
1395
|
+
? String(compactDelegation.toolOutput ?? "")
|
|
1396
|
+
: this.formatCompactDelegationReportForDisplay(compactReport),
|
|
1349
1397
|
};
|
|
1350
1398
|
return;
|
|
1351
1399
|
}
|
|
@@ -396,6 +396,16 @@ export function salvageJsonToolCalls(value) {
|
|
|
396
396
|
.filter((item) => item !== null);
|
|
397
397
|
}
|
|
398
398
|
function normalizeWriteTodosArgs(args) {
|
|
399
|
+
if (typeof args.name === "string" &&
|
|
400
|
+
args.name === "write_todos" &&
|
|
401
|
+
typeof args.arguments === "object" &&
|
|
402
|
+
args.arguments !== null &&
|
|
403
|
+
!Array.isArray(args.arguments)) {
|
|
404
|
+
return normalizeWriteTodosArgs(args.arguments);
|
|
405
|
+
}
|
|
406
|
+
if (Array.isArray(args.items) && !Array.isArray(args.todos)) {
|
|
407
|
+
return normalizeWriteTodosArgs({ ...args, todos: args.items });
|
|
408
|
+
}
|
|
399
409
|
if (!Array.isArray(args.todos)) {
|
|
400
410
|
return args;
|
|
401
411
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botbotgo/agent-harness",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.371",
|
|
4
4
|
"description": "Workspace runtime for multi-agent applications",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@libsql/client": "^0.17.0",
|
|
57
57
|
"@llamaindex/ollama": "^0.1.23",
|
|
58
58
|
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
59
|
-
"@qdrant/js-client-rest": "1.
|
|
59
|
+
"@qdrant/js-client-rest": "1.17.0",
|
|
60
60
|
"deepagents": "^1.9.0",
|
|
61
61
|
"langchain": "^1.3.4",
|
|
62
62
|
"llamaindex": "^0.12.1",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"docs:sync-dev-nav": "node ./scripts/sync-developer-docs-nav.mjs",
|
|
83
83
|
"docs:sync-release-notes": "node ./scripts/sync-release-notes-html.mjs",
|
|
84
84
|
"docs:sync-docs-html": "node ./scripts/sync-release-notes-html.mjs && node ./scripts/sync-developer-docs-nav.mjs",
|
|
85
|
-
"release:prepare": "
|
|
85
|
+
"release:prepare": "node ./scripts/prepare-release-version.mjs && node ./scripts/sync-example-version.mjs && node ./scripts/archive-release-notes.mjs && node ./scripts/sync-release-notes-html.mjs",
|
|
86
86
|
"release:pack": "npm pack --dry-run",
|
|
87
87
|
"release:publish": "npm publish --access public --registry https://registry.npmjs.org/"
|
|
88
88
|
},
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"hono": "^4.12.14",
|
|
100
100
|
"langsmith": "^0.5.20",
|
|
101
101
|
"undici": "^6.24.0",
|
|
102
|
-
"@qdrant/js-client-rest": "1.
|
|
102
|
+
"@qdrant/js-client-rest": "1.17.0",
|
|
103
103
|
"vite": "^7.3.2",
|
|
104
104
|
"openai": "6.33.0",
|
|
105
105
|
"protobufjs": "^7.5.5"
|