@botbotgo/agent-harness 0.0.365 → 0.0.366
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.366";
|
|
2
2
|
export declare const AGENT_HARNESS_RELEASE_DATE = "2026-04-28";
|
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.366";
|
|
2
2
|
export const AGENT_HARNESS_RELEASE_DATE = "2026-04-28";
|
|
@@ -1008,12 +1008,66 @@ export class AgentRuntimeAdapter {
|
|
|
1008
1008
|
const delegatedOutput = typeof compactDelegation.toolOutput === "string"
|
|
1009
1009
|
? [compactDelegation.toolOutput]
|
|
1010
1010
|
: [];
|
|
1011
|
+
const delegatedPayload = (() => {
|
|
1012
|
+
if (delegatedOutput.length === 0) {
|
|
1013
|
+
return undefined;
|
|
1014
|
+
}
|
|
1015
|
+
try {
|
|
1016
|
+
const parsed = JSON.parse(delegatedOutput[0]);
|
|
1017
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed)
|
|
1018
|
+
? parsed
|
|
1019
|
+
: undefined;
|
|
1020
|
+
}
|
|
1021
|
+
catch {
|
|
1022
|
+
return undefined;
|
|
1023
|
+
}
|
|
1024
|
+
})();
|
|
1025
|
+
const payloadStringArray = (key) => {
|
|
1026
|
+
const value = delegatedPayload?.[key];
|
|
1027
|
+
if (!Array.isArray(value)) {
|
|
1028
|
+
return undefined;
|
|
1029
|
+
}
|
|
1030
|
+
const items = value.filter((item) => typeof item === "string" && item.trim().length > 0);
|
|
1031
|
+
return items.length > 0 ? items : undefined;
|
|
1032
|
+
};
|
|
1033
|
+
const payloadReport = typeof delegatedPayload?.report === "string" && delegatedPayload.report.trim().length > 0
|
|
1034
|
+
? delegatedPayload.report
|
|
1035
|
+
: undefined;
|
|
1011
1036
|
const delegatedToolNames = Array.isArray(compactDelegation.delegatedResult?.metadata?.executedToolResults)
|
|
1012
1037
|
? compactDelegation.delegatedResult.metadata.executedToolResults
|
|
1013
1038
|
.filter((toolResult) => toolResult?.toolName)
|
|
1014
1039
|
.map((toolResult) => toolResult.toolName)
|
|
1015
1040
|
: [];
|
|
1016
1041
|
const state = compactDelegation.delegatedResult?.state === "failed" ? "failed" : "completed";
|
|
1042
|
+
const uniqueToolNames = [...new Set(delegatedToolNames)];
|
|
1043
|
+
const toolEvidence = uniqueToolNames.length > 0 ? uniqueToolNames.join(", ") : "none";
|
|
1044
|
+
const fallbackTodoTrace = [
|
|
1045
|
+
`1) TODO observed: delegated to ${delegatedSubagentType}.`,
|
|
1046
|
+
uniqueToolNames.includes("write_todos")
|
|
1047
|
+
? "2) TODO evidence: delegated specialist invoked write_todos."
|
|
1048
|
+
: "2) TODO evidence missing: delegated specialist did not expose write_todos in returned metadata.",
|
|
1049
|
+
state === "failed"
|
|
1050
|
+
? "3) TODO closed: delegated execution failed; blocker reported."
|
|
1051
|
+
: "3) TODO closed: delegated execution completed; synthesis returned.",
|
|
1052
|
+
];
|
|
1053
|
+
const fallbackStepResults = [
|
|
1054
|
+
`1) Delegation step: task invoked ${delegatedSubagentType}.`,
|
|
1055
|
+
`2) Evidence step: delegated tool evidence = ${toolEvidence}.`,
|
|
1056
|
+
state === "failed"
|
|
1057
|
+
? "3) Synthesis step: returned blocker report because delegated execution failed."
|
|
1058
|
+
: "3) Synthesis step: compact delegation report assembled from delegated output.",
|
|
1059
|
+
];
|
|
1060
|
+
const fallbackSummary = [
|
|
1061
|
+
state === "failed"
|
|
1062
|
+
? `子代理 ${delegatedSubagentType} 委托执行失败。`
|
|
1063
|
+
: `已完成子代理 ${delegatedSubagentType} 委托执行。`,
|
|
1064
|
+
];
|
|
1065
|
+
const fallbackFindings = payloadReport
|
|
1066
|
+
? ["子代理返回了结构化报告,详见 report。"]
|
|
1067
|
+
: delegatedOutput.length > 0
|
|
1068
|
+
? delegatedOutput.slice(0, 3)
|
|
1069
|
+
: ["none"];
|
|
1070
|
+
const report = payloadReport ?? (delegatedOutput.join("\n") || "委托已完成,未返回附加报告。");
|
|
1017
1071
|
return {
|
|
1018
1072
|
status: state,
|
|
1019
1073
|
routing: [
|
|
@@ -1026,18 +1080,18 @@ export class AgentRuntimeAdapter {
|
|
|
1026
1080
|
],
|
|
1027
1081
|
execution: [
|
|
1028
1082
|
`1) 调用 task 工具,目标子代理:${delegatedSubagentType}`,
|
|
1029
|
-
|
|
1030
|
-
? `2) 子代理返回工具证据:${
|
|
1083
|
+
uniqueToolNames.length > 0
|
|
1084
|
+
? `2) 子代理返回工具证据:${toolEvidence}`
|
|
1031
1085
|
: "2) 子代理返回文本结果。",
|
|
1032
1086
|
"3) 产出主编排汇总并返回结构化结果。",
|
|
1033
1087
|
],
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
findings:
|
|
1088
|
+
todoTrace: payloadStringArray("todoTrace") ?? fallbackTodoTrace,
|
|
1089
|
+
stepResults: payloadStringArray("stepResults") ?? fallbackStepResults,
|
|
1090
|
+
summary: payloadStringArray("summary") ?? fallbackSummary,
|
|
1091
|
+
findings: payloadStringArray("findings") ?? fallbackFindings,
|
|
1038
1092
|
blockers: state === "failed" ? ["子代理执行未能完成。"] : ["none"],
|
|
1039
1093
|
nextActions: ["如需更深入,可继续追问该次委托的细节。"],
|
|
1040
|
-
report
|
|
1094
|
+
report,
|
|
1041
1095
|
};
|
|
1042
1096
|
}
|
|
1043
1097
|
async *stream(binding, input, sessionId, history = [], options = {}) {
|