open-agents-ai 0.187.475 → 0.187.476

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.
package/dist/index.js CHANGED
@@ -518229,6 +518229,52 @@ function getSystemPromptForTier(tier) {
518229
518229
  return SYSTEM_PROMPT;
518230
518230
  }
518231
518231
  }
518232
+ function detectTaskMode(task) {
518233
+ if (!task)
518234
+ return false;
518235
+ const head = task.slice(0, 4e3).toLowerCase();
518236
+ if (task.length > 2e3)
518237
+ return true;
518238
+ if (/(\/[\w.-]+){2,}/.test(task.slice(0, 2e3)))
518239
+ return true;
518240
+ if (/\b(implement|build|create|refactor|write|fix|migrate|deploy|generate|setup|set up|develop|design|integrate)\b/.test(head)) {
518241
+ if (/\b(spec|file|module|component|api|endpoint|database|schema|test|build|next\.js|typescript|react|prisma|tailwind|sql|python|rust|go)\b/.test(head)) {
518242
+ return true;
518243
+ }
518244
+ }
518245
+ return false;
518246
+ }
518247
+ function slimSystemPromptForTaskMode(prompt) {
518248
+ const SECTION_HEADERS_TO_REMOVE = [
518249
+ /^##\s*Interactive\s*\/\s*Long-?Running Sessions\s*$/im,
518250
+ /^##\s*Document Generation Strategy\s*$/im,
518251
+ /^##\s*Calculations\s*[—-]\s*Always Execute, Never Guess\s*$/im,
518252
+ /^##\s*Knowledge Gaps\s*[—-]\s*Search, Don't Hallucinate\s*$/im,
518253
+ /^##\s*Self-Awareness( & Introspection)?\s*$/im,
518254
+ /^##\s*Debugging\s*[—-]\s*Observe Before Reasoning\s*$/im
518255
+ ];
518256
+ const TOOL_LINES_TO_REMOVE = [
518257
+ /^- nexus:.*$/im,
518258
+ /^- background_run.*task_status.*task_output.*task_stop:.*$/im,
518259
+ /^- (asr_listen|audio_capture|audio_playback|audio_analyze|camera_capture|desktop_click|bluetooth_scan|browser_action):.*$/im,
518260
+ /^Voice\/TTS:.*$/im,
518261
+ /^- Voice\/TTS:.*$/im,
518262
+ /^- Desktop\/Vision:.*$/im,
518263
+ /^- P2P:.*$/im
518264
+ ];
518265
+ const CHAT_MODE_BLOCK = /^\*\*CHAT MODE\*\*[\s\S]*?(?=\*\*TASK MODE\*\*)/im;
518266
+ let out = prompt;
518267
+ for (const re of SECTION_HEADERS_TO_REMOVE) {
518268
+ out = out.replace(new RegExp(re.source + "[\\s\\S]*?(?=^##\\s|\\Z)", "im"), "");
518269
+ }
518270
+ for (const re of TOOL_LINES_TO_REMOVE) {
518271
+ out = out.replace(re, "");
518272
+ }
518273
+ out = out.replace(CHAT_MODE_BLOCK, "");
518274
+ out = out.replace(/^\*\*TASK MODE\*\*[^\n]*\n/im, "");
518275
+ out = out.replace(/\n{3,}/g, "\n\n");
518276
+ return out.trim() + "\n";
518277
+ }
518232
518278
  function computeTodoReminder(input) {
518233
518279
  const turnsSinceWriteThreshold = input.turnsSinceWriteThreshold ?? 10;
518234
518280
  const turnsBetweenReminders = input.turnsBetweenReminders ?? 10;
@@ -518638,7 +518684,17 @@ var init_agenticRunner = __esm({
518638
518684
  async assembleContext(task, context2) {
518639
518685
  const sections = [];
518640
518686
  const pressureCue = pressureCheck(task);
518641
- const basePrompt = getSystemPromptForTier(this.options.modelTier) + pressureCue;
518687
+ const rawPrompt = getSystemPromptForTier(this.options.modelTier);
518688
+ const taskModeOn = detectTaskMode(task);
518689
+ const slimmedPrompt = taskModeOn ? slimSystemPromptForTaskMode(rawPrompt) : rawPrompt;
518690
+ const basePrompt = slimmedPrompt + pressureCue;
518691
+ if (taskModeOn) {
518692
+ this.emit({
518693
+ type: "status",
518694
+ content: `REG-19: TASK MODE detected — system prompt slimmed ${rawPrompt.length}→${slimmedPrompt.length} bytes`,
518695
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
518696
+ });
518697
+ }
518642
518698
  const _BATCH_GUIDANCE = {
518643
518699
  small: "\n\n## Response batching\n\nEmit AT MOST 2 tool calls per response. After observing their results, plan the next 2 in your following response. Smaller batches let the orchestrator deliver cache/failure/progress signals to you between actions. Tool calls beyond the cap are dropped. Use todo_write between batches to mark progress.",
518644
518700
  medium: "\n\n## Response batching\n\nEmit AT MOST 4 tool calls per response. After observing their results, plan the next batch in your following response. Smaller batches let the orchestrator deliver cache/failure/progress signals to you between actions. Tool calls beyond the cap are dropped. Use todo_write between batches to mark progress.",
@@ -520556,6 +520612,20 @@ TASK: ${task}` : task;
520556
520612
  const STAG_FAILURE_THRESHOLD = 5;
520557
520613
  const STAG_VARIANT_THRESHOLD = 4;
520558
520614
  const STAG_FILES_DELTA_MIN = 3;
520615
+ let injectionsThisTurn = 0;
520616
+ const INJECTION_BUDGET_SOFT = 2;
520617
+ const deferredSoftInjections = [];
520618
+ const pushSoftInjection = (role, content) => {
520619
+ if (injectionsThisTurn < INJECTION_BUDGET_SOFT) {
520620
+ messages2.push({ role, content });
520621
+ injectionsThisTurn++;
520622
+ return true;
520623
+ }
520624
+ if (deferredSoftInjections.length < 6) {
520625
+ deferredSoftInjections.push({ role, content });
520626
+ }
520627
+ return false;
520628
+ };
520559
520629
  for (let turn = 0; turn < this.options.maxTurns; turn++) {
520560
520630
  clearTurnState(this._appState);
520561
520631
  this._maybeApplyThinkGuard();
@@ -520570,6 +520640,12 @@ TASK: ${task}` : task;
520570
520640
  this.emit({ type: "error", content: "Task aborted by user", timestamp: (/* @__PURE__ */ new Date()).toISOString() });
520571
520641
  break;
520572
520642
  }
520643
+ injectionsThisTurn = 0;
520644
+ while (deferredSoftInjections.length > 0 && injectionsThisTurn < INJECTION_BUDGET_SOFT) {
520645
+ const next = deferredSoftInjections.shift();
520646
+ messages2.push({ role: next.role, content: next.content });
520647
+ injectionsThisTurn++;
520648
+ }
520573
520649
  if (turn > stagnationCooldownUntilTurn && stagnationWindow.length >= STAG_MIN_SAMPLES) {
520574
520650
  const cutoffTurn = turn - STAG_WINDOW_TURNS;
520575
520651
  const cutoffTs = Date.now() - STAG_WINDOW_MS;
@@ -520817,11 +520893,8 @@ Now call file_write with YOUR skeleton for this task.`
520817
520893
  if (toolHints.length > 0) {
520818
520894
  toolHints.sort((a2, b) => b.score - a2.score);
520819
520895
  const top = toolHints.slice(0, 5);
520820
- messages2.push({
520821
- role: "system",
520822
- content: `[Relevant tools for this task]
520823
- ${top.map((t2) => `- ${t2.name}: ${t2.desc}`).join("\n")}`
520824
- });
520896
+ pushSoftInjection("system", `[Relevant tools for this task]
520897
+ ${top.map((t2) => `- ${t2.name}: ${t2.desc}`).join("\n")}`);
520825
520898
  }
520826
520899
  }
520827
520900
  if (turn === 0 && (turnTier === "small" || turnTier === "medium")) {
@@ -520845,11 +520918,8 @@ ${top.map((t2) => `- ${t2.name}: ${t2.desc}`).join("\n")}`
520845
520918
  }
520846
520919
  hints.push("EFFICIENCY: Aim for 3-5 tool calls total. Each call should make measurable progress. Do not repeat a tool call with the same arguments.");
520847
520920
  if (hints.length > 0) {
520848
- messages2.push({
520849
- role: "system",
520850
- content: `[Efficiency Guide]
520851
- ${hints.join("\n")}`
520852
- });
520921
+ pushSoftInjection("system", `[Efficiency Guide]
520922
+ ${hints.join("\n")}`);
520853
520923
  }
520854
520924
  }
520855
520925
  if (turn === 0 && (turnTier === "small" || turnTier === "medium")) {
@@ -520859,21 +520929,18 @@ ${hints.join("\n")}`
520859
520929
  const hasMultiStepRequirement = taskGoal.length > 200 && (taskGoal.match(/\d\./g) || []).length >= 2;
520860
520930
  const isAnalysisTask = (taskGoal.match(/\banalyze\b|\baudit\b|\breview\b|\bdiagnose\b|\binvestigate\b|\bcompare\b|\bevaluate\b/gi) || []).length >= 1;
520861
520931
  if (hasMultiplePremises || hasConditionalLogic || hasMultiStepRequirement || isAnalysisTask) {
520862
- messages2.push({
520863
- role: "system",
520864
- content: [
520865
- "[Structured Reasoning Guide]",
520866
- "This task requires multi-step reasoning. Follow this structure:",
520867
- "",
520868
- "1. DECOMPOSE: List the sub-questions this task requires, from simplest to most complex.",
520869
- "2. For each sub-question:",
520870
- " a. State what you KNOW (verified from evidence/tool output)",
520871
- " b. State what you ASSUME (hypotheses not yet confirmed)",
520872
- " c. Derive your conclusion using ONLY verified facts",
520873
- "3. If a tool result contradicts your earlier reasoning, UPDATE your conclusions — don't ignore new evidence.",
520874
- "4. Before your final answer, verify: does each conclusion follow from the evidence?"
520875
- ].join("\n")
520876
- });
520932
+ pushSoftInjection("system", [
520933
+ "[Structured Reasoning Guide]",
520934
+ "This task requires multi-step reasoning. Follow this structure:",
520935
+ "",
520936
+ "1. DECOMPOSE: List the sub-questions this task requires, from simplest to most complex.",
520937
+ "2. For each sub-question:",
520938
+ " a. State what you KNOW (verified from evidence/tool output)",
520939
+ " b. State what you ASSUME (hypotheses not yet confirmed)",
520940
+ " c. Derive your conclusion using ONLY verified facts",
520941
+ "3. If a tool result contradicts your earlier reasoning, UPDATE your conclusions — don't ignore new evidence.",
520942
+ "4. Before your final answer, verify: does each conclusion follow from the evidence?"
520943
+ ].join("\n"));
520877
520944
  }
520878
520945
  }
520879
520946
  const turnBudget = turnTier === "small" ? 5 : turnTier === "medium" ? 8 : 0;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.475",
3
+ "version": "0.187.476",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "open-agents-ai",
9
- "version": "0.187.475",
9
+ "version": "0.187.476",
10
10
  "hasInstallScript": true,
11
11
  "license": "CC-BY-NC-4.0",
12
12
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.475",
3
+ "version": "0.187.476",
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",