open-agents-ai 0.187.247 → 0.187.249

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 +34 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -270300,6 +270300,13 @@ ${body}`;
270300
270300
  const window2 = recentToolCalls.slice(-repetitionWindow);
270301
270301
  const uniqueKeys = new Set(window2.map((tc) => `${tc.name}:${tc.argsKey}`));
270302
270302
  const ratio = 1 - uniqueKeys.size / window2.length;
270303
+ if (ratio > 0.4 && this._littlemanToolOutcomes.length >= 3) {
270304
+ const recentOutcomes = this._littlemanToolOutcomes.slice(-6);
270305
+ const uniquePreviews = new Set(recentOutcomes.map((o2) => o2.preview.slice(0, 40)));
270306
+ if (uniquePreviews.size >= 3) {
270307
+ return Math.max(0, ratio - 0.4);
270308
+ }
270309
+ }
270303
270310
  return ratio;
270304
270311
  }
270305
270312
  /**
@@ -271057,7 +271064,7 @@ ${memoryLines.join("\n")}`
271057
271064
  }
271058
271065
  const toolStart = performance.now();
271059
271066
  toolCallCount++;
271060
- const argsKey = Object.entries(tc.arguments ?? {}).sort(([a2], [b]) => a2.localeCompare(b)).map(([k, v]) => `${k}=${typeof v === "string" ? v.slice(0, 80) : JSON.stringify(v)}`).join(",");
271067
+ const argsKey = Object.entries(tc.arguments ?? {}).sort(([a2], [b]) => a2.localeCompare(b)).map(([k, v]) => `${k}=${typeof v === "string" ? v.slice(0, 160) : JSON.stringify(v).slice(0, 160)}`).join(",");
271061
271068
  toolCallLog.push({ name: tc.name, argsKey, turn, timestampMs: Date.now() });
271062
271069
  const budgetRemaining = toolCallBudget.get(tc.name);
271063
271070
  if (budgetRemaining !== void 0) {
@@ -326975,6 +326982,20 @@ function adaptTool6(tool) {
326975
326982
  }
326976
326983
  };
326977
326984
  }
326985
+ function scanForSessionSignals(toolOutput) {
326986
+ if (/SESSION_ACTIVE\s*=\s*true/i.test(toolOutput)) {
326987
+ _interactiveSessionActive = true;
326988
+ _interactiveSessionReason = "An interactive session is active (SESSION_ACTIVE=true detected in tool output).";
326989
+ }
326990
+ if (/SESSION_ACTIVE\s*=\s*false/i.test(toolOutput) || /\"event\"\s*:\s*\"(?:call_ended|session_ended|disconnected|closed|terminated)\"/i.test(toolOutput)) {
326991
+ _interactiveSessionActive = false;
326992
+ _interactiveSessionReason = "";
326993
+ }
326994
+ }
326995
+ function resetSessionLock() {
326996
+ _interactiveSessionActive = false;
326997
+ _interactiveSessionReason = "";
326998
+ }
326978
326999
  function createTaskCompleteTool(modelTier) {
326979
327000
  const summaryDesc = modelTier === "small" || modelTier === "medium" ? "Your complete response to the user. For questions/chat: put your FULL answer here (this is what the user will see). For coding tasks: brief summary of what was accomplished." : "Brief summary of what was accomplished";
326980
327001
  return {
@@ -326988,6 +327009,13 @@ function createTaskCompleteTool(modelTier) {
326988
327009
  required: ["summary"]
326989
327010
  },
326990
327011
  async execute(args) {
327012
+ if (_interactiveSessionActive) {
327013
+ return {
327014
+ success: false,
327015
+ output: "",
327016
+ error: `task_complete BLOCKED — interactive session still active. ${_interactiveSessionReason} You MUST continue the interaction loop until the session ends. Do NOT call task_complete until you receive a termination signal (e.g. "ended", "disconnected", "closed", SESSION_ACTIVE=false). Resume the loop NOW.`
327017
+ };
327018
+ }
326991
327019
  try {
326992
327020
  const sessionId = getTodoSessionId();
326993
327021
  const todos = readTodos(sessionId);
@@ -328408,6 +328436,7 @@ ${entry.fullContent}`
328408
328436
  }
328409
328437
  break;
328410
328438
  case "tool_result": {
328439
+ if (event.content) scanForSessionSignals(String(event.content));
328411
328440
  if (_apiCallbacks?.onToolResult) {
328412
328441
  _apiCallbacks.onToolResult(
328413
328442
  event.toolName ?? "unknown",
@@ -328662,6 +328691,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
328662
328691
  ));
328663
328692
  }
328664
328693
  }
328694
+ resetSessionLock();
328665
328695
  const promise = runner.run(effectiveTask, systemContext).then((result) => {
328666
328696
  const tokens = { total: result.totalTokens, estimated: result.estimatedTokens };
328667
328697
  contentWrite(() => {
@@ -332800,7 +332830,7 @@ Rules:
332800
332830
  process.exit(1);
332801
332831
  }
332802
332832
  }
332803
- var taskManager, _apiCallbacks, _shellToolRef, _replToolRef, _fullSubAgentToolRef, _agentToolRef, _sendMessageToolRef, _agentLifecycleMgr, _activeRunnerRef, _wireSubAgentCallbacks, _wireAgentToolCallbacks, _wireSubAgentToolCallbacks, _autoUpdatedThisSession, _mcpManager, _pluginManager, _mcpTools, SELF_IMPROVE_INTERVAL, _tasksSinceImprove;
332833
+ var _interactiveSessionActive, _interactiveSessionReason, taskManager, _apiCallbacks, _shellToolRef, _replToolRef, _fullSubAgentToolRef, _agentToolRef, _sendMessageToolRef, _agentLifecycleMgr, _activeRunnerRef, _wireSubAgentCallbacks, _wireAgentToolCallbacks, _wireSubAgentToolCallbacks, _autoUpdatedThisSession, _mcpManager, _pluginManager, _mcpTools, SELF_IMPROVE_INTERVAL, _tasksSinceImprove;
332804
332834
  var init_interactive = __esm({
332805
332835
  "packages/cli/src/tui/interactive.ts"() {
332806
332836
  "use strict";
@@ -332846,6 +332876,8 @@ var init_interactive = __esm({
332846
332876
  init_neovim_mode();
332847
332877
  init_task_manager_singleton();
332848
332878
  init_tui_tasks_renderer();
332879
+ _interactiveSessionActive = false;
332880
+ _interactiveSessionReason = "";
332849
332881
  taskManager = new BackgroundTaskManager();
332850
332882
  _apiCallbacks = null;
332851
332883
  _shellToolRef = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.247",
3
+ "version": "0.187.249",
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",