@paigy/mcp 0.40.39 → 0.40.40

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.
@@ -1,5 +1,5 @@
1
1
  // ../../packages/schema/dist/index.js
2
- import { z as z11 } from "zod";
2
+ import { z as z12 } from "zod";
3
3
  import { z } from "zod";
4
4
  import { z as z3 } from "zod";
5
5
  import { z as z2 } from "zod";
@@ -16,6 +16,8 @@ import { z as z9 } from "zod";
16
16
  import { zodToJsonSchema as zodToJsonSchema5 } from "zod-to-json-schema";
17
17
  import { z as z10 } from "zod";
18
18
  import { zodToJsonSchema as zodToJsonSchema6 } from "zod-to-json-schema";
19
+ import { z as z11 } from "zod";
20
+ import { zodToJsonSchema as zodToJsonSchema7 } from "zod-to-json-schema";
19
21
  var OPTIONS_MIN = 2;
20
22
  var OPTIONS_MAX = 6;
21
23
  var OPTION_LABEL_MAX = 50;
@@ -45,7 +47,7 @@ var OptionInputSchema = z.object({
45
47
  imgUrl: OptionSchema.shape.image
46
48
  }).strict();
47
49
  var NIGHT = { from: 23, to: 7 };
48
- var ASK_MAX = 250;
50
+ var ASK_MAX = 80;
49
51
  var UNITS_MAX = 12;
50
52
  var UNIT_TITLE_MAX = 50;
51
53
  var UNIT_BODY_MAX = 200;
@@ -110,15 +112,15 @@ var CompletionSchema = z3.object({
110
112
  }).strict();
111
113
  var CompleteChangeSchema = CompletionSchema.extend({ kind: z3.literal("complete") });
