@ouro.bot/cli 0.1.0-alpha.1630 → 0.1.0-alpha.1632

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,14 +1,27 @@
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.1632",
6
+ "changes": [
7
+ "ACP clients such as Orca's chat now see each tool call separately. Before, two calls to the same tool in one turn shared an id, so the client merged them into one row and showed only the last result.",
8
+ "Reopening a saved Ouro chat in an ACP client such as Orca now works, and long chats come back whole. Before, the client was never told it could reopen them, and longer chats lost their latest turns when reopened.",
9
+ "When something inside Ouro fails during an ACP chat (for example the daemon restarting), Orca now shows that error instead of asking you to sign in."
10
+ ]
11
+ },
4
12
  {
5
13
  "version": "0.1.0-alpha.1630",
6
14
  "changes": [
7
- "`mailbox_deliver` now sends a waiting letter to the person's iMessage chat, as the agent, through the agent's own BlueBubbles settings. The text is the one Ouro renders, never the agent's. It goes to the handle that was set when the letter was filed, and the letter records a `delivered` event saying where it landed. A dry run shows the exact text and sends nothing.",
8
- "Each letter goes to the chat once. A second deliver is refused with `already-delivered`. A send that fails after it may have reached the chat, or that outlasts its 25-second deadline, counts as delivered (`send-uncertain`), so a retry never sends the person the same letter twice. A send that never reached the chat (`send-failed`) leaves the letter waiting. A letter whose expiry has passed isn't delivered. When the person has never messaged the agent from that handle, the refusal says so.",
9
15
  "Fixed a flaky guardrails test (#1972): its fixture filled `R/` and then `H/` placeholders in two passes, so a temp folder whose random name ended in `H` had its path rewritten and the shell call was no longer aimed at the friends store. No change to the shipped guard."
10
16
  ]
11
17
  },
18
+ {
19
+ "version": "0.1.0-alpha.1629",
20
+ "changes": [
21
+ "`mailbox_deliver` now sends a waiting letter to the person's iMessage chat, as the agent, through the agent's own BlueBubbles settings. The text is the one Ouro renders, never the agent's. It goes to the handle that was set when the letter was filed, and the letter records a `delivered` event saying where it landed. A dry run shows the exact text and sends nothing.",
22
+ "Each letter goes to the chat once. A second deliver is refused with `already-delivered`. A send that fails after it may have reached the chat, or that outlasts its 25-second deadline, counts as delivered (`send-uncertain`), so a retry never sends the person the same letter twice. A send that never reached the chat (`send-failed`) leaves the letter waiting. A letter whose expiry has passed isn't delivered. When the person has never messaged the agent from that handle, the refusal says so."
23
+ ]
24
+ },
12
25
  {
13
26
  "version": "0.1.0-alpha.1628",
14
27
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1630",
2
+ "runtimeVersion": "0.1.0-alpha.1632",
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.1630</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1632</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -38,6 +38,7 @@ const node_crypto_1 = require("node:crypto");
38
38
  const readline = __importStar(require("node:readline"));
39
39
  const frontend_socket_client_1 = require("../heart/frontend-socket-client");
40
40
  const runtime_1 = require("../nerves/runtime");
41
+ const bundle_manifest_1 = require("../mind/bundle-manifest");
41
42
  const SESSION_ID = /^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/;
42
43
  class AcpProtocolError extends Error {
43
44
  code;
@@ -77,6 +78,7 @@ function createAcpServer(options) {
77
78
  for (const prompt of activePrompts.values())
78
79
  prompt.reject(failure);
79
80
  pendingOutbound.clear();
81
+ toolCalls.clear();
80
82
  });
81
83
  return value;
82
84
  });
@@ -110,6 +112,28 @@ function createAcpServer(options) {
110
112
  },
111
113
  });
112
114
  }
