@paigy/mcp 0.40.24 → 0.40.26

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,11 +1,15 @@
1
1
  // ../../packages/schema/dist/index.js
2
- import { z as z5 } from "zod";
2
+ import { z as z7 } from "zod";
3
3
  import { z } from "zod";
4
4
  import { z as z3 } from "zod";
5
5
  import { zodToJsonSchema } from "zod-to-json-schema";
6
6
  import { z as z2 } from "zod";
7
7
  import { z as z4 } from "zod";
8
8
  import { zodToJsonSchema as zodToJsonSchema2 } from "zod-to-json-schema";
9
+ import { z as z5 } from "zod";
10
+ import { zodToJsonSchema as zodToJsonSchema3 } from "zod-to-json-schema";
11
+ import { z as z6 } from "zod";
12
+ import { zodToJsonSchema as zodToJsonSchema4 } from "zod-to-json-schema";
9
13
  var OPTIONS_MIN = 2;
10
14
  var OPTIONS_MAX = 6;
11
15
  var OptionSchema = z.object({
@@ -15,14 +19,20 @@ var OptionSchema = z.object({
15
19
  // .describe() flows into the MCP contact JSON schema (zodToJsonSchema), so
16
20
  // the constraints below are what an agent reads when deciding to use these.
17
21
  html: z.string().max(16384).describe(
18
- "Optional sandboxed HTML/CSS preview for a visual 'pick one' (shown in the option card). Untrusted-sandboxed: NO JavaScript, NO external network or images \u2014 inline CSS and data: URIs only; <=16KB. Rendered edge-to-edge in a responsive card that is 200pt tall (about 320pt wide on a phone, with the next option peeking beside it); make your HTML fit that viewport. Use for layout/CSS mockups, tables, diffs. For a hosted image use `image` instead."
22
+ "Optional sandboxed HTML/CSS preview for a visual 'pick one' (shown in the option card). Untrusted-sandboxed: NO JavaScript, NO external network or images \u2014 inline CSS and data: URIs only; <=16KB. Rendered edge-to-edge in a responsive card that is 200pt tall (about 320pt wide on a phone, with the next option peeking beside it); make your HTML fit that viewport. Use for layout/CSS mockups, tables, diffs. For a hosted image use the image URL instead."
19
23
  ).optional(),
20
24
  image: z.string().url().describe(
21
- "Optional image URL rendered as the option's preview (plain image, not sandboxed). For agent-generated HTML/CSS mockups, use `html` instead."
25
+ "Optional image URL rendered as the option's preview (plain image, not sandboxed). For agent-generated HTML/CSS mockups, use the HTML preview instead."
22
26
  ).optional()
23
27
  });
24
- var OptionInputSchema = OptionSchema.omit({ id: true }).extend({
25
- label: z.string().trim().min(1).max(1e3)
28
+ var OptionInputSchema = z.object({
29
+ id: z.string().trim().min(1).max(64).regex(/^[A-Za-z0-9_.:-]+$/).optional().describe(
30
+ `Optional: this option's own id, which answers name it by (selectedOptionIds). Give every option one, or none: without them the options are numbered "1", "2", \u2026 in order.`
31
+ ),
32
+ label: z.string().trim().min(1).max(1e3),
33
+ hint: OptionSchema.shape.hint,
34
+ htmlPreview: OptionSchema.shape.html,
35
+ imgUrl: OptionSchema.shape.image
26
36
  }).strict();
27
37
  var NIGHT = { from: 23, to: 7 };
28
38
  function draft2020(node) {
@@ -54,33 +64,162 @@ function mcpInputSchema(s) {
54
64
  delete schema.$schema;
55
65
  return draft2020(schema);
56
66
  }
57
- var AskInputSchema = z2.object({
58
- id: z2.string().optional().describe("Optional idempotency key or client-side ID for this specific ask."),
59
- parentId: z2.string().uuid().optional().describe("The Goal this question is about \u2014 usually the one you are working on. The question goes onto that Goal and its answer comes back there. Omit it and the question starts a new Goal of yours."),
60
- repo: z2.string().optional().describe("Optional repository context."),
61
- ask: z2.string().trim().min(1).max(1e4).describe(
62
- "ONE question, and only what is needed to answer it. Several questions are several asks in the array, one each: an answer settles the one ask it was given in the shape that ask declares, so a person who answers the part of a bundled ask that interested them settles nothing and is asked again. Paigy sends each ask exactly as you wrote it: a bundled ask arrives as one card. News, progress and findings are their own contact; ANY contact for a person already on a call JOINS that call, whatever channel you asked for, so several arrive as one call."
67
+ var ASK_MAX = 250;
68
+ var UNITS_MAX = 12;
69
+ var UNIT_TITLE_MAX = 50;
70
+ var UNIT_BODY_MAX = 200;
71
+ var UnitInputSchema = z2.object({
72
+ title: z2.string().trim().min(1).describe(`What this unit is about, at most ${UNIT_TITLE_MAX} characters. The app lists the titles; the person taps one to read its body.`),
73
+ body: z2.string().trim().min(1).describe(`The unit itself, at most ${UNIT_BODY_MAX} characters.`)
74
+ }).strict();
75
+ function capRefusals(text, units2, field) {
76
+ const out = [];
77
+ const name = field === "text" ? "answer" : field;
78
+ if (text.length > ASK_MAX) out.push({
79
+ refusal: "ask_too_long",
80
+ length: text.length,
81
+ cap: ASK_MAX,
82
+ path: field === "text" ? ["answer", "text"] : [field],
83
+ message: `ask_too_long: the ${name} is ${text.length} characters; the cap is ${ASK_MAX}. Keep the one point in the ${name} and move the context into units.`
84
+ });
85
+ const all = units2 ?? [];
86
+ if (all.length > UNITS_MAX) out.push({
87
+ refusal: "too_many_units",
88
+ length: all.length,
89
+ cap: UNITS_MAX,
90
+ path: ["units"],
91
+ message: `too_many_units: ${all.length} units; the cap is ${UNITS_MAX}. Keep only the context this ${name} needs.`
92
+ });
93
+ all.forEach((unit, index) => {
94
+ if (unit.title.length > UNIT_TITLE_MAX) out.push({
95
+ refusal: "unit_title_too_long",
96
+ index,
97
+ length: unit.title.length,
98
+ cap: UNIT_TITLE_MAX,
99
+ path: ["units", index, "title"],
100
+ message: `unit_title_too_long: units[${index}]'s title is ${unit.title.length} characters; the cap is ${UNIT_TITLE_MAX}.`
101
+ });
102
+ if (unit.body.length > UNIT_BODY_MAX) out.push({
103
+ refusal: "unit_body_too_long",
104
+ index,
105
+ length: unit.body.length,
106
+ cap: UNIT_BODY_MAX,
107
+ path: ["units", index, "body"],
108
+ message: `unit_body_too_long: units[${index}]'s body is ${unit.body.length} characters; the cap is ${UNIT_BODY_MAX}. Cut it into two units.`
109
+ });
110
+ });
111
+ return out;
112
+ }
113
+ function refuseOverCaps(text, units2, field, ctx) {
114
+ for (const { path, message, ...params } of capRefusals(text, units2, field)) ctx.addIssue({ code: z2.ZodIssueCode.custom, path, message, params });
115
+ }
116
+ var questionHandle = z2.string().trim().regex(/^[0-9a-fA-F-]{8,36}$/, "a question id, whole or its first eight characters");
117
+ var NodeRef = z2.object({
118
+ type: z2.enum(["goal", "question"]),
119
+ id: z2.string().uuid()
120
+ }).strict().describe("A Goal or a Question, by its id.");
121
+ var BlockedAction = z2.enum(["start", "complete", "answer"]).describe("What waits: starting or completing a Goal, or answering a Question.");
122
+ var reason = z2.string().trim().min(1).max(500).describe("Why, as an explanation, never as policy.");
123
+ var actionFits = (b) => b.blocked.type === "goal" === (b.action !== "answer");
124
+ var ACTION_FITS = "a goal is blocked from start or complete; a question from answer";
125
+ var userExplicitlyRequested = z2.enum(["any", "call"]).optional().describe(
126
+ `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.`
127
+ );
128
+ var units = z2.array(UnitInputSchema).optional().describe(
129
+ `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.`
130
+ );
131
+ var UpdateInputSchema = z2.object({
132
+ message: z2.string().trim().min(1).describe(`The one point, at most ${ASK_MAX} characters; the context goes in units.`),
133
+ goalIds: z2.array(z2.string().uuid()).min(1).max(10).describe("The Goals it is about, each one that exists: the one it is mainly about first."),
134
+ units,
135
+ userExplicitlyRequested
136
+ }).strict().superRefine((u, ctx) => refuseOverCaps(u.message, u.units, "message", ctx));
137
+ var questionFields = {
138
+ question: z2.string().trim().min(1).describe(
139
+ `ONE question, in at most ${ASK_MAX} characters, and only what is needed to answer it; the context goes in units. Several questions are several objects, one each: an answer settles the one question it was given, so a person who answers the part of a bundled question that interested them settles nothing and is asked again. Separate questions cost nothing: ANY contact for a person already on a call JOINS that call, so several arrive as one call.`
63
140
  ),
64
- options: z2.array(OptionInputSchema).min(1).max(6).optional(),
141
+ goalId: z2.string().uuid().describe("The Goal the question is about, which must exist (create it with manage_goals first). Its answer comes back there."),
142
+ units,
143
+ options: z2.array(OptionInputSchema).min(1).max(6).optional().describe("The choices, when you have them. Each label stands on its own."),
65
144
  // HOW THE OPTIONS ARE ANSWERED, SAID BY THE AGENT (owner, 2026-10-02: "one and many makes sense";
66
- // brain_prompts.md §1: structured agent questions need no model). Every card was pick-one while no
67
- // agent sent this; no read reshapes cards any more, so this is the card's shape, and the
68
- // description says so plainly.
69
- select: z2.enum(["one", "many"]).optional().describe(
70
- 'How the options are answered: "many" makes a checklist (they may want several, e.g. independent fixes), "one" (the default) a pick (choosing one rules out the others). Send "many" whenever more than one option could be wanted at once. The person can always answer in their own words as well. Ignored without options.'
145
+ // brain_prompts.md §1: structured agent questions need no model). The app draws all three.
146
+ pickMode: z2.enum(["one", "many", "rank"]).optional().describe(
147
+ 'How the options are answered: "one" (the default) a pick, for alternatives; "many" a checklist, for independent options they may want several of; "rank" an order of all of them. Only with options.'
148
+ ),
149
+ // WHAT THE QUESTION HOLDS UP (brain_prompts.md §2.1): replaces `waiting: 'hard'`. A question that
150
+ // blocks work asks for a call (the person's settings and ring cooldowns still decide).
151
+ workItBlocks: z2.array(z2.object({ blocked: NodeRef, action: BlockedAction, reason: reason.optional() }).strict().refine(actionFits, ACTION_FITS)).min(1).max(10).optional().describe(
152
+ "The work that cannot go on until this is answered: a Goal's start or completion, or another Question's answer. Only for work truly blocked; it asks for a call. Leave it out for a question you can keep working around."
71
153
  ),
72
- answers: z2.string().trim().regex(/^[0-9a-fA-F-]{8,36}$/).optional().describe(
73
- "Your reply answers a question the person asked you: the id the conversation shows for it (8 characters or whole). Their question closes with this reply as its answer, and any decision of yours it was holding back goes back to them. parentId is optional here: the question's own Goal is used. The reply is sent to them as it is; to also ask something new, send that as its own ask."
154
+ userExplicitlyRequested
155
+ };
156
+ var refineQuestion = (q, ctx) => {
157
+ refuseOverCaps(q.question, q.units, "question", ctx);
158
+ if (q.pickMode && !q.options) ctx.addIssue({ code: z2.ZodIssueCode.custom, path: ["pickMode"], message: "pickMode comes only with options" });
159
+ const ids = (q.options ?? []).map((o) => o.id);
160
+ if (ids.some((id2) => id2) && (ids.some((id2) => !id2) || new Set(ids).size !== ids.length)) {
161
+ ctx.addIssue({ code: z2.ZodIssueCode.custom, path: ["options"], message: "give every option a distinct id, or none" });
162
+ }
163
+ };
164
+ var QuestionInputSchema = z2.object({
165
+ questionId: z2.string().uuid().optional().describe("Optional: your own stable id for this question (a UUID), so a resend is the same question. Minted for you when omitted; the result returns it."),
166
+ ...questionFields
167
+ }).strict().superRefine(refineQuestion);
168
+ var QuestionWireSchema = z2.object({ questionId: z2.string().uuid(), ...questionFields }).strict().superRefine(refineQuestion);
169
+ var AnswerInputSchema = z2.object({
170
+ questionId: questionHandle.describe("The Question you answer: its id as the event or the conversation shows it (8 characters or whole)."),
171
+ answer: z2.object({
172
+ text: z2.string().trim().min(1).describe(`Your answer in your own words, at most ${ASK_MAX} characters; the context goes in units.`),
173
+ selectedOptionIds: z2.array(z2.string().trim().min(1)).min(1).max(6).optional().describe("The ids of the options you choose, when the Question offered options (in order, for a ranking).")
174
+ }).strict(),
175
+ units
176
+ }).strict().superRefine((a, ctx) => refuseOverCaps(a.answer.text, a.units, "text", ctx));
177
+ var QuestionDependencySchema = z2.object({
178
+ questionId: questionHandle.describe("A Question you asked."),
179
+ change: z2.enum(["add", "remove"]),
180
+ blocked: NodeRef,
181
+ action: BlockedAction,
182
+ reason: reason.optional()
183
+ }).strict().refine(actionFits, ACTION_FITS);
184
+ var sendFields = {
185
+ updates: z2.array(UpdateInputSchema).min(1).max(20).optional().describe(
186
+ "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."
187
+ ),
188
+ answers: z2.array(AnswerInputSchema).min(1).max(20).optional().describe("Answers to Questions addressed to you."),
189
+ withdrawQuestionIds: z2.array(questionHandle).min(1).max(10).optional().describe(
190
+ "Questions you asked that no longer need an answer: you acted on them yourself, they no longer matter, or you asked wrongly. Each is cancelled, not answered: its card closes and nothing rings for it."
191
+ ),
192
+ questionDependencies: z2.array(QuestionDependencySchema).min(1).max(20).optional().describe(
193
+ "Add or remove what a Question you asked holds up, after asking it."
194
+ )
195
+ };
196
+ var ContactSchema = z2.object({
197
+ ...sendFields,
198
+ questions: z2.array(QuestionInputSchema).min(1).max(20).optional().describe("Questions for the person, one per object."),
199
+ /** RECEIVING (2I, I2; brain_prompts.md §2.2): the events this agent handled. */
200
+ ackEventIds: z2.array(z2.string().uuid()).min(1).max(100).optional().describe(
201
+ "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."
202
+ ),
203
+ wait: z2.boolean().optional().describe(
204
+ "Only controls when this returns. Sending: false (the default) returns at once; true waits up to about 45 seconds for a response to what you sent. Sending nothing: true (the default) waits up to about 45 seconds for anything addressed to you; false returns what is waiting now. It does not mean work is blocked, set urgency, or ask for a call. `waitOutcome` says which happened: `available`, `expired` (nothing arrived; wait again without sending again), or `not_waited`."
74
205
  )
75
206
  }).strict();
76
- var StartContactSchema = z2.object({
77
- asks: z2.array(AskInputSchema).min(1).describe("The questions to pose, one per object. An ask with a parentId is filed on that Goal as it is; an ask naming no Goal starts a new Goal of yours."),
78
- waiting: z2.enum(["none", "hard"]).default("none").describe("hard requests a call even when channel is notification; user permissions and ring cooldowns still apply."),
79
- channel: z2.enum(["notification", "call"]).default("notification")
80
- }).strict();
81
- var ContactSchema = z2.union([StartContactSchema, z2.object({ deliveryId: z2.string().uuid() }).strict()]);
207
+ var sendsAnything = (c) => !!(c.updates?.length || c.questions?.length || c.answers?.length || c.withdrawQuestionIds?.length || c.questionDependencies?.length);
208
+ var ContactWireSchema = z2.object({
209
+ operationId: z2.string().uuid(),
210
+ ...sendFields,
211
+ questions: z2.array(QuestionWireSchema).min(1).max(20).optional()
212
+ }).strict().refine(sendsAnything, "a contact sends at least one update, question, answer, withdrawal or question dependency");
82
213
  var CONTACT_SCHEMA = { type: "object", ...mcpInputSchema(ContactSchema) };
83
- var CONTACT_DESCRIPTION = "Contact the user with one or more asks/questions. Pass an array of asks (each with 'ask', optional 'options', 'select', 'id', 'parentId', 'repo'), plus channel:'notification'|'call', and waiting:'none'|'hard'. An ask that names a Goal (parentId) goes onto that Goal; one that names none starts a new Goal of yours. Notification returns immediately; collect durable answers with check_replies. On stdio, a Call holds one cancellable ~45s window; continue with ONLY {deliveryId}. One question per 'ask'; several questions are several objects in 'asks'. Each ask is sent exactly as written, with no reading in between: a bundled ask arrives as one card, so separate questions are separate asks. An ask with no options that is not blocking is a report, and a report is an UPDATE, never a claim on them: it reaches them and is listed apart from what waits on them, so no answer is owed and none should be awaited. On a Goal whose report card is still open it is added to that card, with no new push; Where your work stands while under way is progress: report it with update_goal, not contact. Send options (or waiting:'hard') when you actually need an answer. Each option's label must stand on its own \u2014 the person may see only the labels \u2014 so never a label that points into your text ('All three', 'Option 2', '1 and 3 only'). select:'many' makes the card a checklist, for independent options they may want several of; select:'one' (the default) a pick, for alternatives. The person can always answer in their own words, so never add an 'Other' option. If the person is already on a call, your contact joins that call automatically \u2014 whatever channel you asked for, with no ring \u2014 and the Delivery it returns IS that call: reread it with contact({deliveryId}) to see everything answered on it so far, and contact again while it is live to add information or a further question to the same call.";
214
+ var CONTACT_DESCRIPTION = `Send to and receive from the person: 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.
215
+
216
+ QUESTIONS: one question per object; several questions are several objects in one contact, so each can be answered on its own. Each is sent exactly as written, with no reading in between: a bundled question arrives as one card. Give options when you have them. Each option's label must stand on its own \u2014 the person may see only the labels \u2014 so never a label that points into your text ('All three', 'Option 2', '1 and 3 only'). pickMode:'one' (the default) makes a pick, for alternatives; 'many' a checklist, for independent options they may want several of; 'rank' an ordering. The person can always answer in their own words, so never add an 'Other' option. workItBlocks names the work a question holds up, only when you are truly blocked: it asks for a call. Answers land on the question's Goal: collect them by receiving (below) or with get_goal.
217
+
218
+ 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.
219
+
220
+ 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. So when the work is finished, mark the Goal done first (manage_goals), then send one update saying what is done and anything they need to do or check. 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.
221
+
222
+ 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_goal); \`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\`; claim_goal starts it) and your work gone quiet (\`stalled\`).`;
84
223
  var CreateGoalSchema = z3.object({
85
224
  outcome: z3.string().trim().min(1).max(1e4),
86
225
  /** The work's NAME (#2115) — one to five words, how a person refers to it out loud ("the night
@@ -100,10 +239,6 @@ var CreateGoalSchema = z3.object({
100
239
  * repo name. Delegated work inherits this from its parent Goal when omitted. */
101
240
  repo: z3.string().trim().min(1).max(200).optional()
102
241
  });
103
- var CreateGoalToolSchema = CreateGoalSchema.extend({
104
- idempotencyKey: CreateGoalSchema.shape.idempotencyKey.optional().describe("Optional. One is minted per call; pass your own only so a retry lands on the same Goal.")
105
- }).strict();
106
- var CREATE_GOAL_DESCRIPTION = 'Create a durable Goal for an outcome. Without parentGoalId it is placed against your open Goals: if one already IS this work, that Goal comes back (existing: true) and nothing new is created \u2014 continue it; if the work belongs under one, it is created there (parentGoalId in the receipt); otherwise it is a root. Pass parentGoalId yourself to put it under a specific Goal. Pass repo to anchor the work to a specific repository ("owner/repo" or repo name); delegated children inherit it. Pass title to name it in one to five words, as a person would refer to it out loud ("the night rings") \u2014 it heads every list and is spoken on a call; without one the brain writes it. Admission only: claim it before doing work, then update it as it advances. Returns an admission receipt with goalId, current state, revision, ownerParticipant, and the next step; no Goal content or execution lease.';
107
242
  var UpdateGoalSchema = z3.object({
108
243
  revision: z3.number().int().positive(),
109
244
  changes: z3.object({
@@ -118,16 +253,64 @@ var UpdateGoalSchema = z3.object({
118
253
  state: z3.enum(["active", "done", "cancelled"]).optional(),
119
254
  progress: z3.string().trim().min(1).max(1e4).optional(),
120
255
  reviewed: z3.literal(true).optional(),
121
- dueAt: z3.string().datetime({ offset: true }).nullable().optional(),
122
- /** WITHDRAW YOUR OWN QUESTION (#2777, owner 2026-09-30). The question's id as every read shows it
123
- * (the conversation's `id`, eight characters, or the whole request Entry id), on THIS Goal, asked
124
- * by you and still open. It is cancelled, not answered: its cards close and nothing rings for it. */
125
- withdraw: z3.array(z3.string().trim().regex(/^[0-9a-fA-F-]{8,36}$/)).min(1).max(10).optional()
256
+ dueAt: z3.string().datetime({ offset: true }).nullable().optional()
126
257
  }).strict().refine((v) => Object.keys(v).length > 0),
127
258
  reason: z3.string().trim().min(1).max(2e3),
128
259
  operationId: z3.string().uuid().optional()
129
260
  }).strict();
130
- var UpdateGoalToolSchema = UpdateGoalSchema.omit({ operationId: true }).extend({ goalId: z3.string().uuid() }).strict();
261
+ var changedGoal = z3.string().uuid().describe("The Goal to change, as a read shows it.");
262
+ var goalTitle = z3.string().trim().min(1).max(80).describe("The Goal's short display name: one to five words, how a person refers to it out loud.");
263
+ var goalOutcome = z3.string().trim().min(1).max(1e4).describe("The full desired result. There is no third description field.");
264
+ var CreateChange = z3.object({
265
+ kind: z3.literal("create"),
266
+ title: goalTitle,
267
+ outcome: goalOutcome,
268
+ ownerId: z3.string().trim().min(1).optional().describe("Who owns the work: an agent's participant (as who_is_working shows it) or the person's. Omitted: you."),
269
+ parentGoalId: z3.string().uuid().optional().describe("The Goal it belongs under. Omitted: a root."),
270
+ sourceEntryIds: z3.array(z3.string().uuid()).max(20).optional().describe("The whole Entries the work came from, ones you can read.")
271
+ }).strict();
272
+ var EditChange = z3.object({ kind: z3.literal("edit"), goalId: changedGoal, title: goalTitle.optional(), outcome: goalOutcome.optional() }).strict();
273
+ var StateChange = z3.object({ kind: z3.literal("state"), goalId: changedGoal, state: z3.enum(["open", "completed", "canceled"]).describe(
274
+ "completed: the Goal's own work is done now (refused while required children are open); open: reopen it; canceled: it will not be done."
275
+ ) }).strict();
276
+ var AssignChange = z3.object({ kind: z3.literal("assign"), goalId: changedGoal, ownerId: z3.string().trim().min(1).describe("The new owner's participant.") }).strict();
277
+ var DeferChange = z3.object({ kind: z3.literal("defer"), goalId: changedGoal, until: z3.string().datetime({ offset: true }).nullable().describe(
278
+ "Postpone it until this instant: it waits until then, and its owner is woken when it passes (a promise to follow up later). null takes the postponement back."
279
+ ) }).strict();
280
+ var MoveChange = z3.object({ kind: z3.literal("move"), goalId: changedGoal, parentGoalId: z3.string().uuid().nullable().describe(
281
+ "Its new parent, or null for a root. Only this Goal moves; its new parent's other children stay."
282
+ ) }).strict();
283
+ var DependencyChange = z3.object({
284
+ kind: z3.literal("dependency"),
285
+ change: z3.enum(["add", "remove"]),
286
+ goalId: changedGoal,
287
+ dependsOnGoalId: z3.string().uuid().describe("The Goal it waits on."),
288
+ action: z3.enum(["start", "complete"]).describe("What waits: starting goalId, or completing it."),
289
+ reason: z3.string().trim().min(1).max(2e3).optional().describe("Why, as an explanation, never as policy.")
290
+ }).strict();
291
+ var read = { revision: z3.number().int().positive().optional() };
292
+ var GoalChangeSchema = z3.discriminatedUnion("kind", [
293
+ CreateChange,
294
+ EditChange.extend(read),
295
+ StateChange.extend(read),
296
+ AssignChange.extend(read),
297
+ DeferChange.extend(read),
298
+ MoveChange.extend(read),
299
+ DependencyChange
300
+ ]);
301
+ var editNames = (changes, ctx) => changes.forEach((c, i) => {
302
+ if (c.kind === "edit" && c.title === void 0 && c.outcome === void 0) {
303
+ ctx.addIssue({ code: z3.ZodIssueCode.custom, path: ["changes", i], message: "an edit supplies title, outcome, or both" });
304
+ }
305
+ });
306
+ var ManageGoalsSchema = z3.object({
307
+ requestId: z3.string().uuid().optional(),
308
+ changes: z3.array(GoalChangeSchema).min(1).max(50)
309
+ }).strict().superRefine((v, ctx) => editNames(v.changes, ctx));
310
+ var ManageGoalsToolSchema = z3.object({
311
+ changes: z3.array(z3.discriminatedUnion("kind", [CreateChange, EditChange, StateChange, AssignChange, DeferChange, MoveChange, DependencyChange])).min(1).max(50).describe("The changes, applied in order, each on its own.")
312
+ }).strict().superRefine((v, ctx) => editNames(v.changes, ctx));
313
+ var MANAGE_GOALS_DESCRIPTION = "Create, edit, assign, organize or close work. Every change here changes Goals; answering, withdrawing or asking Questions stays in contact. Each change applies independently: a refused one names why (`results[i].error`, e.g. goal_revision_conflict, goal_children_open, goal_not_joined, goal_not_found) and the rest still apply, so read every result: a partial result is never a complete success. Kinds: create (title, outcome, ownerId, parentGoalId, sourceEntryIds) returns the new Goal's id in `results[i].goalId`, in the order requested, to use in later calls; edit (title and/or outcome); state (open, completed, canceled); assign (ownerId); defer (until: the Goal waits until then and its owner is woken when it passes; null takes it back); move (parentGoalId, or null for a root: only this Goal moves); dependency (add or remove: goalId waits on dependsOnGoalId to start or to complete). A Goal cannot be completed while its required children or dependencies remain open: finish or move them first. Finishing the children does not prove the parent's own work is done. An edit applies at the version you last read: if someone changed the Goal since, it is refused as goal_revision_conflict, so read it again (get_goal) and reconsider. You may change a Goal you own or have written on. Returns `ok` (every change applied), `results` per change (applied or failed), and `goals`, each changed Goal's id, state, title, outcome and revision.";
131
314
  var ClaimGoalSchema = z3.object({ goalId: z3.string().uuid().optional() }).strict();
132
315
  var GetGoalSchema = z3.object({
133
316
  goalId: z3.string().uuid(),
@@ -140,32 +323,44 @@ var GetGoalSchema = z3.object({
140
323
  diagnose: z3.boolean().optional()
141
324
  }).strict();
142
325
  var GET_GOAL_DESCRIPTION = "Read one Goal without claiming it, including others (the ten most recent other contributors, with names, latest entry headlines and times): its outcome, state, revision, progress, blockers, the conversation on it (each question with its options and what was decided), `next`, the one step to take, and `more`, where to read further. A question in that conversation reads `open` (nothing yet), `answered` (a choice was made, and `answer` carries it), `replied` (they said something and the read settled the question on their words \u2014 NO option of yours was chosen, and the words are the reply line beside it, so read that before you act), or `closed`. The conversation carries everything the person said, every open question and your newest entry; your older entries are left out and counted \u2014 history: true reads every entry in full. Every Goal of your person is readable, whichever of their agents owns it; another account's Goals are not disclosed.\n\ndiagnose: true is for when a read has CONFUSED you \u2014 not for the working loop. It adds `diagnosis`, which asks every reader that already answers a question about your work and NAMES the reader behind every value, so you never guess which of two places to look: what state your work is really in (the stored `goals.state` beside the derived `goal_execution_state`, which can differ); whether anything is armed to ring and when (`ladder_candidates`, with the ladder's own last decision); whether a wake fired for you and what it did (durable `wake.*` events, beside when your process was last heard from); and what has reached you (`list_waiting` \u2014 review flags, unstarted work, open questions, the person's newest words). Read `diagnosis.disagreements` FIRST: each one is two readers giving different values for the same fact, with both values and both sources, and it never chooses between them \u2014 that is yours to do, from the Goal's own history. `diagnosis.looked` names every reader asked, including any that could not answer, so an empty answer is never confused with a broken one.";
143
- var UPDATE_GOAL_DESCRIPTION = `Update a Goal you are on at an exact revision. You are on a Goal you own, or one you have written on (an update with progress, or a contact on it); any of your person's agents may write on any of their Goals, and one that never touched a Goal is refused (409 goal_not_joined). State, ownership, dependencies, children, progress, title, and review acknowledgement are explicit; stale revisions are rejected. A CONTACT ON THIS GOAL MOVES ITS REVISION: a question filed on a Goal is a change to it, so an update prepared before a contact and sent after it is refused as stale (409 goal_revision_conflict) \u2014 re-read the Goal, then write. title is the work's name in one to five words, as a person would refer to it out loud (it is spoken on a call and heads every list); null clears it. reviewed: true acknowledges new evidence and closes the Deliveries addressed to you on that Goal, never over an open decision. dueAt (an ISO instant, or null) makes the Goal wait until then; when it passes you are woken for it \u2014 use it for a promise to follow up later. withdraw: [questionId] takes back a question YOU asked on this Goal that is still open \u2014 because you acted on it yourself, it no longer matters, or you asked it wrongly (e.g. waiting: hard when nothing was blocked): it is cancelled, not answered, its card closes and it stops ringing; the id is the one the conversation shows. state: done means the work was accomplished, and it can be reopened: when the person says it is not done ("it's not working"), set state: active on that same Goal instead of starting a new one; its parent reopens with it. state: done while children are still open records your part as done: the Goal waits and closes by itself when its last open child closes. cancelled is final. Returns the Goal as get_goal reads it, at its new revision.`;
144
- var CLAIM_GOAL_DESCRIPTION = "Claim a pending answer to your question or the oldest runnable or review-pending Goal you own. Pass goalId to join any Goal of your person; its assignment stays unchanged. Read others before overlapping another agent\u2019s work. Joining lets you contribute and change its state; use update_goal with ownerParticipant when the assignment itself should change. Returns the Goal as get_goal reads it, and marks you as on it, which never shuts another agent out: other agents of your person may write on it and change it too, and two changes at once are told apart by revision (409 goal_revision_conflict).";
145
- var CHECK_REPLIES_DESCRIPTION = "What is waiting for you: your open Deliveries (a request the user started toward you, a handoff), one row each with its Goals, how many decisions are still open, and the newest words in brief; `assigned`, your Goals nobody has started yet, however they became yours (claim_goal({goalId}) starts one); and `review`, your Goals with something new on them \u2014 the user's answers and notes are Entries on the Goal, not Deliveries. A pure read with no arguments: nothing is consumed, acknowledged or claimed by reading it, so call it on startup, after a long wait, or whenever you want to know what is outstanding. To act on one, claim its Goal (claim_goal) or reread a Delivery in full with contact({deliveryId}). Once you have acted on what arrived, update_goal with reviewed: true clears the Goal from `review` and closes the Deliveries addressed to you on it.";
146
- var CheckRepliesSchema = z3.object({}).strict();
326
+ var CLAIM_GOAL_DESCRIPTION = "Claim a pending answer to your question or the oldest runnable or review-pending Goal you own. Pass goalId to join any Goal of your person; its assignment stays unchanged. Read others before overlapping another agent\u2019s work. Joining lets you contribute and change it; use manage_goals (assign) when the assignment itself should change. Returns the Goal as get_goal reads it, and marks you as on it, which never shuts another agent out: other agents of your person may write on it and change it too, and two changes at once are told apart by revision (409 goal_revision_conflict).";
327
+ var SearchToolSchema = z3.object({
328
+ query: z3.string().trim().min(1).max(500),
329
+ types: z3.array(z3.enum(["entry", "goal", "answer"])).min(1).optional(),
330
+ goalId: z3.string().uuid().optional(),
331
+ limit: z3.number().int().min(1).max(20).optional()
332
+ }).strict();
333
+ var SEARCH_DESCRIPTION = "Search your person's history across all of their agents: Entries (what anyone said or wrote, typed or spoken on a call), Goals (by title and outcome) and Answers (found by their Question or by the words that gave them). query is words to look for; records sharing more of its words rank first, and exact names work. types narrows it to entry, goal and/or answer (default: all three). goalId searches under one Goal: its Entries, its Questions' Answers, and it and its immediate children. limit is matches per type, 1 to 20 (default 8). Read-only. Each match carries its whole saved words, its ID and its links (an Answer carries its Question, the choice made and the Entries that support it); `omitted` counts what matched but was left out, so narrow the words or add a goalId to see it. Nothing found is not proof that nothing exists; a refused search says why. Sealed (encrypted) content is never searched or returned.";
334
+ var WhoIsWorkingSchema = z3.object({}).strict();
335
+ var FEEDBACK_TEXT_MAX = 5e4;
336
+ var SendFeedbackSchema = z3.object({
337
+ text: z3.string().trim().min(1).max(FEEDBACK_TEXT_MAX).describe(`The report, in markdown: what happened, what was expected, how to reproduce it, versions, evidence. At most ${FEEDBACK_TEXT_MAX} characters.`),
338
+ title: z3.string().trim().min(1).max(200).optional().describe("One line naming it."),
339
+ kind: z3.enum(["bug", "idea", "other"]).default("other").describe("bug: something Paigy does wrong. idea: something it should do. other: anything else.")
340
+ }).strict();
341
+ var SEND_FEEDBACK_DESCRIPTION = "Send feedback about Paigy itself (a bug report, an idea) straight to the Paigy team. Send it only when the person asked you to, or agreed when you offered: it goes to Paigy, never to the person, and nobody answers it here. Not for your work or a question for the person: use contact for those. Returns whether it was stored.";
147
342
  var AGENT_TOOLS = [
148
- { name: "who_is_working", description: "Read your person's agents that contributed in the last 24 hours, newest first: at most 30 agents and their five most recently touched Goals, with their latest entry headline and time. Use get_goal to read a Goal and its other contributors before starting overlapping work. Read-only; no arguments.", inputSchema: mcpInputSchema(CheckRepliesSchema) },
343
+ { name: "who_is_working", description: "Read your person's agents that contributed in the last 24 hours, newest first: at most 30 agents and their five most recently touched Goals, with their latest entry headline and time. Use get_goal to read a Goal and its other contributors before starting overlapping work. Read-only; no arguments.", inputSchema: mcpInputSchema(WhoIsWorkingSchema) },
149
344
  { name: "contact", description: CONTACT_DESCRIPTION, inputSchema: CONTACT_SCHEMA },
150
- { name: "check_replies", description: CHECK_REPLIES_DESCRIPTION, inputSchema: mcpInputSchema(CheckRepliesSchema) },
151
- { name: "create_goal", description: CREATE_GOAL_DESCRIPTION, inputSchema: mcpInputSchema(CreateGoalToolSchema) },
345
+ { name: "manage_goals", description: MANAGE_GOALS_DESCRIPTION, inputSchema: mcpInputSchema(ManageGoalsToolSchema) },
152
346
  { name: "claim_goal", description: CLAIM_GOAL_DESCRIPTION, inputSchema: mcpInputSchema(ClaimGoalSchema) },
153
347
  { name: "get_goal", description: GET_GOAL_DESCRIPTION, inputSchema: mcpInputSchema(GetGoalSchema) },
154
- { name: "update_goal", description: UPDATE_GOAL_DESCRIPTION, inputSchema: mcpInputSchema(UpdateGoalToolSchema) }
348
+ { name: "search", description: SEARCH_DESCRIPTION, inputSchema: mcpInputSchema(SearchToolSchema) },
349
+ { name: "send_feedback", description: SEND_FEEDBACK_DESCRIPTION, inputSchema: mcpInputSchema(SendFeedbackSchema) }
155
350
  ];
156
351
  var AGENT_TOOL_NAMES = AGENT_TOOLS.map((t) => t.name);
157
352
  function serverInstructions(opts) {
158
- const calls = opts.waits ? "A Call holds one bounded window here; continue with contact({deliveryId}) to hold the next or reread that exact Delivery." : "A Call returns after one read; continue with contact({deliveryId}) to reread that exact Delivery.";
159
- return `On startup and after a wake, call check_replies for the open Deliveries addressed to you, and claim_goal for your runnable or review-pending Goal and the conversation on it. get_goal rereads it without claiming. Every Goal of your person is open to you, whichever of their agents owns it: read it with get_goal, write on it (contact with its id as parentId, or update_goal progress), and once you have written on it you may change it too. Every read ends in \`next\`, the one step to take. Notifications return immediately: keep working and collect answers through claim_goal/get_goal. ${calls} Evidence can repeat: reads do not acknowledge or hide it. Report progress and acknowledge review with update_goal, never as a contact. 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.
353
+ 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.";
354
+ 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})), and claim_goal for your runnable or review-pending Goal and the conversation on it. get_goal rereads it without claiming. Every Goal of your person is open to you, whichever of their agents owns it: read it with get_goal, write on it (a contact naming its id), and once you have written on it you may change it too (manage_goals). Create, edit, assign, organize or close work with manage_goals, never as a contact; 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 claim_goal/get_goal. ${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.
160
355
 
161
356
  HOW TO ASK:
162
- 1. One question per ask. Five questions are five objects in \`asks\`, in one contact, so each can be answered on its own; one question with five parts settles nothing until all five are answered.
163
- 2. Name the Goal you are working on as the ask's \`parentId\`: the question goes onto that Goal and its answer comes back there. Without one, Paigy places it.
164
- 3. \`waiting: hard\` only for a decision you are blocked on; \`waiting: none\` for a question you can keep working around.
165
- 4. Never hold the process open with while-loops. For an open Call with a pending decision, follow its \`next\` with another bounded \`contact({deliveryId})\` tool call; a returned wait window is not a completed conversation. STOP REREADING when a window comes back with nothing new said \u2014 they are not typing, 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 \`check_replies\` or \`claim_goal\` on that wake.
166
- 5. One ask, 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.
357
+ 1. One question per question 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.
358
+ 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.
359
+ 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.
360
+ 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. 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 \`claim_goal\` on that wake.
361
+ 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\`.
167
362
  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.
168
- 7. A question carries its options. Without them it reaches the person as a bare title nobody can answer. Each option names its choice in full -- never \`All three\` or \`Option 2\`. \`select: "many"\` makes the card a checklist (options they may want several of); \`"one"\`, the default, a pick (one rules out the others). Your ask is sent exactly as you wrote it. They can always answer in their own words, so no "Other" option.
363
+ 7. A question carries its options. Without them it reaches the person as a bare title nobody can answer. Each option names 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. Your question is sent exactly as you wrote it. They can always answer in their own words, so no "Other" option.
169
364
  8. A diagnosis says when, why and how it happens, then proposes one fix. Never options first.`;
170
365
  }
171
366
  var id = z4.string().uuid();
@@ -196,17 +391,6 @@ var existingGoalChanges = [
196
391
  reason: z4.string().max(500).optional()
197
392
  }).strict()
198
393
  ];
199
- var GoalChangeSchema = z4.union([
200
- z4.object({
201
- kind: z4.literal("create"),
202
- title: z4.string().min(1).max(120),
203
- outcome: z4.string().min(1),
204
- ownerId: participant,
205
- parentGoalId: id.optional(),
206
- sourceEntryIds: z4.array(id)
207
- }).strict(),
208
- ...existingGoalChanges
209
- ]);
210
394
  var BrainGoalChangeSchema = z4.union([
211
395
  // newSession: Paigy starts a session to own it (owner, 2026-10-06); until it has, the person owns it.
212
396
  z4.object({
@@ -315,6 +499,66 @@ var CompactResultSchema = z4.object({
315
499
  var COMPACT_RESULT_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
316
500
  zodToJsonSchema2(CompactResultSchema, { $refStrategy: "none" })
317
501
  );
502
+ var str2 = z5.string();
503
+ var strs2 = z5.array(z5.string());
504
+ var TalkerReplySchema = z5.object({
505
+ /** What to say and send, messages to the person first: spoken in the order written. `to` is "user"
506
+ * or an agent's handle; `about` names handles; `blocks` is the item a question to an agent must be
507
+ * answered before ("" for none). */
508
+ messages: z5.array(z5.object({ key: str2, to: str2, text: str2, about: strs2, blocks: str2 }).strict()),
509
+ /** What the call does next: listen, hold (the person asked for a moment) or end (they asked to). */
510
+ then: z5.enum(["listen", "hold", "end"]),
511
+ /** Items the person's words settle: the item's handle, the chosen option IDs, the line handles. */
512
+ answers: z5.array(z5.object({ item: str2, options: strs2, lines: strs2 }).strict()),
513
+ /** The line handles that hold a new instruction from the person. */
514
+ instruction: strs2,
515
+ /** The line handles that ask for new work, a change to existing work, or a standing rule: the filer
516
+ * reads only these (3e). */
517
+ file: strs2,
518
+ /** Evidence to fetch for a second round: a search, an item's full text, or an agent by name. */
519
+ need: z5.object({ kind: z5.enum(["search", "item", "agent", ""]), text: str2 }).strict(),
520
+ /** The handle of the item to explain ("" for none). */
521
+ explain: str2
522
+ }).strict();
523
+ var TALKER_REPLY_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
524
+ zodToJsonSchema3(TalkerReplySchema, { $refStrategy: "none" })
525
+ );
526
+ var str3 = z6.string();
527
+ var strs3 = z6.array(z6.string());
528
+ var FilerReplySchema = z6.object({
529
+ /** Which Goals each new line goes on: a line's handle and Goal handles (or keys of new Goals). */
530
+ filed: z6.array(z6.object({ line: str3, goals: strs3 }).strict()),
531
+ goals: z6.array(z6.object({
532
+ op: z6.enum(["create", "edit", "complete", "cancel", "reopen", "assign", "defer", "move", "block", "unblock"]),
533
+ key: str3,
534
+ goal: str3,
535
+ title: str3,
536
+ outcome: str3,
537
+ owner: str3,
538
+ under: str3,
539
+ until: str3,
540
+ on: str3,
541
+ gate: z6.enum(["start", "complete", "answer", ""]),
542
+ why: str3
543
+ }).strict()),
544
+ questions: z6.array(z6.object({
545
+ op: z6.enum(["create", "edit", "assign", "withdraw"]),
546
+ key: str3,
547
+ question: str3,
548
+ text: str3,
549
+ to: str3,
550
+ goal: str3,
551
+ options: z6.array(z6.object({ id: str3, label: str3 }).strict()),
552
+ pick: z6.enum(["one", "many", "rank", "words", ""]),
553
+ blocks: str3
554
+ }).strict()),
555
+ lessons: z6.array(z6.object({ op: z6.enum(["remember", "revise", "withdraw"]), lesson: str3, text: str3, scope: str3 }).strict()),
556
+ /** Line handles whose words comment on Paigy itself. */
557
+ feedback: strs3
558
+ }).strict();
559
+ var FILER_REPLY_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
560
+ zodToJsonSchema4(FilerReplySchema, { $refStrategy: "none" })
561
+ );
318
562
  function entryWords(entry) {
319
563
  const content = entry.content;
320
564
  if (content && "sealed" in content) return "";
@@ -332,19 +576,29 @@ function entryWords(entry) {
332
576
  }
333
577
  return entry.sources.map((source) => source.text).join("\n");
334
578
  }
579
+ function entryUnit(entry) {
580
+ if (entry.kind !== "contribution" || !entry.aboutId) return null;
581
+ const plain = entry.content && "plain" in entry.content ? entry.content.plain : null;
582
+ if (!plain || typeof plain !== "object") return null;
583
+ const { title, text } = plain;
584
+ return typeof title === "string" && typeof text === "string" ? { title, body: text } : null;
585
+ }
335
586
  var LIVE_MS = 3 * 6e4;
336
587
  var WORKING_MS = 60 * 6e4;
337
- var ContextSchema = z5.object({
338
- title: z5.string().min(1).describe("One-line headline of what you need (required, non-empty)."),
339
- description: z5.array(z5.string().min(1)).describe(
588
+ var ContextSchema = z7.object({
589
+ title: z7.string().min(1).describe("One-line headline of what you need (required, non-empty)."),
590
+ description: z7.array(z7.string().min(1)).describe(
340
591
  "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."
341
- )
592
+ ),
593
+ /** THE ASK'S UNITS (3c): its context as titled units, in order. The app lists the titles and opens
594
+ * a body on a tap. Absent on an ask sent without units, which renders as before. */
595
+ units: z7.array(z7.object({ title: z7.string(), body: z7.string() })).optional()
342
596
  });
343
- var ParticipantSchema = z5.object({
344
- kind: z5.enum(["human", "agent"]),
345
- id: z5.string()
597
+ var ParticipantSchema = z7.object({
598
+ kind: z7.enum(["human", "agent"]),
599
+ id: z7.string()
346
600
  });
347
- var TransformSchema = z5.enum([
601
+ var TransformSchema = z7.enum([
348
602
  "structure",
349
603
  // shape intent into an answer contract; pick channel/urgency — broker `ask`, `select` shapes, `points`
350
604
  "request_more",
@@ -360,13 +614,13 @@ var TransformSchema = z5.enum([
360
614
  "summarize"
361
615
  // reduce volume, keep decision value — 30-turn cap, spoken briefing
362
616
  ]);
363
- var VisualSchema = z5.object({
364
- url: z5.string().url(),
365
- label: z5.string().optional()
617
+ var VisualSchema = z7.object({
618
+ url: z7.string().url(),
619
+ label: z7.string().optional()
366
620
  });
367
- var NotifyLevelSchema = z5.enum(["inbox", "push", "banner", "call"]);
368
- var SelectShapeSchema = z5.enum(["one", "many", "rank", "confirm", "text"]);
369
- var ReceiptEventSchema = z5.enum([
621
+ var NotifyLevelSchema = z7.enum(["inbox", "push", "banner", "call"]);
622
+ var SelectShapeSchema = z7.enum(["one", "many", "rank", "confirm", "text"]);
623
+ var ReceiptEventSchema = z7.enum([
370
624
  "delivered",
371
625
  // the bundle reached the recipient at some level
372
626
  "seen",
@@ -396,47 +650,47 @@ var ReceiptEventSchema = z5.enum([
396
650
  // be rewound by a writer that forgot to advance it.
397
651
  "restarted"
398
652
  ]);
399
- var AttentionSchema = z5.object({
653
+ var AttentionSchema = z7.object({
400
654
  urgency: NotifyLevelSchema,
401
655
  /** The required answer shape, or null for a plain notify that asks nothing back. */
402
656
  select: SelectShapeSchema.nullable(),
403
657
  /** Coverage contract (#396) — points the answer must address; null = none declared. */
404
- points: z5.array(z5.string()).nullable(),
658
+ points: z7.array(z7.string()).nullable(),
405
659
  /** Whether the ask blocks the sender — what lets arbitration escalate it on silence. */
406
- blocking: z5.boolean(),
660
+ blocking: z7.boolean(),
407
661
  /** Reserved (docs/model/model.md lists it): a response deadline. No row column yet — a later Phase 2
408
662
  * slice wires it; optional so today's rows/callers project cleanly. */
409
- deadline: z5.string().datetime().nullable().optional()
663
+ deadline: z7.string().datetime().nullable().optional()
410
664
  });
411
- var NotifyRequestFields = z5.object({
665
+ var NotifyRequestFields = z7.object({
412
666
  /** Plaintext message content. Present on the plaintext path (today's shape);
413
667
  * ABSENT on the E2EE path, where the sealed `envelope` below carries it. The
414
668
  * superRefine at the bottom enforces exactly one of the two. */
415
669
  context: ContextSchema.optional(),
416
- options: z5.array(OptionInputSchema).min(OPTIONS_MIN).max(OPTIONS_MAX).optional().describe(
670
+ options: z7.array(OptionSchema.omit({ id: true }).extend({ label: z7.string().trim().min(1).max(1e3) }).strict()).min(OPTIONS_MIN).max(OPTIONS_MAX).optional().describe(
417
671
  "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)."
418
672
  ),
419
- points: z5.array(z5.string().min(1)).optional().describe(
673
+ points: z7.array(z7.string().min(1)).optional().describe(
420
674
  "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."
421
675
  ),
422
- visuals: z5.array(VisualSchema).optional().describe(
676
+ visuals: z7.array(VisualSchema).optional().describe(
423
677
  "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."
424
678
  ),
425
679
  /** Git repo the agent is working in ("owner/name"). Local MCP fills this from the checkout — omit unless overriding. */
426
- repo: z5.string().optional(),
680
+ repo: z7.string().optional(),
427
681
  /** Git branch the agent is on. Local MCP fills this from the checkout — omit unless overriding. */
428
- branch: z5.string().optional(),
682
+ branch: z7.string().optional(),
429
683
  /** Continue an existing conversation — the id of any notification in it (its root
430
684
  * is the conversation's identity). Omitted = start a new conversation. Renamed
431
685
  * from `parentId` (2026-08-03): one linkage system, the parent; the API edge
432
686
  * still accepts the old name from older clients. */
433
- parentId: z5.string().uuid().optional(),
687
+ parentId: z7.string().uuid().optional(),
434
688
  /** The durable outcome this contact advances. Optional during the notification-to-Work
435
689
  * migration; when present, a blocking ask creates a DecisionNeed for this Work. */
436
- workId: z5.string().uuid().optional(),
690
+ workId: z7.string().uuid().optional(),
437
691
  /** Target Goal scope. During staged migration this is accepted by the shared contract but
438
692
  * target delivery activation remains model-gated; workId and goalId are mutually exclusive. */
439
- goalId: z5.string().uuid().optional(),
693
+ goalId: z7.string().uuid().optional(),
440
694
  urgency: NotifyLevelSchema.default("inbox").describe(
441
695
  "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."
442
696
  ),
@@ -444,7 +698,7 @@ var NotifyRequestFields = z5.object({
444
698
  * visible and marks it needs_input. Renamed from the old `parentId` (2026-08-03)
445
699
  * when `parentId` became the conversation handle: `parentId` says WHERE, this
446
700
  * says HOW. */
447
- clarifies: z5.string().optional(),
701
+ clarifies: z7.string().optional(),
448
702
  select: SelectShapeSchema.optional().describe(
449
703
  "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."
450
704
  ),
@@ -458,20 +712,20 @@ var NotifyRequestFields = z5.object({
458
712
  // (docs/brain/broker/agenda-design.md) — not by a wire cap the agent has to pre-summarize under.
459
713
  // Owner, 2026-07-28: "our actual limitation on how long something is to the user should
460
714
  // come from the broker splitting and summarizing." The cap that remains is a size guard.
461
- ask: z5.string().min(1).max(1e4).optional().describe(
715
+ ask: z7.string().min(1).max(1e4).optional().describe(
462
716
  '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.'
463
717
  ),
464
- needs: z5.array(z5.string().min(1)).optional().describe(
718
+ needs: z7.array(z7.string().min(1)).optional().describe(
465
719
  "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."
466
720
  ),
467
- urgencyHint: z5.enum(["whenever", "soon", "now"]).optional().describe(
721
+ urgencyHint: z7.enum(["whenever", "soon", "now"]).optional().describe(
468
722
  "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."
469
723
  ),
470
724
  /** #575: the ONE self-report that replaces urgencyHint + blocking — what happens
471
725
  * to the agent's work while it waits. Normalized server-side into those two
472
726
  * fields (normalizeWaiting) so everything downstream is untouched; explicit
473
727
  * urgencyHint/blocking win when both are sent. */
474
- waiting: z5.enum(["none", "soft", "hard"]).optional().describe(
728
+ waiting: z7.enum(["none", "soft", "hard"]).optional().describe(
475
729
  "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."
476
730
  ),
477
731
  /** Δ9b (#895): HOLD this claim so the sender can correct the plan before anyone is
@@ -479,98 +733,98 @@ var NotifyRequestFields = z5.object({
479
733
  * holding by default would charge every quiet claim that minute before any agent could
480
734
  * correct anything. Ignored for `waiting: 'hard'`: a blocking ask rings on what we have,
481
735
  * and the enrichment can still land mid-call (#781 re-plans the unspoken tail). */
482
- confirm: z5.boolean().optional().describe(
736
+ confirm: z7.boolean().optional().describe(
483
737
  "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'."
484
738
  ),
485
739
  /** #575: a RELAY of the user's explicitly stated preference, never the agent's
486
740
  * choice. Outranks waiting in both directions: 'call' rings even for a
487
741
  * waiting:'none' "call me when it's done"; 'message' never rings even for
488
742
  * waiting:'hard'. */
489
- channel: z5.enum(["call", "message"]).optional().describe(
743
+ channel: z7.enum(["call", "message"]).optional().describe(
490
744
  "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."
491
745
  ),
492
- confirmStyle: z5.enum(["yesno", "approve"]).default("yesno").describe(
746
+ confirmStyle: z7.enum(["yesno", "approve"]).default("yesno").describe(
493
747
  "Labels for a select:'confirm' paige \u2014 'yesno' (Yes/No) or 'approve' (Approve/Deny). Ignored unless select is 'confirm'."
494
748
  ),
495
- blocking: z5.boolean().default(false).describe(
749
+ blocking: z7.boolean().default(false).describe(
496
750
  "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."
497
751
  )
498
752
  });
499
753
  var NotifyRequestSchema = NotifyRequestFields.superRefine((r, ctx) => {
500
- if (r.workId && r.goalId) ctx.addIssue({ code: z5.ZodIssueCode.custom, path: ["goalId"], message: "pass goalId or workId, not both" });
754
+ if (r.workId && r.goalId) ctx.addIssue({ code: z7.ZodIssueCode.custom, path: ["goalId"], message: "pass goalId or workId, not both" });
501
755
  if (r.ask !== void 0) {
502
756
  for (const f of ["context", "select", "points"]) {
503
757
  if (r[f] !== void 0)
504
- ctx.addIssue({ code: z5.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.` });
758
+ ctx.addIssue({ code: z7.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.` });
505
759
  }
506
760
  return;
507
761
  }
508
762
  if (r.needs !== void 0 || r.urgencyHint !== void 0)
509
- ctx.addIssue({ code: z5.ZodIssueCode.custom, path: ["needs"], message: "needs/urgencyHint belong to the simplified `ask` form \u2014 with a shaped request use points/urgency" });
763
+ ctx.addIssue({ code: z7.ZodIssueCode.custom, path: ["needs"], message: "needs/urgencyHint belong to the simplified `ask` form \u2014 with a shaped request use points/urgency" });
510
764
  if (!r.context)
511
- ctx.addIssue({ code: z5.ZodIssueCode.custom, path: ["context"], message: "context is required (plaintext path)" });
765
+ ctx.addIssue({ code: z7.ZodIssueCode.custom, path: ["context"], message: "context is required (plaintext path)" });
512
766
  if (!r.select)
513
- ctx.addIssue({ code: z5.ZodIssueCode.custom, path: ["select"], message: "select is required on the shaped form" });
767
+ ctx.addIssue({ code: z7.ZodIssueCode.custom, path: ["select"], message: "select is required on the shaped form" });
514
768
  const needsOptions = r.select === "one" || r.select === "many" || r.select === "rank";
515
769
  if (needsOptions && !r.options?.length)
516
- ctx.addIssue({ code: z5.ZodIssueCode.custom, path: ["options"], message: `select:'${r.select}' requires options` });
770
+ ctx.addIssue({ code: z7.ZodIssueCode.custom, path: ["options"], message: `select:'${r.select}' requires options` });
517
771
  if (!needsOptions && r.options?.length)
518
- ctx.addIssue({ code: z5.ZodIssueCode.custom, path: ["options"], message: `select:'${r.select}' takes no options` });
772
+ ctx.addIssue({ code: z7.ZodIssueCode.custom, path: ["options"], message: `select:'${r.select}' takes no options` });
519
773
  });
520
- var NotifyStatusSchema = z5.enum(["pending", "answered", "ignored"]);
521
- var AgentStateSchema = z5.enum(["idle", "in_progress", "completed", "needs_input"]);
522
- var TurnSchema = z5.object({
523
- prompt: z5.string(),
524
- reply: z5.string()
774
+ var NotifyStatusSchema = z7.enum(["pending", "answered", "ignored"]);
775
+ var AgentStateSchema = z7.enum(["idle", "in_progress", "completed", "needs_input"]);
776
+ var TurnSchema = z7.object({
777
+ prompt: z7.string(),
778
+ reply: z7.string()
525
779
  });
526
- var UserAnswerSchema = z5.discriminatedUnion("kind", [
527
- z5.object({ kind: z5.literal("option"), optionId: z5.string(), label: z5.string().optional() }),
528
- z5.object({ kind: z5.literal("text"), text: z5.string() }),
529
- z5.object({ kind: z5.literal("ignored") }),
530
- z5.object({ kind: z5.literal("multi"), optionIds: z5.array(z5.string()), labels: z5.array(z5.string()).optional() }),
531
- z5.object({ kind: z5.literal("ranked"), optionIds: z5.array(z5.string()), labels: z5.array(z5.string()).optional() }),
532
- z5.object({ kind: z5.literal("clarify"), chunks: z5.array(z5.string()).min(1) }),
533
- z5.object({ kind: z5.literal("confirm"), approved: z5.boolean() }),
534
- z5.object({ kind: z5.literal("turns"), turns: z5.array(TurnSchema).min(1) }),
780
+ var UserAnswerSchema = z7.discriminatedUnion("kind", [
781
+ z7.object({ kind: z7.literal("option"), optionId: z7.string(), label: z7.string().optional() }),
782
+ z7.object({ kind: z7.literal("text"), text: z7.string() }),
783
+ z7.object({ kind: z7.literal("ignored") }),
784
+ z7.object({ kind: z7.literal("multi"), optionIds: z7.array(z7.string()), labels: z7.array(z7.string()).optional() }),
785
+ z7.object({ kind: z7.literal("ranked"), optionIds: z7.array(z7.string()), labels: z7.array(z7.string()).optional() }),
786
+ z7.object({ kind: z7.literal("clarify"), chunks: z7.array(z7.string()).min(1) }),
787
+ z7.object({ kind: z7.literal("confirm"), approved: z7.boolean() }),
788
+ z7.object({ kind: z7.literal("turns"), turns: z7.array(TurnSchema).min(1) }),
535
789
  /** An auto-answer derived from the user's PAST decisions (docs/brain/broker/precedent-design.md §2):
536
790
  * delivered through the same settle/await path as a human answer, carrying the judge's
537
791
  * derivation and the precedent ids it grew from. Always paired with a visible trail
538
792
  * card the user can reply to — the broker never overrides the user. */
539
- z5.object({ kind: z5.literal("precedent"), answer: z5.string(), derivation: z5.string(), sources: z5.array(z5.string()).min(1) })
793
+ z7.object({ kind: z7.literal("precedent"), answer: z7.string(), derivation: z7.string(), sources: z7.array(z7.string()).min(1) })
540
794
  ]);
541
- var IntentSchema = z5.object({
795
+ var IntentSchema = z7.object({
542
796
  // The full vocabulary the bot's mapper emits (mapper.INTENT_KINDS) — the schema lagged
543
797
  // it by two ("detail", "feedback"), and because the settle handler parsed the array
544
798
  // all-or-nothing, ONE feedback act silently dropped EVERY intent on the call,
545
799
  // questions included. Found auditing five calls' stored feedback, 2026-08-01.
546
- kind: z5.enum(["defer", "delegate", "channel", "question", "detail", "feedback", "command", "control"]),
547
- detail: z5.string(),
800
+ kind: z7.enum(["defer", "delegate", "channel", "question", "detail", "feedback", "command", "control"]),
801
+ detail: z7.string(),
548
802
  /** Defer only: seconds until the callback the caller asked for, when something upstream
549
803
  * already read the time. Nothing sets it today (#397 documented an MCP parser that was
550
804
  * never written) — the API reads the defer's `detail` itself with `notes/when.ts`
551
805
  * (`parseDelay`, #1292), and a value here simply wins over that reading. */
552
- dueInSeconds: z5.number().int().positive().optional(),
806
+ dueInSeconds: z7.number().int().positive().optional(),
553
807
  /** Feedback only (#812): WHICH failure the complaint names — typed by the mapper that
554
808
  * already read the utterance, so `signals.kind` stops defaulting to
555
809
  * 'other' on every row. A table that records that something was wrong and nothing
556
810
  * about what cannot answer "is the bot looping less this week?". */
557
- fault: z5.enum(["loop", "unanswered", "overridden", "misheard", "slow", "other"]).optional()
811
+ fault: z7.enum(["loop", "unanswered", "overridden", "misheard", "slow", "other"]).optional()
558
812
  });
559
- var RideAlongSchema = z5.object({
813
+ var RideAlongSchema = z7.object({
560
814
  /** The note this came from — assign/clarify/close it through /api/notes/:id. */
561
- noteId: z5.string(),
815
+ noteId: z7.string(),
562
816
  /** What to do, in the owner's own words (the note's headline). Never model-rewritten. */
563
- text: z5.string(),
817
+ text: z7.string(),
564
818
  /** The thread to report back on, when the note was dispatched over the request rail. */
565
- parentId: z5.string().nullable()
819
+ parentId: z7.string().nullable()
566
820
  });
567
- var AwaitItemSchema = z5.discriminatedUnion("type", [
568
- z5.object({
569
- type: z5.literal("reply"),
570
- parentId: z5.string(),
571
- notificationId: z5.string(),
572
- workId: z5.string().uuid().optional(),
573
- decisionId: z5.string().uuid().optional(),
821
+ var AwaitItemSchema = z7.discriminatedUnion("type", [
822
+ z7.object({
823
+ type: z7.literal("reply"),
824
+ parentId: z7.string(),
825
+ notificationId: z7.string(),
826
+ workId: z7.string().uuid().optional(),
827
+ decisionId: z7.string().uuid().optional(),
574
828
  answer: UserAnswerSchema,
575
829
  /** WHAT THE AGENT CANNOT KNOW FROM THE FIELDS BESIDE IT (owner, 2026-09-04, issue
576
830
  * #1537). One line, built from the record: the ask and the caller's reply VERBATIM,
@@ -580,103 +834,103 @@ var AwaitItemSchema = z5.discriminatedUnion("type", [
580
834
  * "call me back after you merge" in their own words decides for itself what to do,
581
835
  * and now knows exactly which call to make. Absent when either half is missing —
582
836
  * a sentence with a hole in it is worse than no sentence. */
583
- note: z5.string().optional(),
837
+ note: z7.string().optional(),
584
838
  /** The call record rendered for THIS agent (`docs/brain/voice/record-design.md`): the words the
585
839
  * shaped answer was mapped from, filtered to its own claims. There is no second list
586
840
  * of labels beside it — the acts went 2026-09-04 and `intents` went with them (owner,
587
841
  * 2026-09-04): the agent reads the sentence and decides. */
588
- transcript: z5.string().optional(),
842
+ transcript: z7.string().optional(),
589
843
  /** Coverage report (#396), when the ask declared `points`: which of them this
590
844
  * answer addressed. Missing points = re-ask or proceed knowingly partial. */
591
- covered: z5.array(z5.string()).optional(),
845
+ covered: z7.array(z7.string()).optional(),
592
846
  /** Ride-alongs (RideAlongSchema) — pending work for you, attached to the moment you
593
847
  * became free. Only `reply` and `idle` carry it: those are the two outcomes that
594
848
  * END a wait. `remind`, `superseded` and `turn` are mid-flight, and handing an
595
849
  * agent a side-quest while it is still holding the line is how the main thing gets
596
850
  * dropped. Absent/empty = nothing owed. */
597
- also: z5.array(RideAlongSchema).optional()
851
+ also: z7.array(RideAlongSchema).optional()
598
852
  }),
599
- z5.object({
600
- type: z5.literal("remind"),
601
- parentId: z5.string(),
602
- notificationId: z5.string(),
603
- remindAt: z5.string().datetime({ offset: true }),
853
+ z7.object({
854
+ type: z7.literal("remind"),
855
+ parentId: z7.string(),
856
+ notificationId: z7.string(),
857
+ remindAt: z7.string().datetime({ offset: true }),
604
858
  /** Seconds until remindAt, server-computed — pass straight to ScheduleWakeup. */
605
- remindInSeconds: z5.number()
859
+ remindInSeconds: z7.number()
606
860
  }),
607
861
  /** The awaited ask was REPLACED by a newer notification on its thread (e.g. a
608
862
  * post-feedback revision, #633) — the user will never answer this id. Stop
609
863
  * awaiting it; the live ask is the thread's newest turn (await that one, or
610
- * re-orient via check_replies). */
611
- z5.object({
612
- type: z5.literal("superseded"),
613
- parentId: z5.string(),
614
- notificationId: z5.string()
864
+ * re-orient via contact({})). */
865
+ z7.object({
866
+ type: z7.literal("superseded"),
867
+ parentId: z7.string(),
868
+ notificationId: z7.string()
615
869
  }),
616
870
  /** A LIVE call's turn, streamed as it lands (#783). PROVISIONAL: the user can still
617
871
  * revise any of these until the final reply arrives — partial = intelligence,
618
872
  * settled = authorization. Use it to PREPARE (fetch, draft, warm), never to act
619
873
  * irreversibly. If `acts` carries a question aimed at you and you know the answer,
620
874
  * contact on the same thread right away — the caller hears it on the same call. */
621
- z5.object({
622
- type: z5.literal("partial"),
623
- notificationId: z5.string(),
624
- inFlight: z5.literal(true),
625
- turn: z5.object({
626
- idx: z5.number(),
627
- prompt: z5.string(),
628
- reply: z5.string(),
629
- acts: z5.array(IntentSchema).nullable().optional()
875
+ z7.object({
876
+ type: z7.literal("partial"),
877
+ notificationId: z7.string(),
878
+ inFlight: z7.literal(true),
879
+ turn: z7.object({
880
+ idx: z7.number(),
881
+ prompt: z7.string(),
882
+ reply: z7.string(),
883
+ acts: z7.array(IntentSchema).nullable().optional()
630
884
  })
631
885
  }),
632
- z5.object({
633
- type: z5.literal("idle"),
634
- also: z5.array(RideAlongSchema).optional(),
886
+ z7.object({
887
+ type: z7.literal("idle"),
888
+ also: z7.array(RideAlongSchema).optional(),
635
889
  /** Is a call live for this agent's user right now? The SDK polls the partial stream
636
890
  * (#783) between idle ticks ONLY while this is not `false` — a partial can only exist
637
891
  * during a live call, and polling for one on a banner/message was a wasted HTTP call +
638
892
  * 3 queries on every idle tick of every waiting agent (~80% of all traffic at scale).
639
893
  * Absent = an older API → the SDK keeps polling, exactly as before. */
640
- inFlight: z5.boolean().optional()
894
+ inFlight: z7.boolean().optional()
641
895
  })
642
896
  ]);
643
- var VoiceKeySchema = z5.enum(["rachel", "george", "jessica", "brian", "lily"]);
644
- var AgendaTurnSchema = z5.object({
897
+ var VoiceKeySchema = z7.enum(["rachel", "george", "jessica", "brian", "lily"]);
898
+ var AgendaTurnSchema = z7.object({
645
899
  /** THE TURN'S IDENTITY (the first-sentence stream, 2026-09-09): the brain call that wrote
646
900
  * it and its place in that reply — `<brainCallId>:<index>`, with `:p` on the first
647
901
  * sentence a re-plan publishes ahead of the rest. A turn is spoken once, by this id: the
648
902
  * completion of a streamed re-plan carries the published sentence again, and the walk
649
903
  * drops what it already said by identity, never by the API's guess of what was polled.
650
904
  * Absent on plans nothing streams (a ring plan, a floor). */
651
- id: z5.string().optional(),
905
+ id: z7.string().optional(),
652
906
  /** Twin coverage (#1089): sibling claim ids this asking turn's answer ALSO settles —
653
907
  * the planner declares duplicates instead of asking them twice. */
654
- coveredIds: z5.array(z5.string()).optional(),
908
+ coveredIds: z7.array(z7.string()).optional(),
655
909
  /** The spoken sentences of the turn, in order. No count: how long a turn is is the brain's call
656
910
  * (owner, 2026-09-25), and a count here refused whole plans. */
657
- info: z5.array(z5.string().min(1)).default([]),
658
- question: z5.string().min(1).nullable(),
911
+ info: z7.array(z7.string().min(1)).default([]),
912
+ question: z7.string().min(1).nullable(),
659
913
  /** True on the one turn carrying the agent's own declared question. */
660
- asks: z5.boolean().optional(),
914
+ asks: z7.boolean().optional(),
661
915
  /** The claim this turn belongs to (#781) — the RETURN identity: answers route by it.
662
916
  * Absent on a single-claim plan (the session's own claim) and on shared context turns,
663
917
  * which route nothing. */
664
- claimId: z5.string().optional(),
918
+ claimId: z7.string().optional(),
665
919
  /** The claim's voice key (#462) — the OUTBOUND identity, audible who-is-asking. */
666
- voice: z5.string().optional(),
920
+ voice: z7.string().optional(),
667
921
  /** The claim's AGENT NAME (#838) — the spoken identity. A voice alone doesn't say
668
922
  * whose request this is: an item that folded in from another agent arrived as a bare
669
923
  * non-sequitur ("First real production sign-in is yours to make whenever you want.")
670
924
  * and the owner answered "What?". The bot names the agent before its first turn. */
671
- agent: z5.string().optional(),
925
+ agent: z7.string().optional(),
672
926
  /** The claim's agent by ID — the pairing's connection id (`notifications.token_id`), the
673
927
  * same id a face is minted from. A name is not an identity: two pairings may be called
674
928
  * "Claude", and a name cannot be joined on. The record's entries carry it (`agent_id`)
675
929
  * so "who said that" survives the call, and it rides PER TURN because a coalesced call
676
930
  * speaks for several agents — the turn is the only place that knows which. */
677
- agentId: z5.string().optional(),
931
+ agentId: z7.string().optional(),
678
932
  select: SelectShapeSchema.optional(),
679
- options: z5.array(OptionSchema.omit({ id: true })).optional(),
933
+ options: z7.array(OptionSchema.omit({ id: true })).optional(),
680
934
  /* `pace` STOOD HERE (#826). A turn could carry seconds and the model chose them. The walk
681
935
  paces itself now — a short beat between the sentences of a turn, the longer one at its end
682
936
  (owner, 2026-09-30: "remove the bot deciding pace") — and it does that where the words are
@@ -685,33 +939,33 @@ var AgendaTurnSchema = z5.object({
685
939
  /** Whether the walk WAITS for an answer before moving on. Absent = derived as today
686
940
  * (a question blocks, context flows). blocking:false on a question = ask and move
687
941
  * on, the claim stays pending; blocking:true on context = hold for a reply. */
688
- blocking: z5.boolean().optional(),
942
+ blocking: z7.boolean().optional(),
689
943
  /** SPOKEN ONLY IF THEY SAY NOTHING (owner, 2026-10-01, call 812de935: "you're gonna re-ask, but it
690
944
  * shouldn't be the same words … more like, hey, are you still there, or are you able to answer, or
691
945
  * would you need more information"). The walk holds this turn out of its queue; at the queue's end it
692
946
  * listens for the last word, and only if that listen is silent is this turn said and asked. If they
693
947
  * speak, it is dropped and their words are taken like any reply. */
694
- ifSilent: z5.boolean().optional()
948
+ ifSilent: z7.boolean().optional()
695
949
  });
696
950
  var CLAIM_STALE_MS = 30 * 6e4;
697
- var InboxItemSchema = z5.object({
698
- id: z5.string(),
699
- tokenId: z5.string().optional(),
951
+ var InboxItemSchema = z7.object({
952
+ id: z7.string(),
953
+ tokenId: z7.string().optional(),
700
954
  status: NotifyStatusSchema,
701
955
  context: ContextSchema,
702
- options: z5.array(OptionSchema).optional(),
956
+ options: z7.array(OptionSchema).optional(),
703
957
  /** The ask's declared coverage points (#396), when the agent sent them. */
704
- points: z5.array(z5.string()).optional(),
958
+ points: z7.array(z7.string()).optional(),
705
959
  /** Does this claim want an ANSWER, or is it telling you something? Written per row from
706
960
  * `requestAsks` — the agent's own declaration, not a guess. `false` is what earns a card
707
961
  * its acknowledge affordance: without it a status update offers a text box and a dismiss,
708
962
  * and neither of those is "got it" (owner, 2026-08-10). */
709
- asks: z5.boolean().optional(),
963
+ asks: z7.boolean().optional(),
710
964
  /** When a live process last pulsed for this row's agent — the liveness input for
711
965
  * "working requires a pulse" (#928): the list said "Working…" from agent_state alone
712
966
  * while the party called the same dead claim stalled. Absent = no token/no data,
713
967
  * which must never CLAIM stalled. */
714
- lastSeenAt: z5.string().optional(),
968
+ lastSeenAt: z7.string().optional(),
715
969
  /** WHEN THE AGENT LAST SAID ANYTHING ABOUT THIS CLAIM — the newest `agent_state` row in
716
970
  * the `notification_events` ledger (trigger-written since 20260621010000, so every row a
717
971
  * user can see has one). The age input for `CLAIM_STALE_MS`, and it has to be this rather
@@ -721,7 +975,7 @@ var InboxItemSchema = z5.object({
721
975
  * work. Reading the row's birth as the claim's age brands that "No update in 8h" the
722
976
  * instant the agent picks it up (#997). Absent = pre-trigger row; fall back to
723
977
  * `createdAt`. */
724
- agentStateAt: z5.string().datetime().optional(),
978
+ agentStateAt: z7.string().datetime().optional(),
725
979
  /** THE QUESTIONS A CALL CARRIES — the call screen's agenda spine (docs/clients/app/walk/design.md §11, owner
726
980
  * 2026-09-22). One per DecisionNeed on the Call, in the Call's order, answered or open (a
727
981
  * superseded or cancelled need is no longer a question anyone is asked). Present only on a
@@ -735,54 +989,54 @@ var InboxItemSchema = z5.object({
735
989
  * `turn` topic (`asking`, `settled`), because the bot never sees a DecisionNeed id. `title` is
736
990
  * the card's own concise heading; `answer` the accepted answer in words, null while open. It
737
991
  * REPLACED `agenda` (turns), which nothing ever filled. */
738
- questions: z5.array(z5.object({
739
- id: z5.string(),
740
- entryId: z5.string(),
741
- title: z5.string(),
742
- state: z5.enum(["open", "answered"]),
743
- answer: z5.string().nullable(),
992
+ questions: z7.array(z7.object({
993
+ id: z7.string(),
994
+ entryId: z7.string(),
995
+ title: z7.string(),
996
+ state: z7.enum(["open", "answered"]),
997
+ answer: z7.string().nullable(),
744
998
  /** WHO ASKED IT (owner, 2026-09-23, Goal a345e906: each agenda row wears its agent's face) — the
745
999
  * request Entry's author, as the same three facts the item's own `tokenId`/`name`/`voice`
746
1000
  * carry for the call's one agent, so the phone draws it with the same seed. Absent when the
747
1001
  * author is not an agent this account holds (unpaired since, or a person). */
748
- agent: z5.object({ tokenId: z5.string(), name: z5.string(), voice: VoiceKeySchema.optional() }).optional(),
1002
+ agent: z7.object({ tokenId: z7.string(), name: z7.string(), voice: VoiceKeySchema.optional() }).optional(),
749
1003
  /** ITS OPTIONS, WHEN THERE IS SOMETHING TO SEE (owner, 2026-09-25: "Yes, add it"): the options
750
1004
  * its need offers, exactly as its own card carries them, present only when one of them has a
751
1005
  * preview (`html` or `image`). The call screen opens them from the agenda row, so a preview is
752
1006
  * never re-sent as a second card to be seen mid-call. Words-only options are absent — the bot
753
1007
  * says those, and the list stays small (an `html` is up to 16 KB). */
754
- options: z5.array(OptionSchema).optional()
1008
+ options: z7.array(OptionSchema).optional()
755
1009
  })).optional(),
756
- visuals: z5.array(VisualSchema).optional(),
1010
+ visuals: z7.array(VisualSchema).optional(),
757
1011
  /** The connected agent's name (the single pairing name — user-typed, or the
758
1012
  * agent's suggestion, or a default silly name). */
759
- name: z5.string(),
1013
+ name: z7.string(),
760
1014
  /** The pairing's assigned voice (#462); absent = the default voice. */
761
1015
  voice: VoiceKeySchema.optional(),
762
- repo: z5.string().optional(),
763
- branch: z5.string().optional(),
764
- createdAt: z5.string().datetime(),
765
- snoozedUntil: z5.string().datetime().optional(),
1016
+ repo: z7.string().optional(),
1017
+ branch: z7.string().optional(),
1018
+ createdAt: z7.string().datetime(),
1019
+ snoozedUntil: z7.string().datetime().optional(),
766
1020
  agentState: AgentStateSchema.default("idle"),
767
1021
  /** Whose action the item is waiting on: "you" = an agent asked you (the default,
768
1022
  * every agent→user notification); "agent" = you sent a request and it's awaiting the
769
1023
  * agent (held in the inbox until the agent replies on the thread). */
770
- turn: z5.enum(["you", "agent"]).default("you"),
1024
+ turn: z7.enum(["you", "agent"]).default("you"),
771
1025
  /** Hard error reason on an awaiting request (turn="agent") — the wake failed to reach
772
1026
  * the agent (provider-agnostic; set server-side). Absent = no hard error. Drives the inbox
773
1027
  * error badge + Retry. */
774
- error: z5.string().optional(),
1028
+ error: z7.string().optional(),
775
1029
  /** WHEN THIS AGENT WORK WENT QUIET (turn="agent"), by the one rule (`coldSince`: three days
776
1030
  * with nothing said), or absent while it is not stalled. The inbox's stalled badge reads
777
1031
  * this and nothing else (2026-09-23: a 3-minute age rule badged every live Goal stalled,
778
1032
  * and "dismiss the stalled ones" cancelled 37 pieces of live work). */
779
- cold: z5.string().datetime().optional(),
780
- clarifies: z5.string().optional(),
1033
+ cold: z7.string().datetime().optional(),
1034
+ clarifies: z7.string().optional(),
781
1035
  /** THIS CARD'S QUESTION IS ON A LIVE CALL (owner, 2026-09-24: "Mark it while the call is
782
1036
  * live"). Present only while an open Call Delivery carries the card's request Entry — read
783
1037
  * off the same open list the card came from, so it clears when the Call does. A card is the
784
1038
  * backup for a call not taken; while the call has it, the call is where it is answered. */
785
- onCall: z5.literal(true).optional(),
1039
+ onCall: z7.literal(true).optional(),
786
1040
  /** THE RING, ON THE ITEM (docs/clients/app/walk/design.md §12 §17, #2251): the last ring on this card was
787
1041
  * declined, and what the ladder will do next — read off the cron's own row, never computed
788
1042
  * on the phone. Present only while a `declined` receipt stands on the card's last Call.
@@ -792,31 +1046,31 @@ var InboxItemSchema = z5.object({
792
1046
  * It replaced `gaveUp` (deleted 2026-09-22): "the ladder spent" was a boolean the projection
793
1047
  * never set, and it is `nextRingAt === null` here — the party's *Missed you* (`party/dress.ts`)
794
1048
  * and the roster's `unreached` read `declinedAt`, and stand while it does. */
795
- ring: z5.object({
796
- declinedAt: z5.string().datetime(),
797
- anchorAt: z5.string().datetime(),
798
- nextRingAt: z5.string().datetime().nullable(),
799
- step: z5.number().int()
1049
+ ring: z7.object({
1050
+ declinedAt: z7.string().datetime(),
1051
+ anchorAt: z7.string().datetime(),
1052
+ nextRingAt: z7.string().datetime().nullable(),
1053
+ step: z7.number().int()
800
1054
  }).optional(),
801
1055
  /** Why this arrived the way it did, read back off the delivery receipt (`notify/why.ts`).
802
1056
  * Absent for anything never delivered through a push, and for older rows written before
803
1057
  * the reason was recorded. Deliberately a debug affordance, shown small (owner,
804
1058
  * 2026-08-07) — its real job is to give "this didn't need a call" something to be
805
1059
  * feedback ABOUT. */
806
- why: z5.object({
1060
+ why: z7.object({
807
1061
  asked: NotifyLevelSchema,
808
1062
  got: NotifyLevelSchema,
809
- because: z5.enum(["unresponsive", "dismissed", "not_permitted", "silent", "coalesced", "agent_capped", "unplanned", "learned_raise"]).optional(),
810
- line: z5.string()
1063
+ because: z7.enum(["unresponsive", "dismissed", "not_permitted", "silent", "coalesced", "agent_capped", "unplanned", "learned_raise"]).optional(),
1064
+ line: z7.string()
811
1065
  }).optional(),
812
- select: z5.enum(["one", "many", "rank", "confirm", "text"]).default("one"),
813
- confirmStyle: z5.enum(["yesno", "approve"]).default("yesno").describe(
1066
+ select: z7.enum(["one", "many", "rank", "confirm", "text"]).default("one"),
1067
+ confirmStyle: z7.enum(["yesno", "approve"]).default("yesno").describe(
814
1068
  "Labels for a select:'confirm' paige \u2014 'yesno' (Yes/No) or 'approve' (Approve/Deny). Ignored unless select is 'confirm'."
815
1069
  ),
816
1070
  /** Real downstream work is stuck behind this one — set by the agent, independent of
817
1071
  * urgency (see the main README's "premier use case" + docs/delivery/notify/states.md). Drives the
818
1072
  * inbox's blocking badge and the extra confirm step before dismissing it. */
819
- blocking: z5.boolean().default(false),
1073
+ blocking: z7.boolean().default(false),
820
1074
  /** The user's locked-in answer; present only for replied items (GET /api/replied/:id). */
821
1075
  answer: UserAnswerSchema.optional(),
822
1076
  /** THE TARGET FACTS A CARD RENDERS (#1796 point 5, 2026-09-11): the Delivery it is a view of,
@@ -824,17 +1078,17 @@ var InboxItemSchema = z5.object({
824
1078
  * for a request that asks nothing), whether its content is sealed, and that Goal's state. The
825
1079
  * answer writer (`POST /api/entries`) and the disposition (`close_delivery`) take their ids from
826
1080
  * here. The server projects it (`apps/api/src/inbox/project.ts`); a client never builds it. */
827
- communication: z5.object({
828
- deliveryId: z5.string(),
829
- kind: z5.enum(["notification", "call"]),
830
- entryId: z5.string(),
831
- goalIds: z5.array(z5.string()),
832
- decisionNeedId: z5.string().optional(),
833
- sealed: z5.boolean(),
834
- goalState: z5.string().optional(),
1081
+ communication: z7.object({
1082
+ deliveryId: z7.string(),
1083
+ kind: z7.enum(["notification", "call"]),
1084
+ entryId: z7.string(),
1085
+ goalIds: z7.array(z7.string()),
1086
+ decisionNeedId: z7.string().optional(),
1087
+ sealed: z7.boolean(),
1088
+ goalState: z7.string().optional(),
835
1089
  /** THAT GOAL'S NAME (#2416) — what Activity's row is headed by, since a row there is one Goal
836
1090
  * and the cards it holds sit behind it. Stamped by the same read as `goalState`. */
837
- goalTitle: z5.string().optional()
1091
+ goalTitle: z7.string().optional()
838
1092
  }).optional(),
839
1093
  /** WHAT THIS CARD IS, IN TWELVE CHARACTERS (#3019) — the hash of every other field on it, stamped
840
1094
  * by the one read that serves the open list (`apps/api/src/inbox/project.ts` `inboxFor`). It is
@@ -846,27 +1100,27 @@ var InboxItemSchema = z5.object({
846
1100
  * own moves (its Goal's state and name, how cold the work behind it has gone, whether a ring is
847
1101
  * live). Optional, so a fixture, the demo and the archive lens need not spell one, and a card
848
1102
  * with no rev is simply always re-sent. */
849
- rev: z5.string().optional()
1103
+ rev: z7.string().optional()
850
1104
  });
851
1105
  var APNS_TOKEN_RE = /^[0-9a-fA-F]{64}$/;
852
- var PushTokenSchema = z5.object({
853
- voipToken: z5.string().min(1).optional(),
854
- alertToken: z5.string().min(1).optional(),
855
- fcmToken: z5.string().min(1).optional(),
856
- platform: z5.enum(["ios", "android"])
1106
+ var PushTokenSchema = z7.object({
1107
+ voipToken: z7.string().min(1).optional(),
1108
+ alertToken: z7.string().min(1).optional(),
1109
+ fcmToken: z7.string().min(1).optional(),
1110
+ platform: z7.enum(["ios", "android"])
857
1111
  }).superRefine((v, ctx) => {
858
1112
  if (v.platform !== "ios") return;
859
1113
  for (const field of ["voipToken", "alertToken"]) {
860
1114
  const token = v[field];
861
1115
  if (token === void 0 || APNS_TOKEN_RE.test(token)) continue;
862
1116
  ctx.addIssue({
863
- code: z5.ZodIssueCode.custom,
1117
+ code: z7.ZodIssueCode.custom,
864
1118
  path: [field],
865
1119
  message: `not an APNs device token (want 64 hex chars, got ${token.length})`
866
1120
  });
867
1121
  }
868
1122
  });
869
- var MissedCallSchema = z5.enum([
1123
+ var MissedCallSchema = z7.enum([
870
1124
  "retry_10m",
871
1125
  "retry_30m",
872
1126
  "retry_60m",
@@ -878,31 +1132,31 @@ var MissedCallSchema = z5.enum([
878
1132
  ]);
879
1133
  var clock = (h) => h === 0 ? "midnight" : h === 12 ? "noon" : h < 12 ? `${h} am` : `${h - 12} pm`;
880
1134
  var QUIET = ` Nothing rings from ${clock(NIGHT.from)} to ${clock(NIGHT.to)} your time; the count waits for morning.`;
881
- var BrokerTuningSchema = z5.object({
1135
+ var BrokerTuningSchema = z7.object({
882
1136
  /** 'none' = skip the spoken ack after a mapped answer (power users find it slow). */
883
- ackVerbosity: z5.enum(["normal", "none"]).optional(),
1137
+ ackVerbosity: z7.enum(["normal", "none"]).optional(),
884
1138
  /** How readily the mapper asks its one clarification: 'low' = only when truly
885
1139
  * uninterpretable, 'high' = whenever not fully certain. */
886
- clarifyEagerness: z5.enum(["low", "normal", "high"]).optional(),
1140
+ clarifyEagerness: z7.enum(["low", "normal", "high"]).optional(),
887
1141
  /** The user's own shorthand: when they say `say`, they mean `mean`. */
888
- phrasebook: z5.array(z5.object({ say: z5.string().min(1).max(60), mean: z5.string().min(1).max(120) })).max(24).optional(),
1142
+ phrasebook: z7.array(z7.object({ say: z7.string().min(1).max(60), mean: z7.string().min(1).max(120) })).max(24).optional(),
889
1143
  /** The language calls are PLANNED in, when the account has chosen one (#1272). Absent —
890
1144
  * which is every account today — means the agent's own words decide, per ask: a call
891
1145
  * about an English ask opens in English. This is the only thing that overrides that,
892
1146
  * and a live caller who switches language mid-call still outranks it (broker/lang.ts).
893
1147
  * Set per user (no UI yet), like `voiceTuning`. */
894
- language: z5.enum(["en", "es"]).optional()
1148
+ language: z7.enum(["en", "es"]).optional()
895
1149
  });
896
- var UserSettingsSchema = z5.object({
897
- permissions: z5.object({
898
- call: z5.boolean(),
899
- banner: z5.boolean(),
900
- push: z5.boolean()
1150
+ var UserSettingsSchema = z7.object({
1151
+ permissions: z7.object({
1152
+ call: z7.boolean(),
1153
+ banner: z7.boolean(),
1154
+ push: z7.boolean()
901
1155
  }),
902
1156
  /** LockedIn / Default / DateNight on screen; the stored words are unchanged on purpose —
903
1157
  * they are an enum on a live column across every account, and the rename is a rename of
904
1158
  * what people read (owner, 2026-09-30). */
905
- sessionMode: z5.enum(["default", "all_calls", "silent"]),
1159
+ sessionMode: z7.enum(["default", "all_calls", "silent"]),
906
1160
  /** `silentPush` lived here until #2813 and is now GONE, field and column both. It was kept as an
907
1161
  * optional long after DateNight stopped reading it, on the theory that a phone on an older
908
1162
  * bundle PATCHing the whole settings object would be REFUSED for sending a key we had stopped
@@ -911,7 +1165,7 @@ var UserSettingsSchema = z5.object({
911
1165
  * an old bundle's `silentPush` is accepted and ignored. Worth remembering before keeping the
912
1166
  * next dead field for the same reason. */
913
1167
  /** Opt-in (default false) to using your content to improve Paigy and train models. */
914
- improveConsent: z5.boolean(),
1168
+ improveConsent: z7.boolean(),
915
1169
  missedCall: MissedCallSchema.default("backoff_standard"),
916
1170
  /** Where voice audio is processed. 'hosted' (default) = Paigy's voice services
917
1171
  * (ElevenLabs TTS, faster-whisper STT, the call bot); 'on_device' = the phone
@@ -919,17 +1173,17 @@ var UserSettingsSchema = z5.object({
919
1173
  * Optional, NOT defaulted: a stale client PATCHing the full settings object
920
1174
  * must not silently reset this privacy choice. Absent = leave unchanged on
921
1175
  * write, 'hosted' on read (see store.ts). */
922
- voiceMode: z5.enum(["hosted", "on_device"]).optional(),
1176
+ voiceMode: z7.enum(["hosted", "on_device"]).optional(),
923
1177
  /** Talk — after you answer, the next step is read aloud (docs/clients/app/walk/design.md §6). ALWAYS ON until
924
1178
  * turned off (owner, 2026-09-18, #2249): a setting, not a per-walk toggle. Optional, NOT
925
1179
  * defaulted, for the same reason `voiceMode` is: a stale client PATCHing the full settings
926
1180
  * object must not silently turn it back on. Absent = leave unchanged on write, true on
927
1181
  * read (see store.ts). */
928
- talk: z5.boolean().optional(),
1182
+ talk: z7.boolean().optional(),
929
1183
  /** CALL DIAGNOSTICS (owner, 2026-10-01): the call report carries each listen and the bot's own
930
1184
  * load timings. SERVER-SET, no UI — on for every account that existed on 2026-10-01, off for
931
1185
  * newer ones (migration 20261001132859). Read-only here: the settings PATCH never writes it. */
932
- callDiagnostics: z5.boolean().optional(),
1186
+ callDiagnostics: z7.boolean().optional(),
933
1187
  /** Per-user ring budget (#603): calls per rolling day before further calls
934
1188
  * degrade to banner. Absent = the global default (25). A number, never a
935
1189
  * bypass — every account keeps a ceiling. No UI; set per user for testing. */
@@ -937,7 +1191,7 @@ var UserSettingsSchema = z5.object({
937
1191
  * payload['tuning'] (e.g. { silence_s: 3.5 } — a longer pause window for a
938
1192
  * slower speaker). No API-side semantics; the bot resolves each key with its
939
1193
  * own defaults. Set per user (no UI yet); absent = bot defaults. */
940
- voiceTuning: z5.record(z5.string(), z5.union([z5.number(), z5.string()])).optional(),
1194
+ voiceTuning: z7.record(z7.string(), z7.union([z7.number(), z7.string()])).optional(),
941
1195
  /** The user's IANA timezone (e.g. "America/Bogota"), recorded by the app — it is the
942
1196
  * only party that knows it. REMINDERS are why it exists: "remind me at ten" becomes
943
1197
  * an absolute `due_at` only if we know whose ten. Optional and never defaulted, for
@@ -946,53 +1200,53 @@ var UserSettingsSchema = z5.object({
946
1200
  * that failure reads as the reminder rail being unreliable rather than as a missing
947
1201
  * setting. Absent = a spoken time can't be landed, so the reminder rides the next
948
1202
  * call — honest about what we know. */
949
- timezone: z5.string().min(1).max(64).optional(),
1203
+ timezone: z7.string().min(1).max(64).optional(),
950
1204
  /** Rung-2 broker tuning (#381). Optional and NOT defaulted, same stale-client
951
1205
  * clobber guard as voiceMode: absent = leave unchanged on write. */
952
1206
  broker: BrokerTuningSchema.optional()
953
1207
  });
954
- var HistoryWorkSchema = z5.object({
955
- id: z5.string(),
956
- title: z5.string(),
957
- state: z5.enum(["done", "cancelled"]),
1208
+ var HistoryWorkSchema = z7.object({
1209
+ id: z7.string(),
1210
+ title: z7.string(),
1211
+ state: z7.enum(["done", "cancelled"]),
958
1212
  /** Who held it (`agent:<tokenId>` or `human:<userId>`). */
959
- assignee: z5.string()
1213
+ assignee: z7.string()
960
1214
  });
961
- var HistoryEntrySchema = z5.union([
962
- z5.object({ at: z5.string(), card: InboxItemSchema }),
963
- z5.object({ at: z5.string(), work: HistoryWorkSchema })
1215
+ var HistoryEntrySchema = z7.union([
1216
+ z7.object({ at: z7.string(), card: InboxItemSchema }),
1217
+ z7.object({ at: z7.string(), work: HistoryWorkSchema })
964
1218
  ]);
965
- var HistoryPageSchema = z5.object({
966
- entries: z5.array(HistoryEntrySchema),
967
- next: z5.string().nullable()
1219
+ var HistoryPageSchema = z7.object({
1220
+ entries: z7.array(HistoryEntrySchema),
1221
+ next: z7.string().nullable()
968
1222
  });
969
1223
  var ACTIVITY_LINES = 2;
970
1224
  var ACTIVITY_LINE_MAX = 80;
971
- var AgentActivitySchema = z5.object({
1225
+ var AgentActivitySchema = z7.object({
972
1226
  /** Oldest first, so the newest line is last — the one that replaces in place. */
973
- lines: z5.array(z5.string().max(ACTIVITY_LINE_MAX)).max(ACTIVITY_LINES),
1227
+ lines: z7.array(z7.string().max(ACTIVITY_LINE_MAX)).max(ACTIVITY_LINES),
974
1228
  /** When the harness observed this tail. Its own timestamp, not the heartbeat's: a beat
975
1229
  * that carries an UNCHANGED tail must not make a stalled agent look like it just moved. */
976
- at: z5.string().datetime()
1230
+ at: z7.string().datetime()
977
1231
  });
978
- var ConnectionSummarySchema = z5.object({
1232
+ var ConnectionSummarySchema = z7.object({
979
1233
  /** The connection = the agent's token id (used to address a request). */
980
- id: z5.string(),
1234
+ id: z7.string(),
981
1235
  /** The credential kind: "device" = a paired machine (mint-only — it hosts and mints, it
982
1236
  * never talks); "agent" = an identity that sends. The roster and devices surfaces split
983
1237
  * on this. Optional/absent reads as "agent" (a row predating the kind column). See
984
1238
  * docs/server/tokens/devices-vs-agents-design.md. */
985
- kind: z5.enum(["device", "agent"]).optional(),
1239
+ kind: z7.enum(["device", "agent"]).optional(),
986
1240
  /** For an agent, the token id of the DEVICE that minted it — so agents group under their
987
1241
  * machine, and revoking a device cascades to them. Null on devices, and on unlinked
988
1242
  * agents (phone-launched, provider-managed, or minted before the link existed). */
989
- mintedByDevice: z5.string().nullable().optional(),
990
- device: z5.string().nullable(),
1243
+ mintedByDevice: z7.string().nullable().optional(),
1244
+ device: z7.string().nullable(),
991
1245
  /** The agent's display name (the single pairing name). */
992
- name: z5.string(),
1246
+ name: z7.string(),
993
1247
  /** For a managed connection, the provider key (e.g. "cma") that agentOrigin maps to a
994
1248
  * label; null for a local connection. Sourced from the token's provider, not the name. */
995
- provider: z5.string().nullable(),
1249
+ provider: z7.string().nullable(),
996
1250
  /** The pairing's assigned voice (#462); null = the default voice. */
997
1251
  voice: VoiceKeySchema.nullable(),
998
1252
  /** The LOUDEST this agent may ever reach you — a ceiling on `NOTIFY_LADDER`, set by the
@@ -1003,34 +1257,34 @@ var ConnectionSummarySchema = z5.object({
1003
1257
  * every surface at once and outranks even `sessionMode: all_calls` — a mode the user
1004
1258
  * set once must not overrule a rule they set about one agent. */
1005
1259
  reach: NotifyLevelSchema.nullable().optional(),
1006
- createdAt: z5.string().datetime(),
1260
+ createdAt: z7.string().datetime(),
1007
1261
  /** Most recent notification on this connection, either direction. Null = no contact yet.
1008
1262
  * Drives the agents-page recency grouping (Today / This week / …). */
1009
- lastContactAt: z5.string().datetime().nullable(),
1263
+ lastContactAt: z7.string().datetime().nullable(),
1010
1264
  /** Last presence heartbeat from a running agent process (POST /api/presence) — the
1011
1265
  * desktop app while open. Null = never seen; stale = offline. */
1012
- lastSeenAt: z5.string().datetime().nullable().optional(),
1266
+ lastSeenAt: z7.string().datetime().nullable().optional(),
1013
1267
  /** WORKING, NOT JUST CONNECTED (owner, 2026-09-30): the last time the agent itself acted on one of
1014
1268
  * its Goals — took its lease or recorded an operation (`tokens.last_worked_at`). Within
1015
1269
  * `WORKING_MS` it is working; otherwise it is connected but idle. Null = not seen working yet. */
1016
- lastWorkedAt: z5.string().datetime().nullable().optional(),
1270
+ lastWorkedAt: z7.string().datetime().nullable().optional(),
1017
1271
  /** The oldest of its Goals that is `ready` for it — work handed to it that nobody has started.
1018
1272
  * With no work of its own for `WORKING_MS`, an agent sitting on this is not taking its work. */
1019
- oldestReadyAt: z5.string().datetime().nullable().optional(),
1273
+ oldestReadyAt: z7.string().datetime().nullable().optional(),
1020
1274
  /** What a live desktop can run (docs/clients/desktop/companion.md §2.2), advertised on its heartbeat:
1021
1275
  * harness availabilities + granted workspaces — the option set the phone's
1022
1276
  * "new session" sheet offers. Absent for ordinary MCP agents. */
1023
- runtime: z5.object({
1277
+ runtime: z7.object({
1024
1278
  /** The @paigy/harness this host is running — a machine the self-update has not reached
1025
1279
  * shows its age here (`apps/desktop/src/update.ts`). */
1026
- version: z5.string().optional(),
1027
- harnesses: z5.array(z5.object({ name: z5.string(), label: z5.string(), status: z5.string() })).optional(),
1028
- workspaces: z5.array(z5.string()).optional(),
1280
+ version: z7.string().optional(),
1281
+ harnesses: z7.array(z7.object({ name: z7.string(), label: z7.string(), status: z7.string() })).optional(),
1282
+ workspaces: z7.array(z7.string()).optional(),
1029
1283
  /** THE GIT REPOS IN THOSE FOLDERS (2026-10-01, Goal 26982211): each granted folder that is a
1030
1284
  * repo, and each repo directly inside one, with its `origin` remote. A session started for
1031
1285
  * work on `mauurda/paigy` opens in that repo rather than the folder above it, where the repo's
1032
1286
  * own AGENTS.md is never read (`workspaceForRepo`). Absent on hosts that predate it. */
1033
- repos: z5.array(z5.object({ path: z5.string(), remote: z5.string() })).optional()
1287
+ repos: z7.array(z7.object({ path: z7.string(), remote: z7.string() })).optional()
1034
1288
  }).optional(),
1035
1289
  /** The tail of this agent's working log, when a harness is driving it — the agent page's
1036
1290
  * live strip. Absent for anything the desktop harness isn't running (a hatched identity
@@ -1039,156 +1293,156 @@ var ConnectionSummarySchema = z5.object({
1039
1293
  activity: AgentActivitySchema.optional(),
1040
1294
  /** True = a provider-managed agent running in the provider's cloud (e.g. Anthropic CMA);
1041
1295
  * false = a local MCP connection running on the user's computer (Claude Code/Codex/…). */
1042
- managed: z5.boolean()
1296
+ managed: z7.boolean()
1043
1297
  });
1044
- var LedgerItemSchema = z5.object({ id: z5.string(), parentId: z5.string(), title: z5.string(), createdAt: z5.string() });
1045
- var AgentLedgerSchema = z5.object({
1298
+ var LedgerItemSchema = z7.object({ id: z7.string(), parentId: z7.string(), title: z7.string(), createdAt: z7.string() });
1299
+ var AgentLedgerSchema = z7.object({
1046
1300
  /** Null when the agent has not named itself yet — never a placeholder (owner, 2026-10-01). */
1047
- agent: z5.object({ id: z5.string(), name: z5.string().nullable(), revokedAt: z5.string().nullable() }),
1301
+ agent: z7.object({ id: z7.string(), name: z7.string().nullable(), revokedAt: z7.string().nullable() }),
1048
1302
  /** Its own questions you have not answered. */
1049
- asks: z5.array(LedgerItemSchema),
1303
+ asks: z7.array(LedgerItemSchema),
1050
1304
  /** Its questions you answered that nobody acted on — still owed to somebody. */
1051
- answered: z5.array(LedgerItemSchema),
1305
+ answered: z7.array(LedgerItemSchema),
1052
1306
  /** Requests you sent it that it never took. */
1053
- requests: z5.array(LedgerItemSchema),
1054
- goals: z5.array(z5.object({ id: z5.string(), outcome: z5.string(), state: z5.string() })),
1055
- callbacks: z5.array(z5.object({ id: z5.string(), parentId: z5.string(), trigger: z5.string(), note: z5.string(), dueAt: z5.string().nullable() }))
1307
+ requests: z7.array(LedgerItemSchema),
1308
+ goals: z7.array(z7.object({ id: z7.string(), outcome: z7.string(), state: z7.string() })),
1309
+ callbacks: z7.array(z7.object({ id: z7.string(), parentId: z7.string(), trigger: z7.string(), note: z7.string(), dueAt: z7.string().nullable() }))
1056
1310
  });
1057
- var ReassignResultSchema = z5.object({
1058
- moved: z5.object({ asks: z5.number(), answered: z5.number(), requests: z5.number(), goals: z5.number(), callbacks: z5.number() }),
1059
- parentId: z5.string().nullable()
1311
+ var ReassignResultSchema = z7.object({
1312
+ moved: z7.object({ asks: z7.number(), answered: z7.number(), requests: z7.number(), goals: z7.number(), callbacks: z7.number() }),
1313
+ parentId: z7.string().nullable()
1060
1314
  });
1061
- var LessonStateSchema = z5.enum(["active", "proposed", "retired"]);
1062
- var LessonViewSchema = z5.object({
1063
- id: z5.string(),
1064
- text: z5.string(),
1315
+ var LessonStateSchema = z7.enum(["active", "proposed", "retired"]);
1316
+ var LessonViewSchema = z7.object({
1317
+ id: z7.string(),
1318
+ text: z7.string(),
1065
1319
  state: LessonStateSchema,
1066
1320
  /** The Goal it is scoped to; null = the whole account. */
1067
- scopeGoalId: z5.string().nullable(),
1068
- goalTitle: z5.string().nullable(),
1069
- version: z5.number(),
1070
- pinned: z5.boolean(),
1321
+ scopeGoalId: z7.string().nullable(),
1322
+ goalTitle: z7.string().nullable(),
1323
+ version: z7.number(),
1324
+ pinned: z7.boolean(),
1071
1325
  /** When the person last wrote its text themselves. */
1072
- editedAt: z5.string().nullable(),
1073
- createdAt: z5.string(),
1074
- updatedAt: z5.string(),
1326
+ editedAt: z7.string().nullable(),
1327
+ createdAt: z7.string(),
1328
+ updatedAt: z7.string(),
1075
1329
  /** The Entries it came from, oldest first; `words` is null when an Entry has none to show (sealed). */
1076
- sources: z5.array(z5.object({ entryId: z5.string(), words: z5.string().nullable(), at: z5.string() }))
1330
+ sources: z7.array(z7.object({ entryId: z7.string(), words: z7.string().nullable(), at: z7.string() }))
1077
1331
  });
1078
- var QueueQuestionSchema = z5.object({
1332
+ var QueueQuestionSchema = z7.object({
1079
1333
  /** The decision need's id — what an answer is accepted against. */
1080
- id: z5.string(),
1334
+ id: z7.string(),
1081
1335
  /** The words that were asked, from the request Entry that asked them. */
1082
- question: z5.string(),
1336
+ question: z7.string(),
1083
1337
  /** Where it was asked — which is where the ruling goes (`POST /api/entries`). Null only
1084
1338
  * for a need whose request Entry is carried by no interactive Delivery, which nothing
1085
1339
  * can answer. */
1086
- deliveryId: z5.string().nullable().default(null),
1340
+ deliveryId: z7.string().nullable().default(null),
1087
1341
  /** The Entry the ruling is about. */
1088
- aboutId: z5.string().nullable().default(null),
1342
+ aboutId: z7.string().nullable().default(null),
1089
1343
  /** Empty for a free-text question. */
1090
- options: z5.array(OptionSchema).default([]),
1091
- select: z5.enum(["one", "many", "rank", "confirm", "text"]).default("text"),
1092
- askedAt: z5.string(),
1344
+ options: z7.array(OptionSchema).default([]),
1345
+ select: z7.enum(["one", "many", "rank", "confirm", "text"]).default("text"),
1346
+ askedAt: z7.string(),
1093
1347
  /** Null while the question is open — which is how the page tells the two apart. */
1094
- answeredAt: z5.string().nullable().default(null),
1348
+ answeredAt: z7.string().nullable().default(null),
1095
1349
  /** The ruling in the person's own words, from the contribution that replied — not the
1096
1350
  * option id, which is not something anyone reads back. Null while it is open, and null
1097
1351
  * for a settled question whose reply carried nothing readable. */
1098
- answer: z5.string().nullable().default(null),
1352
+ answer: z7.string().nullable().default(null),
1099
1353
  /** The Goal this question belongs to — a step knows its Goal on its own, not only through
1100
1354
  * an `InboxItem`'s `communication.goalIds[0]` (docs/clients/app/walk/design.md §12 item 3).
1101
1355
  * READ BY `apps/client/src/walk/order.ts`, which stamps it onto every `WalkStep`: the walk's
1102
1356
  * order, its route, home's trees and the list of steps all take a step's Goal from here, so
1103
1357
  * this is the field they agree through rather than each re-deriving it from the row it
1104
1358
  * arrived under. Required because the API projects it on every need it sends. */
1105
- goalId: z5.string(),
1359
+ goalId: z7.string(),
1106
1360
  /** True only while an unmet START gate holds the Goal — a Goal that merely waits to
1107
1361
  * *finish* does not stop a person from answering (owner, 2026-09-16: "per need gate from
1108
1362
  * the API"; §4's dashed node). Not the same fact as `QueueItem.blocked`, which counts any
1109
1363
  * gate at all. */
1110
- blocked: z5.boolean().default(false)
1364
+ blocked: z7.boolean().default(false)
1111
1365
  });
1112
- var QueueReplySchema = z5.object({
1366
+ var QueueReplySchema = z7.object({
1113
1367
  /** The card this note was (`deliveryId:requestEntryId`, minted by the server like every card
1114
1368
  * id) — so the phone can tell a reply it just sent from one the queue already carries, and the
1115
1369
  * walk can name it in its zoom. */
1116
- id: z5.string(),
1370
+ id: z7.string(),
1117
1371
  /** The Goal the note is on. */
1118
- goalId: z5.string(),
1372
+ goalId: z7.string(),
1119
1373
  /** What the note said. */
1120
- note: z5.string(),
1374
+ note: z7.string(),
1121
1375
  /** Where it was carried — where a second reply goes (`POST /api/entries`, #2252). */
1122
- deliveryId: z5.string(),
1123
- requestEntryId: z5.string(),
1124
- askedAt: z5.string(),
1376
+ deliveryId: z7.string(),
1377
+ requestEntryId: z7.string(),
1378
+ askedAt: z7.string(),
1125
1379
  /** When the person last replied — the window's start. */
1126
- repliedAt: z5.string(),
1380
+ repliedAt: z7.string(),
1127
1381
  /** The person's latest words about it; null when there is nothing readable in them. */
1128
- reply: z5.string().nullable()
1382
+ reply: z7.string().nullable()
1129
1383
  });
1130
- var QueueItemSchema = z5.object({
1131
- id: z5.string(),
1384
+ var QueueItemSchema = z7.object({
1385
+ id: z7.string(),
1132
1386
  /** One-line headline — the first sentence of the outcome. */
1133
- title: z5.string(),
1387
+ title: z7.string(),
1134
1388
  /** The outcome in full, verbatim: the person's own words are what an assignee sees. */
1135
- intent: z5.string(),
1389
+ intent: z7.string(),
1136
1390
  /** `ready` | `active` | `waiting` | `done` | `cancelled`, straight off the Goal. */
1137
- state: z5.string(),
1391
+ state: z7.string(),
1138
1392
  /** Who holds it (a participant ref); null when nobody does yet. */
1139
- assignee: z5.string().nullable().default(null),
1393
+ assignee: z7.string().nullable().default(null),
1140
1394
  /** What the agent last said it was doing; null if it has said nothing. */
1141
- progress: z5.string().nullable().default(null),
1395
+ progress: z7.string().nullable().default(null),
1142
1396
  /** HOME'S LINE FOR THAT NOTE (owner, 2026-09-23): a few plain words one read wrote from `progress`,
1143
1397
  * served only while it was written for the current note. Null means show the Goal's name. */
1144
- progressLine: z5.string().nullable().optional(),
1145
- reviewPending: z5.boolean().default(false),
1146
- dueAt: z5.string().nullable().default(null),
1398
+ progressLine: z7.string().nullable().optional(),
1399
+ reviewPending: z7.boolean().default(false),
1400
+ dueAt: z7.string().nullable().default(null),
1147
1401
  /** WHEN ITS OWNER SAID DONE WHILE CHILDREN WERE OPEN (#2704): its own work is finished and it closes
1148
1402
  * with its last open child. Null otherwise; optional, so hand-built queues need not spell it. */
1149
- finishedAt: z5.string().nullable().optional(),
1403
+ finishedAt: z7.string().nullable().optional(),
1150
1404
  /** The Goal this one was opened under; null at the root. */
1151
- parentGoalId: z5.string().nullable().default(null),
1405
+ parentGoalId: z7.string().nullable().default(null),
1152
1406
  /** Goals opened under this one — only those the same list holds. */
1153
- childGoalIds: z5.array(z5.string()).default([]),
1407
+ childGoalIds: z7.array(z7.string()).default([]),
1154
1408
  /** Goals this one waits on (start or finish gates). */
1155
- dependencyGoalIds: z5.array(z5.string()).default([]),
1409
+ dependencyGoalIds: z7.array(z7.string()).default([]),
1156
1410
  /** True while any gate is on a Goal that is not done — the walk draws it dashed. */
1157
- blocked: z5.boolean().default(false),
1411
+ blocked: z7.boolean().default(false),
1158
1412
  /** Its questions: every OPEN one, and at most ten settled, newest settled first
1159
1413
  * (20260929133308) — the page decides which of them to show. NOT the whole set: `asked` and
1160
1414
  * `answered` are, and a settled one's words are a line (280 characters), its body read when the
1161
1415
  * question is opened. */
1162
- questions: z5.array(QueueQuestionSchema).default([]),
1416
+ questions: z7.array(QueueQuestionSchema).default([]),
1163
1417
  /** HOW MANY QUESTIONS THIS WORK HAS ASKED, and how many are answered — the Goal's own totals,
1164
1418
  * bounded at 100 server-side. A tally counted off `questions` is a wrong number that looks
1165
1419
  * right once the cap bites (`walk/trees.ts` `tallyOf`). Optional, and defaulted from the array
1166
1420
  * by the projection, so hand-built queues (fixtures, the demo) need not spell them. */
1167
- asked: z5.number().optional(),
1168
- answered: z5.number().optional(),
1421
+ asked: z7.number().optional(),
1422
+ answered: z7.number().optional(),
1169
1423
  /** Every note on it the person replied to (`QueueReplySchema`) — the page decides which to show.
1170
1424
  * Optional, not defaulted: absent is none, and every hand-built queue (fixtures, the demo) need
1171
1425
  * not spell an empty list. */
1172
- replies: z5.array(QueueReplySchema).optional(),
1426
+ replies: z7.array(QueueReplySchema).optional(),
1173
1427
  /** The repository or project identifier this Goal belongs to (#2280), null if untracked. */
1174
- repo: z5.string().nullable().optional(),
1175
- createdAt: z5.string(),
1176
- updatedAt: z5.string().nullable().default(null),
1177
- /** When its owner last SAID something about it (`goals.last_progress_at`, written by every
1178
- * `update_goal` that changes `progress`). `updatedAt` moves for reasons nobody chose — a
1428
+ repo: z7.string().nullable().optional(),
1429
+ createdAt: z7.string(),
1430
+ updatedAt: z7.string().nullable().default(null),
1431
+ /** When its owner last SAID something about it (the newest `progress` Entry: a contact update kept
1432
+ * as progress). `updatedAt` moves for reasons nobody chose — a
1179
1433
  * state recomputed, a review flag — so it cannot tell work in hand from work gone quiet. */
1180
- lastProgressAt: z5.string().nullable().optional(),
1434
+ lastProgressAt: z7.string().nullable().optional(),
1181
1435
  /** THE GOAL'S NEWEST WORD, FROM EITHER SIDE (owner, 2026-09-27): the newest Entry on it, of any
1182
1436
  * kind — what the person added ("Add to this"), their reply, the agent's ask or its progress
1183
1437
  * note. A progress note is an Entry, so this is already the newer of the two: the person's note
1184
1438
  * shows the moment it is written, and the agent's reply or next note replaces it by being newer.
1185
1439
  * `said` is bounded to 280 characters server-side (a line, not the conversation). Null when the
1186
1440
  * Goal carries no readable Entry; optional, so hand-built queues need not spell it. */
1187
- latest: z5.object({
1188
- from: z5.enum(["person", "agent"]),
1189
- said: z5.string(),
1190
- at: z5.string(),
1191
- entryId: z5.string()
1441
+ latest: z7.object({
1442
+ from: z7.enum(["person", "agent"]),
1443
+ said: z7.string(),
1444
+ at: z7.string(),
1445
+ entryId: z7.string()
1192
1446
  }).nullable().optional(),
1193
1447
  /** WHEN THIS PERSON LAST PUT A HAND ON IT THEMSELVES (owner, Paigy Goal 16d18f51, 2026-09-30):
1194
1448
  * the newest Entry on the Goal they wrote, of any kind — a line they added, a reply to a note, an
@@ -1201,7 +1455,7 @@ var QueueItemSchema = z5.object({
1201
1455
  * minute after the person speaks erases their instant from it, and the durable traces the client
1202
1456
  * can see (`replies`, `questions[].answeredAt`) miss a spontaneous note entirely — a `request`
1203
1457
  * Entry with no `about_id` is in neither. */
1204
- lastPersonAt: z5.string().nullable().optional(),
1458
+ lastPersonAt: z7.string().nullable().optional(),
1205
1459
  /** WHAT THIS ROW IS, IN TWELVE CHARACTERS (#2928) — the hash of every other field on it, stamped
1206
1460
  * by the one projection that builds the row (`apps/api/src/goal/queue.ts`). It is how the
1207
1461
  * incremental read knows a row has not moved: the phone echoes back the revs it holds
@@ -1212,40 +1466,40 @@ var QueueItemSchema = z5.object({
1212
1466
  * the row shows that no `updated_at` moves for (a lease lapsing, a dependency's state, a
1213
1467
  * sibling appearing in `childGoalIds`) cannot go unnoticed. Optional because a hand-built
1214
1468
  * queue (a fixture, the demo) spells none, and a row with no rev is simply always re-sent. */
1215
- rev: z5.string().optional()
1469
+ rev: z7.string().optional()
1216
1470
  });
1217
- var QueueDeltaSchema = z5.object({
1218
- ids: z5.array(z5.string()),
1219
- items: z5.array(QueueItemSchema)
1471
+ var QueueDeltaSchema = z7.object({
1472
+ ids: z7.array(z7.string()),
1473
+ items: z7.array(QueueItemSchema)
1220
1474
  });
1221
1475
  var COLD_AFTER_MS = 3 * 24 * 60 * 60 * 1e3;
1222
- var NoteSourceSchema = z5.enum(["app", "call"]);
1223
- var NoteStatusSchema = z5.enum(["open", "assigned", "in_progress", "done"]);
1224
- var NoteRepeatSchema = z5.enum(["once", "until_done"]);
1225
- var DecisionSchema = z5.object({
1226
- id: z5.string(),
1476
+ var NoteSourceSchema = z7.enum(["app", "call"]);
1477
+ var NoteStatusSchema = z7.enum(["open", "assigned", "in_progress", "done"]);
1478
+ var NoteRepeatSchema = z7.enum(["once", "until_done"]);
1479
+ var DecisionSchema = z7.object({
1480
+ id: z7.string(),
1227
1481
  /** The note this decision refines; null = recorded on a bare thread (the
1228
1482
  * extensibility seam — any conversation can accrue decisions). */
1229
- noteId: z5.string().nullable(),
1483
+ noteId: z7.string().nullable(),
1230
1484
  /** What was ambiguous — the broker's (or the user's own) question. */
1231
- question: z5.string(),
1485
+ question: z7.string(),
1232
1486
  /** The user's ruling; null while the question is open. */
1233
- answer: z5.string().nullable(),
1234
- decidedAt: z5.string().nullable(),
1235
- createdAt: z5.string()
1487
+ answer: z7.string().nullable(),
1488
+ decidedAt: z7.string().nullable(),
1489
+ createdAt: z7.string()
1236
1490
  });
1237
- var NoteSchema = z5.object({
1238
- id: z5.string(),
1491
+ var NoteSchema = z7.object({
1492
+ id: z7.string(),
1239
1493
  /** One-line headline (broker-titled; deterministic floor). */
1240
- title: z5.string(),
1494
+ title: z7.string(),
1241
1495
  /** The original intent, verbatim — assignees always see the user's own words. */
1242
- intent: z5.string(),
1496
+ intent: z7.string(),
1243
1497
  source: NoteSourceSchema,
1244
1498
  status: NoteStatusSchema,
1245
1499
  /** Who it was assigned to (a participant ref, 'agent:<tokenId>'); null = unassigned. */
1246
- assignee: z5.string().nullable(),
1500
+ assignee: z7.string().nullable(),
1247
1501
  /** The request thread minted at assignment; null until assigned. */
1248
- parentId: z5.string().nullable(),
1502
+ parentId: z7.string().nullable(),
1249
1503
  /** REMINDERS (docs/model/notes/reminders-design.md): the NOT-BEFORE this becomes eligible to ride a
1250
1504
  * call — never a deadline. It only ever comes from the user's own words, so when it
1251
1505
  * passes Paigy rings ONCE (#1293, owner 2026-08-26: a time said out loud is consent to
@@ -1254,152 +1508,152 @@ var NoteSchema = z5.object({
1254
1508
  // Defaulted, not required: a Note from an API deploy older than the reminders
1255
1509
  // migration has none of these, and the defaults ARE what it means — no not-before,
1256
1510
  // one ride, never ridden. Parsing must not fail across a rolling deploy.
1257
- dueAt: z5.string().nullable().default(null),
1511
+ dueAt: z7.string().nullable().default(null),
1258
1512
  repeat: NoteRepeatSchema.default("once"),
1259
1513
  /** How many calls have already carried it — the fatigue cap counts rides, not days. */
1260
- rides: z5.number().int().default(0),
1261
- lastRideAt: z5.string().nullable().default(null),
1262
- createdAt: z5.string()
1514
+ rides: z7.number().int().default(0),
1515
+ lastRideAt: z7.string().nullable().default(null),
1516
+ createdAt: z7.string()
1263
1517
  });
1264
- var TriageItemSchema = z5.object({
1265
- noteId: z5.string(),
1518
+ var TriageItemSchema = z7.object({
1519
+ noteId: z7.string(),
1266
1520
  /** The note's headline at run time. */
1267
- title: z5.string(),
1521
+ title: z7.string(),
1268
1522
  /** WHY, in one short human line, evidence first — this is read on a phone underneath
1269
1523
  * the note's title: "no movement in 34 days", "worked 3 notes in this repo this week".
1270
1524
  * Never a model's reasoning transcript, never an id. */
1271
- why: z5.string()
1525
+ why: z7.string()
1272
1526
  });
1273
- var TriageAssignmentSchema = z5.object({
1527
+ var TriageAssignmentSchema = z7.object({
1274
1528
  /** The agent's token id — what `dispatchNote` resolves and what a request is addressed to. */
1275
- agent: z5.string(),
1529
+ agent: z7.string(),
1276
1530
  /** Its display name at run time (the name on the hatchling's card). Denormalized for the
1277
1531
  * same reason as `title`: the card must render from the proposal alone. */
1278
- agentName: z5.string(),
1279
- notes: z5.array(TriageItemSchema)
1532
+ agentName: z7.string(),
1533
+ notes: z7.array(TriageItemSchema)
1280
1534
  });
1281
- var TriageStatusSchema = z5.enum(["open", "superseded", "dismissed"]);
1282
- var SubmitTriageSchema = z5.object({
1535
+ var TriageStatusSchema = z7.enum(["open", "superseded", "dismissed"]);
1536
+ var SubmitTriageSchema = z7.object({
1283
1537
  /** Which runtime judged: "ollama" (inference never left the machine) or a harness the
1284
1538
  * user already runs under their own credentials ("claude" / "codex" / "agy"). Recorded
1285
1539
  * so the phone can say where the content went — an unattributed privacy claim is worth
1286
1540
  * nothing, and #1106's promise is precisely "Paigy's servers never see this". */
1287
- provider: z5.string().min(1).max(60),
1541
+ provider: z7.string().min(1).max(60),
1288
1542
  /** The concrete model when the provider names one (an ollama tag); null otherwise. */
1289
- model: z5.string().max(200).nullable().optional(),
1543
+ model: z7.string().max(200).nullable().optional(),
1290
1544
  /** How many open notes the run actually looked at — the denominator on the phone
1291
1545
  * ("6 of 50"), and the honest answer to "did it read the whole queue?". */
1292
- reviewed: z5.number().int().min(0).max(1e4).default(0),
1293
- close: z5.array(TriageItemSchema).max(200).default([]),
1294
- stale: z5.array(TriageItemSchema).max(200).default([]),
1295
- assign: z5.array(TriageAssignmentSchema).max(50).default([])
1546
+ reviewed: z7.number().int().min(0).max(1e4).default(0),
1547
+ close: z7.array(TriageItemSchema).max(200).default([]),
1548
+ stale: z7.array(TriageItemSchema).max(200).default([]),
1549
+ assign: z7.array(TriageAssignmentSchema).max(50).default([])
1296
1550
  });
1297
1551
  var TriageProposalSchema = SubmitTriageSchema.extend({
1298
- id: z5.string(),
1299
- runAt: z5.string(),
1552
+ id: z7.string(),
1553
+ runAt: z7.string(),
1300
1554
  status: TriageStatusSchema,
1301
- model: z5.string().nullable().default(null)
1555
+ model: z7.string().nullable().default(null)
1302
1556
  });
1303
- var AcceptTriageSchema = z5.discriminatedUnion("group", [
1304
- z5.object({ group: z5.literal("close"), noteIds: z5.array(z5.string()).max(200).optional() }),
1305
- z5.object({ group: z5.literal("stale"), noteIds: z5.array(z5.string()).max(200).optional() }),
1306
- z5.object({
1307
- group: z5.literal("assign"),
1308
- agent: z5.string().min(1),
1309
- noteIds: z5.array(z5.string()).max(200).optional()
1557
+ var AcceptTriageSchema = z7.discriminatedUnion("group", [
1558
+ z7.object({ group: z7.literal("close"), noteIds: z7.array(z7.string()).max(200).optional() }),
1559
+ z7.object({ group: z7.literal("stale"), noteIds: z7.array(z7.string()).max(200).optional() }),
1560
+ z7.object({
1561
+ group: z7.literal("assign"),
1562
+ agent: z7.string().min(1),
1563
+ noteIds: z7.array(z7.string()).max(200).optional()
1310
1564
  })
1311
1565
  ]);
1312
- var AcceptTriageResultSchema = z5.object({
1313
- accepted: z5.array(z5.string()),
1314
- failed: z5.array(z5.object({ noteId: z5.string(), reason: z5.string() }))
1566
+ var AcceptTriageResultSchema = z7.object({
1567
+ accepted: z7.array(z7.string()),
1568
+ failed: z7.array(z7.object({ noteId: z7.string(), reason: z7.string() }))
1315
1569
  });
1316
- var DeliveryModeSchema = z5.enum(["poll", "self_hosted"]);
1317
- var RegisterDeliverySchema = z5.object({ mode: DeliveryModeSchema });
1318
- var OAuthStartSchema = z5.object({
1319
- provider: z5.enum(["cma"]),
1320
- returnTo: z5.string().min(1)
1570
+ var DeliveryModeSchema = z7.enum(["poll", "self_hosted"]);
1571
+ var RegisterDeliverySchema = z7.object({ mode: DeliveryModeSchema });
1572
+ var OAuthStartSchema = z7.object({
1573
+ provider: z7.enum(["cma"]),
1574
+ returnTo: z7.string().min(1)
1321
1575
  });
1322
- var DeliveryConfigSchema = z5.object({
1323
- tokenId: z5.string(),
1576
+ var DeliveryConfigSchema = z7.object({
1577
+ tokenId: z7.string(),
1324
1578
  mode: DeliveryModeSchema,
1325
1579
  /** null when the deployment has no anon key configured. `self_hosted` is then REFUSED
1326
1580
  * (503 `self_hosted_unavailable`) rather than registered, so a self_hosted config always
1327
1581
  * carries credentials; only a `poll` registration can come back with null here. */
1328
- realtime: z5.object({ url: z5.string(), anonKey: z5.string() }).nullable()
1582
+ realtime: z7.object({ url: z7.string(), anonKey: z7.string() }).nullable()
1329
1583
  });
1330
- var HostDecisionSchema = z5.object({
1584
+ var HostDecisionSchema = z7.object({
1331
1585
  /** The agent's token id: the row's `recipient`. */
1332
- agent: z5.string().uuid(),
1333
- decision: z5.enum(["stood_back", "took_over"]),
1586
+ agent: z7.string().uuid(),
1587
+ decision: z7.enum(["stood_back", "took_over"]),
1334
1588
  /** The work it was about: the Goal `claim_goal` would hand that agent next. */
1335
- goalId: z5.string().uuid().nullable().optional(),
1589
+ goalId: z7.string().uuid().nullable().optional(),
1336
1590
  /** When the server last heard from the agent, as the host read it: the presence it stood back for. */
1337
- seenAt: z5.string().datetime().nullable().optional(),
1338
- /** When that work last moved (`claimable.since` on `check_replies`), the fact the bound is judged on. */
1339
- since: z5.string().datetime().nullable().optional(),
1591
+ seenAt: z7.string().datetime().nullable().optional(),
1592
+ /** When that work last moved (`claimable.since` on an agent's `contact({})` read), the fact the bound is judged on. */
1593
+ since: z7.string().datetime().nullable().optional(),
1340
1594
  /** What the host said, in its log's own words: why it stood back, or what the take-over did. */
1341
- said: z5.string().max(300).optional()
1595
+ said: z7.string().max(300).optional()
1342
1596
  });
1343
- var WakeNudgeSchema = z5.object({
1344
- kind: z5.enum(["reply", "request", "callback"]),
1345
- notificationId: z5.string().optional(),
1346
- parentId: z5.string()
1597
+ var WakeNudgeSchema = z7.object({
1598
+ kind: z7.enum(["reply", "request", "callback"]),
1599
+ notificationId: z7.string().optional(),
1600
+ parentId: z7.string()
1347
1601
  });
1348
- var PairingStatusSchema = z5.enum(["pending", "approved", "denied", "expired"]);
1349
- var DeviceCodeSchema = z5.object({
1350
- device_code: z5.string(),
1351
- user_code: z5.string(),
1352
- verification_uri: z5.string().url(),
1353
- verification_uri_complete: z5.string().url(),
1354
- interval: z5.number(),
1355
- expires_in: z5.number()
1602
+ var PairingStatusSchema = z7.enum(["pending", "approved", "denied", "expired"]);
1603
+ var DeviceCodeSchema = z7.object({
1604
+ device_code: z7.string(),
1605
+ user_code: z7.string(),
1606
+ verification_uri: z7.string().url(),
1607
+ verification_uri_complete: z7.string().url(),
1608
+ interval: z7.number(),
1609
+ expires_in: z7.number()
1356
1610
  });
1357
- var DeviceInfoSchema = z5.object({
1358
- code: z5.string(),
1611
+ var DeviceInfoSchema = z7.object({
1612
+ code: z7.string(),
1359
1613
  /** The agent's suggested name (from /device/code) — shown on the approval screen,
1360
1614
  * pre-filling the name field the human can edit. */
1361
- name: z5.string(),
1615
+ name: z7.string(),
1362
1616
  /** @deprecated Legacy alias of `name` for the pre-#531 embedded bundle in App Store
1363
1617
  * build 35, whose DeviceFlow renders `info.agent.slice(0, 2)` — without this a FRESH
1364
1618
  * install crashes on the pairing screen on first launch, before the OTA lands
1365
1619
  * (seen live: PAIGY-5T, 2026-07-21). Remove once a newer binary is the floor. */
1366
- agent: z5.string().optional(),
1367
- device: z5.string().nullable(),
1620
+ agent: z7.string().optional(),
1621
+ device: z7.string().nullable(),
1368
1622
  status: PairingStatusSchema
1369
1623
  });
1370
- var DeviceTokenSchema = z5.object({
1371
- access_token: z5.string(),
1624
+ var DeviceTokenSchema = z7.object({
1625
+ access_token: z7.string(),
1372
1626
  /** The pairing's single name (user-typed at approval, the agent's suggestion, or
1373
1627
  * a default silly name). */
1374
- name: z5.string(),
1375
- device: z5.string().nullable(),
1628
+ name: z7.string(),
1629
+ device: z7.string().nullable(),
1376
1630
  /** The pairing's assigned voice, cached so the desktop can seed the SAME face the phone
1377
1631
  * draws — voice is the third ingredient of a hatchling's build (party/traits.ts). */
1378
- voice: z5.string().nullable().optional(),
1632
+ voice: z7.string().nullable().optional(),
1379
1633
  /** The token's server-side id — the face's COLOUR anchor, and the only seed ingredient
1380
1634
  * that survives a rename. Cached by the host's identity beat. */
1381
- token_id: z5.string().nullable().optional(),
1635
+ token_id: z7.string().nullable().optional(),
1382
1636
  /** WHERE this identity works — the folder a wake should land it in. Written by the host
1383
1637
  * at spawn and by `paigy-harness handoff` from a live terminal. Without it every wake
1384
1638
  * landed in the FIRST granted workspace and the agent rediscovered its own repo from
1385
1639
  * the thread each time (host.ts, live catch 2026-08-06 — prompt-papered until now). */
1386
- workspace: z5.string().nullable().optional(),
1640
+ workspace: z7.string().nullable().optional(),
1387
1641
  /** Local host recovery must preserve the launch's runtime and Paigy identity. */
1388
- harness: z5.enum(["claude", "codex", "agy"]).optional(),
1389
- session_id: z5.string().uuid().optional(),
1642
+ harness: z7.enum(["claude", "codex", "agy"]).optional(),
1643
+ session_id: z7.string().uuid().optional(),
1390
1644
  /** A conversation the host must not resume: its context is full, so every turn fails
1391
1645
  * ("Prompt is too long"). Written when a run hits it (`run.ts` `onFull`); the host skips a slot
1392
1646
  * whose resumable session is this one, so its Goals reach the dead-agent handoff instead of a
1393
1647
  * copy that types the person's words into a turn that cannot run (Calls, 2026-10-06). */
1394
- full_session: z5.string().optional(),
1395
- uik_pub: z5.string().nullable().optional()
1648
+ full_session: z7.string().optional(),
1649
+ uik_pub: z7.string().nullable().optional()
1396
1650
  });
1397
- var SupportRequestSchema = z5.object({
1398
- email: z5.string().email().max(320),
1399
- message: z5.string().trim().min(1).max(5e3),
1400
- name: z5.string().trim().max(120).optional()
1651
+ var SupportRequestSchema = z7.object({
1652
+ email: z7.string().email().max(320),
1653
+ message: z7.string().trim().min(1).max(5e3),
1654
+ name: z7.string().trim().max(120).optional()
1401
1655
  });
1402
- var NotificationFeedbackKindSchema = z5.enum([
1656
+ var NotificationFeedbackKindSchema = z7.enum([
1403
1657
  "break_down",
1404
1658
  // "This should be more than one ask — break it down."
1405
1659
  "regenerate_options",
@@ -1414,116 +1668,116 @@ var NotificationFeedbackKindSchema = z5.enum([
1414
1668
  // anything else — the note carries it.
1415
1669
  ]);
1416
1670
  var SlimOptionSchema = OptionSchema.omit({ html: true });
1417
- var QuestionRowSchema = z5.object({
1671
+ var QuestionRowSchema = z7.object({
1418
1672
  /** The card's id (`deliveryId:needId`, or `deliveryId:entryId` for an update), as the inbox mints it. */
1419
- id: z5.string(),
1420
- deliveryId: z5.string(),
1421
- entryId: z5.string(),
1673
+ id: z7.string(),
1674
+ deliveryId: z7.string(),
1675
+ entryId: z7.string(),
1422
1676
  /** The decision it waits on; null for an update, which asks nothing. */
1423
- needId: z5.string().nullable(),
1424
- goalIds: z5.array(z5.string()),
1677
+ needId: z7.string().nullable(),
1678
+ goalIds: z7.array(z7.string()),
1425
1679
  /** The name of the work it is about, when the read could word it. */
1426
- goalTitle: z5.string().optional(),
1427
- tokenId: z5.string().optional(),
1428
- name: z5.string(),
1429
- title: z5.string(),
1430
- body: z5.string(),
1431
- select: z5.enum(["one", "many", "rank", "confirm", "text"]),
1432
- options: z5.array(SlimOptionSchema),
1433
- hasPreview: z5.boolean(),
1434
- blocking: z5.boolean(),
1435
- askedAt: z5.string().datetime(),
1680
+ goalTitle: z7.string().optional(),
1681
+ tokenId: z7.string().optional(),
1682
+ name: z7.string(),
1683
+ title: z7.string(),
1684
+ body: z7.string(),
1685
+ select: z7.enum(["one", "many", "rank", "confirm", "text"]),
1686
+ options: z7.array(SlimOptionSchema),
1687
+ hasPreview: z7.boolean(),
1688
+ blocking: z7.boolean(),
1689
+ askedAt: z7.string().datetime(),
1436
1690
  ring: InboxItemSchema.shape.ring,
1437
- onCall: z5.literal(true).optional(),
1438
- sealed: z5.boolean()
1691
+ onCall: z7.literal(true).optional(),
1692
+ sealed: z7.boolean()
1439
1693
  });
1440
- var WorkStateSchema = z5.enum(["ready", "active", "waiting", "done", "cancelled"]);
1441
- var WorkRowSchema = z5.object({
1442
- id: z5.string(),
1443
- parentId: z5.string().nullable(),
1444
- title: z5.string(),
1694
+ var WorkStateSchema = z7.enum(["ready", "active", "waiting", "done", "cancelled"]);
1695
+ var WorkRowSchema = z7.object({
1696
+ id: z7.string(),
1697
+ parentId: z7.string().nullable(),
1698
+ title: z7.string(),
1445
1699
  /** Straight off the Goal. */
1446
1700
  state: WorkStateSchema,
1447
- owner: z5.string().nullable(),
1448
- revision: z5.number().int(),
1701
+ owner: z7.string().nullable(),
1702
+ revision: z7.number().int(),
1449
1703
  /** Open questions on it, counted to 100. */
1450
- waiting: z5.number().int(),
1704
+ waiting: z7.number().int(),
1451
1705
  /** Held by a gate on work that is not done. */
1452
- blocked: z5.boolean(),
1453
- lastProgressAt: z5.string().datetime().nullable(),
1706
+ blocked: z7.boolean(),
1707
+ lastProgressAt: z7.string().datetime().nullable(),
1454
1708
  /** The line written for its newest progress note, else that note's first words. */
1455
- line: z5.string().nullable(),
1709
+ line: z7.string().nullable(),
1456
1710
  /** Work directly under it, counted to 100; the list carries up to 12 of them. */
1457
- children: z5.number().int(),
1458
- createdAt: z5.string().datetime(),
1459
- updatedAt: z5.string().datetime(),
1711
+ children: z7.number().int(),
1712
+ createdAt: z7.string().datetime(),
1713
+ updatedAt: z7.string().datetime(),
1460
1714
  /** When anything at or under it last moved — the order the list is in. */
1461
- activeAt: z5.string().datetime(),
1715
+ activeAt: z7.string().datetime(),
1462
1716
  /** A sealed outcome has no title here; the work's page opens it. */
1463
- sealed: z5.boolean()
1717
+ sealed: z7.boolean()
1464
1718
  });
1465
1719
  var ComputerRowSchema = ConnectionSummarySchema.omit({ activity: true });
1466
1720
  var AgentRowSchema = ComputerRowSchema.extend({
1467
1721
  /** Open questions it is asking the person, over every open card; null when that read failed. */
1468
- asking: z5.number().int().nullable(),
1469
- oldestAskAt: z5.string().datetime().nullable(),
1722
+ asking: z7.number().int().nullable(),
1723
+ oldestAskAt: z7.string().datetime().nullable(),
1470
1724
  /** Up to three of the live Goals it holds, oldest first (the order it picks them up), and how
1471
1725
  * many in all among the account's 200 most recently active agent-held live Goals
1472
1726
  * (`agent_holds`); null when that read failed. */
1473
- holds: z5.array(z5.object({ id: z5.string(), title: z5.string() })).nullable(),
1474
- held: z5.number().int().nullable(),
1727
+ holds: z7.array(z7.object({ id: z7.string(), title: z7.string() })).nullable(),
1728
+ held: z7.number().int().nullable(),
1475
1729
  /** The earliest instant any Goal it holds went quiet, by the one rule (`coldSince`); null
1476
1730
  * while none has, or when that read failed. */
1477
- cold: z5.string().datetime().nullable(),
1731
+ cold: z7.string().datetime().nullable(),
1478
1732
  /** The newest line of its working log, and when the harness saw it. */
1479
- line: z5.string().nullable(),
1480
- lineAt: z5.string().datetime().nullable()
1733
+ line: z7.string().nullable(),
1734
+ lineAt: z7.string().datetime().nullable()
1481
1735
  });
1482
- var SnapshotSchema = z5.object({
1736
+ var SnapshotSchema = z7.object({
1483
1737
  /** The API's clock, taken before the first read: what a later delta will start from. */
1484
- at: z5.string().datetime(),
1485
- questions: z5.object({
1738
+ at: z7.string().datetime(),
1739
+ questions: z7.object({
1486
1740
  /** The newest 30 open cards, questions before updates. */
1487
- items: z5.array(QuestionRowSchema),
1741
+ items: z7.array(QuestionRowSchema),
1488
1742
  /** Every open question, and apart from them every update, and what was put off. */
1489
- total: z5.number().int(),
1490
- updates: z5.number().int(),
1491
- putOff: z5.number().int()
1743
+ total: z7.number().int(),
1744
+ updates: z7.number().int(),
1745
+ putOff: z7.number().int()
1492
1746
  }).nullable(),
1493
- agents: z5.object({
1747
+ agents: z7.object({
1494
1748
  /** Up to 60, most recently seen first. */
1495
- items: z5.array(AgentRowSchema),
1496
- more: z5.boolean()
1749
+ items: z7.array(AgentRowSchema),
1750
+ more: z7.boolean()
1497
1751
  }).nullable(),
1498
- work: z5.object({
1752
+ work: z7.object({
1499
1753
  /** The 60 most recently active roots, each followed by up to 12 children; 240 rows at most. */
1500
- items: z5.array(WorkRowSchema),
1754
+ items: z7.array(WorkRowSchema),
1501
1755
  /** How much work is behind each of the Work tab's four filters, each counted to 100, read with
1502
1756
  * the rows. `work_list` (20260928023533) owns the predicates: Live is `ready`, `active` or
1503
1757
  * `waiting`; Waiting on you is live work with an open question or an unmet gate; Not started
1504
1758
  * is `ready`; Done is `done` or `cancelled`. */
1505
- counts: z5.object({ live: z5.number().int(), waiting: z5.number().int(), notStarted: z5.number().int(), done: z5.number().int() })
1759
+ counts: z7.object({ live: z7.number().int(), waiting: z7.number().int(), notStarted: z7.number().int(), done: z7.number().int() })
1506
1760
  }).nullable(),
1507
- you: z5.object({
1761
+ you: z7.object({
1508
1762
  settings: UserSettingsSchema,
1509
- callable: z5.boolean(),
1763
+ callable: z7.boolean(),
1510
1764
  /** Up to 20 paired computers; null when the roster read failed. */
1511
- computers: z5.array(ComputerRowSchema).nullable()
1765
+ computers: z7.array(ComputerRowSchema).nullable()
1512
1766
  }).nullable()
1513
1767
  });
1514
- var CallRecapSchema = z5.object({
1515
- call: z5.object({
1516
- status: z5.string(),
1517
- startedAt: z5.string(),
1518
- durationMs: z5.number().nullable(),
1519
- agents: z5.array(z5.object({ id: z5.string(), name: z5.string().nullable() }))
1768
+ var CallRecapSchema = z7.object({
1769
+ call: z7.object({
1770
+ status: z7.string(),
1771
+ startedAt: z7.string(),
1772
+ durationMs: z7.number().nullable(),
1773
+ agents: z7.array(z7.object({ id: z7.string(), name: z7.string().nullable() }))
1520
1774
  }),
1521
- topics: z5.array(z5.object({
1522
- goalId: z5.string().uuid(),
1523
- title: z5.string(),
1524
- owner: z5.string(),
1525
- state: z5.string(),
1526
- questions: z5.array(z5.object({ id: z5.string().uuid(), state: z5.string(), title: z5.string() })),
1775
+ topics: z7.array(z7.object({
1776
+ goalId: z7.string().uuid(),
1777
+ title: z7.string(),
1778
+ owner: z7.string(),
1779
+ state: z7.string(),
1780
+ questions: z7.array(z7.object({ id: z7.string().uuid(), state: z7.string(), title: z7.string() })),
1527
1781
  /** `words` is always what they SAID, verbatim — the record, never replaced. `headline` is
1528
1782
  * their answer on one line when the call's read wrote one (owner, 2026-10-01: "render them
1529
1783
  * summarized like a pre-made option is"), so the row scans like a chosen option and their
@@ -1531,10 +1785,10 @@ var CallRecapSchema = z5.object({
1531
1785
  * anything that is not an answer. */
1532
1786
  /** `about` is the request the line answered (its question), null for words that answered none —
1533
1787
  * the key the screen groups on, so one question is one row however many times it was answered. */
1534
- lines: z5.array(z5.object({ entryId: z5.string().uuid(), words: z5.string(), headline: z5.string().optional(), about: z5.string().nullable().optional() }))
1788
+ lines: z7.array(z7.object({ entryId: z7.string().uuid(), words: z7.string(), headline: z7.string().optional(), about: z7.string().nullable().optional() }))
1535
1789
  })),
1536
- unfiled: z5.array(z5.object({ lineId: z5.string().uuid(), words: z5.string(), atMs: z5.number() })),
1537
- more: z5.object({ lines: z5.number(), entries: z5.number(), topics: z5.number() })
1790
+ unfiled: z7.array(z7.object({ lineId: z7.string().uuid(), words: z7.string(), atMs: z7.number() })),
1791
+ more: z7.object({ lines: z7.number(), entries: z7.number(), topics: z7.number() })
1538
1792
  });
1539
1793
 
1540
1794
  // src/listening.ts
@@ -1555,7 +1809,7 @@ function sessionStartHook() {
1555
1809
  [ -f "\${HOME}/.paigy/token.json" ] || exit 0 # not paired on this machine: nothing to listen as
1556
1810
  cat <<'PAIGY'
1557
1811
  Paigy: nothing pushes answers into a session started in a terminal \u2014 an answer waits for your
1558
- next check_replies. Start your own listener now, as a BACKGROUND task whose output you watch
1812
+ next contact({ wait: false }). Start your own listener now, as a BACKGROUND task whose output you watch
1559
1813
  (your harness's monitor/background-task tool), and leave it running for this session:
1560
1814
 
1561
1815
  npx -y -p @paigy/mcp@latest paigy-listen
@@ -1591,12 +1845,6 @@ function decideListen(f) {
1591
1845
  message: "Already listening: this session was started by the Paigy harness, whose pump delivers every answer into it as it lands. Nothing to start."
1592
1846
  };
1593
1847
  }
1594
- if (!f.token) {
1595
- return {
1596
- status: "unpaired",
1597
- message: "Not paired: no token in this session's slot, so there is no identity to listen as \u2014 call onboard first."
1598
- };
1599
- }
1600
1848
  if (f.pidAlive && f.pid !== void 0) {
1601
1849
  const connected = f.wake?.ready === true && (f.wake.target.kind !== "codex" || f.wake.target.thread === f.env.CODEX_THREAD_ID);
1602
1850
  return { status: connected ? "listening" : "receiving", via: "daemon", pid: f.pid, ...f.wake ? { wake: f.wake } : {}, message: connected ? `Listener running (pid ${f.pid}); wake adapter ready. A queued message is not proof the agent handled it.` : `Listener running (pid ${f.pid}), but automatic session resume is not confirmed${f.wake?.lastError ? `: ${f.wake.lastError}` : ". Watch its output or configure a supported wake adapter"}. Do not start a second listener.` };
@@ -1656,6 +1904,7 @@ export {
1656
1904
  AGENT_TOOLS,
1657
1905
  serverInstructions,
1658
1906
  entryWords,
1907
+ entryUnit,
1659
1908
  harnessDriven,
1660
1909
  sessionStartHook,
1661
1910
  withSessionStartHook,