@ouro.bot/cli 0.1.0-alpha.1436 → 0.1.0-alpha.1438

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/changelog.json CHANGED
@@ -1,6 +1,16 @@
1
1
  {
2
2
  "_note": "Each pull request writes its own change note under changes/; the release job on main gives each landed change its version and adds the notes here (scripts/release-version.cjs). On main this file stops at the last version set by hand; the published package has every release. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.1438",
6
+ "changes": [
7
+ "When `load_skill` gets a name that isn't a skill, its error now lists the skills the agent can load and says to call it again with one of them. Before, it listed the folders it had checked, and its fix said to call `list_skills`, which the Sanctuary owner profile doesn't have; in the step 6 replay, MiniMax runs that asked for an unknown skill went to list those folders with the shell instead. If the skill exists but can't be read, or the skills can't be listed, the loader's own error is kept.",
8
+ "A turn close to its step budget is now warned, and one step without progress no longer ends a working turn early.",
9
+ "When two or fewer later steps can still run tools, the last result of each step ends with a `[step budget]` note. This covers a tool's result, a lone `speak` or `find_tools`, and a batch rejected before it ran. The note says how many steps are left at most, and whether more can still be earned. It also says to finish what was asked first, such as a change or a send already prepared, before extra checks. After the last such step, it says to settle (or rest) now.",
10
+ "The budget still starts at 8 and grows by 4, up to 24 (or `context.maxStepsPerTurn`). It now grows when any of the last 4 steps made progress, not only the step just before the boundary. So a `speak`, a check that exits 1 or a rejected call on that step no longer stops the turn. A turn with no progress in its last 4 steps still stops.",
11
+ "Why: in the step 6 MiniMax replay, 4 of the 5 failed unreadable-edition runs stopped below 24. In 4 of the 5, the step the limit rejected held a `books library replace` that was ready to run."
12
+ ]
13
+ },
4
14
  {
5
15
  "version": "0.1.0-alpha.1436",
6
16
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1436",
2
+ "runtimeVersion": "0.1.0-alpha.1438",
3
3
  "bundleSchemaVersion": 3,
4
4
  "lastUpdated": "2026-09-03T00:00:00.000Z"
5
5
  }
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0"?>
2
2
  <Container version="2">
3
3
  <Name>ouro-butler</Name>
4
- <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1436</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1438</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MAX_PROVIDER_ITERATIONS_CEILING = exports.STEP_BUDGET_EXTENSION = exports.MAX_PROVIDER_ITERATIONS = void 0;
3
+ exports.STEP_BUDGET_NOTICE_AT = exports.MAX_PROVIDER_ITERATIONS_CEILING = exports.STEP_BUDGET_EXTENSION = exports.MAX_PROVIDER_ITERATIONS = void 0;
4
4
  exports.validateToolCallBatchAtProductionBoundary = validateToolCallBatchAtProductionBoundary;
5
5
  exports.createProviderRegistry = createProviderRegistry;
6
6
  exports.getProviderRuntime = getProviderRuntime;
@@ -10,6 +10,7 @@ exports.getProvider = getProvider;
10
10
  exports.createSummarize = createSummarize;
11
11
  exports.getProviderDisplayLabel = getProviderDisplayLabel;
12
12
  exports.createHabitCallbackBuffer = createHabitCallbackBuffer;
13
+ exports.stepBudgetNotice = stepBudgetNotice;
13
14
  exports.resumeApprovalContinuation = resumeApprovalContinuation;
14
15
  exports.unsentSurfaceResult = unsentSurfaceResult;
15
16
  exports.surfacesReachedLater = surfacesReachedLater;
@@ -320,6 +321,20 @@ exports.STEP_BUDGET_EXTENSION = 4;
320
321
  /** Hard ceiling on the per-turn provider-call budget, however much progress is made. */
321
322
  exports.MAX_PROVIDER_ITERATIONS_CEILING = 24;
