@botbotgo/agent-harness 0.0.381 → 0.0.383
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-
|
|
1
|
+
export declare const AGENT_HARNESS_VERSION = "0.0.383";
|
|
2
|
+
export declare const AGENT_HARNESS_RELEASE_DATE = "2026-05-01";
|
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-
|
|
1
|
+
export const AGENT_HARNESS_VERSION = "0.0.383";
|
|
2
|
+
export const AGENT_HARNESS_RELEASE_DATE = "2026-05-01";
|
|
@@ -47,12 +47,32 @@ function renderMarkdownTable(block) {
|
|
|
47
47
|
const columnCount = Math.max(header.length, ...body.map((row) => row.length));
|
|
48
48
|
const normalizedRows = [header, ...body].map((row) => Array.from({ length: columnCount }, (_, index) => renderInlineConsoleMarkdown(row[index] ?? "")));
|
|
49
49
|
const widths = Array.from({ length: columnCount }, (_, index) => Math.max(...normalizedRows.map((row) => stripAnsi(row[index] ?? "").length), 0));
|
|
50
|
+
const renderedWidth = widths.reduce((sum, width) => sum + width, 0) + (columnCount * 3) + 1;
|
|
51
|
+
if (renderedWidth > 120 || columnCount > 5) {
|
|
52
|
+
return renderMarkdownTableAsList(header, body);
|
|
53
|
+
}
|
|
50
54
|
const renderRow = (row) => `| ${row
|
|
51
55
|
.map((cell, index) => cell.padEnd(widths[index] + (cell.length - stripAnsi(cell).length)))
|
|
52
56
|
.join(" | ")} |`;
|
|
53
57
|
const separator = `|-${widths.map((width) => "-".repeat(Math.max(3, width))).join("-|-")}-|`;
|
|
54
58
|
return [renderRow(normalizedRows[0] ?? []), separator, ...normalizedRows.slice(1).map(renderRow)].join("\n");
|
|
55
59
|
}
|
|
60
|
+
function renderMarkdownTableAsList(header, body) {
|
|
61
|
+
const normalizedHeader = header.map((cell) => cell.trim()).filter(Boolean);
|
|
62
|
+
return body
|
|
63
|
+
.map((row, rowIndex) => {
|
|
64
|
+
const title = renderInlineConsoleMarkdown(row[0]?.trim() || `Row ${rowIndex + 1}`);
|
|
65
|
+
const details = normalizedHeader.slice(1).flatMap((label, index) => {
|
|
66
|
+
const value = row[index + 1]?.trim();
|
|
67
|
+
if (!value) {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
return ` • ${renderInlineConsoleMarkdown(label)}: ${renderInlineConsoleMarkdown(value)}`;
|
|
71
|
+
});
|
|
72
|
+
return [`• ${title}`, ...details].join("\n");
|
|
73
|
+
})
|
|
74
|
+
.join("\n\n");
|
|
75
|
+
}
|
|
56
76
|
export function markdownToHtml(markdown) {
|
|
57
77
|
const normalized = markdown.replace(/\r\n/g, "\n");
|
|
58
78
|
const blocks = normalized.split(/\n\n+/);
|
|
@@ -96,7 +116,10 @@ export function markdownToConsole(markdown) {
|
|
|
96
116
|
if (!markdown.includes("\n")) {
|
|
97
117
|
return renderInlineConsoleMarkdown(markdown.trim());
|
|
98
118
|
}
|
|
99
|
-
const normalized = markdown
|
|
119
|
+
const normalized = markdown
|
|
120
|
+
.replace(/\r\n/g, "\n")
|
|
121
|
+
.replace(/^(#{1,6}\s+.+)$/gm, "\n$1\n")
|
|
122
|
+
.replace(/^(\s*[-*_=])(?:\s*\1){2,}\s*$/gm, "\n$&\n");
|
|
100
123
|
const blocks = normalized.split(/\n\n+/);
|
|
101
124
|
const rendered = [];
|
|
102
125
|
for (const block of blocks) {
|
|
@@ -128,7 +151,8 @@ export function markdownToConsole(markdown) {
|
|
|
128
151
|
const level = match?.[1].length ?? 1;
|
|
129
152
|
const title = renderInlineConsoleMarkdown(match?.[2] ?? trimmed);
|
|
130
153
|
const underline = level === 1 ? "=" : "-";
|
|
131
|
-
|
|
154
|
+
const underlineWidth = Math.min(72, Math.max(3, title.replace(/\u001b\[[0-9;]*m/g, "").length));
|
|
155
|
+
rendered.push(`\u001b[1m${title}\u001b[0m\n\u001b[2m${underline.repeat(underlineWidth)}\u001b[0m`);
|
|
132
156
|
continue;
|
|
133
157
|
}
|
|
134
158
|
if (trimmed.split("\n").every((line) => /^\s*[-*]\s+/.test(line))) {
|
|
@@ -159,7 +183,7 @@ export function markdownToConsole(markdown) {
|
|
|
159
183
|
.join("\n"));
|
|
160
184
|
continue;
|
|
161
185
|
}
|
|
162
|
-
if (/^([-*_])(?:\s*\1){2,}$/.test(trimmed)) {
|
|
186
|
+
if (/^([-*_=])(?:\s*\1){2,}$/.test(trimmed)) {
|
|
163
187
|
rendered.push(`\u001b[2m${"─".repeat(24)}\u001b[0m`);
|
|
164
188
|
continue;
|
|
165
189
|
}
|
|
@@ -783,9 +783,9 @@ export class AgentRuntimeAdapter {
|
|
|
783
783
|
});
|
|
784
784
|
if (compactDelegation) {
|
|
785
785
|
const compactReport = this.buildCompactDelegationReport(compactDelegation);
|
|
786
|
-
const output =
|
|
787
|
-
? compactDelegation.toolOutput
|
|
788
|
-
: compactReport);
|
|
786
|
+
const output = compactDelegation.delegatedSubagentType === null
|
|
787
|
+
? String(compactDelegation.toolOutput ?? "")
|
|
788
|
+
: this.formatCompactDelegationReportForDisplay(compactReport);
|
|
789
789
|
const delegatedToolResults = Array.isArray(compactDelegation.delegatedResult?.metadata?.executedToolResults)
|
|
790
790
|
? compactDelegation.delegatedResult.metadata.executedToolResults
|
|
791
791
|
: [];
|
|
@@ -1194,44 +1194,14 @@ export class AgentRuntimeAdapter {
|
|
|
1194
1194
|
};
|
|
1195
1195
|
}
|
|
1196
1196
|
formatCompactDelegationReportForDisplay(report) {
|
|
1197
|
-
const readStringArray = (key) => {
|
|
1198
|
-
const value = report[key];
|
|
1199
|
-
const reportText = typeof report.report === "string" ? report.report.trim() : "";
|
|
1200
|
-
return Array.isArray(value)
|
|
1201
|
-
? value.filter((item) => {
|
|
1202
|
-
if (typeof item !== "string") {
|
|
1203
|
-
return false;
|
|
1204
|
-
}
|
|
1205
|
-
const trimmed = item.trim();
|
|
1206
|
-
return trimmed.length > 0 && trimmed !== reportText;
|
|
1207
|
-
})
|
|
1208
|
-
: [];
|
|
1209
|
-
};
|
|
1210
|
-
const lines = [];
|
|
1211
1197
|
const reportText = typeof report.report === "string" ? report.report.trim() : "";
|
|
1212
1198
|
if (reportText) {
|
|
1213
|
-
|
|
1214
|
-
}
|
|
1215
|
-
const sections = [
|
|
1216
|
-
["Routing", readStringArray("routing")],
|
|
1217
|
-
["TODO Trace", readStringArray("todoTrace")],
|
|
1218
|
-
["Step Results", readStringArray("stepResults")],
|
|
1219
|
-
["Summary", readStringArray("summary")],
|
|
1220
|
-
["Findings", readStringArray("findings")],
|
|
1221
|
-
["Blockers", readStringArray("blockers")],
|
|
1222
|
-
["Next Actions", readStringArray("nextActions")],
|
|
1223
|
-
];
|
|
1224
|
-
for (const [title, items] of sections) {
|
|
1225
|
-
if (items.length === 0 || (items.length === 1 && items[0]?.toLowerCase() === "none")) {
|
|
1226
|
-
continue;
|
|
1227
|
-
}
|
|
1228
|
-
if (lines.length > 0) {
|
|
1229
|
-
lines.push("");
|
|
1230
|
-
}
|
|
1231
|
-
lines.push(`## ${title}`);
|
|
1232
|
-
lines.push(...items.map((item) => `- ${item}`));
|
|
1199
|
+
return reportText;
|
|
1233
1200
|
}
|
|
1234
|
-
|
|
1201
|
+
const summary = Array.isArray(report.summary)
|
|
1202
|
+
? report.summary.find((item) => typeof item === "string" && item.trim().length > 0)
|
|
1203
|
+
: undefined;
|
|
1204
|
+
return summary?.trim() || "委托已完成,未返回附加报告。";
|
|
1235
1205
|
}
|
|
1236
1206
|
async *streamDelegateWithCompactRouter(binding, input, sessionId, requestId, options = {}) {
|
|
1237
1207
|
if (!isDelegationOnlyDeepAgentBinding(binding) || !this.options.bindingResolver) {
|