@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.
- package/README.md +1 -1
- package/changelog.json +16 -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 +26 -12
- package/dist/heart/daemon/daemon.js +33 -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/bluebubbles/index.js +15 -7
- 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
|
@@ -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,
|