@ouro.bot/cli 0.1.0-alpha.1463 → 0.1.0-alpha.1465

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +2 -2
  2. package/changelog.json +14 -0
  3. package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
  4. package/deploy/unraid/sanctuary.xml +1 -1
  5. package/dist/heart/daemon/cli-commands/mail.js +0 -1
  6. package/dist/heart/daemon/cli-exec.js +0 -33
  7. package/dist/heart/daemon/cli-help.js +0 -13
  8. package/dist/heart/daemon/cli-parse.js +0 -3
  9. package/dist/heart/daemon/cli-render.js +0 -7
  10. package/dist/heart/daemon/daemon-entry.js +1 -1
  11. package/dist/heart/daemon/daemon.js +0 -63
  12. package/dist/heart/{mailbox/mailbox-supervision.js → shepherd/supervision-read.js} +4 -4
  13. package/dist/nerves/coverage/file-completeness.js +0 -11
  14. package/dist/nerves/observation.js +2 -4
  15. package/dist/repertoire/tools-mail.js +2 -2
  16. package/dist/senses/cli/ouro-tui.js +2 -2
  17. package/dist/senses/shepherd/operations.js +2 -2
  18. package/npm-shrinkwrap.json +2 -2
  19. package/package.json +2 -4
  20. package/skills/sense-setup.md +1 -1
  21. package/dist/heart/mailbox/mailbox-http-hooks.js +0 -99
  22. package/dist/heart/mailbox/mailbox-http-response.js +0 -7
  23. package/dist/heart/mailbox/mailbox-http-routes.js +0 -406
  24. package/dist/heart/mailbox/mailbox-http-static.js +0 -103
  25. package/dist/heart/mailbox/mailbox-http-transport.js +0 -272
  26. package/dist/heart/mailbox/mailbox-http.js +0 -99
  27. package/dist/heart/mailbox/mailbox-read.js +0 -41
  28. package/dist/heart/mailbox/mailbox-types.js +0 -27
  29. package/dist/heart/mailbox/mailbox-view.js +0 -197
  30. package/dist/heart/mailbox/readers/agent-machine.js +0 -428
  31. package/dist/heart/mailbox/readers/continuity-readers.js +0 -329
  32. package/dist/heart/mailbox/readers/mail.js +0 -375
  33. package/dist/heart/mailbox/readers/runtime-readers.js +0 -823
  34. package/dist/heart/mailbox/readers/sessions.js +0 -231
  35. package/dist/heart/mailbox/readers/shared.js +0 -111
  36. package/dist/mailbox-ui/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  37. package/dist/mailbox-ui/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  38. package/dist/mailbox-ui/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  39. package/dist/mailbox-ui/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  40. package/dist/mailbox-ui/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  41. package/dist/mailbox-ui/assets/index-BQYBPyiH.js +0 -5
  42. package/dist/mailbox-ui/assets/index-UZ85Lvxp.css +0 -1
  43. package/dist/mailbox-ui/assets/vendor-BfcLUM_P.js +0 -65
  44. package/dist/mailbox-ui/index.html +0 -18
