@ouro.bot/cli 0.1.0-alpha.1517 → 0.1.0-alpha.1518

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.
@@ -2,14 +2,195 @@
2
2
  "generator": "ouro-actions-tools 1.12.0",
3
3
  "set": "mailbox",
4
4
  "tools": [
5
+ {
6
+ "type": "function",
7
+ "function": {
8
+ "name": "mailbox_send",
9
+ "description": "File a letter to this agent's person: a request only they can answer, with the options their answer picks from. The answer comes back to the sender.",
10
+ "parameters": {
11
+ "type": "object",
12
+ "properties": {
13
+ "kind": {
14
+ "type": "string",
15
+ "description": "decide: pick one of 2 to 5 options; do: a task only they can do; accept: approve finished work; know: something they should know.",
16
+ "enum": [
17
+ "decide",
18
+ "do",
19
+ "accept",
20
+ "know"
21
+ ]
22
+ },
23
+ "subject": {
24
+ "type": "string",
25
+ "description": "What is asked, in one line of at most 80 characters.",
26
+ "maxLength": 80
27
+ },
28
+ "whyOnlyYou": {
29
+ "type": "string",
30
+ "description": "Why only the person can answer, at most 200 characters; required unless kind is know.",
31
+ "maxLength": 200
32
+ },
33
+ "body": {
34
+ "type": "string",
35
+ "description": "What the person needs to answer, in Markdown, at most 4,000 characters. It may run over several lines.",
36
+ "maxLength": 4000
37
+ },
38
+ "options": {
39
+ "type": "array",
40
+ "description": "For a decide letter only: 2 to 5 options, each { label, effect }. Labels are words, without dashes, each its own.",
41
+ "items": {
42
+ "type": "object",
43
+ "description": "One answer the person can pick.",
44
+ "properties": {
45
+ "label": {
46
+ "type": "string",
47
+ "description": "The option's words, at most 40 characters.",
48
+ "maxLength": 40
49
+ },
50
+ "effect": {
51
+ "type": "string",
52
+ "description": "What happens when the person picks it, at most 160 characters.",
53
+ "maxLength": 160
54
+ }
55
+ },
56
+ "required": [
57
+ "label",
58
+ "effect"
59
+ ],
60
+ "additionalProperties": false
61
+ },
62
+ "minItems": 2,
63
+ "maxItems": 5
64
+ },
65
+ "links": {
66
+ "type": "array",
67
+ "description": "Pages the person may want while answering, each { label, url }.",
68
+ "items": {
69
+ "type": "object",
70
+ "description": "One page.",
71
+ "properties": {
72
+ "label": {
73
+ "type": "string",
74
+ "description": "The link's words.",
75
+ "maxLength": 80
76
+ },
77
+ "url": {
78
+ "type": "string",
79
+ "description": "An https:// or http:// address.",
80
+ "maxLength": 500
81
+ }
82
+ },
83
+ "required": [
84
+ "label",
85
+ "url"
86
+ ],
87
+ "additionalProperties": false
88
+ }
89
+ },
90
+ "dedupeKey": {
91
+ "type": "string",
92
+ "description": "A key of yours for this question: a send with a key you used before returns that letter instead of filing another.",
93
+ "maxLength": 120
94
+ },
95
+ "urgency": {
96
+ "type": "string",
97
+ "description": "How soon it matters.",
98
+ "enum": [
99
+ "now",
100
+ "today",
101
+ "whenever"
102
+ ],
103
+ "default": "whenever"
104
+ },
105
+ "holdUntil": {
106
+ "type": "string",
107
+ "description": "\"interactive\" to hold it for a session with the person, or an ISO time.",
108
+ "maxLength": 40
109
+ },
110
+ "expiresAt": {
111
+ "type": "string",
112
+ "description": "An ISO time after which the question is moot, such as 2026-12-01T17:00:00Z.",
113
+ "maxLength": 40
114
+ },
115
+ "lane": {
116
+ "type": "string",
117
+ "description": "Where you ask from, such as a desk task path, so the person knows who waits.",
118
+ "maxLength": 120
119
+ }
120
+ },
121
+ "required": [
122
+ "kind",
123
+ "subject"
124
+ ],
125
+ "additionalProperties": false
126
+ }
127
+ },
128
+ "ax": {
129
+ "id": "tool:mailbox_send",
130
+ "group": "mailbox",
131
+ "when": "Pick this to ask the person something only they can answer, once per question; a send with the same dedupeKey returns the letter already filed.",
132
+ "effect": "write",
133
+ "errors": [
134
+ {
135
+ "code": "invalid-letter",
136
+ "means": "A field broke a letter rule, such as a missing whyOnlyYou or a letter code in sender text; the text names the field.",
137
+ "fix": "Fix that field as the text says, then send again."
138
+ },
139
+ {
140
+ "code": "no-person",
141
+ "means": "Ouro can't tell who this agent's person is: no family friend record, or several, names this machine's owner.",
142
+ "fix": "Have the person run `ouro friend dedupe --apply`, or link their record to this machine, then send again."
143
+ },
144
+ {
145
+ "code": "daemon-down",
146
+ "means": "The Ouro daemon, which keeps the letters, isn't running, so nothing was read or filed.",
147
+ "fix": "Start it with `ouro up`, then call again."
148
+ },
149
+ {
150
+ "code": "unknown-input",
151
+ "means": "The call passed an input mailbox_send doesn't take, such as to or from, which Ouro sets; the text names it.",
152
+ "fix": "Call it again with only the inputs its schema lists."
153
+ },
154
+ {
155
+ "code": "bad-input",
156
+ "means": "An input is missing or has the wrong type or value; the text names it and what it takes.",
157
+ "fix": "Call it again with that input as its schema describes."
158
+ },
159
+ {
160
+ "code": "no-agent",
161
+ "means": "No agent bundle by that name is on this machine, so there are no letters to read or file.",
162
+ "fix": "Name an agent this machine has; `ouro status` lists them."
163
+ }
164
+ ]
165
+ }
166
+ },
5
167
  {
6
168
  "type": "function",
7
169
  "function": {
8
170
  "name": "mailbox_list",
9
- "description": "List the letters this agent has filed for its person that are still waiting for an answer, oldest first. Read only.",
171
+ "description": "List the letters this agent's person has been sent that still wait for an answer, oldest first, or every letter with all. Read only.",
10
172
  "parameters": {
11
173
  "type": "object",
12
- "properties": {},
174
+ "properties": {
175
+ "all": {
176
+ "type": "boolean",
177
+ "description": "List answered, withdrawn and expired letters too."
178
+ },
179
+ "mine": {
180
+ "type": "boolean",
181
+ "description": "Only the letters this agent filed."
182
+ },
183
+ "kind": {
184
+ "type": "string",
185
+ "description": "Only letters of this kind.",
186
+ "enum": [
187
+ "decide",
188
+ "do",
189
+ "accept",
190
+ "know"
191
+ ]
192
+ }
193
+ },
13
194
  "required": [],
14
195
  "additionalProperties": false
15
196
  }
@@ -20,16 +201,316 @@
20
201
  "when": "Pick this to see which letters still wait for the person's answer before filing another; it only reads.",
21
202
  "effect": "read",
22
203
  "errors": [
204
+ {
205
+ "code": "daemon-down",
206
+ "means": "The Ouro daemon, which keeps the letters, isn't running, so nothing was read or filed.",
207
+ "fix": "Start it with `ouro up`, then call again."
208
+ },
209
+ {
210
+ "code": "unknown-input",
211
+ "means": "The call passed an input mailbox_list doesn't take, such as to or from, which Ouro sets; the text names it.",
212
+ "fix": "Call it again with only the inputs its schema lists."
213
+ },
214
+ {
215
+ "code": "bad-input",
216
+ "means": "An input is missing or has the wrong type or value; the text names it and what it takes.",
217
+ "fix": "Call it again with that input as its schema describes."
218
+ },
219
+ {
220
+ "code": "no-agent",
221
+ "means": "No agent bundle by that name is on this machine, so there are no letters to read or file.",
222
+ "fix": "Name an agent this machine has; `ouro status` lists them."
223
+ }
224
+ ],
225
+ "idempotent": true
226
+ }
227
+ },
228
+ {
229
+ "type": "function",
230
+ "function": {
231
+ "name": "mailbox_read",
232
+ "description": "Read one letter by id or code: what it asks, its options, its state and every event, such as when it was seen. Read only.",
233
+ "parameters": {
234
+ "type": "object",
235
+ "properties": {
236
+ "letter": {
237
+ "type": "string",
238
+ "description": "The letter's id (ltr_…) or its code (L7).",
239
+ "maxLength": 64
240
+ }
241
+ },
242
+ "required": [
243
+ "letter"
244
+ ],
245
+ "additionalProperties": false
246
+ }
247
+ },
248
+ "ax": {
249
+ "id": "tool:mailbox_read",
250
+ "group": "mailbox",
251
+ "when": "Pick this when you hold a letter's id or code and want its state or answer; it only reads.",
252
+ "effect": "read",
253
+ "errors": [
254
+ {
255
+ "code": "not-found",
256
+ "means": "No letter has that id or code.",
257
+ "fix": "Find it with mailbox_list (all: true lists closed letters too), then call again with its id or code."
258
+ },
259
+ {
260
+ "code": "daemon-down",
261
+ "means": "The Ouro daemon, which keeps the letters, isn't running, so nothing was read or filed.",
262
+ "fix": "Start it with `ouro up`, then call again."
263
+ },
23
264
  {
24
265
  "code": "unknown-input",
25
- "means": "The call passed an input mailbox_list doesn't take; the text names it.",
26
- "fix": "Call it again with no input; it takes none."
266
+ "means": "The call passed an input mailbox_read doesn't take, such as to or from, which Ouro sets; the text names it.",
267
+ "fix": "Call it again with only the inputs its schema lists."
268
+ },
269
+ {
270
+ "code": "bad-input",
271
+ "means": "An input is missing or has the wrong type or value; the text names it and what it takes.",
272
+ "fix": "Call it again with that input as its schema describes."
273
+ },
274
+ {
275
+ "code": "no-agent",
276
+ "means": "No agent bundle by that name is on this machine, so there are no letters to read or file.",
277
+ "fix": "Name an agent this machine has; `ouro status` lists them."
27
278
  }
28
279
  ],
29
280
  "idempotent": true
30
281
  }
282
+ },
283
+ {
284
+ "type": "function",
285
+ "function": {
286
+ "name": "mailbox_wait",
287
+ "description": "Block until a letter leaves waiting or the timeout ends, then return its state and a cursor to pass next time. Read only.",
288
+ "parameters": {
289
+ "type": "object",
290
+ "properties": {
291
+ "letter": {
292
+ "type": "string",
293
+ "description": "The letter's id (ltr_…) or its code (L7).",
294
+ "maxLength": 64
295
+ },
296
+ "cursor": {
297
+ "type": "integer",
298
+ "description": "The cursor the last wait returned; events after it count.",
299
+ "minimum": 0
300
+ },
301
+ "timeout": {
302
+ "type": "integer",
303
+ "description": "Seconds to wait, 1 to 300.",
304
+ "minimum": 1,
305
+ "maximum": 300,
306
+ "default": 60
307
+ }
308
+ },
309
+ "required": [
310
+ "letter"
311
+ ],
312
+ "additionalProperties": false
313
+ }
314
+ },
315
+ "ax": {
316
+ "id": "tool:mailbox_wait",
317
+ "group": "mailbox",
318
+ "when": "Pick this only when your caller must block on the answer; otherwise the answer arrives in the session that asked.",
319
+ "effect": "read",
320
+ "errors": [
321
+ {
322
+ "code": "not-found",
323
+ "means": "No letter has that id or code.",
324
+ "fix": "Find it with mailbox_list (all: true lists closed letters too), then call again with its id or code."
325
+ },
326
+ {
327
+ "code": "daemon-down",
328
+ "means": "The Ouro daemon, which keeps the letters, isn't running, so nothing was read or filed.",
329
+ "fix": "Start it with `ouro up`, then call again."
330
+ },
331
+ {
332
+ "code": "unknown-input",
333
+ "means": "The call passed an input mailbox_wait doesn't take, such as to or from, which Ouro sets; the text names it.",
334
+ "fix": "Call it again with only the inputs its schema lists."
335
+ },
336
+ {
337
+ "code": "bad-input",
338
+ "means": "An input is missing or has the wrong type or value; the text names it and what it takes.",
339
+ "fix": "Call it again with that input as its schema describes."
340
+ },
341
+ {
342
+ "code": "no-agent",
343
+ "means": "No agent bundle by that name is on this machine, so there are no letters to read or file.",
344
+ "fix": "Name an agent this machine has; `ouro status` lists them."
345
+ }
346
+ ],
347
+ "idempotent": true
348
+ }
349
+ },
350
+ {
351
+ "type": "function",
352
+ "function": {
353
+ "name": "mailbox_withdraw",
354
+ "description": "Take back a waiting letter this agent filed, with the reason, so the person stops seeing it.",
355
+ "parameters": {
356
+ "type": "object",
357
+ "properties": {
358
+ "letter": {
359
+ "type": "string",
360
+ "description": "The letter's id (ltr_…) or its code (L7).",
361
+ "maxLength": 64
362
+ },
363
+ "reason": {
364
+ "type": "string",
365
+ "description": "Why it no longer needs an answer, in one line.",
366
+ "maxLength": 200
367
+ }
368
+ },
369
+ "required": [
370
+ "letter",
371
+ "reason"
372
+ ],
373
+ "additionalProperties": false
374
+ }
375
+ },
376
+ "ax": {
377
+ "id": "tool:mailbox_withdraw",
378
+ "group": "mailbox",
379
+ "when": "Pick this when a letter you filed no longer needs an answer, such as when the question became moot.",
380
+ "effect": "write",
381
+ "errors": [
382
+ {
383
+ "code": "not-found",
384
+ "means": "No letter has that id or code.",
385
+ "fix": "Find it with mailbox_list (all: true lists closed letters too), then call again with its id or code."
386
+ },
387
+ {
388
+ "code": "not-sender",
389
+ "means": "Another agent filed this letter, and only the agent that filed a letter may withdraw it.",
390
+ "fix": "Leave it, or ask the agent that filed it."
391
+ },
392
+ {
393
+ "code": "not-waiting",
394
+ "means": "The letter is already answered, withdrawn or expired.",
395
+ "fix": "Read it with mailbox_read; there is nothing to withdraw."
396
+ },
397
+ {
398
+ "code": "daemon-down",
399
+ "means": "The Ouro daemon, which keeps the letters, isn't running, so nothing was read or filed.",
400
+ "fix": "Start it with `ouro up`, then call again."
401
+ },
402
+ {
403
+ "code": "unknown-input",
404
+ "means": "The call passed an input mailbox_withdraw doesn't take, such as to or from, which Ouro sets; the text names it.",
405
+ "fix": "Call it again with only the inputs its schema lists."
406
+ },
407
+ {
408
+ "code": "bad-input",
409
+ "means": "An input is missing or has the wrong type or value; the text names it and what it takes.",
410
+ "fix": "Call it again with that input as its schema describes."
411
+ },
412
+ {
413
+ "code": "no-agent",
414
+ "means": "No agent bundle by that name is on this machine, so there are no letters to read or file.",
415
+ "fix": "Name an agent this machine has; `ouro status` lists them."
416
+ }
417
+ ]
418
+ }
419
+ },
420
+ {
421
+ "type": "function",
422
+ "function": {
423
+ "name": "mailbox_deliver",
424
+ "description": "Ask Ouro to send a waiting letter to the person's own chat now, rendered by Ouro, and record that it was delivered.",
425
+ "parameters": {
426
+ "type": "object",
427
+ "properties": {
428
+ "letter": {
429
+ "type": "string",
430
+ "description": "The letter's id (ltr_…) or its code (L7).",
431
+ "maxLength": 64
432
+ }
433
+ },
434
+ "required": [
435
+ "letter"
436
+ ],
437
+ "additionalProperties": false
438
+ }
439
+ },
440
+ "ax": {
441
+ "id": "tool:mailbox_deliver",
442
+ "group": "mailbox",
443
+ "when": "Pick this when you judge the person should see a waiting letter now; Ouro writes the text and picks the chat.",
444
+ "effect": "write",
445
+ "errors": [
446
+ {
447
+ "code": "no-answering-handle",
448
+ "means": "The person has no answering handle yet, so Ouro has no chat to send the letter to.",
449
+ "fix": "Leave the letter waiting; the person sets the handle with `ouro mailbox handle set` when chat delivery is ready."
450
+ },
451
+ {
452
+ "code": "not-found",
453
+ "means": "No letter has that id or code.",
454
+ "fix": "Find it with mailbox_list (all: true lists closed letters too), then call again with its id or code."
455
+ },
456
+ {
457
+ "code": "daemon-down",
458
+ "means": "The Ouro daemon, which keeps the letters, isn't running, so nothing was read or filed.",
459
+ "fix": "Start it with `ouro up`, then call again."
460
+ },
461
+ {
462
+ "code": "unknown-input",
463
+ "means": "The call passed an input mailbox_deliver doesn't take, such as to or from, which Ouro sets; the text names it.",
464
+ "fix": "Call it again with only the inputs its schema lists."
465
+ },
466
+ {
467
+ "code": "bad-input",
468
+ "means": "An input is missing or has the wrong type or value; the text names it and what it takes.",
469
+ "fix": "Call it again with that input as its schema describes."
470
+ },
471
+ {
472
+ "code": "no-agent",
473
+ "means": "No agent bundle by that name is on this machine, so there are no letters to read or file.",
474
+ "fix": "Name an agent this machine has; `ouro status` lists them."
475
+ }
476
+ ]
477
+ }
31
478
  }
32
479
  ],
