@ouro.bot/cli 0.1.0-alpha.1724 → 0.1.0-alpha.1725

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,12 @@
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.1725",
6
+ "changes": [
7
+ "An agent's messages no longer run sentences together, as in \"...as promised.Quarantine retry is the big one\". When the agent wrote a line, used a tool and then answered, the line and the answer reached the person as one message with no space between them. On iMessage, Telegram and mail, which send whole messages, the answer now goes out alone, and the agent's mid-turn messages still go out through `speak`. On Teams and the terminal, which show text as it is written, each message in a turn starts a new paragraph: the agent's line, each `speak` and the answer. The fix is in the shared engine, so every sense gets it."
8
+ ]
9
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.1724",
6
12
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1724",
2
+ "runtimeVersion": "0.1.0-alpha.1725",
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.1724</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1725</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -339,7 +339,7 @@ function stepBudgetNotice(left, ceilingLeft, wrapUpTool) {
339
339
  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}.`;
340
340
  }
341
341
  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.";
342
- function continuationCallbacks(callbacks, text) {
342
+ function continuationCallbacks(callbacks, text, deliver) {
343
343
  const noop = () => undefined;
344
344
  return {
345
345
  onModelStart: callbacks.onModelStart ?? noop,
@@ -353,8 +353,19 @@ function continuationCallbacks(callbacks, text) {
353
353
  ...(callbacks.onToolDispatch ? { onToolDispatch: callbacks.onToolDispatch } : {}),
354
354
  onToolEnd: callbacks.onToolEnd ?? noop,
355
355
  onError: callbacks.onError ?? noop,
356
- ...(callbacks.onClearText ? { onClearText: callbacks.onClearText } : {}),
357
- ...(callbacks.flushNow ? { flushNow: callbacks.flushNow } : {}),
356
+ onClearText: () => {
357
+ text.value = "";
358
+ callbacks.onClearText?.();
359
+ },
360
+ // A speak is its own message: the caller's sense sends it, or the continuation does.
361
+ flushNow: async () => {
362
+ const spoken = text.value.trim();
363
+ text.value = "";
364
+ if (callbacks.flushNow)
365
+ await callbacks.flushNow();
366
+ else if (spoken)
367
+ await deliver(spoken);
368
+ },
358
369
  ...(callbacks.settleOutputMode ? { settleOutputMode: callbacks.settleOutputMode } : {}),
359
370
  };
360
371
  }
@@ -409,7 +420,7 @@ async function resumeApprovalContinuation(options) {
409
420
  return { outcome: "terminal_notice", messages: materialized.messages };
410
421
  }
411
422
  const outward = { value: "" };
412
- const callbacks = continuationCallbacks(options.callbacks, outward);
423
+ const callbacks = continuationCallbacks(options.callbacks, outward, options.deliver);
413
424
  await options.markContinuationAttempted();
414
425
  const result = await options.runAgent(materialized.messages, callbacks, options.channel, options.signal, currentOptions);
415
426
  if (result.outcome === "suspended") {
@@ -1160,7 +1171,41 @@ async function runAgent(messages, callbacks, channel, signal, options) {
1160
1171
  });
1161
1172
  }
1162
1173
  }
1163
- async function runCountedTurn(turnTally, messages, callbacks, channel, signal, options) {
1174
+ /** A turn's text reaches a sense as one stream, and this marks where each message in it ends: at a tool step, and once
1175
+ * a speak is delivered. A sense that streams has already shown the last message, so the next starts a new paragraph.
1176
+ * A sense that can't stream drops narration it never sent, so the answer goes out on its own. */
1177
+ function messageBoundaries(callbacks, streams) {
1178
+ let wrote = false;
1179
+ let breakNext = false;
1180
+ const ended = () => { breakNext = streams && wrote; };
1181
+ const bounded = new Proxy(callbacks, {
1182
+ get(target, property, receiver) {
1183
+ const value = Reflect.get(target, property, receiver);
1184
+ if (property === "onTextChunk") {
1185
+ return (text) => {
1186
+ value.call(target, breakNext && text ? `\n\n${text}` : text);
1187
+ if (text) {
1188
+ wrote = true;
1189
+ breakNext = false;
1190
+ }
1191
+ };
1192
+ }
1193
+ if (property !== "flushNow" || typeof value !== "function")
1194
+ return value;
1195
+ return async () => { await value.call(target); ended(); };
1196
+ },
1197
+ });
1198
+ return {
1199
+ callbacks: bounded,
1200
+ endStep: () => { if (streams)
1201
+ ended();
1202
+ else
1203
+ callbacks.onClearText?.(); },
1204
+ };
1205
+ }
1206
+ async function runCountedTurn(turnTally, messages, unboundedCallbacks, channel, signal, options) {
1207
+ const boundaries = messageBoundaries(unboundedCallbacks, !channel || (0, friends_1.getChannelCapabilities)(channel).supportsStreaming);
1208
+ const callbacks = boundaries.callbacks;
1164
1209
  const generatedMessages = [];
1165
1210
  let nextAttemptControls = [];
1166
1211
  let rejectedAttempt = [];
@@ -2289,15 +2334,9 @@ async function runCountedTurn(turnTally, messages, callbacks, channel, signal, o
2289
2334
  : undefined;
2290
2335
  if (soleTerminalCall && soleTerminalProjection?.mode === "verbatim") {
2291
2336
  const terminalArgs = validatedCallArguments.get(soleTerminalCall);
2292
- if (soleTerminalProjection.clearBufferedText
2293
- || callbacks.settleOutputMode === "final_only") {
2294
- streamCallbackBuffer?.discard();
2295
- }
2296
- else {
2297
- await streamCallbackBuffer?.flush();
2298
- }
2299
- if (soleTerminalProjection.clearBufferedText)
2300
- callbacks.onClearText?.();
2337
+ // The tool's receipt is the whole answer, so prose written beside the call never reaches the person with it.
2338
+ streamCallbackBuffer?.discard();
2339
+ callbacks.onClearText?.();
2301
2340
  callbacks.onToolStart(soleTerminalCall.name, terminalArgs);
2302
2341
  let terminalResult;
2303
2342
  let terminalSucceeded = false;
@@ -2772,6 +2811,7 @@ async function runCountedTurn(turnTally, messages, callbacks, channel, signal, o
2772
2811
  continue;
2773
2812
  }
2774
2813
  await streamCallbackBuffer?.flush();
2814
+ boundaries.endStep();
2775
2815
  pushGenerated(msg);
2776
2816
  const batchToolImages = [];
2777
2817
  // Every pre-dispatch gate accepted the complete batch.
@@ -2828,9 +2868,6 @@ async function runCountedTurn(turnTally, messages, callbacks, channel, signal, o
2828
2868
  continue;
2829
2869
  }
2830
2870
  callbacks.onToolDispatch?.("speak");
2831
- // A sense that can't stream holds the model's narration unsent (settle clears it); keep it out of the speak.
2832
- if (channel && !(0, friends_1.getChannelCapabilities)(channel).supportsStreaming)
2833
- callbacks.onClearText?.();
2834
2871
  callbacks.onTextChunk(speakMessage);
2835
2872
  let speakDeliveryError = null;
2836
2873
  try {
@@ -55,7 +55,6 @@ exports.habitToolDefinitions = [
55
55
  terminalProjection: {
56
56
  mode: "verbatim",
57
57
  requiresSoleCall: true,
58
- clearBufferedText: true,
59
58
  },
60
59
  summaryKeys: ["habit", "evidence"],
61
60
  handler: async (args, context) => {
@@ -603,7 +603,9 @@ function createTeamsCallbacks(stream, controller, sendMessage, options) {
603
603
  textBuffer = "";
604
604
  },
605
605
  flushNow: async () => {
606
- const trimmed = textBuffer.trim();
606
+ // The stream keeps the paragraph break the engine leads a message with; a separate fallback message does not.
607
+ const paragraph = textBuffer.trimEnd();
608
+ const trimmed = paragraph.trimStart();
607
609
  if (!trimmed)
608
610
  return;
609
611
  // Cancel pending periodic flush — we're delivering now.
@@ -622,7 +624,7 @@ function createTeamsCallbacks(stream, controller, sendMessage, options) {
622
624
  let delivered = false;
623
625
  let lastError = null;
624
626
  if (!stopped) {
625
- const ok = await tryEmitNoAbort(trimmed);
627
+ const ok = await tryEmitNoAbort(paragraph);
626
628
  if (ok)
627
629
  delivered = true;
628
630
  else
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1724",
3
+ "version": "0.1.0-alpha.1725",
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.1724",
9
+ "version": "0.1.0-alpha.1725",
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.1724",
3
+ "version": "0.1.0-alpha.1725",
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": {