322
323
  const STEP_BUDGET_REPORT_INSTRUCTION = "the step budget for this turn is used up. do not call any more work tools; none of the tool calls in your last message were executed. call settle now with a short progress report: what is done (with evidence from tool results above), what is still in flight, and what you will do next. say you can continue where you left off when the conversation resumes.";
324
+ /** How few tool-running steps a turn has left before the model is told, so it finishes the asked-for change before the stop. */
325
+ exports.STEP_BUDGET_NOTICE_AT = 2;
326
+ /**
327
+ * The note on a batch's last tool result once the turn is near its step budget: how many more steps can run tools, whether
328
+ * more can still be earned, and what to do with them. `left` counts the steps that will run tools if no further call makes
329
+ * progress; `ceilingLeft` the most the turn can ever get.
330
+ */
331
+ function stepBudgetNotice(left, ceilingLeft, wrapUpTool) {
332
+ if (left <= 0)
333
+ return `[step budget] that was the last step in this turn that can run tools. call ${wrapUpTool} now: what is done (with evidence from the results above), what is still open, and what you will do next.`;
334
+ const steps = left === 1 ? "at most 1 more step" : `at most ${left} more steps`;
335
+ const more = left >= ceilingLeft ? ", and that is this turn's limit" : "; more come only while new calls keep succeeding";
336
+ return `[step budget] ${steps} in this turn can run tools${more}. finish what was asked first (a change or a send you have ready), leave extra checks for later, then call ${wrapUpTool}.`;
337
+ }
323
338
  const STEP_BUDGET_REST_INSTRUCTION = "the step budget for this turn is used up. do not call any more work tools; none of the tool calls in your last message were executed. call rest now with a short note: what is done, what is still open, and what to pick up next time.";
