@botbotgo/agent-harness 0.0.435 → 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,55 +486,6 @@ function parseCompactRouterSelection(value, subagentNames) {
|
|
|
486
486
|
}
|
|
487
487
|
return null;
|
|
488
488
|
}
|
|
489
|
-
function resolveSingleExplicitOwnerMention(requestText, subagentNames) {
|
|
490
|
-
const numberedClauses = requestText
|
|
491
|
-
.split(/\r?\n/u)
|
|
492
|
-
.map((item) => item.trim())
|
|
493
|
-
.filter((item) => /^\d+\s*[.)、.]\s*/u.test(item));
|
|
494
|
-
if (numberedClauses.length > 1) {
|
|
495
|
-
return null;
|
|
496
|
-
}
|
|
497
|
-
const matches = [];
|
|
498
|
-
for (const subagentName of subagentNames) {
|
|
499
|
-
const escapedName = escapeRegExp(subagentName);
|
|
500
|
-
const pattern = new RegExp(`(?:^|[^\\p{L}\\p{N}_-])\`?${escapedName}\`?(?:$|[^\\p{L}\\p{N}_-])`, "iu");
|
|
501
|
-
if (pattern.test(requestText)) {
|
|
502
|
-
matches.push(subagentName);
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
return matches.length === 1 ? matches[0] : null;
|
|
506
|
-
}
|
|
507
|
-
function extractExplicitSubagentTasks(requestText, subagentNames) {
|
|
508
|
-
const lines = requestText.split(/\r?\n/u);
|
|
509
|
-
const tasks = [];
|
|
510
|
-
let current = null;
|
|
511
|
-
const marker = new RegExp(`^\\s*(?:[-*]|\\d+[.)]|\\d+\\s*[、.])?\\s*(${Array.from(subagentNames).map(escapeRegExp).join("|")})\\s*[::]\\s*(.*)$`, "iu");
|
|
512
|
-
for (const line of lines) {
|
|
513
|
-
const match = marker.exec(line);
|
|
514
|
-
if (match?.[1]) {
|
|
515
|
-
if (current) {
|
|
516
|
-
tasks.push({ subagentType: current.subagentType, text: current.parts.join("\n").trim() });
|
|
517
|
-
}
|
|
518
|
-
const subagentType = Array.from(subagentNames).find((name) => name.toLowerCase() === match[1].toLowerCase()) ?? match[1];
|
|
519
|
-
current = { subagentType, parts: [match[2] ?? ""] };
|
|
520
|
-
continue;
|
|
521
|
-
}
|
|
522
|
-
if (current && line.trim()) {
|
|
523
|
-
current.parts.push(line);
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
if (current) {
|
|
527
|
-
tasks.push({ subagentType: current.subagentType, text: current.parts.join("\n").trim() });
|
|
528
|
-
}
|
|
529
|
-
const deduped = [];
|
|
530
|
-
for (const task of tasks) {
|
|
531
|
-
if (!subagentNames.has(task.subagentType) || deduped.some((item) => item.subagentType === task.subagentType)) {
|
|
532
|
-
continue;
|
|
533
|
-
}
|
|
534
|
-
deduped.push({ subagentType: task.subagentType, text: task.text || requestText });
|
|
535
|
-
}
|
|
536
|
-
return deduped;
|
|
537
|
-
}
|
|
538
489
|
function buildCompactRouterPolicy(routingPolicy, subagentNames) {
|
|
539
490
|
if (!routingPolicy) {
|
|
540
491
|
return "";
|
|
@@ -1466,10 +1417,6 @@ export class AgentRuntimeAdapter {
|
|
|
1466
1417
|
: parsedSelection;
|
|
1467
1418
|
}
|
|
1468
1419
|
}
|
|
1469
|
-
const explicitOwner = resolveSingleExplicitOwnerMention(requestText, subagentNames);
|
|
1470
|
-
if ((selection?.refusedReason || !selection) && explicitOwner) {
|
|
1471
|
-
selection = { subagentType: explicitOwner };
|
|
1472
|
-
}
|
|
1473
1420
|
if (selection?.delegations && selection.delegations.length > 0) {
|
|
1474
1421
|
selection = { subagentType: selection.delegations[0].subagentType };
|
|
1475
1422
|
}
|
|
@@ -1833,25 +1780,18 @@ export class AgentRuntimeAdapter {
|
|
|
1833
1780
|
: parsedSelection;
|
|
1834
1781
|
}
|
|
1835
1782
|
}
|
|
1836
|
-
const explicitTasks = extractExplicitSubagentTasks(requestText, subagentNames);
|
|
1837
|
-
const explicitOwner = resolveSingleExplicitOwnerMention(requestText, subagentNames);
|
|
1838
|
-
if (selection?.refusedReason && explicitOwner) {
|
|
1839
|
-
selection = { subagentType: explicitOwner };
|
|
1840
|
-
}
|
|
1841
1783
|
const numberedRequestSteps = requestText
|
|
1842
1784
|
.split(/\r?\n/u)
|
|
1843
1785
|
.map((item) => item.trim())
|
|
1844
1786
|
.filter((item) => /^\d+\s*[.)、.]\s*/u.test(item));
|
|
1845
|
-
const shouldRouteNumberedClauses =
|
|
1846
|
-
&& explicitTasks.length === 0
|
|
1847
|
-
&& model
|
|
1787
|
+
const shouldRouteNumberedClauses = model
|
|
1848
1788
|
&& numberedRequestSteps.length > 1
|
|
1849
1789
|
&& (!selection
|
|
1850
1790
|
|| Boolean(selection.refusedReason)
|
|
1851
1791
|
|| (Array.isArray(selection.delegations)
|
|
1852
1792
|
&& selection.delegations.length > 1
|
|
1853
1793
|
&& selection.delegations.length < numberedRequestSteps.length));
|
|
1854
|
-
if (shouldRouteNumberedClauses || ((!selection || selection.refusedReason) &&
|
|
1794
|
+
if (shouldRouteNumberedClauses || ((!selection || selection.refusedReason) && model)) {
|
|
1855
1795
|
const routeClauses = numberedRequestSteps.length > 1 ? numberedRequestSteps : [requestText];
|
|
1856
1796
|
const routedDelegations = [];
|
|
1857
1797
|
for (const [index, clause] of routeClauses.entries()) {
|
|
@@ -1890,38 +1830,17 @@ export class AgentRuntimeAdapter {
|
|
|
1890
1830
|
selection = { subagentType: routedDelegations[0].subagentType };
|
|
1891
1831
|
}
|
|
1892
1832
|
}
|
|
1893
|
-
if (!selection) {
|
|
1894
|
-
if (explicitTasks.length > 1) {
|
|
1895
|
-
selection = {
|
|
1896
|
-
delegations: explicitTasks.map((task) => ({
|
|
1897
|
-
subagentType: task.subagentType,
|
|
1898
|
-
description: task.text,
|
|
1899
|
-
})),
|
|
1900
|
-
};
|
|
1901
|
-
}
|
|
1902
|
-
else if (explicitTasks.length === 1) {
|
|
1903
|
-
selection = { subagentType: explicitTasks[0].subagentType };
|
|
1904
|
-
}
|
|
1905
|
-
else if (explicitOwner) {
|
|
1906
|
-
selection = { subagentType: explicitOwner };
|
|
1907
|
-
}
|
|
1908
|
-
}
|
|
1909
1833
|
if (selection?.delegations?.length === 1) {
|
|
1910
1834
|
const onlyDelegation = selection.delegations[0];
|
|
1911
1835
|
selection = { subagentType: onlyDelegation.subagentType };
|
|
1912
1836
|
}
|
|
1913
|
-
if (selection?.delegations && selection.delegations.length > 1) {
|
|
1914
|
-
if (explicitOwner) {
|
|
1915
|
-
selection = { subagentType: explicitOwner };
|
|
1916
|
-
}
|
|
1917
|
-
}
|
|
1918
1837
|
if (selection?.delegations && selection.delegations.length > 1) {
|
|
1919
1838
|
const plannedDelegations = selection.delegations;
|
|
1920
1839
|
const plannedNames = new Set(plannedDelegations.map((item) => item.subagentType));
|
|
1921
1840
|
const planCoversEverySubagent = plannedDelegations.length === subagents.length
|
|
1922
1841
|
&& plannedNames.size === subagentNames.size
|
|
1923
1842
|
&& Array.from(subagentNames).every((name) => plannedNames.has(name));
|
|
1924
|
-
const shouldCollapseOverbroadPlan = planCoversEverySubagent &&
|
|
1843
|
+
const shouldCollapseOverbroadPlan = planCoversEverySubagent && numberedRequestSteps.length < 3;
|
|
1925
1844
|
const executableDelegations = shouldCollapseOverbroadPlan ? plannedDelegations.slice(0, 1) : plannedDelegations;
|
|
1926
1845
|
const aggregateToolResults = [];
|
|
1927
1846
|
const childReports = [];
|