@ouro.bot/cli 0.1.0-alpha.522 → 0.1.0-alpha.524

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 (30) hide show
  1. package/README.md +1 -1
  2. package/changelog.json +16 -0
  3. package/dist/heart/daemon/cli-exec.js +10 -10
  4. package/dist/heart/daemon/cli-help.js +5 -0
  5. package/dist/heart/daemon/cli-parse.js +1 -1
  6. package/dist/heart/daemon/cli-render.js +6 -2
  7. package/dist/heart/daemon/daemon-entry.js +26 -12
  8. package/dist/heart/daemon/daemon.js +33 -27
  9. package/dist/heart/{outlook/outlook-http-hooks.js → mailbox/mailbox-http-hooks.js} +23 -23
  10. package/dist/heart/{outlook/outlook-http-routes.js → mailbox/mailbox-http-routes.js} +45 -43
  11. package/dist/heart/{outlook/outlook-http-static.js → mailbox/mailbox-http-static.js} +13 -13
  12. package/dist/heart/{outlook/outlook-http-transport.js → mailbox/mailbox-http-transport.js} +1 -1
  13. package/dist/heart/{outlook/outlook-http.js → mailbox/mailbox-http.js} +15 -15
  14. package/dist/heart/{outlook/outlook-read.js → mailbox/mailbox-read.js} +4 -4
  15. package/dist/heart/{outlook/outlook-types.js → mailbox/mailbox-types.js} +9 -9
  16. package/dist/heart/{outlook/outlook-view.js → mailbox/mailbox-view.js} +11 -11
  17. package/dist/heart/{outlook → mailbox}/readers/agent-machine.js +10 -10
  18. package/dist/heart/{outlook → mailbox}/readers/continuity-readers.js +18 -16
  19. package/dist/heart/{outlook → mailbox}/readers/mail.js +11 -11
  20. package/dist/heart/{outlook → mailbox}/readers/runtime-readers.js +6 -5
  21. package/dist/heart/{outlook → mailbox}/readers/sessions.js +2 -2
  22. package/dist/heart/{outlook → mailbox}/readers/shared.js +2 -2
  23. package/dist/nerves/coverage/file-completeness.js +10 -10
  24. package/dist/senses/bluebubbles/index.js +15 -7
  25. package/dist/senses/cli/ouro-tui.js +1 -1
  26. package/package.json +4 -4
  27. /package/dist/heart/{outlook/outlook-http-response.js → mailbox/mailbox-http-response.js} +0 -0
  28. /package/dist/{outlook-ui → mailbox-ui}/assets/index-BPr5vNuM.css +0 -0
  29. /package/dist/{outlook-ui → mailbox-ui}/assets/index-Cm51CY9W.js +0 -0
  30. /package/dist/{outlook-ui → mailbox-ui}/index.html +0 -0
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.readOutlookContinuity = readOutlookContinuity;
36
+ exports.readMailboxContinuity = readMailboxContinuity;
37
37
  exports.readOrientationView = readOrientationView;
38
38
  exports.readObligationDetailView = readObligationDetailView;
39
39
  exports.readChangesView = readChangesView;
@@ -72,15 +72,15 @@ function sortOpenObligations(obligations) {
72
72
  })
73
73
  .map((entry) => entry.obligation);
74
74
  }