324
339
  function continuationCallbacks(callbacks, text) {
325
340
  const noop = () => undefined;
@@ -1380,7 +1395,10 @@ async function runAgent(messages, callbacks, channel, signal, options) {
1380
1395
  // Adaptive step budget: starts at the base, grows while tool calls make progress.
1381
1396
  let stepBudget = exports.MAX_PROVIDER_ITERATIONS;
1382
1397
  const stepBudgetCeiling = Math.max(exports.MAX_PROVIDER_ITERATIONS, (0, config_1.getContextConfig)().maxStepsPerTurn ?? exports.MAX_PROVIDER_ITERATIONS_CEILING);
1383
- let lastIterationMadeProgress = false;
1398
+ // The iteration whose tool calls last made progress. The budget grows when any of the last few iterations did, so one
1399
+ // step without progress at the boundary (a speak, a check that exits 1, a rejected call) does not end a working turn.
1400
+ let lastProgressIteration = 0;
1401
+ const progressedRecently = () => lastProgressIteration > 0 && lastProgressIteration >= providerIterations - exports.STEP_BUDGET_EXTENSION;
1384
1402
  let stepReportIteration = null;
1385
1403
  // The one tool a turn may call after its step budget is used up: settle for conversations, rest for private turns.
1386
1404
  let stepReportTool = "settle";
@@ -1389,13 +1407,34 @@ async function runAgent(messages, callbacks, channel, signal, options) {
1389
1407
  const budgetExhausted = () => {
1390
1408
  if (providerIterations < stepBudget)
1391
1409
  return false;
1392
- if (lastIterationMadeProgress && stepBudget < stepBudgetCeiling) {
1410
+ if (progressedRecently() && stepBudget < stepBudgetCeiling) {
1393
1411
  stepBudget = Math.min(stepBudgetCeiling, stepBudget + exports.STEP_BUDGET_EXTENSION);
1394
1412
  (0, runtime_1.emitNervesEvent)({ component: "engine", event: "engine.step_budget_extended", message: "tool progress extended the per-turn step budget", meta: { stepBudget } });
1395
1413
  return providerIterations >= stepBudget;
1396
1414
  }
1397
1415
  return true;
1398
1416
  };
1417
+ // After this iteration's calls: how many later steps will run tools if nothing more makes progress, told to the model
1418
+ // once that is STEP_BUDGET_NOTICE_AT or fewer, so a prepared change is not cut off by a stop it never saw coming.
1419
+ const nearBudgetNotice = (toolNames) => {
1420
+ // The next boundary is the first later step that reaches the budget; it extends only if this or an earlier step's
1421
+ // progress still falls in its window, and a second extension is never earned without new progress.
1422
+ const boundary = Math.max(providerIterations + 1, stepBudget);
1423
+ const grows = lastProgressIteration > 0 && lastProgressIteration >= boundary - exports.STEP_BUDGET_EXTENSION && stepBudget < stepBudgetCeiling;
1424
+ const budget = grows ? Math.min(stepBudgetCeiling, stepBudget + exports.STEP_BUDGET_EXTENSION) : stepBudget;
1425
+ const left = Math.max(0, budget - providerIterations - 1);
1426
+ if (left > exports.STEP_BUDGET_NOTICE_AT)
1427
+ return null;
1428
+ const wrapUpTool = toolNames.has("settle") ? "settle" : toolNames.has("rest") ? "rest" : null;
1429
+ if (!wrapUpTool)
1430
+ return null;
1431
+ return stepBudgetNotice(left, stepBudgetCeiling - providerIterations - 1, wrapUpTool);
1432
+ };
1433
+ // Adds the note, when there is one, to the last result the model gets for this step's batch.
1434
+ const withBudgetNote = (content, isLast, toolNames) => {
1435
+ const note = isLast && stepReportIteration === null ? nearBudgetNotice(toolNames) : null;
1436
+ return note ? `${content}\n\n${note}` : content;
1437
+ };
1399
1438
  const requiredToolCallNames = [...new Set(options?.requiredToolCalls?.names ?? [])];
1400
1439
  const dispatchedRequiredToolCalls = new Set();
1401
1440
  const rejectAttempt = (assistant, controls) => {
@@ -1468,9 +1507,12 @@ async function runAgent(messages, callbacks, channel, signal, options) {
1468
1507
  }
1469
1508
  return { error: groundingError ?? shelfError ?? brevityError, unverifiedNames, shelfUnverified };
1470
1509
  };
1510
+ // The tools this step offered, so a whole-batch rejection can carry the step-budget note too.
1511
+ let budgetNoteToolNames = new Set();
1471
1512
  const rejectToolBatch = (assistant, reasons) => {
1472
- rejectAttempt(assistant, assistant.tool_calls.map((call, index) => ({
1473
- role: "tool", tool_call_id: call.id, content: reasons[index],
1513
+ const calls = assistant.tool_calls;
1514
+ rejectAttempt(assistant, calls.map((call, index) => ({
1515
+ role: "tool", tool_call_id: call.id, content: withBudgetNote(reasons[index], index === calls.length - 1, budgetNoteToolNames),
1474
1516
  })));
1475
1517
  };
1476
1518
  const pendingRequiredToolCalls = () => {
@@ -1639,6 +1681,7 @@ async function runAgent(messages, callbacks, channel, signal, options) {
1639
1681
  })()
1640
1682
  : ordinaryActiveTools;
1641
1683
  const candidateToolNames = new Set(candidateActiveTools.map((tool) => tool.function.name));
1684
+ budgetNoteToolNames = candidateToolNames;
1642
1685
  const unadvertisedRequiredTool = requiredToolCallNames.find((name) => !candidateToolNames.has(name));
1643
1686
  if (unadvertisedRequiredTool) {
1644
1687
  (0, runtime_1.emitNervesEvent)({ level: "error", component: "engine", event: "engine.required_tool_unadvertised", message: "required tool is not advertised for the active channel", meta: { toolName: unadvertisedRequiredTool, channel: String(channel) } });
@@ -1927,8 +1970,6 @@ async function runAgent(messages, callbacks, channel, signal, options) {
1927
1970
  (0, runtime_1.emitNervesEvent)({ level: "warn", component: "engine", event: "engine.step_budget_exhausted", message: `step budget used up; requesting a ${wrapUpTool}-only progress report`, meta: { stepBudget, providerIterations } });
1928
1971
  continue;
1929
1972
  }
1930
- if (result.toolCalls.length > 0)
1931
- lastIterationMadeProgress = false;
1932
1973
  // Phase annotation for Codex provider
1933
1974
  const hasPhaseAnnotation = providerRuntime.capabilities.has("phase-annotation");
1934
1975
  const isSoleSettle = result.toolCalls.length === 1 && result.toolCalls[0].name === "settle";
@@ -2656,6 +2697,7 @@ async function runAgent(messages, callbacks, channel, signal, options) {
2656
2697
  pushGenerated(msg);
2657
2698
  const batchToolImages = [];
2658
2699
  // Every pre-dispatch gate accepted the complete batch.
2700
+ const isLastCall = (tc) => tc === result.toolCalls[result.toolCalls.length - 1];
2659
2701
  for (const tc of result.toolCalls) {
2660
2702
  if (signal?.aborted)
2661
2703
  break;
@@ -2676,11 +2718,11 @@ async function runAgent(messages, callbacks, channel, signal, options) {
2676
2718
  loadedDeferredTools.push(name);
2677
2719
  // A job a bundle does with a command its skill documents has no door to find; the skill's section answers.
2678
2720
  const skills = (0, skill_search_1.findToolsSkillNote)(query, activeToolNames);
2679
- const found = (0, tool_catalog_1.formatFindToolsReply)(matched, skills.note);
2721
+ if (matched.length > 0 || skills.hits > 0)
2722
+ lastProgressIteration = providerIterations;
2723
+ const found = withBudgetNote((0, tool_catalog_1.formatFindToolsReply)(matched, skills.note), isLastCall(tc), candidateToolNames);
2680
2724
  pushGenerated({ role: "tool", tool_call_id: tc.id, content: found });
2681
2725
  providerRuntime.appendToolOutput(tc.id, found);
2682
- if (matched.length > 0 || skills.hits > 0)
2683
- lastIterationMadeProgress = true;
2684
2726
  // onToolEnd's success means a door was loaded; a skill-only reply loaded none, but is still progress.
2685
2727
  callbacks.onToolEnd(tool_catalog_1.FIND_TOOLS_NAME, query, matched.length > 0);
2686
2728
  (0, tool_catalog_1.recordFindTools)({ query, matched: matched.length, deferred: deferralPool.length, skills: skills.hits });
@@ -2693,7 +2735,7 @@ async function runAgent(messages, callbacks, channel, signal, options) {
2693
2735
  const argSummary = (0, tools_1.summarizeArgs)("speak", { message: speakMessage }, toolSelection);
2694
2736
  callbacks.onToolStart("speak", { message: speakMessage });
2695
2737
  if (speakMessage.trim().length === 0) {
2696
- const err = tools_flow_1.FLOW_TOOL_REFUSALS.speakEmpty;
2738
+ const err = withBudgetNote(tools_flow_1.FLOW_TOOL_REFUSALS.speakEmpty, isLastCall(tc), candidateToolNames);
2697
2739
  callbacks.onToolEnd("speak", argSummary, false);
2698
2740
  pushGenerated({ role: "tool", tool_call_id: tc.id, content: err });
2699
2741
  providerRuntime.appendToolOutput(tc.id, err);
@@ -2717,7 +2759,7 @@ async function runAgent(messages, callbacks, channel, signal, options) {
2717
2759
  }
2718
2760
  if (speakDeliveryError) {
2719
2761
  callbacks.onToolEnd("speak", argSummary, false);
2720
- const failMsg = tools_flow_1.FLOW_TOOL_REFUSALS.speakNotDelivered(speakDeliveryError.message);
2762
+ const failMsg = withBudgetNote(tools_flow_1.FLOW_TOOL_REFUSALS.speakNotDelivered(speakDeliveryError.message), isLastCall(tc), candidateToolNames);
2721
2763
  pushGenerated({ role: "tool", tool_call_id: tc.id, content: failMsg });
2722
2764
  providerRuntime.appendToolOutput(tc.id, failMsg);
2723
2765
  (0, runtime_1.emitNervesEvent)({
@@ -2730,7 +2772,7 @@ async function runAgent(messages, callbacks, channel, signal, options) {
2730
2772
  continue;
2731
2773
  }
2732
2774
  callbacks.onToolEnd("speak", argSummary, true);
2733
- const ack = "(spoken)";
2775
+ const ack = withBudgetNote("(spoken)", isLastCall(tc), candidateToolNames);
2734
2776
  pushGenerated({ role: "tool", tool_call_id: tc.id, content: ack });
2735
2777
  providerRuntime.appendToolOutput(tc.id, ack);
2736
2778
  (0, runtime_1.emitNervesEvent)({
@@ -2894,7 +2936,7 @@ async function runAgent(messages, callbacks, channel, signal, options) {
2894
2936
  toolResult = error instanceof Error ? error.message : String(error);
2895
2937
  }
2896
2938
  callbacks.onToolEnd(tc.name, argSummary, success);
2897
- const shieldedToolResult = (0, delegated_command_1.shieldDelegatedBanner)(toolResult);
2939
+ const shieldedToolResult = withBudgetNote((0, delegated_command_1.shieldDelegatedBanner)(toolResult), isLastCall(tc), candidateToolNames);
2898
2940
  pushGenerated({ role: "tool", tool_call_id: tc.id, content: shieldedToolResult });
2899
2941
  providerRuntime.appendToolOutput(tc.id, shieldedToolResult);
2900
2942
  continue;
@@ -2961,7 +3003,10 @@ async function runAgent(messages, callbacks, channel, signal, options) {
2961
3003
  }
2962
3004
  catch { /* a stale saved copy only repeats the news */ }
2963
3005
  }
2964
- const modelResult = (0, delegated_command_1.shieldDelegatedBanner)((0, tool_output_budget_1.fitToolOutputForModel)(tc.name, (0, tool_friction_1.rewriteToolResultForModel)(tc.name, toolResult, toolFrictionLedger)));
3006
+ if (success && !(0, tool_loop_1.hasRecordedToolCall)(toolLoopState, tc.name, args))
3007
+ lastProgressIteration = providerIterations;
3008
+ const fittedResult = (0, delegated_command_1.shieldDelegatedBanner)((0, tool_output_budget_1.fitToolOutputForModel)(tc.name, (0, tool_friction_1.rewriteToolResultForModel)(tc.name, toolResult, toolFrictionLedger)));
3009
+ const modelResult = withBudgetNote(fittedResult, isLastCall(tc), candidateToolNames);
2965
3010
  pushGenerated({ role: "tool", tool_call_id: tc.id, content: modelResult });
2966
3011
  providerRuntime.appendToolOutput(tc.id, modelResult);
2967
3012
  if (!success)
@@ -2995,9 +3040,7 @@ async function runAgent(messages, callbacks, channel, signal, options) {
2995
3040
  invoked,
2996
3041
  sideEffect: success && changesState,
2997
3042
  });
2998
- if (success && !(0, tool_loop_1.hasRecordedToolCall)(toolLoopState, tc.name, args))
2999
- lastIterationMadeProgress = true;
3000
- (0, tool_loop_1.recordToolOutcome)(toolLoopState, tc.name, args, modelResult, success);
3043
+ (0, tool_loop_1.recordToolOutcome)(toolLoopState, tc.name, args, fittedResult, success);
3001
3044
  callbacks.onToolEnd(tc.name, (0, tools_1.buildToolResultSummary)(tc.name, args, modelResult, success, toolSelection), success);
3002
3045
  callbacks.onToolResult?.(messages);
3003
3046
  }
@@ -65,6 +65,22 @@ function isOwnPersonaNote(key, content) {
65
65
  return PERSONA_KEY.test(key ?? "") || OWN_PERSONA_NOTE.test(`${key ?? ""} ${content ?? ""}`);
66
66
  }
67
67
  exports.OWN_PERSONA_NOTE_REFUSAL = "that note is about my own personality or voice, not about this person, so it belongs in my psyche, not in a friend note. what i learn about how the house works goes into psyche/TACIT.md, and the rest of my psyche changes when my owner asks me directly. a note about the person themselves (their facts, preferences, voice, a character in a game) saves normally.";
68
+ // An unknown name is answered with the names that do load, so the fix needs no other tool: a profile may hold load_skill
69
+ // without list_skills (the Sanctuary owner profile does), and the folder paths only invited the agent to go and look.
70
+ function skillNotFound(name, error) {
71
+ let names;
72
+ try {
73
+ names = (0, skills_1.listSkills)();
74
+ }
75
+ catch {
76
+ return `error: ${error}`;
77
+ }
78
+ if (names.includes(name))
79
+ return `error: ${error}`;
80
+ if (names.length === 0)
81
+ return `error: there is no skill called '${name}', and this agent has no skills installed. Work from the tools you have.`;
82
+ return `error: there is no skill called '${name}'. Skills you can load: ${names.join(", ")}. Call load_skill again with one of those names, spelled exactly.`;
83
+ }
68
84
  exports.notesToolDefinitions = [
69
85
  {
70
86
  tool: {
@@ -99,13 +115,13 @@ exports.notesToolDefinitions = [
99
115
  return (0, skills_1.loadSkill)(a.name);
100
116
  }
101
117
  catch (e) {
102
- return (0, tool_error_code_1.withCode)(`error: ${e}`, "skill-not-found");
118
+ return (0, tool_error_code_1.withCode)(skillNotFound(a.name, e), "skill-not-found");
103
119
  }
104
120
  },
105
121
  summaryKeys: ["name"],
106
122
  riskProfile: { mutates: "none", risk: "low" },
107
- ax: { id: "tool:load_skill", eager: true, group: "turn-skills", when: "Pick this to read a skill's full steps once list_skills has shown you its exact name.", effect: "read", idempotent: true, errors: [
108
- { code: "skill-not-found", means: "No skill with that name could be found or read; the message lists the folders checked.", fix: "Call list_skills and load one of the names it returns, spelled exactly." },
123
+ ax: { id: "tool:load_skill", eager: true, group: "turn-skills", when: "Pick this to read a skill's full steps once you know its exact name.", effect: "read", idempotent: true, errors: [
124
+ { code: "skill-not-found", means: "No skill with that name could be found or read; the message lists the skills this agent can load, or says why a listed one could not be read.", fix: "Load one of the names the error lists, spelled exactly." },
109
125
  ] },
110
126
  },
111
127
  {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1436",
3
+ "version": "0.1.0-alpha.1438",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@ouro.bot/cli",
9
- "version": "0.1.0-alpha.1436",
9
+ "version": "0.1.0-alpha.1438",
10
10
  "bundleDependencies": [
11
11
  "@ouro.bot/friends"
12
12
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1436",
3
+ "version": "0.1.0-alpha.1438",
4
4
  "description": "Ouroboros, the agent harness: agents with durable memory that live where you talk (terminal, Teams, iMessage, mail, voice) and use real tools. Start with npx ouro.bot@latest.",
5
5
  "homepage": "https://ouroboros.bot/",
6
6
  "engines": {