@botbotgo/agent-harness 0.0.463 → 0.0.465
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.
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/resources/prompts/runtime/write-todos-full-entry.md +1 -1
- package/dist/runtime/adapter/flow/stream-runtime.js +101 -6
- package/dist/runtime/adapter/invocation-result.js +15 -2
- package/dist/runtime/adapter/local-tool-invocation.js +49 -1
- package/dist/runtime/adapter/runtime-adapter-support.d.ts +0 -1
- package/dist/runtime/adapter/runtime-adapter-support.js +10 -7
- package/dist/runtime/adapter/stream-event-projection.d.ts +1 -0
- package/dist/runtime/adapter/stream-event-projection.js +75 -16
- package/dist/runtime/adapter/tool/builtin-middleware-tools.js +1 -9
- package/dist/runtime/adapter/tool/tool-arguments.js +145 -10
- package/dist/runtime/agent-runtime-adapter.d.ts +12 -0
- package/dist/runtime/agent-runtime-adapter.js +217 -29
- package/dist/runtime/parsing/output-recovery.js +2 -1
- package/dist/runtime/parsing/output-tool-args.js +20 -1
- package/dist/runtime/parsing/stream-event-parsing.js +0 -32
- package/package.json +1 -1
|
@@ -574,11 +574,30 @@ function normalizeWriteTodosArgs(args) {
|
|
|
574
574
|
const normalized = {};
|
|
575
575
|
if (content !== undefined)
|
|
576
576
|
normalized.content = content;
|
|
577
|
-
normalized.status =
|
|
577
|
+
normalized.status = normalizeWriteTodoStatus(record.status);
|
|
578
578
|
return Object.keys(normalized).length > 0 ? normalized : todo;
|
|
579
579
|
}),
|
|
580
580
|
};
|
|
581
581
|
}
|
|
582
|
+
function normalizeWriteTodoStatus(value) {
|
|
583
|
+
if (typeof value !== "string") {
|
|
584
|
+
return "pending";
|
|
585
|
+
}
|
|
586
|
+
const normalized = value.trim().toLowerCase().replace(/[\s-]+/gu, "_");
|
|
587
|
+
if (!normalized) {
|
|
588
|
+
return "pending";
|
|
589
|
+
}
|
|
590
|
+
if (normalized === "not_started" || normalized === "todo" || normalized === "open") {
|
|
591
|
+
return "pending";
|
|
592
|
+
}
|
|
593
|
+
if (normalized === "started" || normalized === "active" || normalized === "in_progress") {
|
|
594
|
+
return "in_progress";
|
|
595
|
+
}
|
|
596
|
+
if (normalized === "done" || normalized === "complete" || normalized === "completed") {
|
|
597
|
+
return "completed";
|
|
598
|
+
}
|
|
599
|
+
return normalized;
|
|
600
|
+
}
|
|
582
601
|
function normalizeTaskArgs(args) {
|
|
583
602
|
const description = typeof args.description === "string" && args.description.trim().length > 0
|
|
584
603
|
? args.description
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { isLowSignalTodoContent } from "../adapter/runtime-adapter-support.js";
|
|
2
1
|
import { extractReasoningText, extractVisibleOutput, hasToolCalls, readTextContent } from "./output-parsing.js";
|
|
3
2
|
const MAX_STREAM_INLINE_TEXT_CHARS = 12_000;
|
|
4
3
|
const STREAM_PREVIEW_TEXT_CHARS = 2_000;
|
|
@@ -205,31 +204,6 @@ function isErrorLikeToolOutput(value) {
|
|
|
205
204
|
|| /^command failed:/i.test(firstNonEmptyLine)
|
|
206
205
|
|| /^stderr:/i.test(firstNonEmptyLine);
|
|
207
206
|
}
|
|
208
|
-
function isEmptyInitialWriteTodosResult(value) {
|
|
209
|
-
if (typeof value !== "object" || !value || Array.isArray(value)) {
|
|
210
|
-
return false;
|
|
211
|
-
}
|
|
212
|
-
const typed = value;
|
|
213
|
-
if (typeof typed.summary === "object" && typed.summary && Array.isArray(typed.summary.items)) {
|
|
214
|
-
return (typed.summary.items).length === 0;
|
|
215
|
-
}
|
|
216
|
-
if (typeof typed.update === "object" && typed.update && Array.isArray(typed.update.todos)) {
|
|
217
|
-
return (typed.update.todos).length === 0;
|
|
218
|
-
}
|
|
219
|
-
return false;
|
|
220
|
-
}
|
|
221
|
-
function hasLowSignalInitialWriteTodos(value) {
|
|
222
|
-
if (typeof value !== "object" || !value || Array.isArray(value)) {
|
|
223
|
-
return false;
|
|
224
|
-
}
|
|
225
|
-
const typed = value;
|
|
226
|
-
const items = typeof typed.summary === "object" && typed.summary && Array.isArray(typed.summary.items)
|
|
227
|
-
? (typed.summary.items ?? [])
|
|
228
|
-
: typeof typed.update === "object" && typed.update && Array.isArray(typed.update.todos)
|
|
229
|
-
? (typed.update.todos ?? [])
|
|
230
|
-
: [];
|
|
231
|
-
return items.length > 0 && items.every((item) => typeof item?.content === "string" && isLowSignalTodoContent(item.content));
|
|
232
|
-
}
|
|
233
207
|
function isToolMessageLike(value) {
|
|
234
208
|
if (typeof value !== "object" || value === null) {
|
|
235
209
|
return false;
|
|
@@ -326,12 +300,6 @@ export function extractToolResult(event) {
|
|
|
326
300
|
const normalizedOutput = typeof rawOutput === "string"
|
|
327
301
|
? parseMaybeJson(rawOutput)
|
|
328
302
|
: unwrapToolMessageOutput(rawOutput);
|
|
329
|
-
if (!isToolError && toolName === "write_todos" && isEmptyInitialWriteTodosResult(normalizedOutput)) {
|
|
330
|
-
throw new Error("Error invoking tool 'write_todos' with kwargs {\"todos\":[]} with error: Error: Initial write_todos call cannot use an empty todo list. Send the concrete task steps with both content and status.");
|
|
331
|
-
}
|
|
332
|
-
if (!isToolError && toolName === "write_todos" && hasLowSignalInitialWriteTodos(normalizedOutput)) {
|
|
333
|
-
throw new Error("Error invoking tool 'write_todos' with placeholder todo content with error: Error: Initial write_todos call must use descriptive task content. Do not use placeholder entries like '1', '2', or 'step 1'.");
|
|
334
|
-
}
|
|
335
303
|
return {
|
|
336
304
|
toolName,
|
|
337
305
|
output: sanitizeStreamPayload(normalizedOutput),
|