@@ -1,231 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.readSessionInventory = readSessionInventory;
37
- exports.readSessionTranscript = readSessionTranscript;
38
- const path = __importStar(require("path"));
39
- const runtime_1 = require("../../../nerves/runtime");
40
- const identity_1 = require("../../identity");
41
- const session_events_1 = require("../../session-events");
42
- const shared_1 = require("./shared");
43
- /* v8 ignore start — session envelope parsing utilities */
44
- function parseSessionUsage(raw) {
45
- if (!raw || typeof raw !== "object")
46
- return null;
47
- const record = raw;
48
- const inputTokens = typeof record.input_tokens === "number" ? record.input_tokens : 0;
49
- const outputTokens = typeof record.output_tokens === "number" ? record.output_tokens : 0;
50
- const reasoningTokens = typeof record.reasoning_tokens === "number" ? record.reasoning_tokens : 0;
51
- const totalTokens = typeof record.total_tokens === "number" ? record.total_tokens : 0;
52
- if (inputTokens === 0 && outputTokens === 0 && totalTokens === 0)
53
- return null;
54
- return { input_tokens: inputTokens, output_tokens: outputTokens, reasoning_tokens: reasoningTokens, total_tokens: totalTokens };
55
- }
56
- function parseSessionContinuity(raw) {
57
- if (!raw)
58
- return null;
59
- if (typeof raw !== "object")
60
- return null;
61
- const record = raw;
62
- const continuity = {
63
- mustResolveBeforeHandoff: record.mustResolveBeforeHandoff === true,
64
- lastFriendActivityAt: typeof record.lastFriendActivityAt === "string" ? record.lastFriendActivityAt : null,
65
- };
66
- if (!continuity.mustResolveBeforeHandoff && continuity.lastFriendActivityAt === null)
67
- return null;
68
- return continuity;
69
- }
70
- function extractContent(event) {
71
- if (!event)
72
- return null;
73
- const text = (0, session_events_1.extractEventText)(event);
74
- return text.length > 0 ? text : null;
75
- }
76
- function extractToolCallNames(event) {
77
- if (!event)
78
- return [];
79
- return event.toolCalls
80
- .map((call) => call.function.name)
81
- .filter((name) => typeof name === "string" && name.length > 0);
82
- }
83
- /* v8 ignore stop */
84
- function estimateTokenCount(messages) {
85
- let charCount = 0;
86
- for (const msg of messages) {
87
- const content = extractContent(msg);
88
- if (content)
89
- charCount += content.length;
90
- if (msg.toolCalls.length > 0)
91
- charCount += JSON.stringify(msg.toolCalls).length;
92
- }
93
- return Math.ceil(charCount / 4);
94
- }
95
- /* v8 ignore start — filesystem traversal with defensive isDirectory checks */
96
- function resolveAllSessionPaths(sessionsDir) {
97
- const results = [];
98
- if (!(0, shared_1.safeIsDirectory)(sessionsDir))
99
- return results;
100
- for (const friendId of (0, shared_1.safeReaddir)(sessionsDir)) {
101
- const friendDir = path.join(sessionsDir, friendId);
102
- if (!(0, shared_1.safeIsDirectory)(friendDir))
103
- continue;
104
- for (const channel of (0, shared_1.safeReaddir)(friendDir)) {
105
- const channelDir = path.join(friendDir, channel);
106
- if (!(0, shared_1.safeIsDirectory)(channelDir))
107
- continue;
108
- for (const file of (0, shared_1.safeReaddir)(channelDir)) {
109
- if (!file.endsWith(".json"))
110
- continue;
111
- const key = file.slice(0, -5);
112
- results.push({
113
- friendId,
114
- channel,
115
- key,
116
- sessionPath: path.join(channelDir, file),
117
- });
118
- }
119
- }
120
- }
121
- return results;
122
- }
123
- /* v8 ignore stop */
124
- function readSessionInventory(agentName, options = {}) {
125
- const bundlesRoot = options.bundlesRoot ?? (0, identity_1.getAgentBundlesRoot)();
126
- const now = options.now?.() ?? new Date();
127
- const agentRoot = path.join(bundlesRoot, `${agentName}.ouro`);
128
- const sessionsDir = path.join(agentRoot, "state", "sessions");
129
- const friendsDir = path.join(agentRoot, "friends");
130
- const allSessions = resolveAllSessionPaths(sessionsDir);
131
- const items = [];
132
- for (const { friendId, channel, key, sessionPath } of allSessions) {
133
- if (friendId === "self" && channel === "inner")
134
- continue;
135
- const envelope = (0, shared_1.readSessionEnvelope)(sessionPath);
136
- const events = (0, session_events_1.selectEffectiveSessionEvents)(envelope?.events ?? []);
137
- const chronology = (0, session_events_1.deriveSessionChronology)(events);
138
- const lastUsage = parseSessionUsage(envelope?.lastUsage);
139
- const continuity = parseSessionContinuity(envelope?.state);
140
- const hasObservedEventTiming = events.some((event) => event.time.authoredAt !== null || event.time.observedAt !== null);
141
- const lastActivityAt = hasObservedEventTiming
142
- ? (chronology.lastActivityAt ?? continuity?.lastFriendActivityAt ?? (0, shared_1.safeFileMtime)(sessionPath) ?? now.toISOString())
143
- : (continuity?.lastFriendActivityAt ?? (0, shared_1.safeFileMtime)(sessionPath) ?? now.toISOString());
144
- const activitySource = hasObservedEventTiming && chronology.lastActivityAt
145
- ? "event-timeline"
146
- : continuity?.lastFriendActivityAt
147
- ? "friend-facing"
148
- : "mtime-fallback";
149
- const userMessages = events.filter((m) => m.role === "user");
150
- const assistantMessages = events.filter((m) => m.role === "assistant");
151
- const lastUser = userMessages.length > 0 ? userMessages[userMessages.length - 1] : null;
152
- const lastAssistant = assistantMessages.length > 0 ? assistantMessages[assistantMessages.length - 1] : null;
153
- const latestToolCallNames = [];
154
- for (let i = events.length - 1; i >= 0; i--) {
155
- const names = extractToolCallNames(events[i]);
156
- if (names.length > 0) {
157
- latestToolCallNames.push(...names);
158
- break;
159
- }
160
- }
161
- const friendName = (0, shared_1.resolveFriendName)(friendsDir, friendId);
162
- const lastMsg = events.length > 0 ? events[events.length - 1] : null;
163
- const mustResolve = continuity?.mustResolveBeforeHandoff === true;
164
- let replyState = "idle";
165
- if (mustResolve) {
166
- replyState = "on-hold";
167
- }
168
- else if (lastMsg?.role === "user") {
169
- replyState = "needs-reply";
170
- }
171
- else if (events.length > 0) {
172
- replyState = "monitoring";
173
- }
174
- items.push({
175
- friendId,
176
- friendName,
177
- channel,
178
- key,
179
- sessionPath,
180
- lastActivityAt,
181
- activitySource,
182
- replyState,
183
- messageCount: events.length,
184
- lastUsage,
185
- continuity,
186
- latestUserExcerpt: (0, shared_1.truncateExcerpt)(extractContent(lastUser)),
187
- latestAssistantExcerpt: (0, shared_1.truncateExcerpt)(extractContent(lastAssistant)),
188
- latestToolCallNames,
189
- estimatedTokens: events.length > 0 ? estimateTokenCount(events) : null,
190
- });
191
- }
192
- items.sort((a, b) => b.lastActivityAt.localeCompare(a.lastActivityAt));
193
- const ageThreshold = now.getTime() - shared_1.STALE_THRESHOLD_MS;
194
- const activeCount = items.filter((item) => Date.parse(item.lastActivityAt) >= ageThreshold).length;
195
- (0, runtime_1.emitNervesEvent)({
196
- component: "heart",
197
- event: "heart.mailbox_sessions_read",
198
- message: "reading mailbox session inventory",
199
- meta: { agentName, totalCount: items.length, activeCount },
200
- });
201
- return {
202
- totalCount: items.length,
203
- activeCount,
204
- staleCount: items.length - activeCount,
205
- items,
206
- };
207
- }
208
- function readSessionTranscript(agentName, friendId, channel, key, options = {}) {
209
- const bundlesRoot = options.bundlesRoot ?? (0, identity_1.getAgentBundlesRoot)();
210
- const agentRoot = path.join(bundlesRoot, `${agentName}.ouro`);
211
- const sessionPath = path.join(agentRoot, "state", "sessions", friendId, channel, `${key}.json`);
212
- const envelope = (0, shared_1.readSessionEnvelope)(sessionPath);
213
- if (!envelope)
214
- return null;
215
- const rawMessages = (0, session_events_1.selectEffectiveSessionEvents)(envelope.events);
216
- const friendsDir = path.join(agentRoot, "friends");
217
- const friendName = (0, shared_1.resolveFriendName)(friendsDir, friendId);
218
- const messages = rawMessages;
219
- return {
220
- friendId,
221
- friendName,
222
- channel,
223
- key,
224
- sessionPath,
225
- messageCount: messages.length,
226
- truncatedHistory: envelope.projection.trimmed,
227
- lastUsage: parseSessionUsage(envelope.lastUsage),
228
- continuity: parseSessionContinuity(envelope.state),
229
- messages,
230
- };
231
- }
@@ -1,111 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.STALE_THRESHOLD_MS = exports.BLOCKED_CODING_STATUSES = exports.ACTIVE_CODING_STATUSES = void 0;
37
- exports.issue = issue;
38
- exports.safeReaddir = safeReaddir;
39
- exports.safeIsDirectory = safeIsDirectory;
40
- exports.resolveFriendName = resolveFriendName;
41
- exports.safeFileMtime = safeFileMtime;
42
- exports.truncateExcerpt = truncateExcerpt;
43
- exports.readSessionEnvelope = readSessionEnvelope;
44
- const fs = __importStar(require("fs"));
45
- const path = __importStar(require("path"));
46
- const runtime_1 = require("../../../nerves/runtime");
47
- const session_events_1 = require("../../session-events");
48
- exports.ACTIVE_CODING_STATUSES = new Set(["spawning", "running", "waiting_input", "stalled"]);
49
- exports.BLOCKED_CODING_STATUSES = new Set(["waiting_input", "stalled"]);
50
- exports.STALE_THRESHOLD_MS = 24 * 60 * 60 * 1000;
51
- function issue(code, detail) {
52
- return { code, detail };
53
- }
54
- function safeReaddir(dir) {
55
- try {
56
- return fs.readdirSync(dir);
57
- }
58
- catch {
59
- return [];
60
- }
61
- }
62
- function safeIsDirectory(filePath) {
63
- try {
64
- return fs.statSync(filePath).isDirectory();
65
- /* v8 ignore start */
66
- }
67
- catch {
68
- return false;
69
- }
70
- /* v8 ignore stop */
71
- }
72
- /* v8 ignore start — defensive friend name resolution */
73
- function resolveFriendName(friendsDir, friendId) {
74
- try {
75
- const raw = fs.readFileSync(path.join(friendsDir, `${friendId}.json`), "utf-8");
76
- const parsed = JSON.parse(raw);
77
- return typeof parsed.name === "string" ? parsed.name : friendId;
78
- }
79
- catch {
80
- return friendId;
81
- }
82
- }
83
- /* v8 ignore stop */
84
- /* v8 ignore start — utility helpers with defensive branches */
85
- function safeFileMtime(filePath) {
86
- try {
87
- return fs.statSync(filePath).mtime.toISOString();
88
- }
89
- catch {
90
- return null;
91
- }
92
- }
93
- function truncateExcerpt(content, maxLength = 200) {
94
- if (!content)
95
- return null;
96
- if (content.length <= maxLength)
97
- return content;
98
- const truncated = content.slice(0, maxLength);
99
- const lastSpace = truncated.lastIndexOf(" ");
100
- return (lastSpace > maxLength * 0.6 ? truncated.slice(0, lastSpace) : truncated) + "…";
101
- }
102
- /* v8 ignore stop */
103
- function readSessionEnvelope(sessionPath) {
104
- (0, runtime_1.emitNervesEvent)({
105
- component: "heart",
106
- event: "heart.mailbox_session_envelope_read",
107
- message: "reading mailbox session envelope",
108
- meta: { sessionPath },
109
- });
110
- return (0, session_events_1.loadSessionEnvelopeFile)(sessionPath);
111
- }