115
+ const toolCalls = new Map();
116
+ function startToolCall(sessionId, turnId, name) {
117
+ const turns = toolCalls.get(sessionId) ?? new Map();
118
+ const turn = turns.get(turnId) ?? new Map();
119
+ const calls = turn.get(name) ?? { started: 0, open: [] };
120
+ calls.started += 1;
121
+ const toolCallId = `${turnId}:${name}:${calls.started}`;
122
+ calls.open.push(toolCallId);
123
+ turn.set(name, calls);
124
+ turns.set(turnId, turn);
125
+ toolCalls.set(sessionId, turns);
126
+ return toolCallId;
127
+ }
128
+ function finishToolCall(sessionId, turnId, name) {
129
+ return toolCalls.get(sessionId)?.get(turnId)?.get(name)?.open.shift();
130
+ }
131
+ function forgetTurnToolCalls(sessionId, turnId) {
132
+ const turns = toolCalls.get(sessionId);
133
+ turns?.delete(turnId);
134
+ if (turns?.size === 0)
135
+ toolCalls.delete(sessionId);
136
+ }
113
137
  function replayEvent(sessionId, event) {
114
138
  const data = event.data ?? {};
115
139
  if (event.type === "user_message" && typeof data.text === "string") {
@@ -129,20 +153,36 @@ function createAcpServer(options) {
129
153
  else if (event.type === "tool_started") {
130
154
  sessionUpdate(sessionId, {
131
155
  sessionUpdate: "tool_call",
132
- toolCallId: `${event.turnId}:${String(data.name ?? "tool")}`,
156
+ toolCallId: startToolCall(sessionId, String(event.turnId), String(data.name ?? "tool")),
133
157
  title: String(data.name ?? "tool"),
134
158
  status: "pending",
135
159
  rawInput: data.args ?? {},
136
160
  });
137
161
  }
138
162
  else if (event.type === "tool_completed") {
163
+ const name = String(data.name ?? "tool");
164
+ const toolCallId = finishToolCall(sessionId, String(event.turnId), name);
165
+ if (!toolCallId) {
166
+ // An ACP update must name a call the client was shown; this completion has none to close.
167
+ (0, runtime_1.emitNervesEvent)({
168
+ level: "warn",
169
+ component: "senses",
170
+ event: "senses.acp_tool_completion_unmatched",
171
+ message: "ACP tool completion had no open call to close",
172
+ meta: { sessionId, turnId: String(event.turnId), tool: name },
173
+ });
174
+ return;
175
+ }
139
176
  sessionUpdate(sessionId, {
140
177
  sessionUpdate: "tool_call_update",
141
- toolCallId: `${event.turnId}:${String(data.name ?? "tool")}`,
178
+ toolCallId,
142
179
  status: data.success === false ? "failed" : "completed",
143
180
  content: [{ type: "content", content: { type: "text", text: String(data.summary ?? "") } }],
144
181
  });
145
182
  }
183
+ else if (event.type === "turn_completed" || event.type === "turn_cancelled" || event.type === "turn_failed") {
184
+ forgetTurnToolCalls(sessionId, String(event.turnId));
185
+ }
146
186
  else if (event.type === "structured_output") {
147
187
  const output = data.output;
148
188
  sessionUpdate(sessionId, {
@@ -159,6 +199,9 @@ function createAcpServer(options) {
159
199
  return;
160
200
  const turnId = typeof event.turnId === "string" ? event.turnId : "";
161
201
  const active = activePrompts.get(sessionId);
202
+ if (event.event === "turn.completed" || event.event === "turn.cancelled" || event.event === "turn.failed") {
203
+ replayEvent(sessionId, { type: event.event.replace(".", "_"), turnId });
204
+ }
162
205
  if (event.event === "text.delta" && typeof event.text === "string") {
163
206
  sessionUpdate(sessionId, {
164
207
  sessionUpdate: "agent_message_chunk",
@@ -244,7 +287,12 @@ function createAcpServer(options) {
244
287
  return;
245
288
  if (requestParams.protocolVersion !== 1)
246
289
  throw new AcpProtocolError(-32602, "protocolVersion must be 1");
247
- result(id, { protocolVersion: 1 });
290
+ result(id, {
291
+ protocolVersion: 1,
292
+ // Clients only reopen a saved chat when loading is advertised; observe-only mode refuses it.
293
+ agentCapabilities: { loadSession: !options.disableTools },
294
+ agentInfo: { name: "ouro", title: "Ouro", version: (0, bundle_manifest_1.getPackageVersion)() },
295
+ });
248
296
  return;
249
297
  }
250
298
  if (method === "session/new") {
@@ -269,19 +317,35 @@ function createAcpServer(options) {
269
317
  }
270
318
  const sessionId = requiredString(requestParams.sessionId, "sessionId");
271
319
  const frontend = await client();
272
- const replay = await frontend.request("session.load", {
273
- agent: options.agent,
274
- friendId: options.friendId,
275
- sessionKey: sessionId,
276
- afterSequence: 0,
277
- });
278
- if (!Array.isArray(replay?.events) || replay.events.length === 0) {
279
- throw new AcpProtocolError(-32001, "session not found");
320
+ // The journal answers in pages of up to 1,000 events; read every page so the newest turns show.
321
+ const events = [];
322
+ let pendingPermissions = [];
323
+ let afterSequence = 0;
324
+ for (;;) {
325
+ const page = await frontend.request("session.load", {
326
+ agent: options.agent,
327
+ friendId: options.friendId,
328
+ sessionKey: sessionId,
329
+ afterSequence,
330
+ });
331
+ const pageEvents = Array.isArray(page?.events) ? page.events : [];
332
+ events.push(...pageEvents);
333
+ pendingPermissions = page?.pendingPermissions ?? [];
334
+ const last = pageEvents.at(-1)?.sequence;
335
+ if (page?.hasMore !== true || typeof last !== "number" || last <= afterSequence)
336
+ break;
337
+ afterSequence = last;
280
338
  }
281
- for (const event of replay.events)
339
+ // -32002 is ACP's resource-not-found code; clients start a new session for an unsaved chat on it.
340
+ if (events.length === 0)
341
+ throw new AcpProtocolError(-32002, "session not found");
342
+ // The replay rebuilds which calls are open; counters from an earlier load, or live events that
343
+ // arrived while this load was pending (the journal holds them too), would misnumber them.
344
+ toolCalls.delete(sessionId);
345
+ for (const event of events)
282
346
  replayEvent(sessionId, event);
283
347
  await subscribe(sessionId);
284
- for (const pending of replay.pendingPermissions ?? [])
348
+ for (const pending of pendingPermissions)
285
349
  permissionRequest(sessionId, pending);
286
350
  result(id, {});
287
351
  return;
@@ -343,7 +407,8 @@ function createAcpServer(options) {
343
407
  }
344
408
  catch (caught) {
345
409
  const id = request.id ?? null;
346
- const code = caught instanceof AcpProtocolError ? caught.code : -32000;
410
+ // ACP reserves -32000 for "authentication required", so an internal failure is JSON-RPC's -32603.
411
+ const code = caught instanceof AcpProtocolError ? caught.code : -32603;
347
412
  error(id, code, caught instanceof Error ? caught.message : String(caught));
348
413
  }
349
414
  }
@@ -380,6 +445,7 @@ function createAcpServer(options) {
380
445
  prompt.reject(new Error("ACP server stopped"));
381
446
  activePrompts.clear();
382
447
  pendingOutbound.clear();
448
+ toolCalls.clear();
383
449
  sessions.clear();
384
450
  },
385
451
  };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1630",
3
+ "version": "0.1.0-alpha.1632",
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.1630",
9
+ "version": "0.1.0-alpha.1632",
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.1630",
3
+ "version": "0.1.0-alpha.1632",
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": {