75
- function readOutlookContinuity(agentRoot, agentName) {
75
+ function readMailboxContinuity(agentRoot, agentName) {
76
76
  const self = (0, presence_1.readPresence)(agentRoot, agentName);
77
77
  const peers = (0, presence_1.readPeerPresence)(agentRoot);
78
78
  const cares = (0, cares_1.readActiveCares)(agentRoot);
79
79
  const episodes = (0, episodes_1.readRecentEpisodes)(agentRoot, { limit: 10 });
80
80
  (0, runtime_1.emitNervesEvent)({
81
81
  component: "heart",
82
- event: "heart.outlook_continuity_read",
83
- message: `outlook continuity: ${cares.length} cares, ${episodes.length} episodes`,
82
+ event: "heart.mailbox_continuity_read",
83
+ message: `mailbox continuity: ${cares.length} cares, ${episodes.length} episodes`,
84
84
  meta: { careCount: cares.length, episodeCount: episodes.length, hasSelf: self != null, peerCount: peers.length },
85
85
  });
86
86
  return {
@@ -162,8 +162,8 @@ function readOrientationView(agentRoot, agentName) {
162
162
  : null;
163
163
  (0, runtime_1.emitNervesEvent)({
164
164
  component: "heart",
165
- event: "heart.outlook_orientation_read",
166
- message: `outlook orientation: ${openObligations.length} obligations, ${sessions.length} sessions`,
165
+ event: "heart.mailbox_orientation_read",
166
+ message: `mailbox orientation: ${openObligations.length} obligations, ${sessions.length} sessions`,
167
167
  meta: { obligationCount: openObligations.length, sessionCount: sessions.length, primaryId: primary?.id ?? null },
168
168
  });
169
169
  return {
@@ -211,8 +211,8 @@ function readObligationDetailView(agentRoot) {
211
211
  }
212
212
  (0, runtime_1.emitNervesEvent)({
213
213
  component: "heart",
214
- event: "heart.outlook_obligations_read",
215
- message: `outlook obligations: ${openObligations.length} open`,
214
+ event: "heart.mailbox_obligations_read",
215
+ message: `mailbox obligations: ${openObligations.length} open`,
216
216
  meta: { openCount: openObligations.length, primaryId: primary?.id ?? null },
217
217
  });
218
218
  return {
@@ -223,10 +223,11 @@ function readObligationDetailView(agentRoot) {
223
223
  };
224
224
  }
225
225
  function readChangesView(agentRoot) {
226
- const snapshotPath = path.join(agentRoot, "state", "outlook", "active-work-snapshot.json");
226
+ const snapshotPath = path.join(agentRoot, "state", "mailbox", "active-work-snapshot.json");
227
+ const legacySnapshotPath = path.join(agentRoot, "state", "outlook", "active-work-snapshot.json");
227
228
  let previous = null;
228
229
  try {
229
- const raw = fs.readFileSync(snapshotPath, "utf-8");
230
+ const raw = fs.readFileSync(fs.existsSync(snapshotPath) ? snapshotPath : legacySnapshotPath, "utf-8");
230
231
  previous = JSON.parse(raw);
231
232
  if (!previous.obligationSnapshots || !previous.codingSnapshots)
232
233
  previous = null;
@@ -266,8 +267,8 @@ function readChangesView(agentRoot) {
266
267
  const formatted = (0, active_work_1.formatActiveWorkChanges)(changes);
267
268
  (0, runtime_1.emitNervesEvent)({
268
269
  component: "heart",
269
- event: "heart.outlook_changes_read",
270
- message: `outlook changes: ${changes.length} detected`,
270
+ event: "heart.mailbox_changes_read",
271
+ message: `mailbox changes: ${changes.length} detected`,
271
272
  meta: { changeCount: changes.length, snapshotAge: previous.timestamp },
272
273
  });
273
274
  return {
@@ -298,8 +299,8 @@ function readSelfFixView(agentRoot) {
298
299
  const activeStep = steps.find((s) => s.status === "active");
299
300
  (0, runtime_1.emitNervesEvent)({
300
301
  component: "heart",
301
- event: "heart.outlook_selffix_read",
302
- message: `outlook self-fix: ${selfFixTasks.length} tasks`,
302
+ event: "heart.mailbox_selffix_read",
303
+ message: `mailbox self-fix: ${selfFixTasks.length} tasks`,
303
304
  meta: { taskCount: selfFixTasks.length, active: !!activeStep },
304
305
  });
305
306
  return {
@@ -309,10 +310,11 @@ function readSelfFixView(agentRoot) {
309
310
  };
310
311
  }
311
312
  function readNoteDecisionView(agentRoot, limit = 50) {
312
- const logPath = path.join(agentRoot, "state", "outlook", "note-decisions.jsonl");
313
+ const logPath = path.join(agentRoot, "state", "mailbox", "note-decisions.jsonl");
314
+ const legacyLogPath = path.join(agentRoot, "state", "outlook", "note-decisions.jsonl");
313
315
  let lines = [];
314
316
  try {
315
- const raw = fs.readFileSync(logPath, "utf-8");
317
+ const raw = fs.readFileSync(fs.existsSync(logPath) ? logPath : legacyLogPath, "utf-8");
316
318
  lines = raw.split("\n").filter((l) => l.trim().length > 0);
317
319
  }
318
320
  catch {
@@ -6,9 +6,9 @@ const runtime_1 = require("../../../nerves/runtime");
6
6
  const file_store_1 = require("../../../mailroom/file-store");
7
7
  const reader_1 = require("../../../mailroom/reader");
8
8
  const core_1 = require("../../../mailroom/core");
9
- const OUTLOOK_MAIL_LIST_LIMIT = 50;
10
- const OUTLOOK_MAIL_SUMMARY_LIMIT = OUTLOOK_MAIL_LIST_LIMIT;
11
- const OUTLOOK_MAIL_BODY_LIMIT = 12_000;
9
+ const MAILBOX_MAIL_LIST_LIMIT = 50;
10
+ const MAILBOX_MAIL_SUMMARY_LIMIT = MAILBOX_MAIL_LIST_LIMIT;
11
+ const MAILBOX_MAIL_BODY_LIMIT = 12_000;
12
12
  function emptyFolders() {
13
13
  return [
14
14
  { id: "imbox", label: "Imbox", count: 0 },
@@ -246,7 +246,7 @@ function accessProvenance(message) {
246
246
  function emitMailRead(agentName, mode, status) {
247
247
  (0, runtime_1.emitNervesEvent)({
248
248
  component: "heart",
249
- event: "heart.outlook_mail_read",
249
+ event: "heart.mailbox_mail_read",
250
250
  message: "reading Mailbox mail surface",
251
251
  meta: { agentName, mode, status },
252
252
  });
@@ -262,7 +262,7 @@ async function readMailView(agentName) {
262
262
  return unavailableMailView(agentName, status, resolved.error);
263
263
  }
264
264
  try {
265
- const stored = await resolved.store.listMessages({ agentId: agentName, limit: OUTLOOK_MAIL_SUMMARY_LIMIT });
265
+ const stored = await resolved.store.listMessages({ agentId: agentName, limit: MAILBOX_MAIL_SUMMARY_LIMIT });
266
266
  const result = decryptVisibleMessages(stored, resolved.config.privateKeys);
267
267
  const summaries = result.decrypted.map(mailSummary);
268
268
  const screener = (await resolved.store.listScreenerCandidates({ agentId: agentName, status: "pending", limit: 100 }))
@@ -270,7 +270,7 @@ async function readMailView(agentName) {
270
270
  const outbound = (await resolved.store.listMailOutbound(agentName)).map(outboundRecord);
271
271
  await resolved.store.recordAccess({
272
272
  agentId: agentName,
273
- tool: "outlook_mail_list",
273
+ tool: "mailbox_mail_list",
274
274
  reason: "mailbox read-only mailbox",
275
275
  });
276
276
  const accessLog = accessEntries(await resolved.store.listAccessLog(agentName));
@@ -285,7 +285,7 @@ async function readMailView(agentName) {
285
285
  label: resolved.storeLabel,
286
286
  },
287
287
  folders: buildFolders(summaries, outbound),
288
- messages: summaries.slice(0, OUTLOOK_MAIL_LIST_LIMIT),
288
+ messages: summaries.slice(0, MAILBOX_MAIL_LIST_LIMIT),
289
289
  screener,
290
290
  outbound,
291
291
  recovery: buildRecovery(summaries, result.skipped),
@@ -324,18 +324,18 @@ async function readMailMessageView(agentName, messageId) {
324
324
  const access = await resolved.store.recordAccess({
325
325
  agentId: agentName,
326
326
  messageId,
327
- tool: "outlook_mail_message",
327
+ tool: "mailbox_mail_message",
328
328
  reason: "mailbox read-only message body",
329
329
  ...accessProvenance(decrypted),
330
330
  });
331
- const body = decrypted.private.text.length > OUTLOOK_MAIL_BODY_LIMIT
332
- ? decrypted.private.text.slice(0, OUTLOOK_MAIL_BODY_LIMIT)
331
+ const body = decrypted.private.text.length > MAILBOX_MAIL_BODY_LIMIT
332
+ ? decrypted.private.text.slice(0, MAILBOX_MAIL_BODY_LIMIT)
333
333
  : decrypted.private.text;
334
334
  const detail = {
335
335
  ...mailSummary(decrypted),
336
336
  text: body,
337
337
  htmlAvailable: typeof decrypted.private.html === "string" && decrypted.private.html.length > 0,
338
- bodyTruncated: decrypted.private.text.length > OUTLOOK_MAIL_BODY_LIMIT,
338
+ bodyTruncated: decrypted.private.text.length > MAILBOX_MAIL_BODY_LIMIT,
339
339
  attachments: decrypted.private.attachments,
340
340
  access: {
341
341
  tool: access.tool,
@@ -196,8 +196,8 @@ function readAttentionView(agentName, options = {}) {
196
196
  const returnObligations = (0, agent_machine_1.readObligationSummary)(agentRoot).items;
197
197
  (0, runtime_1.emitNervesEvent)({
198
198
  component: "heart",
199
- event: "heart.outlook_attention_read",
200
- message: "reading outlook attention queue",
199
+ event: "heart.mailbox_attention_read",
200
+ message: "reading mailbox attention queue",
201
201
  meta: { agentName, queueLength: queueItems.length, pendingChannelCount: pendingChannels.length },
202
202
  });
203
203
  return {
@@ -274,7 +274,7 @@ function readDaemonHealthDeep(healthPath) {
274
274
  // Layer 1: tighten the parse so only post-Layer-1 vocabulary
275
275
  // carries through. Stale cached files that still hold legacy
276
276
  // string values like "ok" or "running" — written by an older
277
- // daemon binary — fall back to "unknown" so downstream Outlook
277
+ // daemon binary — fall back to "unknown" so downstream Mailbox
278
278
  // consumers can detect the unparseable case explicitly.
279
279
  status: (0, daemon_health_1.isDaemonStatus)(health.status) ? health.status : "unknown",
280
280
  mode: typeof health.mode === "string" ? health.mode : "unknown",
@@ -596,7 +596,8 @@ function readNeedsMeView(agentName, options = {}) {
596
596
  }
597
597
  /* v8 ignore start — defensive JSON parsing in desk prefs reader */
598
598
  function readDeskPrefs(agentRoot) {
599
- const prefsPath = path.join(agentRoot, "state", "outlook-prefs.json");
599
+ const prefsPath = path.join(agentRoot, "state", "mailbox-prefs.json");
600
+ const legacyPrefsPath = path.join(agentRoot, "state", "outlook-prefs.json");
600
601
  const defaults = {
601
602
  carrying: null,
602
603
  statusLine: null,
@@ -606,7 +607,7 @@ function readDeskPrefs(agentRoot) {
606
607
  dismissedObligations: [],
607
608
  };
608
609
  try {
609
- const raw = fs.readFileSync(prefsPath, "utf-8");
610
+ const raw = fs.readFileSync(fs.existsSync(prefsPath) ? prefsPath : legacyPrefsPath, "utf-8");
610
611
  const parsed = JSON.parse(raw);
611
612
  return {
612
613
  carrying: typeof parsed.carrying === "string" ? parsed.carrying : null,
@@ -195,8 +195,8 @@ function readSessionInventory(agentName, options = {}) {
195
195
  const activeCount = items.filter((item) => Date.parse(item.lastActivityAt) >= ageThreshold).length;
196
196
  (0, runtime_1.emitNervesEvent)({
197
197
  component: "heart",
198
- event: "heart.outlook_sessions_read",
199
- message: "reading outlook session inventory",
198
+ event: "heart.mailbox_sessions_read",
199
+ message: "reading mailbox session inventory",
200
200
  meta: { agentName, totalCount: items.length, activeCount },
201
201
  });
202
202
  return {
@@ -103,8 +103,8 @@ function truncateExcerpt(content, maxLength = 200) {
103
103
  function readSessionEnvelope(sessionPath) {
104
104
  (0, runtime_1.emitNervesEvent)({
105
105
  component: "heart",
106
- event: "heart.outlook_session_envelope_read",
107
- message: "reading outlook session envelope",
106
+ event: "heart.mailbox_session_envelope_read",
107
+ message: "reading mailbox session envelope",
108
108
  meta: { sessionPath },
109
109
  });
110
110
  return (0, session_events_1.loadSessionEnvelopeFile)(sessionPath);
@@ -109,10 +109,10 @@ const DISPATCH_EXEMPT_PATTERNS = [
109
109
  "heart/attachments/originals",
110
110
  "heart/attachments/sources/index",
111
111
  "heart/attachments/sources/cli-local-file",
112
- // Browser-safe Outlook contract helpers: shared types/formatting helpers
113
- // consumed by server readers and the UI. Outlook read/render modules own
112
+ // Browser-safe Mailbox contract helpers: shared types/formatting helpers
113
+ // consumed by server readers and the UI. Mailbox read/render modules own
114
114
  // the observability for these projections.
115
- "heart/outlook/outlook-types",
115
+ "heart/mailbox/mailbox-types",
116
116
  // Mail search relevance scorer: pure heuristic function (regex + counter
117
117
  // arithmetic). The caller (search-cache.ts searchMailSearchCache) owns
118
118
  // observability via senses.mail_search_cache_upserted and friends.
@@ -124,13 +124,13 @@ const DISPATCH_EXEMPT_PATTERNS = [
124
124
  // hashing. The caller (trips/store.ts) owns observability via
125
125
  // trips.ledger_created and trips.evidence_attached.
126
126
  "trips/core",
127
- // Outlook HTTP helper modules: route/static/transport/hook seams are
128
- // dispatched by outlook-http.ts, whose server lifecycle owns observability.
129
- "heart/outlook/outlook-http-transport",
130
- "heart/outlook/outlook-http-static",
131
- "heart/outlook/outlook-http-hooks",
132
- "heart/outlook/outlook-http-routes",
133
- "heart/outlook/outlook-http-response",
127
+ // Mailbox HTTP helper modules: route/static/transport/hook seams are
128
+ // dispatched by mailbox-http.ts, whose server lifecycle owns observability.
129
+ "heart/mailbox/mailbox-http-transport",
130
+ "heart/mailbox/mailbox-http-static",
131
+ "heart/mailbox/mailbox-http-hooks",
132
+ "heart/mailbox/mailbox-http-routes",
133
+ "heart/mailbox/mailbox-http-response",
134
134
  // Session playback: read-only debugging CLI for sanitize-pipeline replay.
135
135
  // No side effects on the runtime; output is human-readable diagnostics only.
136
136
  "heart/session-playback-cli-main",
@@ -1203,21 +1203,29 @@ async function syncBlueBubblesRuntime(deps = {}) {
1203
1203
  await client.checkHealth();
1204
1204
  const capturedPending = countPendingCapturedInboundMessages(agentName);
1205
1205
  const recoveryPending = countPendingRecoveryCandidates(agentName);
1206
+ (0, runtime_state_1.writeBlueBubblesRuntimeState)(agentName, {
1207
+ upstreamStatus: "ok",
1208
+ detail: "upstream reachable; recovery pass running",
1209
+ lastCheckedAt: checkedAt,
1210
+ pendingRecoveryCount: capturedPending + recoveryPending,
1211
+ lastRecoveredAt: previousState.lastRecoveredAt,
1212
+ lastRecoveredMessageGuid: previousState.lastRecoveredMessageGuid,
1213
+ });
1206
1214
  const catchUp = await catchUpMissedBlueBubblesMessages(resolvedDeps, previousState, {
1207
1215
  processTurns: false,
1208
1216
  });
1209
1217
  const failed = catchUp.failed;
1210
1218
  const queued = capturedPending + recoveryPending + (catchUp.queued ?? 0);
1211
- // upstreamStatus reflects whether BlueBubbles itself is healthy and we
1212
- // have unprocessed work (pendingRecoveryCount). Per-cycle recovery
1213
- // failures are noted in `detail` for transparency but do NOT flip the
1214
- // status to error: a single permanently-unrecoverable message would
1215
- // otherwise stick the sense in "error" forever, contradicting `ouro
1219
+ // upstreamStatus reflects whether BlueBubbles itself is healthy and
1220
+ // whether the local bridge can answer webhook traffic. Queued recovery work
1221
+ // and per-cycle failures are noted in `detail` for transparency but do NOT
1222
+ // flip the status to error: a single permanently-unrecoverable message
1223
+ // would otherwise stick the sense in "error" forever, contradicting `ouro
1216
1224
  // doctor` which only checks upstream reachability.
1217
1225
  (0, runtime_state_1.writeBlueBubblesRuntimeState)(agentName, {
1218
- upstreamStatus: queued > 0 ? "error" : "ok",
1226
+ upstreamStatus: "ok",
1219
1227
  detail: queued > 0
1220
- ? `pending recovery: ${queued}`
1228
+ ? `upstream reachable; ${queued} recovery item(s) queued`
1221
1229
  : failed > 0
1222
1230
  ? `${failed} message(s) unrecoverable this cycle; upstream ok`
1223
1231
  : "upstream reachable",
@@ -22,7 +22,7 @@ const kill_ring_1 = require("./kill-ring");
22
22
  const input_keys_1 = require("./input-keys");
23
23
  const image_ref_navigation_1 = require("./image-ref-navigation");
24
24
  // ─── Ouroboros Brand Palette (ANSI RGB) ─────────────────────────────
25
- // From packages/outlook-ui/src/style.css and ouroboros.bot
25
+ // From packages/mailbox-ui/src/style.css and ouroboros.bot
26
26
  const OURO = {
27
27
  scale: "#2f8f4e", // primary green
28
28
  teal: "#4ec9b0", // tool/accent teal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.522",
3
+ "version": "0.1.0-alpha.524",
4
4
  "main": "dist/heart/daemon/ouro-entry.js",
5
5
  "bin": {
6
6
  "cli": "dist/heart/daemon/ouro-bot-entry.js",
@@ -30,11 +30,11 @@
30
30
  "test:integration": "npm run build && vitest run --config vitest.integration.config.ts",
31
31
  "test:e2e:package": "npm run build && node scripts/package-e2e.cjs",
32
32
  "test:e2e:real-smoke": "npm run build && node scripts/nightly-real-smoke.cjs",
33
- "typecheck:outlook-ui": "tsc --noEmit -p packages/outlook-ui/tsconfig.json",
34
- "test:outlook-ui": "npm test --prefix packages/outlook-ui",
33
+ "typecheck:mailbox-ui": "tsc --noEmit -p packages/mailbox-ui/tsconfig.json",
34
+ "test:mailbox-ui": "npm test --prefix packages/mailbox-ui",
35
35
  "test:coverage:vitest": "vitest run --coverage",
36
36
  "test:coverage": "node scripts/run-coverage-gate.cjs",
37
- "build": "tsc && (cd packages/outlook-ui && npm install --ignore-scripts 2>/dev/null && npm run build && cd ../.. && node scripts/copy-outlook-ui.cjs) || echo 'outlook-ui build skipped'",
37
+ "build": "tsc && (cd packages/mailbox-ui && npm install --ignore-scripts 2>/dev/null && npm run build && cd ../.. && node scripts/copy-mailbox-ui.cjs) || echo 'mailbox-ui build skipped'",
38
38
  "lint": "eslint src/",
39
39
  "release:preflight": "node scripts/release-preflight.cjs",
40
40
  "release:smoke": "node scripts/release-smoke.cjs",
File without changes