@ouro.bot/cli 0.1.0-alpha.523 → 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.
- package/README.md +1 -1
- package/changelog.json +8 -0
- package/dist/heart/daemon/cli-exec.js +10 -10
- package/dist/heart/daemon/cli-help.js +5 -0
- package/dist/heart/daemon/cli-parse.js +1 -1
- package/dist/heart/daemon/cli-render.js +6 -2
- package/dist/heart/daemon/daemon-entry.js +1 -1
- package/dist/heart/daemon/daemon.js +29 -27
- package/dist/heart/{outlook/outlook-http-hooks.js → mailbox/mailbox-http-hooks.js} +23 -23
- package/dist/heart/{outlook/outlook-http-routes.js → mailbox/mailbox-http-routes.js} +45 -43
- package/dist/heart/{outlook/outlook-http-static.js → mailbox/mailbox-http-static.js} +13 -13
- package/dist/heart/{outlook/outlook-http-transport.js → mailbox/mailbox-http-transport.js} +1 -1
- package/dist/heart/{outlook/outlook-http.js → mailbox/mailbox-http.js} +15 -15
- package/dist/heart/{outlook/outlook-read.js → mailbox/mailbox-read.js} +4 -4
- package/dist/heart/{outlook/outlook-types.js → mailbox/mailbox-types.js} +9 -9
- package/dist/heart/{outlook/outlook-view.js → mailbox/mailbox-view.js} +11 -11
- package/dist/heart/{outlook → mailbox}/readers/agent-machine.js +10 -10
- package/dist/heart/{outlook → mailbox}/readers/continuity-readers.js +18 -16
- package/dist/heart/{outlook → mailbox}/readers/mail.js +11 -11
- package/dist/heart/{outlook → mailbox}/readers/runtime-readers.js +6 -5
- package/dist/heart/{outlook → mailbox}/readers/sessions.js +2 -2
- package/dist/heart/{outlook → mailbox}/readers/shared.js +2 -2
- package/dist/nerves/coverage/file-completeness.js +10 -10
- package/dist/senses/cli/ouro-tui.js +1 -1
- package/package.json +4 -4
- /package/dist/heart/{outlook/outlook-http-response.js → mailbox/mailbox-http-response.js} +0 -0
- /package/dist/{outlook-ui → mailbox-ui}/assets/index-BPr5vNuM.css +0 -0
- /package/dist/{outlook-ui → mailbox-ui}/assets/index-Cm51CY9W.js +0 -0
- /package/dist/{outlook-ui → mailbox-ui}/index.html +0 -0
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ The shared harness lives in `src/`:
|
|
|
41
41
|
- `src/arc/`
|
|
42
42
|
Durable continuity state — obligations, cares, episodes, intentions, presence, and attention types. The agent's sense of ongoing story.
|
|
43
43
|
- `src/heart/`
|
|
44
|
-
Core runtime, provider adapters, daemon, bootstrap, identity, and entrypoints. Organized into topic subdirectories: daemon/ (lifecycle),
|
|
44
|
+
Core runtime, provider adapters, daemon, bootstrap, identity, and entrypoints. Organized into topic subdirectories: daemon/ (lifecycle), mailbox/ (calendar), habits/ (scheduling), hatch/ (agent creation), versioning/ (updates), auth/, mcp/, providers/, bridges/.
|
|
45
45
|
- `src/mind/`
|
|
46
46
|
Prompt assembly, session persistence, bundle manifest enforcement, phrases, formatting, diary, note search, embedding providers, journal, obligation steering, and friend resolution.
|
|
47
47
|
- `src/repertoire/`
|
package/changelog.json
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
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.524",
|
|
6
|
+
"changes": [
|
|
7
|
+
"Completes the human-facing Ouro Mailbox rename by moving the former Outlook source, tests, UI package, build scripts, and package asset checks onto mailbox naming.",
|
|
8
|
+
"Keeps compatibility aliases for `ouro outlook`, legacy `/outlook` API paths, old `outlookUrl` status consumers, and existing Outlook-named local preference/state files during the transition.",
|
|
9
|
+
"Cleans stale legacy Outlook UI package output during Mailbox UI builds so published packages carry the renamed asset tree without leftover old paths."
|
|
10
|
+
]
|
|
11
|
+
},
|
|
4
12
|
{
|
|
5
13
|
"version": "0.1.0-alpha.523",
|
|
6
14
|
"changes": [
|
|
@@ -6251,7 +6251,7 @@ async function runOuroCli(args, deps = (0, cli_defaults_1.createDefaultOuroCliDe
|
|
|
6251
6251
|
deps.writeStdout(message);
|
|
6252
6252
|
return message;
|
|
6253
6253
|
}
|
|
6254
|
-
if (command.kind === "
|
|
6254
|
+
if (command.kind === "mailbox") {
|
|
6255
6255
|
let status;
|
|
6256
6256
|
try {
|
|
6257
6257
|
status = await deps.sendCommand(deps.socketPath, { kind: "daemon.status" });
|
|
@@ -6264,23 +6264,23 @@ async function runOuroCli(args, deps = (0, cli_defaults_1.createDefaultOuroCliDe
|
|
|
6264
6264
|
}
|
|
6265
6265
|
/* v8 ignore stop */
|
|
6266
6266
|
const payload = (0, cli_render_1.parseStatusPayload)(status.data);
|
|
6267
|
-
/* v8 ignore start -- ?? branch:
|
|
6268
|
-
const
|
|
6267
|
+
/* v8 ignore start -- ?? branch: mailboxUrl always present in test fixtures */
|
|
6268
|
+
const mailboxUrl = payload?.overview.mailboxUrl ?? payload?.overview.outlookUrl ?? "unavailable";
|
|
6269
6269
|
/* v8 ignore stop */
|
|
6270
6270
|
if (!command.json) {
|
|
6271
|
-
deps.writeStdout(
|
|
6272
|
-
return
|
|
6271
|
+
deps.writeStdout(mailboxUrl);
|
|
6272
|
+
return mailboxUrl;
|
|
6273
6273
|
}
|
|
6274
|
-
/* v8 ignore start — error path:
|
|
6275
|
-
if (
|
|
6276
|
-
deps.writeStdout(
|
|
6277
|
-
return
|
|
6274
|
+
/* v8 ignore start — error path: mailbox URL not available */
|
|
6275
|
+
if (mailboxUrl === "unavailable") {
|
|
6276
|
+
deps.writeStdout(mailboxUrl);
|
|
6277
|
+
return mailboxUrl;
|
|
6278
6278
|
}
|
|
6279
6279
|
/* v8 ignore stop */
|
|
6280
6280
|
/* v8 ignore start -- ?? branch: tests always inject fetchImpl */
|
|
6281
6281
|
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
6282
6282
|
/* v8 ignore stop */
|
|
6283
|
-
const response = await fetchImpl(`${
|
|
6283
|
+
const response = await fetchImpl(`${mailboxUrl}/api/machine`);
|
|
6284
6284
|
const data = await response.json();
|
|
6285
6285
|
const text = JSON.stringify(data, null, 2);
|
|
6286
6286
|
deps.writeStdout(text);
|
|
@@ -90,6 +90,7 @@ exports.COMMAND_REGISTRY = {
|
|
|
90
90
|
description: "Deprecated alias for `ouro mailbox`",
|
|
91
91
|
usage: "ouro outlook [--json]",
|
|
92
92
|
example: "ouro outlook --json",
|
|
93
|
+
hidden: true,
|
|
93
94
|
},
|
|
94
95
|
whoami: {
|
|
95
96
|
category: "Agents",
|
|
@@ -433,6 +434,8 @@ function suggestCommand(input) {
|
|
|
433
434
|
let bestMatch = null;
|
|
434
435
|
let bestDistance = Infinity;
|
|
435
436
|
for (const name of Object.keys(exports.COMMAND_REGISTRY)) {
|
|
437
|
+
if (exports.COMMAND_REGISTRY[name].hidden)
|
|
438
|
+
continue;
|
|
436
439
|
const distance = levenshteinDistance(input, name);
|
|
437
440
|
if (distance < bestDistance) {
|
|
438
441
|
bestDistance = distance;
|
|
@@ -459,6 +462,8 @@ function getGroupedHelp() {
|
|
|
459
462
|
for (const category of CATEGORY_ORDER) {
|
|
460
463
|
lines.push(` ${category}:`);
|
|
461
464
|
for (const [name, entry] of Object.entries(exports.COMMAND_REGISTRY)) {
|
|
465
|
+
if (entry.hidden)
|
|
466
|
+
continue;
|
|
462
467
|
if (entry.category === category) {
|
|
463
468
|
lines.push(` ${name.padEnd(16)} ${entry.description}`);
|
|
464
469
|
}
|
|
@@ -1459,7 +1459,7 @@ function parseOuroCommand(args) {
|
|
|
1459
1459
|
return { kind: "daemon.logs" };
|
|
1460
1460
|
}
|
|
1461
1461
|
if (head === "mailbox" || head === "outlook")
|
|
1462
|
-
return { kind: "
|
|
1462
|
+
return { kind: "mailbox", ...(args.includes("--json") ? { json: true } : {}) };
|
|
1463
1463
|
if (head === "hatch")
|
|
1464
1464
|
return parseHatchCommand(args.slice(1));
|
|
1465
1465
|
if (head === "auth")
|
|
@@ -92,7 +92,10 @@ function parseStatusPayload(data) {
|
|
|
92
92
|
daemon: stringField(overview.daemon) ?? "unknown",
|
|
93
93
|
health: stringField(overview.health) ?? "unknown",
|
|
94
94
|
socketPath: stringField(overview.socketPath) ?? "unknown",
|
|
95
|
-
|
|
95
|
+
mailboxUrl: stringField(overview.mailboxUrl)
|
|
96
|
+
?? stringField(overview.outlookUrl)
|
|
97
|
+
?? "unavailable",
|
|
98
|
+
outlookUrl: stringField(overview.outlookUrl) ?? undefined,
|
|
96
99
|
version: stringField(overview.version) ?? "unknown",
|
|
97
100
|
lastUpdated: stringField(overview.lastUpdated) ?? "unknown",
|
|
98
101
|
repoRoot: stringField(overview.repoRoot) ?? "unknown",
|
|
@@ -309,7 +312,7 @@ function formatDaemonStatusOutput(response, fallback) {
|
|
|
309
312
|
// ── Key-value overview ──
|
|
310
313
|
const kvLine = (label, value) => ` ${teal(label.padEnd(11))} ${value}`;
|
|
311
314
|
lines.push(kvLine("Socket", ov.socketPath));
|
|
312
|
-
lines.push(kvLine("Mailbox", ov.
|
|
315
|
+
lines.push(kvLine("Mailbox", ov.mailboxUrl));
|
|
313
316
|
lines.push(kvLine("Health", `${statusDot(ov.health)} ${ov.health}`));
|
|
314
317
|
lines.push(kvLine("Updated", ov.lastUpdated));
|
|
315
318
|
lines.push("");
|
|
@@ -456,6 +459,7 @@ function buildStoppedStatusPayload(socketPath, syncRows = [], agentRows = []) {
|
|
|
456
459
|
daemon: "stopped",
|
|
457
460
|
health: "warn",
|
|
458
461
|
socketPath,
|
|
462
|
+
mailboxUrl: "unavailable",
|
|
459
463
|
outlookUrl: "unavailable",
|
|
460
464
|
version: metadata.version,
|
|
461
465
|
lastUpdated: metadata.lastUpdated,
|
|
@@ -199,7 +199,7 @@ function buildDaemonHealthState() {
|
|
|
199
199
|
};
|
|
200
200
|
});
|
|
201
201
|
// Preserved for backwards-compatible inspection: callers (status
|
|
202
|
-
// command,
|
|
202
|
+
// command, mailbox surface, etc.) may still read this combined list
|
|
203
203
|
// for per-component reasons. The rollup status field above is what
|
|
204
204
|
// changed meaning — the array is still the union of bootstrap +
|
|
205
205
|
// agent-derived degradation entries.
|
|
@@ -61,10 +61,10 @@ const pending_1 = require("../../mind/pending");
|
|
|
61
61
|
const agent_service_1 = require("./agent-service");
|
|
62
62
|
const channel_1 = require("../../mind/friends/channel");
|
|
63
63
|
const mcp_manager_1 = require("../../repertoire/mcp-manager");
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
const
|
|
67
|
-
const
|
|
64
|
+
const mailbox_http_1 = require("../mailbox/mailbox-http");
|
|
65
|
+
const mailbox_types_1 = require("../mailbox/mailbox-types");
|
|
66
|
+
const mailbox_read_1 = require("../mailbox/mailbox-read");
|
|
67
|
+
const mailbox_view_1 = require("../mailbox/mailbox-view");
|
|
68
68
|
const provider_visibility_1 = require("../provider-visibility");
|
|
69
69
|
const socket_client_1 = require("./socket-client");
|
|
70
70
|
const PIDFILE_PATH = path.join(os.homedir(), ".ouro-cli", "daemon.pids");
|
|
@@ -414,10 +414,10 @@ class OuroDaemon {
|
|
|
414
414
|
bundlesRoot;
|
|
415
415
|
mode;
|
|
416
416
|
server = null;
|
|
417
|
-
|
|
417
|
+
mailboxServer = null;
|
|
418
418
|
socketIdentity = null;
|
|
419
419
|
senseAutostartTimer = null;
|
|
420
|
-
|
|
420
|
+
mailboxServerFactory;
|
|
421
421
|
onStopCommandComplete;
|
|
422
422
|
constructor(options) {
|
|
423
423
|
this.socketPath = options.socketPath;
|
|
@@ -428,36 +428,36 @@ class OuroDaemon {
|
|
|
428
428
|
this.senseManager = options.senseManager ?? null;
|
|
429
429
|
this.bundlesRoot = options.bundlesRoot ?? (0, identity_1.getAgentBundlesRoot)();
|
|
430
430
|
this.mode = options.mode ?? "production";
|
|
431
|
-
this.
|
|
431
|
+
this.mailboxServerFactory = options.mailboxServerFactory ?? this.createDefaultMailboxServer.bind(this);
|
|
432
432
|
this.onStopCommandComplete = options.onStopCommandComplete ?? null;
|
|
433
433
|
}
|
|
434
|
-
/* v8 ignore start -- default
|
|
435
|
-
|
|
436
|
-
return (0,
|
|
434
|
+
/* v8 ignore start -- default mailbox server wiring: production-only path, tests inject mailboxServerFactory stub instead. startMailboxHttpServer itself has full coverage in mailbox-http.test.ts @preserve */
|
|
435
|
+
createDefaultMailboxServer() {
|
|
436
|
+
return (0, mailbox_http_1.startMailboxHttpServer)({
|
|
437
437
|
host: "127.0.0.1",
|
|
438
|
-
port:
|
|
438
|
+
port: mailbox_types_1.MAILBOX_DEFAULT_PORT,
|
|
439
439
|
bundlesRoot: this.bundlesRoot,
|
|
440
|
-
readMachineState: () => (0,
|
|
440
|
+
readMachineState: () => (0, mailbox_read_1.readMailboxMachineState)({ bundlesRoot: this.bundlesRoot }),
|
|
441
441
|
readMachineView: ({ machine }) => {
|
|
442
442
|
const overview = this.buildStatusPayload().overview;
|
|
443
|
-
return (0,
|
|
443
|
+
return (0, mailbox_view_1.buildMailboxMachineView)({
|
|
444
444
|
machine,
|
|
445
445
|
daemon: {
|
|
446
446
|
status: overview.daemon,
|
|
447
447
|
health: overview.health,
|
|
448
448
|
mode: overview.mode,
|
|
449
449
|
socketPath: overview.socketPath,
|
|
450
|
-
|
|
450
|
+
mailboxUrl: overview.mailboxUrl,
|
|
451
451
|
entryPath: overview.entryPath,
|
|
452
452
|
workerCount: overview.workerCount,
|
|
453
453
|
senseCount: overview.senseCount,
|
|
454
454
|
},
|
|
455
455
|
});
|
|
456
456
|
},
|
|
457
|
-
readAgentState: (agentName) => (0,
|
|
457
|
+
readAgentState: (agentName) => (0, mailbox_read_1.readMailboxAgentState)(agentName, { bundlesRoot: this.bundlesRoot }),
|
|
458
458
|
readAgentView: (agentName) => {
|
|
459
|
-
const agent = (0,
|
|
460
|
-
return (0,
|
|
459
|
+
const agent = (0, mailbox_read_1.readMailboxAgentState)(agentName, { bundlesRoot: this.bundlesRoot });
|
|
460
|
+
return (0, mailbox_view_1.buildMailboxAgentView)({
|
|
461
461
|
agent,
|
|
462
462
|
viewer: { kind: "human" },
|
|
463
463
|
});
|
|
@@ -476,12 +476,14 @@ class OuroDaemon {
|
|
|
476
476
|
agentName: agent.name,
|
|
477
477
|
agentRoot: path.join(this.bundlesRoot, `${agent.name}.ouro`),
|
|
478
478
|
})));
|
|
479
|
+
const mailboxUrl = this.mailboxServer?.origin ?? "http://127.0.0.1:0";
|
|
479
480
|
return {
|
|
480
481
|
overview: {
|
|
481
482
|
daemon: "running",
|
|
482
483
|
health: workers.every((worker) => worker.status === "running") ? "ok" : "warn",
|
|
483
484
|
socketPath: this.socketPath,
|
|
484
|
-
|
|
485
|
+
mailboxUrl,
|
|
486
|
+
outlookUrl: mailboxUrl,
|
|
485
487
|
...(0, runtime_metadata_1.getRuntimeMetadata)(),
|
|
486
488
|
workerCount: workers.length,
|
|
487
489
|
senseCount: senses.length,
|
|
@@ -622,18 +624,18 @@ class OuroDaemon {
|
|
|
622
624
|
await this.drainPendingBundleMessages();
|
|
623
625
|
await this.drainPendingSenseMessages();
|
|
624
626
|
// startInner is only reachable when this.server is null (guarded in
|
|
625
|
-
// start()), and stop() nulls out this.
|
|
626
|
-
// so
|
|
627
|
+
// start()), and stop() nulls out this.mailboxServer alongside this.server,
|
|
628
|
+
// so mailboxServer is guaranteed unset here — no need for a guard.
|
|
627
629
|
try {
|
|
628
|
-
this.
|
|
630
|
+
this.mailboxServer = await this.mailboxServerFactory();
|
|
629
631
|
}
|
|
630
632
|
catch (error) {
|
|
631
633
|
(0, runtime_1.emitNervesEvent)({
|
|
632
634
|
level: "warn",
|
|
633
635
|
component: "daemon",
|
|
634
|
-
event: "daemon.
|
|
635
|
-
message: `
|
|
636
|
-
meta: { port:
|
|
636
|
+
event: "daemon.mailbox_start_failed",
|
|
637
|
+
message: `Mailbox server failed to start: ${String(error)}`,
|
|
638
|
+
meta: { port: mailbox_types_1.MAILBOX_DEFAULT_PORT },
|
|
637
639
|
});
|
|
638
640
|
}
|
|
639
641
|
}
|
|
@@ -948,9 +950,9 @@ class OuroDaemon {
|
|
|
948
950
|
this.server.close();
|
|
949
951
|
this.server = null;
|
|
950
952
|
}
|
|
951
|
-
if (this.
|
|
952
|
-
await this.
|
|
953
|
-
this.
|
|
953
|
+
if (this.mailboxServer) {
|
|
954
|
+
await this.mailboxServer.stop();
|
|
955
|
+
this.mailboxServer = null;
|
|
954
956
|
}
|
|
955
957
|
const socketPathExists = fs.existsSync(this.socketPath);
|
|
956
958
|
const currentSocketIdentity = socketPathExists ? readSocketIdentity(this.socketPath) : null;
|
|
@@ -33,34 +33,34 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
36
|
+
exports.createMailboxHttpReadHooks = createMailboxHttpReadHooks;
|
|
37
37
|
const path = __importStar(require("path"));
|
|
38
|
-
const
|
|
39
|
-
function
|
|
38
|
+
const mailbox_read_1 = require("./mailbox-read");
|
|
39
|
+
function createMailboxHttpReadHooks(options) {
|
|
40
40
|
const bundlesRoot = options.bundlesRoot;
|
|
41
41
|
const readOptions = bundlesRoot ? { bundlesRoot } : undefined;
|
|
42
42
|
const agentRoot = (agentName) => path.join(bundlesRoot ?? "", `${agentName}.ouro`);
|
|
43
43
|
return {
|
|
44
44
|
agentRoot,
|
|
45
|
-
readAgentSessions: options.readAgentSessions ?? ((agentName) => (0,
|
|
46
|
-
readAgentTranscript: options.readAgentTranscript ?? ((agentName, friendId, channel, key) => (0,
|
|
47
|
-
readAgentCoding: options.readAgentCoding ?? ((agentName) => (0,
|
|
48
|
-
readAgentAttention: options.readAgentAttention ?? ((agentName) => (0,
|
|
49
|
-
readAgentBridges: options.readAgentBridges ?? ((agentName) => (0,
|
|
50
|
-
readAgentNotes: options.readAgentNotes ?? ((agentName) => (0,
|
|
51
|
-
readAgentFriends: options.readAgentFriends ?? ((agentName) => (0,
|
|
52
|
-
readAgentContinuity: options.readAgentContinuity ?? ((agentName) => (0,
|
|
53
|
-
readAgentOrientation: options.readAgentOrientation ?? ((agentName) => (0,
|
|
54
|
-
readAgentObligations: options.readAgentObligations ?? ((agentName) => (0,
|
|
55
|
-
readAgentChanges: options.readAgentChanges ?? ((agentName) => (0,
|
|
56
|
-
readAgentSelfFix: options.readAgentSelfFix ?? ((agentName) => (0,
|
|
57
|
-
readAgentNoteDecisions: options.readAgentNoteDecisions ?? ((agentName) => (0,
|
|
58
|
-
readAgentHabits: options.readAgentHabits ?? ((agentName) => (0,
|
|
59
|
-
readAgentMail: options.readAgentMail ?? ((agentName) => (0,
|
|
60
|
-
readAgentMailMessage: options.readAgentMailMessage ?? ((agentName, messageId) => (0,
|
|
61
|
-
readDaemonHealth: options.readDaemonHealth ?? (() => (0,
|
|
62
|
-
readLogs: options.readLogs ?? (() => (0,
|
|
63
|
-
readDeskPrefs: (agentName) => (0,
|
|
64
|
-
readNeedsMe: (agentName) => (0,
|
|
45
|
+
readAgentSessions: options.readAgentSessions ?? ((agentName) => (0, mailbox_read_1.readSessionInventory)(agentName, readOptions)),
|
|
46
|
+
readAgentTranscript: options.readAgentTranscript ?? ((agentName, friendId, channel, key) => (0, mailbox_read_1.readSessionTranscript)(agentName, friendId, channel, key, readOptions)),
|
|
47
|
+
readAgentCoding: options.readAgentCoding ?? ((agentName) => (0, mailbox_read_1.readCodingDeep)(agentRoot(agentName))),
|
|
48
|
+
readAgentAttention: options.readAgentAttention ?? ((agentName) => (0, mailbox_read_1.readAttentionView)(agentName, readOptions)),
|
|
49
|
+
readAgentBridges: options.readAgentBridges ?? ((agentName) => (0, mailbox_read_1.readBridgeInventory)(agentRoot(agentName))),
|
|
50
|
+
readAgentNotes: options.readAgentNotes ?? ((agentName) => (0, mailbox_read_1.readNotesView)(agentRoot(agentName))),
|
|
51
|
+
readAgentFriends: options.readAgentFriends ?? ((agentName) => (0, mailbox_read_1.readFriendView)(agentName, readOptions)),
|
|
52
|
+
readAgentContinuity: options.readAgentContinuity ?? ((agentName) => (0, mailbox_read_1.readMailboxContinuity)(agentRoot(agentName), agentName)),
|
|
53
|
+
readAgentOrientation: options.readAgentOrientation ?? ((agentName) => (0, mailbox_read_1.readOrientationView)(agentRoot(agentName), agentName)),
|
|
54
|
+
readAgentObligations: options.readAgentObligations ?? ((agentName) => (0, mailbox_read_1.readObligationDetailView)(agentRoot(agentName))),
|
|
55
|
+
readAgentChanges: options.readAgentChanges ?? ((agentName) => (0, mailbox_read_1.readChangesView)(agentRoot(agentName))),
|
|
56
|
+
readAgentSelfFix: options.readAgentSelfFix ?? ((agentName) => (0, mailbox_read_1.readSelfFixView)(agentRoot(agentName))),
|
|
57
|
+
readAgentNoteDecisions: options.readAgentNoteDecisions ?? ((agentName) => (0, mailbox_read_1.readNoteDecisionView)(agentRoot(agentName))),
|
|
58
|
+
readAgentHabits: options.readAgentHabits ?? ((agentName) => (0, mailbox_read_1.readHabitView)(agentRoot(agentName))),
|
|
59
|
+
readAgentMail: options.readAgentMail ?? ((agentName) => (0, mailbox_read_1.readMailView)(agentName)),
|
|
60
|
+
readAgentMailMessage: options.readAgentMailMessage ?? ((agentName, messageId) => (0, mailbox_read_1.readMailMessageView)(agentName, messageId)),
|
|
61
|
+
readDaemonHealth: options.readDaemonHealth ?? (() => (0, mailbox_read_1.readDaemonHealthDeep)(options.healthPath)),
|
|
62
|
+
readLogs: options.readLogs ?? (() => (0, mailbox_read_1.readLogView)(options.logPath ?? null)),
|
|
63
|
+
readDeskPrefs: (agentName) => (0, mailbox_read_1.readDeskPrefs)(agentRoot(agentName)),
|
|
64
|
+
readNeedsMe: (agentName) => (0, mailbox_read_1.readNeedsMeView)(agentName, readOptions),
|
|
65
65
|
};
|
|
66
66
|
}
|
|
@@ -33,15 +33,15 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
36
|
+
exports.createMailboxHttpRequestHandler = createMailboxHttpRequestHandler;
|
|
37
37
|
const fs = __importStar(require("fs"));
|
|
38
38
|
const path = __importStar(require("path"));
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
function
|
|
42
|
-
const staticFiles = options.staticFiles ?? { resolveSpaDistDir:
|
|
39
|
+
const mailbox_http_response_1 = require("./mailbox-http-response");
|
|
40
|
+
const mailbox_http_static_1 = require("./mailbox-http-static");
|
|
41
|
+
function createMailboxHttpRequestHandler(options) {
|
|
42
|
+
const staticFiles = options.staticFiles ?? { resolveSpaDistDir: mailbox_http_static_1.resolveSpaDistDir, serveStaticFile: mailbox_http_static_1.serveStaticFile };
|
|
43
43
|
return (request, response) => {
|
|
44
|
-
let pathname = (0,
|
|
44
|
+
let pathname = (0, mailbox_http_static_1.normalizeMailboxRequestPath)(request.url);
|
|
45
45
|
const origin = `http://${options.host}:${options.getPort()}`;
|
|
46
46
|
if (pathname.startsWith("/assets/")) {
|
|
47
47
|
const spaDir = staticFiles.resolveSpaDistDir();
|
|
@@ -50,15 +50,15 @@ function createOutlookHttpRequestHandler(options) {
|
|
|
50
50
|
if (staticFiles.serveStaticFile(response, assetPath))
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
-
(0,
|
|
53
|
+
(0, mailbox_http_response_1.writeJson)(response, 404, { ok: false, error: "asset not found" });
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
|
-
if (pathname === "/
|
|
56
|
+
if (pathname === "/mailbox" || pathname === "/outlook") {
|
|
57
57
|
response.writeHead(301, { location: "/" });
|
|
58
58
|
response.end();
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
pathname = (0,
|
|
61
|
+
pathname = (0, mailbox_http_static_1.normalizeLegacyMailboxApiPath)(pathname);
|
|
62
62
|
if (pathname === "/api/events") {
|
|
63
63
|
response.writeHead(200, { "content-type": "text/event-stream", "cache-control": "no-cache", "connection": "keep-alive", "access-control-allow-origin": "*" });
|
|
64
64
|
response.write(":ok\n\n");
|
|
@@ -68,16 +68,16 @@ function createOutlookHttpRequestHandler(options) {
|
|
|
68
68
|
if (pathname === "/api/machine") {
|
|
69
69
|
const machine = options.readMachineState();
|
|
70
70
|
const machineView = options.readMachineView?.({ origin, machine });
|
|
71
|
-
(0,
|
|
71
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, machineView ?? machine);
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
74
|
if (pathname === "/api/machine/health") {
|
|
75
75
|
const health = options.hooks.readDaemonHealth();
|
|
76
|
-
(0,
|
|
76
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, health ?? { status: "unavailable" });
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
79
|
if (pathname === "/api/machine/logs") {
|
|
80
|
-
(0,
|
|
80
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, options.hooks.readLogs());
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
const agentMatch = /^\/api\/agents\/([^/]+)(?:\/(.+))?$/.exec(pathname);
|
|
@@ -87,7 +87,7 @@ function createOutlookHttpRequestHandler(options) {
|
|
|
87
87
|
surface: agentMatch[2] ?? null,
|
|
88
88
|
options,
|
|
89
89
|
}).catch((error) => {
|
|
90
|
-
(0,
|
|
90
|
+
(0, mailbox_http_response_1.writeJson)(response, 500, { ok: false, error: error instanceof Error ? error.message : String(error) });
|
|
91
91
|
});
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
@@ -96,7 +96,7 @@ function createOutlookHttpRequestHandler(options) {
|
|
|
96
96
|
if (staticFiles.serveStaticFile(response, path.join(spaDir, "index.html")))
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
|
-
(0,
|
|
99
|
+
(0, mailbox_http_response_1.writeJson)(response, 404, { ok: false, error: `not found: ${pathname}` });
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
async function handleAgentRoute(request, response, context) {
|
|
@@ -104,19 +104,19 @@ async function handleAgentRoute(request, response, context) {
|
|
|
104
104
|
if (!surface) {
|
|
105
105
|
const view = options.readAgentView?.(agent);
|
|
106
106
|
if (view) {
|
|
107
|
-
(0,
|
|
107
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, view);
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
110
|
const state = options.readAgentState(agent);
|
|
111
111
|
if (!state) {
|
|
112
|
-
(0,
|
|
112
|
+
(0, mailbox_http_response_1.writeJson)(response, 404, { ok: false, error: `unknown agent: ${agent}` });
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
(0,
|
|
115
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, state);
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
118
|
if (surface === "sessions") {
|
|
119
|
-
(0,
|
|
119
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, options.hooks.readAgentSessions(agent));
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
const transcriptMatch = /^sessions\/([^/]+)\/([^/]+)\/([^/]+)$/.exec(surface);
|
|
@@ -126,54 +126,54 @@ async function handleAgentRoute(request, response, context) {
|
|
|
126
126
|
const key = decodeURIComponent(transcriptMatch[3]);
|
|
127
127
|
const transcript = options.hooks.readAgentTranscript(agent, friendId, channel, key);
|
|
128
128
|
if (!transcript) {
|
|
129
|
-
(0,
|
|
129
|
+
(0, mailbox_http_response_1.writeJson)(response, 404, { ok: false, error: "session not found" });
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
|
-
(0,
|
|
132
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, transcript);
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
135
135
|
if (surface === "coding") {
|
|
136
|
-
(0,
|
|
136
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, options.hooks.readAgentCoding(agent));
|
|
137
137
|
return;
|
|
138
138
|
}
|
|
139
139
|
if (surface === "attention") {
|
|
140
|
-
(0,
|
|
140
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, options.hooks.readAgentAttention(agent));
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
143
|
if (surface === "bridges") {
|
|
144
|
-
(0,
|
|
144
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, options.hooks.readAgentBridges(agent));
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
147
147
|
if (surface === "notes") {
|
|
148
|
-
(0,
|
|
148
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, options.hooks.readAgentNotes(agent));
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
151
|
if (surface === "friends") {
|
|
152
|
-
(0,
|
|
152
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, options.hooks.readAgentFriends(agent));
|
|
153
153
|
return;
|
|
154
154
|
}
|
|
155
155
|
if (surface === "continuity") {
|
|
156
|
-
(0,
|
|
156
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, options.hooks.readAgentContinuity(agent));
|
|
157
157
|
return;
|
|
158
158
|
}
|
|
159
159
|
if (surface === "orientation") {
|
|
160
|
-
(0,
|
|
160
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, options.hooks.readAgentOrientation(agent));
|
|
161
161
|
return;
|
|
162
162
|
}
|
|
163
163
|
if (surface === "obligations") {
|
|
164
|
-
(0,
|
|
164
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, options.hooks.readAgentObligations(agent));
|
|
165
165
|
return;
|
|
166
166
|
}
|
|
167
167
|
if (surface === "changes") {
|
|
168
|
-
(0,
|
|
168
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, options.hooks.readAgentChanges(agent));
|
|
169
169
|
return;
|
|
170
170
|
}
|
|
171
171
|
if (surface === "self-fix") {
|
|
172
|
-
(0,
|
|
172
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, options.hooks.readAgentSelfFix(agent));
|
|
173
173
|
return;
|
|
174
174
|
}
|
|
175
175
|
if (surface === "note-decisions") {
|
|
176
|
-
(0,
|
|
176
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, options.hooks.readAgentNoteDecisions(agent));
|
|
177
177
|
return;
|
|
178
178
|
}
|
|
179
179
|
if (surface === "dismiss-obligation" && request.method === "POST") {
|
|
@@ -181,33 +181,33 @@ async function handleAgentRoute(request, response, context) {
|
|
|
181
181
|
return;
|
|
182
182
|
}
|
|
183
183
|
if (surface === "desk-prefs") {
|
|
184
|
-
(0,
|
|
184
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, options.hooks.readDeskPrefs(agent));
|
|
185
185
|
return;
|
|
186
186
|
}
|
|
187
187
|
if (surface === "needs-me") {
|
|
188
|
-
(0,
|
|
188
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, options.hooks.readNeedsMe(agent));
|
|
189
189
|
return;
|
|
190
190
|
}
|
|
191
191
|
if (surface === "habits") {
|
|
192
|
-
(0,
|
|
192
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, options.hooks.readAgentHabits(agent));
|
|
193
193
|
return;
|
|
194
194
|
}
|
|
195
195
|
if (surface === "mail") {
|
|
196
|
-
(0,
|
|
196
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, await options.hooks.readAgentMail(agent));
|
|
197
197
|
return;
|
|
198
198
|
}
|
|
199
199
|
const mailMessageMatch = /^mail\/([^/]+)$/.exec(surface);
|
|
200
200
|
if (mailMessageMatch) {
|
|
201
201
|
const messageId = decodeURIComponent(mailMessageMatch[1]);
|
|
202
|
-
(0,
|
|
202
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, await options.hooks.readAgentMailMessage(agent, messageId));
|
|
203
203
|
return;
|
|
204
204
|
}
|
|
205
205
|
if (surface === "inner-transcript") {
|
|
206
206
|
const transcript = options.hooks.readAgentTranscript(agent, "self", "inner", "dialog");
|
|
207
|
-
(0,
|
|
207
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, transcript ?? { messageCount: 0, messages: [] });
|
|
208
208
|
return;
|
|
209
209
|
}
|
|
210
|
-
(0,
|
|
210
|
+
(0, mailbox_http_response_1.writeJson)(response, 404, { ok: false, error: `unknown agent surface: ${surface}` });
|
|
211
211
|
}
|
|
212
212
|
function handleDismissObligation(request, response, agentRoot) {
|
|
213
213
|
let body = "";
|
|
@@ -218,13 +218,15 @@ function handleDismissObligation(request, response, agentRoot) {
|
|
|
218
218
|
try {
|
|
219
219
|
const { obligationId } = JSON.parse(body);
|
|
220
220
|
if (!obligationId) {
|
|
221
|
-
(0,
|
|
221
|
+
(0, mailbox_http_response_1.writeJson)(response, 400, { ok: false, error: "obligationId required" });
|
|
222
222
|
return;
|
|
223
223
|
}
|
|
224
|
-
const prefsPath = path.join(agentRoot, "state", "
|
|
224
|
+
const prefsPath = path.join(agentRoot, "state", "mailbox-prefs.json");
|
|
225
|
+
const legacyPrefsPath = path.join(agentRoot, "state", "outlook-prefs.json");
|
|
225
226
|
let prefs = {};
|
|
226
227
|
try {
|
|
227
|
-
|
|
228
|
+
const readPath = fs.existsSync(prefsPath) ? prefsPath : legacyPrefsPath;
|
|
229
|
+
prefs = JSON.parse(fs.readFileSync(readPath, "utf-8"));
|
|
228
230
|
}
|
|
229
231
|
catch {
|
|
230
232
|
// Missing or malformed prefs start from a clean preference object.
|
|
@@ -235,10 +237,10 @@ function handleDismissObligation(request, response, agentRoot) {
|
|
|
235
237
|
prefs.dismissedObligations = dismissed;
|
|
236
238
|
fs.mkdirSync(path.dirname(prefsPath), { recursive: true });
|
|
237
239
|
fs.writeFileSync(prefsPath, `${JSON.stringify(prefs, null, 2)}\n`, "utf-8");
|
|
238
|
-
(0,
|
|
240
|
+
(0, mailbox_http_response_1.writeJson)(response, 200, { ok: true, dismissed: dismissed.length });
|
|
239
241
|
}
|
|
240
242
|
catch (error) {
|
|
241
|
-
(0,
|
|
243
|
+
(0, mailbox_http_response_1.writeJson)(response, 500, { ok: false, error: String(error) });
|
|
242
244
|
}
|
|
243
245
|
});
|
|
244
246
|
}
|
|
@@ -33,8 +33,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
36
|
+
exports.normalizeMailboxRequestPath = normalizeMailboxRequestPath;
|
|
37
|
+
exports.normalizeLegacyMailboxApiPath = normalizeLegacyMailboxApiPath;
|
|
38
38
|
exports.resolveSpaDistDir = resolveSpaDistDir;
|
|
39
39
|
exports.serveStaticFile = serveStaticFile;
|
|
40
40
|
const fs = __importStar(require("fs"));
|
|
@@ -49,31 +49,31 @@ const MIME_TYPES = {
|
|
|
49
49
|
".ico": "image/x-icon",
|
|
50
50
|
".woff2": "font/woff2",
|
|
51
51
|
};
|
|
52
|
-
function
|
|
52
|
+
function normalizeMailboxRequestPath(urlValue = "/") {
|
|
53
53
|
const parsed = new URL(urlValue, "http://127.0.0.1");
|
|
54
54
|
const normalizedPath = parsed.pathname.replace(/\/+$/, "");
|
|
55
55
|
if (normalizedPath.length === 0)
|
|
56
56
|
return "/";
|
|
57
57
|
return normalizedPath;
|
|
58
58
|
}
|
|
59
|
-
function
|
|
60
|
-
if (pathname.startsWith("/outlook/api/"))
|
|
61
|
-
return pathname.slice("/outlook".length);
|
|
62
|
-
if (pathname === "/outlook/api")
|
|
63
|
-
return "/api";
|
|
59
|
+
function normalizeLegacyMailboxApiPath(pathname) {
|
|
64
60
|
if (pathname.startsWith("/mailbox/api/"))
|
|
65
61
|
return pathname.slice("/mailbox".length);
|
|
66
62
|
if (pathname === "/mailbox/api")
|
|
67
63
|
return "/api";
|
|
64
|
+
if (pathname.startsWith("/outlook/api/"))
|
|
65
|
+
return pathname.slice("/outlook".length);
|
|
66
|
+
if (pathname === "/outlook/api")
|
|
67
|
+
return "/api";
|
|
68
68
|
return pathname;
|
|
69
69
|
}
|
|
70
70
|
function defaultSpaDistCandidates() {
|
|
71
71
|
return [
|
|
72
|
-
path.resolve(__dirname, "..", "..", "..", "packages", "
|
|
73
|
-
path.resolve(__dirname, "..", "..", "packages", "
|
|
74
|
-
path.resolve(__dirname, "..", "..", "..", "..", "packages", "
|
|
75
|
-
path.resolve(__dirname, "..", "..", "
|
|
76
|
-
path.resolve(__dirname, "..", "
|
|
72
|
+
path.resolve(__dirname, "..", "..", "..", "packages", "mailbox-ui", "dist"),
|
|
73
|
+
path.resolve(__dirname, "..", "..", "packages", "mailbox-ui", "dist"),
|
|
74
|
+
path.resolve(__dirname, "..", "..", "..", "..", "packages", "mailbox-ui", "dist"),
|
|
75
|
+
path.resolve(__dirname, "..", "..", "mailbox-ui"),
|
|
76
|
+
path.resolve(__dirname, "..", "mailbox-ui"),
|
|
77
77
|
];
|
|
78
78
|
}
|
|
79
79
|
function resolveSpaDistDir(candidates = defaultSpaDistCandidates()) {
|
|
@@ -96,7 +96,7 @@ function createBundleWatcher(bundlesRoot, onChange, deps = DEFAULT_BUNDLE_WATCHE
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
catch {
|
|
99
|
-
// Watching is best-effort; manual broadcasts still keep
|
|
99
|
+
// Watching is best-effort; manual broadcasts still keep Mailbox usable.
|
|
100
100
|
}
|
|
101
101
|
return {
|
|
102
102
|
stop() {
|
|
@@ -33,31 +33,31 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
36
|
+
exports.startMailboxHttpServer = startMailboxHttpServer;
|
|
37
37
|
const http = __importStar(require("http"));
|
|
38
38
|
const runtime_1 = require("../../nerves/runtime");
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
async function
|
|
39
|
+
const mailbox_read_1 = require("./mailbox-read");
|
|
40
|
+
const mailbox_http_hooks_1 = require("./mailbox-http-hooks");
|
|
41
|
+
const mailbox_http_routes_1 = require("./mailbox-http-routes");
|
|
42
|
+
const mailbox_http_transport_1 = require("./mailbox-http-transport");
|
|
43
|
+
async function startMailboxHttpServer(options = {}) {
|
|
44
44
|
const host = options.host ?? "127.0.0.1";
|
|
45
45
|
const port = options.port ?? 0;
|
|
46
46
|
const bundlesRoot = options.bundlesRoot;
|
|
47
47
|
const opts = bundlesRoot ? { bundlesRoot } : undefined;
|
|
48
|
-
const readMachineState = options.readMachineState ?? (() => (0,
|
|
48
|
+
const readMachineState = options.readMachineState ?? (() => (0, mailbox_read_1.readMailboxMachineState)(opts));
|
|
49
49
|
const readMachineView = options.readMachineView;
|
|
50
50
|
const readAgentState = options.readAgentState ?? ((agentName) => {
|
|
51
51
|
if (opts)
|
|
52
|
-
return (0,
|
|
53
|
-
return (0,
|
|
52
|
+
return (0, mailbox_read_1.readMailboxAgentState)(agentName, opts);
|
|
53
|
+
return (0, mailbox_read_1.readMailboxAgentState)(agentName);
|
|
54
54
|
});
|
|
55
55
|
const readAgentView = options.readAgentView;
|
|
56
|
-
const hooks = (0,
|
|
57
|
-
const sse = (0,
|
|
58
|
-
const bundleWatcher = bundlesRoot ? (0,
|
|
56
|
+
const hooks = (0, mailbox_http_hooks_1.createMailboxHttpReadHooks)(options);
|
|
57
|
+
const sse = (0, mailbox_http_transport_1.createSseBroadcaster)();
|
|
58
|
+
const bundleWatcher = bundlesRoot ? (0, mailbox_http_transport_1.createBundleWatcher)(bundlesRoot, (0, mailbox_http_transport_1.createStateChangedBroadcast)(sse)) : null;
|
|
59
59
|
let server;
|
|
60
|
-
server = http.createServer((0,
|
|
60
|
+
server = http.createServer((0, mailbox_http_routes_1.createMailboxHttpRequestHandler)({
|
|
61
61
|
host,
|
|
62
62
|
getPort: () => server.address().port,
|
|
63
63
|
readMachineState,
|
|
@@ -75,7 +75,7 @@ async function startOutlookHttpServer(options = {}) {
|
|
|
75
75
|
const origin = `http://${host}:${address.port}`;
|
|
76
76
|
(0, runtime_1.emitNervesEvent)({
|
|
77
77
|
component: "daemon",
|
|
78
|
-
event: "daemon.
|
|
78
|
+
event: "daemon.mailbox_http_started",
|
|
79
79
|
message: "started Mailbox HTTP server",
|
|
80
80
|
meta: { origin },
|
|
81
81
|
});
|
|
@@ -90,7 +90,7 @@ async function startOutlookHttpServer(options = {}) {
|
|
|
90
90
|
await new Promise((resolve) => server.close(() => resolve()));
|
|
91
91
|
(0, runtime_1.emitNervesEvent)({
|
|
92
92
|
component: "daemon",
|
|
93
|
-
event: "daemon.
|
|
93
|
+
event: "daemon.mailbox_http_stopped",
|
|
94
94
|
message: "stopped Mailbox HTTP server",
|
|
95
95
|
meta: { origin },
|
|
96
96
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readSelfFixView = exports.
|
|
3
|
+
exports.readSelfFixView = exports.readMailboxContinuity = exports.readOrientationView = exports.readObligationDetailView = exports.readNoteDecisionView = exports.readChangesView = exports.readNeedsMeView = exports.readNotesView = exports.readLogView = exports.readHabitView = exports.readFriendView = exports.readDeskPrefs = exports.readDaemonHealthDeep = exports.readCodingDeep = exports.readBridgeInventory = exports.readAttentionView = exports.readMailView = exports.readMailMessageView = exports.readSessionTranscript = exports.readSessionInventory = exports.readMailboxMachineState = exports.readMailboxAgentState = exports.readObligationSummary = void 0;
|
|
4
4
|
var agent_machine_1 = require("./readers/agent-machine");
|
|
5
5
|
Object.defineProperty(exports, "readObligationSummary", { enumerable: true, get: function () { return agent_machine_1.readObligationSummary; } });
|
|
6
|
-
Object.defineProperty(exports, "
|
|
7
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "readMailboxAgentState", { enumerable: true, get: function () { return agent_machine_1.readMailboxAgentState; } });
|
|
7
|
+
Object.defineProperty(exports, "readMailboxMachineState", { enumerable: true, get: function () { return agent_machine_1.readMailboxMachineState; } });
|
|
8
8
|
var sessions_1 = require("./readers/sessions");
|
|
9
9
|
Object.defineProperty(exports, "readSessionInventory", { enumerable: true, get: function () { return sessions_1.readSessionInventory; } });
|
|
10
10
|
Object.defineProperty(exports, "readSessionTranscript", { enumerable: true, get: function () { return sessions_1.readSessionTranscript; } });
|
|
@@ -27,5 +27,5 @@ Object.defineProperty(exports, "readChangesView", { enumerable: true, get: funct
|
|
|
27
27
|
Object.defineProperty(exports, "readNoteDecisionView", { enumerable: true, get: function () { return continuity_readers_1.readNoteDecisionView; } });
|
|
28
28
|
Object.defineProperty(exports, "readObligationDetailView", { enumerable: true, get: function () { return continuity_readers_1.readObligationDetailView; } });
|
|
29
29
|
Object.defineProperty(exports, "readOrientationView", { enumerable: true, get: function () { return continuity_readers_1.readOrientationView; } });
|
|
30
|
-
Object.defineProperty(exports, "
|
|
30
|
+
Object.defineProperty(exports, "readMailboxContinuity", { enumerable: true, get: function () { return continuity_readers_1.readMailboxContinuity; } });
|
|
31
31
|
Object.defineProperty(exports, "readSelfFixView", { enumerable: true, get: function () { return continuity_readers_1.readSelfFixView; } });
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
3
|
+
exports.MAILBOX_DEFAULT_PORT = exports.MAILBOX_DEFAULT_INNER_VISIBILITY = exports.MAILBOX_RELEASE_INTERACTION_MODEL = exports.MAILBOX_PRODUCT_NAME = void 0;
|
|
4
|
+
exports.getMailboxTranscriptMessageText = getMailboxTranscriptMessageText;
|
|
5
|
+
exports.getMailboxTranscriptTimestamp = getMailboxTranscriptTimestamp;
|
|
6
|
+
exports.MAILBOX_PRODUCT_NAME = "Ouro Mailbox";
|
|
7
|
+
exports.MAILBOX_RELEASE_INTERACTION_MODEL = "read-only";
|
|
8
|
+
exports.MAILBOX_DEFAULT_INNER_VISIBILITY = "summary";
|
|
9
|
+
exports.MAILBOX_DEFAULT_PORT = 6876;
|
|
10
10
|
function transcriptContentText(content) {
|
|
11
11
|
if (typeof content === "string")
|
|
12
12
|
return content;
|
|
@@ -19,9 +19,9 @@ function transcriptContentText(content) {
|
|
|
19
19
|
.filter((text) => text.length > 0)
|
|
20
20
|
.join("");
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function getMailboxTranscriptMessageText(message) {
|
|
23
23
|
return transcriptContentText(message.content);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function getMailboxTranscriptTimestamp(message) {
|
|
26
26
|
return message.time.authoredAt ?? message.time.observedAt ?? message.time.recordedAt;
|
|
27
27
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.buildMailboxMachineView = buildMailboxMachineView;
|
|
4
|
+
exports.buildMailboxAgentView = buildMailboxAgentView;
|
|
5
5
|
const runtime_1 = require("../../nerves/runtime");
|
|
6
|
-
const
|
|
6
|
+
const mailbox_types_1 = require("./mailbox-types");
|
|
7
7
|
function deriveAttention(agent) {
|
|
8
8
|
if (agent.degraded.status === "degraded") {
|
|
9
9
|
return { level: "degraded", label: "Degraded" };
|
|
@@ -70,7 +70,7 @@ function deriveMood(machine, daemon) {
|
|
|
70
70
|
}
|
|
71
71
|
return "calm";
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function buildMailboxMachineView(input) {
|
|
74
74
|
const totals = buildTotals(input.machine);
|
|
75
75
|
const agents = input.machine.agents
|
|
76
76
|
.map((agent) => ({
|
|
@@ -84,9 +84,9 @@ function buildOutlookMachineView(input) {
|
|
|
84
84
|
});
|
|
85
85
|
return {
|
|
86
86
|
overview: {
|
|
87
|
-
productName:
|
|
87
|
+
productName: mailbox_types_1.MAILBOX_PRODUCT_NAME,
|
|
88
88
|
observedAt: input.machine.observedAt,
|
|
89
|
-
primaryEntryPoint: input.daemon.
|
|
89
|
+
primaryEntryPoint: input.daemon.mailboxUrl,
|
|
90
90
|
daemon: input.daemon,
|
|
91
91
|
runtime: input.machine.runtime,
|
|
92
92
|
freshness: input.machine.freshness,
|
|
@@ -94,7 +94,7 @@ function buildOutlookMachineView(input) {
|
|
|
94
94
|
totals,
|
|
95
95
|
mood: deriveMood(input.machine, input.daemon),
|
|
96
96
|
entrypoints: [
|
|
97
|
-
{ kind: "web", label: "Open Mailbox", target: input.daemon.
|
|
97
|
+
{ kind: "web", label: "Open Mailbox", target: input.daemon.mailboxUrl },
|
|
98
98
|
{ kind: "cli", label: "CLI JSON", target: "ouro mailbox --json" },
|
|
99
99
|
],
|
|
100
100
|
},
|
|
@@ -160,13 +160,13 @@ function buildRecentActivity(agent) {
|
|
|
160
160
|
.sort((left, right) => right.at.localeCompare(left.at))
|
|
161
161
|
.slice(0, 4);
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function buildMailboxAgentView(input) {
|
|
164
164
|
/* v8 ignore next */
|
|
165
|
-
(0, runtime_1.emitNervesEvent)({ component: "daemon", event: "daemon.
|
|
165
|
+
(0, runtime_1.emitNervesEvent)({ component: "daemon", event: "daemon.mailbox_view_agent", message: `building mailbox view for ${input.agent.agentName}`, meta: { agent: input.agent.agentName } });
|
|
166
166
|
const viewer = normalizeViewer(input.viewer);
|
|
167
167
|
return {
|
|
168
|
-
productName:
|
|
169
|
-
interactionModel:
|
|
168
|
+
productName: mailbox_types_1.MAILBOX_PRODUCT_NAME,
|
|
169
|
+
interactionModel: mailbox_types_1.MAILBOX_RELEASE_INTERACTION_MODEL,
|
|
170
170
|
viewer,
|
|
171
171
|
agent: {
|
|
172
172
|
agentName: input.agent.agentName,
|
|
@@ -34,8 +34,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.readObligationSummary = readObligationSummary;
|
|
37
|
-
exports.
|
|
38
|
-
exports.
|
|
37
|
+
exports.readMailboxAgentState = readMailboxAgentState;
|
|
38
|
+
exports.readMailboxMachineState = readMailboxMachineState;
|
|
39
39
|
const fs = __importStar(require("fs"));
|
|
40
40
|
const path = __importStar(require("path"));
|
|
41
41
|
const runtime_1 = require("../../../nerves/runtime");
|
|
@@ -48,7 +48,7 @@ const agent_discovery_1 = require("../../daemon/agent-discovery");
|
|
|
48
48
|
const runtime_metadata_1 = require("../../daemon/runtime-metadata");
|
|
49
49
|
const provider_visibility_1 = require("../../provider-visibility");
|
|
50
50
|
const thoughts_1 = require("../../daemon/thoughts");
|
|
51
|
-
const
|
|
51
|
+
const mailbox_types_1 = require("../mailbox-types");
|
|
52
52
|
const shared_1 = require("./shared");
|
|
53
53
|
const LIVE_TASK_STATUSES = ["processing", "validating", "collaborating", "blocked"];
|
|
54
54
|
function emptyByStatus() {
|
|
@@ -188,7 +188,7 @@ function readInnerSummary(agentRoot) {
|
|
|
188
188
|
?? null;
|
|
189
189
|
return {
|
|
190
190
|
summary: {
|
|
191
|
-
visibility:
|
|
191
|
+
visibility: mailbox_types_1.MAILBOX_DEFAULT_INNER_VISIBILITY,
|
|
192
192
|
status: job.status,
|
|
193
193
|
hasPending: pendingMessages.length > 0,
|
|
194
194
|
surfacedSummary,
|
|
@@ -306,7 +306,7 @@ function summarizeAgent(state) {
|
|
|
306
306
|
},
|
|
307
307
|
};
|
|
308
308
|
}
|
|
309
|
-
function
|
|
309
|
+
function readMailboxAgentState(agentName, options = {}) {
|
|
310
310
|
const bundlesRoot = options.bundlesRoot ?? (0, identity_1.getAgentBundlesRoot)();
|
|
311
311
|
const now = options.now?.() ?? new Date();
|
|
312
312
|
const agentRoot = path.join(bundlesRoot, `${agentName}.ouro`);
|
|
@@ -329,7 +329,7 @@ function readOutlookAgentState(agentName, options = {}) {
|
|
|
329
329
|
coding: coding.items,
|
|
330
330
|
}).sort((left, right) => right.localeCompare(left))[0] ?? null;
|
|
331
331
|
return {
|
|
332
|
-
productName:
|
|
332
|
+
productName: mailbox_types_1.MAILBOX_PRODUCT_NAME,
|
|
333
333
|
agentName,
|
|
334
334
|
agentRoot,
|
|
335
335
|
enabled: config.summary.enabled,
|
|
@@ -356,14 +356,14 @@ function readOutlookAgentState(agentName, options = {}) {
|
|
|
356
356
|
},
|
|
357
357
|
};
|
|
358
358
|
}
|
|
359
|
-
function
|
|
359
|
+
function readMailboxMachineState(options = {}) {
|
|
360
360
|
/* v8 ignore next */
|
|
361
|
-
(0, runtime_1.emitNervesEvent)({ component: "daemon", event: "daemon.
|
|
361
|
+
(0, runtime_1.emitNervesEvent)({ component: "daemon", event: "daemon.mailbox_read", message: "reading mailbox machine state", meta: {} });
|
|
362
362
|
const bundlesRoot = options.bundlesRoot ?? (0, identity_1.getAgentBundlesRoot)();
|
|
363
363
|
const now = options.now?.() ?? new Date();
|
|
364
364
|
const runtime = options.runtimeMetadata ?? (0, runtime_metadata_1.getRuntimeMetadata)({ bundlesRoot });
|
|
365
365
|
const agentNames = options.agentNames ?? (0, agent_discovery_1.listEnabledBundleAgents)({ bundlesRoot });
|
|
366
|
-
const agentStates = agentNames.map((agentName) =>
|
|
366
|
+
const agentStates = agentNames.map((agentName) => readMailboxAgentState(agentName, { ...options, bundlesRoot, now: () => now }));
|
|
367
367
|
const degradedIssues = agentStates
|
|
368
368
|
.flatMap((state) => state.degraded.issues.map((problem) => (0, shared_1.issue)("agent-degraded", `${state.agentName}: ${problem.detail}`)));
|
|
369
369
|
const freshest = agentStates
|
|
@@ -371,7 +371,7 @@ function readOutlookMachineState(options = {}) {
|
|
|
371
371
|
.filter((value) => typeof value === "string")
|
|
372
372
|
.sort((left, right) => right.localeCompare(left))[0] ?? null;
|
|
373
373
|
return {
|
|
374
|
-
productName:
|
|
374
|
+
productName: mailbox_types_1.MAILBOX_PRODUCT_NAME,
|
|
375
375
|
observedAt: now.toISOString(),
|
|
376
376
|
runtime,
|
|
377
377
|
agentCount: agentStates.length,
|
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
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
|
|
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.
|
|
83
|
-
message: `
|
|
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.
|
|
166
|
-
message: `
|
|
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.
|
|
215
|
-
message: `
|
|
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", "
|
|
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.
|
|
270
|
-
message: `
|
|
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.
|
|
302
|
-
message: `
|
|
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", "
|
|
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
|
|
10
|
-
const
|
|
11
|
-
const
|
|
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.
|
|
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:
|
|
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: "
|
|
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,
|
|
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: "
|
|
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 >
|
|
332
|
-
? decrypted.private.text.slice(0,
|
|
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 >
|
|
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.
|
|
200
|
-
message: "reading
|
|
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
|
|
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", "
|
|
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.
|
|
199
|
-
message: "reading
|
|
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.
|
|
107
|
-
message: "reading
|
|
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
|
|
113
|
-
// consumed by server readers and the UI.
|
|
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/
|
|
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
|
-
//
|
|
128
|
-
// dispatched by
|
|
129
|
-
"heart/
|
|
130
|
-
"heart/
|
|
131
|
-
"heart/
|
|
132
|
-
"heart/
|
|
133
|
-
"heart/
|
|
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",
|
|
@@ -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/
|
|
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.
|
|
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:
|
|
34
|
-
"test:
|
|
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/
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|