@botbotgo/agent-harness 0.0.468 → 0.0.470
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 +0 -1
- package/dist/runtime/adapter/runtime-adapter-support.js +0 -10
- package/dist/runtime/agent-runtime-adapter.js +175 -3
- package/dist/runtime/parsing/output-parsing.d.ts +2 -2
- package/dist/runtime/parsing/output-parsing.js +2 -2
- package/dist/runtime/parsing/output-recovery.d.ts +0 -1
- package/dist/runtime/parsing/output-recovery.js +1 -7
- package/dist/runtime/prompts/runtime-prompts.d.ts +0 -1
- package/dist/runtime/prompts/runtime-prompts.js +0 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export declare const AGENT_HARNESS_VERSION = "0.0.470";
|
|
2
2
|
export declare const AGENT_HARNESS_RELEASE_DATE = "2026-05-04";
|
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.470";
|
|
2
2
|
export const AGENT_HARNESS_RELEASE_DATE = "2026-05-04";
|
|
@@ -56,7 +56,6 @@ const INITIAL_REQUIRED_PLAN_INSTRUCTION = [
|
|
|
56
56
|
"Your first action for this request must be write_todos with concrete task steps and statuses.",
|
|
57
57
|
"Do not call any domain/evidence tool and do not provide a final answer before the initial write_todos call succeeds.",
|
|
58
58
|
"After write_todos succeeds, do not call write_todos or read_todos again until one non-planning evidence tool returns.",
|
|
59
|
-
"Do not use placeholders like '1', '2', '3', 'step 1', or generic labels. Each todo must name the concrete work it represents.",
|
|
60
59
|
"After each evidence step, update the todo board. Before the final answer, close every todo as completed or failed.",
|
|
61
60
|
].join("\n");
|
|
62
61
|
function buildInitialRequiredPlanInstruction(primaryTools) {
|
|
@@ -69,13 +69,6 @@ function readTodoContent(todo) {
|
|
|
69
69
|
}
|
|
70
70
|
return "";
|
|
71
71
|
}
|
|
72
|
-
function isLowSignalTodoContent(content) {
|
|
73
|
-
const normalized = content.trim().toLowerCase();
|
|
74
|
-
if (!normalized) {
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
return /^\d+$/.test(normalized) || /^step\s*\d+$/.test(normalized) || /^todo\s*\d+$/.test(normalized);
|
|
78
|
-
}
|
|
79
72
|
function normalizeTodoStatus(value) {
|
|
80
73
|
if (typeof value !== "string") {
|
|
81
74
|
return "pending";
|
|
@@ -97,9 +90,6 @@ export function summarizeBuiltinWriteTodosArgs(args) {
|
|
|
97
90
|
return [];
|
|
98
91
|
}
|
|
99
92
|
const content = readTodoContent(todo);
|
|
100
|
-
if (isLowSignalTodoContent(content)) {
|
|
101
|
-
return [];
|
|
102
|
-
}
|
|
103
93
|
const status = normalizeTodoStatus(todo.status);
|
|
104
94
|
const metadata = isRecord(todo.metadata) ? todo.metadata : undefined;
|
|
105
95
|
return content ? [{
|
|
@@ -265,6 +265,18 @@ function buildCompactRouterPolicy(routingPolicy) {
|
|
|
265
265
|
.slice(0, 80)
|
|
266
266
|
.join("\n");
|
|
267
267
|
}
|
|
268
|
+
function looksLikeStructuredMultiItemRequest(requestText) {
|
|
269
|
+
const lines = requestText
|
|
270
|
+
.split(/\r?\n/u)
|
|
271
|
+
.map((line) => line.trim())
|
|
272
|
+
.filter(Boolean);
|
|
273
|
+
const numberedItems = lines.filter((line) => /^\d+[\.)、]\s+/u.test(line));
|
|
274
|
+
if (numberedItems.length >= 2) {
|
|
275
|
+
return true;
|
|
276
|
+
}
|
|
277
|
+
const bulletItems = lines.filter((line) => /^[-*]\s+/u.test(line));
|
|
278
|
+
return bulletItems.length >= 2;
|
|
279
|
+
}
|
|
268
280
|
function buildDelegatedOwnedTaskInstruction(input) {
|
|
269
281
|
return [
|
|
270
282
|
`Delegated owner: ${input.subagentType}.`,
|
|
@@ -1242,6 +1254,7 @@ export class AgentRuntimeAdapter {
|
|
|
1242
1254
|
}
|
|
1243
1255
|
const subagents = getBindingSubagents(binding);
|
|
1244
1256
|
const subagentNames = new Set(subagents.map((subagent) => subagent.name));
|
|
1257
|
+
const structuredMultiItemRequest = looksLikeStructuredMultiItemRequest(requestText);
|
|
1245
1258
|
let selection = null;
|
|
1246
1259
|
const subagentCatalog = subagents
|
|
1247
1260
|
.map((subagent) => `- ${subagent.name}: ${subagent.description}`)
|
|
@@ -1253,6 +1266,7 @@ export class AgentRuntimeAdapter {
|
|
|
1253
1266
|
"You are selecting a subagent for a delegation-only agent.",
|
|
1254
1267
|
"Choose exactly one listed subagent when it can responsibly handle the request.",
|
|
1255
1268
|
"Use the agent routing policy as authoritative routing configuration when it maps the request meaning to a listed subagent.",
|
|
1269
|
+
"When the routing policy says a request class is owned by one listed subagent, keep that request with the configured owner even if the task mentions supporting evidence from other domains.",
|
|
1256
1270
|
"Do not refuse while any listed subagent can own the request after applying the routing policy.",
|
|
1257
1271
|
"Refuse only when the request is outside every listed subagent's configured responsibility.",
|
|
1258
1272
|
compactRoutingPolicy ? "Agent routing policy:" : "",
|
|
@@ -1330,6 +1344,10 @@ export class AgentRuntimeAdapter {
|
|
|
1330
1344
|
continue;
|
|
1331
1345
|
}
|
|
1332
1346
|
if (parsedSelection.delegations && parsedSelection.delegations.length > 1) {
|
|
1347
|
+
if (selection?.subagentType
|
|
1348
|
+
&& !parsedSelection.delegations.some((delegation) => delegation.subagentType === selection?.subagentType)) {
|
|
1349
|
+
continue;
|
|
1350
|
+
}
|
|
1333
1351
|
selection = parsedSelection;
|
|
1334
1352
|
break;
|
|
1335
1353
|
}
|
|
@@ -1340,7 +1358,96 @@ export class AgentRuntimeAdapter {
|
|
|
1340
1358
|
}
|
|
1341
1359
|
}
|
|
1342
1360
|
}
|
|
1343
|
-
if (selection?.delegations && selection.delegations.length >
|
|
1361
|
+
if (selection?.delegations && selection.delegations.length > 1) {
|
|
1362
|
+
const aggregateToolResults = [];
|
|
1363
|
+
const childReports = [];
|
|
1364
|
+
for (const planned of selection.delegations) {
|
|
1365
|
+
const selectedBinding = this.options.bindingResolver(planned.subagentType);
|
|
1366
|
+
if (!selectedBinding) {
|
|
1367
|
+
const output = `Configured subagent '${planned.subagentType}' could not be resolved.`;
|
|
1368
|
+
childReports.push({
|
|
1369
|
+
subagentType: planned.subagentType,
|
|
1370
|
+
result: {
|
|
1371
|
+
sessionId,
|
|
1372
|
+
requestId: `${requestId}:${planned.subagentType}`,
|
|
1373
|
+
agentId: planned.subagentType,
|
|
1374
|
+
state: "failed",
|
|
1375
|
+
output,
|
|
1376
|
+
finalMessageText: output,
|
|
1377
|
+
metadata: { executedToolResults: [] },
|
|
1378
|
+
},
|
|
1379
|
+
output,
|
|
1380
|
+
});
|
|
1381
|
+
continue;
|
|
1382
|
+
}
|
|
1383
|
+
const delegatedResult = await this.invoke(selectedBinding, buildDelegatedOwnedTaskInstruction({
|
|
1384
|
+
subagentType: planned.subagentType,
|
|
1385
|
+
taskText: planned.description,
|
|
1386
|
+
originalRequest: requestText,
|
|
1387
|
+
}), sessionId, `${requestId}:${planned.subagentType}`, undefined, [], {
|
|
1388
|
+
context: options.context,
|
|
1389
|
+
state: options.state,
|
|
1390
|
+
files: options.files,
|
|
1391
|
+
memoryContext: options.memoryContext,
|
|
1392
|
+
});
|
|
1393
|
+
const executedToolResults = Array.isArray(delegatedResult.metadata?.executedToolResults)
|
|
1394
|
+
? delegatedResult.metadata.executedToolResults
|
|
1395
|
+
: [];
|
|
1396
|
+
aggregateToolResults.push(...executedToolResults);
|
|
1397
|
+
childReports.push({
|
|
1398
|
+
subagentType: planned.subagentType,
|
|
1399
|
+
result: delegatedResult,
|
|
1400
|
+
output: typeof delegatedResult.output === "string" ? delegatedResult.output : String(delegatedResult.output ?? ""),
|
|
1401
|
+
});
|
|
1402
|
+
}
|
|
1403
|
+
const failedChildren = childReports.filter((child) => child.result.state === "failed");
|
|
1404
|
+
const uniqueToolNames = [...new Set(aggregateToolResults.map((toolResult) => toolResult.toolName))];
|
|
1405
|
+
const status = failedChildren.length > 0 ? "failed" : "completed";
|
|
1406
|
+
const report = childReports
|
|
1407
|
+
.map((child) => `## ${child.subagentType}\n${child.output.trim() || "No visible output returned."}`)
|
|
1408
|
+
.join("\n\n");
|
|
1409
|
+
const output = JSON.stringify({
|
|
1410
|
+
status,
|
|
1411
|
+
routing: selection.delegations.map((planned, index) => `${index + 1}) 路由判断: ${planned.subagentType} 负责 ${planned.description.trim() || "该专业域子任务"}。`),
|
|
1412
|
+
plan: selection.delegations.map((planned, index) => `${index + 1}) 委托 ${planned.subagentType}: ${planned.description.trim() || "执行其专业域任务"}。`),
|
|
1413
|
+
execution: childReports.map((child, index) => `${index + 1}) ${child.subagentType} ${child.result.state === "failed" ? "failed" : "completed"}。`),
|
|
1414
|
+
todoTrace: childReports.map((child, index) => `${index + 1}) ${child.subagentType}: ${hasDelegatedPlanEvidence(child.result) ? "TODO evidence observed" : "TODO evidence missing"}。`),
|
|
1415
|
+
stepResults: childReports.map((child, index) => `${index + 1}) ${child.subagentType}: delegated result collected; aggregate tools = ${uniqueToolNames.length > 0 ? uniqueToolNames.join(", ") : "none"}。`),
|
|
1416
|
+
summary: [
|
|
1417
|
+
status === "failed"
|
|
1418
|
+
? `多 specialist 编排完成,但 ${failedChildren.length} 个委托返回 failed。`
|
|
1419
|
+
: "多 specialist 编排已完成,所有委托均返回 completed。",
|
|
1420
|
+
],
|
|
1421
|
+
findings: childReports.map((child) => `${child.subagentType}: ${child.output.trim().slice(0, 500) || "No finding text returned."}`),
|
|
1422
|
+
blockers: failedChildren.length > 0
|
|
1423
|
+
? failedChildren.map((child) => `${child.subagentType}: delegated execution failed.`)
|
|
1424
|
+
: ["none"],
|
|
1425
|
+
nextActions: failedChildren.length > 0
|
|
1426
|
+
? ["查看 failed specialist 的 blocker 并单独重跑该委托。"]
|
|
1427
|
+
: ["可基于各 specialist 结果继续做最终修复或发布决策。"],
|
|
1428
|
+
report,
|
|
1429
|
+
});
|
|
1430
|
+
return {
|
|
1431
|
+
toolOutput: output,
|
|
1432
|
+
delegatedSubagentType: "multiple",
|
|
1433
|
+
delegatedResult: {
|
|
1434
|
+
sessionId,
|
|
1435
|
+
requestId,
|
|
1436
|
+
agentId: binding.agent.id,
|
|
1437
|
+
state: status,
|
|
1438
|
+
output,
|
|
1439
|
+
finalMessageText: output,
|
|
1440
|
+
metadata: {
|
|
1441
|
+
executedToolResults: aggregateToolResults,
|
|
1442
|
+
delegations: childReports.map((child) => ({
|
|
1443
|
+
subagentType: child.subagentType,
|
|
1444
|
+
state: child.result.state,
|
|
1445
|
+
})),
|
|
1446
|
+
},
|
|
1447
|
+
},
|
|
1448
|
+
};
|
|
1449
|
+
}
|
|
1450
|
+
if (selection?.delegations && selection.delegations.length === 1) {
|
|
1344
1451
|
selection = { subagentType: selection.delegations[0].subagentType };
|
|
1345
1452
|
}
|
|
1346
1453
|
if (selection?.refusedReason) {
|
|
@@ -1600,6 +1707,7 @@ export class AgentRuntimeAdapter {
|
|
|
1600
1707
|
}
|
|
1601
1708
|
const subagents = getBindingSubagents(binding);
|
|
1602
1709
|
const subagentNames = new Set(subagents.map((subagent) => subagent.name));
|
|
1710
|
+
const structuredMultiItemRequest = looksLikeStructuredMultiItemRequest(requestText);
|
|
1603
1711
|
let selection = null;
|
|
1604
1712
|
const subagentCatalog = subagents
|
|
1605
1713
|
.map((subagent) => `- ${subagent.name}: ${subagent.description}`)
|
|
@@ -1611,9 +1719,14 @@ export class AgentRuntimeAdapter {
|
|
|
1611
1719
|
"You are planning delegation for a delegation-only agent.",
|
|
1612
1720
|
"Choose exactly one listed subagent when one specialist can responsibly handle the request.",
|
|
1613
1721
|
"If the request naturally requires multiple specialist-owned steps, return an ordered delegation plan instead of one subagent.",
|
|
1722
|
+
"A single objective with multiple evidence requirements is still single-owner when one listed subagent owns the objective.",
|
|
1723
|
+
"Return multi-owner delegations only when the user asks for multiple independently owned specialist work items.",
|
|
1614
1724
|
"For multi-line or numbered requests, evaluate every requested item semantically before choosing the final owner list.",
|
|
1615
1725
|
"Use the agent routing policy as authoritative routing configuration when it maps request meaning to listed subagents.",
|
|
1616
1726
|
"Apply the routing policy and subagent catalog literally; do not assign work to a subagent when the policy says that subagent is not the owner.",
|
|
1727
|
+
"When the routing policy or subagent catalog says a request class routes to one owner only, choose that single owner.",
|
|
1728
|
+
"Evidence dimensions inside one request, such as tools, files, CI, output format, failure states, routing, or runtime paths, are inputs to the selected owner; they do not create extra owners unless the user asks those specialists to do their own work.",
|
|
1729
|
+
"A request made from one specialist perspective is single-owner when that specialist can responsibly handle the whole requested assessment.",
|
|
1617
1730
|
"Evaluate each listed subagent independently against the request and include every listed owner whose configured responsibility is required.",
|
|
1618
1731
|
"Do not merge one listed subagent's configured responsibility into another listed subagent's task.",
|
|
1619
1732
|
"A broad request can still be handleable when multiple listed subagents each own part of it; return a delegation plan in that case.",
|
|
@@ -1687,9 +1800,12 @@ export class AgentRuntimeAdapter {
|
|
|
1687
1800
|
primaryModel.init?.think === false ? "/no_think" : "",
|
|
1688
1801
|
"Multi-specialist delegation is supported.",
|
|
1689
1802
|
"If a request needs multiple listed specialists, that is not a refusal condition.",
|
|
1803
|
+
"A single objective with multiple evidence requirements is still single-owner when one listed subagent owns the objective.",
|
|
1804
|
+
"Return multi-owner delegations only when the user asks for multiple independently owned specialist work items.",
|
|
1690
1805
|
"Return a delegations array that assigns each specialist-owned work item to listed subagents.",
|
|
1691
1806
|
"Evaluate each listed subagent independently against the request and include every listed owner whose configured responsibility is required.",
|
|
1692
1807
|
"Do not merge one listed subagent's configured responsibility into another listed subagent's task.",
|
|
1808
|
+
"Do not turn supporting evidence dimensions into separate owners when one listed subagent owns the requested assessment.",
|
|
1693
1809
|
"Never return final response fields such as routing, todoTrace, stepResults, summary, findings, blockers, nextActions, or report.",
|
|
1694
1810
|
"Return JSON only with this exact shape:",
|
|
1695
1811
|
"{\"delegations\":[{\"subagent_type\":\"<one exact listed name>\",\"description\":\"<owned subtask>\"}]}",
|
|
@@ -1719,6 +1835,10 @@ export class AgentRuntimeAdapter {
|
|
|
1719
1835
|
selection = parsedSelection;
|
|
1720
1836
|
break;
|
|
1721
1837
|
}
|
|
1838
|
+
if (parsedSelection.subagentType && !structuredMultiItemRequest) {
|
|
1839
|
+
selection = parsedSelection;
|
|
1840
|
+
break;
|
|
1841
|
+
}
|
|
1722
1842
|
if (!selection || selection.refusedReason || parsedSelection.subagentType) {
|
|
1723
1843
|
selection = parsedSelection.refusedReason && index < routerPrompts.length - 1
|
|
1724
1844
|
? selection
|
|
@@ -1740,10 +1860,14 @@ export class AgentRuntimeAdapter {
|
|
|
1740
1860
|
"Internally review every sentence or list item in the user request before returning JSON.",
|
|
1741
1861
|
"Return one corrected JSON object only.",
|
|
1742
1862
|
"Keep the candidate plan unchanged when it already covers every specialist-owned work item.",
|
|
1863
|
+
"Return a single subagent_type when one listed subagent owns the whole request and the candidate plan only split supporting evidence dimensions.",
|
|
1864
|
+
"A single objective with multiple evidence requirements is still single-owner when one listed subagent owns the objective.",
|
|
1865
|
+
"Return multi-owner delegations only when the user asks for multiple independently owned specialist work items.",
|
|
1743
1866
|
"If the candidate omits a specialist-owned work item, add that listed subagent in the correct user-requested order.",
|
|
1744
1867
|
"If the candidate includes a subagent whose described work is not owned by that subagent, remove or replace it.",
|
|
1745
1868
|
"Evaluate each listed subagent independently against the request and include every listed owner whose configured responsibility is required.",
|
|
1746
1869
|
"Do not merge one listed subagent's configured responsibility into another listed subagent's task.",
|
|
1870
|
+
"Do not turn supporting evidence dimensions into separate owners when one listed subagent owns the requested assessment.",
|
|
1747
1871
|
"Do not add a subagent unless the routing policy or subagent catalog makes ownership clear.",
|
|
1748
1872
|
"When the routing policy states that a subagent is not the owner for a domain, do not assign that domain to that subagent.",
|
|
1749
1873
|
"Use only listed subagent names.",
|
|
@@ -1753,7 +1877,8 @@ export class AgentRuntimeAdapter {
|
|
|
1753
1877
|
subagentCatalog,
|
|
1754
1878
|
"Candidate delegation plan:",
|
|
1755
1879
|
candidatePlan,
|
|
1756
|
-
"
|
|
1880
|
+
"Allowed JSON shapes:",
|
|
1881
|
+
"{\"subagent_type\":\"<listed subagent name>\"}",
|
|
1757
1882
|
"{\"delegations\":[{\"subagent_type\":\"<listed subagent name>\",\"description\":\"<only that specialist's owned portion>\"}]}",
|
|
1758
1883
|
"User request:",
|
|
1759
1884
|
requestText,
|
|
@@ -1762,15 +1887,62 @@ export class AgentRuntimeAdapter {
|
|
|
1762
1887
|
if (rawCoverage !== null) {
|
|
1763
1888
|
const coverageText = readModelText(rawCoverage);
|
|
1764
1889
|
const coverageSelection = parseCompactRouterSelection(coverageText, subagentNames);
|
|
1890
|
+
if (coverageSelection?.subagentType && !structuredMultiItemRequest) {
|
|
1891
|
+
selection = coverageSelection;
|
|
1892
|
+
}
|
|
1893
|
+
if (coverageSelection?.delegations && coverageSelection.delegations.length === 1 && !structuredMultiItemRequest) {
|
|
1894
|
+
selection = { subagentType: coverageSelection.delegations[0].subagentType };
|
|
1895
|
+
}
|
|
1765
1896
|
if (coverageSelection?.delegations && coverageSelection.delegations.length > 1) {
|
|
1766
1897
|
const candidateNames = new Set(candidateDelegations.map((item) => item.subagentType));
|
|
1767
1898
|
const coverageNames = new Set(coverageSelection.delegations.map((item) => item.subagentType));
|
|
1768
1899
|
const preservesCandidateOwners = Array.from(candidateNames).every((name) => coverageNames.has(name));
|
|
1769
|
-
if (
|
|
1900
|
+
if (preservesCandidateOwners) {
|
|
1770
1901
|
selection = coverageSelection;
|
|
1771
1902
|
}
|
|
1772
1903
|
}
|
|
1773
1904
|
}
|
|
1905
|
+
if (candidateDelegations.length > 1 && selection?.delegations && selection.delegations.length > 1) {
|
|
1906
|
+
const activePlan = selection.delegations
|
|
1907
|
+
.map((item, index) => `${index + 1}. ${item.subagentType}: ${item.description}`)
|
|
1908
|
+
.join("\n");
|
|
1909
|
+
const arbitrationPrompt = [
|
|
1910
|
+
primaryModel.init?.think === false ? "/no_think" : "",
|
|
1911
|
+
"Arbitrate whether this delegation plan is over-split.",
|
|
1912
|
+
"The runtime supports both one-owner and multi-owner delegation.",
|
|
1913
|
+
"Choose one owner when the routing policy or subagent catalog says one listed subagent owns the whole request.",
|
|
1914
|
+
"A single objective with multiple evidence requirements is still single-owner when one listed subagent owns the objective.",
|
|
1915
|
+
"Treat supporting evidence dimensions as inputs to that owner, not as separate owners.",
|
|
1916
|
+
"Keep multi-owner delegation only when the user asked for multiple independently owned specialist work items.",
|
|
1917
|
+
"Return exactly one JSON object and no prose.",
|
|
1918
|
+
"Single-owner shape:",
|
|
1919
|
+
"{\"subagent_type\":\"<listed subagent name>\"}",
|
|
1920
|
+
"Multi-owner shape:",
|
|
1921
|
+
"{\"delegations\":[{\"subagent_type\":\"<listed subagent name>\",\"description\":\"<only that specialist's owned portion>\"}]}",
|
|
1922
|
+
compactRoutingPolicy ? "Agent routing policy:" : "",
|
|
1923
|
+
compactRoutingPolicy,
|
|
1924
|
+
"Available subagents:",
|
|
1925
|
+
subagentCatalog,
|
|
1926
|
+
"Candidate plan:",
|
|
1927
|
+
activePlan,
|
|
1928
|
+
"User request:",
|
|
1929
|
+
requestText,
|
|
1930
|
+
].filter(Boolean).join("\n\n");
|
|
1931
|
+
const rawArbitration = await invokeRouter(arbitrationPrompt, "delegation router over-split arbitration invoke");
|
|
1932
|
+
if (rawArbitration !== null) {
|
|
1933
|
+
const arbitrationText = readModelText(rawArbitration);
|
|
1934
|
+
const arbitrationSelection = parseCompactRouterSelection(arbitrationText, subagentNames);
|
|
1935
|
+
if (arbitrationSelection?.subagentType && !structuredMultiItemRequest) {
|
|
1936
|
+
selection = arbitrationSelection;
|
|
1937
|
+
}
|
|
1938
|
+
else if (arbitrationSelection?.delegations && arbitrationSelection.delegations.length === 1 && !structuredMultiItemRequest) {
|
|
1939
|
+
selection = { subagentType: arbitrationSelection.delegations[0].subagentType };
|
|
1940
|
+
}
|
|
1941
|
+
else if (arbitrationSelection?.delegations && arbitrationSelection.delegations.length > 1) {
|
|
1942
|
+
selection = arbitrationSelection;
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1774
1946
|
}
|
|
1775
1947
|
if (selection?.delegations?.length === 1) {
|
|
1776
1948
|
const onlyDelegation = selection.delegations[0];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { appendToolRecoveryInstruction, isRepairableWriteTodosContentFailure, isRepairableWriteTodosEmptyFailure,
|
|
2
|
-
export { BROWSER_CAPABILITY_DISCLAIMER_RECOVERY_INSTRUCTION, EXECUTION_WITH_TOOL_EVIDENCE_INSTRUCTION, EXECUTION_WITH_TOOL_EVIDENCE_RETRY_INSTRUCTION, INVALID_TOOL_SELECTION_RECOVERY_INSTRUCTION, STRICT_TOOL_JSON_INSTRUCTION, WORKSPACE_RELATIVE_PATH_INSTRUCTION,
|
|
1
|
+
export { appendToolRecoveryInstruction, isRepairableWriteTodosContentFailure, isRepairableWriteTodosEmptyFailure, isRetrySafeInvalidToolSelectionError, resolveMissingPlanRecoveryInstruction, isToolCallRecoveryFailure, isToolCallValidationFailure, isWorkspacePathScopeFailure, resolveExecutionWithoutToolEvidenceInstruction, resolveExecutionWithoutToolEvidenceTextInstruction, resolveToolCallRecoveryInstruction, shouldValidateExecutionWithoutToolEvidence, wrapResolvedModel, } from "./output-recovery.js";
|
|
2
|
+
export { BROWSER_CAPABILITY_DISCLAIMER_RECOVERY_INSTRUCTION, EXECUTION_WITH_TOOL_EVIDENCE_INSTRUCTION, EXECUTION_WITH_TOOL_EVIDENCE_RETRY_INSTRUCTION, INVALID_TOOL_SELECTION_RECOVERY_INSTRUCTION, STRICT_TOOL_JSON_INSTRUCTION, WORKSPACE_RELATIVE_PATH_INSTRUCTION, WRITE_TODOS_FULL_ENTRY_INSTRUCTION, WRITE_TODOS_NON_EMPTY_INITIAL_LIST_INSTRUCTION, } from "../prompts/runtime-prompts.js";
|
|
3
3
|
export { containsLikelySkillDocument, extractContentBlocks, extractEmptyAssistantMessageFailure, extractOutputContent, extractReasoningText, extractToolFallbackContext, extractVisibleOutput, hasToolCalls, readTextContent, sanitizeVisibleText, } from "./output-content.js";
|
|
4
4
|
export { isLikelyToolArgsObject, salvageToolArgs, tryParseJson, } from "./output-tool-args.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { appendToolRecoveryInstruction, isRepairableWriteTodosContentFailure, isRepairableWriteTodosEmptyFailure,
|
|
2
|
-
export { BROWSER_CAPABILITY_DISCLAIMER_RECOVERY_INSTRUCTION, EXECUTION_WITH_TOOL_EVIDENCE_INSTRUCTION, EXECUTION_WITH_TOOL_EVIDENCE_RETRY_INSTRUCTION, INVALID_TOOL_SELECTION_RECOVERY_INSTRUCTION, STRICT_TOOL_JSON_INSTRUCTION, WORKSPACE_RELATIVE_PATH_INSTRUCTION,
|
|
1
|
+
export { appendToolRecoveryInstruction, isRepairableWriteTodosContentFailure, isRepairableWriteTodosEmptyFailure, isRetrySafeInvalidToolSelectionError, resolveMissingPlanRecoveryInstruction, isToolCallRecoveryFailure, isToolCallValidationFailure, isWorkspacePathScopeFailure, resolveExecutionWithoutToolEvidenceInstruction, resolveExecutionWithoutToolEvidenceTextInstruction, resolveToolCallRecoveryInstruction, shouldValidateExecutionWithoutToolEvidence, wrapResolvedModel, } from "./output-recovery.js";
|
|
2
|
+
export { BROWSER_CAPABILITY_DISCLAIMER_RECOVERY_INSTRUCTION, EXECUTION_WITH_TOOL_EVIDENCE_INSTRUCTION, EXECUTION_WITH_TOOL_EVIDENCE_RETRY_INSTRUCTION, INVALID_TOOL_SELECTION_RECOVERY_INSTRUCTION, STRICT_TOOL_JSON_INSTRUCTION, WORKSPACE_RELATIVE_PATH_INSTRUCTION, WRITE_TODOS_FULL_ENTRY_INSTRUCTION, WRITE_TODOS_NON_EMPTY_INITIAL_LIST_INSTRUCTION, } from "../prompts/runtime-prompts.js";
|
|
3
3
|
export { containsLikelySkillDocument, extractContentBlocks, extractEmptyAssistantMessageFailure, extractOutputContent, extractReasoningText, extractToolFallbackContext, extractVisibleOutput, hasToolCalls, readTextContent, sanitizeVisibleText, } from "./output-content.js";
|
|
4
4
|
export { isLikelyToolArgsObject, salvageToolArgs, tryParseJson, } from "./output-tool-args.js";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export declare function isToolCallValidationFailure(error: unknown): boolean;
|
|
2
2
|
export declare function isWorkspacePathScopeFailure(error: unknown): boolean;
|
|
3
3
|
export declare function isInternalRuntimeSpillPathFailure(error: unknown): boolean;
|
|
4
|
-
export declare function isRepairableWriteTodosPlaceholderFailure(error: unknown): boolean;
|
|
5
4
|
export declare function isRepairableWriteTodosContentFailure(error: unknown): boolean;
|
|
6
5
|
export declare function isRepairableWriteTodosEmptyFailure(error: unknown): boolean;
|
|
7
6
|
export declare function isToolCallRecoveryFailure(error: unknown): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EXECUTION_WITH_TOOL_EVIDENCE_RETRY_INSTRUCTION, INTERNAL_RUNTIME_SPILL_PATH_INSTRUCTION, REQUIRED_EXECUTION_CONTINUATION_INSTRUCTION, STRICT_TOOL_JSON_INSTRUCTION, WORKSPACE_RELATIVE_PATH_INSTRUCTION,
|
|
1
|
+
import { EXECUTION_WITH_TOOL_EVIDENCE_RETRY_INSTRUCTION, INTERNAL_RUNTIME_SPILL_PATH_INSTRUCTION, REQUIRED_EXECUTION_CONTINUATION_INSTRUCTION, STRICT_TOOL_JSON_INSTRUCTION, WORKSPACE_RELATIVE_PATH_INSTRUCTION, WRITE_TODOS_FULL_ENTRY_INSTRUCTION, WRITE_TODOS_NON_EMPTY_INITIAL_LIST_INSTRUCTION, WRITE_TODOS_REQUIRED_PLAN_INSTRUCTION, } from "../prompts/runtime-prompts.js";
|
|
2
2
|
import { wrapNormalizedMessage, readTextContent } from "./output-content.js";
|
|
3
3
|
import { salvageJsonToolCalls } from "./output-tool-args.js";
|
|
4
4
|
function collectRequestMessages(request) {
|
|
@@ -85,9 +85,6 @@ export function isWorkspacePathScopeFailure(error) {
|
|
|
85
85
|
export function isInternalRuntimeSpillPathFailure(error) {
|
|
86
86
|
return collectErrorMessages(error).some((message) => /\/large_tool_results\/|internal runtime spill path/i.test(message));
|
|
87
87
|
}
|
|
88
|
-
export function isRepairableWriteTodosPlaceholderFailure(error) {
|
|
89
|
-
return error instanceof Error && /write_todos/i.test(error.message) && /descriptive task content|placeholder entries/i.test(error.message);
|
|
90
|
-
}
|
|
91
88
|
export function isRepairableWriteTodosContentFailure(error) {
|
|
92
89
|
return error instanceof Error && /write_todos/i.test(error.message) && /todos\[\d+\]\.content/i.test(error.message);
|
|
93
90
|
}
|
|
@@ -98,7 +95,6 @@ export function isToolCallRecoveryFailure(error) {
|
|
|
98
95
|
return (isToolCallParseFailure(error) ||
|
|
99
96
|
isToolCallValidationFailure(error) ||
|
|
100
97
|
isRepairableWriteTodosEmptyFailure(error) ||
|
|
101
|
-
isRepairableWriteTodosPlaceholderFailure(error) ||
|
|
102
98
|
isInternalRuntimeSpillPathFailure(error) ||
|
|
103
99
|
isWorkspacePathScopeFailure(error));
|
|
104
100
|
}
|
|
@@ -160,8 +156,6 @@ export function resolveToolCallRecoveryInstruction(error) {
|
|
|
160
156
|
return WRITE_TODOS_NON_EMPTY_INITIAL_LIST_INSTRUCTION;
|
|
161
157
|
if (isRepairableWriteTodosContentFailure(error))
|
|
162
158
|
return WRITE_TODOS_FULL_ENTRY_INSTRUCTION;
|
|
163
|
-
if (isRepairableWriteTodosPlaceholderFailure(error))
|
|
164
|
-
return WRITE_TODOS_DESCRIPTIVE_CONTENT_INSTRUCTION;
|
|
165
159
|
if (isInternalRuntimeSpillPathFailure(error))
|
|
166
160
|
return INTERNAL_RUNTIME_SPILL_PATH_INSTRUCTION;
|
|
167
161
|
if (isWorkspacePathScopeFailure(error))
|
|
@@ -6,7 +6,6 @@ export declare const BROWSER_CAPABILITY_DISCLAIMER_RECOVERY_INSTRUCTION: string;
|
|
|
6
6
|
export declare const INVALID_TOOL_SELECTION_RECOVERY_INSTRUCTION: string;
|
|
7
7
|
export declare const WRITE_TODOS_FULL_ENTRY_INSTRUCTION: string;
|
|
8
8
|
export declare const WRITE_TODOS_NON_EMPTY_INITIAL_LIST_INSTRUCTION: string;
|
|
9
|
-
export declare const WRITE_TODOS_DESCRIPTIVE_CONTENT_INSTRUCTION: string;
|
|
10
9
|
export declare const WRITE_TODOS_REQUIRED_PLAN_INSTRUCTION: string;
|
|
11
10
|
export declare const EXECUTION_WITH_TOOL_EVIDENCE_INSTRUCTION: string;
|
|
12
11
|
export declare const EXECUTION_WITH_TOOL_EVIDENCE_RETRY_INSTRUCTION: string;
|
|
@@ -9,7 +9,6 @@ export const BROWSER_CAPABILITY_DISCLAIMER_RECOVERY_INSTRUCTION = readRuntimePro
|
|
|
9
9
|
export const INVALID_TOOL_SELECTION_RECOVERY_INSTRUCTION = readRuntimePrompt("invalid-tool-selection-recovery");
|
|
10
10
|
export const WRITE_TODOS_FULL_ENTRY_INSTRUCTION = readRuntimePrompt("write-todos-full-entry");
|
|
11
11
|
export const WRITE_TODOS_NON_EMPTY_INITIAL_LIST_INSTRUCTION = readRuntimePrompt("write-todos-non-empty-initial-list");
|
|
12
|
-
export const WRITE_TODOS_DESCRIPTIVE_CONTENT_INSTRUCTION = readRuntimePrompt("write-todos-descriptive-content");
|
|
13
12
|
export const WRITE_TODOS_REQUIRED_PLAN_INSTRUCTION = readRuntimePrompt("write-todos-required-plan");
|
|
14
13
|
export const EXECUTION_WITH_TOOL_EVIDENCE_INSTRUCTION = readRuntimePrompt("execution-with-tool-evidence");
|
|
15
14
|
export const EXECUTION_WITH_TOOL_EVIDENCE_RETRY_INSTRUCTION = readRuntimePrompt("execution-with-tool-evidence-retry");
|