open-agents-ai 0.88.0 → 0.89.0

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 +122 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -18325,6 +18325,49 @@ var init_nexusBackend = __esm({
18325
18325
  usage: this.extractUsage(responseData)
18326
18326
  };
18327
18327
  }
18328
+ /**
18329
+ * Simulated streaming: calls chatCompletion() for the full response,
18330
+ * then yields it as word-level StreamChunk objects.
18331
+ * Gives API compatibility with the streaming path in AgenticRunner.
18332
+ */
18333
+ async *chatCompletionStream(request) {
18334
+ const response = await this.chatCompletion(request);
18335
+ const choice = response.choices[0];
18336
+ if (!choice)
18337
+ return;
18338
+ const msg = choice.message;
18339
+ if (msg.content) {
18340
+ const words = msg.content.split(/(\s+)/);
18341
+ for (const word of words) {
18342
+ if (word) {
18343
+ yield { type: "content", content: word };
18344
+ }
18345
+ }
18346
+ }
18347
+ if (msg.toolCalls) {
18348
+ for (let i = 0; i < msg.toolCalls.length; i++) {
18349
+ const tc = msg.toolCalls[i];
18350
+ yield {
18351
+ type: "tool_call_delta",
18352
+ toolCallIndex: i,
18353
+ toolCallId: tc.id,
18354
+ toolCallName: tc.name,
18355
+ toolCallArgs: JSON.stringify(tc.arguments)
18356
+ };
18357
+ }
18358
+ }
18359
+ if (response.usage) {
18360
+ yield {
18361
+ type: "usage",
18362
+ usage: {
18363
+ promptTokens: response.usage.promptTokens ?? 0,
18364
+ completionTokens: response.usage.completionTokens ?? 0,
18365
+ totalTokens: response.usage.totalTokens
18366
+ }
18367
+ };
18368
+ }
18369
+ yield { type: "finish", finishReason: "stop" };
18370
+ }
18328
18371
  extractUsage(data) {
18329
18372
  const usage = data.usage;
18330
18373
  if (!usage)
@@ -18341,6 +18384,60 @@ var init_nexusBackend = __esm({
18341
18384
  }
18342
18385
  });
18343
18386
 
18387
+ // packages/orchestrator/dist/flowstatePrompt.js
18388
+ var FLOWSTATE_PROMPT;
18389
+ var init_flowstatePrompt = __esm({
18390
+ "packages/orchestrator/dist/flowstatePrompt.js"() {
18391
+ "use strict";
18392
+ FLOWSTATE_PROMPT = `## FlowState Protocol (Active)
18393
+
18394
+ You are operating in FlowState mode. Apply this protocol to every task:
18395
+
18396
+ ### Pre-Task (Engage)
18397
+ - Clear context of noise \u2014 compact if SNR is degraded
18398
+ - Set ridiculously specific sub-goals (not "fix things" but "change line 47 of auth.ts to check for null")
18399
+ - Begin immediately \u2014 first tool call in first response (response inhibition)
18400
+ - Identify the first concrete action before reasoning further
18401
+
18402
+ ### During Task (Struggle -> Release -> Flow)
18403
+ - Execute the highest-impact action first (goal-directedness)
18404
+ - Maintain tight feedback loops: execute, verify, learn (immediate feedback)
18405
+ - Calibrate task complexity: chunk if overwhelming, compress if trivial (challenge-skill balance)
18406
+ - Rotate approaches when stuck: different tools, different angles (oasis effect)
18407
+ - Minimize context pollution: archive large outputs, compact when needed (minimalism)
18408
+ - Never research when you can act; never read when you can execute
18409
+ - Track your own token allocation: maximize flow-tokens (core reasoning), minimize junk-tokens (unnecessary elaboration)
18410
+
18411
+ ### Between Tasks (Recovery)
18412
+ - Compact context aggressively (active recovery, not passive degradation)
18413
+ - Update persistent memory with learnings (consolidation)
18414
+ - Clear the todo list \u2014 identify next highest-impact action (power-down ritual)
18415
+ - Assess context quality and improve if degraded
18416
+
18417
+ ### Flowstate Checklist (verify before each major action)
18418
+ - [ ] Is the goal ridiculously clear? (specific file, line, change \u2014 not vague intent)
18419
+ - [ ] Is context clean? (no irrelevant history cluttering working memory)
18420
+ - [ ] Is the first action identified? (a specific tool call, not more research)
18421
+ - [ ] Is the feedback loop tight? (verification command defined before making changes)
18422
+ - [ ] Is recovery planned? (compaction strategy selected for after task)
18423
+
18424
+ ### The Diagnostic Compass (when stuck)
18425
+ | Symptom | Variable | Fix |
18426
+ |---|---|---|
18427
+ | Working on the wrong thing | Goal-Directedness | Re-target. Find the most direct path. |
18428
+ | Underleveraged | Leverage | Parallelize. Use sub-agents. Build reusable systems. |
18429
+ | Distracted, fractured, unable to sustain depth | Flow | Remove friction. Reduce cognitive load. Create immersion. |
18430
+
18431
+ ### Peak Performance Equation
18432
+ Peak Performance = Goal-Directedness x Leverage x Flow
18433
+ (These MULTIPLY \u2014 a zero in any one collapses the entire equation)
18434
+
18435
+ ### Mantra
18436
+ Flow follows focus. Focus follows clarity. Clarity follows constraint.
18437
+ Constrain your context. Clarify your target. Focus your tools. Flow will follow.`;
18438
+ }
18439
+ });
18440
+
18344
18441
  // packages/orchestrator/dist/costTracker.js
