@ouro.bot/cli 0.1.0-alpha.1162 → 0.1.0-alpha.1165

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/README.md CHANGED
@@ -22,6 +22,7 @@ npx ouro.bot@latest up # install the ouro command and start the daemon
22
22
  - **You talk to it where you already are:** the terminal, Teams, iMessage, mail or a voice call.
23
23
  - **It remembers.** Notes, people and promises live in the agent's own bundle and vault, so tomorrow it knows what you agreed today.
24
24
  - **It does the work.** Real tools: files, shell, GitHub, Microsoft Graph, and coding agents it can hand work to. [Shepherd](https://ouroboros.bot/#shepherd) keeps those coding agents moving, and [Butler](https://ouroboros.bot/butler/) looks after a home server.
25
+ - **Its errors go back to it, not to you.** If the model provider turns a request down or a tool call comes back broken, the agent hears what went wrong, fixes it and replies in the same turn. Only what needs a person, such as a sign-in, a usage limit or an outage, comes to you.
25
26
 
26
27
  `ouro.bot` is the bootstrap wrapper: `npx ouro.bot@latest` installs `@ouro.bot/cli`, which gives you the `ouro` command.
27
28
 
package/changelog.json CHANGED
@@ -1,6 +1,18 @@
1
1
  {
2
2
  "_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.1165",
6
+ "changes": [
7
+ "A message the agent sends into a conversation while one of its turns is running there (a proactive notice, a send_message, a Shepherd notice) now goes into that conversation's history as soon as the turn ends, under the turn's own lease, instead of waiting for the friend's next message or the agent's next send, and it carries the time it was really sent. On 2026-11-16 a 07:49 notice sent during a Teams turn was kept but only written in at 08:19, stamped 08:19."
8
+ ]
9
+ },
10
+ {
11
+ "version": "0.1.0-alpha.1163",
12
+ "changes": [
13
+ "The Copilot app sense's succession record (successions.json) keeps only the sessions the sidebar lists, plus a successor that has left it while the session it succeeds is still listed, instead of every session ever seen (8,269 entries on the Mac mini), and reads no history of a session the app no longer lists. isHandedOff and handoffSuccessors read the record the sense refreshes each minute."
14
+ ]
15
+ },
4
16
  {
5
17
  "version": "0.1.0-alpha.1162",
6
18
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1162",
2
+ "runtimeVersion": "0.1.0-alpha.1165",
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.1162</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1165</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -1572,7 +1572,9 @@ function buildCanonicalSessionEnvelope(options) {
1572
1572
  envelope.structuredOutputs = (0, structured_output_1.extractStructuredOutputsFromEvents)(providerProjectionEvents(envelope));
1573
1573
  return { envelope, evictedEvents };
1574
1574
  }
1575
- function appendSyntheticAssistantEvent(envelope, content, recordedAt, outbound) {
1575
+ function appendSyntheticAssistantEvent(envelope, content, recordedAt, outbound,
1576
+ /** When the message was really sent, when that is earlier than now: a record that waited out another turn. */
1577
+ sentAt) {
1576
1578
  // Use nextEventSequence(events) instead of `events.length + 1` so any gap
1577
1579
  // (from pruning, archive replay, or self-heal dedup) cannot collide with
1578
1580
  // an existing event id. Same fix pattern as line 1046.
@@ -1580,6 +1582,8 @@ function appendSyntheticAssistantEvent(envelope, content, recordedAt, outbound)
1580
1582
  const event = buildEventFromMessage({ role: "assistant", content }, sequence, recordedAt, "synthetic", null, null);
1581
1583
  if (outbound)
1582
1584
  event.provenance = { ...event.provenance, outbound: { origin: outbound.origin, deliveryId: outbound.deliveryId } };
1585
+ if (sentAt)
1586
+ event.time = { ...event.time, authoredAt: sentAt, observedAt: sentAt };
1583
1587
  const priorIds = projectedSessionEventIds(envelope);
1584
1588
  const updated = {
1585
1589
  ...envelope,
@@ -335,7 +335,7 @@ function appendSyntheticAssistantMessage(filePath, content, lease, options = {})
335
335
  const deliveryId = options.outbound?.deliveryId;
336
336
  if (deliveryId && envelope.events.some((event) => event.provenance.outbound?.deliveryId === deliveryId))
337
337
  return true;
338
- const updated = (0, session_events_1.appendSyntheticAssistantEvent)(envelope, content, recordedAt, options.outbound);
338
+ const updated = (0, session_events_1.appendSyntheticAssistantEvent)(envelope, content, recordedAt, options.outbound, options.sentAt);
339
339
  writeSessionEnvelopeUnderLease(filePath, updated, owned);
340
340
  (0, runtime_1.emitNervesEvent)({
341
341
  component: "mind",
@@ -120,7 +120,7 @@ function drainUnderLease(agentRoot, friendId, channel, key, lease) {
120
120
  if (!record) {
121
121
  recordError("skipped an unreadable deferred outbound record", { friendId, channel, file: name });
122
122
  }
123
- else if ((0, context_1.appendSyntheticAssistantMessage)(lease.sessionPath, recordedText(record), lease, { outbound: { origin: record.origin, deliveryId: record.deliveryId }, createIfMissing: true })) {
123
+ else if ((0, context_1.appendSyntheticAssistantMessage)(lease.sessionPath, recordedText(record), lease, { outbound: { origin: record.origin, deliveryId: record.deliveryId }, createIfMissing: true, sentAt: record.recordedAt })) {
124
124
  count += 1;
125
125
  }
126
126
  else {
@@ -152,13 +152,13 @@ function status(row, rows, pending, options, successors) {
152
152
  // ---------- reading ----------
153
153
  async function listSessionsAndChats(options = {}, agentRoot) {
154
154
  const rows = await (0, client_1.listAppSessions)(options);
155
- const successors = agentRoot ? (0, coordinator_1.handoffSuccessors)(agentRoot, options) : undefined;
155
+ const successors = agentRoot ? (0, coordinator_1.handoffSuccessors)(agentRoot) : undefined;
156
156
  return { total: rows.length, items: rows.map(row => item(row, rows, options, successors)) };
157
157
  }
158
158
  async function getSessionsStatus(agentRoot, state, options = {}) {
159
159
  const rows = await (0, client_1.listAppSessions)(options);
160
160
  const pending = (0, store_1.readPending)(agentRoot);
161
- const successors = (0, coordinator_1.handoffSuccessors)(agentRoot, options);
161
+ const successors = (0, coordinator_1.handoffSuccessors)(agentRoot);
162
162
  const count = (keep) => rows.filter(keep).length;
163
163
  return {
164
164
  summary: {
@@ -170,7 +170,7 @@ async function getSessionsStatus(agentRoot, state, options = {}) {
170
170
  }
171
171
  async function getSession(agentRoot, id, options = {}) {
172
172
  const rows = await (0, client_1.listAppSessions)(options);
173
- return status(findSession(rows, id), rows, (0, store_1.readPending)(agentRoot), options, (0, coordinator_1.handoffSuccessors)(agentRoot, options));
173
+ return status(findSession(rows, id), rows, (0, store_1.readPending)(agentRoot), options, (0, coordinator_1.handoffSuccessors)(agentRoot));
174
174
  }
175
175
  // ---------- writing ----------
176
176
  /** Put a message into a session, as its message box does, and wait for the app to accept it (a session that is not loaded loads first). */
@@ -294,7 +294,7 @@ async function archiveSession(agentRoot, id, options = {}, ownerAsked = false) {
294
294
  const made = (0, store_1.readProbes)(agentRoot);
295
295
  let reason = null;
296
296
  if (!made[row.id]) {
297
- reason = ownerAsked ? "owner-asked" : (0, handoff_1.isHandedOff)(agentRoot, row, options) ? "handed-off" : null;
297
+ reason = ownerAsked ? "owner-asked" : (0, handoff_1.isHandedOff)(agentRoot, row) ? "handed-off" : null;
298
298
  if (!reason) {
299
299
  (0, runtime_1.emitNervesEvent)({ level: "warn", component: "senses", event: "senses.app_sessions_archive_declined", message: "declined to archive a session this agent did not create", meta: { session: row.id } });
300
300
  throw new Error(`session ${row.id} was not created by this agent, so it will not archive it unless the owner asked for it or it is oversize and a newer session names it as handed off (yours: ${Object.keys(made).join(", ") || "none"})`);
@@ -21,10 +21,10 @@ const handoff_1 = require("./handoff");
21
21
  */
22
22
  exports.REPORT_SCAN_BYTES = 16 * 1024 * 1024;
23
23
  const SEND_TOOL = /(?:^|-)send_session_message$/;
24
- /** `successorOf` over the hand-offs `handoff.ts` knows, read once, the first time a pass needs one. */
25
- function handoffSuccessors(agentRoot, client) {
24
+ /** `successorOf` over the hand-offs the sense last recorded (`handoff.ts` refreshes them each minute), read once, when first needed. */
25
+ function handoffSuccessors(agentRoot) {
26
26
  let successions = null;
27
- return id => (0, handoff_1.successorOf)(id, (successions ??= (0, handoff_1.refreshSuccessions)(agentRoot, client)));
27
+ return id => (0, handoff_1.successorOf)(id, (successions ??= (0, handoff_1.readSuccessions)(agentRoot)));
28
28
  }
29
29
  const listedAs = (rows, id) => id ? rows.find(row => row.id === id || row.workspaceId === id) : undefined;
30
30
  /** The session ids this lane sent messages to, oldest first, from the end of its history. */
@@ -63,8 +63,6 @@ const FREE_TEXT_OPENING_CHARS = 2_000;
63
63
  const FREE_TEXT_ID_WINDOW = 240;
64
64
  /** How far into a history the first message is looked for, and the most read per pass while waiting for the first turn. */
65
65
  exports.FIRST_MESSAGE_SCAN_BYTES = 1024 * 1024;
66
- /** Histories untouched this long are not read for a first message (an old one cannot hand off a live session). */
67
- const RECENT_MS = 7 * 86_400_000;
68
66
  const stateFile = (agentRoot) => path.join((0, store_1.appSessionsStateDir)(agentRoot), "successions.json");
69
67
  const readSuccessions = (agentRoot) => (0, store_1.readJson)(stateFile(agentRoot), { sessions: {} }).sessions;
70
68
  exports.readSuccessions = readSuccessions;
@@ -93,30 +91,30 @@ function historyIds(client) {
93
91
  return [];
94
92
  }
95
93
  }
96
- /** Read what is new in each recent history, as far as succession needs, and remember it. Returns every succession known. */
97
- function refreshSuccessions(agentRoot, client, now = Date.now()) {
94
+ /**
95
+ * Read what is new in the history of each session the app lists, as far as succession needs, and remember only those,
96
+ * plus each pending succession: one whose successor has left the sidebar while the session it succeeds is still listed,
97
+ * so that session can still be retired. Anything else the app no longer lists drops out, and the record stays the size
98
+ * of the sidebar.
99
+ */
100
+ function refreshSuccessions(agentRoot, client, listed) {
98
101
  const before = (0, exports.readSuccessions)(agentRoot);
102
+ const live = new Set(listed);
99
103
  const ids = historyIds(client);
100
104
  const known = (value) => {
101
105
  const matches = ids.filter(id => id.toLowerCase().startsWith(value));
102
106
  return matches.length === 1 ? matches[0] : null;
103
107
  };
104
108
  const next = {};
105
- for (const id of ids) {
109
+ for (const [id, entry] of Object.entries(before))
110
+ if (!live.has(id) && entry.predecessor && live.has(entry.predecessor))
111
+ next[id] = entry;
112
+ for (const id of live) {
106
113
  const was = before[id];
107
114
  if (was && !was.pending && (!was.predecessor || was.turned)) {
108
115
  next[id] = was;
109
116
  continue;
110
117
  }
111
- let modified;
112
- try {
113
- modified = fs.statSync((0, client_1.eventLogPath)(id, client)).mtimeMs;
114
- }
115
- catch {
116
- continue;
117
- }
118
- if (!was && now - modified > RECENT_MS)
119
- continue;
120
118
  const entry = was ? { ...was } : { predecessor: null, offset: 0, pending: true };
121
119
  let message = null;
122
120
  let turned = false;
@@ -172,13 +170,13 @@ function successorOf(id, successions) {
172
170
  }
173
171
  /**
174
172
  * Whether an oversize session has been handed off: it is in the oversize list, and a newer session's first message
175
- * names it as the session it succeeds.
173
+ * names it as the session it succeeds, as the sense last recorded.
176
174
  */
177
- function isHandedOff(agentRoot, row, options = {}) {
175
+ function isHandedOff(agentRoot, row) {
178
176
  const flagged = (0, store_1.readJson)(path.join((0, store_1.appSessionsStateDir)(agentRoot), "oversize.json"), {}).sessions ?? {};
179
177
  if (!flagged[row.id])
180
178
  return false;
181
- const successor = successorOf(row.id, refreshSuccessions(agentRoot, options));
179
+ const successor = successorOf(row.id, (0, exports.readSuccessions)(agentRoot));
182
180
  if (successor)
183
181
  (0, runtime_1.emitNervesEvent)({ component: "senses", event: "senses.app_sessions_handoff_found", message: "found the successor that a session was handed off to", meta: { session: row.id, successor } });
184
182
  return successor !== null;
@@ -38,7 +38,7 @@ function childrenNote(predecessor, children) {
38
38
  async function retireSessions(agentRoot, rows, deps) {
39
39
  const send = deps.send ?? ((id, text) => (0, app_interface_1.deliverMessage)(id, text, "immediate", deps.client));
40
40
  const archive = deps.archive ?? (async (row, reason, note) => (await (0, app_interface_1.archiveRow)(agentRoot, row, reason, deps.client, { note, keepWorktree: true })).ok === true);
41
- const successions = (0, handoff_1.refreshSuccessions)(agentRoot, deps.client, deps.now);
41
+ const successions = (0, handoff_1.refreshSuccessions)(agentRoot, deps.client, rows.map(row => row.id));
42
42
  const listed = new Map(rows.map(row => [row.id, row]));
43
43
  const childrenOf = (id) => rows.filter(row => recordedCoordinator(row) === id);
44
44
  const busyChildren = (id, except) => childrenOf(id).filter(child => child.id !== except && !(settled(child) || (child.remote && !child.isRunning)));
@@ -186,7 +186,7 @@ async function noticeOversizedSessions(agentRoot, rows, deps) {
186
186
  const big = [...listed.values()].filter(row => next[row.id]);
187
187
  // A coordinator that is itself a giant is only messaged while it runs, since a message would reload it.
188
188
  // The coordinator now, not the one the app recorded: that one may have handed off and been archived.
189
- const successors = (0, coordinator_1.handoffSuccessors)(agentRoot, client);
189
+ const successors = (0, coordinator_1.handoffSuccessors)(agentRoot);
190
190
  const reachable = (lane) => {
191
191
  const found = (0, coordinator_1.coordinatorOf)(lane, rows.filter(row => !row.remote), { client, successorOf: successors });
192
192
  const row = found && "id" in found ? listed.get(found.id) : undefined;