@botbotgo/agent-harness 0.0.368 → 0.0.370

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,2 +1,2 @@
1
- export declare const AGENT_HARNESS_VERSION = "0.0.368";
1
+ export declare const AGENT_HARNESS_VERSION = "0.0.370";
2
2
  export declare const AGENT_HARNESS_RELEASE_DATE = "2026-04-30";
@@ -1,2 +1,2 @@
1
- export const AGENT_HARNESS_VERSION = "0.0.368";
1
+ export const AGENT_HARNESS_VERSION = "0.0.370";
2
2
  export const AGENT_HARNESS_RELEASE_DATE = "2026-04-30";
@@ -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
- let delegatedResult;
1267
- const runDelegatedRequest = (text, requestSuffix = "") => this.invoke(selectedBinding, text, sessionId, `${childRequestId}${requestSuffix}`, undefined, [], {
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
- delegatedResult = await runDelegatedRequest(requestText);
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
- const output = error instanceof Error ? error.message : String(error);
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 delegatedToolResults = Array.isArray(delegatedResult.metadata?.executedToolResults)
1292
- ? delegatedResult.metadata.executedToolResults
1293
- : [];
1294
- for (const toolResult of delegatedToolResults) {
1295
- if (!toolResult?.toolName) {
1296
- continue;
1297
- }
1298
- yield {
1299
- kind: "tool-result",
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: JSON.stringify(compactDelegation.delegatedSubagentType === null
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.368",
3
+ "version": "0.0.370",
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.13.0",
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": "npm version patch --no-git-tag-version && node ./scripts/sync-example-version.mjs && node ./scripts/archive-release-notes.mjs && node ./scripts/sync-release-notes-html.mjs",
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.13.0",
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"