33
- "errors": [],
34
- "refusals": {}
480
+ "errors": [
481
+ {
482
+ "code": "person-only",
483
+ "means": "Only the person can do this, so no agent may call it; the refusal says why and where the person does it.",
484
+ "fix": "Tell the person what the refusal says, and leave the step to them."
485
+ }
486
+ ],
487
+ "refusals": {
488
+ "mailbox_answer": {
489
+ "ax": "outcome/1",
490
+ "action": "mailbox answer",
491
+ "effect": "private",
492
+ "audience": {
493
+ "only": true,
494
+ "who": "only you"
495
+ },
496
+ "target": null,
497
+ "state": "refused",
498
+ "summary": "Answer a letter: You can't answer a letter for the person; only they can. Ask the person, who does it by replying to the letter in their chat, such as \"L7 2\".",
499
+ "postcondition": {
500
+ "checked": false,
501
+ "holds": null,
502
+ "how": "not checked"
503
+ },
504
+ "receipt": null,
505
+ "next": [],
506
+ "error": {
507
+ "code": "person-only",
508
+ "exit": 2,
509
+ "thing": "mailbox answer",
510
+ "problem": "You can't answer a letter for the person; only they can. Ask the person, who does it by replying to the letter in their chat, such as \"L7 2\"",
511
+ "fix": null,
512
+ "message": "Answer a letter: You can't answer a letter for the person; only they can. Ask the person, who does it by replying to the letter in their chat, such as \"L7 2\"."
513
+ }
514
+ }
515
+ }
35
516
  }
