@botbotgo/agent-harness 0.0.436 → 0.0.437
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.
|
|
1
|
+
export declare const AGENT_HARNESS_VERSION = "0.0.437";
|
|
2
2
|
export declare const AGENT_HARNESS_RELEASE_DATE = "2026-05-03";
|
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.437";
|
|
2
2
|
export const AGENT_HARNESS_RELEASE_DATE = "2026-05-03";
|
|
@@ -486,37 +486,6 @@ function parseCompactRouterSelection(value, subagentNames) {
|
|
|
486
486
|
}
|
|
487
487
|
return null;
|
|
488
488
|
}
|
|
489
|
-
function extractExplicitSubagentTasks(requestText, subagentNames) {
|
|
490
|
-
const lines = requestText.split(/\r?\n/u);
|
|
491
|
-
const tasks = [];
|
|
492
|
-
let current = null;
|
|
493
|
-
const marker = new RegExp(`^\\s*(?:[-*]|\\d+[.)]|\\d+\\s*[、.])?\\s*(${Array.from(subagentNames).map(escapeRegExp).join("|")})\\s*[::]\\s*(.*)$`, "iu");
|
|
494
|
-
for (const line of lines) {
|
|
495
|
-
const match = marker.exec(line);
|
|
496
|
-
if (match?.[1]) {
|
|
497
|
-
if (current) {
|
|
498
|
-
tasks.push({ subagentType: current.subagentType, text: current.parts.join("\n").trim() });
|
|
499
|
-
}
|
|
500
|
-
const subagentType = Array.from(subagentNames).find((name) => name.toLowerCase() === match[1].toLowerCase()) ?? match[1];
|
|
501
|
-
current = { subagentType, parts: [match[2] ?? ""] };
|
|
502
|
-
continue;
|
|
503
|
-
}
|
|
504
|
-
if (current && line.trim()) {
|
|
505
|
-
current.parts.push(line);
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
if (current) {
|
|
509
|
-
tasks.push({ subagentType: current.subagentType, text: current.parts.join("\n").trim() });
|
|
510
|
-
}
|
|
511
|
-
const deduped = [];
|
|
512
|
-
for (const task of tasks) {
|
|
513
|
-
if (!subagentNames.has(task.subagentType) || deduped.some((item) => item.subagentType === task.subagentType)) {
|
|
514
|
-
continue;
|
|
515
|
-
}
|
|
516
|
-
deduped.push({ subagentType: task.subagentType, text: task.text || requestText });
|
|
517
|
-
}
|
|
518
|
-
return deduped;
|
|
519
|
-
}
|
|
520
489
|
function buildCompactRouterPolicy(routingPolicy, subagentNames) {
|
|
521
490
|
if (!routingPolicy) {
|
|
522
491
|
return "";
|
|
@@ -1811,20 +1780,18 @@ export class AgentRuntimeAdapter {
|
|
|
1811
1780
|
: parsedSelection;
|
|
1812
1781
|
}
|
|
1813
1782
|
}
|
|
1814
|
-
const explicitTasks = extractExplicitSubagentTasks(requestText, subagentNames);
|
|
1815
1783
|
const numberedRequestSteps = requestText
|
|
1816
1784
|
.split(/\r?\n/u)
|
|
1817
1785
|
.map((item) => item.trim())
|
|
1818
1786
|
.filter((item) => /^\d+\s*[.)、.]\s*/u.test(item));
|
|
1819
|
-
const shouldRouteNumberedClauses =
|
|
1820
|
-
&& model
|
|
1787
|
+
const shouldRouteNumberedClauses = model
|
|
1821
1788
|
&& numberedRequestSteps.length > 1
|
|
1822
1789
|
&& (!selection
|
|
1823
1790
|
|| Boolean(selection.refusedReason)
|
|
1824
1791
|
|| (Array.isArray(selection.delegations)
|
|
1825
1792
|
&& selection.delegations.length > 1
|
|
1826
1793
|
&& selection.delegations.length < numberedRequestSteps.length));
|
|
1827
|
-
if (shouldRouteNumberedClauses || ((!selection || selection.refusedReason) &&
|
|
1794
|
+
if (shouldRouteNumberedClauses || ((!selection || selection.refusedReason) && model)) {
|
|
1828
1795
|
const routeClauses = numberedRequestSteps.length > 1 ? numberedRequestSteps : [requestText];
|
|
1829
1796
|
const routedDelegations = [];
|
|
1830
1797
|
for (const [index, clause] of routeClauses.entries()) {
|
|
@@ -1863,19 +1830,6 @@ export class AgentRuntimeAdapter {
|
|
|
1863
1830
|
selection = { subagentType: routedDelegations[0].subagentType };
|
|
1864
1831
|
}
|
|
1865
1832
|
}
|
|
1866
|
-
if (!selection) {
|
|
1867
|
-
if (explicitTasks.length > 1) {
|
|
1868
|
-
selection = {
|
|
1869
|
-
delegations: explicitTasks.map((task) => ({
|
|
1870
|
-
subagentType: task.subagentType,
|
|
1871
|
-
description: task.text,
|
|
1872
|
-
})),
|
|
1873
|
-
};
|
|
1874
|
-
}
|
|
1875
|
-
else if (explicitTasks.length === 1) {
|
|
1876
|
-
selection = { subagentType: explicitTasks[0].subagentType };
|
|
1877
|
-
}
|
|
1878
|
-
}
|
|
1879
1833
|
if (selection?.delegations?.length === 1) {
|
|
1880
1834
|
const onlyDelegation = selection.delegations[0];
|
|
1881
1835
|
selection = { subagentType: onlyDelegation.subagentType };
|
|
@@ -1886,7 +1840,7 @@ export class AgentRuntimeAdapter {
|
|
|
1886
1840
|
const planCoversEverySubagent = plannedDelegations.length === subagents.length
|
|
1887
1841
|
&& plannedNames.size === subagentNames.size
|
|
1888
1842
|
&& Array.from(subagentNames).every((name) => plannedNames.has(name));
|
|
1889
|
-
const shouldCollapseOverbroadPlan = planCoversEverySubagent &&
|
|
1843
|
+
const shouldCollapseOverbroadPlan = planCoversEverySubagent && numberedRequestSteps.length < 3;
|
|
1890
1844
|
const executableDelegations = shouldCollapseOverbroadPlan ? plannedDelegations.slice(0, 1) : plannedDelegations;
|
|
1891
1845
|
const aggregateToolResults = [];
|
|
1892
1846
|
const childReports = [];
|