@botbotgo/agent-harness 0.0.436 → 0.0.438
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.
|
|
2
|
-
export declare const AGENT_HARNESS_RELEASE_DATE = "2026-05-
|
|
1
|
+
export declare const AGENT_HARNESS_VERSION = "0.0.438";
|
|
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.
|
|
2
|
-
export const AGENT_HARNESS_RELEASE_DATE = "2026-05-
|
|
1
|
+
export const AGENT_HARNESS_VERSION = "0.0.438";
|
|
2
|
+
export const AGENT_HARNESS_RELEASE_DATE = "2026-05-04";
|
|
@@ -486,38 +486,7 @@ function parseCompactRouterSelection(value, subagentNames) {
|
|
|
486
486
|
}
|
|
487
487
|
return null;
|
|
488
488
|
}
|
|
489
|
-
function
|
|
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
|
-
function buildCompactRouterPolicy(routingPolicy, subagentNames) {
|
|
489
|
+
function buildCompactRouterPolicy(routingPolicy) {
|
|
521
490
|
if (!routingPolicy) {
|
|
522
491
|
return "";
|
|
523
492
|
}
|
|
@@ -525,46 +494,10 @@ function buildCompactRouterPolicy(routingPolicy, subagentNames) {
|
|
|
525
494
|
.split(/\r?\n/u)
|
|
526
495
|
.map((line) => line.trim())
|
|
527
496
|
.filter((line) => line.length > 0);
|
|
528
|
-
const
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
const escaped = escapeRegExp(name);
|
|
533
|
-
return new RegExp(`(?:^|[^\\p{L}\\p{N}_-])\`?${escaped}\`?(?:$|[^\\p{L}\\p{N}_-])`, "iu");
|
|
534
|
-
});
|
|
535
|
-
for (const line of lines) {
|
|
536
|
-
const normalized = line.toLowerCase();
|
|
537
|
-
if (/^route by meaning\b/iu.test(line)) {
|
|
538
|
-
inRoutingBlock = true;
|
|
539
|
-
inDelegationBlock = false;
|
|
540
|
-
selected.push(line);
|
|
541
|
-
continue;
|
|
542
|
-
}
|
|
543
|
-
if (/^delegation rules\b/iu.test(line)) {
|
|
544
|
-
inRoutingBlock = false;
|
|
545
|
-
inDelegationBlock = true;
|
|
546
|
-
selected.push(line);
|
|
547
|
-
continue;
|
|
548
|
-
}
|
|
549
|
-
if (/^(output|role|rules|working style|tool rules)\b/iu.test(line)) {
|
|
550
|
-
inRoutingBlock = false;
|
|
551
|
-
inDelegationBlock = false;
|
|
552
|
-
}
|
|
553
|
-
const mentionsSubagent = subagentPatterns.some((pattern) => pattern.test(line));
|
|
554
|
-
const mentionsDelegationPrimitive = normalized.includes("task")
|
|
555
|
-
|| normalized.includes("delegate")
|
|
556
|
-
|| normalized.includes("delegating")
|
|
557
|
-
|| normalized.includes("委托")
|
|
558
|
-
|| normalized.includes("路由");
|
|
559
|
-
if (inRoutingBlock && mentionsSubagent) {
|
|
560
|
-
selected.push(line);
|
|
561
|
-
continue;
|
|
562
|
-
}
|
|
563
|
-
if (inDelegationBlock && (mentionsSubagent || mentionsDelegationPrimitive)) {
|
|
564
|
-
selected.push(line);
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
return selected.slice(0, 80).join("\n");
|
|
497
|
+
const outputContractIndex = lines.findIndex((line) => /^output:?$/iu.test(line));
|
|
498
|
+
return (outputContractIndex >= 0 ? lines.slice(0, outputContractIndex) : lines)
|
|
499
|
+
.slice(0, 80)
|
|
500
|
+
.join("\n");
|
|
568
501
|
}
|
|
569
502
|
function buildDelegatedOwnedTaskInstruction(input) {
|
|
570
503
|
const relevantPolicyLines = (input.routingPolicy ?? "")
|
|
@@ -1364,7 +1297,7 @@ export class AgentRuntimeAdapter {
|
|
|
1364
1297
|
.map((subagent) => `- ${subagent.name}: ${subagent.description}`)
|
|
1365
1298
|
.join("\n");
|
|
1366
1299
|
const routingPolicy = getBindingSystemPrompt(binding);
|
|
1367
|
-
const compactRoutingPolicy = buildCompactRouterPolicy(routingPolicy
|
|
1300
|
+
const compactRoutingPolicy = buildCompactRouterPolicy(routingPolicy);
|
|
1368
1301
|
const prompt = [
|
|
1369
1302
|
primaryModel.init?.think === false ? "/no_think" : "",
|
|
1370
1303
|
"You are selecting a subagent for a delegation-only agent.",
|
|
@@ -1720,7 +1653,7 @@ export class AgentRuntimeAdapter {
|
|
|
1720
1653
|
.map((subagent) => `- ${subagent.name}: ${subagent.description}`)
|
|
1721
1654
|
.join("\n");
|
|
1722
1655
|
const routingPolicy = getBindingSystemPrompt(binding);
|
|
1723
|
-
const compactRoutingPolicy = buildCompactRouterPolicy(routingPolicy
|
|
1656
|
+
const compactRoutingPolicy = buildCompactRouterPolicy(routingPolicy);
|
|
1724
1657
|
const prompt = [
|
|
1725
1658
|
primaryModel.init?.think === false ? "/no_think" : "",
|
|
1726
1659
|
"You are planning delegation for a delegation-only agent.",
|
|
@@ -1811,20 +1744,18 @@ export class AgentRuntimeAdapter {
|
|
|
1811
1744
|
: parsedSelection;
|
|
1812
1745
|
}
|
|
1813
1746
|
}
|
|
1814
|
-
const explicitTasks = extractExplicitSubagentTasks(requestText, subagentNames);
|
|
1815
1747
|
const numberedRequestSteps = requestText
|
|
1816
1748
|
.split(/\r?\n/u)
|
|
1817
1749
|
.map((item) => item.trim())
|
|
1818
1750
|
.filter((item) => /^\d+\s*[.)、.]\s*/u.test(item));
|
|
1819
|
-
const shouldRouteNumberedClauses =
|
|
1820
|
-
&& model
|
|
1751
|
+
const shouldRouteNumberedClauses = model
|
|
1821
1752
|
&& numberedRequestSteps.length > 1
|
|
1822
1753
|
&& (!selection
|
|
1823
1754
|
|| Boolean(selection.refusedReason)
|
|
1824
1755
|
|| (Array.isArray(selection.delegations)
|
|
1825
1756
|
&& selection.delegations.length > 1
|
|
1826
1757
|
&& selection.delegations.length < numberedRequestSteps.length));
|
|
1827
|
-
if (shouldRouteNumberedClauses || ((!selection || selection.refusedReason) &&
|
|
1758
|
+
if (shouldRouteNumberedClauses || ((!selection || selection.refusedReason) && model)) {
|
|
1828
1759
|
const routeClauses = numberedRequestSteps.length > 1 ? numberedRequestSteps : [requestText];
|
|
1829
1760
|
const routedDelegations = [];
|
|
1830
1761
|
for (const [index, clause] of routeClauses.entries()) {
|
|
@@ -1863,19 +1794,6 @@ export class AgentRuntimeAdapter {
|
|
|
1863
1794
|
selection = { subagentType: routedDelegations[0].subagentType };
|
|
1864
1795
|
}
|
|
1865
1796
|
}
|
|
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
1797
|
if (selection?.delegations?.length === 1) {
|
|
1880
1798
|
const onlyDelegation = selection.delegations[0];
|
|
1881
1799
|
selection = { subagentType: onlyDelegation.subagentType };
|
|
@@ -1886,7 +1804,7 @@ export class AgentRuntimeAdapter {
|
|
|
1886
1804
|
const planCoversEverySubagent = plannedDelegations.length === subagents.length
|
|
1887
1805
|
&& plannedNames.size === subagentNames.size
|
|
1888
1806
|
&& Array.from(subagentNames).every((name) => plannedNames.has(name));
|
|
1889
|
-
const shouldCollapseOverbroadPlan = planCoversEverySubagent &&
|
|
1807
|
+
const shouldCollapseOverbroadPlan = planCoversEverySubagent && numberedRequestSteps.length < 3;
|
|
1890
1808
|
const executableDelegations = shouldCollapseOverbroadPlan ? plannedDelegations.slice(0, 1) : plannedDelegations;
|
|
1891
1809
|
const aggregateToolResults = [];
|
|
1892
1810
|
const childReports = [];
|