@@ -42,7 +42,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
42
42
  return (mod && mod.__esModule) ? mod : { "default": mod };
43
43
  };
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.pingGithubCopilotModel = void 0;
45
+ exports.pingGithubCopilotModel = exports.MAILBOX_CLI_REFUSAL_CODES = void 0;
46
46
  exports.runMcpServeCliLifecycle = runMcpServeCliLifecycle;
47
47
  exports.summarizeDaemonStartupFailure = summarizeDaemonStartupFailure;
48
48
  exports.writeSyncProbeSummary = writeSyncProbeSummary;
@@ -113,6 +113,11 @@ const cli_parse_2 = require("./cli-parse");
113
113
  const cli_help_1 = require("./cli-help");
114
114
  const cli_manifest_1 = require("./cli-manifest");
115
115
  const doors_1 = require("../letters/doors");
116
+ /** The codes the mailbox commands fail with: the doors' own checks and the daemon's letters writer. */
117
+ exports.MAILBOX_CLI_REFUSAL_CODES = new Set([
118
+ "daemon-down", "bad-input", "not-found",
119
+ "invalid-letter", "no-person", "not-sender", "not-waiting", "no-answering-handle",
120
+ ]);
116
121
  const plugin_cli_1 = require("./plugin-cli");
117
122
  const cli_desk_1 = require("./cli-desk");
