@botbotgo/agent-harness 0.0.395 → 0.0.397

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.395";
1
+ export declare const AGENT_HARNESS_VERSION = "0.0.397";
2
2
  export declare const AGENT_HARNESS_RELEASE_DATE = "2026-05-02";
@@ -1,2 +1,2 @@
1
- export const AGENT_HARNESS_VERSION = "0.0.395";
1
+ export const AGENT_HARNESS_VERSION = "0.0.397";
2
2
  export const AGENT_HARNESS_RELEASE_DATE = "2026-05-02";
@@ -185,6 +185,31 @@ 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
+ if (/\b(?:let'?s\s+try|we\s+can(?:not|'t)?\s+(?:run|call|use|try)|cannot\s+.+\btry\b|can\s+run\s+[A-Za-z_][A-Za-z0-9_]*)/iu.test(trimmed)) {
200
+ return false;
201
+ }
202
+ try {
203
+ const parsed = JSON.parse(trimmed);
204
+ if (typeof parsed === "object" && parsed !== null) {
205
+ return false;
206
+ }
207
+ }
208
+ catch {
209
+ // Non-JSON prose can be useful synthesis.
210
+ }
211
+ return true;
212
+ }
188
213
  function readBindingExecutionParams(binding) {
189
214
  const params = binding.execution?.params ?? binding.deepAgentParams ?? binding.langchainAgentParams;
190
215
  return {
@@ -573,12 +598,24 @@ export async function* streamRuntimeExecution(options) {
573
598
  yield chunk;
574
599
  }
575
600
  if (requiresPlanEvidence(options.binding) && sawCompletedPlanToolResult && sawSuccessfulNonTodoToolResult) {
601
+ if (hasUsefulVisibleSynthesis(projectionState.emittedOutput)) {
602
+ if (deferredStreamContent.length > 0) {
603
+ yield* flushDeferredStreamContent();
604
+ }
605
+ return;
606
+ }
576
607
  deferredStreamContent.length = 0;
577
608
  yield { kind: "content", content: buildDeterministicFinalFromStreamToolEvidence(streamedToolResults) };
578
609
  return;
579
610
  }
580
611
  const eventExecutionEvidence = buildExecutionRecoveryEvidence({ projectionState });
581
612
  if (requiresPlanEvidence(options.binding) && hasCompletedPlanWithEvidence(eventExecutionEvidence)) {
613
+ if (hasUsefulVisibleSynthesis(projectionState.emittedOutput)) {
614
+ if (deferredStreamContent.length > 0) {
615
+ yield* flushDeferredStreamContent();
616
+ }
617
+ return;
618
+ }
582
619
  deferredStreamContent.length = 0;
583
620
  yield { kind: "content", content: buildDeterministicFinalFromStreamToolEvidence(streamedToolResults) };
584
621
  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
- ...(symbol ? { symbol } : {}),
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botbotgo/agent-harness",
3
- "version": "0.0.395",
3
+ "version": "0.0.397",
4
4
  "description": "Workspace runtime for multi-agent applications",
5
5
  "license": "MIT",
6
6
  "type": "module",