18345
18442
  var DEFAULT_PRICING, CostTracker;
18346
18443
  var init_costTracker = __esm({
@@ -18821,6 +18918,7 @@ var init_dist5 = __esm({
18821
18918
  init_retryController();
18822
18919
  init_agenticRunner();
18823
18920
  init_nexusBackend();
18921
+ init_flowstatePrompt();
18824
18922
  init_costTracker();
18825
18923
  init_workEvaluator();
18826
18924
  init_sessionMetrics();
@@ -23674,6 +23772,7 @@ function renderSlashHelp() {
23674
23772
  ["/compact <strategy>", "Compact with strategy: aggressive, decisions, errors, summary, structured"],
23675
23773
  ["/bruteforce", "Toggle brute-force mode (auto re-engage on turn limit)"],
23676
23774
  ["/deep", "Toggle deep context \u2014 relaxes compaction so large models use 85% of context"],
23775
+ ["/flow", "Toggle FlowState protocol \u2014 immediate action, tight loops, goal clarity"],
23677
23776
  ["/tools", "List agent-created custom tools"],
23678
23777
  ["/skills", "List available AIWG skills"],
23679
23778
  ["/skills <keyword>", "Filter skills by name or trigger"],
@@ -29386,6 +29485,18 @@ async function handleSlashCommand(input, ctx) {
29386
29485
  renderInfo(`Deep context mode: ${isOn ? "ON" : "OFF"}${hasLocal ? " (project-local)" : ""}` + (isOn ? " \u2014 compaction relaxed to 85% of context window. Large models will retain more working memory for complex reasoning." : " \u2014 compaction restored to default thresholds."));
29387
29486
  return "handled";
29388
29487
  }
29488
+ case "flow":
29489
+ case "flowstate": {
29490
+ if (!ctx.flowToggle) {
29491
+ renderWarning("FlowState not available");
29492
+ return "handled";
29493
+ }
29494
+ const isFlowOn = ctx.flowToggle();
29495
+ const flowSave = hasLocal ? ctx.saveLocalSettings.bind(ctx) : ctx.saveSettings.bind(ctx);
29496
+ flowSave({ flow: isFlowOn });
29497
+ renderInfo(`FlowState protocol: ${isFlowOn ? "ON" : "OFF"}${hasLocal ? " (project-local)" : ""}` + (isFlowOn ? " \u2014 agent will follow FlowState protocol: immediate action, tight feedback loops, goal clarity, challenge-skill calibration." : " \u2014 standard agent behavior restored."));
29498
+ return "handled";
29499
+ }
29389
29500
  case "emojis":
29390
29501
  case "emoji": {
29391
29502
  const current = ctx.getEmojis?.() ?? true;
@@ -39630,7 +39741,7 @@ function formatDMNToolArgs(toolName, args) {
39630
39741
  return "";
39631
39742
  }
39632
39743
  }
39633
- function startTask(task, config, repoRoot, voice, stream, taskStores, bruteForce, statusBar, sudoCallback, costTracker, onComplete, taskType, contextWindowSize, modelCaps, personality, deepContext, onCompaction, emotionEngine) {
39744
+ function startTask(task, config, repoRoot, voice, stream, taskStores, bruteForce, statusBar, sudoCallback, costTracker, onComplete, taskType, contextWindowSize, modelCaps, personality, deepContext, onCompaction, emotionEngine, flowEnabled) {
39634
39745
  const voiceStyleMap = {
39635
39746
  concise: 1,
39636
39747
  balanced: 3,
@@ -39644,6 +39755,9 @@ function startTask(task, config, repoRoot, voice, stream, taskStores, bruteForce
39644
39755
  if (taskType && modelTier !== "small") {
39645
39756
  dynamicContext += "\n\n" + buildTaskContext(taskType);
39646
39757
  }
39758
+ if (flowEnabled) {
39759
+ dynamicContext += "\n\n" + FLOWSTATE_PROMPT;
39760
+ }
39647
39761
  let backend;
39648
39762
  if (config.backendType === "nexus") {
39649
39763
  const nexusTool = new NexusTool(repoRoot);
@@ -40042,6 +40156,7 @@ async function startInteractive(config, repoPath) {
40042
40156
  let bruteForceEnabled = savedSettings.bruteforce ?? true;
40043
40157
  let currentStyle = PRESET_NAMES.includes(savedSettings.style) ? savedSettings.style : "balanced";
40044
40158
  let deepContextEnabled = savedSettings.deepContext ?? false;
40159
+ let flowEnabled = savedSettings.flow === true;
40045
40160
  if (savedSettings.emojis !== void 0)
40046
40161
  setEmojisEnabled(savedSettings.emojis);
40047
40162
  if (savedSettings.colors !== void 0)
@@ -40574,6 +40689,10 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
40574
40689
  deepContextEnabled = !deepContextEnabled;
40575
40690
  return deepContextEnabled;
40576
40691
  },
40692
+ flowToggle() {
40693
+ flowEnabled = !flowEnabled;
40694
+ return flowEnabled;
40695
+ },
40577
40696
  setStyle(preset) {
40578
40697
  currentStyle = preset;
40579
40698
  },
@@ -41547,7 +41666,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
41547
41666
  }, bruteForceEnabled, statusBar, handleSudoRequest, costTracker, (summary, meta) => {
41548
41667
  lastCompletedSummary = summary;
41549
41668
  lastTaskMeta = meta ?? null;
41550
- }, currentTaskType, resolvedContextWindowSize, resolvedCaps, currentStyle, deepContextEnabled, compactionSNRCallback(), emotionEngine);
41669
+ }, currentTaskType, resolvedContextWindowSize, resolvedCaps, currentStyle, deepContextEnabled, compactionSNRCallback(), emotionEngine, flowEnabled);
41551
41670
  activeTask = task;
41552
41671
  showPrompt();
41553
41672
  await task.promise;
@@ -41764,7 +41883,7 @@ NEW TASK: ${fullInput}`;
41764
41883
  }, bruteForceEnabled, statusBar, handleSudoRequest, costTracker, (summary, meta) => {
41765
41884
  lastCompletedSummary = summary;
41766
41885
  lastTaskMeta = meta ?? null;
41767
- }, currentTaskType, resolvedContextWindowSize, resolvedCaps, currentStyle, deepContextEnabled, compactionSNRCallback(), emotionEngine);
41886
+ }, currentTaskType, resolvedContextWindowSize, resolvedCaps, currentStyle, deepContextEnabled, compactionSNRCallback(), emotionEngine, flowEnabled);
41768
41887
  activeTask = task;
41769
41888
  showPrompt();
41770
41889
  await task.promise;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.88.0",
3
+ "version": "0.89.0",
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",