118
123
  const desk_admin_1 = require("./desk-admin");
@@ -566,6 +571,7 @@ function agentResolutionFailureMode(command) {
566
571
  case "a2a.serve":
567
572
  case "a2a.escalation":
568
573
  case "a2a.delegatedCommands":
574
+ case "mailbox.action":
569
575
  return "throw";
570
576
  case "provider.use":
571
577
  case "provider.check":
@@ -8981,8 +8987,18 @@ async function runOuroCli(args, deps = (0, cli_defaults_1.createDefaultOuroCliDe
8981
8987
  }
8982
8988
  // ── mailbox (local: each command runs the action ouro-actions generated it from) ──
8983
8989
  if (command.kind === "mailbox.action") {
8984
- const result = (0, doors_1.runMailboxAction)(command.action, {});
8985
- const message = command.json ? JSON.stringify(result) : result.count === 0 ? "No letters are waiting." : result.listing;
8990
+ let result;
8991
+ try {
8992
+ result = await (0, doors_1.runMailboxAction)(command.action, command.input, { agent: command.agent, socketPath: deps.socketPath, ...(command.dryRun ? { dryRun: true } : {}) });
8993
+ }
8994
+ catch (error) {
8995
+ // A refusal fails the command with its card's code, which the CLI prints as its last stderr line; a code the
8996
+ // mailbox commands don't answer with fails it as an error.
8997
+ if (!(error instanceof doors_1.MailboxDoorError))
8998
+ throw error;
8999
+ throw exports.MAILBOX_CLI_REFUSAL_CODES.has(error.code) ? Object.assign(new Error(error.message), { code: error.code }) : new Error(error.message);
9000
+ }
9001
+ const message = command.json ? JSON.stringify(result) : (0, doors_1.renderMailboxResult)(command.action, result);
8986
9002
  deps.writeStdout(message);
8987
9003
  return message;
8988
9004
  }
@@ -59,6 +59,7 @@ const cli_desk_1 = require("./cli-desk");
59
59
  const flight_recorder_1 = require("../../arc/flight-recorder");
60
60
  const core_1 = require("../../nerves/review/core");
61
61
  const prunable_bundle_1 = require("./prunable-bundle");
62
+ const doors_1 = require("../letters/doors");
62
63
  const vault_items_1 = require("./vault-items");
63
64
  // ── Shared helpers ──
64
65
  function extractAgentFlag(args) {
@@ -466,7 +467,7 @@ function usage() {
466
467
  " ouro shepherd reconcile --agent <name> --expected-revision <n> --request-id <id> --id <id> --resolution retired|delivered [--json]",
467
468
  " ouro shepherd maintenance --agent <name> --expected-revision <n> --request-id <id> --destination <path> [--json]",
468
469
  " ouro session list [--agent <name>]",
469
- " ouro mailbox list [--json]",
470
+ ...(0, doors_1.mailboxUsageLines)().map((line) => ` ${line}`),
470
471
  " ouro mcp list",
471
472
  " ouro mcp call <server> <tool> [--args '{...}']",
472
473
  " ouro mcp doctor --agent <name> [--json]",
@@ -676,23 +677,34 @@ function parsePokeCommand(args) {
676
677
  * The words of the mailbox group (`ouro mailbox <word>`), each the generated action it runs. They are written out here because the AX census
677
678
  * reads a parser's words from its own syntax; doors.test.ts holds them equal to actions/generated/mailbox.
678
679
  */
679
- exports.MAILBOX_CLI_WORDS = { list: "mailbox_list" };
680
+ exports.MAILBOX_CLI_WORDS = {
681
+ send: "mailbox_send",
682
+ list: "mailbox_list",
683
+ read: "mailbox_read",
684
+ wait: "mailbox_wait",
685
+ withdraw: "mailbox_withdraw",
686
+ deliver: "mailbox_deliver",
687
+ };
680
688
  const MAILBOX_USAGE_WORDS = Object.keys(exports.MAILBOX_CLI_WORDS).join("|");
681
689
  /**
682
690
  * `ouro mailbox <word>`: each word is a command ouro-actions generated for the mailbox group
683
- * (actions/generated/mailbox/commands.json), and runs that command's action (src/heart/letters/doors.ts).
691
+ * (actions/generated/mailbox/commands.json), and runs that command's action (src/heart/letters/doors.ts). A
692
+ * person-only word, such as `answer`, is refused with its generated refusal.
684
693
  */
685
694
  function parseMailboxCommand(args) {
686
- const { rest } = extractAgentFlag(args);
695
+ const { agent, rest } = extractAgentFlag(args);
687
696
  const sub = rest[0];
697
+ const personOnly = sub === undefined ? undefined : (0, doors_1.readMailboxDoors)().refusals[`mailbox_${sub}`];
698
+ if (personOnly)
699
+ throw Object.assign(new Error(personOnly.summary), { code: "person-only" });
688
700
  if (sub === undefined || !Object.hasOwn(exports.MAILBOX_CLI_WORDS, sub)) {
689
701
  throw new Error(`Usage: ouro mailbox ${MAILBOX_USAGE_WORDS} [--json]`);
690
702
  }
691
- const extra = rest.slice(1).filter((token) => token !== "--json");
692
- if (extra.length > 0)
693
- throw new Error(`ouro mailbox ${sub} takes no words after it: ${extra.join(" ")}`);
694
- const action = exports.MAILBOX_CLI_WORDS[sub];
695
- return { kind: "mailbox.action", action, ...(rest.includes("--json") ? { json: true } : {}) };
703
+ const parsed = (0, doors_1.parseMailboxCli)(sub, rest.slice(1));
704
+ return {
705
+ kind: "mailbox.action", action: parsed.action, input: parsed.input,
706
+ ...(agent ? { agent } : {}), ...(parsed.json ? { json: true } : {}), ...(parsed.dryRun ? { dryRun: true } : {}),
707
+ };
696
708
  }
697
709
  function parseHabitCommand(args) {
698
710
  const { agent, rest } = extractAgentFlag(args);
@@ -632,6 +632,8 @@ class OuroDaemon {
632
632
  router;
633
633
  senseManager;
634
634
  bundlesRoot;
635
+ /** The letters' single writer, made on the first mailbox call. */
636
+ lettersWriter = null;
635
637
  mode;
636
638
  server = null;
637
639
  frontendSocketServer = null;
@@ -2502,6 +2504,13 @@ class OuroDaemon {
2502
2504
  case "await.poke": {
2503
2505
  return this.handlePrivateRuntimeWake(this.buildAwaitPrivateWakeCommand(command));
2504
2506
  }
2507
+ case "letters.action":
2508
+ {
2509
+ // Loaded on the first mailbox call so a daemon with no letters pays nothing at start.
2510
+ const letters = await Promise.resolve().then(() => __importStar(require("../letters/writer")));
2511
+ this.lettersWriter ??= new letters.LettersWriter({ bundlesRoot: this.bundlesRoot });
2512
+ return letters.answerLettersCommand(this.lettersWriter, command);
2513
+ }
2505
2514
  case "mcp.list": {
2506
2515
  return (0, turn_execution_lease_1.withTurnExecutionLease)(async () => {
2507
2516
  const agentName = command.agent ?? "default";