open-agents-ai 0.187.237 → 0.187.239

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.
Files changed (2) hide show
  1. package/dist/index.js +70 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -270794,6 +270794,32 @@ ${memoryLines.join("\n")}`
270794
270794
  maxTokens: effectiveMaxTokens,
270795
270795
  timeoutMs: this.options.requestTimeoutMs
270796
270796
  };
270797
+ {
270798
+ const ctxChars = compacted.reduce((s2, m2) => {
270799
+ let c7 = typeof m2.content === "string" ? m2.content.length : 100;
270800
+ if (m2.tool_calls)
270801
+ for (const tc of m2.tool_calls)
270802
+ c7 += tc.function.arguments?.length ?? 0;
270803
+ return s2 + c7;
270804
+ }, 0);
270805
+ const estTokens = Math.ceil(ctxChars / 4);
270806
+ const limits = this.contextLimits();
270807
+ this.emit({
270808
+ type: "debug_context",
270809
+ content: `Turn ${turn}: ${compacted.length} msgs, ~${estTokens} tokens (threshold: ${limits.compactionThreshold}), headroom: ${limits.compactionThreshold - estTokens}`,
270810
+ turn,
270811
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
270812
+ contextSnapshot: {
270813
+ messageCount: compacted.length,
270814
+ estimatedTokens: estTokens,
270815
+ compactionThreshold: limits.compactionThreshold,
270816
+ toolCallCount,
270817
+ keepRecent: limits.keepRecent,
270818
+ littlemanOutcomes: this._littlemanToolOutcomes.length,
270819
+ headroom: limits.compactionThreshold - estTokens
270820
+ }
270821
+ });
270822
+ }
270797
270823
  let response;
270798
270824
  try {
270799
270825
  response = this.options.streamEnabled && this.hasStreamingSupport() ? await this.streamingRequest(chatRequest, turn) : await this.backend.chatCompletion(chatRequest);
@@ -271667,14 +271693,19 @@ Call task_complete(summary="...") NOW with whatever you have.`
271667
271693
  }
271668
271694
  if (isThinkOnly) {
271669
271695
  if (consecutiveThinkOnly >= MAX_CONSECUTIVE_THINK_ONLY) {
271696
+ const recentSuccesses = this._littlemanToolOutcomes.slice(-3).filter((o2) => o2.succeeded);
271697
+ const hasRecentSuccess = recentSuccesses.length > 0;
271698
+ const successHint = hasRecentSuccess ? `
271699
+
271700
+ Your most recent tool calls SUCCEEDED. If the task is complete, call task_complete now with a summary of what you accomplished.` : "";
271670
271701
  this.emit({
271671
271702
  type: "status",
271672
- content: `Model produced ${consecutiveThinkOnly} consecutive think-only responses — nudging toward visible output`,
271703
+ content: `Model produced ${consecutiveThinkOnly} consecutive think-only responses — nudging toward action${hasRecentSuccess ? " (recent tools succeeded)" : ""}`,
271673
271704
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
271674
271705
  });
271675
271706
  messages2.push({
271676
271707
  role: "user",
271677
- content: "You have been reasoning internally for several turns without producing visible output or tool calls. Please take action now — call a tool or produce a visible response."
271708
+ content: "You have been reasoning internally for several turns without producing visible output or tool calls. Please take action now — call a tool or produce a visible response." + successHint
271678
271709
  });
271679
271710
  }
271680
271711
  continue;
@@ -272023,9 +272054,11 @@ Full content available via: repl_exec(code="data = retrieve('${handleId}')") or
272023
272054
  }
272024
272055
  if (isThinkOnlyBF) {
272025
272056
  if (consecutiveThinkOnly >= MAX_CONSECUTIVE_THINK_ONLY) {
272057
+ const recentSucc = this._littlemanToolOutcomes.slice(-3).filter((o2) => o2.succeeded);
272058
+ const succHint = recentSucc.length > 0 ? "\n\nYour most recent tool calls SUCCEEDED. If the task is complete, call task_complete now with a summary." : "";
272026
272059
  messages2.push({
272027
272060
  role: "user",
272028
- content: "You have been reasoning internally for several turns without producing visible output or tool calls. Please take action now — call a tool or produce a visible response."
272061
+ content: "You have been reasoning internally for several turns without producing visible output or tool calls. Please take action now — call a tool or produce a visible response." + succHint
272029
272062
  });
272030
272063
  }
272031
272064
  continue;
@@ -272975,6 +273008,20 @@ Do NOT re-run it. Use the result you already have and proceed to the next step.`
272975
273008
  break;
272976
273009
  }
272977
273010
  }
273011
+ const succCount = this._littlemanToolOutcomes.filter((o2) => o2.succeeded).length;
273012
+ const failCount = this._littlemanToolOutcomes.filter((o2) => !o2.succeeded).length;
273013
+ this.emit({
273014
+ type: "debug_littleman",
273015
+ turn,
273016
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
273017
+ content: `Littleman: ${this._littlemanToolOutcomes.length} tracked outcomes (${succCount} ok, ${failCount} err)`,
273018
+ littlemanAction: {
273019
+ detection: "none",
273020
+ recentSuccesses: succCount,
273021
+ recentFailures: failCount,
273022
+ intervention: this.pendingUserMessages.length > 0 ? this.pendingUserMessages[this.pendingUserMessages.length - 1]?.slice(0, 120) ?? null : null
273023
+ }
273024
+ });
272978
273025
  }
272979
273026
  /**
272980
273027
  * Infer what the model should do next from the most recent messages.
@@ -328589,6 +328636,26 @@ ${entry.fullContent}`
328589
328636
  break;
328590
328637
  case "complete":
328591
328638
  break;
328639
+ // -- Live observability hooks --
328640
+ case "debug_context":
328641
+ if (config.verbose) {
328642
+ const snap = event.contextSnapshot;
328643
+ if (snap) {
328644
+ contentWrite(() => renderInfo(
328645
+ `\x1B[38;5;243m[ctx] ${snap.messageCount} msgs | ~${snap.estimatedTokens} tok | headroom: ${snap.headroom} | tools: ${snap.toolCallCount} | littleman: ${snap.littlemanOutcomes} tracked\x1B[0m`
328646
+ ));
328647
+ }
328648
+ }
328649
+ break;
328650
+ case "debug_littleman":
328651
+ if (config.verbose && event.littlemanAction) {
328652
+ const lm = event.littlemanAction;
328653
+ const intervention = lm.intervention ? ` | INTERVENTION: ${lm.intervention}` : "";
328654
+ contentWrite(() => renderInfo(
328655
+ `\x1B[38;5;178m[littleman] ${lm.recentSuccesses} ok, ${lm.recentFailures} err${intervention}\x1B[0m`
328656
+ ));
328657
+ }
328658
+ break;
328592
328659
  }
328593
328660
  });
328594
328661
  const sessionId = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.237",
3
+ "version": "0.187.239",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",