open-agents-ai 0.187.248 → 0.187.250

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 +54 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -270566,6 +270566,34 @@ TASK: ${task}` : task;
270566
270566
  });
270567
270567
  nextSelfEval = now + selfEvalInterval;
270568
270568
  }
270569
+ const turnsRemaining = this.options.maxTurns - turn;
270570
+ if (turnsRemaining <= 3 && turnsRemaining > 0 && this._littlemanToolOutcomes.length >= 2) {
270571
+ const recentOutcomes = this._littlemanToolOutcomes.slice(-6);
270572
+ const recentSuccesses = recentOutcomes.filter((o2) => o2.succeeded).length;
270573
+ const uniqueResults = new Set(recentOutcomes.map((o2) => o2.preview.slice(0, 40))).size;
270574
+ const isActive = recentSuccesses >= 2 && uniqueResults >= 2;
270575
+ if (isActive) {
270576
+ const extension2 = 30;
270577
+ this.options.maxTurns += extension2;
270578
+ this.emit({
270579
+ type: "status",
270580
+ content: `Littleman triage: activity detected (${recentSuccesses} recent successes, ${uniqueResults} unique results) — extending turn limit by ${extension2} (now ${this.options.maxTurns})`,
270581
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
270582
+ });
270583
+ this.emit({
270584
+ type: "debug_littleman",
270585
+ turn,
270586
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
270587
+ content: `Timeout triage: EXTENDED by ${extension2} turns (active session detected)`,
270588
+ littlemanAction: {
270589
+ detection: "none",
270590
+ recentSuccesses,
270591
+ recentFailures: recentOutcomes.length - recentSuccesses,
270592
+ intervention: `Extended maxTurns to ${this.options.maxTurns}`
270593
+ }
270594
+ });
270595
+ }
270596
+ }
270569
270597
  while (this.pendingUserMessages.length > 0) {
270570
270598
  const userMsg = this.pendingUserMessages.shift();
270571
270599
  const imagePattern = /\[IMAGE_BASE64:([^:]+):([^\]]+)\]/;
@@ -326982,6 +327010,20 @@ function adaptTool6(tool) {
326982
327010
  }
326983
327011
  };
326984
327012
  }
327013
+ function scanForSessionSignals(toolOutput) {
327014
+ if (/SESSION_ACTIVE\s*=\s*true/i.test(toolOutput)) {
327015
+ _interactiveSessionActive = true;
327016
+ _interactiveSessionReason = "An interactive session is active (SESSION_ACTIVE=true detected in tool output).";
327017
+ }
327018
+ if (/SESSION_ACTIVE\s*=\s*false/i.test(toolOutput) || /\"event\"\s*:\s*\"(?:call_ended|session_ended|disconnected|closed|terminated)\"/i.test(toolOutput)) {
327019
+ _interactiveSessionActive = false;
327020
+ _interactiveSessionReason = "";
327021
+ }
327022
+ }
327023
+ function resetSessionLock() {
327024
+ _interactiveSessionActive = false;
327025
+ _interactiveSessionReason = "";
327026
+ }
326985
327027
  function createTaskCompleteTool(modelTier) {
326986
327028
  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";
326987
327029
  return {
@@ -326995,6 +327037,13 @@ function createTaskCompleteTool(modelTier) {
326995
327037
  required: ["summary"]
326996
327038
  },
326997
327039
  async execute(args) {
327040
+ if (_interactiveSessionActive) {
327041
+ return {
327042
+ success: false,
327043
+ output: "",
327044
+ 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.`
327045
+ };
327046
+ }
326998
327047
  try {
326999
327048
  const sessionId = getTodoSessionId();
327000
327049
  const todos = readTodos(sessionId);
@@ -328415,6 +328464,7 @@ ${entry.fullContent}`
328415
328464
  }
328416
328465
  break;
328417
328466
  case "tool_result": {
328467
+ if (event.content) scanForSessionSignals(String(event.content));
328418
328468
  if (_apiCallbacks?.onToolResult) {
328419
328469
  _apiCallbacks.onToolResult(
328420
328470
  event.toolName ?? "unknown",
@@ -328669,6 +328719,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
328669
328719
  ));
328670
328720
  }
328671
328721
  }
328722
+ resetSessionLock();
328672
328723
  const promise = runner.run(effectiveTask, systemContext).then((result) => {
328673
328724
  const tokens = { total: result.totalTokens, estimated: result.estimatedTokens };
328674
328725
  contentWrite(() => {
@@ -332807,7 +332858,7 @@ Rules:
332807
332858
  process.exit(1);
332808
332859
  }
332809
332860
  }
332810
- var taskManager, _apiCallbacks, _shellToolRef, _replToolRef, _fullSubAgentToolRef, _agentToolRef, _sendMessageToolRef, _agentLifecycleMgr, _activeRunnerRef, _wireSubAgentCallbacks, _wireAgentToolCallbacks, _wireSubAgentToolCallbacks, _autoUpdatedThisSession, _mcpManager, _pluginManager, _mcpTools, SELF_IMPROVE_INTERVAL, _tasksSinceImprove;
332861
+ var _interactiveSessionActive, _interactiveSessionReason, taskManager, _apiCallbacks, _shellToolRef, _replToolRef, _fullSubAgentToolRef, _agentToolRef, _sendMessageToolRef, _agentLifecycleMgr, _activeRunnerRef, _wireSubAgentCallbacks, _wireAgentToolCallbacks, _wireSubAgentToolCallbacks, _autoUpdatedThisSession, _mcpManager, _pluginManager, _mcpTools, SELF_IMPROVE_INTERVAL, _tasksSinceImprove;
332811
332862
  var init_interactive = __esm({
332812
332863
  "packages/cli/src/tui/interactive.ts"() {
332813
332864
  "use strict";
@@ -332853,6 +332904,8 @@ var init_interactive = __esm({
332853
332904
  init_neovim_mode();
332854
332905
  init_task_manager_singleton();
332855
332906
  init_tui_tasks_renderer();
332907
+ _interactiveSessionActive = false;
332908
+ _interactiveSessionReason = "";
332856
332909
  taskManager = new BackgroundTaskManager();
332857
332910
  _apiCallbacks = null;
332858
332911
  _shellToolRef = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.248",
3
+ "version": "0.187.250",
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",