@botbotgo/agent-harness 0.0.333 → 0.0.335
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-04-
|
|
1
|
+
export declare const AGENT_HARNESS_VERSION = "0.0.334";
|
|
2
|
+
export declare const AGENT_HARNESS_RELEASE_DATE = "2026-04-23";
|
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-04-
|
|
1
|
+
export const AGENT_HARNESS_VERSION = "0.0.334";
|
|
2
|
+
export const AGENT_HARNESS_RELEASE_DATE = "2026-04-23";
|
|
@@ -20,6 +20,8 @@ export type StreamEventProjectionState = {
|
|
|
20
20
|
openTaskDelegations: number;
|
|
21
21
|
openToolCapableTaskDelegations: number;
|
|
22
22
|
taskDelegationHasToolsStack: boolean[];
|
|
23
|
+
taskDelegationFindingsStack: string[];
|
|
24
|
+
lastCompletedTaskDelegationFindings: string;
|
|
23
25
|
seenTerminalOutputs: Set<string>;
|
|
24
26
|
};
|
|
25
27
|
export declare function createStreamEventProjectionState(): StreamEventProjectionState;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { sanitizeVisibleText } from "../parsing/output-parsing.js";
|
|
1
|
+
import { extractToolFallbackContext, extractVisibleOutput, readTextContent, sanitizeVisibleText } from "../parsing/output-parsing.js";
|
|
2
2
|
import { salvageFunctionLikeToolCall } from "../parsing/output-tool-args.js";
|
|
3
3
|
import { computeIncrementalOutput, extractInterruptPayload, extractReasoningStreamOutput, sanitizeRetainedUpstreamEvent, extractStateStreamOutput, extractTerminalStreamOutput, extractToolResult, extractVisibleStreamOutput, normalizeTerminalOutputKey, } from "../parsing/stream-event-parsing.js";
|
|
4
4
|
import { resolveModelFacingToolName } from "./tool/tool-name-mapping.js";
|
|
@@ -22,6 +22,8 @@ export function createStreamEventProjectionState() {
|
|
|
22
22
|
openTaskDelegations: 0,
|
|
23
23
|
openToolCapableTaskDelegations: 0,
|
|
24
24
|
taskDelegationHasToolsStack: [],
|
|
25
|
+
taskDelegationFindingsStack: [],
|
|
26
|
+
lastCompletedTaskDelegationFindings: "",
|
|
25
27
|
seenTerminalOutputs: new Set(),
|
|
26
28
|
};
|
|
27
29
|
}
|
|
@@ -163,6 +165,63 @@ function isUpstreamPlaceholderTaskResult(value) {
|
|
|
163
165
|
&& typeof message?.tool_call_id === "string"
|
|
164
166
|
&& message?.content === "Task completed";
|
|
165
167
|
}
|
|
168
|
+
function extractDelegatedFindingsCandidateText(value, depth = 0) {
|
|
169
|
+
if (depth > 6 || value === null || value === undefined) {
|
|
170
|
+
return "";
|
|
171
|
+
}
|
|
172
|
+
if (typeof value === "string") {
|
|
173
|
+
return value;
|
|
174
|
+
}
|
|
175
|
+
const visibleOutput = extractVisibleOutput(value);
|
|
176
|
+
if (visibleOutput) {
|
|
177
|
+
return visibleOutput;
|
|
178
|
+
}
|
|
179
|
+
const toolFallback = extractToolFallbackContext(value);
|
|
180
|
+
if (toolFallback) {
|
|
181
|
+
return toolFallback;
|
|
182
|
+
}
|
|
183
|
+
const directText = readTextContent(value);
|
|
184
|
+
if (directText) {
|
|
185
|
+
return directText;
|
|
186
|
+
}
|
|
187
|
+
if (Array.isArray(value)) {
|
|
188
|
+
for (let index = value.length - 1; index >= 0; index -= 1) {
|
|
189
|
+
const nested = extractDelegatedFindingsCandidateText(value[index], depth + 1);
|
|
190
|
+
if (nested) {
|
|
191
|
+
return nested;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return "";
|
|
195
|
+
}
|
|
196
|
+
if (typeof value === "object") {
|
|
197
|
+
const typed = value;
|
|
198
|
+
for (const key of ["messages", "update", "output", "content", "data", "summary"]) {
|
|
199
|
+
const nested = extractDelegatedFindingsCandidateText(typed[key], depth + 1);
|
|
200
|
+
if (nested) {
|
|
201
|
+
return nested;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return "";
|
|
206
|
+
}
|
|
207
|
+
function normalizeDelegatedFindingsText(value) {
|
|
208
|
+
const directText = extractDelegatedFindingsCandidateText(value);
|
|
209
|
+
if (!directText) {
|
|
210
|
+
return "";
|
|
211
|
+
}
|
|
212
|
+
const normalized = sanitizeVisibleText(directText).trim();
|
|
213
|
+
return normalized === "Task completed" ? "" : normalized;
|
|
214
|
+
}
|
|
215
|
+
function recordDelegatedFindings(state, value) {
|
|
216
|
+
if (state.taskDelegationFindingsStack.length === 0) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
const normalized = normalizeDelegatedFindingsText(value);
|
|
220
|
+
if (!normalized) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
state.taskDelegationFindingsStack[state.taskDelegationFindingsStack.length - 1] = normalized;
|
|
224
|
+
}
|
|
166
225
|
function updateDelegationState(state, event, countConfiguredToolsForAgentId) {
|
|
167
226
|
if (typeof event !== "object" || event === null) {
|
|
168
227
|
return;
|
|
@@ -185,11 +244,13 @@ function updateDelegationState(state, event, countConfiguredToolsForAgentId) {
|
|
|
185
244
|
state.sawDelegatedAgentWithConfiguredTools = true;
|
|
186
245
|
state.openToolCapableTaskDelegations += 1;
|
|
187
246
|
}
|
|
247
|
+
state.taskDelegationFindingsStack.push("");
|
|
188
248
|
return;
|
|
189
249
|
}
|
|
190
250
|
if (isTaskEnd || isTaskError) {
|
|
191
251
|
state.openTaskDelegations = Math.max(0, state.openTaskDelegations - 1);
|
|
192
252
|
const delegatedTaskHadTools = state.taskDelegationHasToolsStack.pop() === true;
|
|
253
|
+
state.lastCompletedTaskDelegationFindings = state.taskDelegationFindingsStack.pop() ?? "";
|
|
193
254
|
if (delegatedTaskHadTools) {
|
|
194
255
|
state.openToolCapableTaskDelegations = Math.max(0, state.openToolCapableTaskDelegations - 1);
|
|
195
256
|
}
|
|
@@ -255,11 +316,20 @@ export function projectRuntimeStreamEvent(params) {
|
|
|
255
316
|
if (toolResult) {
|
|
256
317
|
const isTodoTool = toolResult.toolName === "write_todos" || toolResult.toolName === "read_todos";
|
|
257
318
|
const isSuccessfulTaskResult = toolResult.toolName === "task" && toolResult.isError !== true;
|
|
258
|
-
const isPlaceholderTaskResult = isSuccessfulTaskResult && isUpstreamPlaceholderTaskResult(toolResult.output);
|
|
259
319
|
const isDelegatedExecutionTool = (isDelegatedAgentEvent || state.openToolCapableTaskDelegations > 0)
|
|
260
320
|
&& toolResult.toolName !== "write_todos"
|
|
261
321
|
&& toolResult.toolName !== "read_todos"
|
|
262
322
|
&& toolResult.toolName !== "task";
|
|
323
|
+
if (isDelegatedExecutionTool && toolResult.isError !== true) {
|
|
324
|
+
recordDelegatedFindings(state, toolResult.output);
|
|
325
|
+
}
|
|
326
|
+
const delegatedTaskFindings = isSuccessfulTaskResult && isUpstreamPlaceholderTaskResult(toolResult.output)
|
|
327
|
+
? state.lastCompletedTaskDelegationFindings
|
|
328
|
+
: "";
|
|
329
|
+
const effectiveToolOutput = delegatedTaskFindings || toolResult.output;
|
|
330
|
+
const isPlaceholderTaskResult = isSuccessfulTaskResult
|
|
331
|
+
&& !delegatedTaskFindings
|
|
332
|
+
&& isUpstreamPlaceholderTaskResult(toolResult.output);
|
|
263
333
|
state.emittedToolResult = true;
|
|
264
334
|
state.emittedToolError = state.emittedToolError || toolResult.isError === true;
|
|
265
335
|
state.emittedSuccessfulToolResult = state.emittedSuccessfulToolResult || toolResult.isError !== true;
|
|
@@ -273,15 +343,19 @@ export function projectRuntimeStreamEvent(params) {
|
|
|
273
343
|
chunks.push({
|
|
274
344
|
kind: "tool-result",
|
|
275
345
|
toolName: resolveModelFacingToolName(toolResult.toolName, toolNameMapping, primaryTools),
|
|
276
|
-
output:
|
|
346
|
+
output: effectiveToolOutput,
|
|
277
347
|
isError: toolResult.isError,
|
|
278
348
|
});
|
|
349
|
+
if (toolResult.toolName === "task") {
|
|
350
|
+
state.lastCompletedTaskDelegationFindings = "";
|
|
351
|
+
}
|
|
279
352
|
}
|
|
280
353
|
const output = allowVisibleContent ? extractTerminalStreamOutput(event) : "";
|
|
281
354
|
if (!allowVisibleContent) {
|
|
282
355
|
const delegatedTerminalOutput = extractTerminalStreamOutput(event);
|
|
283
356
|
if (delegatedTerminalOutput) {
|
|
284
357
|
state.emittedDelegatedTerminalOutput = true;
|
|
358
|
+
recordDelegatedFindings(state, delegatedTerminalOutput);
|
|
285
359
|
}
|
|
286
360
|
}
|
|
287
361
|
if (output && !shouldSuppressVisibleToolCallText(output)) {
|