112
114
  var ASKING_RULES = `HOW TO ASK:
113
- 1. Write one question per object. Five questions are five objects in \`questions\`, in one contact, so each can be answered on its own; one question with five parts settles nothing until all five are answered.
114
- 2. Name the Goal you are working on as the question's \`goalId\`: the question goes onto that Goal and its answer comes back there. It must exist: create it with manage_goals first.
115
- 3. \`workItBlocks\` only for work you are truly blocked on (it asks for a call); leave it out for a question you can keep working around.
116
- 4. Never hold the process open with while-loops. A wait that comes back \`expired\` is not a finished conversation: wait again with contact({wait:true}) only while you have nothing else to do. While a Call you placed is open, keep receiving window after window until it ends, even when a window is empty: the person may give follow-ups or instructions. With no open Call, STOP WAITING when a window comes back with nothing new \u2014 the question stays open, and its answer reaches you on the Goal. Otherwise, yield only with a working listener or scheduled wakeup, and collect answers with \`contact({wait:false})\` or \`get_goals\` on that wake.
117
- 5. One question, one row. Never restate a question that is still waiting inside a new contact: keep waiting on the original, or the answer lands on one copy and the other stays open. Take back one that no longer matters with \`withdrawQuestionIds\`.
118
- 6. Read the Goal's conversation before asking. Never ask again what was answered or already shipped \u2014 and tell its states apart: \`answered\` carries the choice in \`answer\`, while \`replied\` means they said something and chose none of your options, so that question is still yours to settle and their words are the line beside it.
119
- 7. A question carries its options when you have them; a free-text question may omit them. Each option\u2019s label must stand on its own and name its choice in full -- never \`All three\` or \`Option 2\`. \`pickMode: "many"\` makes the card a checklist (options they may want several of); \`"one"\`, the default, a pick (one rules out the others); \`"rank"\` an ordering. Each question is sent exactly as written, with no reading in between. They can always answer in their own words, so never add an 'Other' option.
120
- 8. A diagnosis says when, why and how it happens, then proposes one fix. Never options first.
121
- 9. GIVE A REPORT ITS REPLY: an update takes \`reply\` too, one line the person can tap instead of typing, written in THEIR voice for THAT report ("Sounds good, I'll test later") \u2014 the same care you give a question's options. What they tap is what you read back, which tells you whether they verified your work or only received it. One line, because a report has one way to close, and it may not change what happens next: a reply that would is a question. Requested delivery and completed-Goal reports require a reply (reply_required); ordinary progress may omit it.`;
115
+ 1. One question per object in \`questions\`, so each is answered on its own.
116
+ 2. \`goalId\` names the existing Goal it is about (create one with manage_goals first); the answer comes back there.
117
+ 3. \`workItBlocks\` only when you are truly blocked: it asks for a call.
118
+ 4. No while-loops. While any Call is open, even one your question joined from their items, keep receiving through empty windows; otherwise stop at one: the answer reaches you on the Goal. Yield only with a listener or wakeup.
119
+ 5. One question, one row: never re-send one still waiting; take back one that no longer matters with \`withdrawQuestionIds\`.
120
+ 6. Read the Goal before asking; never re-ask what was answered or shipped. \`replied\` means they chose no option: it is still yours to settle.
121
+ 7. Give options when you have them. Each label names its choice in full (never "Option 2"); never add "Other". \`pickMode\`: one (default), many, rank.
122
+ 8. A diagnosis says when, why and how it happens, then proposes one fix.
123
+ 9. Give a report its \`reply\`: one line in THEIR voice for THAT report, so you learn whether they verified it or only received it. Required when it reaches them or completes a Goal.`;
122
124
  function draft2020(node) {
123
125
  if (Array.isArray(node)) return node.map(draft2020);
124
126
  if (node && typeof node === "object") {
@@ -161,7 +163,7 @@ var userExplicitlyRequested = z4.enum(["any", "call"]).optional().describe(
161
163
  `Only what the person said about THIS message, in so many words: "any" when they asked you to send it to them ("send it to my phone", "message me the result"), "call" when they asked to be called about it. It is then delivered (a call rings for the whole contact, and carries everything waiting on them); omitted, an update is only recorded as the Goal's progress unless the person needs it. Never set it to make a message louder.`
162
164
  );
163
165
  var units = z4.array(UnitInputSchema).optional().describe(
164
- `The context this message needs, as up to ${UNITS_MAX} units in reading order, each {title, body}: a title of at most ${UNIT_TITLE_MAX} characters and a body of at most ${UNIT_BODY_MAX}. One idea per unit. Leave it out when the main text says it all.`
166
+ `The context this message needs, as up to ${UNITS_MAX} units in reading order, each {title, body}: a title of at most ${UNIT_TITLE_MAX} characters and a body of at most ${UNIT_BODY_MAX}. One idea per unit. Leave it out when the main text says it all. Over a cap is refused by name (ask_too_long, too_many_units, unit_title_too_long, unit_body_too_long) and nothing is sent.`
165
167
  );
166
168
  var UpdateInputSchema = z4.object({
167
169
  message: z4.string().trim().min(1).describe(`The one point, at most ${ASK_MAX} characters; the context goes in units.`),
@@ -216,7 +218,7 @@ var questionFields = {
216
218
  ),
217
219
  goalId: z4.string().uuid().describe("The Goal the question is about, which must exist (create it with manage_goals first). Its answer comes back there."),
218
220
  units,
219
- options: z4.array(OptionInputSchema).min(1).max(6).optional().describe("The choices, when you have them. Each label stands on its own, at most 50 characters; a hint, at most 200."),
221
+ options: z4.array(OptionInputSchema).min(1).max(6).optional().describe("The choices, when you have them. Each label stands on its own, at most 50 characters; a hint, at most 200. They can always answer in their own words, so no 'Other' or 'None of these'."),
220
222
  // HOW THE OPTIONS ARE ANSWERED, SAID BY THE AGENT (owner, 2026-10-02: "one and many makes sense";
221
223
  // brain_prompts.md §1: structured agent questions need no model). The app draws all three.
222
224
  pickMode: z4.enum(["one", "many", "rank"]).optional().describe(
@@ -258,7 +260,9 @@ var QuestionDependencySchema = z4.object({
258
260
  reason: reason.optional()
259
261
  }).strict().refine(actionFits, ACTION_FITS);
260
262
  var sendFields = {
261
- completions: z4.array(CompletionSchema).min(1).max(20).optional().describe("Close existing Goals and deliver their completion reports atomically. Ordinary updates never close work."),
263
+ completions: z4.array(CompletionSchema).min(1).max(20).optional().describe(
264
+ "COMPLETIONS close and report in one operation, the same contract as manage_goals kind:complete: closure and the report commit together or neither does. Required children and dependencies must already be finished. options suggest next steps: a tap acknowledges the report and requests that step, and never reopens the Goal (follow-up work needs a new one). No reviewer rejudges it: say only what your evidence supports. Ordinary updates never close a Goal."
265
+ ),
262
266
  updates: z4.array(UpdateInputSchema).min(1).max(20).optional().describe(
263
267
  "News: progress, findings, a result. An update asks nothing. It reaches the person only when they asked for it (userExplicitlyRequested), when it answers something they said, or once its Goal is done; otherwise it is recorded as the Goal's progress and nobody is notified."
264
268
  ),
@@ -272,7 +276,7 @@ var sendFields = {
272
276
  };
273
277
  var ContactSchema = z4.object({
274
278
  ...sendFields,
275
- questions: z4.array(QuestionInputSchema).min(1).max(20).optional().describe("Questions for the person, one per object."),
279
+ questions: z4.array(QuestionInputSchema).min(1).max(20).optional().describe("Questions for the person, one per object, each sent exactly as written, with no reading in between."),
276
280
  /** RECEIVING (2I, I2; brain_prompts.md §2.2): the events this agent handled. */
277
281
  ackEventIds: z4.array(z4.string().uuid()).min(1).max(100).optional().describe(
278
282
  "The exact eventIds of the events you have handled: an acknowledgment (ACK). Reading alone acknowledges nothing, so an event comes back until you acknowledge it; after that the next batch can come. Each recipient acknowledges separately, for itself only. A Question you owe is answered (answers), never acknowledged away."
@@ -288,15 +292,13 @@ var ContactWireSchema = z4.object({
288
292
  questions: z4.array(QuestionWireSchema).min(1).max(20).optional()
289
293
  }).strict().refine(sendsAnything, "a contact sends at least one update, question, answer, withdrawal or question dependency");
290
294
  var CONTACT_SCHEMA = { type: "object", ...mcpInputSchema(ContactSchema) };
291
- var CONTACT_DESCRIPTION = "Send to and receive from the person: completions, updates, questions, answers to questions addressed to you, withdrawals of your own questions, and what a question holds up. Every Goal you name must already exist: create it with manage_goals first; an unknown Goal is refused and nothing is sent. Every item applies on its own: read `results`, where a failed item names why while the rest still apply.\n\n" + ASKING_RULES + `
295
+ var CONTACT_DESCRIPTION = "Send to and receive from the person: completions, updates, questions, answers to questions addressed to you, withdrawals, and what a question holds up. Every Goal named must exist: an unknown one refuses the whole contact. Each item applies on its own: read `results`, where a failed one names why.\n\n" + ASKING_RULES + `
292
296
 
293
- CUT A LONG MESSAGE BEFORE YOU SEND IT: a question, an update's message or an answer is the one point, in at most ${ASK_MAX} characters; everything else it needs goes in 'units', up to ${UNITS_MAX} {title, body} in reading order, one idea each, every title at most ${UNIT_TITLE_MAX} characters and every body at most ${UNIT_BODY_MAX}. The person sees the main text and the titles, and opens a unit to read its body. Over a cap is refused by name (ask_too_long, too_many_units, unit_title_too_long, unit_body_too_long) and nothing is sent.
297
+ LENGTH: the question, message or answer is the one point, at most ${ASK_MAX} characters; the rest goes in \`units\`, one idea each. Over a cap is refused by name and nothing is sent. Several results are several updates.
294
298
 
295
- UPDATES ask nothing, so no answer is owed and none should be awaited. An update reaches the person only when they asked you for it (userExplicitlyRequested), when it answers something they said, or once its Goal is done; any other is recorded as the Goal's progress and nobody is notified. Ordinary updates never close a Goal. On a Goal whose report card is still open, an update that reaches them is added to that card, with no new push. If the person is already on a call, anything that reaches them joins that call, with no ring.
299
+ UPDATES ask nothing. One reaches the person only when they asked for it, it answers something they said, or its Goal is done; else it is kept as progress. One that reaches them joins an open report card or a live call.
296
300
 
297
- COMPLETIONS close and report in one operation: completions:[{goalId,message,units?,reply,options?}]. The same contract works in manage_goals changes with kind:complete. message is at most 50 characters; use units when useful for initial state, changes, current state (verification and limits), and next steps / leftover work with its owner. reply is one acknowledgement in the person's voice. Optional options:[{label,hint}] suggest next steps: a tap acknowledges the report and requests that step from its author. It never reopens the completed Goal; follow-up work needs a new Goal. Closure and the report commit together or neither does. Required children and dependencies must already be finished. No Reviewer rejudges your completion; say only what your evidence supports.
298
-
299
- RECEIVING: a contact that sends nothing returns \`events\`, a limited batch of what is addressed to you (not a history page): \`question\`, a Question you owe (answer it in answers, with its questionId); \`update\`, something new on one of your Goals (a reply, an answer: read it with get_goals); \`instruction\`, a request or note sent to you. \`hasMore\` says more are waiting. Reading acknowledges nothing: once you have handled events, confirm their eventIds with contact({ackEventIds}), and the next batch can come. contact({}) waits up to about 45 seconds for something to arrive; contact({wait:false}) returns at once. It also lists work given to you that nobody has started (\`assigned\`; your first write to it starts it) and your work gone quiet (\`stalled\`).`;
301
+ RECEIVING: contact({}) waits ~45 s; contact({wait:false}) returns \`events\` at once. Confirm the ones you handled with contact({ackEventIds}).`;
300
302
  var CreateGoalSchema = z5.object({
301
303
  outcome: z5.string().trim().min(1).max(1e4),
302
304
  /** The work's NAME (#2115) — one to five words, how a person refers to it out loud ("the night
@@ -430,8 +432,8 @@ var AGENT_TOOLS = [
430
432
  ];
431
433
  var AGENT_TOOL_NAMES = AGENT_TOOLS.map((t) => t.name);
432
434
  function serverInstructions(opts) {
433
- const waits = opts.waits ? "contact({..., wait:true}) holds one bounded ~45 s window for a response to what you sent; contact({}) holds one for anything addressed to you." : "A contact here returns after one read (`waitOutcome: not_waited`); answers wake you, and contact({wait:false}) collects them.";
434
- return `On startup and after a wake, call contact({wait:false}) for the events addressed to you (acknowledge the ones you handled with contact({ackEventIds})), which hand you your work: answers, assignments, reviews and due Goals. get_goals reads a Goal and the conversation on it; a read never puts you on it. You are on a Goal from your first write to it (a contact update, question or answer naming it, or a manage_goals change); there is nothing to claim or join. Every Goal of your person is open to you, whichever of their agents owns it: read it with get_goals, write on it (a contact naming its id) and change it (manage_goals). Create, edit, assign and organize work with manage_goals. Complete and report atomically with contact.completions or manage_goals kind:complete; both take the same completion contract. A contact only names Goals that already exist. Every read ends in \`next\`, the one step to take. Sending returns immediately unless you ask it to wait: keep working and collect answers by receiving or through get_goals. ${waits} Events repeat until you acknowledge them: reading alone acknowledges nothing; an \`update\` event acknowledged is a review cleared. Report progress as a contact update: one the person does not need yet is kept as the Goal's progress and reaches no one. To follow up later, defer the Goal with manage_goals: you are woken when its time comes. Never infer ringing from an open Call Delivery. Soft waiting and re-presentation are unsupported. Your user is remote. Always interact with the user through Paigy. For decisions, approvals, or questions, contact them with structured options. Never assume anyone is reading the terminal stdout.
435
+ const waits = opts.waits ? "contact({wait:true}) waits ~45 s for a reply to what you sent; contact({}) for anything addressed to you." : "A contact here returns after one read; answers wake you, and contact({wait:false}) collects them.";
436
+ return `On startup and after a wake, contact({wait:false}) returns your events. They repeat until you acknowledge them with contact({ackEventIds}); reading acknowledges nothing. get_goals reads a Goal and its conversation; your first write to one puts you on it, and every Goal of your person is open to you. manage_goals creates, assigns and organizes work; to follow up later, defer the Goal with manage_goals (you're woken when due). Complete and report in one step: contact.completions or manage_goals kind:complete. Every read ends in \`next\`: your next step. ${waits} Report progress as a contact update; one they don't need yet stays on the Goal. An open Call is not proof it rang. Your user is remote: reach them only through Paigy, never the terminal; ask decisions with options.
435
437
 
436
438
  ${ASKING_RULES}`;
437
439
  }
@@ -520,11 +522,22 @@ var BrainMessageSchema = z6.union([
520
522
  // A MESSAGE TO THE PERSON KEEPS ITS SENTENCES (turns.md): the talker writes them one by one, and each is
521
523
  // its own unit of speech (`<cycle>:<key>:<n>`). `text` is the same words joined, for every reader of a
522
524
  // message's words. Absent on results written before sentences.
523
- z6.object({ ...messageBase, to: z6.object({ kind: z6.literal("user") }).strict(), sentences: z6.array(z6.string().min(1)).min(1).optional() }).strict(),
525
+ z6.object({
526
+ ...messageBase,
527
+ to: z6.object({ kind: z6.literal("user") }).strict(),
528
+ sentences: z6.array(z6.string().min(1)).min(1).optional(),
529
+ // THE REPORTS IT TELLS, BY THEIR OWN IDENTITY (call 9d1c096c, 2026-10-15): the talker's message names the report
530
+ // Entries it speaks of, so the plan's line names that report rather than re-finding it by its Goal. Absent on
531
+ // results written before it.
532
+ tells: z6.array(z6.object({ id }).strict()).optional()
533
+ }).strict(),
524
534
  z6.object({
525
535
  ...messageBase,
526
536
  to: z6.object({ kind: z6.literal("agent"), agentId: z6.string().regex(/^agent:(?!paigy$)\S+$/) }).strict(),
527
537
  call: z6.object({ callId: id, listen: z6.literal(true) }).strict().optional(),
538
+ // WHAT IT ASKS THE AGENT, IN UNDER TEN WORDS (owner, 2026-10-15: "Yes, add the summary"): the talker's own, stored
539
+ // as the sent Entry's summary, which the recap's "Sent to <agent>: …" row shows. Absent on results written before it.
540
+ summary: z6.string().optional(),
528
541
  // THE PERSON ASKED TO BE CALLED BACK ONCE THIS AGENT'S WORK IS DONE (turns.md, step 0): the agent owes
529
542
  // the call, and its next contact about it rings them (`public.callbacks`).
530
543
  callback: z6.literal(true).optional()
@@ -551,95 +564,97 @@ var BrainResultSchema = z6.object({
551
564
  next: BrainNextSchema,
552
565
  search: BrainSearchSchema.optional()
553
566
  }).strict();
554
- var str = z6.string();
567
+ var str2 = z6.string();
555
568
  var strs = z6.array(z6.string());
556
569
  var CompactResultSchema = z6.object({
557
- next: z6.object({ say: strs, then: z6.enum(["listen", "hold", "end", "none"]), waitFor: strs, reason: str, instructions: strs }).strict(),
558
- messages: z6.array(z6.object({ key: str, to: str, text: str, about: strs, entries: strs, owed: strs, inviteToCall: z6.boolean() }).strict()),
559
- entries: z6.array(z6.object({ key: str, from: str, on: strs }).strict()),
560
- answers: z6.array(z6.object({ question: str, entries: strs, summary: str, picked: strs }).strict()),
570
+ next: z6.object({ say: strs, then: z6.enum(["listen", "hold", "end", "none"]), waitFor: strs, reason: str2, instructions: strs }).strict(),
571
+ messages: z6.array(z6.object({ key: str2, to: str2, text: str2, about: strs, entries: strs, owed: strs, inviteToCall: z6.boolean() }).strict()),
572
+ entries: z6.array(z6.object({ key: str2, from: str2, on: strs }).strict()),
573
+ answers: z6.array(z6.object({ question: str2, entries: strs, summary: str2, picked: strs }).strict()),
561
574
  changes: z6.array(z6.object({
562
- key: str,
575
+ key: str2,
563
576
  what: z6.enum(["goal", "question", "lesson"]),
564
577
  op: z6.enum(["create", "edit", "assign", "open", "complete", "cancel", "defer", "move", "block", "unblock", "withdraw", "remember", "revise"]),
565
- id: str,
566
- text: str,
567
- title: str,
568
- who: str,
569
- under: str,
578
+ id: str2,
579
+ text: str2,
580
+ title: str2,
581
+ who: str2,
582
+ under: str2,
570
583
  gate: z6.enum(["start", "complete", "answer", "none"]),
571
- options: z6.array(z6.object({ id: str, label: str }).strict()),
584
+ options: z6.array(z6.object({ id: str2, label: str2 }).strict()),
572
585
  pick: z6.enum(["one", "many", "rank", "words"]),
573
586
  entries: strs
574
587
  }).strict()),
575
588
  feedback: z6.array(strs),
576
- search: z6.object({ query: str, within: strs, goal: str }).strict()
589
+ search: z6.object({ query: str2, within: strs, goal: str2 }).strict()
577
590
  }).strict();
578
591
  var COMPACT_RESULT_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
579
592
  zodToJsonSchema2(CompactResultSchema, { $refStrategy: "none" })
580
593
  );
581
- var str2 = z7.string();
594
+ var str3 = z7.string();
582
595
  var strs2 = z7.array(z7.string());
583
596
  var TalkerReplySchema = z7.object({
584
597
  /** What to say and send, messages to the person first: spoken in the order written. `to` is "user"
585
598
  * or an agent's handle; `sentences` is what a message to the person says, one short sentence each
586
- * ([] to an agent); `text` is what a message to an agent says ("" to the person); `about` names
599
+ * ([] to an agent); `text` is what a message to an agent says ("" to the person); `summary` is what it
600
+ * asks the agent, in under ten words, as the person would put it ("" to the person; owner, 2026-10-15:
601
+ * "Yes, add the summary"), which the recap's "Sent to <agent>: …" row shows; `about` names
587
602
  * handles; `blocks` is the item a question to an agent must be answered before ("" for none);
588
603
  * `callback` is true on a message to the agent doing work the person asked to be called back about
589
604
  * once it is done (false otherwise): that agent then owes the call (turns.md, step 0). */
590
- messages: z7.array(z7.object({ key: str2, to: str2, sentences: strs2, text: str2, about: strs2, blocks: str2, callback: z7.boolean() }).strict()),
605
+ messages: z7.array(z7.object({ key: str3, to: str3, sentences: strs2, text: str3, summary: str3, about: strs2, blocks: str3, callback: z7.boolean() }).strict()),
591
606
  /** What the call does next: listen, hold (the person asked for a moment) or end (they asked to). */
592
607
  then: z7.enum(["listen", "hold", "end"]),
593
608
  /** The person's replies to items (replies, owner 2026-10-07): the item's handle, the chosen option
594
609
  * IDs, the line handles, how they replied in under ten words (keeping any condition), and `defer`:
595
610
  * "" when their words settle the item, else what a reply that puts it off waits for -- "call" (the
596
611
  * end of this call), a question's handle (that question's answer) or an ISO time. */
597
- replies: z7.array(z7.object({ item: str2, options: strs2, lines: strs2, summary: str2, defer: str2 }).strict()),
612
+ replies: z7.array(z7.object({ item: str3, options: strs2, lines: strs2, summary: str3, defer: str3 }).strict()),
598
613
  /** The line handles that tell the talker how to run this call; they last until it ends and reach no agent. */
599
614
  instruction: strs2,
600
615
  /** The line handles the filer acts on, and the only ones it reads (3e): new work, a change to existing
601
616
  * work, feedback on Paigy, anything said to an agent, and any rule meant to outlast the call. */
602
617
  file: strs2,
603
618
  /** Evidence to fetch for a second round: a search, an item's full text, or an agent by name. */
604
- need: z7.object({ kind: z7.enum(["search", "item", "agent", ""]), text: str2 }).strict(),
619
+ need: z7.object({ kind: z7.enum(["search", "item", "agent", ""]), text: str3 }).strict(),
605
620
  /** The handle of the item to explain ("" for none). */
606
- explain: str2
621
+ explain: str3
607
622
  }).strict();
608
623
  var TALKER_REPLY_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
609
624
  zodToJsonSchema3(TalkerReplySchema, { $refStrategy: "none" })
610
625
  );
611
- var str3 = z8.string();
626
+ var str4 = z8.string();
612
627
  var strs3 = z8.array(z8.string());
613
628
  var FilerReplySchema = z8.object({
614
629
  /** Which Goals each new line goes on: a line's handle, Goal handles (or keys of new Goals), and what
615
630
  * the line says in at most ten words. */
616
- filed: z8.array(z8.object({ line: str3, goals: strs3, summary: str3 }).strict()),
631
+ filed: z8.array(z8.object({ line: str4, goals: strs3, summary: str4 }).strict()),
617
632
  goals: z8.array(z8.object({
618
633
  op: z8.enum(["create", "edit", "complete", "cancel", "reopen", "assign", "defer", "move", "block", "unblock"]),
619
- key: str3,
620
- goal: str3,
621
- title: str3,
622
- outcome: str3,
623
- owner: str3,
624
- under: str3,
625
- until: str3,
626
- on: str3,
634
+ key: str4,
635
+ goal: str4,
636
+ title: str4,
637
+ outcome: str4,
638
+ owner: str4,
639
+ under: str4,
640
+ until: str4,
641
+ on: str4,
627
642
  gate: z8.enum(["start", "complete", "answer", ""]),
628
- why: str3
643
+ why: str4
629
644
  }).strict()),
630
645
  questions: z8.array(z8.object({
631
646
  op: z8.enum(["create", "edit", "assign", "withdraw"]),
632
- key: str3,
633
- question: str3,
634
- text: str3,
635
- summary: str3,
636
- to: str3,
637
- goal: str3,
638
- options: z8.array(z8.object({ id: str3, label: str3 }).strict()),
647
+ key: str4,
648
+ question: str4,
649
+ text: str4,
650
+ summary: str4,
651
+ to: str4,
652
+ goal: str4,
653
+ options: z8.array(z8.object({ id: str4, label: str4 }).strict()),
639
654
  pick: z8.enum(["one", "many", "rank", "words", ""]),
640
- blocks: str3
655
+ blocks: str4
641
656
  }).strict()),
642
- lessons: z8.array(z8.object({ op: z8.enum(["remember", "revise", "withdraw"]), lesson: str3, text: str3, scope: str3 }).strict()),
657
+ lessons: z8.array(z8.object({ op: z8.enum(["remember", "revise", "withdraw"]), lesson: str4, text: str4, scope: str4 }).strict()),
643
658
  /** Line handles whose words comment on Paigy itself. */
644
659
  feedback: strs3
645
660
  }).strict();
@@ -700,6 +715,27 @@ var TidyReplySchema = z10.object({
700
715
  var TIDY_REPLY_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
701
716
  zodToJsonSchema6(TidyReplySchema, { $refStrategy: "none" })
702
717
  );
718
+ var HandoutReplySchema = z11.object({
719
+ assign: z11.array(z11.object({
720
+ /** The Goal's handle (G). */
721
+ goal: z11.string(),
722
+ /** The agent's handle (A). */
723
+ to: z11.string(),
724
+ /** At most ten words, naming the Goal of theirs it is most like: the reason the hand-out records. */
725
+ why: z11.string()
726
+ }).strict()),
727
+ /** The Goals no listed agent's work is even loosely like: Paigy starts a session for them (owner, 2026-10-24,
728
+ * Goal 37603006, "One per family of related Goals"). */
729
+ new: z11.array(z11.object({
730
+ /** The Goal's handle (G). */
731
+ goal: z11.string(),
732
+ /** At most ten words: why nothing active fits it. */
733
+ why: z11.string()
734
+ }).strict())
735
+ }).strict();
736
+ var HANDOUT_REPLY_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
737
+ zodToJsonSchema7(HandoutReplySchema, { $refStrategy: "none" })
738
+ );
703
739
  function entryWords(entry) {
704
740
  const content = entry.content;
705
741
  if (content && "sealed" in content) return "";
@@ -728,20 +764,20 @@ var LIVE_MS = 3 * 6e4;
728
764
  var WORKING_MS = 60 * 6e4;
729
765
  var WORKING_TIER_MS = 2 * 60 * 6e4;
730
766
  var RECENT_TIER_MS = 24 * 60 * 6e4;
731
- var ContextSchema = z11.object({
732
- title: z11.string().min(1).describe("One-line headline of what you need (required, non-empty)."),
733
- description: z11.array(z11.string().min(1)).describe(
767
+ var ContextSchema = z12.object({
768
+ title: z12.string().min(1).describe("One-line headline of what you need (required, non-empty)."),
769
+ description: z12.array(z12.string().min(1)).describe(
734
770
  "Semantic chunks of detail (each a standalone, non-empty piece). The user can select chunks to ask you to expand. MAY BE EMPTY: a claim whose whole content is its heading \u2014 a single sentence \u2014 has no body, and saying so beats repeating the heading underneath itself. That repeat is what `min(1)` used to force, at 2x the storage, with every reader subtracting it back out at render time."
735
771
  ),
736
772
  /** THE ASK'S UNITS (3c): its context as titled units, in order. The app lists the titles and opens
737
773
  * a body on a tap. Absent on an ask sent without units, which renders as before. */
738
- units: z11.array(z11.object({ title: z11.string(), body: z11.string() })).optional()
774
+ units: z12.array(z12.object({ title: z12.string(), body: z12.string() })).optional()
739
775
  });
740
- var ParticipantSchema = z11.object({
741
- kind: z11.enum(["human", "agent"]),
742
- id: z11.string()
776
+ var ParticipantSchema = z12.object({
777
+ kind: z12.enum(["human", "agent"]),
778
+ id: z12.string()
743
779
  });
744
- var TransformSchema = z11.enum([
780
+ var TransformSchema = z12.enum([
745
781
  "structure",
746
782
  // shape intent into an answer contract; pick channel/urgency — broker `ask`, `select` shapes, `points`
747
783
  "request_more",
@@ -757,13 +793,13 @@ var TransformSchema = z11.enum([
757
793
  "summarize"
758
794
  // reduce volume, keep decision value — 30-turn cap, spoken briefing
759
795
  ]);
760
- var VisualSchema = z11.object({
761
- url: z11.string().url(),
762
- label: z11.string().optional()
796
+ var VisualSchema = z12.object({
797
+ url: z12.string().url(),
798
+ label: z12.string().optional()
763
799
  });
764
- var NotifyLevelSchema = z11.enum(["inbox", "push", "banner", "call"]);
765
- var SelectShapeSchema = z11.enum(["one", "many", "rank", "confirm", "text"]);
766
- var ReceiptEventSchema = z11.enum([
800
+ var NotifyLevelSchema = z12.enum(["inbox", "push", "banner", "call"]);
801
+ var SelectShapeSchema = z12.enum(["one", "many", "rank", "confirm", "text"]);
802
+ var ReceiptEventSchema = z12.enum([
767
803
  "delivered",
768
804
  // the bundle reached the recipient at some level
769
805
  "seen",
@@ -793,47 +829,47 @@ var ReceiptEventSchema = z11.enum([
793
829
  // be rewound by a writer that forgot to advance it.
794
830
  "restarted"
795
831
  ]);
796
- var AttentionSchema = z11.object({
832
+ var AttentionSchema = z12.object({
797
833
  urgency: NotifyLevelSchema,
798
834
  /** The required answer shape, or null for a plain notify that asks nothing back. */
799
835
  select: SelectShapeSchema.nullable(),
800
836
  /** Coverage contract (#396) — points the answer must address; null = none declared. */
801
- points: z11.array(z11.string()).nullable(),
837
+ points: z12.array(z12.string()).nullable(),
802
838
  /** Whether the ask blocks the sender — what lets arbitration escalate it on silence. */
803
- blocking: z11.boolean(),
839
+ blocking: z12.boolean(),
804
840
  /** Reserved (docs/model/model.md lists it): a response deadline. No row column yet — a later Phase 2
805
841
  * slice wires it; optional so today's rows/callers project cleanly. */
806
- deadline: z11.string().datetime().nullable().optional()
842
+ deadline: z12.string().datetime().nullable().optional()
807
843
  });
808
- var NotifyRequestFields = z11.object({
844
+ var NotifyRequestFields = z12.object({
809
845
  /** Plaintext message content. Present on the plaintext path (today's shape);
810
846
  * ABSENT on the E2EE path, where the sealed `envelope` below carries it. The
811
847
  * superRefine at the bottom enforces exactly one of the two. */
812
848
  context: ContextSchema.optional(),
813
- options: z11.array(OptionSchema.omit({ id: true }).extend({ label: z11.string().trim().min(1).max(1e3) }).strict()).min(OPTIONS_MIN).max(OPTIONS_MAX).optional().describe(
849
+ options: z12.array(OptionSchema.omit({ id: true }).extend({ label: z12.string().trim().min(1).max(1e3) }).strict()).min(OPTIONS_MIN).max(OPTIONS_MAX).optional().describe(
814
850
  "The choices, in order \u2014 required when select is 'one'/'many'/'rank', omitted otherwise. Ids are assigned automatically by position ('1', '2', \u2026); the user's answer references them as optionId(s)."
815
851
  ),
816
- points: z11.array(z11.string().min(1)).optional().describe(
852
+ points: z12.array(z12.string().min(1)).optional().describe(
817
853
  "The distinct things you need answered, each a short phrase \u2014 on a call the broker keeps the conversation going until each is addressed, and the reply reports which were covered, so a half-answer is never silently returned as final. Omit for single-part asks."
818
854
  ),
819
- visuals: z11.array(VisualSchema).optional().describe(
855
+ visuals: z12.array(VisualSchema).optional().describe(
820
856
  "Images attached to the message itself \u2014 context for the whole question (a screenshot, a chart). For a preview on one selectable choice, use that option's `html`/`image` instead."
821
857
  ),
822
858
  /** Git repo the agent is working in ("owner/name"). Local MCP fills this from the checkout — omit unless overriding. */
823
- repo: z11.string().optional(),
859
+ repo: z12.string().optional(),
824
860
  /** Git branch the agent is on. Local MCP fills this from the checkout — omit unless overriding. */
825
- branch: z11.string().optional(),
861
+ branch: z12.string().optional(),
826
862
  /** Continue an existing conversation — the id of any notification in it (its root
827
863
  * is the conversation's identity). Omitted = start a new conversation. Renamed
828
864
  * from `parentId` (2026-08-03): one linkage system, the parent; the API edge
829
865
  * still accepts the old name from older clients. */
830
- parentId: z11.string().uuid().optional(),
866
+ parentId: z12.string().uuid().optional(),
831
867
  /** The durable outcome this contact advances. Optional during the notification-to-Work
832
868
  * migration; when present, a blocking ask creates a DecisionNeed for this Work. */
833
- workId: z11.string().uuid().optional(),
869
+ workId: z12.string().uuid().optional(),
834
870
  /** Target Goal scope. During staged migration this is accepted by the shared contract but
835
871
  * target delivery activation remains model-gated; workId and goalId are mutually exclusive. */
836
- goalId: z11.string().uuid().optional(),
872
+ goalId: z12.string().uuid().optional(),
837
873
  urgency: NotifyLevelSchema.default("inbox").describe(
838
874
  "The level you're requesting \u2014 the user's account permissions + session mode can lower it. 'inbox' (default) = sits silently in the inbox for the user to get to. 'push' = a quiet passive push (lands in Notification Center, no sound) \u2014 a gentle heads-up. 'banner' = a time-sensitive banner/lock-screen push with sound (a 'paige') they tap to open \u2014 use when you need them soon-ish but it's not worth ringing them. 'call' = rings the user's phone now (a CallKit voice call) \u2014 use only when you genuinely need them in the moment (blocked and waiting, time-sensitive). context.title is what they see on the banner/ring, so make it specific."
839
875
  ),
@@ -841,7 +877,7 @@ var NotifyRequestFields = z11.object({
841
877
  * visible and marks it needs_input. Renamed from the old `parentId` (2026-08-03)
842
878
  * when `parentId` became the conversation handle: `parentId` says WHERE, this
843
879
  * says HOW. */
844
- clarifies: z11.string().optional(),
880
+ clarifies: z12.string().optional(),
845
881
  select: SelectShapeSchema.optional().describe(
846
882
  "How the user answers \u2014 required on the fully-shaped form, pick the shape that fits the question: 'one' = pick one option, 'many' = pick several, 'rank' = pick & order (each needs `options`); 'confirm' = yes/no or approve/deny; 'text' = free-form reply only (status updates, open questions). 'confirm' and 'text' take no options. Omit only when sending the simplified `ask` form \u2014 the broker picks the shape."
847
883
  ),
@@ -855,20 +891,20 @@ var NotifyRequestFields = z11.object({
855
891
  // (docs/brain/broker/agenda-design.md) — not by a wire cap the agent has to pre-summarize under.
856
892
  // Owner, 2026-07-28: "our actual limitation on how long something is to the user should
857
893
  // come from the broker splitting and summarizing." The cap that remains is a size guard.
858
- ask: z11.string().min(1).max(1e4).optional().describe(
894
+ ask: z12.string().min(1).max(1e4).optional().describe(
859
895
  'SIMPLIFIED FORM \u2014 state in plain prose what you need to learn from the user and why it matters now (e.g. "I need to know whether to deploy the auth fix \u2014 tests are green, staging verified"). Write as much as the situation needs (up to 10k characters) \u2014 Paigy breaks it into topics and reads it back a few sentences at a time; do NOT pre-summarize it into one line. Paigy derives the title, answer shape, options, and delivery channel for you. Mutually exclusive with context/select/options \u2014 send one form or the other.'
860
896
  ),
861
- needs: z11.array(z11.string().min(1)).optional().describe(
897
+ needs: z12.array(z12.string().min(1)).optional().describe(
862
898
  "With `ask` only: the distinct things you need answered when the ask is multi-part \u2014 becomes the coverage contract (`points`), so a half-answer is never silently final."
863
899
  ),
864
- urgencyHint: z11.enum(["whenever", "soon", "now"]).optional().describe(
900
+ urgencyHint: z12.enum(["whenever", "soon", "now"]).optional().describe(
865
901
  "With `ask` only: how urgently you need the answer \u2014 'whenever' (inbox), 'soon' (worth a heads-up), 'now' (you're blocked this minute). A hint, not a command: the user's settings still have the final word."
866
902
  ),
867
903
  /** #575: the ONE self-report that replaces urgencyHint + blocking — what happens
868
904
  * to the agent's work while it waits. Normalized server-side into those two
869
905
  * fields (normalizeWaiting) so everything downstream is untouched; explicit
870
906
  * urgencyHint/blocking win when both are sent. */
871
- waiting: z11.enum(["none", "soft", "hard"]).optional().describe(
907
+ waiting: z12.enum(["none", "soft", "hard"]).optional().describe(
872
908
  "With `ask`: what happens to your work while you wait. 'none' = you're just informing the user. 'soft' = you'd like an answer but can keep working. 'hard' = you are stopped until they answer (reaches them urgently and escalates to a real phone call if unanswered). Replaces urgencyHint + blocking \u2014 send this one field."
873
909
  ),
874
910
  /** Δ9b (#895): HOLD this claim so the sender can correct the plan before anyone is
@@ -876,98 +912,98 @@ var NotifyRequestFields = z11.object({
876
912
  * holding by default would charge every quiet claim that minute before any agent could
877
913
  * correct anything. Ignored for `waiting: 'hard'`: a blocking ask rings on what we have,
878
914
  * and the enrichment can still land mid-call (#781 re-plans the unspoken tail). */
879
- confirm: z11.boolean().optional().describe(
915
+ confirm: z12.boolean().optional().describe(
880
916
  "Hold this one so you can correct the plan before the user is interrupted. The response comes back with `held: true` and the plan; POST the confirm route to release it (with options/visuals/urgency corrections, or nothing at all). If you never do, it is announced anyway a couple of minutes later. Ignored when waiting is 'hard'."
881
917
  ),
882
918
  /** #575: a RELAY of the user's explicitly stated preference, never the agent's
883
919
  * choice. Outranks waiting in both directions: 'call' rings even for a
884
920
  * waiting:'none' "call me when it's done"; 'message' never rings even for
885
921
  * waiting:'hard'. */
886
- channel: z11.enum(["call", "message"]).optional().describe(
922
+ channel: z12.enum(["call", "message"]).optional().describe(
887
923
  "Only if the user explicitly said how to reach them \u2014 'call me' \u2192 'call', 'just message/text me' \u2192 'message'. Omit otherwise; Paigy picks."
888
924
  ),
889
- confirmStyle: z11.enum(["yesno", "approve"]).default("yesno").describe(
925
+ confirmStyle: z12.enum(["yesno", "approve"]).default("yesno").describe(
890
926
  "Labels for a select:'confirm' paige \u2014 'yesno' (Yes/No) or 'approve' (Approve/Deny). Ignored unless select is 'confirm'."
891
927
  ),
892
- blocking: z11.boolean().default(false).describe(
928
+ blocking: z12.boolean().default(false).describe(
893
929
  "Set true when real downstream work is stuck behind this specific decision \u2014 you can't make meaningful progress until it's answered. This is the real signal for how urgently the user should be reached; it's what the premier use case (an agent that stays unblocked instead of going idle) depends on. Independent of `urgency`: a `banner`-level question can still be `blocking` (something IS stuck, just not time-critical enough to ring for immediately) \u2014 if it goes unanswered a while, Paigy escalates it to a real call using this flag rather than guessing from how many other things happen to be pending. Leave false for anything you could work around, defer, or where other useful work exists meanwhile."
894
930
  )
895
931
  });
896
932
  var NotifyRequestSchema = NotifyRequestFields.superRefine((r, ctx) => {
897
- if (r.workId && r.goalId) ctx.addIssue({ code: z11.ZodIssueCode.custom, path: ["goalId"], message: "pass goalId or workId, not both" });
933
+ if (r.workId && r.goalId) ctx.addIssue({ code: z12.ZodIssueCode.custom, path: ["goalId"], message: "pass goalId or workId, not both" });
898
934
  if (r.ask !== void 0) {
899
935
  for (const f of ["context", "select", "points"]) {
900
936
  if (r[f] !== void 0)
901
- ctx.addIssue({ code: z11.ZodIssueCode.custom, path: [f], message: `the simplified \`ask\` form takes no ${f} \u2014 the broker derives the answer shape from your prose. Drop ${f} and say it in \`ask\` instead ("should I\u2026" for approve/deny, "which of these\u2026" for a pick), passing \`options\` when you're offering concrete alternatives.` });
937
+ ctx.addIssue({ code: z12.ZodIssueCode.custom, path: [f], message: `the simplified \`ask\` form takes no ${f} \u2014 the broker derives the answer shape from your prose. Drop ${f} and say it in \`ask\` instead ("should I\u2026" for approve/deny, "which of these\u2026" for a pick), passing \`options\` when you're offering concrete alternatives.` });
902
938
  }
903
939
  return;
904
940
  }
905
941
  if (r.needs !== void 0 || r.urgencyHint !== void 0)
906
- ctx.addIssue({ code: z11.ZodIssueCode.custom, path: ["needs"], message: "needs/urgencyHint belong to the simplified `ask` form \u2014 with a shaped request use points/urgency" });
942
+ ctx.addIssue({ code: z12.ZodIssueCode.custom, path: ["needs"], message: "needs/urgencyHint belong to the simplified `ask` form \u2014 with a shaped request use points/urgency" });
907
943
  if (!r.context)
908
- ctx.addIssue({ code: z11.ZodIssueCode.custom, path: ["context"], message: "context is required (plaintext path)" });
944
+ ctx.addIssue({ code: z12.ZodIssueCode.custom, path: ["context"], message: "context is required (plaintext path)" });
909
945
  if (!r.select)
910
- ctx.addIssue({ code: z11.ZodIssueCode.custom, path: ["select"], message: "select is required on the shaped form" });
946
+ ctx.addIssue({ code: z12.ZodIssueCode.custom, path: ["select"], message: "select is required on the shaped form" });
911
947
  const needsOptions = r.select === "one" || r.select === "many" || r.select === "rank";
912
948
  if (needsOptions && !r.options?.length)
913
- ctx.addIssue({ code: z11.ZodIssueCode.custom, path: ["options"], message: `select:'${r.select}' requires options` });
949
+ ctx.addIssue({ code: z12.ZodIssueCode.custom, path: ["options"], message: `select:'${r.select}' requires options` });
914
950
  if (!needsOptions && r.options?.length)
915
- ctx.addIssue({ code: z11.ZodIssueCode.custom, path: ["options"], message: `select:'${r.select}' takes no options` });
951
+ ctx.addIssue({ code: z12.ZodIssueCode.custom, path: ["options"], message: `select:'${r.select}' takes no options` });
916
952
  });
917
- var NotifyStatusSchema = z11.enum(["pending", "answered", "ignored"]);
918
- var AgentStateSchema = z11.enum(["idle", "in_progress", "completed", "needs_input"]);
919
- var TurnSchema = z11.object({
920
- prompt: z11.string(),
921
- reply: z11.string()
953
+ var NotifyStatusSchema = z12.enum(["pending", "answered", "ignored"]);
954
+ var AgentStateSchema = z12.enum(["idle", "in_progress", "completed", "needs_input"]);
955
+ var TurnSchema = z12.object({
956
+ prompt: z12.string(),
957
+ reply: z12.string()
922
958
  });
923
- var UserAnswerSchema = z11.discriminatedUnion("kind", [
924
- z11.object({ kind: z11.literal("option"), optionId: z11.string(), label: z11.string().optional() }),
925
- z11.object({ kind: z11.literal("text"), text: z11.string() }),
926
- z11.object({ kind: z11.literal("ignored") }),
927
- z11.object({ kind: z11.literal("multi"), optionIds: z11.array(z11.string()), labels: z11.array(z11.string()).optional() }),
928
- z11.object({ kind: z11.literal("ranked"), optionIds: z11.array(z11.string()), labels: z11.array(z11.string()).optional() }),
929
- z11.object({ kind: z11.literal("clarify"), chunks: z11.array(z11.string()).min(1) }),
930
- z11.object({ kind: z11.literal("confirm"), approved: z11.boolean() }),
931
- z11.object({ kind: z11.literal("turns"), turns: z11.array(TurnSchema).min(1) }),
959
+ var UserAnswerSchema = z12.discriminatedUnion("kind", [
960
+ z12.object({ kind: z12.literal("option"), optionId: z12.string(), label: z12.string().optional() }),
961
+ z12.object({ kind: z12.literal("text"), text: z12.string() }),
962
+ z12.object({ kind: z12.literal("ignored") }),
963
+ z12.object({ kind: z12.literal("multi"), optionIds: z12.array(z12.string()), labels: z12.array(z12.string()).optional() }),
964
+ z12.object({ kind: z12.literal("ranked"), optionIds: z12.array(z12.string()), labels: z12.array(z12.string()).optional() }),
965
+ z12.object({ kind: z12.literal("clarify"), chunks: z12.array(z12.string()).min(1) }),
966
+ z12.object({ kind: z12.literal("confirm"), approved: z12.boolean() }),
967
+ z12.object({ kind: z12.literal("turns"), turns: z12.array(TurnSchema).min(1) }),
932
968
  /** An auto-answer derived from the user's PAST decisions (docs/brain/broker/precedent-design.md §2):
933
969
  * delivered through the same settle/await path as a human answer, carrying the judge's
934
970
  * derivation and the precedent ids it grew from. Always paired with a visible trail
935
971
  * card the user can reply to — the broker never overrides the user. */
936
- z11.object({ kind: z11.literal("precedent"), answer: z11.string(), derivation: z11.string(), sources: z11.array(z11.string()).min(1) })
972
+ z12.object({ kind: z12.literal("precedent"), answer: z12.string(), derivation: z12.string(), sources: z12.array(z12.string()).min(1) })
937
973
  ]);
938
- var IntentSchema = z11.object({
974
+ var IntentSchema = z12.object({
939
975
  // The full vocabulary the bot's mapper emits (mapper.INTENT_KINDS) — the schema lagged
940
976
  // it by two ("detail", "feedback"), and because the settle handler parsed the array
941
977
  // all-or-nothing, ONE feedback act silently dropped EVERY intent on the call,
942
978
  // questions included. Found auditing five calls' stored feedback, 2026-08-01.
943
- kind: z11.enum(["defer", "delegate", "channel", "question", "detail", "feedback", "command", "control"]),
944
- detail: z11.string(),
979
+ kind: z12.enum(["defer", "delegate", "channel", "question", "detail", "feedback", "command", "control"]),
980
+ detail: z12.string(),
945
981
  /** Defer only: seconds until the callback the caller asked for, when something upstream
946
982
  * already read the time. Nothing sets it today (#397 documented an MCP parser that was
947
983
  * never written) — the API reads the defer's `detail` itself with `notes/when.ts`
948
984
  * (`parseDelay`, #1292), and a value here simply wins over that reading. */
949
- dueInSeconds: z11.number().int().positive().optional(),
985
+ dueInSeconds: z12.number().int().positive().optional(),
950
986
  /** Feedback only (#812): WHICH failure the complaint names — typed by the mapper that
951
987
  * already read the utterance, so `signals.kind` stops defaulting to
952
988
  * 'other' on every row. A table that records that something was wrong and nothing
953
989
  * about what cannot answer "is the bot looping less this week?". */
954
- fault: z11.enum(["loop", "unanswered", "overridden", "misheard", "slow", "other"]).optional()
990
+ fault: z12.enum(["loop", "unanswered", "overridden", "misheard", "slow", "other"]).optional()
955
991
  });
956
- var RideAlongSchema = z11.object({
992
+ var RideAlongSchema = z12.object({
957
993
  /** The note this came from — assign/clarify/close it through /api/notes/:id. */
958
- noteId: z11.string(),
994
+ noteId: z12.string(),
959
995
  /** What to do, in the owner's own words (the note's headline). Never model-rewritten. */
960
- text: z11.string(),
996
+ text: z12.string(),
961
997
  /** The thread to report back on, when the note was dispatched over the request rail. */
962
- parentId: z11.string().nullable()
998
+ parentId: z12.string().nullable()
963
999
  });
964
- var AwaitItemSchema = z11.discriminatedUnion("type", [
965
- z11.object({
966
- type: z11.literal("reply"),
967
- parentId: z11.string(),
968
- notificationId: z11.string(),
969
- workId: z11.string().uuid().optional(),
970
- decisionId: z11.string().uuid().optional(),
1000
+ var AwaitItemSchema = z12.discriminatedUnion("type", [
1001
+ z12.object({
1002
+ type: z12.literal("reply"),
1003
+ parentId: z12.string(),
1004
+ notificationId: z12.string(),
1005
+ workId: z12.string().uuid().optional(),
1006
+ decisionId: z12.string().uuid().optional(),
971
1007
  answer: UserAnswerSchema,
972
1008
  /** WHAT THE AGENT CANNOT KNOW FROM THE FIELDS BESIDE IT (owner, 2026-09-04, issue
973
1009
  * #1537). One line, built from the record: the ask and the caller's reply VERBATIM,
@@ -977,111 +1013,126 @@ var AwaitItemSchema = z11.discriminatedUnion("type", [
977
1013
  * "call me back after you merge" in their own words decides for itself what to do,
978
1014
  * and now knows exactly which call to make. Absent when either half is missing —
979
1015
  * a sentence with a hole in it is worse than no sentence. */
980
- note: z11.string().optional(),
1016
+ note: z12.string().optional(),
981
1017
  /** The call record rendered for THIS agent (`docs/brain/voice/record-design.md`): the words the
982
1018
  * shaped answer was mapped from, filtered to its own claims. There is no second list
983
1019
  * of labels beside it — the acts went 2026-09-04 and `intents` went with them (owner,
984
1020
  * 2026-09-04): the agent reads the sentence and decides. */
985
- transcript: z11.string().optional(),
1021
+ transcript: z12.string().optional(),
986
1022
  /** Coverage report (#396), when the ask declared `points`: which of them this
987
1023
  * answer addressed. Missing points = re-ask or proceed knowingly partial. */
988
- covered: z11.array(z11.string()).optional(),
1024
+ covered: z12.array(z12.string()).optional(),
989
1025
  /** Ride-alongs (RideAlongSchema) — pending work for you, attached to the moment you
990
1026
  * became free. Only `reply` and `idle` carry it: those are the two outcomes that
991
1027
  * END a wait. `remind`, `superseded` and `turn` are mid-flight, and handing an
992
1028
  * agent a side-quest while it is still holding the line is how the main thing gets
993
1029
  * dropped. Absent/empty = nothing owed. */
994
- also: z11.array(RideAlongSchema).optional()
1030
+ also: z12.array(RideAlongSchema).optional()
995
1031
  }),
996
- z11.object({
997
- type: z11.literal("remind"),
998
- parentId: z11.string(),
999
- notificationId: z11.string(),
1000
- remindAt: z11.string().datetime({ offset: true }),
1032
+ z12.object({
1033
+ type: z12.literal("remind"),
1034
+ parentId: z12.string(),
1035
+ notificationId: z12.string(),
1036
+ remindAt: z12.string().datetime({ offset: true }),
1001
1037
  /** Seconds until remindAt, server-computed — pass straight to ScheduleWakeup. */
1002
- remindInSeconds: z11.number()
1038
+ remindInSeconds: z12.number()
1003
1039
  }),
1004
1040
  /** The awaited ask was REPLACED by a newer notification on its thread (e.g. a
1005
1041
  * post-feedback revision, #633) — the user will never answer this id. Stop
1006
1042
  * awaiting it; the live ask is the thread's newest turn (await that one, or
1007
1043
  * re-orient via contact({})). */
1008
- z11.object({
1009
- type: z11.literal("superseded"),
1010
- parentId: z11.string(),
1011
- notificationId: z11.string()
1044
+ z12.object({
1045
+ type: z12.literal("superseded"),
1046
+ parentId: z12.string(),
1047
+ notificationId: z12.string()
1012
1048
  }),
1013
1049
  /** A LIVE call's turn, streamed as it lands (#783). PROVISIONAL: the user can still
1014
1050
  * revise any of these until the final reply arrives — partial = intelligence,
1015
1051
  * settled = authorization. Use it to PREPARE (fetch, draft, warm), never to act
1016
1052
  * irreversibly. If `acts` carries a question aimed at you and you know the answer,
1017
1053
  * contact on the same thread right away — the caller hears it on the same call. */
1018
- z11.object({
1019
- type: z11.literal("partial"),
1020
- notificationId: z11.string(),
1021
- inFlight: z11.literal(true),
1022
- turn: z11.object({
1023
- idx: z11.number(),
1024
- prompt: z11.string(),
1025
- reply: z11.string(),
1026
- acts: z11.array(IntentSchema).nullable().optional()
1054
+ z12.object({
1055
+ type: z12.literal("partial"),
1056
+ notificationId: z12.string(),
1057
+ inFlight: z12.literal(true),
1058
+ turn: z12.object({
1059
+ idx: z12.number(),
1060
+ prompt: z12.string(),
1061
+ reply: z12.string(),
1062
+ acts: z12.array(IntentSchema).nullable().optional()
1027
1063
  })
1028
1064
  }),
1029
- z11.object({
1030
- type: z11.literal("idle"),
1031
- also: z11.array(RideAlongSchema).optional(),
1065
+ z12.object({
1066
+ type: z12.literal("idle"),
1067
+ also: z12.array(RideAlongSchema).optional(),
1032
1068
  /** Is a call live for this agent's user right now? The SDK polls the partial stream
1033
1069
  * (#783) between idle ticks ONLY while this is not `false` — a partial can only exist
1034
1070
  * during a live call, and polling for one on a banner/message was a wasted HTTP call +
1035
1071
  * 3 queries on every idle tick of every waiting agent (~80% of all traffic at scale).
1036
1072
  * Absent = an older API → the SDK keeps polling, exactly as before. */
1037
- inFlight: z11.boolean().optional()
1073
+ inFlight: z12.boolean().optional()
1038
1074
  })
1039
1075
  ]);
1040
- var VoiceKeySchema = z11.enum(["rachel", "george", "jessica", "brian", "lily"]);
1041
- var AgendaTurnSchema = z11.object({
1076
+ var VoiceKeySchema = z12.enum(["rachel", "george", "jessica", "brian", "lily"]);
1077
+ var AgendaTurnSchema = z12.object({
1042
1078
  /** THE TURN'S IDENTITY (the first-sentence stream, 2026-09-09): the brain call that wrote
1043
1079
  * it and its place in that reply — `<brainCallId>:<index>`, with `:p` on the first
1044
1080
  * sentence a re-plan publishes ahead of the rest. A turn is spoken once, by this id: the
1045
1081
  * completion of a streamed re-plan carries the published sentence again, and the walk
1046
1082
  * drops what it already said by identity, never by the API's guess of what was polled.
1047
1083
  * Absent on plans nothing streams (a ring plan, a floor). */
1048
- id: z11.string().optional(),
1084
+ id: z12.string().optional(),
1049
1085
  /** Twin coverage (#1089): sibling claim ids this asking turn's answer ALSO settles —
1050
1086
  * the planner declares duplicates instead of asking them twice. */
1051
- coveredIds: z11.array(z11.string()).optional(),
1087
+ coveredIds: z12.array(z12.string()).optional(),
1052
1088
  /** The spoken sentences of the turn, in order. No count: how long a turn is is the brain's call
1053
1089
  * (owner, 2026-09-25), and a count here refused whole plans. */
1054
- info: z11.array(z11.string().min(1)).default([]),
1090
+ info: z12.array(z12.string().min(1)).default([]),
1055
1091
  /** THE ID OF EACH SENTENCE, when the plan names them (turns.md): a talker message's sentences are its
1056
1092
  * `info`, one piece each, and `units[i]` is the id the bot's line receipt carries for `info[i]`
1057
1093
  * (`<cycle>:<key>:<n>`), so what was heard is known per sentence. Absent on every other turn. */
1058
- units: z11.array(z11.string().min(1)).optional(),
1059
- question: z11.string().min(1).nullable(),
1094
+ units: z12.array(z12.string().min(1)).optional(),
1095
+ question: z12.string().min(1).nullable(),
1060
1096
  /** True on the one turn carrying the agent's own declared question. */
1061
- asks: z11.boolean().optional(),
1097
+ asks: z12.boolean().optional(),
1062
1098
  /** The claim this turn belongs to (#781) — the RETURN identity: answers route by it.
1063
1099
  * Absent on a single-claim plan (the session's own claim) and on shared context turns,
1064
1100
  * which route nothing. */
1065
- claimId: z11.string().optional(),
1101
+ claimId: z12.string().optional(),
1066
1102
  /** The claim's voice key (#462) — the OUTBOUND identity, audible who-is-asking. */
1067
- voice: z11.string().optional(),
1103
+ voice: z12.string().optional(),
1068
1104
  /** The claim's AGENT NAME (#838) — the spoken identity. A voice alone doesn't say
1069
1105
  * whose request this is: an item that folded in from another agent arrived as a bare
1070
1106
  * non-sequitur ("First real production sign-in is yours to make whenever you want.")
1071
1107
  * and the owner answered "What?". The bot names the agent before its first turn. */
1072
- agent: z11.string().optional(),
1108
+ agent: z12.string().optional(),
1073
1109
  /** The claim's agent by ID — the pairing's connection id (`notifications.token_id`), the
1074
1110
  * same id a face is minted from. A name is not an identity: two pairings may be called
1075
1111
  * "Claude", and a name cannot be joined on. The record's entries carry it (`agent_id`)
1076
1112
  * so "who said that" survives the call, and it rides PER TURN because a coalesced call
1077
1113
  * speaks for several agents — the turn is the only place that knows which. */
1078
- agentId: z11.string().optional(),
1114
+ agentId: z12.string().optional(),
1079
1115
  /** ITS QUESTION IS ON THE TABLE (#3292): a talker line about a question the person owes. The walk tells
1080
1116
  * the phone (`asking`, so the agenda goes gold and its options show) without treating the line as a
1081
1117
  * question turn — the talker owns re-asking and the waits, so `question` stays null. */
1082
- onTable: z11.boolean().optional(),
1118
+ onTable: z12.boolean().optional(),
1119
+ /** THE CARRIED ITEM THIS LINE TELLS (Goal 2a1e50eb, owner 2026-10-14: "Build the whole design") — a
1120
+ * request the Call carries that asks NOTHING: a report, a progress note, another agent's waiting news.
1121
+ * Its request Entry id, so the phone can make that agenda row the current one while it is read
1122
+ * (`telling` on the `turn` topic, `docs/clients/app/walk/design.md` §11).
1123
+ *
1124
+ * A FIELD OF ITS OWN, NEVER `claimId`: the claim is the RETURN identity — answers route by it and the
1125
+ * record tags the line with it (`workId`) — and an answer must never route to an Entry that asks
1126
+ * nothing. Absent on a turn speaking for a question (`claimId` says that) and on one speaking for no
1127
+ * carried item at all (an opener, a sign-off, Paigy's own line). */
1128
+ telling: z12.string().optional(),
1129
+ /** PAIGY'S OWN LINE (owner, 2026-10-15; calls ed2cbdce, ad50ad25): a turn that speaks for no item -- an
1130
+ * opener, a sign-off, a reply about nothing an agent asked or told -- is recorded as Paigy's, not as the
1131
+ * agent that rang. Absent on every turn that speaks for an item (`agentId` names whose), and on plans
1132
+ * from before it: a bot that does not know it records the ringing agent, as before. */
1133
+ speaksFor: z12.literal("paigy").optional(),
1083
1134
  select: SelectShapeSchema.optional(),
1084
- options: z11.array(OptionSchema.omit({ id: true })).optional(),
1135
+ options: z12.array(OptionSchema.omit({ id: true })).optional(),
1085
1136
  /* `pace` STOOD HERE (#826). A turn could carry seconds and the model chose them. The walk
1086
1137
  paces itself now — a short beat between the sentences of a turn, the longer one at its end
1087
1138
  (owner, 2026-09-30: "remove the bot deciding pace") — and it does that where the words are
@@ -1090,58 +1141,58 @@ var AgendaTurnSchema = z11.object({
1090
1141
  /** Whether the walk WAITS for an answer before moving on. Absent = derived as today
1091
1142
  * (a question blocks, context flows). blocking:false on a question = ask and move
1092
1143
  * on, the claim stays pending; blocking:true on context = hold for a reply. */
1093
- blocking: z11.boolean().optional(),
1144
+ blocking: z12.boolean().optional(),
1094
1145
  /** SPOKEN ONLY IF THEY SAY NOTHING (owner, 2026-10-01, call 812de935: "you're gonna re-ask, but it
1095
1146
  * shouldn't be the same words … more like, hey, are you still there, or are you able to answer, or
1096
1147
  * would you need more information"). The walk holds this turn out of its queue; at the queue's end it
1097
1148
  * listens for the last word, and only if that listen is silent is this turn said and asked. If they
1098
1149
  * speak, it is dropped and their words are taken like any reply. */
1099
- ifSilent: z11.boolean().optional()
1150
+ ifSilent: z12.boolean().optional()
1100
1151
  });
1101
1152
  var CLAIM_STALE_MS = 30 * 6e4;
1102
- var CallQuestionSchema = z11.object({
1103
- id: z11.string(),
1104
- entryId: z11.string(),
1105
- title: z11.string(),
1106
- state: z11.enum(["open", "answered"]),
1107
- answer: z11.string().nullable(),
1153
+ var CallQuestionSchema = z12.object({
1154
+ id: z12.string(),
1155
+ entryId: z12.string(),
1156
+ title: z12.string(),
1157
+ state: z12.enum(["open", "answered"]),
1158
+ answer: z12.string().nullable(),
1108
1159
  /** WHO ASKED IT (owner, 2026-09-23, Goal a345e906: each agenda row wears its agent's face) — the
1109
1160
  * request Entry's author, as the same three facts the item's own `tokenId`/`name`/`voice`
1110
1161
  * carry for the call's one agent, so the phone draws it with the same seed. Absent when the
1111
1162
  * author is not an agent this account holds (unpaired since, or a person). */
1112
- agent: z11.object({ tokenId: z11.string(), name: z11.string(), voice: VoiceKeySchema.optional() }).optional(),
1163
+ agent: z12.object({ tokenId: z12.string(), name: z12.string(), voice: VoiceKeySchema.optional() }).optional(),
1113
1164
  /** ITS OPTIONS, WHEN THERE IS SOMETHING TO SEE (owner, 2026-09-25: "Yes, add it"): the options
1114
1165
  * its need offers, exactly as its own card carries them, present only when one of them has a
1115
1166
  * preview (`html` or `image`). The call screen opens them from the agenda row, so a preview is
1116
1167
  * never re-sent as a second card to be seen mid-call. Words-only options are `choices`. */
1117
- options: z11.array(OptionSchema).optional(),
1168
+ options: z12.array(OptionSchema).optional(),
1118
1169
  /** ITS OPTIONS WHEN THEY ARE WORDS (owner, 2026-10-02, on a call: "whenever there are pre-made
1119
1170
  * options … now for a checklist, we should also show them on the screen"; design C, 2026-10-08):
1120
1171
  * numbered chips above the call's controls, so a checklist is never only something read aloud. A
1121
1172
  * field of its own so `options` keeps meaning "previews": a phone on an older bundle opens the
1122
1173
  * preview layout for any `options`, and must see exactly what it did. */
1123
- choices: z11.array(OptionSchema).optional(),
1174
+ choices: z12.array(OptionSchema).optional(),
1124
1175
  /** HOW MANY MAY BE PICKED, beside its `choices`: one, any (`many`) or an order (`rank`). */
1125
- select: z11.enum(["one", "many", "rank"]).optional()
1176
+ select: z12.enum(["one", "many", "rank"]).optional()
1126
1177
  });
1127
- var InboxItemSchema = z11.object({
1128
- id: z11.string(),
1129
- tokenId: z11.string().optional(),
1178
+ var InboxItemSchema = z12.object({
1179
+ id: z12.string(),
1180
+ tokenId: z12.string().optional(),
1130
1181
  status: NotifyStatusSchema,
1131
1182
  context: ContextSchema,
1132
- options: z11.array(OptionSchema).optional(),
1183
+ options: z12.array(OptionSchema).optional(),
1133
1184
  /** The ask's declared coverage points (#396), when the agent sent them. */
1134
- points: z11.array(z11.string()).optional(),
1185
+ points: z12.array(z12.string()).optional(),
1135
1186
  /** Does this claim want an ANSWER, or is it telling you something? Written per row from
1136
1187
  * `requestAsks` — the agent's own declaration, not a guess. `false` is what earns a card
1137
1188
  * its acknowledge affordance: without it a status update offers a text box and a dismiss,
1138
1189
  * and neither of those is "got it" (owner, 2026-08-10). */
1139
- asks: z11.boolean().optional(),
1190
+ asks: z12.boolean().optional(),
1140
1191
  /** When a live process last pulsed for this row's agent — the liveness input for
1141
1192
  * "working requires a pulse" (#928): the list said "Working…" from agent_state alone
1142
1193
  * while the party called the same dead claim stalled. Absent = no token/no data,
1143
1194
  * which must never CLAIM stalled. */
1144
- lastSeenAt: z11.string().optional(),
1195
+ lastSeenAt: z12.string().optional(),
1145
1196
  /** WHEN THE AGENT LAST SAID ANYTHING ABOUT THIS CLAIM — the newest `agent_state` row in
1146
1197
  * the `notification_events` ledger (trigger-written since 20260621010000, so every row a
1147
1198
  * user can see has one). The age input for `CLAIM_STALE_MS`, and it has to be this rather
@@ -1151,7 +1202,7 @@ var InboxItemSchema = z11.object({
1151
1202
  * work. Reading the row's birth as the claim's age brands that "No update in 8h" the
1152
1203
  * instant the agent picks it up (#997). Absent = pre-trigger row; fall back to
1153
1204
  * `createdAt`. */
1154
- agentStateAt: z11.string().datetime().optional(),
1205
+ agentStateAt: z12.string().datetime().optional(),
1155
1206
  /** THE QUESTIONS A CALL CARRIES — the call screen's agenda spine (docs/clients/app/walk/design.md §11, owner
1156
1207
  * 2026-09-22). One per DecisionNeed on the Call, in the Call's order, answered or open (a
1157
1208
  * superseded or cancelled need is no longer a question anyone is asked). Present only on a
@@ -1165,40 +1216,40 @@ var InboxItemSchema = z11.object({
1165
1216
  * `turn` topic (`asking`, `settled`), because the bot never sees a DecisionNeed id. `title` is
1166
1217
  * the card's own concise heading; `answer` the accepted answer in words, null while open. It
1167
1218
  * REPLACED `agenda` (turns), which nothing ever filled. */
1168
- questions: z11.array(CallQuestionSchema).optional(),
1219
+ questions: z12.array(CallQuestionSchema).optional(),
1169
1220
  /** The same call carrying order, including request Entries with no DecisionNeed as reports.
1170
1221
  * Additive: questions stays decision-only for every other surface and older bundles. */
1171
- callItems: z11.array(CallQuestionSchema.extend({ state: z11.enum(["open", "answered", "report"]) })).optional(),
1172
- visuals: z11.array(VisualSchema).optional(),
1222
+ callItems: z12.array(CallQuestionSchema.extend({ state: z12.enum(["open", "answered", "report"]), acknowledged: z12.boolean().optional() })).optional(),
1223
+ visuals: z12.array(VisualSchema).optional(),
1173
1224
  /** The connected agent's name (the single pairing name — user-typed, or the
1174
1225
  * agent's suggestion, or a default silly name). */
1175
- name: z11.string(),
1226
+ name: z12.string(),
1176
1227
  /** The pairing's assigned voice (#462); absent = the default voice. */
1177
1228
  voice: VoiceKeySchema.optional(),
1178
- repo: z11.string().optional(),
1179
- branch: z11.string().optional(),
1180
- createdAt: z11.string().datetime(),
1181
- snoozedUntil: z11.string().datetime().optional(),
1229
+ repo: z12.string().optional(),
1230
+ branch: z12.string().optional(),
1231
+ createdAt: z12.string().datetime(),
1232
+ snoozedUntil: z12.string().datetime().optional(),
1182
1233
  agentState: AgentStateSchema.default("idle"),
1183
1234
  /** Whose action the item is waiting on: "you" = an agent asked you (the default,
1184
1235
  * every agent→user notification); "agent" = you sent a request and it's awaiting the
1185
1236
  * agent (held in the inbox until the agent replies on the thread). */
1186
- turn: z11.enum(["you", "agent"]).default("you"),
1237
+ turn: z12.enum(["you", "agent"]).default("you"),
1187
1238
  /** Hard error reason on an awaiting request (turn="agent") — the wake failed to reach
1188
1239
  * the agent (provider-agnostic; set server-side). Absent = no hard error. Drives the inbox
1189
1240
  * error badge + Retry. */
1190
- error: z11.string().optional(),
1241
+ error: z12.string().optional(),
1191
1242
  /** WHEN THIS AGENT WORK WENT QUIET (turn="agent"), by the one rule (`coldSince`: three days
1192
1243
  * with nothing said), or absent while it is not stalled. The inbox's stalled badge reads
1193
1244
  * this and nothing else (2026-09-23: a 3-minute age rule badged every live Goal stalled,
1194
1245
  * and "dismiss the stalled ones" cancelled 37 pieces of live work). */
1195
- cold: z11.string().datetime().optional(),
1196
- clarifies: z11.string().optional(),
1246
+ cold: z12.string().datetime().optional(),
1247
+ clarifies: z12.string().optional(),
1197
1248
  /** THIS CARD'S QUESTION IS ON A LIVE CALL (owner, 2026-09-24: "Mark it while the call is
1198
1249
  * live"). Present only while an open Call Delivery carries the card's request Entry — read
1199
1250
  * off the same open list the card came from, so it clears when the Call does. A card is the
1200
1251
  * backup for a call not taken; while the call has it, the call is where it is answered. */
1201
- onCall: z11.literal(true).optional(),
1252
+ onCall: z12.literal(true).optional(),
1202
1253
  /** THE RING, ON THE ITEM (docs/clients/app/walk/design.md §12 §17, #2251): the last ring on this card was
1203
1254
  * declined, and what the ladder will do next — read off the cron's own row, never computed
1204
1255
  * on the phone. Present only while a `declined` receipt stands on the card's last Call.
@@ -1208,31 +1259,46 @@ var InboxItemSchema = z11.object({
1208
1259
  * It replaced `gaveUp` (deleted 2026-09-22): "the ladder spent" was a boolean the projection
1209
1260
  * never set, and it is `nextRingAt === null` here — the party's *Missed you* (`party/dress.ts`)
1210
1261
  * and the roster's `unreached` read `declinedAt`, and stand while it does. */
1211
- ring: z11.object({
1212
- declinedAt: z11.string().datetime(),
1213
- anchorAt: z11.string().datetime(),
1214
- nextRingAt: z11.string().datetime().nullable(),
1215
- step: z11.number().int()
1262
+ ring: z12.object({
1263
+ declinedAt: z12.string().datetime(),
1264
+ anchorAt: z12.string().datetime(),
1265
+ nextRingAt: z12.string().datetime().nullable(),
1266
+ step: z12.number().int()
1216
1267
  }).optional(),
1217
1268
  /** Why this arrived the way it did, read back off the delivery receipt (`notify/why.ts`).
1218
1269
  * Absent for anything never delivered through a push, and for older rows written before
1219
1270
  * the reason was recorded. Deliberately a debug affordance, shown small (owner,
1220
1271
  * 2026-08-07) — its real job is to give "this didn't need a call" something to be
1221
1272
  * feedback ABOUT. */
1222
- why: z11.object({
1273
+ why: z12.object({
1223
1274
  asked: NotifyLevelSchema,
1224
1275
  got: NotifyLevelSchema,
1225
- because: z11.enum(["unresponsive", "dismissed", "not_permitted", "silent", "coalesced", "agent_capped", "unplanned", "learned_raise"]).optional(),
1226
- line: z11.string()
1276
+ because: z12.enum(["unresponsive", "dismissed", "not_permitted", "silent", "coalesced", "agent_capped", "unplanned", "learned_raise"]).optional(),
1277
+ line: z12.string()
1227
1278
  }).optional(),
1228
- select: z11.enum(["one", "many", "rank", "confirm", "text"]).default("one"),
1229
- confirmStyle: z11.enum(["yesno", "approve"]).default("yesno").describe(
1279
+ select: z12.enum(["one", "many", "rank", "confirm", "text"]).default("one"),
1280
+ confirmStyle: z12.enum(["yesno", "approve"]).default("yesno").describe(
1230
1281
  "Labels for a select:'confirm' paige \u2014 'yesno' (Yes/No) or 'approve' (Approve/Deny). Ignored unless select is 'confirm'."
1231
1282
  ),
1232
1283
  /** Real downstream work is stuck behind this one — set by the agent, independent of
1233
1284
  * urgency (see the main README's "premier use case" + docs/delivery/notify/states.md). Drives the
1234
1285
  * inbox's blocking badge and the extra confirm step before dismissing it. */
1235
- blocking: z11.boolean().default(false),
1286
+ blocking: z12.boolean().default(false),
1287
+ /** WHAT FREED THIS QUESTION (owner, 2026-10-16, Goal 2383ef14: "we don't really show the question
1288
+ * at the top until the question it could reply to with is resolved. And then we show it again
1289
+ * with the context of the other thing that was resolved"; asked how it should carry that, "The
1290
+ * answer above it"). A question they answered with a question of their own waits for theirs
1291
+ * (`private.ask_back`) and drops out of the front while it waits; when it comes back, the card
1292
+ * draws their question and the answer it got ABOVE the ask, as one card. Absent on a question
1293
+ * nothing ever held back. */
1294
+ freedBy: z12.object({
1295
+ questionId: z12.string(),
1296
+ asked: z12.string(),
1297
+ answer: z12.string(),
1298
+ answeredAt: z12.string(),
1299
+ /** The answer in ten words, when the talker wrote one beside it. */
1300
+ summary: z12.string().optional()
1301
+ }).optional(),
1236
1302
  /** The user's locked-in answer; present only for replied items (GET /api/replied/:id). */
1237
1303
  answer: UserAnswerSchema.optional(),
1238
1304
  /** THE TARGET FACTS A CARD RENDERS (#1796 point 5, 2026-09-11): the Delivery it is a view of,
@@ -1240,17 +1306,17 @@ var InboxItemSchema = z11.object({
1240
1306
  * for a request that asks nothing), whether its content is sealed, and that Goal's state. The
1241
1307
  * answer writer (`POST /api/entries`) and the disposition (`close_delivery`) take their ids from
1242
1308
  * here. The server projects it (`apps/api/src/inbox/project.ts`); a client never builds it. */
1243
- communication: z11.object({
1244
- deliveryId: z11.string(),
1245
- kind: z11.enum(["notification", "call"]),
1246
- entryId: z11.string(),
1247
- goalIds: z11.array(z11.string()),
1248
- decisionNeedId: z11.string().optional(),
1249
- sealed: z11.boolean(),
1250
- goalState: z11.string().optional(),
1309
+ communication: z12.object({
1310
+ deliveryId: z12.string(),
1311
+ kind: z12.enum(["notification", "call"]),
1312
+ entryId: z12.string(),
1313
+ goalIds: z12.array(z12.string()),
1314
+ decisionNeedId: z12.string().optional(),
1315
+ sealed: z12.boolean(),
1316
+ goalState: z12.string().optional(),
1251
1317
  /** THAT GOAL'S NAME (#2416) — what Activity's row is headed by, since a row there is one Goal
1252
1318
  * and the cards it holds sit behind it. Stamped by the same read as `goalState`. */
1253
- goalTitle: z11.string().optional()
1319
+ goalTitle: z12.string().optional()
1254
1320
  }).optional(),
1255
1321
  /** WHAT THIS CARD IS, IN TWELVE CHARACTERS (#3019) — the hash of every other field on it, stamped
1256
1322
  * by the one read that serves the open list (`apps/api/src/inbox/project.ts` `inboxFor`). It is
@@ -1262,27 +1328,27 @@ var InboxItemSchema = z11.object({
1262
1328
  * own moves (its Goal's state and name, how cold the work behind it has gone, whether a ring is
1263
1329
  * live). Optional, so a fixture, the demo and the archive lens need not spell one, and a card
1264
1330
  * with no rev is simply always re-sent. */
1265
- rev: z11.string().optional()
1331
+ rev: z12.string().optional()
1266
1332
  });
1267
1333
  var APNS_TOKEN_RE = /^[0-9a-fA-F]{64}$/;
1268
- var PushTokenSchema = z11.object({
1269
- voipToken: z11.string().min(1).optional(),
1270
- alertToken: z11.string().min(1).optional(),
1271
- fcmToken: z11.string().min(1).optional(),
1272
- platform: z11.enum(["ios", "android"])
1334
+ var PushTokenSchema = z12.object({
1335
+ voipToken: z12.string().min(1).optional(),
1336
+ alertToken: z12.string().min(1).optional(),
1337
+ fcmToken: z12.string().min(1).optional(),
1338
+ platform: z12.enum(["ios", "android"])
1273
1339
  }).superRefine((v, ctx) => {
1274
1340
  if (v.platform !== "ios") return;
1275
1341
  for (const field of ["voipToken", "alertToken"]) {
1276
1342
  const token = v[field];
1277
1343
  if (token === void 0 || APNS_TOKEN_RE.test(token)) continue;
1278
1344
  ctx.addIssue({
1279
- code: z11.ZodIssueCode.custom,
1345
+ code: z12.ZodIssueCode.custom,
1280
1346
  path: [field],
1281
1347
  message: `not an APNs device token (want 64 hex chars, got ${token.length})`
1282
1348
  });
1283
1349
  }
1284
1350
  });
1285
- var MissedCallSchema = z11.enum([
1351
+ var MissedCallSchema = z12.enum([
1286
1352
  "retry_10m",
1287
1353
  "retry_30m",
1288
1354
  "retry_60m",
@@ -1294,31 +1360,31 @@ var MissedCallSchema = z11.enum([
1294
1360
  ]);
1295
1361
  var clock = (h) => h === 0 ? "midnight" : h === 12 ? "noon" : h < 12 ? `${h} am` : `${h - 12} pm`;
1296
1362
  var QUIET = ` Nothing rings from ${clock(NIGHT.from)} to ${clock(NIGHT.to)} your time; the count waits for morning.`;
1297
- var BrokerTuningSchema = z11.object({
1363
+ var BrokerTuningSchema = z12.object({
1298
1364
  /** 'none' = skip the spoken ack after a mapped answer (power users find it slow). */
1299
- ackVerbosity: z11.enum(["normal", "none"]).optional(),
1365
+ ackVerbosity: z12.enum(["normal", "none"]).optional(),
1300
1366
  /** How readily the mapper asks its one clarification: 'low' = only when truly
1301
1367
  * uninterpretable, 'high' = whenever not fully certain. */
1302
- clarifyEagerness: z11.enum(["low", "normal", "high"]).optional(),
1368
+ clarifyEagerness: z12.enum(["low", "normal", "high"]).optional(),
1303
1369
  /** The user's own shorthand: when they say `say`, they mean `mean`. */
1304
- phrasebook: z11.array(z11.object({ say: z11.string().min(1).max(60), mean: z11.string().min(1).max(120) })).max(24).optional(),
1370
+ phrasebook: z12.array(z12.object({ say: z12.string().min(1).max(60), mean: z12.string().min(1).max(120) })).max(24).optional(),
1305
1371
  /** The language calls are PLANNED in, when the account has chosen one (#1272). Absent —
1306
1372
  * which is every account today — means the agent's own words decide, per ask: a call
1307
1373
  * about an English ask opens in English. This is the only thing that overrides that,
1308
1374
  * and a live caller who switches language mid-call still outranks it (broker/lang.ts).
1309
1375
  * Set per user (no UI yet), like `voiceTuning`. */
1310
- language: z11.enum(["en", "es"]).optional()
1376
+ language: z12.enum(["en", "es"]).optional()
1311
1377
  });
1312
- var UserSettingsSchema = z11.object({
1313
- permissions: z11.object({
1314
- call: z11.boolean(),
1315
- banner: z11.boolean(),
1316
- push: z11.boolean()
1378
+ var UserSettingsSchema = z12.object({
1379
+ permissions: z12.object({
1380
+ call: z12.boolean(),
1381
+ banner: z12.boolean(),
1382
+ push: z12.boolean()
1317
1383
  }),
1318
1384
  /** LockedIn / Default / DateNight on screen; the stored words are unchanged on purpose —
1319
1385
  * they are an enum on a live column across every account, and the rename is a rename of
1320
1386
  * what people read (owner, 2026-09-30). */
1321
- sessionMode: z11.enum(["default", "all_calls", "silent"]),
1387
+ sessionMode: z12.enum(["default", "all_calls", "silent"]),
1322
1388
  /** `silentPush` lived here until #2813 and is now GONE, field and column both. It was kept as an
1323
1389
  * optional long after DateNight stopped reading it, on the theory that a phone on an older
1324
1390
  * bundle PATCHing the whole settings object would be REFUSED for sending a key we had stopped
@@ -1327,7 +1393,7 @@ var UserSettingsSchema = z11.object({
1327
1393
  * an old bundle's `silentPush` is accepted and ignored. Worth remembering before keeping the
1328
1394
  * next dead field for the same reason. */
1329
1395
  /** Opt-in (default false) to using your content to improve Paigy and train models. */
1330
- improveConsent: z11.boolean(),
1396
+ improveConsent: z12.boolean(),
1331
1397
  missedCall: MissedCallSchema.default("backoff_standard"),
1332
1398
  /** Where voice audio is processed. 'hosted' (default) = Paigy's voice services
1333
1399
  * (ElevenLabs TTS, faster-whisper STT, the call bot); 'on_device' = the phone
@@ -1335,17 +1401,17 @@ var UserSettingsSchema = z11.object({
1335
1401
  * Optional, NOT defaulted: a stale client PATCHing the full settings object
1336
1402
  * must not silently reset this privacy choice. Absent = leave unchanged on
1337
1403
  * write, 'hosted' on read (see store.ts). */
1338
- voiceMode: z11.enum(["hosted", "on_device"]).optional(),
1404
+ voiceMode: z12.enum(["hosted", "on_device"]).optional(),
1339
1405
  /** Talk — after you answer, the next step is read aloud (docs/clients/app/walk/design.md §6). ALWAYS ON until
1340
1406
  * turned off (owner, 2026-09-18, #2249): a setting, not a per-walk toggle. Optional, NOT
1341
1407
  * defaulted, for the same reason `voiceMode` is: a stale client PATCHing the full settings
1342
1408
  * object must not silently turn it back on. Absent = leave unchanged on write, true on
1343
1409
  * read (see store.ts). */
1344
- talk: z11.boolean().optional(),
1410
+ talk: z12.boolean().optional(),
1345
1411
  /** CALL DIAGNOSTICS (owner, 2026-10-01): the call report carries each listen and the bot's own
1346
1412
  * load timings. SERVER-SET, no UI — on for every account that existed on 2026-10-01, off for
1347
1413
  * newer ones (migration 20261001132859). Read-only here: the settings PATCH never writes it. */
1348
- callDiagnostics: z11.boolean().optional(),
1414
+ callDiagnostics: z12.boolean().optional(),
1349
1415
  /** Per-user ring budget (#603): calls per rolling day before further calls
1350
1416
  * degrade to banner. Absent = the global default (25). A number, never a
1351
1417
  * bypass — every account keeps a ceiling. No UI; set per user for testing. */
@@ -1353,7 +1419,7 @@ var UserSettingsSchema = z11.object({
1353
1419
  * payload['tuning'] (e.g. { silence_s: 3.5 } — a longer pause window for a
1354
1420
  * slower speaker). No API-side semantics; the bot resolves each key with its
1355
1421
  * own defaults. Set per user (no UI yet); absent = bot defaults. */
1356
- voiceTuning: z11.record(z11.string(), z11.union([z11.number(), z11.string()])).optional(),
1422
+ voiceTuning: z12.record(z12.string(), z12.union([z12.number(), z12.string()])).optional(),
1357
1423
  /** The user's IANA timezone (e.g. "America/Bogota"), recorded by the app — it is the
1358
1424
  * only party that knows it. REMINDERS are why it exists: "remind me at ten" becomes
1359
1425
  * an absolute `due_at` only if we know whose ten. Optional and never defaulted, for
@@ -1362,70 +1428,70 @@ var UserSettingsSchema = z11.object({
1362
1428
  * that failure reads as the reminder rail being unreliable rather than as a missing
1363
1429
  * setting. Absent = a spoken time can't be landed, so the reminder rides the next
1364
1430
  * call — honest about what we know. */
1365
- timezone: z11.string().min(1).max(64).optional(),
1431
+ timezone: z12.string().min(1).max(64).optional(),
1366
1432
  /** Rung-2 broker tuning (#381). Optional and NOT defaulted, same stale-client
1367
1433
  * clobber guard as voiceMode: absent = leave unchanged on write. */
1368
1434
  broker: BrokerTuningSchema.optional()
1369
1435
  });
1370
- var GoalLatestSchema = z11.object({
1371
- from: z11.enum(["person", "agent"]),
1372
- said: z11.string(),
1373
- at: z11.string(),
1374
- entryId: z11.string(),
1436
+ var GoalLatestSchema = z12.object({
1437
+ from: z12.enum(["person", "agent"]),
1438
+ said: z12.string(),
1439
+ at: z12.string(),
1440
+ entryId: z12.string(),
1375
1441
  /** ITS SUMMARY IN AT MOST TEN WORDS (owner, 2026-10-08: "the same switch to the more summarized sources
1376
1442
  * at the work tab top level screen too"): what the talker or filer wrote on the Entry; absent when
1377
1443
  * none was. The Work row reads it before `said`. */
1378
- summary: z11.string().optional(),
1444
+ summary: z12.string().optional(),
1379
1445
  /** AN AGENT'S UPDATE OR QUESTION AS ITS UNITS' TITLES (owner, 2026-10-08: "send the 50 chars from the title
1380
1446
  * of each unit"): each at most 50 characters, in order; absent when it has none. */
1381
- titles: z11.array(z11.string()).optional(),
1447
+ titles: z12.array(z12.string()).optional(),
1382
1448
  /** A PROGRESS NOTE'S ONE POINT ("An agent's progress note -> maybe let's cap it at 200 chars"): the
1383
1449
  * update's own line, before its units; the row caps it at 200. Absent on anything else. */
1384
- line: z11.string().optional()
1450
+ line: z12.string().optional()
1385
1451
  });
1386
- var HistoryWorkSchema = z11.object({
1387
- id: z11.string(),
1388
- title: z11.string(),
1389
- state: z11.enum(["done", "cancelled"]),
1452
+ var HistoryWorkSchema = z12.object({
1453
+ id: z12.string(),
1454
+ title: z12.string(),
1455
+ state: z12.enum(["done", "cancelled"]),
1390
1456
  /** Who held it (`agent:<tokenId>` or `human:<userId>`). */
1391
- assignee: z11.string(),
1457
+ assignee: z12.string(),
1392
1458
  latest: GoalLatestSchema.nullable().optional()
1393
1459
  });
1394
- var HistoryEntrySchema = z11.union([
1395
- z11.object({ at: z11.string(), card: InboxItemSchema }),
1396
- z11.object({ at: z11.string(), work: HistoryWorkSchema })
1460
+ var HistoryEntrySchema = z12.union([
1461
+ z12.object({ at: z12.string(), card: InboxItemSchema }),
1462
+ z12.object({ at: z12.string(), work: HistoryWorkSchema })
1397
1463
  ]);
1398
- var HistoryPageSchema = z11.object({
1399
- entries: z11.array(HistoryEntrySchema),
1400
- next: z11.string().nullable()
1464
+ var HistoryPageSchema = z12.object({
1465
+ entries: z12.array(HistoryEntrySchema),
1466
+ next: z12.string().nullable()
1401
1467
  });
1402
1468
  var ACTIVITY_LINES = 2;
1403
1469
  var ACTIVITY_LINE_MAX = 80;
1404
- var AgentActivitySchema = z11.object({
1470
+ var AgentActivitySchema = z12.object({
1405
1471
  /** Oldest first, so the newest line is last — the one that replaces in place. */
1406
- lines: z11.array(z11.string().max(ACTIVITY_LINE_MAX)).max(ACTIVITY_LINES),
1472
+ lines: z12.array(z12.string().max(ACTIVITY_LINE_MAX)).max(ACTIVITY_LINES),
1407
1473
  /** When the harness observed this tail. Its own timestamp, not the heartbeat's: a beat
1408
1474
  * that carries an UNCHANGED tail must not make a stalled agent look like it just moved. */
1409
- at: z11.string().datetime()
1475
+ at: z12.string().datetime()
1410
1476
  });
1411
- var ConnectionSummarySchema = z11.object({
1477
+ var ConnectionSummarySchema = z12.object({
1412
1478
  /** The connection = the agent's token id (used to address a request). */
1413
- id: z11.string(),
1479
+ id: z12.string(),
1414
1480
  /** The credential kind: "device" = a paired machine (mint-only — it hosts and mints, it
1415
1481
  * never talks); "agent" = an identity that sends. The roster and devices surfaces split
1416
1482
  * on this. Optional/absent reads as "agent" (a row predating the kind column). See
1417
1483
  * docs/server/tokens/devices-vs-agents-design.md. */
1418
- kind: z11.enum(["device", "agent"]).optional(),
1484
+ kind: z12.enum(["device", "agent"]).optional(),
1419
1485
  /** For an agent, the token id of the DEVICE that minted it — so agents group under their
1420
1486
  * machine, and revoking a device cascades to them. Null on devices, and on unlinked
1421
1487
  * agents (phone-launched, provider-managed, or minted before the link existed). */
1422
- mintedByDevice: z11.string().nullable().optional(),
1423
- device: z11.string().nullable(),
1488
+ mintedByDevice: z12.string().nullable().optional(),
1489
+ device: z12.string().nullable(),
1424
1490
  /** The agent's display name (the single pairing name). */
1425
- name: z11.string(),
1491
+ name: z12.string(),
1426
1492
  /** For a managed connection, the provider key (e.g. "cma") that agentOrigin maps to a
1427
1493
  * label; null for a local connection. Sourced from the token's provider, not the name. */
1428
- provider: z11.string().nullable(),
1494
+ provider: z12.string().nullable(),
1429
1495
  /** The pairing's assigned voice (#462); null = the default voice. */
1430
1496
  voice: VoiceKeySchema.nullable(),
1431
1497
  /** The LOUDEST this agent may ever reach you — a ceiling on `NOTIFY_LADDER`, set by the
@@ -1436,34 +1502,34 @@ var ConnectionSummarySchema = z11.object({
1436
1502
  * every surface at once and outranks even `sessionMode: all_calls` — a mode the user
1437
1503
  * set once must not overrule a rule they set about one agent. */
1438
1504
  reach: NotifyLevelSchema.nullable().optional(),
1439
- createdAt: z11.string().datetime(),
1505
+ createdAt: z12.string().datetime(),
1440
1506
  /** Most recent notification on this connection, either direction. Null = no contact yet.
1441
1507
  * Drives the agents-page recency grouping (Today / This week / …). */
1442
- lastContactAt: z11.string().datetime().nullable(),
1508
+ lastContactAt: z12.string().datetime().nullable(),
1443
1509
  /** Last presence heartbeat from a running agent process (POST /api/presence) — the
1444
1510
  * desktop app while open. Null = never seen; stale = offline. */
1445
- lastSeenAt: z11.string().datetime().nullable().optional(),
1511
+ lastSeenAt: z12.string().datetime().nullable().optional(),
1446
1512
  /** WORKING, NOT JUST CONNECTED (owner, 2026-09-30): the last time the agent itself acted on one of
1447
1513
  * its Goals — wrote on one or recorded an operation (`tokens.last_worked_at`). Within
1448
1514
  * `WORKING_MS` it is working; otherwise it is connected but idle. Null = not seen working yet. */
1449
- lastWorkedAt: z11.string().datetime().nullable().optional(),
1515
+ lastWorkedAt: z12.string().datetime().nullable().optional(),
1450
1516
  /** The oldest of its Goals that is `ready` for it — work handed to it that nobody has started.
1451
1517
  * With no work of its own for `WORKING_MS`, an agent sitting on this is not taking its work. */
1452
- oldestReadyAt: z11.string().datetime().nullable().optional(),
1518
+ oldestReadyAt: z12.string().datetime().nullable().optional(),
1453
1519
  /** What a live desktop can run (docs/clients/desktop/companion.md §2.2), advertised on its heartbeat:
1454
1520
  * harness availabilities + granted workspaces — the option set the phone's
1455
1521
  * "new session" sheet offers. Absent for ordinary MCP agents. */
1456
- runtime: z11.object({
1522
+ runtime: z12.object({
1457
1523
  /** The @paigy/harness this host is running — a machine the self-update has not reached
1458
1524
  * shows its age here (`apps/desktop/src/update.ts`). */
1459
- version: z11.string().optional(),
1460
- harnesses: z11.array(z11.object({ name: z11.string(), label: z11.string(), status: z11.string(), models: z11.array(z11.string()).optional() })).optional(),
1461
- workspaces: z11.array(z11.string()).optional(),
1525
+ version: z12.string().optional(),
1526
+ harnesses: z12.array(z12.object({ name: z12.string(), label: z12.string(), status: z12.string(), models: z12.array(z12.string()).optional() })).optional(),
1527
+ workspaces: z12.array(z12.string()).optional(),
1462
1528
  /** THE GIT REPOS IN THOSE FOLDERS (2026-10-01, Goal 26982211): each granted folder that is a
1463
1529
  * repo, and each repo directly inside one, with its `origin` remote. A session started for
1464
1530
  * work on `mauurda/paigy` opens in that repo rather than the folder above it, where the repo's
1465
1531
  * own AGENTS.md is never read (`workspaceForRepo`). Absent on hosts that predate it. */
1466
- repos: z11.array(z11.object({ path: z11.string(), remote: z11.string() })).optional()
1532
+ repos: z12.array(z12.object({ path: z12.string(), remote: z12.string() })).optional()
1467
1533
  }).optional(),
1468
1534
  /** The tail of this agent's working log, when a harness is driving it — the agent page's
1469
1535
  * live strip. Absent for anything the desktop harness isn't running (a hatched identity
@@ -1472,145 +1538,145 @@ var ConnectionSummarySchema = z11.object({
1472
1538
  activity: AgentActivitySchema.optional(),
1473
1539
  /** True = a provider-managed agent running in the provider's cloud (e.g. Anthropic CMA);
1474
1540
  * false = a local MCP connection running on the user's computer (Claude Code/Codex/…). */
1475
- managed: z11.boolean()
1541
+ managed: z12.boolean()
1476
1542
  });
1477
- var LedgerItemSchema = z11.object({ id: z11.string(), parentId: z11.string(), title: z11.string(), createdAt: z11.string() });
1478
- var AgentLedgerSchema = z11.object({
1543
+ var LedgerItemSchema = z12.object({ id: z12.string(), parentId: z12.string(), title: z12.string(), createdAt: z12.string() });
1544
+ var AgentLedgerSchema = z12.object({
1479
1545
  /** Null when the agent has not named itself yet — never a placeholder (owner, 2026-10-01). */
1480
- agent: z11.object({ id: z11.string(), name: z11.string().nullable(), revokedAt: z11.string().nullable() }),
1546
+ agent: z12.object({ id: z12.string(), name: z12.string().nullable(), revokedAt: z12.string().nullable() }),
1481
1547
  /** Its own questions you have not answered. */
1482
- asks: z11.array(LedgerItemSchema),
1548
+ asks: z12.array(LedgerItemSchema),
1483
1549
  /** Its questions you answered that nobody acted on — still owed to somebody. */
1484
- answered: z11.array(LedgerItemSchema),
1550
+ answered: z12.array(LedgerItemSchema),
1485
1551
  /** Requests you sent it that it never took. */
1486
- requests: z11.array(LedgerItemSchema),
1487
- goals: z11.array(z11.object({ id: z11.string(), outcome: z11.string(), state: z11.string() })),
1488
- callbacks: z11.array(z11.object({ id: z11.string(), parentId: z11.string(), trigger: z11.string(), note: z11.string(), dueAt: z11.string().nullable() }))
1552
+ requests: z12.array(LedgerItemSchema),
1553
+ goals: z12.array(z12.object({ id: z12.string(), outcome: z12.string(), state: z12.string() })),
1554
+ callbacks: z12.array(z12.object({ id: z12.string(), parentId: z12.string(), trigger: z12.string(), note: z12.string(), dueAt: z12.string().nullable() }))
1489
1555
  });
1490
- var ReassignResultSchema = z11.object({
1491
- moved: z11.object({ asks: z11.number(), answered: z11.number(), requests: z11.number(), goals: z11.number(), callbacks: z11.number() }),
1492
- parentId: z11.string().nullable()
1556
+ var ReassignResultSchema = z12.object({
1557
+ moved: z12.object({ asks: z12.number(), answered: z12.number(), requests: z12.number(), goals: z12.number(), callbacks: z12.number() }),
1558
+ parentId: z12.string().nullable()
1493
1559
  });
1494
- var LessonStateSchema = z11.enum(["active", "proposed", "retired"]);
1495
- var LessonViewSchema = z11.object({
1496
- id: z11.string(),
1497
- text: z11.string(),
1560
+ var LessonStateSchema = z12.enum(["active", "proposed", "retired"]);
1561
+ var LessonViewSchema = z12.object({
1562
+ id: z12.string(),
1563
+ text: z12.string(),
1498
1564
  state: LessonStateSchema,
1499
1565
  /** The Goal it is scoped to; null = the whole account. */
1500
- scopeGoalId: z11.string().nullable(),
1501
- goalTitle: z11.string().nullable(),
1502
- version: z11.number(),
1503
- pinned: z11.boolean(),
1566
+ scopeGoalId: z12.string().nullable(),
1567
+ goalTitle: z12.string().nullable(),
1568
+ version: z12.number(),
1569
+ pinned: z12.boolean(),
1504
1570
  /** When the person last wrote its text themselves. */
1505
- editedAt: z11.string().nullable(),
1506
- createdAt: z11.string(),
1507
- updatedAt: z11.string(),
1571
+ editedAt: z12.string().nullable(),
1572
+ createdAt: z12.string(),
1573
+ updatedAt: z12.string(),
1508
1574
  /** The Entries it came from, oldest first; `words` is null when an Entry has none to show (sealed). */
1509
- sources: z11.array(z11.object({ entryId: z11.string(), words: z11.string().nullable(), at: z11.string() }))
1575
+ sources: z12.array(z12.object({ entryId: z12.string(), words: z12.string().nullable(), at: z12.string() }))
1510
1576
  });
1511
- var QueueQuestionSchema = z11.object({
1577
+ var QueueQuestionSchema = z12.object({
1512
1578
  /** The decision need's id — what an answer is accepted against. */
1513
- id: z11.string(),
1579
+ id: z12.string(),
1514
1580
  /** The words that were asked, from the request Entry that asked them. */
1515
- question: z11.string(),
1581
+ question: z12.string(),
1516
1582
  /** Where it was asked — which is where the ruling goes (`POST /api/entries`). Null only
1517
1583
  * for a need whose request Entry is carried by no interactive Delivery, which nothing
1518
1584
  * can answer. */
1519
- deliveryId: z11.string().nullable().default(null),
1585
+ deliveryId: z12.string().nullable().default(null),
1520
1586
  /** The Entry the ruling is about. */
1521
- aboutId: z11.string().nullable().default(null),
1587
+ aboutId: z12.string().nullable().default(null),
1522
1588
  /** Empty for a free-text question. */
1523
- options: z11.array(OptionSchema).default([]),
1524
- select: z11.enum(["one", "many", "rank", "confirm", "text"]).default("text"),
1525
- askedAt: z11.string(),
1589
+ options: z12.array(OptionSchema).default([]),
1590
+ select: z12.enum(["one", "many", "rank", "confirm", "text"]).default("text"),
1591
+ askedAt: z12.string(),
1526
1592
  /** Null while the question is open — which is how the page tells the two apart. */
1527
- answeredAt: z11.string().nullable().default(null),
1593
+ answeredAt: z12.string().nullable().default(null),
1528
1594
  /** The ruling in the person's own words, from the contribution that replied — not the
1529
1595
  * option id, which is not something anyone reads back. Null while it is open, and null
1530
1596
  * for a settled question whose reply carried nothing readable. */
1531
- answer: z11.string().nullable().default(null),
1597
+ answer: z12.string().nullable().default(null),
1532
1598
  /** The Goal this question belongs to — a step knows its Goal on its own, not only through
1533
1599
  * an `InboxItem`'s `communication.goalIds[0]` (docs/clients/app/walk/design.md §12 item 3).
1534
1600
  * READ BY `apps/client/src/walk/order.ts`, which stamps it onto every `WalkStep`: the walk's
1535
1601
  * order, its route, home's trees and the list of steps all take a step's Goal from here, so
1536
1602
  * this is the field they agree through rather than each re-deriving it from the row it
1537
1603
  * arrived under. Required because the API projects it on every need it sends. */
1538
- goalId: z11.string(),
1604
+ goalId: z12.string(),
1539
1605
  /** True only while an unmet START gate holds the Goal — a Goal that merely waits to
1540
1606
  * *finish* does not stop a person from answering (owner, 2026-09-16: "per need gate from
1541
1607
  * the API"; §4's dashed node). Not the same fact as `QueueItem.blocked`, which counts any
1542
1608
  * gate at all. */
1543
- blocked: z11.boolean().default(false)
1609
+ blocked: z12.boolean().default(false)
1544
1610
  });
1545
- var QueueReplySchema = z11.object({
1611
+ var QueueReplySchema = z12.object({
1546
1612
  /** The card this note was (`deliveryId:requestEntryId`, minted by the server like every card
1547
1613
  * id) — so the phone can tell a reply it just sent from one the queue already carries, and the
1548
1614
  * walk can name it in its zoom. */
1549
- id: z11.string(),
1615
+ id: z12.string(),
1550
1616
  /** The Goal the note is on. */
1551
- goalId: z11.string(),
1617
+ goalId: z12.string(),
1552
1618
  /** What the note said. */
1553
- note: z11.string(),
1619
+ note: z12.string(),
1554
1620
  /** Where it was carried — where a second reply goes (`POST /api/entries`, #2252). */
1555
- deliveryId: z11.string(),
1556
- requestEntryId: z11.string(),
1557
- askedAt: z11.string(),
1621
+ deliveryId: z12.string(),
1622
+ requestEntryId: z12.string(),
1623
+ askedAt: z12.string(),
1558
1624
  /** When the person last replied — the window's start. */
1559
- repliedAt: z11.string(),
1625
+ repliedAt: z12.string(),
1560
1626
  /** The person's latest words about it; null when there is nothing readable in them. */
1561
- reply: z11.string().nullable()
1627
+ reply: z12.string().nullable()
1562
1628
  });
1563
- var QueueItemSchema = z11.object({
1564
- id: z11.string(),
1629
+ var QueueItemSchema = z12.object({
1630
+ id: z12.string(),
1565
1631
  /** One-line headline — the first sentence of the outcome. */
1566
- title: z11.string(),
1632
+ title: z12.string(),
1567
1633
  /** The outcome in full, verbatim: the person's own words are what an assignee sees. */
1568
- intent: z11.string(),
1634
+ intent: z12.string(),
1569
1635
  /** `ready` | `active` | `waiting` | `done` | `cancelled`, straight off the Goal. */
1570
- state: z11.string(),
1636
+ state: z12.string(),
1571
1637
  /** Who holds it (a participant ref); null when nobody does yet. */
1572
- assignee: z11.string().nullable().default(null),
1638
+ assignee: z12.string().nullable().default(null),
1573
1639
  /** What the agent last said it was doing; null if it has said nothing. */
1574
- progress: z11.string().nullable().default(null),
1640
+ progress: z12.string().nullable().default(null),
1575
1641
  /** HOME'S LINE FOR THAT NOTE (owner, 2026-09-23): a few plain words one read wrote from `progress`,
1576
1642
  * served only while it was written for the current note. Null means show the Goal's name. */
1577
- progressLine: z11.string().nullable().optional(),
1578
- reviewPending: z11.boolean().default(false),
1579
- dueAt: z11.string().nullable().default(null),
1643
+ progressLine: z12.string().nullable().optional(),
1644
+ reviewPending: z12.boolean().default(false),
1645
+ dueAt: z12.string().nullable().default(null),
1580
1646
  /** WHEN ITS OWNER SAID DONE WHILE CHILDREN WERE OPEN (#2704): its own work is finished and it closes
1581
1647
  * with its last open child. Null otherwise; optional, so hand-built queues need not spell it. */
1582
- finishedAt: z11.string().nullable().optional(),
1648
+ finishedAt: z12.string().nullable().optional(),
1583
1649
  /** The Goal this one was opened under; null at the root. */
1584
- parentGoalId: z11.string().nullable().default(null),
1650
+ parentGoalId: z12.string().nullable().default(null),
1585
1651
  /** Goals opened under this one — only those the same list holds. */
1586
- childGoalIds: z11.array(z11.string()).default([]),
1652
+ childGoalIds: z12.array(z12.string()).default([]),
1587
1653
  /** Goals this one waits on (start or finish gates). */
1588
- dependencyGoalIds: z11.array(z11.string()).default([]),
1654
+ dependencyGoalIds: z12.array(z12.string()).default([]),
1589
1655
  /** True while any gate is on a Goal that is not done — the walk draws it dashed. */
1590
- blocked: z11.boolean().default(false),
1656
+ blocked: z12.boolean().default(false),
1591
1657
  /** Its questions: every OPEN one, and at most ten settled, newest settled first
1592
1658
  * (20260929133308) — the page decides which of them to show. NOT the whole set: `asked` and
1593
1659
  * `answered` are, and a settled one's words are a line (280 characters), its body read when the
1594
1660
  * question is opened. */
1595
- questions: z11.array(QueueQuestionSchema).default([]),
1661
+ questions: z12.array(QueueQuestionSchema).default([]),
1596
1662
  /** HOW MANY QUESTIONS THIS WORK HAS ASKED, and how many are answered — the Goal's own totals,
1597
1663
  * bounded at 100 server-side. A tally counted off `questions` is a wrong number that looks
1598
1664
  * right once the cap bites (`walk/trees.ts` `tallyOf`). Optional, and defaulted from the array
1599
1665
  * by the projection, so hand-built queues (fixtures, the demo) need not spell them. */
1600
- asked: z11.number().optional(),
1601
- answered: z11.number().optional(),
1666
+ asked: z12.number().optional(),
1667
+ answered: z12.number().optional(),
1602
1668
  /** Every note on it the person replied to (`QueueReplySchema`) — the page decides which to show.
1603
1669
  * Optional, not defaulted: absent is none, and every hand-built queue (fixtures, the demo) need
1604
1670
  * not spell an empty list. */
1605
- replies: z11.array(QueueReplySchema).optional(),
1671
+ replies: z12.array(QueueReplySchema).optional(),
1606
1672
  /** The repository or project identifier this Goal belongs to (#2280), null if untracked. */
1607
- repo: z11.string().nullable().optional(),
1608
- createdAt: z11.string(),
1609
- updatedAt: z11.string().nullable().default(null),
1673
+ repo: z12.string().nullable().optional(),
1674
+ createdAt: z12.string(),
1675
+ updatedAt: z12.string().nullable().default(null),
1610
1676
  /** When its owner last SAID something about it (the newest `progress` Entry: a contact update kept
1611
1677
  * as progress). `updatedAt` moves for reasons nobody chose — a
1612
1678
  * state recomputed, a review flag — so it cannot tell work in hand from work gone quiet. */
1613
- lastProgressAt: z11.string().nullable().optional(),
1679
+ lastProgressAt: z12.string().nullable().optional(),
1614
1680
  /** THE GOAL'S NEWEST WORD, FROM EITHER SIDE (owner, 2026-09-27): the newest Entry on it, of any
1615
1681
  * kind — what the person added ("Add to this"), their reply, the agent's ask or its progress
1616
1682
  * note. A progress note is an Entry, so this is already the newer of the two: the person's note
@@ -1629,7 +1695,7 @@ var QueueItemSchema = z11.object({
1629
1695
  * minute after the person speaks erases their instant from it, and the durable traces the client
1630
1696
  * can see (`replies`, `questions[].answeredAt`) miss a spontaneous note entirely — a `request`
1631
1697
  * Entry with no `about_id` is in neither. */
1632
- lastPersonAt: z11.string().nullable().optional(),
1698
+ lastPersonAt: z12.string().nullable().optional(),
1633
1699
  /** EACH SIDE'S NEWEST WORD IN THE LAST DAY (owner, 2026-10-13, the Work tab's order): the person's
1634
1700
  * (`yours`) and the agents' (`theirs`), each null when that side wrote nothing on it in 24 hours.
1635
1701
  * `latest` holds one Entry, so whichever side wrote first is hidden there; Work orders a Goal by
@@ -1647,40 +1713,40 @@ var QueueItemSchema = z11.object({
1647
1713
  * the row shows that no `updated_at` moves for (`active` lapsing, a dependency's state, a
1648
1714
  * sibling appearing in `childGoalIds`) cannot go unnoticed. Optional because a hand-built
1649
1715
  * queue (a fixture, the demo) spells none, and a row with no rev is simply always re-sent. */
1650
- rev: z11.string().optional()
1716
+ rev: z12.string().optional()
1651
1717
  });
1652
- var QueueDeltaSchema = z11.object({
1653
- ids: z11.array(z11.string()),
1654
- items: z11.array(QueueItemSchema)
1718
+ var QueueDeltaSchema = z12.object({
1719
+ ids: z12.array(z12.string()),
1720
+ items: z12.array(QueueItemSchema)
1655
1721
  });
1656
1722
  var COLD_AFTER_MS = 3 * 24 * 60 * 60 * 1e3;
1657
- var NoteSourceSchema = z11.enum(["app", "call"]);
1658
- var NoteStatusSchema = z11.enum(["open", "assigned", "in_progress", "done"]);
1659
- var NoteRepeatSchema = z11.enum(["once", "until_done"]);
1660
- var DecisionSchema = z11.object({
1661
- id: z11.string(),
1723
+ var NoteSourceSchema = z12.enum(["app", "call"]);
1724
+ var NoteStatusSchema = z12.enum(["open", "assigned", "in_progress", "done"]);
1725
+ var NoteRepeatSchema = z12.enum(["once", "until_done"]);
1726
+ var DecisionSchema = z12.object({
1727
+ id: z12.string(),
1662
1728
  /** The note this decision refines; null = recorded on a bare thread (the
1663
1729
  * extensibility seam — any conversation can accrue decisions). */
1664
- noteId: z11.string().nullable(),
1730
+ noteId: z12.string().nullable(),
1665
1731
  /** What was ambiguous — the broker's (or the user's own) question. */
1666
- question: z11.string(),
1732
+ question: z12.string(),
1667
1733
  /** The user's ruling; null while the question is open. */
1668
- answer: z11.string().nullable(),
1669
- decidedAt: z11.string().nullable(),
1670
- createdAt: z11.string()
1734
+ answer: z12.string().nullable(),
1735
+ decidedAt: z12.string().nullable(),
1736
+ createdAt: z12.string()
1671
1737
  });
1672
- var NoteSchema = z11.object({
1673
- id: z11.string(),
1738
+ var NoteSchema = z12.object({
1739
+ id: z12.string(),
1674
1740
  /** One-line headline (broker-titled; deterministic floor). */
1675
- title: z11.string(),
1741
+ title: z12.string(),
1676
1742
  /** The original intent, verbatim — assignees always see the user's own words. */
1677
- intent: z11.string(),
1743
+ intent: z12.string(),
1678
1744
  source: NoteSourceSchema,
1679
1745
  status: NoteStatusSchema,
1680
1746
  /** Who it was assigned to (a participant ref, 'agent:<tokenId>'); null = unassigned. */
1681
- assignee: z11.string().nullable(),
1747
+ assignee: z12.string().nullable(),
1682
1748
  /** The request thread minted at assignment; null until assigned. */
1683
- parentId: z11.string().nullable(),
1749
+ parentId: z12.string().nullable(),
1684
1750
  /** REMINDERS (docs/model/notes/reminders-design.md): the NOT-BEFORE this becomes eligible to ride a
1685
1751
  * call — never a deadline. It only ever comes from the user's own words, so when it
1686
1752
  * passes Paigy rings ONCE (#1293, owner 2026-08-26: a time said out loud is consent to
@@ -1689,100 +1755,100 @@ var NoteSchema = z11.object({
1689
1755
  // Defaulted, not required: a Note from an API deploy older than the reminders
1690
1756
  // migration has none of these, and the defaults ARE what it means — no not-before,
1691
1757
  // one ride, never ridden. Parsing must not fail across a rolling deploy.
1692
- dueAt: z11.string().nullable().default(null),
1758
+ dueAt: z12.string().nullable().default(null),
1693
1759
  repeat: NoteRepeatSchema.default("once"),
1694
1760
  /** How many calls have already carried it — the fatigue cap counts rides, not days. */
1695
- rides: z11.number().int().default(0),
1696
- lastRideAt: z11.string().nullable().default(null),
1697
- createdAt: z11.string()
1761
+ rides: z12.number().int().default(0),
1762
+ lastRideAt: z12.string().nullable().default(null),
1763
+ createdAt: z12.string()
1698
1764
  });
1699
- var DeliveryModeSchema = z11.enum(["poll", "self_hosted"]);
1700
- var RegisterDeliverySchema = z11.object({ mode: DeliveryModeSchema });
1701
- var OAuthStartSchema = z11.object({
1702
- provider: z11.enum(["cma"]),
1703
- returnTo: z11.string().min(1)
1765
+ var DeliveryModeSchema = z12.enum(["poll", "self_hosted"]);
1766
+ var RegisterDeliverySchema = z12.object({ mode: DeliveryModeSchema });
1767
+ var OAuthStartSchema = z12.object({
1768
+ provider: z12.enum(["cma"]),
1769
+ returnTo: z12.string().min(1)
1704
1770
  });
1705
- var DeliveryConfigSchema = z11.object({
1706
- tokenId: z11.string(),
1771
+ var DeliveryConfigSchema = z12.object({
1772
+ tokenId: z12.string(),
1707
1773
  mode: DeliveryModeSchema,
1708
1774
  /** null when the deployment has no anon key configured. `self_hosted` is then REFUSED
1709
1775
  * (503 `self_hosted_unavailable`) rather than registered, so a self_hosted config always
1710
1776
  * carries credentials; only a `poll` registration can come back with null here. */
1711
- realtime: z11.object({ url: z11.string(), anonKey: z11.string() }).nullable()
1777
+ realtime: z12.object({ url: z12.string(), anonKey: z12.string() }).nullable()
1712
1778
  });
1713
- var HostDecisionSchema = z11.object({
1779
+ var HostDecisionSchema = z12.object({
1714
1780
  /** The agent's token id: the row's `recipient`. */
1715
- agent: z11.string().uuid(),
1716
- decision: z11.enum(["stood_back", "took_over"]),
1781
+ agent: z12.string().uuid(),
1782
+ decision: z12.enum(["stood_back", "took_over"]),
1717
1783
  /** The work it was about: the Goal waiting on that agent next (`claimable` on its `contact({})` read). */
1718
- goalId: z11.string().uuid().nullable().optional(),
1784
+ goalId: z12.string().uuid().nullable().optional(),
1719
1785
  /** When the server last heard from the agent, as the host read it: the presence it stood back for. */
1720
- seenAt: z11.string().datetime().nullable().optional(),
1786
+ seenAt: z12.string().datetime().nullable().optional(),
1721
1787
  /** When that work last moved (`claimable.since` on an agent's `contact({})` read), the fact the bound is judged on. */
1722
- since: z11.string().datetime().nullable().optional(),
1788
+ since: z12.string().datetime().nullable().optional(),
1723
1789
  /** What the host said, in its log's own words: why it stood back, or what the take-over did. */
1724
- said: z11.string().max(300).optional()
1790
+ said: z12.string().max(300).optional()
1725
1791
  });
1726
- var WakeNudgeSchema = z11.object({
1727
- kind: z11.enum(["reply", "request", "callback"]),
1728
- notificationId: z11.string().optional(),
1729
- parentId: z11.string()
1792
+ var WakeNudgeSchema = z12.object({
1793
+ kind: z12.enum(["reply", "request", "callback"]),
1794
+ notificationId: z12.string().optional(),
1795
+ parentId: z12.string()
1730
1796
  });
1731
- var PairingStatusSchema = z11.enum(["pending", "approved", "denied", "expired"]);
1732
- var DeviceCodeSchema = z11.object({
1733
- device_code: z11.string(),
1734
- user_code: z11.string(),
1735
- verification_uri: z11.string().url(),
1736
- verification_uri_complete: z11.string().url(),
1737
- interval: z11.number(),
1738
- expires_in: z11.number()
1797
+ var PairingStatusSchema = z12.enum(["pending", "approved", "denied", "expired"]);
1798
+ var DeviceCodeSchema = z12.object({
1799
+ device_code: z12.string(),
1800
+ user_code: z12.string(),
1801
+ verification_uri: z12.string().url(),
1802
+ verification_uri_complete: z12.string().url(),
1803
+ interval: z12.number(),
1804
+ expires_in: z12.number()
1739
1805
  });
1740
- var DeviceInfoSchema = z11.object({
1741
- code: z11.string(),
1806
+ var DeviceInfoSchema = z12.object({
1807
+ code: z12.string(),
1742
1808
  /** The agent's suggested name (from /device/code) — shown on the approval screen,
1743
1809
  * pre-filling the name field the human can edit. */
1744
- name: z11.string(),
1810
+ name: z12.string(),
1745
1811
  /** @deprecated Legacy alias of `name` for the pre-#531 embedded bundle in App Store
1746
1812
  * build 35, whose DeviceFlow renders `info.agent.slice(0, 2)` — without this a FRESH
1747
1813
  * install crashes on the pairing screen on first launch, before the OTA lands
1748
1814
  * (seen live: PAIGY-5T, 2026-07-21). Remove once a newer binary is the floor. */
1749
- agent: z11.string().optional(),
1750
- device: z11.string().nullable(),
1815
+ agent: z12.string().optional(),
1816
+ device: z12.string().nullable(),
1751
1817
  status: PairingStatusSchema
1752
1818
  });
1753
- var DeviceTokenSchema = z11.object({
1754
- access_token: z11.string(),
1819
+ var DeviceTokenSchema = z12.object({
1820
+ access_token: z12.string(),
1755
1821
  /** The pairing's single name (user-typed at approval, the agent's suggestion, or
1756
1822
  * a default silly name). */
1757
- name: z11.string(),
1758
- device: z11.string().nullable(),
1823
+ name: z12.string(),
1824
+ device: z12.string().nullable(),
1759
1825
  /** The pairing's assigned voice, cached so the desktop can seed the SAME face the phone
1760
1826
  * draws — voice is the third ingredient of a hatchling's build (party/traits.ts). */
1761
- voice: z11.string().nullable().optional(),
1827
+ voice: z12.string().nullable().optional(),
1762
1828
  /** The token's server-side id — the face's COLOUR anchor, and the only seed ingredient
1763
1829
  * that survives a rename. Cached by the host's identity beat. */
1764
- token_id: z11.string().nullable().optional(),
1830
+ token_id: z12.string().nullable().optional(),
1765
1831
  /** WHERE this identity works — the folder a wake should land it in. Written by the host
1766
1832
  * at spawn and by `paigy-harness handoff` from a live terminal. Without it every wake
1767
1833
  * landed in the FIRST granted workspace and the agent rediscovered its own repo from
1768
1834
  * the thread each time (host.ts, live catch 2026-08-06 — prompt-papered until now). */
1769
- workspace: z11.string().nullable().optional(),
1835
+ workspace: z12.string().nullable().optional(),
1770
1836
  /** Local host recovery must preserve the launch's runtime and Paigy identity. */
1771
- harness: z11.enum(["claude", "codex", "agy"]).optional(),
1772
- session_id: z11.string().uuid().optional(),
1837
+ harness: z12.enum(["claude", "codex", "agy"]).optional(),
1838
+ session_id: z12.string().uuid().optional(),
1773
1839
  /** A conversation the host must not resume: its context is full, so every turn fails
1774
1840
  * ("Prompt is too long"). Written when a run hits it (`run.ts` `onFull`); the host skips a slot
1775
1841
  * whose resumable session is this one, so its Goals reach the dead-agent handoff instead of a
1776
1842
  * copy that types the person's words into a turn that cannot run (Calls, 2026-10-06). */
1777
- full_session: z11.string().optional(),
1778
- uik_pub: z11.string().nullable().optional()
1843
+ full_session: z12.string().optional(),
1844
+ uik_pub: z12.string().nullable().optional()
1779
1845
  });
1780
- var SupportRequestSchema = z11.object({
1781
- email: z11.string().email().max(320),
1782
- message: z11.string().trim().min(1).max(5e3),
1783
- name: z11.string().trim().max(120).optional()
1846
+ var SupportRequestSchema = z12.object({
1847
+ email: z12.string().email().max(320),
1848
+ message: z12.string().trim().min(1).max(5e3),
1849
+ name: z12.string().trim().max(120).optional()
1784
1850
  });
1785
- var NotificationFeedbackKindSchema = z11.enum([
1851
+ var NotificationFeedbackKindSchema = z12.enum([
1786
1852
  "break_down",
1787
1853
  // "This should be more than one ask — break it down."
1788
1854
  "regenerate_options",
@@ -1797,131 +1863,131 @@ var NotificationFeedbackKindSchema = z11.enum([
1797
1863
  // anything else — the note carries it.
1798
1864
  ]);
1799
1865
  var SlimOptionSchema = OptionSchema.omit({ html: true });
1800
- var QuestionRowSchema = z11.object({
1866
+ var QuestionRowSchema = z12.object({
1801
1867
  /** The card's id (`deliveryId:needId`, or `deliveryId:entryId` for an update), as the inbox mints it. */
1802
- id: z11.string(),
1803
- deliveryId: z11.string(),
1804
- entryId: z11.string(),
1868
+ id: z12.string(),
1869
+ deliveryId: z12.string(),
1870
+ entryId: z12.string(),
1805
1871
  /** The decision it waits on; null for an update, which asks nothing. */
1806
- needId: z11.string().nullable(),
1807
- goalIds: z11.array(z11.string()),
1872
+ needId: z12.string().nullable(),
1873
+ goalIds: z12.array(z12.string()),
1808
1874
  /** The name of the work it is about, when the read could word it. */
1809
- goalTitle: z11.string().optional(),
1810
- tokenId: z11.string().optional(),
1811
- name: z11.string(),
1812
- title: z11.string(),
1813
- body: z11.string(),
1814
- select: z11.enum(["one", "many", "rank", "confirm", "text"]),
1815
- options: z11.array(SlimOptionSchema),
1816
- hasPreview: z11.boolean(),
1817
- blocking: z11.boolean(),
1818
- askedAt: z11.string().datetime(),
1875
+ goalTitle: z12.string().optional(),
1876
+ tokenId: z12.string().optional(),
1877
+ name: z12.string(),
1878
+ title: z12.string(),
1879
+ body: z12.string(),
1880
+ select: z12.enum(["one", "many", "rank", "confirm", "text"]),
1881
+ options: z12.array(SlimOptionSchema),
1882
+ hasPreview: z12.boolean(),
1883
+ blocking: z12.boolean(),
1884
+ askedAt: z12.string().datetime(),
1819
1885
  ring: InboxItemSchema.shape.ring,
1820
- onCall: z11.literal(true).optional(),
1821
- sealed: z11.boolean()
1886
+ onCall: z12.literal(true).optional(),
1887
+ sealed: z12.boolean()
1822
1888
  });
1823
- var WorkStateSchema = z11.enum(["ready", "active", "waiting", "done", "cancelled"]);
1824
- var WorkRowSchema = z11.object({
1825
- id: z11.string(),
1826
- parentId: z11.string().nullable(),
1827
- title: z11.string(),
1889
+ var WorkStateSchema = z12.enum(["ready", "active", "waiting", "done", "cancelled"]);
1890
+ var WorkRowSchema = z12.object({
1891
+ id: z12.string(),
1892
+ parentId: z12.string().nullable(),
1893
+ title: z12.string(),
1828
1894
  /** Straight off the Goal. */
1829
1895
  state: WorkStateSchema,
1830
- owner: z11.string().nullable(),
1831
- revision: z11.number().int(),
1896
+ owner: z12.string().nullable(),
1897
+ revision: z12.number().int(),
1832
1898
  /** Open questions on it, counted to 100. */
1833
- waiting: z11.number().int(),
1899
+ waiting: z12.number().int(),
1834
1900
  /** Held by a gate on work that is not done. */
1835
- blocked: z11.boolean(),
1836
- lastProgressAt: z11.string().datetime().nullable(),
1901
+ blocked: z12.boolean(),
1902
+ lastProgressAt: z12.string().datetime().nullable(),
1837
1903
  /** The line written for its newest progress note, else that note's first words. */
1838
- line: z11.string().nullable(),
1904
+ line: z12.string().nullable(),
1839
1905
  /** Work directly under it, counted to 100; the list carries up to 12 of them. */
1840
- children: z11.number().int(),
1841
- createdAt: z11.string().datetime(),
1842
- updatedAt: z11.string().datetime(),
1906
+ children: z12.number().int(),
1907
+ createdAt: z12.string().datetime(),
1908
+ updatedAt: z12.string().datetime(),
1843
1909
  /** When anything at or under it last moved — the order the list is in. */
1844
- activeAt: z11.string().datetime(),
1910
+ activeAt: z12.string().datetime(),
1845
1911
  /** A sealed outcome has no title here; the work's page opens it. */
1846
- sealed: z11.boolean()
1912
+ sealed: z12.boolean()
1847
1913
  });
1848
1914
  var ComputerRowSchema = ConnectionSummarySchema.omit({ activity: true });
1849
1915
  var AgentRowSchema = ComputerRowSchema.extend({
1850
1916
  /** Open questions it is asking the person, over every open card; null when that read failed. */
1851
- asking: z11.number().int().nullable(),
1852
- oldestAskAt: z11.string().datetime().nullable(),
1917
+ asking: z12.number().int().nullable(),
1918
+ oldestAskAt: z12.string().datetime().nullable(),
1853
1919
  /** Up to three of the live Goals it holds, oldest first (the order it picks them up), and how
1854
1920
  * many in all among the account's 200 most recently active agent-held live Goals
1855
1921
  * (`agent_holds`); null when that read failed. */
1856
- holds: z11.array(z11.object({ id: z11.string(), title: z11.string() })).nullable(),
1857
- held: z11.number().int().nullable(),
1922
+ holds: z12.array(z12.object({ id: z12.string(), title: z12.string() })).nullable(),
1923
+ held: z12.number().int().nullable(),
1858
1924
  /** The earliest instant any Goal it holds went quiet, by the one rule (`coldSince`); null
1859
1925
  * while none has, or when that read failed. */
1860
- cold: z11.string().datetime().nullable(),
1926
+ cold: z12.string().datetime().nullable(),
1861
1927
  /** The newest line of its working log, and when the harness saw it. */
1862
- line: z11.string().nullable(),
1863
- lineAt: z11.string().datetime().nullable()
1928
+ line: z12.string().nullable(),
1929
+ lineAt: z12.string().datetime().nullable()
1864
1930
  });
1865
- var SnapshotSchema = z11.object({
1931
+ var SnapshotSchema = z12.object({
1866
1932
  /** The API's clock, taken before the first read: what a later delta will start from. */
1867
- at: z11.string().datetime(),
1868
- questions: z11.object({
1933
+ at: z12.string().datetime(),
1934
+ questions: z12.object({
1869
1935
  /** The newest 30 open cards, questions before updates. */
1870
- items: z11.array(QuestionRowSchema),
1936
+ items: z12.array(QuestionRowSchema),
1871
1937
  /** Every open question, and apart from them every update, and what was put off. */
1872
- total: z11.number().int(),
1873
- updates: z11.number().int(),
1874
- putOff: z11.number().int()
1938
+ total: z12.number().int(),
1939
+ updates: z12.number().int(),
1940
+ putOff: z12.number().int()
1875
1941
  }).nullable(),
1876
- agents: z11.object({
1942
+ agents: z12.object({
1877
1943
  /** Up to 60, most recently seen first. */
1878
- items: z11.array(AgentRowSchema),
1879
- more: z11.boolean()
1944
+ items: z12.array(AgentRowSchema),
1945
+ more: z12.boolean()
1880
1946
  }).nullable(),
1881
- work: z11.object({
1947
+ work: z12.object({
1882
1948
  /** The 60 most recently active roots, each followed by up to 12 children; 240 rows at most. */
1883
- items: z11.array(WorkRowSchema),
1949
+ items: z12.array(WorkRowSchema),
1884
1950
  /** How much work is behind each of the Work tab's four filters, each counted to 100, read with
1885
1951
  * the rows. `work_list` (20260928023533) owns the predicates: Live is `ready`, `active` or
1886
1952
  * `waiting`; Waiting on you is live work with an open question or an unmet gate; Not started
1887
1953
  * is `ready`; Done is `done` or `cancelled`. */
1888
- counts: z11.object({ live: z11.number().int(), waiting: z11.number().int(), notStarted: z11.number().int(), done: z11.number().int() })
1954
+ counts: z12.object({ live: z12.number().int(), waiting: z12.number().int(), notStarted: z12.number().int(), done: z12.number().int() })
1889
1955
  }).nullable(),
1890
- you: z11.object({
1956
+ you: z12.object({
1891
1957
  settings: UserSettingsSchema,
1892
- callable: z11.boolean(),
1958
+ callable: z12.boolean(),
1893
1959
  /** Up to 20 paired computers; null when the roster read failed. */
1894
- computers: z11.array(ComputerRowSchema).nullable()
1960
+ computers: z12.array(ComputerRowSchema).nullable()
1895
1961
  }).nullable()
1896
1962
  });
1897
- var CallRecapSchema = z11.object({
1898
- call: z11.object({
1899
- status: z11.string(),
1900
- startedAt: z11.string(),
1901
- durationMs: z11.number().nullable(),
1963
+ var CallRecapSchema = z12.object({
1964
+ call: z12.object({
1965
+ status: z12.string(),
1966
+ startedAt: z12.string(),
1967
+ durationMs: z12.number().nullable(),
1902
1968
  /** Bot-clock pickup offset; absent before the timestamp release, null before its report lands. */
1903
- pickupMs: z11.number().nullable().optional(),
1904
- agents: z11.array(z11.object({ id: z11.string(), name: z11.string().nullable() }))
1969
+ pickupMs: z12.number().nullable().optional(),
1970
+ agents: z12.array(z12.object({ id: z12.string(), name: z12.string().nullable() }))
1905
1971
  }),
1906
- topics: z11.array(z11.object({
1907
- goalId: z11.string().uuid(),
1908
- title: z11.string(),
1909
- owner: z11.string(),
1910
- state: z11.string(),
1972
+ topics: z12.array(z12.object({
1973
+ goalId: z12.string().uuid(),
1974
+ title: z12.string(),
1975
+ owner: z12.string(),
1976
+ state: z12.string(),
1911
1977
  /** Presented Entry content and its author, separately from the current Goal owner. */
1912
- items: z11.array(z11.object({ entryId: z11.string(), author: z11.string(), text: z11.string(), summary: z11.string().nullable() })).optional(),
1978
+ items: z12.array(z12.object({ entryId: z12.string(), author: z12.string(), text: z12.string(), summary: z12.string().nullable(), acknowledged: z12.boolean().optional() })).optional(),
1913
1979
  /** Whether the call put it to the person. An item it carried and never said has no row on the
1914
1980
  * review (owner, 2026-10-08: "why do we get the third one when it didn't happen in the call?"). */
1915
- presented: z11.boolean(),
1981
+ presented: z12.boolean(),
1916
1982
  /** Whether THIS call created it — the third way a call touches work, beside carrying a request
1917
1983
  * there and filing words there (owner, 2026-10-08, Goal `5b4b1a0a`: "Show the new work, keep my
1918
1984
  * words under it"). Created work is never carried, so it is never `presented`; without this the
1919
1985
  * row is dropped by the "only what happened on the call" filter. False on a database before
1920
1986
  * 20261013080133. */
1921
- created: z11.boolean(),
1987
+ created: z12.boolean(),
1922
1988
  /** `request` is the Entry that asked it — what a line's `about` names when the line answered or put
1923
1989
  * it off. Optional: an older API sent none. */
1924
- questions: z11.array(z11.object({ id: z11.string().uuid(), state: z11.string(), title: z11.string(), request: z11.string().optional() })),
1990
+ questions: z12.array(z12.object({ id: z12.string().uuid(), state: z12.string(), title: z12.string(), request: z12.string().optional() })),
1925
1991
  /** `words` is always what they SAID, verbatim — the record, never replaced. `summary` is what
1926
1992
  * the line says in ten words (owner, 2026-10-07): the filer's, or the talker's for the answer it
1927
1993
  * gave, so the row scans like a chosen option and their own words stay under it. Absent when
@@ -1931,33 +1997,70 @@ var CallRecapSchema = z11.object({
1931
1997
  /** `reply` is the reply the line makes up (an answer, an ok, a deferral), so one reply is one row
1932
1998
  * however many lines it cites; `at` is the call lines it came from, so a filed line an answer already
1933
1999
  * said is not drawn again (owner, 2026-10-07: "fix them all"); `replyKind` says which replies are answers. */
1934
- lines: z11.array(z11.object({
1935
- entryId: z11.string().uuid(),
1936
- words: z11.string(),
1937
- summary: z11.string().optional(),
1938
- about: z11.string().nullable().optional(),
1939
- reply: z11.string().nullable().optional(),
1940
- replyKind: z11.string().nullable().optional(),
1941
- at: z11.array(z11.number()).optional()
2000
+ lines: z12.array(z12.object({
2001
+ entryId: z12.string().uuid(),
2002
+ words: z12.string(),
2003
+ summary: z12.string().optional(),
2004
+ about: z12.string().nullable().optional(),
2005
+ reply: z12.string().nullable().optional(),
2006
+ replyKind: z12.string().nullable().optional(),
2007
+ at: z12.array(z12.number()).optional()
1942
2008
  }))
1943
2009
  })),
1944
- unfiled: z11.array(z11.object({ lineId: z11.string().uuid(), words: z11.string(), atMs: z11.number() })),
2010
+ unfiled: z12.array(z12.object({ lineId: z12.string().uuid(), words: z12.string(), atMs: z12.number() })),
1945
2011
  /** THE PUBLIC TRANSCRIPT — every line said on the call, in the order it was said, and WHO SAID IT
1946
2012
  * (owner, 2026-10-08: "the public view should only have the lines and who said them, and that's
1947
2013
  * it"; `docs/brain/phase-three/modular.md` build step 3). `speaker` is the role: "user" is the
1948
2014
  * person, "agent" an agent speaking, named in `agent`. The timeline's action lines are ours, not
1949
2015
  * theirs, and are not here; nor is a sealed line, which the server has no words for. It stands
1950
2016
  * BESIDE `topics` and `unfiled` — what the call did with the words — never instead of them. */
1951
- said: z11.array(z11.object({
1952
- lineId: z11.string().uuid(),
1953
- speaker: z11.enum(["user", "agent"]),
1954
- agent: z11.object({ id: z11.string().nullable(), name: z11.string().nullable() }).nullable(),
1955
- words: z11.string(),
1956
- atMs: z11.number()
2017
+ said: z12.array(z12.object({
2018
+ lineId: z12.string().uuid(),
2019
+ speaker: z12.enum(["user", "agent"]),
2020
+ agent: z12.object({ id: z12.string().nullable(), name: z12.string().nullable() }).nullable(),
2021
+ words: z12.string(),
2022
+ atMs: z12.number()
1957
2023
  })),
1958
- more: z11.object({ lines: z11.number(), entries: z11.number(), topics: z11.number() }),
2024
+ more: z12.object({ lines: z12.number(), entries: z12.number(), topics: z12.number() }),
1959
2025
  /** Last stored position on this page when another exists; absent before paging shipped. */
1960
- next: z11.number().int().nonnegative().nullable().optional()
2026
+ next: z12.number().int().nonnegative().nullable().optional(),
2027
+ /** THE CALL AS ONE LIST OF ROWS (owner, 2026-10-14: "we only really want a thing like transcript but
2028
+ * built from the summaries", then "the transcript tabs should show the same but with full words").
2029
+ * Both tabs draw these rows, in this order: Summary from `summary`, Transcript from `words`.
2030
+ * - `put`: an item put to the person, at the first agent line that voiced it. Paigy's sentences
2031
+ * that voiced it are folded into `spoken`, never rows of their own.
2032
+ * - `said`: the person's words, one row per reply or per filed line no reply covers.
2033
+ * - `did`: what Paigy did ("Sent to Mouth: …", "Recorded: …", "Filed on …").
2034
+ * `by` is the row's real author, never inferred from `kind`: a relay Paigy sent to an agent is
2035
+ * Paigy's, not the person's. Optional and additive (owner: "make sure whatever you do is backward
2036
+ * compatible"): an API before it sends none, and the screen falls back to `topics` and `said`. */
2037
+ timeline: z12.array(z12.object({
2038
+ id: z12.string(),
2039
+ position: z12.number(),
2040
+ atMs: z12.number(),
2041
+ kind: z12.enum(["put", "said", "did"]),
2042
+ by: z12.object({ participant: z12.string().nullable(), agentId: z12.string().nullable(), name: z12.string().nullable() }),
2043
+ goalId: z12.string().uuid().nullable(),
2044
+ requestId: z12.string().nullable(),
2045
+ summary: z12.string().nullable(),
2046
+ words: z12.string(),
2047
+ /** Paigy's sentences folded into this row: on a `put` row, what it said putting the item to the
2048
+ * person (before their next row); on a `said` row, what it said in reply (until their next row).
2049
+ * `atMs` is when each was said; optional, absent before 2026-10-14's fix. */
2050
+ spoken: z12.array(z12.object({ lineId: z12.string(), words: z12.string(), atMs: z12.number().optional() })),
2051
+ /** On a `said` row: the work these words were filed on, and whether they answered (recorded) a
2052
+ * question. They replace the "Filed on ..." and "Recorded: ..." rows that repeated the person's own
2053
+ * summary (Brain, 2026-10-14). Optional: absent from an API before it. */
2054
+ filedOn: z12.array(z12.object({ goalId: z12.string().uuid(), title: z12.string() })).optional(),
2055
+ recorded: z12.boolean().optional(),
2056
+ settled: z12.object({ requestId: z12.string(), answer: z12.string() }).nullable().optional(),
2057
+ acknowledged: z12.boolean().optional(),
2058
+ /** On a `put` row: still waiting for the person's answer (not settled, not answered, not put off).
2059
+ * The server's judgement; the screen draws "Still waiting for your answer" from it. Optional: absent
2060
+ * from an API before it, where the screen falls back to its own reading. */
2061
+ waiting: z12.boolean().optional(),
2062
+ lineIds: z12.array(z12.string())
2063
+ })).optional()
1961
2064
  });
1962
2065
 
1963
2066
  // src/listening.ts
@@ -1978,14 +2081,21 @@ function sessionStartHook() {
1978
2081
  [ -f "\${HOME}/.paigy/token.json" ] || exit 0 # not paired on this machine: nothing to listen as
1979
2082
  cat <<'PAIGY'
1980
2083
  Paigy: nothing pushes answers into a session started in a terminal \u2014 an answer waits for your
1981
- next contact({ wait: false }). Start your own listener now, as a BACKGROUND task whose output you watch
1982
- (your harness's monitor/background-task tool), and leave it running for this session:
2084
+ next contact({ wait: false }). Start your own listener now with your harness's MONITOR tool, the kind
2085
+ that wakes you on every line it prints (in Claude Code: Monitor, not a background Bash command, which
2086
+ only tells you when it exits). When the monitor expires, start it again:
1983
2087
 
1984
- npx -y -p @paigy/mcp@latest paigy-listen
2088
+ npx -y -p @paigy/mcp@latest paigy-listen --brief
1985
2089
 
1986
2090
  Each line it prints is a Delivery waiting for you: read the Goal, and reply with contact when
1987
- the answer needs a decision. Start it once; if it is already running, do nothing. Then call
1988
- contact({ wait: false }) once: work handed to you before this session started waits there.
2091
+ the answer needs a decision.
2092
+
2093
+ ONE LISTENER PER SESSION, AND ANOTHER SESSION'S IS NOT YOURS. Identities here are per session, so
2094
+ a paigy-listen you find in ps is almost certainly another session listening as itself, and
2095
+ starting yours takes nothing from it. Never decide this from ps: the listen tool reads the mark
2096
+ for YOUR OWN slot and answers in one call. Ask it, or just start the listener above; only a
2097
+ second one for the same slot is the mistake. Then call contact({ wait: false }) once: work handed
2098
+ to you before this session started waits there.
1989
2099
  PAIGY
1990
2100
  exit 0
1991
2101
  `;
@@ -2021,7 +2131,7 @@ function decideListen(f) {
2021
2131
  return {
2022
2132
  status: "start",
2023
2133
  command: `PAIGY_AGENT=${word(f.slot)} PAIGY_SESSION_ID=${word(f.session)} ${f.env.CODEX_THREAD_ID ? `CODEX_THREAD_ID=${word(f.env.CODEX_THREAD_ID)} ` : ""}${f.env.PAIGY_ON_WAKE ? `PAIGY_ON_WAKE=${word(f.env.PAIGY_ON_WAKE)} ` : ""}${word(f.execPath)} ${word(f.listenJs)} --brief`,
2024
- how: "Run this command NOW as a watched background task (your harness's background-task/monitor tool), and leave it running for this session. Each line it prints is a Delivery waiting for you: read the Goal it names with get_goals, and answer with contact. Start it once."
2134
+ how: "Run this command NOW with your harness's MONITOR tool, the kind that wakes you on every line it prints (in Claude Code: Monitor, not a background Bash command, which only tells you when it exits); start it again when the monitor expires. Each line it prints is a Delivery waiting for you: read the Goal it names with get_goals, and answer with contact. Start it once."
2025
2135
  };
2026
2136
  }
2027
2137
  function listenMark(slot, home = homedir()) {
@@ -2037,6 +2147,12 @@ function writeListenMark(slot, pid, home = homedir()) {
2037
2147
  function removeListenMark(slot, home = homedir()) {
2038
2148
  rmSync(listenMark(slot, home), { force: true });
2039
2149
  }
2150
+ function clear(path) {
2151
+ try {
2152
+ rmSync(path, { force: true });
2153
+ } catch {
2154
+ }
2155
+ }
2040
2156
  function listenerAlive(slot, home = homedir()) {
2041
2157
  const path = listenMark(slot, home);
2042
2158
  let pid;
@@ -2046,7 +2162,7 @@ function listenerAlive(slot, home = homedir()) {
2046
2162
  return null;
2047
2163
  }
2048
2164
  if (!Number.isInteger(pid) || pid <= 0) {
2049
- rmSync(path, { force: true });
2165
+ clear(path);
2050
2166
  return null;
2051
2167
  }
2052
2168
  try {
@@ -2054,7 +2170,7 @@ function listenerAlive(slot, home = homedir()) {
2054
2170
  return pid;
2055
2171
  } catch (e) {
2056
2172
  if (e.code === "EPERM") return pid;
2057
- rmSync(path, { force: true });
2173
+ clear(path);
2058
2174
  return null;
2059
2175
  }
2060
2176
  }
@@ -2067,6 +2183,100 @@ function wakeStatusPath(slot, home = homedir()) {
2067
2183
  function existingListener(slot, env, home = homedir()) {
2068
2184
  return listenerAlive(listenerKey(slot, env), home) ?? (env.CODEX_THREAD_ID ? listenerAlive(slot, home) : null);
2069
2185
  }
2186
+ var UNLISTENED_EVERY_MS = 10 * 6e4;
2187
+ var WATCHING_CLIENTS = /* @__PURE__ */ new Set(["claude-code"]);
2188
+ var NON_WATCHING_CLIENTS = /* @__PURE__ */ new Set(["claude-ai", "cursor", "cursor-vscode", "windsurf", "cline", "roo-cline", "continue", "vscode", "visual studio code", "zed", "antigravity"]);
2189
+ function canWatch(f) {
2190
+ if (harnessDriven(f.env) || f.env.PAIGY_ON_WAKE || f.env.CODEX_THREAD_ID) return "yes";
2191
+ const c = f.client?.toLowerCase();
2192
+ if (c && WATCHING_CLIENTS.has(c)) return "yes";
2193
+ if (c && NON_WATCHING_CLIENTS.has(c)) return "no";
2194
+ return "unknown";
2195
+ }
2196
+ function unlistenedNote(f, _now) {
2197
+ if (harnessDriven(f.env) || f.pidAlive) return null;
2198
+ const decision = decideListen(f);
2199
+ if (decision.status !== "start") return null;
2200
+ const head = `NOTHING CAN REACH THIS SESSION WHILE IT RESTS. No listener runs for your slot (${f.slot}) and no harness pump delivers to it`;
2201
+ switch (canWatch(f)) {
2202
+ case "no":
2203
+ return { unlistened: `${head}, and this host cannot run a listener. Work reaches you only as you act \u2014 it rides your tool calls, as it did this one \u2014 so call contact({ wait: false }) before you stop.` };
2204
+ case "yes":
2205
+ return { unlistened: `${head}. Start the listener below as a watched background task; a listener you see in ps belongs to another session's slot, never to yours.`, listen_command: decision.command };
2206
+ default:
2207
+ return { unlistened: `${head}. If this host can run a watched background task, start the listener below; if it cannot, work reaches you only as you act, so call contact({ wait: false }) before you stop.`, listen_command: decision.command };
2208
+ }
2209
+ }
2210
+ var ReachTeller = class {
2211
+ constructor(every = UNLISTENED_EVERY_MS) {
2212
+ this.every = every;
2213
+ }
2214
+ every;
2215
+ checked = /* @__PURE__ */ new Map();
2216
+ async note(slot, tool, d) {
2217
+ const now = d.now();
2218
+ const last = this.checked.get(slot);
2219
+ if (last !== void 0 && now - last < this.every) return null;
2220
+ this.checked.set(slot, now);
2221
+ let note;
2222
+ try {
2223
+ note = unlistenedNote(d.facts(), now);
2224
+ } catch {
2225
+ return null;
2226
+ }
2227
+ if (!note) return null;
2228
+ let waiting = null;
2229
+ if (tool !== "contact") {
2230
+ try {
2231
+ waiting = waitingSummary(await d.poll());
2232
+ } catch {
2233
+ }
2234
+ }
2235
+ return { paigy_reach: { ...note, ...waiting ?? {} } };
2236
+ }
2237
+ };
2238
+ function withReach(shaped, reach) {
2239
+ if (!reach || !shaped || typeof shaped !== "object" || Array.isArray(shaped)) return shaped;
2240
+ return { ...reach, ...shaped };
2241
+ }
2242
+ var HOOKED_HARNESSES = "Claude Code and Codex";
2243
+ function listenBlock(decision, f, stale) {
2244
+ const block = {
2245
+ listen: decision,
2246
+ listen_permanent: `\`${ENABLE_LISTEN_COMMAND}\` installs the SessionStart hook for ${HOOKED_HARNESSES}, so every future session there is told this at its start. Other hosts are not hooked; their sessions learn it as they act.`
2247
+ };
2248
+ if (decision.status === "start") {
2249
+ block.listen_prompt = canWatch(f) === "no" ? "This host cannot run a listener, so nothing reaches this session while it rests. Work arrives with your tool calls; call contact({ wait: false }) before you stop." : "Start your own listener NOW, as described in `listen` \u2014 a watched background task, left running for this session. Without it, every answer waits until you call contact({ wait: false }).";
2250
+ }
2251
+ if (stale) {
2252
+ block.hook_refresh = `The SessionStart hook on this machine is an older text. Ask the user to re-run \`${ENABLE_LISTEN_COMMAND}\` to refresh it \u2014 the old one tells a session to skip its listener when it sees another session's.`;
2253
+ }
2254
+ return block;
2255
+ }
2256
+ var ENABLE_LISTEN_COMMAND = "npx -y -p @paigy/mcp@latest paigy-enable-tools";
2257
+ function hookStale(home = homedir()) {
2258
+ try {
2259
+ return readFileSync(join(home, ".paigy", "hooks", "session-start.sh"), "utf8") !== sessionStartHook();
2260
+ } catch {
2261
+ return false;
2262
+ }
2263
+ }
2264
+ function waitingSummary(received) {
2265
+ const r = received ?? {};
2266
+ const events = Array.isArray(r.events) ? r.events : [];
2267
+ const ids = events.map((e) => String(e?.eventId ?? "")).filter(Boolean);
2268
+ const claimable = r.claimable && typeof r.claimable === "object" ? String(r.claimable.title ?? "") : "";
2269
+ if (!ids.length && !claimable) return null;
2270
+ const kinds = events.map((e) => String(e?.kind ?? "event")).join(", ");
2271
+ const parts = [
2272
+ ids.length ? `${ids.length} event${ids.length === 1 ? "" : "s"} addressed to you (${kinds})` : "",
2273
+ claimable ? `work waiting: ${claimable}` : ""
2274
+ ].filter(Boolean);
2275
+ return {
2276
+ waiting: `${parts.join("; ")}. Nothing acknowledged them \u2014 handle them with contact, and acknowledge with contact({ ackEventIds }) so they stop repeating. Read a Goal with get_goals before acting on a summary of it.`,
2277
+ ...ids.length ? { waiting_events: ids } : {}
2278
+ };
2279
+ }
2070
2280
 
2071
2281
  export {
2072
2282
  mcpInputSchema,
@@ -2082,5 +2292,10 @@ export {
2082
2292
  removeListenMark,
2083
2293
  listenerKey,
2084
2294
  wakeStatusPath,
2085
- existingListener
2295
+ existingListener,
2296
+ ReachTeller,
2297
+ withReach,
2298
+ listenBlock,
2299
+ ENABLE_LISTEN_COMMAND,
2300
+ hookStale
2086
2301
  };