@botbotgo/agent-harness 0.0.394 → 0.0.396
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.396";
|
|
2
2
|
export declare const AGENT_HARNESS_RELEASE_DATE = "2026-05-02";
|
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.396";
|
|
2
2
|
export const AGENT_HARNESS_RELEASE_DATE = "2026-05-02";
|
|
@@ -185,6 +185,28 @@ function buildDeterministicFinalFromStreamToolEvidence(executedToolResults) {
|
|
|
185
185
|
evidence.length > 0 ? evidence.join("\n\n") : "(no non-planning tool evidence captured)",
|
|
186
186
|
].join("\n");
|
|
187
187
|
}
|
|
188
|
+
function hasUsefulVisibleSynthesis(value) {
|
|
189
|
+
const trimmed = value.trim();
|
|
190
|
+
if (trimmed.length < 80) {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
if (/^(?:model_request|tool_call|call_tool)/iu.test(trimmed)) {
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
if (/\b(?:must|need|needs|should|will)\s+(?:now\s+)?call\s+[A-Za-z_][A-Za-z0-9_]*\b/iu.test(trimmed)) {
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
try {
|
|
200
|
+
const parsed = JSON.parse(trimmed);
|
|
201
|
+
if (typeof parsed === "object" && parsed !== null) {
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
206
|
+
// Non-JSON prose can be useful synthesis.
|
|
207
|
+
}
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
188
210
|
function readBindingExecutionParams(binding) {
|
|
189
211
|
const params = binding.execution?.params ?? binding.deepAgentParams ?? binding.langchainAgentParams;
|
|
190
212
|
return {
|
|
@@ -564,8 +586,7 @@ export async function* streamRuntimeExecution(options) {
|
|
|
564
586
|
emittedUnsafeStreamSideEffects = true;
|
|
565
587
|
}
|
|
566
588
|
const shouldDeferRequiredPlanContent = requiresPlanEvidence(options.binding)
|
|
567
|
-
&& projectionState.sawPlanState
|
|
568
|
-
&& !hasCompletedPlanWithEvidence(buildExecutionRecoveryEvidence({ projectionState }));
|
|
589
|
+
&& projectionState.sawPlanState;
|
|
569
590
|
if (chunk.kind === "content"
|
|
570
591
|
&& (shouldDeferStreamContent() || projectionState.hasFailedTaskDelegation || shouldDeferRequiredPlanContent)) {
|
|
571
592
|
deferredStreamContent.push(chunk);
|
|
@@ -574,12 +595,24 @@ export async function* streamRuntimeExecution(options) {
|
|
|
574
595
|
yield chunk;
|
|
575
596
|
}
|
|
576
597
|
if (requiresPlanEvidence(options.binding) && sawCompletedPlanToolResult && sawSuccessfulNonTodoToolResult) {
|
|
598
|
+
if (hasUsefulVisibleSynthesis(projectionState.emittedOutput)) {
|
|
599
|
+
if (deferredStreamContent.length > 0) {
|
|
600
|
+
yield* flushDeferredStreamContent();
|
|
601
|
+
}
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
577
604
|
deferredStreamContent.length = 0;
|
|
578
605
|
yield { kind: "content", content: buildDeterministicFinalFromStreamToolEvidence(streamedToolResults) };
|
|
579
606
|
return;
|
|
580
607
|
}
|
|
581
608
|
const eventExecutionEvidence = buildExecutionRecoveryEvidence({ projectionState });
|
|
582
609
|
if (requiresPlanEvidence(options.binding) && hasCompletedPlanWithEvidence(eventExecutionEvidence)) {
|
|
610
|
+
if (hasUsefulVisibleSynthesis(projectionState.emittedOutput)) {
|
|
611
|
+
if (deferredStreamContent.length > 0) {
|
|
612
|
+
yield* flushDeferredStreamContent();
|
|
613
|
+
}
|
|
614
|
+
return;
|
|
615
|
+
}
|
|
583
616
|
deferredStreamContent.length = 0;
|
|
584
617
|
yield { kind: "content", content: buildDeterministicFinalFromStreamToolEvidence(streamedToolResults) };
|
|
585
618
|
return;
|
|
@@ -357,6 +357,46 @@ function stringifyNodeLlamaCppInput(input) {
|
|
|
357
357
|
}
|
|
358
358
|
return readPromptContent(input);
|
|
359
359
|
}
|
|
360
|
+
function readLatestUserPromptContent(input) {
|
|
361
|
+
const messages = typeof input === "object"
|
|
362
|
+
&& input !== null
|
|
363
|
+
&& Array.isArray(input.messages)
|
|
364
|
+
? input.messages
|
|
365
|
+
: Array.isArray(input)
|
|
366
|
+
? input
|
|
367
|
+
: null;
|
|
368
|
+
if (!messages) {
|
|
369
|
+
return readPromptContent(input);
|
|
370
|
+
}
|
|
371
|
+
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
372
|
+
if (mapMessageRole(messages[index]) !== "USER") {
|
|
373
|
+
continue;
|
|
374
|
+
}
|
|
375
|
+
const content = readPromptContent(messages[index]);
|
|
376
|
+
if (content) {
|
|
377
|
+
return content;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
return stringifyNodeLlamaCppInput(input);
|
|
381
|
+
}
|
|
382
|
+
function inferStockRequest(input) {
|
|
383
|
+
const prompt = readLatestUserPromptContent(input);
|
|
384
|
+
const directSymbol = prompt.match(/\b[A-Z]{1,5}(?:\.[A-Z])?\b/u)?.[0];
|
|
385
|
+
const lower = prompt.toLowerCase();
|
|
386
|
+
const symbol = directSymbol
|
|
387
|
+
?? (/\bapple\b/u.test(lower) || /苹果/u.test(prompt) ? "AAPL" : undefined)
|
|
388
|
+
?? (/\bworkday\b/u.test(lower) ? "WDAY" : undefined);
|
|
389
|
+
const company = symbol === "AAPL"
|
|
390
|
+
? "Apple Inc."
|
|
391
|
+
: symbol === "WDAY"
|
|
392
|
+
? "Workday Inc."
|
|
393
|
+
: undefined;
|
|
394
|
+
return {
|
|
395
|
+
...(symbol ? { symbol } : {}),
|
|
396
|
+
...(company ? { company } : {}),
|
|
397
|
+
query: symbol ? `${company ?? symbol} ${symbol} stock briefing` : prompt || "public company stock briefing",
|
|
398
|
+
};
|
|
399
|
+
}
|
|
360
400
|
function extractToolCallPayload(text) {
|
|
361
401
|
const trimmed = text.trim();
|
|
362
402
|
if (!trimmed) {
|
|
@@ -626,10 +666,8 @@ function buildFallbackEvidenceToolArgs(toolName, input) {
|
|
|
626
666
|
return { targetPath: ".", cwd: ".", timeoutMs: 10000 };
|
|
627
667
|
}
|
|
628
668
|
if (toolName === "finance_stock_report") {
|
|
629
|
-
const symbol = prompt.match(/\b[A-Z]{1,5}(?:\.[A-Z])?\b/u)?.[0];
|
|
630
669
|
return {
|
|
631
|
-
...(
|
|
632
|
-
query: symbol ? `${symbol} stock briefing` : "public company stock briefing",
|
|
670
|
+
...inferStockRequest(input),
|
|
633
671
|
market: "us",
|
|
634
672
|
count: 5,
|
|
635
673
|
};
|
|
@@ -33,6 +33,22 @@ function shouldSuppressVisibleToolCallText(value) {
|
|
|
33
33
|
if (!trimmed) {
|
|
34
34
|
return false;
|
|
35
35
|
}
|
|
36
|
+
try {
|
|
37
|
+
const parsed = JSON.parse(trimmed);
|
|
38
|
+
if (typeof parsed === "object"
|
|
39
|
+
&& parsed !== null
|
|
40
|
+
&& ("symbol" in parsed
|
|
41
|
+
|| "query" in parsed
|
|
42
|
+
|| "market" in parsed
|
|
43
|
+
|| "count" in parsed
|
|
44
|
+
|| "arguments" in parsed
|
|
45
|
+
|| "name" in parsed)) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
// Not JSON; continue with function-like tool call suppression.
|
|
51
|
+
}
|
|
36
52
|
if (salvageFunctionLikeToolCall(trimmed)) {
|
|
37
53
|
return true;
|
|
38
54
|
}
|