@paigy/mcp 0.40.32 → 0.40.33

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.
@@ -7,7 +7,7 @@ import { homedir } from "os";
7
7
  import { join } from "path";
8
8
  import { randomUUID as randomUUID2 } from "crypto";
9
9
  import { setTimeout as sleep2 } from "timers/promises";
10
- import { z as z9 } from "zod";
10
+ import { z as z10 } from "zod";
11
11
  import { z } from "zod";
12
12
  import { z as z3 } from "zod";
13
13
  import { ZodFirstPartyTypeKind as ZodFirstPartyTypeKind3 } from "zod/v3";
@@ -19,6 +19,7 @@ import { z as z5 } from "zod";
19
19
  import { z as z6 } from "zod";
20
20
  import { z as z7 } from "zod";
21
21
  import { z as z8 } from "zod";
22
+ import { z as z9 } from "zod";
22
23
  import { closeSync, existsSync, mkdirSync, openSync, readFileSync as readFileSync2, rmSync, statSync, writeFileSync } from "fs";
23
24
  import { homedir as homedir2 } from "os";
24
25
  import { join as join2 } from "path";
@@ -1495,16 +1496,16 @@ function parseWhen(said2, tz, nowMs, read22 = "earliest") {
1495
1496
  let hour = null;
1496
1497
  let minute = 0;
1497
1498
  const spoken = new RegExp(`\\bat\\s+(${Object.keys(SPOKEN_HOUR).join("|")})\\b`, "i").exec(text);
1498
- const clock2 = CLOCK.exec(text);
1499
+ const clock3 = CLOCK.exec(text);
1499
1500
  if (spoken) {
1500
1501
  hour = SPOKEN_HOUR[spoken[1].toLowerCase()];
1501
- } else if (clock2 && (clock2[3] || /\bat\s/i.test(clock2[0]))) {
1502
- hour = Number(clock2[1]);
1503
- minute = clock2[2] ? Number(clock2[2]) : 0;
1502
+ } else if (clock3 && (clock3[3] || /\bat\s/i.test(clock3[0]))) {
1503
+ hour = Number(clock3[1]);
1504
+ minute = clock3[2] ? Number(clock3[2]) : 0;
1504
1505
  if (hour > 23 || minute > 59) return null;
1505
1506
  }
1506
1507
  if (hour !== null) {
1507
- const mer = clock2?.[3]?.toLowerCase().replace(/\./g, "") ?? "";
1508
+ const mer = clock3?.[3]?.toLowerCase().replace(/\./g, "") ?? "";
1508
1509
  const pmWord = /\b(p\.?m\.?|afternoon|evening|tonight|at night)\b/i.test(text);
1509
1510
  const amWord = /\b(a\.?m\.?|morning)\b/i.test(text);
1510
1511
  if (mer.startsWith("p") || pmWord && !amWord) {
@@ -1548,6 +1549,16 @@ function parseDelay(said2, tz, nowMs, read22 = "earliest") {
1548
1549
  return Math.max(0, Math.round((Date.parse(at2) - nowMs) / 1e3));
1549
1550
  }
1550
1551
  var NIGHT = { from: 23, to: 7 };
1552
+ var ASKING_RULES = `HOW TO ASK:
1553
+ 1. Write one question per object. Five questions are five objects in \`questions\`, in one contact, so each can be answered on its own; one question with five parts settles nothing until all five are answered.
1554
+ 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.
1555
+ 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.
1556
+ 4. Never hold the process open with while-loops. A wait that comes back \`expired\` is not a finished conversation: wait again with contact({wait:true}) only while you have nothing else to do. While a Call you placed is open, keep receiving window after window until it ends, even when a window is empty: the person may give follow-ups or instructions. With no open Call, STOP WAITING when a window comes back with nothing new \u2014 the question stays open, and its answer reaches you on the Goal. Otherwise, yield only with a working listener or scheduled wakeup, and collect answers with \`contact({wait:false})\` or \`get_goal\` on that wake.
1557
+ 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\`.
1558
+ 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.
1559
+ 7. A question carries its options when you have them; a free-text question may omit them. Each option\u2019s label must stand on its own and name its choice in full -- never \`All three\` or \`Option 2\`. \`pickMode: "many"\` makes the card a checklist (options they may want several of); \`"one"\`, the default, a pick (one rules out the others); \`"rank"\` an ordering. Each question is sent exactly as written, with no reading in between. They can always answer in their own words, so never add an 'Other' option.
1560
+ 8. A diagnosis says when, why and how it happens, then proposes one fix. Never options first.
1561
+ 9. GIVE A REPORT ITS REPLY: an update takes \`reply\` too, one line the person can tap instead of typing, written in THEIR voice for THAT report ("Sounds good, I'll test later") \u2014 the same care you give a question's options. What they tap is what you read back, which tells you whether they verified your work or only received it. One line, because a report has one way to close, and it may not change what happens next: a reply that would is a question. Requested delivery and completed-Goal reports require a reply (reply_required); ordinary progress may omit it.`;
1551
1562
  function draft2020(node) {
1552
1563
  if (Array.isArray(node)) return node.map(draft2020);
1553
1564
  if (node && typeof node === "object") {
@@ -1666,10 +1677,18 @@ var UpdateInputSchema = z2.object({
1666
1677
  // MECHANISM). It rides the door as the report's single stored option (`storedOption`,
1667
1678
  // `apps/api/src/goal/router.ts`), so no reader below the door learns a second shape.
1668
1679
  reply: z2.string().trim().min(1).describe(
1669
- `What this report's button says instead of "Got it", at most ${OPTION_LABEL_MAX} characters, written in THEIR voice for THIS report ("Sounds good, I'll test later") -- the care you give a question's options, so what they tap tells you whether they verified your work or only received it. One tap sends exactly these words back to you. Words that would CHANGE what happens next are a question, not a reply to a report: it still asks nothing and still owes you no answer. Left out, the button says "Got it", as every card did.`
1680
+ `What this report's button says instead of "Got it", at most ${OPTION_LABEL_MAX} characters, written in THEIR voice for THIS report ("Sounds good, I'll test later") -- the care you give a question's options, so what they tap tells you whether they verified your work or only received it. One tap sends exactly these words back to you. Words that would CHANGE what happens next are a question, not a reply to a report: it still asks nothing and still owes you no answer. The reply is required for requested delivery and completed Goals; ordinary progress may omit it.`
1670
1681
  ).optional(),
1671
1682
  userExplicitlyRequested
1672
1683
  }).strict().superRefine((u, ctx) => {
1684
+ if (u.userExplicitlyRequested && !u.reply) {
1685
+ ctx.addIssue({
1686
+ code: z2.ZodIssueCode.custom,
1687
+ path: ["reply"],
1688
+ params: { refusal: "reply_required" },
1689
+ message: "reply_required: an update requested for delivery needs one reply, written in the person\u2019s voice for this report."
1690
+ });
1691
+ }
1673
1692
  refuseOverCaps(u.message, u.units, "message", ctx);
1674
1693
  if (u.reply && u.reply.length > OPTION_LABEL_MAX) {
1675
1694
  ctx.addIssue({
@@ -1757,14 +1776,10 @@ var ContactWireSchema = z2.object({
1757
1776
  questions: z2.array(QuestionWireSchema).min(1).max(20).optional()
1758
1777
  }).strict().refine(sendsAnything, "a contact sends at least one update, question, answer, withdrawal or question dependency");
1759
1778
  var CONTACT_SCHEMA = { type: "object", ...mcpInputSchema(ContactSchema) };
1760
- 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.
1761
-
1762
- 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.
1779
+ 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.\n\n" + ASKING_RULES + `
1763
1780
 
1764
1781
  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.
1765
1782
 
1766
- GIVE A REPORT ITS REPLY: an update takes \`reply\` too, one line the person can tap instead of typing, written in THEIR voice for THAT report ("Sounds good, I'll test later") \u2014 the same care you give a question's options. It is what their button says instead of "Got it", and what they tap is what you read back, which tells you whether they verified your work or only received it. One line, because a report has one way to close, and it may not change what happens next: a reply that would is a question. Nothing is owed on it either way, and a report that writes none offers "Got it".
1767
-
1768
1783
  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.
1769
1784
 
1770
1785
  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\`; your first write to it starts it) and your work gone quiet (\`stalled\`).`;
@@ -1870,6 +1885,10 @@ var GetGoalSchema = z3.object({
1870
1885
  * between two of them named. Off by default; `docs/model/goal/diagnose-design.md`. */
1871
1886
  diagnose: z3.boolean().optional()
1872
1887
  }).strict();
1888
+ var GetDeliverySchema = z3.object({
1889
+ deliveryId: z3.string().uuid().describe("The Delivery id returned by contact or receive.")
1890
+ }).strict();
1891
+ var GET_DELIVERY_DESCRIPTION = "Read a Delivery in full: its whole ask, units, options and answers, plus current callState and callOutcome for a Call. Any agent of the same account may read it; another account is not disclosed. Reading never acknowledges or resends anything. Use this after a call or when receive names a Call you are waiting on.";
1873
1892
  var GET_GOAL_DESCRIPTION = "Read one Goal (a read never puts you on 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.";
1874
1893
  var SearchToolSchema = z3.object({
1875
1894
  query: z3.string().trim().min(1).max(500),
@@ -1878,6 +1897,8 @@ var SearchToolSchema = z3.object({
1878
1897
  limit: z3.number().int().min(1).max(20).optional()
1879
1898
  }).strict();
1880
1899
  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 replies -- the person's answers, acknowledgements and deferrals (type answer; found by their summary, by the question or report they reply to, 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, the replies to its items, 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 (a reply carries its kind -- answered, acknowledged or deferred -- whether it is closed (a deferral is not), its summary in under ten words, its question or report, 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.";
1900
+ var ConfigureIdentitySchema = z3.object({}).strict();
1901
+ var CONFIGURE_IDENTITY_DESCRIPTION = "Read this authenticated agent\u2019s current name, voice and token ID. Read-only; no arguments. Pairing, renaming and logout are available only through the local configure driver.";
1881
1902
  var CheckActivitySchema = z3.object({}).strict();
1882
1903
  var FEEDBACK_TEXT_MAX = 5e4;
1883
1904
  var SendFeedbackSchema = z3.object({
@@ -1887,8 +1908,10 @@ var SendFeedbackSchema = z3.object({
1887
1908
  }).strict();
1888
1909
  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.";
1889
1910
  var AGENT_TOOLS = [
1911
+ { name: "configure", description: CONFIGURE_IDENTITY_DESCRIPTION, inputSchema: mcpInputSchema(ConfigureIdentitySchema) },
1890
1912
  { name: "contact", description: CONTACT_DESCRIPTION, inputSchema: CONTACT_SCHEMA },
1891
1913
  { name: "manage_goals", description: MANAGE_GOALS_DESCRIPTION, inputSchema: mcpInputSchema(ManageGoalsToolSchema) },
1914
+ { name: "get_delivery", description: GET_DELIVERY_DESCRIPTION, inputSchema: mcpInputSchema(GetDeliverySchema) },
1892
1915
  { name: "get_goal", description: GET_GOAL_DESCRIPTION, inputSchema: mcpInputSchema(GetGoalSchema) },
1893
1916
  { name: "search", description: SEARCH_DESCRIPTION, inputSchema: mcpInputSchema(SearchToolSchema) },
1894
1917
  { name: "check_activity", 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(CheckActivitySchema) },
@@ -2186,20 +2209,56 @@ var LIVE_MS = 3 * 6e4;
2186
2209
  var WORKING_MS = 60 * 6e4;
2187
2210
  var WORKING_TIER_MS = 2 * 60 * 6e4;
2188
2211
  var RECENT_TIER_MS = 24 * 60 * 6e4;
2189
- var ContextSchema = z9.object({
2190
- title: z9.string().min(1).describe("One-line headline of what you need (required, non-empty)."),
2191
- description: z9.array(z9.string().min(1)).describe(
2212
+ var json = z9.lazy(() => z9.union([
2213
+ z9.string(),
2214
+ z9.number().finite(),
2215
+ z9.boolean(),
2216
+ z9.null(),
2217
+ z9.array(json),
2218
+ z9.record(json)
2219
+ ]));
2220
+ var clock = z9.number().int().nonnegative().safe();
2221
+ var HeardEventSchema = z9.object({
2222
+ eventId: z9.string().uuid(),
2223
+ source: z9.enum(["phone", "bot"]),
2224
+ sequence: clock,
2225
+ kind: z9.string().min(1),
2226
+ phoneAtMs: clock.optional(),
2227
+ botAtMs: clock.optional(),
2228
+ payload: z9.record(json)
2229
+ }).strict();
2230
+ var HeardCursorSchema = HeardEventSchema.pick({ source: true, sequence: true, eventId: true });
2231
+ var HeardPageSchema = z9.object({
2232
+ events: z9.array(HeardEventSchema).max(200),
2233
+ next: HeardCursorSchema.nullable()
2234
+ }).strict();
2235
+ var MAX_EVENTS = 50;
2236
+ var MAX_BYTES = 8e4;
2237
+ var batchBytes = (events) => {
2238
+ let bytes = 0;
2239
+ for (const char of JSON.stringify({ events })) {
2240
+ const point = char.codePointAt(0);
2241
+ bytes += point < 128 ? 1 : point < 2048 ? 2 : point < 65536 ? 3 : 4;
2242
+ }
2243
+ return bytes;
2244
+ };
2245
+ var HeardBatchSchema = z9.object({
2246
+ events: z9.array(HeardEventSchema).min(1).max(MAX_EVENTS)
2247
+ }).strict().refine((value) => batchBytes(value.events) <= MAX_BYTES, "heard_batch_too_large");
2248
+ var ContextSchema = z10.object({
2249
+ title: z10.string().min(1).describe("One-line headline of what you need (required, non-empty)."),
2250
+ description: z10.array(z10.string().min(1)).describe(
2192
2251
  "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."
2193
2252
  ),
2194
2253
  /** THE ASK'S UNITS (3c): its context as titled units, in order. The app lists the titles and opens
2195
2254
  * a body on a tap. Absent on an ask sent without units, which renders as before. */
2196
- units: z9.array(z9.object({ title: z9.string(), body: z9.string() })).optional()
2255
+ units: z10.array(z10.object({ title: z10.string(), body: z10.string() })).optional()
2197
2256
  });
2198
- var ParticipantSchema = z9.object({
2199
- kind: z9.enum(["human", "agent"]),
2200
- id: z9.string()
2257
+ var ParticipantSchema = z10.object({
2258
+ kind: z10.enum(["human", "agent"]),
2259
+ id: z10.string()
2201
2260
  });
2202
- var TransformSchema = z9.enum([
2261
+ var TransformSchema = z10.enum([
2203
2262
  "structure",
2204
2263
  // shape intent into an answer contract; pick channel/urgency — broker `ask`, `select` shapes, `points`
2205
2264
  "request_more",
@@ -2222,13 +2281,13 @@ var PAIGY_SELF = { kind: "agent", id: "paigy" };
2222
2281
  function isPaigy(ref) {
2223
2282
  return ref === participantRef(PAIGY_SELF);
2224
2283
  }
2225
- var VisualSchema = z9.object({
2226
- url: z9.string().url(),
2227
- label: z9.string().optional()
2284
+ var VisualSchema = z10.object({
2285
+ url: z10.string().url(),
2286
+ label: z10.string().optional()
2228
2287
  });
2229
- var NotifyLevelSchema = z9.enum(["inbox", "push", "banner", "call"]);
2230
- var SelectShapeSchema = z9.enum(["one", "many", "rank", "confirm", "text"]);
2231
- var ReceiptEventSchema = z9.enum([
2288
+ var NotifyLevelSchema = z10.enum(["inbox", "push", "banner", "call"]);
2289
+ var SelectShapeSchema = z10.enum(["one", "many", "rank", "confirm", "text"]);
2290
+ var ReceiptEventSchema = z10.enum([
2232
2291
  "delivered",
2233
2292
  // the bundle reached the recipient at some level
2234
2293
  "seen",
@@ -2258,47 +2317,47 @@ var ReceiptEventSchema = z9.enum([
2258
2317
  // be rewound by a writer that forgot to advance it.
2259
2318
  "restarted"
2260
2319
  ]);
2261
- var AttentionSchema = z9.object({
2320
+ var AttentionSchema = z10.object({
2262
2321
  urgency: NotifyLevelSchema,
2263
2322
  /** The required answer shape, or null for a plain notify that asks nothing back. */
2264
2323
  select: SelectShapeSchema.nullable(),
2265
2324
  /** Coverage contract (#396) — points the answer must address; null = none declared. */
2266
- points: z9.array(z9.string()).nullable(),
2325
+ points: z10.array(z10.string()).nullable(),
2267
2326
  /** Whether the ask blocks the sender — what lets arbitration escalate it on silence. */
2268
- blocking: z9.boolean(),
2327
+ blocking: z10.boolean(),
2269
2328
  /** Reserved (docs/model/model.md lists it): a response deadline. No row column yet — a later Phase 2
2270
2329
  * slice wires it; optional so today's rows/callers project cleanly. */
2271
- deadline: z9.string().datetime().nullable().optional()
2330
+ deadline: z10.string().datetime().nullable().optional()
2272
2331
  });
2273
- var NotifyRequestFields = z9.object({
2332
+ var NotifyRequestFields = z10.object({
2274
2333
  /** Plaintext message content. Present on the plaintext path (today's shape);
2275
2334
  * ABSENT on the E2EE path, where the sealed `envelope` below carries it. The
2276
2335
  * superRefine at the bottom enforces exactly one of the two. */
2277
2336
  context: ContextSchema.optional(),
2278
- options: z9.array(OptionSchema.omit({ id: true }).extend({ label: z9.string().trim().min(1).max(1e3) }).strict()).min(OPTIONS_MIN).max(OPTIONS_MAX).optional().describe(
2337
+ options: z10.array(OptionSchema.omit({ id: true }).extend({ label: z10.string().trim().min(1).max(1e3) }).strict()).min(OPTIONS_MIN).max(OPTIONS_MAX).optional().describe(
2279
2338
  "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)."
2280
2339
  ),
2281
- points: z9.array(z9.string().min(1)).optional().describe(
2340
+ points: z10.array(z10.string().min(1)).optional().describe(
2282
2341
  "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."
2283
2342
  ),
2284
- visuals: z9.array(VisualSchema).optional().describe(
2343
+ visuals: z10.array(VisualSchema).optional().describe(
2285
2344
  "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."
2286
2345
  ),
2287
2346
  /** Git repo the agent is working in ("owner/name"). Local MCP fills this from the checkout — omit unless overriding. */
2288
- repo: z9.string().optional(),
2347
+ repo: z10.string().optional(),
2289
2348
  /** Git branch the agent is on. Local MCP fills this from the checkout — omit unless overriding. */
2290
- branch: z9.string().optional(),
2349
+ branch: z10.string().optional(),
2291
2350
  /** Continue an existing conversation — the id of any notification in it (its root
2292
2351
  * is the conversation's identity). Omitted = start a new conversation. Renamed
2293
2352
  * from `parentId` (2026-08-03): one linkage system, the parent; the API edge
2294
2353
  * still accepts the old name from older clients. */
2295
- parentId: z9.string().uuid().optional(),
2354
+ parentId: z10.string().uuid().optional(),
2296
2355
  /** The durable outcome this contact advances. Optional during the notification-to-Work
2297
2356
  * migration; when present, a blocking ask creates a DecisionNeed for this Work. */
2298
- workId: z9.string().uuid().optional(),
2357
+ workId: z10.string().uuid().optional(),
2299
2358
  /** Target Goal scope. During staged migration this is accepted by the shared contract but
2300
2359
  * target delivery activation remains model-gated; workId and goalId are mutually exclusive. */
2301
- goalId: z9.string().uuid().optional(),
2360
+ goalId: z10.string().uuid().optional(),
2302
2361
  urgency: NotifyLevelSchema.default("inbox").describe(
2303
2362
  "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."
2304
2363
  ),
@@ -2306,7 +2365,7 @@ var NotifyRequestFields = z9.object({
2306
2365
  * visible and marks it needs_input. Renamed from the old `parentId` (2026-08-03)
2307
2366
  * when `parentId` became the conversation handle: `parentId` says WHERE, this
2308
2367
  * says HOW. */
2309
- clarifies: z9.string().optional(),
2368
+ clarifies: z10.string().optional(),
2310
2369
  select: SelectShapeSchema.optional().describe(
2311
2370
  "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."
2312
2371
  ),
@@ -2320,20 +2379,20 @@ var NotifyRequestFields = z9.object({
2320
2379
  // (docs/brain/broker/agenda-design.md) — not by a wire cap the agent has to pre-summarize under.
2321
2380
  // Owner, 2026-07-28: "our actual limitation on how long something is to the user should
2322
2381
  // come from the broker splitting and summarizing." The cap that remains is a size guard.
2323
- ask: z9.string().min(1).max(1e4).optional().describe(
2382
+ ask: z10.string().min(1).max(1e4).optional().describe(
2324
2383
  '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.'
2325
2384
  ),
2326
- needs: z9.array(z9.string().min(1)).optional().describe(
2385
+ needs: z10.array(z10.string().min(1)).optional().describe(
2327
2386
  "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."
2328
2387
  ),
2329
- urgencyHint: z9.enum(["whenever", "soon", "now"]).optional().describe(
2388
+ urgencyHint: z10.enum(["whenever", "soon", "now"]).optional().describe(
2330
2389
  "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."
2331
2390
  ),
2332
2391
  /** #575: the ONE self-report that replaces urgencyHint + blocking — what happens
2333
2392
  * to the agent's work while it waits. Normalized server-side into those two
2334
2393
  * fields (normalizeWaiting) so everything downstream is untouched; explicit
2335
2394
  * urgencyHint/blocking win when both are sent. */
2336
- waiting: z9.enum(["none", "soft", "hard"]).optional().describe(
2395
+ waiting: z10.enum(["none", "soft", "hard"]).optional().describe(
2337
2396
  "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."
2338
2397
  ),
2339
2398
  /** Δ9b (#895): HOLD this claim so the sender can correct the plan before anyone is
@@ -2341,98 +2400,98 @@ var NotifyRequestFields = z9.object({
2341
2400
  * holding by default would charge every quiet claim that minute before any agent could
2342
2401
  * correct anything. Ignored for `waiting: 'hard'`: a blocking ask rings on what we have,
2343
2402
  * and the enrichment can still land mid-call (#781 re-plans the unspoken tail). */
2344
- confirm: z9.boolean().optional().describe(
2403
+ confirm: z10.boolean().optional().describe(
2345
2404
  "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'."
2346
2405
  ),
2347
2406
  /** #575: a RELAY of the user's explicitly stated preference, never the agent's
2348
2407
  * choice. Outranks waiting in both directions: 'call' rings even for a
2349
2408
  * waiting:'none' "call me when it's done"; 'message' never rings even for
2350
2409
  * waiting:'hard'. */
2351
- channel: z9.enum(["call", "message"]).optional().describe(
2410
+ channel: z10.enum(["call", "message"]).optional().describe(
2352
2411
  "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."
2353
2412
  ),
2354
- confirmStyle: z9.enum(["yesno", "approve"]).default("yesno").describe(
2413
+ confirmStyle: z10.enum(["yesno", "approve"]).default("yesno").describe(
2355
2414
  "Labels for a select:'confirm' paige \u2014 'yesno' (Yes/No) or 'approve' (Approve/Deny). Ignored unless select is 'confirm'."
2356
2415
  ),
2357
- blocking: z9.boolean().default(false).describe(
2416
+ blocking: z10.boolean().default(false).describe(
2358
2417
  "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."
2359
2418
  )
2360
2419
  });
2361
2420
  var NotifyRequestSchema = NotifyRequestFields.superRefine((r, ctx) => {
2362
- if (r.workId && r.goalId) ctx.addIssue({ code: z9.ZodIssueCode.custom, path: ["goalId"], message: "pass goalId or workId, not both" });
2421
+ if (r.workId && r.goalId) ctx.addIssue({ code: z10.ZodIssueCode.custom, path: ["goalId"], message: "pass goalId or workId, not both" });
2363
2422
  if (r.ask !== void 0) {
2364
2423
  for (const f of ["context", "select", "points"]) {
2365
2424
  if (r[f] !== void 0)
2366
- ctx.addIssue({ code: z9.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.` });
2425
+ ctx.addIssue({ code: z10.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.` });
2367
2426
  }
2368
2427
  return;
2369
2428
  }
2370
2429
  if (r.needs !== void 0 || r.urgencyHint !== void 0)
2371
- ctx.addIssue({ code: z9.ZodIssueCode.custom, path: ["needs"], message: "needs/urgencyHint belong to the simplified `ask` form \u2014 with a shaped request use points/urgency" });
2430
+ ctx.addIssue({ code: z10.ZodIssueCode.custom, path: ["needs"], message: "needs/urgencyHint belong to the simplified `ask` form \u2014 with a shaped request use points/urgency" });
2372
2431
  if (!r.context)
2373
- ctx.addIssue({ code: z9.ZodIssueCode.custom, path: ["context"], message: "context is required (plaintext path)" });
2432
+ ctx.addIssue({ code: z10.ZodIssueCode.custom, path: ["context"], message: "context is required (plaintext path)" });
2374
2433
  if (!r.select)
2375
- ctx.addIssue({ code: z9.ZodIssueCode.custom, path: ["select"], message: "select is required on the shaped form" });
2434
+ ctx.addIssue({ code: z10.ZodIssueCode.custom, path: ["select"], message: "select is required on the shaped form" });
2376
2435
  const needsOptions = r.select === "one" || r.select === "many" || r.select === "rank";
2377
2436
  if (needsOptions && !r.options?.length)
2378
- ctx.addIssue({ code: z9.ZodIssueCode.custom, path: ["options"], message: `select:'${r.select}' requires options` });
2437
+ ctx.addIssue({ code: z10.ZodIssueCode.custom, path: ["options"], message: `select:'${r.select}' requires options` });
2379
2438
  if (!needsOptions && r.options?.length)
2380
- ctx.addIssue({ code: z9.ZodIssueCode.custom, path: ["options"], message: `select:'${r.select}' takes no options` });
2439
+ ctx.addIssue({ code: z10.ZodIssueCode.custom, path: ["options"], message: `select:'${r.select}' takes no options` });
2381
2440
  });
2382
- var NotifyStatusSchema = z9.enum(["pending", "answered", "ignored"]);
2383
- var AgentStateSchema = z9.enum(["idle", "in_progress", "completed", "needs_input"]);
2384
- var TurnSchema = z9.object({
2385
- prompt: z9.string(),
2386
- reply: z9.string()
2441
+ var NotifyStatusSchema = z10.enum(["pending", "answered", "ignored"]);
2442
+ var AgentStateSchema = z10.enum(["idle", "in_progress", "completed", "needs_input"]);
2443
+ var TurnSchema = z10.object({
2444
+ prompt: z10.string(),
2445
+ reply: z10.string()
2387
2446
  });
2388
- var UserAnswerSchema = z9.discriminatedUnion("kind", [
2389
- z9.object({ kind: z9.literal("option"), optionId: z9.string(), label: z9.string().optional() }),
2390
- z9.object({ kind: z9.literal("text"), text: z9.string() }),
2391
- z9.object({ kind: z9.literal("ignored") }),
2392
- z9.object({ kind: z9.literal("multi"), optionIds: z9.array(z9.string()), labels: z9.array(z9.string()).optional() }),
2393
- z9.object({ kind: z9.literal("ranked"), optionIds: z9.array(z9.string()), labels: z9.array(z9.string()).optional() }),
2394
- z9.object({ kind: z9.literal("clarify"), chunks: z9.array(z9.string()).min(1) }),
2395
- z9.object({ kind: z9.literal("confirm"), approved: z9.boolean() }),
2396
- z9.object({ kind: z9.literal("turns"), turns: z9.array(TurnSchema).min(1) }),
2447
+ var UserAnswerSchema = z10.discriminatedUnion("kind", [
2448
+ z10.object({ kind: z10.literal("option"), optionId: z10.string(), label: z10.string().optional() }),
2449
+ z10.object({ kind: z10.literal("text"), text: z10.string() }),
2450
+ z10.object({ kind: z10.literal("ignored") }),
2451
+ z10.object({ kind: z10.literal("multi"), optionIds: z10.array(z10.string()), labels: z10.array(z10.string()).optional() }),
2452
+ z10.object({ kind: z10.literal("ranked"), optionIds: z10.array(z10.string()), labels: z10.array(z10.string()).optional() }),
2453
+ z10.object({ kind: z10.literal("clarify"), chunks: z10.array(z10.string()).min(1) }),
2454
+ z10.object({ kind: z10.literal("confirm"), approved: z10.boolean() }),
2455
+ z10.object({ kind: z10.literal("turns"), turns: z10.array(TurnSchema).min(1) }),
2397
2456
  /** An auto-answer derived from the user's PAST decisions (docs/brain/broker/precedent-design.md §2):
2398
2457
  * delivered through the same settle/await path as a human answer, carrying the judge's
2399
2458
  * derivation and the precedent ids it grew from. Always paired with a visible trail
2400
2459
  * card the user can reply to — the broker never overrides the user. */
2401
- z9.object({ kind: z9.literal("precedent"), answer: z9.string(), derivation: z9.string(), sources: z9.array(z9.string()).min(1) })
2460
+ z10.object({ kind: z10.literal("precedent"), answer: z10.string(), derivation: z10.string(), sources: z10.array(z10.string()).min(1) })
2402
2461
  ]);
2403
- var IntentSchema = z9.object({
2462
+ var IntentSchema = z10.object({
2404
2463
  // The full vocabulary the bot's mapper emits (mapper.INTENT_KINDS) — the schema lagged
2405
2464
  // it by two ("detail", "feedback"), and because the settle handler parsed the array
2406
2465
  // all-or-nothing, ONE feedback act silently dropped EVERY intent on the call,
2407
2466
  // questions included. Found auditing five calls' stored feedback, 2026-08-01.
2408
- kind: z9.enum(["defer", "delegate", "channel", "question", "detail", "feedback", "command", "control"]),
2409
- detail: z9.string(),
2467
+ kind: z10.enum(["defer", "delegate", "channel", "question", "detail", "feedback", "command", "control"]),
2468
+ detail: z10.string(),
2410
2469
  /** Defer only: seconds until the callback the caller asked for, when something upstream
2411
2470
  * already read the time. Nothing sets it today (#397 documented an MCP parser that was
2412
2471
  * never written) — the API reads the defer's `detail` itself with `notes/when.ts`
2413
2472
  * (`parseDelay`, #1292), and a value here simply wins over that reading. */
2414
- dueInSeconds: z9.number().int().positive().optional(),
2473
+ dueInSeconds: z10.number().int().positive().optional(),
2415
2474
  /** Feedback only (#812): WHICH failure the complaint names — typed by the mapper that
2416
2475
  * already read the utterance, so `signals.kind` stops defaulting to
2417
2476
  * 'other' on every row. A table that records that something was wrong and nothing
2418
2477
  * about what cannot answer "is the bot looping less this week?". */
2419
- fault: z9.enum(["loop", "unanswered", "overridden", "misheard", "slow", "other"]).optional()
2478
+ fault: z10.enum(["loop", "unanswered", "overridden", "misheard", "slow", "other"]).optional()
2420
2479
  });
2421
- var RideAlongSchema = z9.object({
2480
+ var RideAlongSchema = z10.object({
2422
2481
  /** The note this came from — assign/clarify/close it through /api/notes/:id. */
2423
- noteId: z9.string(),
2482
+ noteId: z10.string(),
2424
2483
  /** What to do, in the owner's own words (the note's headline). Never model-rewritten. */
2425
- text: z9.string(),
2484
+ text: z10.string(),
2426
2485
  /** The thread to report back on, when the note was dispatched over the request rail. */
2427
- parentId: z9.string().nullable()
2486
+ parentId: z10.string().nullable()
2428
2487
  });
2429
- var AwaitItemSchema = z9.discriminatedUnion("type", [
2430
- z9.object({
2431
- type: z9.literal("reply"),
2432
- parentId: z9.string(),
2433
- notificationId: z9.string(),
2434
- workId: z9.string().uuid().optional(),
2435
- decisionId: z9.string().uuid().optional(),
2488
+ var AwaitItemSchema = z10.discriminatedUnion("type", [
2489
+ z10.object({
2490
+ type: z10.literal("reply"),
2491
+ parentId: z10.string(),
2492
+ notificationId: z10.string(),
2493
+ workId: z10.string().uuid().optional(),
2494
+ decisionId: z10.string().uuid().optional(),
2436
2495
  answer: UserAnswerSchema,
2437
2496
  /** WHAT THE AGENT CANNOT KNOW FROM THE FIELDS BESIDE IT (owner, 2026-09-04, issue
2438
2497
  * #1537). One line, built from the record: the ask and the caller's reply VERBATIM,
@@ -2442,107 +2501,107 @@ var AwaitItemSchema = z9.discriminatedUnion("type", [
2442
2501
  * "call me back after you merge" in their own words decides for itself what to do,
2443
2502
  * and now knows exactly which call to make. Absent when either half is missing —
2444
2503
  * a sentence with a hole in it is worse than no sentence. */
2445
- note: z9.string().optional(),
2504
+ note: z10.string().optional(),
2446
2505
  /** The call record rendered for THIS agent (`docs/brain/voice/record-design.md`): the words the
2447
2506
  * shaped answer was mapped from, filtered to its own claims. There is no second list
2448
2507
  * of labels beside it — the acts went 2026-09-04 and `intents` went with them (owner,
2449
2508
  * 2026-09-04): the agent reads the sentence and decides. */
2450
- transcript: z9.string().optional(),
2509
+ transcript: z10.string().optional(),
2451
2510
  /** Coverage report (#396), when the ask declared `points`: which of them this
2452
2511
  * answer addressed. Missing points = re-ask or proceed knowingly partial. */
2453
- covered: z9.array(z9.string()).optional(),
2512
+ covered: z10.array(z10.string()).optional(),
2454
2513
  /** Ride-alongs (RideAlongSchema) — pending work for you, attached to the moment you
2455
2514
  * became free. Only `reply` and `idle` carry it: those are the two outcomes that
2456
2515
  * END a wait. `remind`, `superseded` and `turn` are mid-flight, and handing an
2457
2516
  * agent a side-quest while it is still holding the line is how the main thing gets
2458
2517
  * dropped. Absent/empty = nothing owed. */
2459
- also: z9.array(RideAlongSchema).optional()
2518
+ also: z10.array(RideAlongSchema).optional()
2460
2519
  }),
2461
- z9.object({
2462
- type: z9.literal("remind"),
2463
- parentId: z9.string(),
2464
- notificationId: z9.string(),
2465
- remindAt: z9.string().datetime({ offset: true }),
2520
+ z10.object({
2521
+ type: z10.literal("remind"),
2522
+ parentId: z10.string(),
2523
+ notificationId: z10.string(),
2524
+ remindAt: z10.string().datetime({ offset: true }),
2466
2525
  /** Seconds until remindAt, server-computed — pass straight to ScheduleWakeup. */
2467
- remindInSeconds: z9.number()
2526
+ remindInSeconds: z10.number()
2468
2527
  }),
2469
2528
  /** The awaited ask was REPLACED by a newer notification on its thread (e.g. a
2470
2529
  * post-feedback revision, #633) — the user will never answer this id. Stop
2471
2530
  * awaiting it; the live ask is the thread's newest turn (await that one, or
2472
2531
  * re-orient via contact({})). */
2473
- z9.object({
2474
- type: z9.literal("superseded"),
2475
- parentId: z9.string(),
2476
- notificationId: z9.string()
2532
+ z10.object({
2533
+ type: z10.literal("superseded"),
2534
+ parentId: z10.string(),
2535
+ notificationId: z10.string()
2477
2536
  }),
2478
2537
  /** A LIVE call's turn, streamed as it lands (#783). PROVISIONAL: the user can still
2479
2538
  * revise any of these until the final reply arrives — partial = intelligence,
2480
2539
  * settled = authorization. Use it to PREPARE (fetch, draft, warm), never to act
2481
2540
  * irreversibly. If `acts` carries a question aimed at you and you know the answer,
2482
2541
  * contact on the same thread right away — the caller hears it on the same call. */
2483
- z9.object({
2484
- type: z9.literal("partial"),
2485
- notificationId: z9.string(),
2486
- inFlight: z9.literal(true),
2487
- turn: z9.object({
2488
- idx: z9.number(),
2489
- prompt: z9.string(),
2490
- reply: z9.string(),
2491
- acts: z9.array(IntentSchema).nullable().optional()
2542
+ z10.object({
2543
+ type: z10.literal("partial"),
2544
+ notificationId: z10.string(),
2545
+ inFlight: z10.literal(true),
2546
+ turn: z10.object({
2547
+ idx: z10.number(),
2548
+ prompt: z10.string(),
2549
+ reply: z10.string(),
2550
+ acts: z10.array(IntentSchema).nullable().optional()
2492
2551
  })
2493
2552
  }),
2494
- z9.object({
2495
- type: z9.literal("idle"),
2496
- also: z9.array(RideAlongSchema).optional(),
2553
+ z10.object({
2554
+ type: z10.literal("idle"),
2555
+ also: z10.array(RideAlongSchema).optional(),
2497
2556
  /** Is a call live for this agent's user right now? The SDK polls the partial stream
2498
2557
  * (#783) between idle ticks ONLY while this is not `false` — a partial can only exist
2499
2558
  * during a live call, and polling for one on a banner/message was a wasted HTTP call +
2500
2559
  * 3 queries on every idle tick of every waiting agent (~80% of all traffic at scale).
2501
2560
  * Absent = an older API → the SDK keeps polling, exactly as before. */
2502
- inFlight: z9.boolean().optional()
2561
+ inFlight: z10.boolean().optional()
2503
2562
  })
2504
2563
  ]);
2505
- var VoiceKeySchema = z9.enum(["rachel", "george", "jessica", "brian", "lily"]);
2506
- var AgendaTurnSchema = z9.object({
2564
+ var VoiceKeySchema = z10.enum(["rachel", "george", "jessica", "brian", "lily"]);
2565
+ var AgendaTurnSchema = z10.object({
2507
2566
  /** THE TURN'S IDENTITY (the first-sentence stream, 2026-09-09): the brain call that wrote
2508
2567
  * it and its place in that reply — `<brainCallId>:<index>`, with `:p` on the first
2509
2568
  * sentence a re-plan publishes ahead of the rest. A turn is spoken once, by this id: the
2510
2569
  * completion of a streamed re-plan carries the published sentence again, and the walk
2511
2570
  * drops what it already said by identity, never by the API's guess of what was polled.
2512
2571
  * Absent on plans nothing streams (a ring plan, a floor). */
2513
- id: z9.string().optional(),
2572
+ id: z10.string().optional(),
2514
2573
  /** Twin coverage (#1089): sibling claim ids this asking turn's answer ALSO settles —
2515
2574
  * the planner declares duplicates instead of asking them twice. */
2516
- coveredIds: z9.array(z9.string()).optional(),
2575
+ coveredIds: z10.array(z10.string()).optional(),
2517
2576
  /** The spoken sentences of the turn, in order. No count: how long a turn is is the brain's call
2518
2577
  * (owner, 2026-09-25), and a count here refused whole plans. */
2519
- info: z9.array(z9.string().min(1)).default([]),
2520
- question: z9.string().min(1).nullable(),
2578
+ info: z10.array(z10.string().min(1)).default([]),
2579
+ question: z10.string().min(1).nullable(),
2521
2580
  /** True on the one turn carrying the agent's own declared question. */
2522
- asks: z9.boolean().optional(),
2581
+ asks: z10.boolean().optional(),
2523
2582
  /** The claim this turn belongs to (#781) — the RETURN identity: answers route by it.
2524
2583
  * Absent on a single-claim plan (the session's own claim) and on shared context turns,
2525
2584
  * which route nothing. */
2526
- claimId: z9.string().optional(),
2585
+ claimId: z10.string().optional(),
2527
2586
  /** The claim's voice key (#462) — the OUTBOUND identity, audible who-is-asking. */
2528
- voice: z9.string().optional(),
2587
+ voice: z10.string().optional(),
2529
2588
  /** The claim's AGENT NAME (#838) — the spoken identity. A voice alone doesn't say
2530
2589
  * whose request this is: an item that folded in from another agent arrived as a bare
2531
2590
  * non-sequitur ("First real production sign-in is yours to make whenever you want.")
2532
2591
  * and the owner answered "What?". The bot names the agent before its first turn. */
2533
- agent: z9.string().optional(),
2592
+ agent: z10.string().optional(),
2534
2593
  /** The claim's agent by ID — the pairing's connection id (`notifications.token_id`), the
2535
2594
  * same id a face is minted from. A name is not an identity: two pairings may be called
2536
2595
  * "Claude", and a name cannot be joined on. The record's entries carry it (`agent_id`)
2537
2596
  * so "who said that" survives the call, and it rides PER TURN because a coalesced call
2538
2597
  * speaks for several agents — the turn is the only place that knows which. */
2539
- agentId: z9.string().optional(),
2598
+ agentId: z10.string().optional(),
2540
2599
  /** ITS QUESTION IS ON THE TABLE (#3292): a talker line about a question the person owes. The walk tells
2541
2600
  * the phone (`asking`, so the agenda goes gold and its options show) without treating the line as a
2542
2601
  * question turn — the talker owns re-asking and the waits, so `question` stays null. */
2543
- onTable: z9.boolean().optional(),
2602
+ onTable: z10.boolean().optional(),
2544
2603
  select: SelectShapeSchema.optional(),
2545
- options: z9.array(OptionSchema.omit({ id: true })).optional(),
2604
+ options: z10.array(OptionSchema.omit({ id: true })).optional(),
2546
2605
  /* `pace` STOOD HERE (#826). A turn could carry seconds and the model chose them. The walk
2547
2606
  paces itself now — a short beat between the sentences of a turn, the longer one at its end
2548
2607
  (owner, 2026-09-30: "remove the bot deciding pace") — and it does that where the words are
@@ -2551,33 +2610,33 @@ var AgendaTurnSchema = z9.object({
2551
2610
  /** Whether the walk WAITS for an answer before moving on. Absent = derived as today
2552
2611
  * (a question blocks, context flows). blocking:false on a question = ask and move
2553
2612
  * on, the claim stays pending; blocking:true on context = hold for a reply. */
2554
- blocking: z9.boolean().optional(),
2613
+ blocking: z10.boolean().optional(),
2555
2614
  /** SPOKEN ONLY IF THEY SAY NOTHING (owner, 2026-10-01, call 812de935: "you're gonna re-ask, but it
2556
2615
  * shouldn't be the same words … more like, hey, are you still there, or are you able to answer, or
2557
2616
  * would you need more information"). The walk holds this turn out of its queue; at the queue's end it
2558
2617
  * listens for the last word, and only if that listen is silent is this turn said and asked. If they
2559
2618
  * speak, it is dropped and their words are taken like any reply. */
2560
- ifSilent: z9.boolean().optional()
2619
+ ifSilent: z10.boolean().optional()
2561
2620
  });
2562
2621
  var CLAIM_STALE_MS = 30 * 6e4;
2563
- var InboxItemSchema = z9.object({
2564
- id: z9.string(),
2565
- tokenId: z9.string().optional(),
2622
+ var InboxItemSchema = z10.object({
2623
+ id: z10.string(),
2624
+ tokenId: z10.string().optional(),
2566
2625
  status: NotifyStatusSchema,
2567
2626
  context: ContextSchema,
2568
- options: z9.array(OptionSchema).optional(),
2627
+ options: z10.array(OptionSchema).optional(),
2569
2628
  /** The ask's declared coverage points (#396), when the agent sent them. */
2570
- points: z9.array(z9.string()).optional(),
2629
+ points: z10.array(z10.string()).optional(),
2571
2630
  /** Does this claim want an ANSWER, or is it telling you something? Written per row from
2572
2631
  * `requestAsks` — the agent's own declaration, not a guess. `false` is what earns a card
2573
2632
  * its acknowledge affordance: without it a status update offers a text box and a dismiss,
2574
2633
  * and neither of those is "got it" (owner, 2026-08-10). */
2575
- asks: z9.boolean().optional(),
2634
+ asks: z10.boolean().optional(),
2576
2635
  /** When a live process last pulsed for this row's agent — the liveness input for
2577
2636
  * "working requires a pulse" (#928): the list said "Working…" from agent_state alone
2578
2637
  * while the party called the same dead claim stalled. Absent = no token/no data,
2579
2638
  * which must never CLAIM stalled. */
2580
- lastSeenAt: z9.string().optional(),
2639
+ lastSeenAt: z10.string().optional(),
2581
2640
  /** WHEN THE AGENT LAST SAID ANYTHING ABOUT THIS CLAIM — the newest `agent_state` row in
2582
2641
  * the `notification_events` ledger (trigger-written since 20260621010000, so every row a
2583
2642
  * user can see has one). The age input for `CLAIM_STALE_MS`, and it has to be this rather
@@ -2587,7 +2646,7 @@ var InboxItemSchema = z9.object({
2587
2646
  * work. Reading the row's birth as the claim's age brands that "No update in 8h" the
2588
2647
  * instant the agent picks it up (#997). Absent = pre-trigger row; fall back to
2589
2648
  * `createdAt`. */
2590
- agentStateAt: z9.string().datetime().optional(),
2649
+ agentStateAt: z10.string().datetime().optional(),
2591
2650
  /** THE QUESTIONS A CALL CARRIES — the call screen's agenda spine (docs/clients/app/walk/design.md §11, owner
2592
2651
  * 2026-09-22). One per DecisionNeed on the Call, in the Call's order, answered or open (a
2593
2652
  * superseded or cancelled need is no longer a question anyone is asked). Present only on a
@@ -2601,61 +2660,61 @@ var InboxItemSchema = z9.object({
2601
2660
  * `turn` topic (`asking`, `settled`), because the bot never sees a DecisionNeed id. `title` is
2602
2661
  * the card's own concise heading; `answer` the accepted answer in words, null while open. It
2603
2662
  * REPLACED `agenda` (turns), which nothing ever filled. */
2604
- questions: z9.array(z9.object({
2605
- id: z9.string(),
2606
- entryId: z9.string(),
2607
- title: z9.string(),
2608
- state: z9.enum(["open", "answered"]),
2609
- answer: z9.string().nullable(),
2663
+ questions: z10.array(z10.object({
2664
+ id: z10.string(),
2665
+ entryId: z10.string(),
2666
+ title: z10.string(),
2667
+ state: z10.enum(["open", "answered"]),
2668
+ answer: z10.string().nullable(),
2610
2669
  /** WHO ASKED IT (owner, 2026-09-23, Goal a345e906: each agenda row wears its agent's face) — the
2611
2670
  * request Entry's author, as the same three facts the item's own `tokenId`/`name`/`voice`
2612
2671
  * carry for the call's one agent, so the phone draws it with the same seed. Absent when the
2613
2672
  * author is not an agent this account holds (unpaired since, or a person). */
2614
- agent: z9.object({ tokenId: z9.string(), name: z9.string(), voice: VoiceKeySchema.optional() }).optional(),
2673
+ agent: z10.object({ tokenId: z10.string(), name: z10.string(), voice: VoiceKeySchema.optional() }).optional(),
2615
2674
  /** ITS OPTIONS, WHEN THERE IS SOMETHING TO SEE (owner, 2026-09-25: "Yes, add it"): the options
2616
2675
  * its need offers, exactly as its own card carries them, present only when one of them has a
2617
2676
  * preview (`html` or `image`). The call screen opens them from the agenda row, so a preview is
2618
2677
  * never re-sent as a second card to be seen mid-call. Words-only options are `choices`. */
2619
- options: z9.array(OptionSchema).optional(),
2678
+ options: z10.array(OptionSchema).optional(),
2620
2679
  /** ITS OPTIONS WHEN THEY ARE WORDS (owner, 2026-10-02, on a call: "whenever there are pre-made
2621
2680
  * options … now for a checklist, we should also show them on the screen"; design C, 2026-10-08):
2622
2681
  * numbered chips above the call's controls, so a checklist is never only something read aloud. A
2623
2682
  * field of its own so `options` keeps meaning "previews": a phone on an older bundle opens the
2624
2683
  * preview layout for any `options`, and must see exactly what it did. */
2625
- choices: z9.array(OptionSchema).optional(),
2684
+ choices: z10.array(OptionSchema).optional(),
2626
2685
  /** HOW MANY MAY BE PICKED, beside its `choices`: one, any (`many`) or an order (`rank`). */
2627
- select: z9.enum(["one", "many", "rank"]).optional()
2686
+ select: z10.enum(["one", "many", "rank"]).optional()
2628
2687
  })).optional(),
2629
- visuals: z9.array(VisualSchema).optional(),
2688
+ visuals: z10.array(VisualSchema).optional(),
2630
2689
  /** The connected agent's name (the single pairing name — user-typed, or the
2631
2690
  * agent's suggestion, or a default silly name). */
2632
- name: z9.string(),
2691
+ name: z10.string(),
2633
2692
  /** The pairing's assigned voice (#462); absent = the default voice. */
2634
2693
  voice: VoiceKeySchema.optional(),
2635
- repo: z9.string().optional(),
2636
- branch: z9.string().optional(),
2637
- createdAt: z9.string().datetime(),
2638
- snoozedUntil: z9.string().datetime().optional(),
2694
+ repo: z10.string().optional(),
2695
+ branch: z10.string().optional(),
2696
+ createdAt: z10.string().datetime(),
2697
+ snoozedUntil: z10.string().datetime().optional(),
2639
2698
  agentState: AgentStateSchema.default("idle"),
2640
2699
  /** Whose action the item is waiting on: "you" = an agent asked you (the default,
2641
2700
  * every agent→user notification); "agent" = you sent a request and it's awaiting the
2642
2701
  * agent (held in the inbox until the agent replies on the thread). */
2643
- turn: z9.enum(["you", "agent"]).default("you"),
2702
+ turn: z10.enum(["you", "agent"]).default("you"),
2644
2703
  /** Hard error reason on an awaiting request (turn="agent") — the wake failed to reach
2645
2704
  * the agent (provider-agnostic; set server-side). Absent = no hard error. Drives the inbox
2646
2705
  * error badge + Retry. */
2647
- error: z9.string().optional(),
2706
+ error: z10.string().optional(),
2648
2707
  /** WHEN THIS AGENT WORK WENT QUIET (turn="agent"), by the one rule (`coldSince`: three days
2649
2708
  * with nothing said), or absent while it is not stalled. The inbox's stalled badge reads
2650
2709
  * this and nothing else (2026-09-23: a 3-minute age rule badged every live Goal stalled,
2651
2710
  * and "dismiss the stalled ones" cancelled 37 pieces of live work). */
2652
- cold: z9.string().datetime().optional(),
2653
- clarifies: z9.string().optional(),
2711
+ cold: z10.string().datetime().optional(),
2712
+ clarifies: z10.string().optional(),
2654
2713
  /** THIS CARD'S QUESTION IS ON A LIVE CALL (owner, 2026-09-24: "Mark it while the call is
2655
2714
  * live"). Present only while an open Call Delivery carries the card's request Entry — read
2656
2715
  * off the same open list the card came from, so it clears when the Call does. A card is the
2657
2716
  * backup for a call not taken; while the call has it, the call is where it is answered. */
2658
- onCall: z9.literal(true).optional(),
2717
+ onCall: z10.literal(true).optional(),
2659
2718
  /** THE RING, ON THE ITEM (docs/clients/app/walk/design.md §12 §17, #2251): the last ring on this card was
2660
2719
  * declined, and what the ladder will do next — read off the cron's own row, never computed
2661
2720
  * on the phone. Present only while a `declined` receipt stands on the card's last Call.
@@ -2665,31 +2724,31 @@ var InboxItemSchema = z9.object({
2665
2724
  * It replaced `gaveUp` (deleted 2026-09-22): "the ladder spent" was a boolean the projection
2666
2725
  * never set, and it is `nextRingAt === null` here — the party's *Missed you* (`party/dress.ts`)
2667
2726
  * and the roster's `unreached` read `declinedAt`, and stand while it does. */
2668
- ring: z9.object({
2669
- declinedAt: z9.string().datetime(),
2670
- anchorAt: z9.string().datetime(),
2671
- nextRingAt: z9.string().datetime().nullable(),
2672
- step: z9.number().int()
2727
+ ring: z10.object({
2728
+ declinedAt: z10.string().datetime(),
2729
+ anchorAt: z10.string().datetime(),
2730
+ nextRingAt: z10.string().datetime().nullable(),
2731
+ step: z10.number().int()
2673
2732
  }).optional(),
2674
2733
  /** Why this arrived the way it did, read back off the delivery receipt (`notify/why.ts`).
2675
2734
  * Absent for anything never delivered through a push, and for older rows written before
2676
2735
  * the reason was recorded. Deliberately a debug affordance, shown small (owner,
2677
2736
  * 2026-08-07) — its real job is to give "this didn't need a call" something to be
2678
2737
  * feedback ABOUT. */
2679
- why: z9.object({
2738
+ why: z10.object({
2680
2739
  asked: NotifyLevelSchema,
2681
2740
  got: NotifyLevelSchema,
2682
- because: z9.enum(["unresponsive", "dismissed", "not_permitted", "silent", "coalesced", "agent_capped", "unplanned", "learned_raise"]).optional(),
2683
- line: z9.string()
2741
+ because: z10.enum(["unresponsive", "dismissed", "not_permitted", "silent", "coalesced", "agent_capped", "unplanned", "learned_raise"]).optional(),
2742
+ line: z10.string()
2684
2743
  }).optional(),
2685
- select: z9.enum(["one", "many", "rank", "confirm", "text"]).default("one"),
2686
- confirmStyle: z9.enum(["yesno", "approve"]).default("yesno").describe(
2744
+ select: z10.enum(["one", "many", "rank", "confirm", "text"]).default("one"),
2745
+ confirmStyle: z10.enum(["yesno", "approve"]).default("yesno").describe(
2687
2746
  "Labels for a select:'confirm' paige \u2014 'yesno' (Yes/No) or 'approve' (Approve/Deny). Ignored unless select is 'confirm'."
2688
2747
  ),
2689
2748
  /** Real downstream work is stuck behind this one — set by the agent, independent of
2690
2749
  * urgency (see the main README's "premier use case" + docs/delivery/notify/states.md). Drives the
2691
2750
  * inbox's blocking badge and the extra confirm step before dismissing it. */
2692
- blocking: z9.boolean().default(false),
2751
+ blocking: z10.boolean().default(false),
2693
2752
  /** The user's locked-in answer; present only for replied items (GET /api/replied/:id). */
2694
2753
  answer: UserAnswerSchema.optional(),
2695
2754
  /** THE TARGET FACTS A CARD RENDERS (#1796 point 5, 2026-09-11): the Delivery it is a view of,
@@ -2697,17 +2756,17 @@ var InboxItemSchema = z9.object({
2697
2756
  * for a request that asks nothing), whether its content is sealed, and that Goal's state. The
2698
2757
  * answer writer (`POST /api/entries`) and the disposition (`close_delivery`) take their ids from
2699
2758
  * here. The server projects it (`apps/api/src/inbox/project.ts`); a client never builds it. */
2700
- communication: z9.object({
2701
- deliveryId: z9.string(),
2702
- kind: z9.enum(["notification", "call"]),
2703
- entryId: z9.string(),
2704
- goalIds: z9.array(z9.string()),
2705
- decisionNeedId: z9.string().optional(),
2706
- sealed: z9.boolean(),
2707
- goalState: z9.string().optional(),
2759
+ communication: z10.object({
2760
+ deliveryId: z10.string(),
2761
+ kind: z10.enum(["notification", "call"]),
2762
+ entryId: z10.string(),
2763
+ goalIds: z10.array(z10.string()),
2764
+ decisionNeedId: z10.string().optional(),
2765
+ sealed: z10.boolean(),
2766
+ goalState: z10.string().optional(),
2708
2767
  /** THAT GOAL'S NAME (#2416) — what Activity's row is headed by, since a row there is one Goal
2709
2768
  * and the cards it holds sit behind it. Stamped by the same read as `goalState`. */
2710
- goalTitle: z9.string().optional()
2769
+ goalTitle: z10.string().optional()
2711
2770
  }).optional(),
2712
2771
  /** WHAT THIS CARD IS, IN TWELVE CHARACTERS (#3019) — the hash of every other field on it, stamped
2713
2772
  * by the one read that serves the open list (`apps/api/src/inbox/project.ts` `inboxFor`). It is
@@ -2719,27 +2778,27 @@ var InboxItemSchema = z9.object({
2719
2778
  * own moves (its Goal's state and name, how cold the work behind it has gone, whether a ring is
2720
2779
  * live). Optional, so a fixture, the demo and the archive lens need not spell one, and a card
2721
2780
  * with no rev is simply always re-sent. */
2722
- rev: z9.string().optional()
2781
+ rev: z10.string().optional()
2723
2782
  });
2724
2783
  var APNS_TOKEN_RE = /^[0-9a-fA-F]{64}$/;
2725
- var PushTokenSchema = z9.object({
2726
- voipToken: z9.string().min(1).optional(),
2727
- alertToken: z9.string().min(1).optional(),
2728
- fcmToken: z9.string().min(1).optional(),
2729
- platform: z9.enum(["ios", "android"])
2784
+ var PushTokenSchema = z10.object({
2785
+ voipToken: z10.string().min(1).optional(),
2786
+ alertToken: z10.string().min(1).optional(),
2787
+ fcmToken: z10.string().min(1).optional(),
2788
+ platform: z10.enum(["ios", "android"])
2730
2789
  }).superRefine((v, ctx) => {
2731
2790
  if (v.platform !== "ios") return;
2732
2791
  for (const field of ["voipToken", "alertToken"]) {
2733
2792
  const token = v[field];
2734
2793
  if (token === void 0 || APNS_TOKEN_RE.test(token)) continue;
2735
2794
  ctx.addIssue({
2736
- code: z9.ZodIssueCode.custom,
2795
+ code: z10.ZodIssueCode.custom,
2737
2796
  path: [field],
2738
2797
  message: `not an APNs device token (want 64 hex chars, got ${token.length})`
2739
2798
  });
2740
2799
  }
2741
2800
  });
2742
- var MissedCallSchema = z9.enum([
2801
+ var MissedCallSchema = z10.enum([
2743
2802
  "retry_10m",
2744
2803
  "retry_30m",
2745
2804
  "retry_60m",
@@ -2749,33 +2808,33 @@ var MissedCallSchema = z9.enum([
2749
2808
  "inbox",
2750
2809
  "dismiss"
2751
2810
  ]);
2752
- var clock = (h) => h === 0 ? "midnight" : h === 12 ? "noon" : h < 12 ? `${h} am` : `${h - 12} pm`;
2753
- var QUIET = ` Nothing rings from ${clock(NIGHT.from)} to ${clock(NIGHT.to)} your time; the count waits for morning.`;
2754
- var BrokerTuningSchema = z9.object({
2811
+ var clock2 = (h) => h === 0 ? "midnight" : h === 12 ? "noon" : h < 12 ? `${h} am` : `${h - 12} pm`;
2812
+ var QUIET = ` Nothing rings from ${clock2(NIGHT.from)} to ${clock2(NIGHT.to)} your time; the count waits for morning.`;
2813
+ var BrokerTuningSchema = z10.object({
2755
2814
  /** 'none' = skip the spoken ack after a mapped answer (power users find it slow). */
2756
- ackVerbosity: z9.enum(["normal", "none"]).optional(),
2815
+ ackVerbosity: z10.enum(["normal", "none"]).optional(),
2757
2816
  /** How readily the mapper asks its one clarification: 'low' = only when truly
2758
2817
  * uninterpretable, 'high' = whenever not fully certain. */
2759
- clarifyEagerness: z9.enum(["low", "normal", "high"]).optional(),
2818
+ clarifyEagerness: z10.enum(["low", "normal", "high"]).optional(),
2760
2819
  /** The user's own shorthand: when they say `say`, they mean `mean`. */
2761
- phrasebook: z9.array(z9.object({ say: z9.string().min(1).max(60), mean: z9.string().min(1).max(120) })).max(24).optional(),
2820
+ phrasebook: z10.array(z10.object({ say: z10.string().min(1).max(60), mean: z10.string().min(1).max(120) })).max(24).optional(),
2762
2821
  /** The language calls are PLANNED in, when the account has chosen one (#1272). Absent —
2763
2822
  * which is every account today — means the agent's own words decide, per ask: a call
2764
2823
  * about an English ask opens in English. This is the only thing that overrides that,
2765
2824
  * and a live caller who switches language mid-call still outranks it (broker/lang.ts).
2766
2825
  * Set per user (no UI yet), like `voiceTuning`. */
2767
- language: z9.enum(["en", "es"]).optional()
2826
+ language: z10.enum(["en", "es"]).optional()
2768
2827
  });
2769
- var UserSettingsSchema = z9.object({
2770
- permissions: z9.object({
2771
- call: z9.boolean(),
2772
- banner: z9.boolean(),
2773
- push: z9.boolean()
2828
+ var UserSettingsSchema = z10.object({
2829
+ permissions: z10.object({
2830
+ call: z10.boolean(),
2831
+ banner: z10.boolean(),
2832
+ push: z10.boolean()
2774
2833
  }),
2775
2834
  /** LockedIn / Default / DateNight on screen; the stored words are unchanged on purpose —
2776
2835
  * they are an enum on a live column across every account, and the rename is a rename of
2777
2836
  * what people read (owner, 2026-09-30). */
2778
- sessionMode: z9.enum(["default", "all_calls", "silent"]),
2837
+ sessionMode: z10.enum(["default", "all_calls", "silent"]),
2779
2838
  /** `silentPush` lived here until #2813 and is now GONE, field and column both. It was kept as an
2780
2839
  * optional long after DateNight stopped reading it, on the theory that a phone on an older
2781
2840
  * bundle PATCHing the whole settings object would be REFUSED for sending a key we had stopped
@@ -2784,7 +2843,7 @@ var UserSettingsSchema = z9.object({
2784
2843
  * an old bundle's `silentPush` is accepted and ignored. Worth remembering before keeping the
2785
2844
  * next dead field for the same reason. */
2786
2845
  /** Opt-in (default false) to using your content to improve Paigy and train models. */
2787
- improveConsent: z9.boolean(),
2846
+ improveConsent: z10.boolean(),
2788
2847
  missedCall: MissedCallSchema.default("backoff_standard"),
2789
2848
  /** Where voice audio is processed. 'hosted' (default) = Paigy's voice services
2790
2849
  * (ElevenLabs TTS, faster-whisper STT, the call bot); 'on_device' = the phone
@@ -2792,17 +2851,17 @@ var UserSettingsSchema = z9.object({
2792
2851
  * Optional, NOT defaulted: a stale client PATCHing the full settings object
2793
2852
  * must not silently reset this privacy choice. Absent = leave unchanged on
2794
2853
  * write, 'hosted' on read (see store.ts). */
2795
- voiceMode: z9.enum(["hosted", "on_device"]).optional(),
2854
+ voiceMode: z10.enum(["hosted", "on_device"]).optional(),
2796
2855
  /** Talk — after you answer, the next step is read aloud (docs/clients/app/walk/design.md §6). ALWAYS ON until
2797
2856
  * turned off (owner, 2026-09-18, #2249): a setting, not a per-walk toggle. Optional, NOT
2798
2857
  * defaulted, for the same reason `voiceMode` is: a stale client PATCHing the full settings
2799
2858
  * object must not silently turn it back on. Absent = leave unchanged on write, true on
2800
2859
  * read (see store.ts). */
2801
- talk: z9.boolean().optional(),
2860
+ talk: z10.boolean().optional(),
2802
2861
  /** CALL DIAGNOSTICS (owner, 2026-10-01): the call report carries each listen and the bot's own
2803
2862
  * load timings. SERVER-SET, no UI — on for every account that existed on 2026-10-01, off for
2804
2863
  * newer ones (migration 20261001132859). Read-only here: the settings PATCH never writes it. */
2805
- callDiagnostics: z9.boolean().optional(),
2864
+ callDiagnostics: z10.boolean().optional(),
2806
2865
  /** Per-user ring budget (#603): calls per rolling day before further calls
2807
2866
  * degrade to banner. Absent = the global default (25). A number, never a
2808
2867
  * bypass — every account keeps a ceiling. No UI; set per user for testing. */
@@ -2810,7 +2869,7 @@ var UserSettingsSchema = z9.object({
2810
2869
  * payload['tuning'] (e.g. { silence_s: 3.5 } — a longer pause window for a
2811
2870
  * slower speaker). No API-side semantics; the bot resolves each key with its
2812
2871
  * own defaults. Set per user (no UI yet); absent = bot defaults. */
2813
- voiceTuning: z9.record(z9.string(), z9.union([z9.number(), z9.string()])).optional(),
2872
+ voiceTuning: z10.record(z10.string(), z10.union([z10.number(), z10.string()])).optional(),
2814
2873
  /** The user's IANA timezone (e.g. "America/Bogota"), recorded by the app — it is the
2815
2874
  * only party that knows it. REMINDERS are why it exists: "remind me at ten" becomes
2816
2875
  * an absolute `due_at` only if we know whose ten. Optional and never defaulted, for
@@ -2819,53 +2878,53 @@ var UserSettingsSchema = z9.object({
2819
2878
  * that failure reads as the reminder rail being unreliable rather than as a missing
2820
2879
  * setting. Absent = a spoken time can't be landed, so the reminder rides the next
2821
2880
  * call — honest about what we know. */
2822
- timezone: z9.string().min(1).max(64).optional(),
2881
+ timezone: z10.string().min(1).max(64).optional(),
2823
2882
  /** Rung-2 broker tuning (#381). Optional and NOT defaulted, same stale-client
2824
2883
  * clobber guard as voiceMode: absent = leave unchanged on write. */
2825
2884
  broker: BrokerTuningSchema.optional()
2826
2885
  });
2827
- var HistoryWorkSchema = z9.object({
2828
- id: z9.string(),
2829
- title: z9.string(),
2830
- state: z9.enum(["done", "cancelled"]),
2886
+ var HistoryWorkSchema = z10.object({
2887
+ id: z10.string(),
2888
+ title: z10.string(),
2889
+ state: z10.enum(["done", "cancelled"]),
2831
2890
  /** Who held it (`agent:<tokenId>` or `human:<userId>`). */
2832
- assignee: z9.string()
2891
+ assignee: z10.string()
2833
2892
  });
2834
- var HistoryEntrySchema = z9.union([
2835
- z9.object({ at: z9.string(), card: InboxItemSchema }),
2836
- z9.object({ at: z9.string(), work: HistoryWorkSchema })
2893
+ var HistoryEntrySchema = z10.union([
2894
+ z10.object({ at: z10.string(), card: InboxItemSchema }),
2895
+ z10.object({ at: z10.string(), work: HistoryWorkSchema })
2837
2896
  ]);
2838
- var HistoryPageSchema = z9.object({
2839
- entries: z9.array(HistoryEntrySchema),
2840
- next: z9.string().nullable()
2897
+ var HistoryPageSchema = z10.object({
2898
+ entries: z10.array(HistoryEntrySchema),
2899
+ next: z10.string().nullable()
2841
2900
  });
2842
2901
  var ACTIVITY_LINES = 2;
2843
2902
  var ACTIVITY_LINE_MAX = 80;
2844
- var AgentActivitySchema = z9.object({
2903
+ var AgentActivitySchema = z10.object({
2845
2904
  /** Oldest first, so the newest line is last — the one that replaces in place. */
2846
- lines: z9.array(z9.string().max(ACTIVITY_LINE_MAX)).max(ACTIVITY_LINES),
2905
+ lines: z10.array(z10.string().max(ACTIVITY_LINE_MAX)).max(ACTIVITY_LINES),
2847
2906
  /** When the harness observed this tail. Its own timestamp, not the heartbeat's: a beat
2848
2907
  * that carries an UNCHANGED tail must not make a stalled agent look like it just moved. */
2849
- at: z9.string().datetime()
2908
+ at: z10.string().datetime()
2850
2909
  });
2851
- var ConnectionSummarySchema = z9.object({
2910
+ var ConnectionSummarySchema = z10.object({
2852
2911
  /** The connection = the agent's token id (used to address a request). */
2853
- id: z9.string(),
2912
+ id: z10.string(),
2854
2913
  /** The credential kind: "device" = a paired machine (mint-only — it hosts and mints, it
2855
2914
  * never talks); "agent" = an identity that sends. The roster and devices surfaces split
2856
2915
  * on this. Optional/absent reads as "agent" (a row predating the kind column). See
2857
2916
  * docs/server/tokens/devices-vs-agents-design.md. */
2858
- kind: z9.enum(["device", "agent"]).optional(),
2917
+ kind: z10.enum(["device", "agent"]).optional(),
2859
2918
  /** For an agent, the token id of the DEVICE that minted it — so agents group under their
2860
2919
  * machine, and revoking a device cascades to them. Null on devices, and on unlinked
2861
2920
  * agents (phone-launched, provider-managed, or minted before the link existed). */
2862
- mintedByDevice: z9.string().nullable().optional(),
2863
- device: z9.string().nullable(),
2921
+ mintedByDevice: z10.string().nullable().optional(),
2922
+ device: z10.string().nullable(),
2864
2923
  /** The agent's display name (the single pairing name). */
2865
- name: z9.string(),
2924
+ name: z10.string(),
2866
2925
  /** For a managed connection, the provider key (e.g. "cma") that agentOrigin maps to a
2867
2926
  * label; null for a local connection. Sourced from the token's provider, not the name. */
2868
- provider: z9.string().nullable(),
2927
+ provider: z10.string().nullable(),
2869
2928
  /** The pairing's assigned voice (#462); null = the default voice. */
2870
2929
  voice: VoiceKeySchema.nullable(),
2871
2930
  /** The LOUDEST this agent may ever reach you — a ceiling on `NOTIFY_LADDER`, set by the
@@ -2876,34 +2935,34 @@ var ConnectionSummarySchema = z9.object({
2876
2935
  * every surface at once and outranks even `sessionMode: all_calls` — a mode the user
2877
2936
  * set once must not overrule a rule they set about one agent. */
2878
2937
  reach: NotifyLevelSchema.nullable().optional(),
2879
- createdAt: z9.string().datetime(),
2938
+ createdAt: z10.string().datetime(),
2880
2939
  /** Most recent notification on this connection, either direction. Null = no contact yet.
2881
2940
  * Drives the agents-page recency grouping (Today / This week / …). */
2882
- lastContactAt: z9.string().datetime().nullable(),
2941
+ lastContactAt: z10.string().datetime().nullable(),
2883
2942
  /** Last presence heartbeat from a running agent process (POST /api/presence) — the
2884
2943
  * desktop app while open. Null = never seen; stale = offline. */
2885
- lastSeenAt: z9.string().datetime().nullable().optional(),
2944
+ lastSeenAt: z10.string().datetime().nullable().optional(),
2886
2945
  /** WORKING, NOT JUST CONNECTED (owner, 2026-09-30): the last time the agent itself acted on one of
2887
2946
  * its Goals — wrote on one or recorded an operation (`tokens.last_worked_at`). Within
2888
2947
  * `WORKING_MS` it is working; otherwise it is connected but idle. Null = not seen working yet. */
2889
- lastWorkedAt: z9.string().datetime().nullable().optional(),
2948
+ lastWorkedAt: z10.string().datetime().nullable().optional(),
2890
2949
  /** The oldest of its Goals that is `ready` for it — work handed to it that nobody has started.
2891
2950
  * With no work of its own for `WORKING_MS`, an agent sitting on this is not taking its work. */
2892
- oldestReadyAt: z9.string().datetime().nullable().optional(),
2951
+ oldestReadyAt: z10.string().datetime().nullable().optional(),
2893
2952
  /** What a live desktop can run (docs/clients/desktop/companion.md §2.2), advertised on its heartbeat:
2894
2953
  * harness availabilities + granted workspaces — the option set the phone's
2895
2954
  * "new session" sheet offers. Absent for ordinary MCP agents. */
2896
- runtime: z9.object({
2955
+ runtime: z10.object({
2897
2956
  /** The @paigy/harness this host is running — a machine the self-update has not reached
2898
2957
  * shows its age here (`apps/desktop/src/update.ts`). */
2899
- version: z9.string().optional(),
2900
- harnesses: z9.array(z9.object({ name: z9.string(), label: z9.string(), status: z9.string() })).optional(),
2901
- workspaces: z9.array(z9.string()).optional(),
2958
+ version: z10.string().optional(),
2959
+ harnesses: z10.array(z10.object({ name: z10.string(), label: z10.string(), status: z10.string() })).optional(),
2960
+ workspaces: z10.array(z10.string()).optional(),
2902
2961
  /** THE GIT REPOS IN THOSE FOLDERS (2026-10-01, Goal 26982211): each granted folder that is a
2903
2962
  * repo, and each repo directly inside one, with its `origin` remote. A session started for
2904
2963
  * work on `mauurda/paigy` opens in that repo rather than the folder above it, where the repo's
2905
2964
  * own AGENTS.md is never read (`workspaceForRepo`). Absent on hosts that predate it. */
2906
- repos: z9.array(z9.object({ path: z9.string(), remote: z9.string() })).optional()
2965
+ repos: z10.array(z10.object({ path: z10.string(), remote: z10.string() })).optional()
2907
2966
  }).optional(),
2908
2967
  /** The tail of this agent's working log, when a harness is driving it — the agent page's
2909
2968
  * live strip. Absent for anything the desktop harness isn't running (a hatched identity
@@ -2912,160 +2971,166 @@ var ConnectionSummarySchema = z9.object({
2912
2971
  activity: AgentActivitySchema.optional(),
2913
2972
  /** True = a provider-managed agent running in the provider's cloud (e.g. Anthropic CMA);
2914
2973
  * false = a local MCP connection running on the user's computer (Claude Code/Codex/…). */
2915
- managed: z9.boolean()
2974
+ managed: z10.boolean()
2916
2975
  });
2917
- var LedgerItemSchema = z9.object({ id: z9.string(), parentId: z9.string(), title: z9.string(), createdAt: z9.string() });
2918
- var AgentLedgerSchema = z9.object({
2976
+ var LedgerItemSchema = z10.object({ id: z10.string(), parentId: z10.string(), title: z10.string(), createdAt: z10.string() });
2977
+ var AgentLedgerSchema = z10.object({
2919
2978
  /** Null when the agent has not named itself yet — never a placeholder (owner, 2026-10-01). */
2920
- agent: z9.object({ id: z9.string(), name: z9.string().nullable(), revokedAt: z9.string().nullable() }),
2979
+ agent: z10.object({ id: z10.string(), name: z10.string().nullable(), revokedAt: z10.string().nullable() }),
2921
2980
  /** Its own questions you have not answered. */
2922
- asks: z9.array(LedgerItemSchema),
2981
+ asks: z10.array(LedgerItemSchema),
2923
2982
  /** Its questions you answered that nobody acted on — still owed to somebody. */
2924
- answered: z9.array(LedgerItemSchema),
2983
+ answered: z10.array(LedgerItemSchema),
2925
2984
  /** Requests you sent it that it never took. */
2926
- requests: z9.array(LedgerItemSchema),
2927
- goals: z9.array(z9.object({ id: z9.string(), outcome: z9.string(), state: z9.string() })),
2928
- callbacks: z9.array(z9.object({ id: z9.string(), parentId: z9.string(), trigger: z9.string(), note: z9.string(), dueAt: z9.string().nullable() }))
2985
+ requests: z10.array(LedgerItemSchema),
2986
+ goals: z10.array(z10.object({ id: z10.string(), outcome: z10.string(), state: z10.string() })),
2987
+ callbacks: z10.array(z10.object({ id: z10.string(), parentId: z10.string(), trigger: z10.string(), note: z10.string(), dueAt: z10.string().nullable() }))
2929
2988
  });
2930
- var ReassignResultSchema = z9.object({
2931
- moved: z9.object({ asks: z9.number(), answered: z9.number(), requests: z9.number(), goals: z9.number(), callbacks: z9.number() }),
2932
- parentId: z9.string().nullable()
2989
+ var ReassignResultSchema = z10.object({
2990
+ moved: z10.object({ asks: z10.number(), answered: z10.number(), requests: z10.number(), goals: z10.number(), callbacks: z10.number() }),
2991
+ parentId: z10.string().nullable()
2933
2992
  });
2934
- var LessonStateSchema = z9.enum(["active", "proposed", "retired"]);
2935
- var LessonViewSchema = z9.object({
2936
- id: z9.string(),
2937
- text: z9.string(),
2993
+ var LessonStateSchema = z10.enum(["active", "proposed", "retired"]);
2994
+ var LessonViewSchema = z10.object({
2995
+ id: z10.string(),
2996
+ text: z10.string(),
2938
2997
  state: LessonStateSchema,
2939
2998
  /** The Goal it is scoped to; null = the whole account. */
2940
- scopeGoalId: z9.string().nullable(),
2941
- goalTitle: z9.string().nullable(),
2942
- version: z9.number(),
2943
- pinned: z9.boolean(),
2999
+ scopeGoalId: z10.string().nullable(),
3000
+ goalTitle: z10.string().nullable(),
3001
+ version: z10.number(),
3002
+ pinned: z10.boolean(),
2944
3003
  /** When the person last wrote its text themselves. */
2945
- editedAt: z9.string().nullable(),
2946
- createdAt: z9.string(),
2947
- updatedAt: z9.string(),
3004
+ editedAt: z10.string().nullable(),
3005
+ createdAt: z10.string(),
3006
+ updatedAt: z10.string(),
2948
3007
  /** The Entries it came from, oldest first; `words` is null when an Entry has none to show (sealed). */
2949
- sources: z9.array(z9.object({ entryId: z9.string(), words: z9.string().nullable(), at: z9.string() }))
3008
+ sources: z10.array(z10.object({ entryId: z10.string(), words: z10.string().nullable(), at: z10.string() }))
2950
3009
  });
2951
- var QueueQuestionSchema = z9.object({
3010
+ var QueueQuestionSchema = z10.object({
2952
3011
  /** The decision need's id — what an answer is accepted against. */
2953
- id: z9.string(),
3012
+ id: z10.string(),
2954
3013
  /** The words that were asked, from the request Entry that asked them. */
2955
- question: z9.string(),
3014
+ question: z10.string(),
2956
3015
  /** Where it was asked — which is where the ruling goes (`POST /api/entries`). Null only
2957
3016
  * for a need whose request Entry is carried by no interactive Delivery, which nothing
2958
3017
  * can answer. */
2959
- deliveryId: z9.string().nullable().default(null),
3018
+ deliveryId: z10.string().nullable().default(null),
2960
3019
  /** The Entry the ruling is about. */
2961
- aboutId: z9.string().nullable().default(null),
3020
+ aboutId: z10.string().nullable().default(null),
2962
3021
  /** Empty for a free-text question. */
2963
- options: z9.array(OptionSchema).default([]),
2964
- select: z9.enum(["one", "many", "rank", "confirm", "text"]).default("text"),
2965
- askedAt: z9.string(),
3022
+ options: z10.array(OptionSchema).default([]),
3023
+ select: z10.enum(["one", "many", "rank", "confirm", "text"]).default("text"),
3024
+ askedAt: z10.string(),
2966
3025
  /** Null while the question is open — which is how the page tells the two apart. */
2967
- answeredAt: z9.string().nullable().default(null),
3026
+ answeredAt: z10.string().nullable().default(null),
2968
3027
  /** The ruling in the person's own words, from the contribution that replied — not the
2969
3028
  * option id, which is not something anyone reads back. Null while it is open, and null
2970
3029
  * for a settled question whose reply carried nothing readable. */
2971
- answer: z9.string().nullable().default(null),
3030
+ answer: z10.string().nullable().default(null),
2972
3031
  /** The Goal this question belongs to — a step knows its Goal on its own, not only through
2973
3032
  * an `InboxItem`'s `communication.goalIds[0]` (docs/clients/app/walk/design.md §12 item 3).
2974
3033
  * READ BY `apps/client/src/walk/order.ts`, which stamps it onto every `WalkStep`: the walk's
2975
3034
  * order, its route, home's trees and the list of steps all take a step's Goal from here, so
2976
3035
  * this is the field they agree through rather than each re-deriving it from the row it
2977
3036
  * arrived under. Required because the API projects it on every need it sends. */
2978
- goalId: z9.string(),
3037
+ goalId: z10.string(),
2979
3038
  /** True only while an unmet START gate holds the Goal — a Goal that merely waits to
2980
3039
  * *finish* does not stop a person from answering (owner, 2026-09-16: "per need gate from
2981
3040
  * the API"; §4's dashed node). Not the same fact as `QueueItem.blocked`, which counts any
2982
3041
  * gate at all. */
2983
- blocked: z9.boolean().default(false)
3042
+ blocked: z10.boolean().default(false)
2984
3043
  });
2985
- var QueueReplySchema = z9.object({
3044
+ var QueueReplySchema = z10.object({
2986
3045
  /** The card this note was (`deliveryId:requestEntryId`, minted by the server like every card
2987
3046
  * id) — so the phone can tell a reply it just sent from one the queue already carries, and the
2988
3047
  * walk can name it in its zoom. */
2989
- id: z9.string(),
3048
+ id: z10.string(),
2990
3049
  /** The Goal the note is on. */
2991
- goalId: z9.string(),
3050
+ goalId: z10.string(),
2992
3051
  /** What the note said. */
2993
- note: z9.string(),
3052
+ note: z10.string(),
2994
3053
  /** Where it was carried — where a second reply goes (`POST /api/entries`, #2252). */
2995
- deliveryId: z9.string(),
2996
- requestEntryId: z9.string(),
2997
- askedAt: z9.string(),
3054
+ deliveryId: z10.string(),
3055
+ requestEntryId: z10.string(),
3056
+ askedAt: z10.string(),
2998
3057
  /** When the person last replied — the window's start. */
2999
- repliedAt: z9.string(),
3058
+ repliedAt: z10.string(),
3000
3059
  /** The person's latest words about it; null when there is nothing readable in them. */
3001
- reply: z9.string().nullable()
3060
+ reply: z10.string().nullable()
3002
3061
  });
3003
- var QueueItemSchema = z9.object({
3004
- id: z9.string(),
3062
+ var QueueItemSchema = z10.object({
3063
+ id: z10.string(),
3005
3064
  /** One-line headline — the first sentence of the outcome. */
3006
- title: z9.string(),
3065
+ title: z10.string(),
3007
3066
  /** The outcome in full, verbatim: the person's own words are what an assignee sees. */
3008
- intent: z9.string(),
3067
+ intent: z10.string(),
3009
3068
  /** `ready` | `active` | `waiting` | `done` | `cancelled`, straight off the Goal. */
3010
- state: z9.string(),
3069
+ state: z10.string(),
3011
3070
  /** Who holds it (a participant ref); null when nobody does yet. */
3012
- assignee: z9.string().nullable().default(null),
3071
+ assignee: z10.string().nullable().default(null),
3013
3072
  /** What the agent last said it was doing; null if it has said nothing. */
3014
- progress: z9.string().nullable().default(null),
3073
+ progress: z10.string().nullable().default(null),
3015
3074
  /** HOME'S LINE FOR THAT NOTE (owner, 2026-09-23): a few plain words one read wrote from `progress`,
3016
3075
  * served only while it was written for the current note. Null means show the Goal's name. */
3017
- progressLine: z9.string().nullable().optional(),
3018
- reviewPending: z9.boolean().default(false),
3019
- dueAt: z9.string().nullable().default(null),
3076
+ progressLine: z10.string().nullable().optional(),
3077
+ reviewPending: z10.boolean().default(false),
3078
+ dueAt: z10.string().nullable().default(null),
3020
3079
  /** WHEN ITS OWNER SAID DONE WHILE CHILDREN WERE OPEN (#2704): its own work is finished and it closes
3021
3080
  * with its last open child. Null otherwise; optional, so hand-built queues need not spell it. */
3022
- finishedAt: z9.string().nullable().optional(),
3081
+ finishedAt: z10.string().nullable().optional(),
3023
3082
  /** The Goal this one was opened under; null at the root. */
3024
- parentGoalId: z9.string().nullable().default(null),
3083
+ parentGoalId: z10.string().nullable().default(null),
3025
3084
  /** Goals opened under this one — only those the same list holds. */
3026
- childGoalIds: z9.array(z9.string()).default([]),
3085
+ childGoalIds: z10.array(z10.string()).default([]),
3027
3086
  /** Goals this one waits on (start or finish gates). */
3028
- dependencyGoalIds: z9.array(z9.string()).default([]),
3087
+ dependencyGoalIds: z10.array(z10.string()).default([]),
3029
3088
  /** True while any gate is on a Goal that is not done — the walk draws it dashed. */
3030
- blocked: z9.boolean().default(false),
3089
+ blocked: z10.boolean().default(false),
3031
3090
  /** Its questions: every OPEN one, and at most ten settled, newest settled first
3032
3091
  * (20260929133308) — the page decides which of them to show. NOT the whole set: `asked` and
3033
3092
  * `answered` are, and a settled one's words are a line (280 characters), its body read when the
3034
3093
  * question is opened. */
3035
- questions: z9.array(QueueQuestionSchema).default([]),
3094
+ questions: z10.array(QueueQuestionSchema).default([]),
3036
3095
  /** HOW MANY QUESTIONS THIS WORK HAS ASKED, and how many are answered — the Goal's own totals,
3037
3096
  * bounded at 100 server-side. A tally counted off `questions` is a wrong number that looks
3038
3097
  * right once the cap bites (`walk/trees.ts` `tallyOf`). Optional, and defaulted from the array
3039
3098
  * by the projection, so hand-built queues (fixtures, the demo) need not spell them. */
3040
- asked: z9.number().optional(),
3041
- answered: z9.number().optional(),
3099
+ asked: z10.number().optional(),
3100
+ answered: z10.number().optional(),
3042
3101
  /** Every note on it the person replied to (`QueueReplySchema`) — the page decides which to show.
3043
3102
  * Optional, not defaulted: absent is none, and every hand-built queue (fixtures, the demo) need
3044
3103
  * not spell an empty list. */
3045
- replies: z9.array(QueueReplySchema).optional(),
3104
+ replies: z10.array(QueueReplySchema).optional(),
3046
3105
  /** The repository or project identifier this Goal belongs to (#2280), null if untracked. */
3047
- repo: z9.string().nullable().optional(),
3048
- createdAt: z9.string(),
3049
- updatedAt: z9.string().nullable().default(null),
3106
+ repo: z10.string().nullable().optional(),
3107
+ createdAt: z10.string(),
3108
+ updatedAt: z10.string().nullable().default(null),
3050
3109
  /** When its owner last SAID something about it (the newest `progress` Entry: a contact update kept
3051
3110
  * as progress). `updatedAt` moves for reasons nobody chose — a
3052
3111
  * state recomputed, a review flag — so it cannot tell work in hand from work gone quiet. */
3053
- lastProgressAt: z9.string().nullable().optional(),
3112
+ lastProgressAt: z10.string().nullable().optional(),
3054
3113
  /** THE GOAL'S NEWEST WORD, FROM EITHER SIDE (owner, 2026-09-27): the newest Entry on it, of any
3055
3114
  * kind — what the person added ("Add to this"), their reply, the agent's ask or its progress
3056
3115
  * note. A progress note is an Entry, so this is already the newer of the two: the person's note
3057
3116
  * shows the moment it is written, and the agent's reply or next note replaces it by being newer.
3058
3117
  * `said` is bounded to 280 characters server-side (a line, not the conversation). Null when the
3059
3118
  * Goal carries no readable Entry; optional, so hand-built queues need not spell it. */
3060
- latest: z9.object({
3061
- from: z9.enum(["person", "agent"]),
3062
- said: z9.string(),
3063
- at: z9.string(),
3064
- entryId: z9.string(),
3119
+ latest: z10.object({
3120
+ from: z10.enum(["person", "agent"]),
3121
+ said: z10.string(),
3122
+ at: z10.string(),
3123
+ entryId: z10.string(),
3065
3124
  /** ITS SUMMARY IN AT MOST TEN WORDS (owner, 2026-10-08: "the same switch to the more summarized sources
3066
3125
  * at the work tab top level screen too"): what the talker or filer wrote on the Entry; absent when
3067
3126
  * none was. The Work row reads it before `said`. */
3068
- summary: z9.string().optional()
3127
+ summary: z10.string().optional(),
3128
+ /** AN AGENT'S UPDATE OR QUESTION AS ITS UNITS' TITLES (owner, 2026-10-08: "send the 50 chars from the title
3129
+ * of each unit"): each at most 50 characters, in order; absent when it has none. */
3130
+ titles: z10.array(z10.string()).optional(),
3131
+ /** A PROGRESS NOTE'S ONE POINT ("An agent's progress note -> maybe let's cap it at 200 chars"): the
3132
+ * update's own line, before its units; the row caps it at 200. Absent on anything else. */
3133
+ line: z10.string().optional()
3069
3134
  }).nullable().optional(),
3070
3135
  /** WHEN THIS PERSON LAST PUT A HAND ON IT THEMSELVES (owner, Paigy Goal 16d18f51, 2026-09-30):
3071
3136
  * the newest Entry on the Goal they wrote, of any kind — a line they added, a reply to a note, an
@@ -3078,7 +3143,7 @@ var QueueItemSchema = z9.object({
3078
3143
  * minute after the person speaks erases their instant from it, and the durable traces the client
3079
3144
  * can see (`replies`, `questions[].answeredAt`) miss a spontaneous note entirely — a `request`
3080
3145
  * Entry with no `about_id` is in neither. */
3081
- lastPersonAt: z9.string().nullable().optional(),
3146
+ lastPersonAt: z10.string().nullable().optional(),
3082
3147
  /** WHAT THIS ROW IS, IN TWELVE CHARACTERS (#2928) — the hash of every other field on it, stamped
3083
3148
  * by the one projection that builds the row (`apps/api/src/goal/queue.ts`). It is how the
3084
3149
  * incremental read knows a row has not moved: the phone echoes back the revs it holds
@@ -3089,40 +3154,40 @@ var QueueItemSchema = z9.object({
3089
3154
  * the row shows that no `updated_at` moves for (`active` lapsing, a dependency's state, a
3090
3155
  * sibling appearing in `childGoalIds`) cannot go unnoticed. Optional because a hand-built
3091
3156
  * queue (a fixture, the demo) spells none, and a row with no rev is simply always re-sent. */
3092
- rev: z9.string().optional()
3157
+ rev: z10.string().optional()
3093
3158
  });
3094
- var QueueDeltaSchema = z9.object({
3095
- ids: z9.array(z9.string()),
3096
- items: z9.array(QueueItemSchema)
3159
+ var QueueDeltaSchema = z10.object({
3160
+ ids: z10.array(z10.string()),
3161
+ items: z10.array(QueueItemSchema)
3097
3162
  });
3098
3163
  var COLD_AFTER_MS = 3 * 24 * 60 * 60 * 1e3;
3099
- var NoteSourceSchema = z9.enum(["app", "call"]);
3100
- var NoteStatusSchema = z9.enum(["open", "assigned", "in_progress", "done"]);
3101
- var NoteRepeatSchema = z9.enum(["once", "until_done"]);
3102
- var DecisionSchema = z9.object({
3103
- id: z9.string(),
3164
+ var NoteSourceSchema = z10.enum(["app", "call"]);
3165
+ var NoteStatusSchema = z10.enum(["open", "assigned", "in_progress", "done"]);
3166
+ var NoteRepeatSchema = z10.enum(["once", "until_done"]);
3167
+ var DecisionSchema = z10.object({
3168
+ id: z10.string(),
3104
3169
  /** The note this decision refines; null = recorded on a bare thread (the
3105
3170
  * extensibility seam — any conversation can accrue decisions). */
3106
- noteId: z9.string().nullable(),
3171
+ noteId: z10.string().nullable(),
3107
3172
  /** What was ambiguous — the broker's (or the user's own) question. */
3108
- question: z9.string(),
3173
+ question: z10.string(),
3109
3174
  /** The user's ruling; null while the question is open. */
3110
- answer: z9.string().nullable(),
3111
- decidedAt: z9.string().nullable(),
3112
- createdAt: z9.string()
3175
+ answer: z10.string().nullable(),
3176
+ decidedAt: z10.string().nullable(),
3177
+ createdAt: z10.string()
3113
3178
  });
3114
- var NoteSchema = z9.object({
3115
- id: z9.string(),
3179
+ var NoteSchema = z10.object({
3180
+ id: z10.string(),
3116
3181
  /** One-line headline (broker-titled; deterministic floor). */
3117
- title: z9.string(),
3182
+ title: z10.string(),
3118
3183
  /** The original intent, verbatim — assignees always see the user's own words. */
3119
- intent: z9.string(),
3184
+ intent: z10.string(),
3120
3185
  source: NoteSourceSchema,
3121
3186
  status: NoteStatusSchema,
3122
3187
  /** Who it was assigned to (a participant ref, 'agent:<tokenId>'); null = unassigned. */
3123
- assignee: z9.string().nullable(),
3188
+ assignee: z10.string().nullable(),
3124
3189
  /** The request thread minted at assignment; null until assigned. */
3125
- parentId: z9.string().nullable(),
3190
+ parentId: z10.string().nullable(),
3126
3191
  /** REMINDERS (docs/model/notes/reminders-design.md): the NOT-BEFORE this becomes eligible to ride a
3127
3192
  * call — never a deadline. It only ever comes from the user's own words, so when it
3128
3193
  * passes Paigy rings ONCE (#1293, owner 2026-08-26: a time said out loud is consent to
@@ -3131,154 +3196,154 @@ var NoteSchema = z9.object({
3131
3196
  // Defaulted, not required: a Note from an API deploy older than the reminders
3132
3197
  // migration has none of these, and the defaults ARE what it means — no not-before,
3133
3198
  // one ride, never ridden. Parsing must not fail across a rolling deploy.
3134
- dueAt: z9.string().nullable().default(null),
3199
+ dueAt: z10.string().nullable().default(null),
3135
3200
  repeat: NoteRepeatSchema.default("once"),
3136
3201
  /** How many calls have already carried it — the fatigue cap counts rides, not days. */
3137
- rides: z9.number().int().default(0),
3138
- lastRideAt: z9.string().nullable().default(null),
3139
- createdAt: z9.string()
3202
+ rides: z10.number().int().default(0),
3203
+ lastRideAt: z10.string().nullable().default(null),
3204
+ createdAt: z10.string()
3140
3205
  });
3141
- var TriageItemSchema = z9.object({
3142
- noteId: z9.string(),
3206
+ var TriageItemSchema = z10.object({
3207
+ noteId: z10.string(),
3143
3208
  /** The note's headline at run time. */
3144
- title: z9.string(),
3209
+ title: z10.string(),
3145
3210
  /** WHY, in one short human line, evidence first — this is read on a phone underneath
3146
3211
  * the note's title: "no movement in 34 days", "worked 3 notes in this repo this week".
3147
3212
  * Never a model's reasoning transcript, never an id. */
3148
- why: z9.string()
3213
+ why: z10.string()
3149
3214
  });
3150
- var TriageAssignmentSchema = z9.object({
3215
+ var TriageAssignmentSchema = z10.object({
3151
3216
  /** The agent's token id — what `dispatchNote` resolves and what a request is addressed to. */
3152
- agent: z9.string(),
3217
+ agent: z10.string(),
3153
3218
  /** Its display name at run time (the name on the hatchling's card). Denormalized for the
3154
3219
  * same reason as `title`: the card must render from the proposal alone. */
3155
- agentName: z9.string(),
3156
- notes: z9.array(TriageItemSchema)
3220
+ agentName: z10.string(),
3221
+ notes: z10.array(TriageItemSchema)
3157
3222
  });
3158
- var TriageStatusSchema = z9.enum(["open", "superseded", "dismissed"]);
3159
- var SubmitTriageSchema = z9.object({
3223
+ var TriageStatusSchema = z10.enum(["open", "superseded", "dismissed"]);
3224
+ var SubmitTriageSchema = z10.object({
3160
3225
  /** Which runtime judged: "ollama" (inference never left the machine) or a harness the
3161
3226
  * user already runs under their own credentials ("claude" / "codex" / "agy"). Recorded
3162
3227
  * so the phone can say where the content went — an unattributed privacy claim is worth
3163
3228
  * nothing, and #1106's promise is precisely "Paigy's servers never see this". */
3164
- provider: z9.string().min(1).max(60),
3229
+ provider: z10.string().min(1).max(60),
3165
3230
  /** The concrete model when the provider names one (an ollama tag); null otherwise. */
3166
- model: z9.string().max(200).nullable().optional(),
3231
+ model: z10.string().max(200).nullable().optional(),
3167
3232
  /** How many open notes the run actually looked at — the denominator on the phone
3168
3233
  * ("6 of 50"), and the honest answer to "did it read the whole queue?". */
3169
- reviewed: z9.number().int().min(0).max(1e4).default(0),
3170
- close: z9.array(TriageItemSchema).max(200).default([]),
3171
- stale: z9.array(TriageItemSchema).max(200).default([]),
3172
- assign: z9.array(TriageAssignmentSchema).max(50).default([])
3234
+ reviewed: z10.number().int().min(0).max(1e4).default(0),
3235
+ close: z10.array(TriageItemSchema).max(200).default([]),
3236
+ stale: z10.array(TriageItemSchema).max(200).default([]),
3237
+ assign: z10.array(TriageAssignmentSchema).max(50).default([])
3173
3238
  });
3174
3239
  var TriageProposalSchema = SubmitTriageSchema.extend({
3175
- id: z9.string(),
3176
- runAt: z9.string(),
3240
+ id: z10.string(),
3241
+ runAt: z10.string(),
3177
3242
  status: TriageStatusSchema,
3178
- model: z9.string().nullable().default(null)
3243
+ model: z10.string().nullable().default(null)
3179
3244
  });
3180
- var AcceptTriageSchema = z9.discriminatedUnion("group", [
3181
- z9.object({ group: z9.literal("close"), noteIds: z9.array(z9.string()).max(200).optional() }),
3182
- z9.object({ group: z9.literal("stale"), noteIds: z9.array(z9.string()).max(200).optional() }),
3183
- z9.object({
3184
- group: z9.literal("assign"),
3185
- agent: z9.string().min(1),
3186
- noteIds: z9.array(z9.string()).max(200).optional()
3245
+ var AcceptTriageSchema = z10.discriminatedUnion("group", [
3246
+ z10.object({ group: z10.literal("close"), noteIds: z10.array(z10.string()).max(200).optional() }),
3247
+ z10.object({ group: z10.literal("stale"), noteIds: z10.array(z10.string()).max(200).optional() }),
3248
+ z10.object({
3249
+ group: z10.literal("assign"),
3250
+ agent: z10.string().min(1),
3251
+ noteIds: z10.array(z10.string()).max(200).optional()
3187
3252
  })
3188
3253
  ]);
3189
- var AcceptTriageResultSchema = z9.object({
3190
- accepted: z9.array(z9.string()),
3191
- failed: z9.array(z9.object({ noteId: z9.string(), reason: z9.string() }))
3254
+ var AcceptTriageResultSchema = z10.object({
3255
+ accepted: z10.array(z10.string()),
3256
+ failed: z10.array(z10.object({ noteId: z10.string(), reason: z10.string() }))
3192
3257
  });
3193
- var DeliveryModeSchema = z9.enum(["poll", "self_hosted"]);
3258
+ var DeliveryModeSchema = z10.enum(["poll", "self_hosted"]);
3194
3259
  var WAKE_EVENT = "wake";
3195
3260
  var wakeChannel = (tokenId) => `wake:${tokenId}`;
3196
- var RegisterDeliverySchema = z9.object({ mode: DeliveryModeSchema });
3197
- var OAuthStartSchema = z9.object({
3198
- provider: z9.enum(["cma"]),
3199
- returnTo: z9.string().min(1)
3261
+ var RegisterDeliverySchema = z10.object({ mode: DeliveryModeSchema });
3262
+ var OAuthStartSchema = z10.object({
3263
+ provider: z10.enum(["cma"]),
3264
+ returnTo: z10.string().min(1)
3200
3265
  });
3201
- var DeliveryConfigSchema = z9.object({
3202
- tokenId: z9.string(),
3266
+ var DeliveryConfigSchema = z10.object({
3267
+ tokenId: z10.string(),
3203
3268
  mode: DeliveryModeSchema,
3204
3269
  /** null when the deployment has no anon key configured. `self_hosted` is then REFUSED
3205
3270
  * (503 `self_hosted_unavailable`) rather than registered, so a self_hosted config always
3206
3271
  * carries credentials; only a `poll` registration can come back with null here. */
3207
- realtime: z9.object({ url: z9.string(), anonKey: z9.string() }).nullable()
3272
+ realtime: z10.object({ url: z10.string(), anonKey: z10.string() }).nullable()
3208
3273
  });
3209
- var HostDecisionSchema = z9.object({
3274
+ var HostDecisionSchema = z10.object({
3210
3275
  /** The agent's token id: the row's `recipient`. */
3211
- agent: z9.string().uuid(),
3212
- decision: z9.enum(["stood_back", "took_over"]),
3276
+ agent: z10.string().uuid(),
3277
+ decision: z10.enum(["stood_back", "took_over"]),
3213
3278
  /** The work it was about: the Goal waiting on that agent next (`claimable` on its `contact({})` read). */
3214
- goalId: z9.string().uuid().nullable().optional(),
3279
+ goalId: z10.string().uuid().nullable().optional(),
3215
3280
  /** When the server last heard from the agent, as the host read it: the presence it stood back for. */
3216
- seenAt: z9.string().datetime().nullable().optional(),
3281
+ seenAt: z10.string().datetime().nullable().optional(),
3217
3282
  /** When that work last moved (`claimable.since` on an agent's `contact({})` read), the fact the bound is judged on. */
3218
- since: z9.string().datetime().nullable().optional(),
3283
+ since: z10.string().datetime().nullable().optional(),
3219
3284
  /** What the host said, in its log's own words: why it stood back, or what the take-over did. */
3220
- said: z9.string().max(300).optional()
3285
+ said: z10.string().max(300).optional()
3221
3286
  });
3222
- var WakeNudgeSchema = z9.object({
3223
- kind: z9.enum(["reply", "request", "callback"]),
3224
- notificationId: z9.string().optional(),
3225
- parentId: z9.string()
3287
+ var WakeNudgeSchema = z10.object({
3288
+ kind: z10.enum(["reply", "request", "callback"]),
3289
+ notificationId: z10.string().optional(),
3290
+ parentId: z10.string()
3226
3291
  });
3227
- var PairingStatusSchema = z9.enum(["pending", "approved", "denied", "expired"]);
3228
- var DeviceCodeSchema = z9.object({
3229
- device_code: z9.string(),
3230
- user_code: z9.string(),
3231
- verification_uri: z9.string().url(),
3232
- verification_uri_complete: z9.string().url(),
3233
- interval: z9.number(),
3234
- expires_in: z9.number()
3292
+ var PairingStatusSchema = z10.enum(["pending", "approved", "denied", "expired"]);
3293
+ var DeviceCodeSchema = z10.object({
3294
+ device_code: z10.string(),
3295
+ user_code: z10.string(),
3296
+ verification_uri: z10.string().url(),
3297
+ verification_uri_complete: z10.string().url(),
3298
+ interval: z10.number(),
3299
+ expires_in: z10.number()
3235
3300
  });
3236
- var DeviceInfoSchema = z9.object({
3237
- code: z9.string(),
3301
+ var DeviceInfoSchema = z10.object({
3302
+ code: z10.string(),
3238
3303
  /** The agent's suggested name (from /device/code) — shown on the approval screen,
3239
3304
  * pre-filling the name field the human can edit. */
3240
- name: z9.string(),
3305
+ name: z10.string(),
3241
3306
  /** @deprecated Legacy alias of `name` for the pre-#531 embedded bundle in App Store
3242
3307
  * build 35, whose DeviceFlow renders `info.agent.slice(0, 2)` — without this a FRESH
3243
3308
  * install crashes on the pairing screen on first launch, before the OTA lands
3244
3309
  * (seen live: PAIGY-5T, 2026-07-21). Remove once a newer binary is the floor. */
3245
- agent: z9.string().optional(),
3246
- device: z9.string().nullable(),
3310
+ agent: z10.string().optional(),
3311
+ device: z10.string().nullable(),
3247
3312
  status: PairingStatusSchema
3248
3313
  });
3249
- var DeviceTokenSchema = z9.object({
3250
- access_token: z9.string(),
3314
+ var DeviceTokenSchema = z10.object({
3315
+ access_token: z10.string(),
3251
3316
  /** The pairing's single name (user-typed at approval, the agent's suggestion, or
3252
3317
  * a default silly name). */
3253
- name: z9.string(),
3254
- device: z9.string().nullable(),
3318
+ name: z10.string(),
3319
+ device: z10.string().nullable(),
3255
3320
  /** The pairing's assigned voice, cached so the desktop can seed the SAME face the phone
3256
3321
  * draws — voice is the third ingredient of a hatchling's build (party/traits.ts). */
3257
- voice: z9.string().nullable().optional(),
3322
+ voice: z10.string().nullable().optional(),
3258
3323
  /** The token's server-side id — the face's COLOUR anchor, and the only seed ingredient
3259
3324
  * that survives a rename. Cached by the host's identity beat. */
3260
- token_id: z9.string().nullable().optional(),
3325
+ token_id: z10.string().nullable().optional(),
3261
3326
  /** WHERE this identity works — the folder a wake should land it in. Written by the host
3262
3327
  * at spawn and by `paigy-harness handoff` from a live terminal. Without it every wake
3263
3328
  * landed in the FIRST granted workspace and the agent rediscovered its own repo from
3264
3329
  * the thread each time (host.ts, live catch 2026-08-06 — prompt-papered until now). */
3265
- workspace: z9.string().nullable().optional(),
3330
+ workspace: z10.string().nullable().optional(),
3266
3331
  /** Local host recovery must preserve the launch's runtime and Paigy identity. */
3267
- harness: z9.enum(["claude", "codex", "agy"]).optional(),
3268
- session_id: z9.string().uuid().optional(),
3332
+ harness: z10.enum(["claude", "codex", "agy"]).optional(),
3333
+ session_id: z10.string().uuid().optional(),
3269
3334
  /** A conversation the host must not resume: its context is full, so every turn fails
3270
3335
  * ("Prompt is too long"). Written when a run hits it (`run.ts` `onFull`); the host skips a slot
3271
3336
  * whose resumable session is this one, so its Goals reach the dead-agent handoff instead of a
3272
3337
  * copy that types the person's words into a turn that cannot run (Calls, 2026-10-06). */
3273
- full_session: z9.string().optional(),
3274
- uik_pub: z9.string().nullable().optional()
3338
+ full_session: z10.string().optional(),
3339
+ uik_pub: z10.string().nullable().optional()
3275
3340
  });
3276
- var SupportRequestSchema = z9.object({
3277
- email: z9.string().email().max(320),
3278
- message: z9.string().trim().min(1).max(5e3),
3279
- name: z9.string().trim().max(120).optional()
3341
+ var SupportRequestSchema = z10.object({
3342
+ email: z10.string().email().max(320),
3343
+ message: z10.string().trim().min(1).max(5e3),
3344
+ name: z10.string().trim().max(120).optional()
3280
3345
  });
3281
- var NotificationFeedbackKindSchema = z9.enum([
3346
+ var NotificationFeedbackKindSchema = z10.enum([
3282
3347
  "break_down",
3283
3348
  // "This should be more than one ask — break it down."
3284
3349
  "regenerate_options",
@@ -3293,119 +3358,119 @@ var NotificationFeedbackKindSchema = z9.enum([
3293
3358
  // anything else — the note carries it.
3294
3359
  ]);
3295
3360
  var SlimOptionSchema = OptionSchema.omit({ html: true });
3296
- var QuestionRowSchema = z9.object({
3361
+ var QuestionRowSchema = z10.object({
3297
3362
  /** The card's id (`deliveryId:needId`, or `deliveryId:entryId` for an update), as the inbox mints it. */
3298
- id: z9.string(),
3299
- deliveryId: z9.string(),
3300
- entryId: z9.string(),
3363
+ id: z10.string(),
3364
+ deliveryId: z10.string(),
3365
+ entryId: z10.string(),
3301
3366
  /** The decision it waits on; null for an update, which asks nothing. */
3302
- needId: z9.string().nullable(),
3303
- goalIds: z9.array(z9.string()),
3367
+ needId: z10.string().nullable(),
3368
+ goalIds: z10.array(z10.string()),
3304
3369
  /** The name of the work it is about, when the read could word it. */
3305
- goalTitle: z9.string().optional(),
3306
- tokenId: z9.string().optional(),
3307
- name: z9.string(),
3308
- title: z9.string(),
3309
- body: z9.string(),
3310
- select: z9.enum(["one", "many", "rank", "confirm", "text"]),
3311
- options: z9.array(SlimOptionSchema),
3312
- hasPreview: z9.boolean(),
3313
- blocking: z9.boolean(),
3314
- askedAt: z9.string().datetime(),
3370
+ goalTitle: z10.string().optional(),
3371
+ tokenId: z10.string().optional(),
3372
+ name: z10.string(),
3373
+ title: z10.string(),
3374
+ body: z10.string(),
3375
+ select: z10.enum(["one", "many", "rank", "confirm", "text"]),
3376
+ options: z10.array(SlimOptionSchema),
3377
+ hasPreview: z10.boolean(),
3378
+ blocking: z10.boolean(),
3379
+ askedAt: z10.string().datetime(),
3315
3380
  ring: InboxItemSchema.shape.ring,
3316
- onCall: z9.literal(true).optional(),
3317
- sealed: z9.boolean()
3381
+ onCall: z10.literal(true).optional(),
3382
+ sealed: z10.boolean()
3318
3383
  });
3319
- var WorkStateSchema = z9.enum(["ready", "active", "waiting", "done", "cancelled"]);
3320
- var WorkRowSchema = z9.object({
3321
- id: z9.string(),
3322
- parentId: z9.string().nullable(),
3323
- title: z9.string(),
3384
+ var WorkStateSchema = z10.enum(["ready", "active", "waiting", "done", "cancelled"]);
3385
+ var WorkRowSchema = z10.object({
3386
+ id: z10.string(),
3387
+ parentId: z10.string().nullable(),
3388
+ title: z10.string(),
3324
3389
  /** Straight off the Goal. */
3325
3390
  state: WorkStateSchema,
3326
- owner: z9.string().nullable(),
3327
- revision: z9.number().int(),
3391
+ owner: z10.string().nullable(),
3392
+ revision: z10.number().int(),
3328
3393
  /** Open questions on it, counted to 100. */
3329
- waiting: z9.number().int(),
3394
+ waiting: z10.number().int(),
3330
3395
  /** Held by a gate on work that is not done. */
3331
- blocked: z9.boolean(),
3332
- lastProgressAt: z9.string().datetime().nullable(),
3396
+ blocked: z10.boolean(),
3397
+ lastProgressAt: z10.string().datetime().nullable(),
3333
3398
  /** The line written for its newest progress note, else that note's first words. */
3334
- line: z9.string().nullable(),
3399
+ line: z10.string().nullable(),
3335
3400
  /** Work directly under it, counted to 100; the list carries up to 12 of them. */
3336
- children: z9.number().int(),
3337
- createdAt: z9.string().datetime(),
3338
- updatedAt: z9.string().datetime(),
3401
+ children: z10.number().int(),
3402
+ createdAt: z10.string().datetime(),
3403
+ updatedAt: z10.string().datetime(),
3339
3404
  /** When anything at or under it last moved — the order the list is in. */
3340
- activeAt: z9.string().datetime(),
3405
+ activeAt: z10.string().datetime(),
3341
3406
  /** A sealed outcome has no title here; the work's page opens it. */
3342
- sealed: z9.boolean()
3407
+ sealed: z10.boolean()
3343
3408
  });
3344
3409
  var ComputerRowSchema = ConnectionSummarySchema.omit({ activity: true });
3345
3410
  var AgentRowSchema = ComputerRowSchema.extend({
3346
3411
  /** Open questions it is asking the person, over every open card; null when that read failed. */
3347
- asking: z9.number().int().nullable(),
3348
- oldestAskAt: z9.string().datetime().nullable(),
3412
+ asking: z10.number().int().nullable(),
3413
+ oldestAskAt: z10.string().datetime().nullable(),
3349
3414
  /** Up to three of the live Goals it holds, oldest first (the order it picks them up), and how
3350
3415
  * many in all among the account's 200 most recently active agent-held live Goals
3351
3416
  * (`agent_holds`); null when that read failed. */
3352
- holds: z9.array(z9.object({ id: z9.string(), title: z9.string() })).nullable(),
3353
- held: z9.number().int().nullable(),
3417
+ holds: z10.array(z10.object({ id: z10.string(), title: z10.string() })).nullable(),
3418
+ held: z10.number().int().nullable(),
3354
3419
  /** The earliest instant any Goal it holds went quiet, by the one rule (`coldSince`); null
3355
3420
  * while none has, or when that read failed. */
3356
- cold: z9.string().datetime().nullable(),
3421
+ cold: z10.string().datetime().nullable(),
3357
3422
  /** The newest line of its working log, and when the harness saw it. */
3358
- line: z9.string().nullable(),
3359
- lineAt: z9.string().datetime().nullable()
3423
+ line: z10.string().nullable(),
3424
+ lineAt: z10.string().datetime().nullable()
3360
3425
  });
3361
- var SnapshotSchema = z9.object({
3426
+ var SnapshotSchema = z10.object({
3362
3427
  /** The API's clock, taken before the first read: what a later delta will start from. */
3363
- at: z9.string().datetime(),
3364
- questions: z9.object({
3428
+ at: z10.string().datetime(),
3429
+ questions: z10.object({
3365
3430
  /** The newest 30 open cards, questions before updates. */
3366
- items: z9.array(QuestionRowSchema),
3431
+ items: z10.array(QuestionRowSchema),
3367
3432
  /** Every open question, and apart from them every update, and what was put off. */
3368
- total: z9.number().int(),
3369
- updates: z9.number().int(),
3370
- putOff: z9.number().int()
3433
+ total: z10.number().int(),
3434
+ updates: z10.number().int(),
3435
+ putOff: z10.number().int()
3371
3436
  }).nullable(),
3372
- agents: z9.object({
3437
+ agents: z10.object({
3373
3438
  /** Up to 60, most recently seen first. */
3374
- items: z9.array(AgentRowSchema),
3375
- more: z9.boolean()
3439
+ items: z10.array(AgentRowSchema),
3440
+ more: z10.boolean()
3376
3441
  }).nullable(),
3377
- work: z9.object({
3442
+ work: z10.object({
3378
3443
  /** The 60 most recently active roots, each followed by up to 12 children; 240 rows at most. */
3379
- items: z9.array(WorkRowSchema),
3444
+ items: z10.array(WorkRowSchema),
3380
3445
  /** How much work is behind each of the Work tab's four filters, each counted to 100, read with
3381
3446
  * the rows. `work_list` (20260928023533) owns the predicates: Live is `ready`, `active` or
3382
3447
  * `waiting`; Waiting on you is live work with an open question or an unmet gate; Not started
3383
3448
  * is `ready`; Done is `done` or `cancelled`. */
3384
- counts: z9.object({ live: z9.number().int(), waiting: z9.number().int(), notStarted: z9.number().int(), done: z9.number().int() })
3449
+ counts: z10.object({ live: z10.number().int(), waiting: z10.number().int(), notStarted: z10.number().int(), done: z10.number().int() })
3385
3450
  }).nullable(),
3386
- you: z9.object({
3451
+ you: z10.object({
3387
3452
  settings: UserSettingsSchema,
3388
- callable: z9.boolean(),
3453
+ callable: z10.boolean(),
3389
3454
  /** Up to 20 paired computers; null when the roster read failed. */
3390
- computers: z9.array(ComputerRowSchema).nullable()
3455
+ computers: z10.array(ComputerRowSchema).nullable()
3391
3456
  }).nullable()
3392
3457
  });
3393
- var CallRecapSchema = z9.object({
3394
- call: z9.object({
3395
- status: z9.string(),
3396
- startedAt: z9.string(),
3397
- durationMs: z9.number().nullable(),
3398
- agents: z9.array(z9.object({ id: z9.string(), name: z9.string().nullable() }))
3458
+ var CallRecapSchema = z10.object({
3459
+ call: z10.object({
3460
+ status: z10.string(),
3461
+ startedAt: z10.string(),
3462
+ durationMs: z10.number().nullable(),
3463
+ agents: z10.array(z10.object({ id: z10.string(), name: z10.string().nullable() }))
3399
3464
  }),
3400
- topics: z9.array(z9.object({
3401
- goalId: z9.string().uuid(),
3402
- title: z9.string(),
3403
- owner: z9.string(),
3404
- state: z9.string(),
3465
+ topics: z10.array(z10.object({
3466
+ goalId: z10.string().uuid(),
3467
+ title: z10.string(),
3468
+ owner: z10.string(),
3469
+ state: z10.string(),
3405
3470
  /** Whether the call put it to the person. An item it carried and never said has no row on the
3406
3471
  * review (owner, 2026-10-08: "why do we get the third one when it didn't happen in the call?"). */
3407
- presented: z9.boolean(),
3408
- questions: z9.array(z9.object({ id: z9.string().uuid(), state: z9.string(), title: z9.string() })),
3472
+ presented: z10.boolean(),
3473
+ questions: z10.array(z10.object({ id: z10.string().uuid(), state: z10.string(), title: z10.string() })),
3409
3474
  /** `words` is always what they SAID, verbatim — the record, never replaced. `summary` is what
3410
3475
  * the line says in ten words (owner, 2026-10-07): the filer's, or the talker's for the answer it
3411
3476
  * gave, so the row scans like a chosen option and their own words stay under it. Absent when
@@ -3415,31 +3480,33 @@ var CallRecapSchema = z9.object({
3415
3480
  /** `reply` is the reply the line makes up (an answer, an ok, a deferral), so one reply is one row
3416
3481
  * however many lines it cites; `at` is the call lines it came from, so a filed line an answer already
3417
3482
  * said is not drawn again (owner, 2026-10-07: "fix them all"); `replyKind` says which replies are answers. */
3418
- lines: z9.array(z9.object({
3419
- entryId: z9.string().uuid(),
3420
- words: z9.string(),
3421
- summary: z9.string().optional(),
3422
- about: z9.string().nullable().optional(),
3423
- reply: z9.string().nullable().optional(),
3424
- replyKind: z9.string().nullable().optional(),
3425
- at: z9.array(z9.number()).optional()
3483
+ lines: z10.array(z10.object({
3484
+ entryId: z10.string().uuid(),
3485
+ words: z10.string(),
3486
+ summary: z10.string().optional(),
3487
+ about: z10.string().nullable().optional(),
3488
+ reply: z10.string().nullable().optional(),
3489
+ replyKind: z10.string().nullable().optional(),
3490
+ at: z10.array(z10.number()).optional()
3426
3491
  }))
3427
3492
  })),
3428
- unfiled: z9.array(z9.object({ lineId: z9.string().uuid(), words: z9.string(), atMs: z9.number() })),
3493
+ unfiled: z10.array(z10.object({ lineId: z10.string().uuid(), words: z10.string(), atMs: z10.number() })),
3429
3494
  /** THE PUBLIC TRANSCRIPT — every line said on the call, in the order it was said, and WHO SAID IT
3430
3495
  * (owner, 2026-10-08: "the public view should only have the lines and who said them, and that's
3431
3496
  * it"; `docs/brain/phase-three/modular.md` build step 3). `speaker` is the role: "user" is the
3432
3497
  * person, "agent" an agent speaking, named in `agent`. The timeline's action lines are ours, not
3433
3498
  * theirs, and are not here; nor is a sealed line, which the server has no words for. It stands
3434
3499
  * BESIDE `topics` and `unfiled` — what the call did with the words — never instead of them. */
3435
- said: z9.array(z9.object({
3436
- lineId: z9.string().uuid(),
3437
- speaker: z9.enum(["user", "agent"]),
3438
- agent: z9.object({ id: z9.string().nullable(), name: z9.string().nullable() }).nullable(),
3439
- words: z9.string(),
3440
- atMs: z9.number()
3500
+ said: z10.array(z10.object({
3501
+ lineId: z10.string().uuid(),
3502
+ speaker: z10.enum(["user", "agent"]),
3503
+ agent: z10.object({ id: z10.string().nullable(), name: z10.string().nullable() }).nullable(),
3504
+ words: z10.string(),
3505
+ atMs: z10.number()
3441
3506
  })),
3442
- more: z9.object({ lines: z9.number(), entries: z9.number(), topics: z9.number() })
3507
+ more: z10.object({ lines: z10.number(), entries: z10.number(), topics: z10.number() }),
3508
+ /** Last stored position on this page when another exists; absent before paging shipped. */
3509
+ next: z10.number().int().nonnegative().nullable().optional()
3443
3510
  });
3444
3511
  function sessionSlot(sessionId2) {
3445
3512
  const id2 = sessionId2 ?? sessionId();
@@ -3644,14 +3711,18 @@ async function hatch(name, voice = null, opts = {}) {
3644
3711
  }
3645
3712
  async function whoAmI(opts = {}) {
3646
3713
  try {
3647
- const res = await reach(`${BACKEND_URL}/api/identity`, {
3648
- headers: { authorization: `Bearer ${authToken(opts.token)}` }
3649
- });
3650
- return res.ok ? await res.json() : null;
3714
+ return await readIdentity(opts);
3651
3715
  } catch {
3652
3716
  return null;
3653
3717
  }
3654
3718
  }
3719
+ async function readIdentity(opts = {}) {
3720
+ const res = await ensureAuthed(await (opts.reach ?? reach)(`${BACKEND_URL}/api/identity`, {
3721
+ headers: { authorization: `Bearer ${authToken(opts.token)}` }
3722
+ }));
3723
+ if (!res.ok) await fail("read_identity", res);
3724
+ return await res.json();
3725
+ }
3655
3726
  var NameTakenError = class extends Error {
3656
3727
  code = "agent_name_taken";
3657
3728
  };
@@ -4064,6 +4135,18 @@ var itemsView = (results) => (results ?? []).map((r) => compact({
4064
4135
  error: r.error,
4065
4136
  detail: r.detail
4066
4137
  }));
4138
+ function deliveryReadView(d) {
4139
+ return compact({
4140
+ deliveryId: d.deliveryId,
4141
+ kind: d.kind,
4142
+ state: d.state,
4143
+ goalIds: d.goalIds,
4144
+ conversation: conversation(d),
4145
+ callState: d.callState,
4146
+ callOutcome: d.callOutcome ?? (d.kind === "call" ? d.message : void 0),
4147
+ next: d.callState && d.callState !== "ended" ? "Keep receiving with contact({wait:true}) while this Call is open, even after an empty window. Do not resend the ask." : "Answers and follow-ups are on their Goals; receive on your next wake. This read acknowledges nothing."
4148
+ });
4149
+ }
4067
4150
  function deliveryView(d) {
4068
4151
  const answers = "Answers land on the Goal: collect them with contact({wait:true}) or get_goal. Do not resend it.";
4069
4152
  const pending = d.state === "open" && d.decisionNeeds.some((n) => n.state === "open");
@@ -4086,6 +4169,7 @@ function deliveryView(d) {
4086
4169
  // live (the person is on it now) or ended. A contact that joined a call already happening reads
4087
4170
  // that call, so it says `live`.
4088
4171
  call: d.callState,
4172
+ callOutcome: d.callOutcome,
4089
4173
  waitOutcome: d.waitOutcome,
4090
4174
  acknowledged: d.acknowledged?.filter((a) => a.acknowledged).map((a) => a.eventId),
4091
4175
  next: [
@@ -4108,20 +4192,21 @@ function quietDays(items, now) {
4108
4192
  const oldest = Math.min(...items.map((i) => Date.parse(i.since ?? "")).filter(Number.isFinite));
4109
4193
  return Number.isFinite(oldest) ? Math.max(3, Math.round((now - oldest) / 864e5)) : 3;
4110
4194
  }
4111
- var quietFor = (items, now) => {
4195
+ var quietFor = (items, now, count = items.length) => {
4112
4196
  const days = quietDays(items, now);
4113
- return items.length === 1 ? `for ${days} days` : `, the longest for ${days} days`;
4197
+ return count === 1 ? `for ${days} days` : `, the longest for ${days} days`;
4114
4198
  };
4115
4199
  function receivedView(r, now = Date.now()) {
4116
4200
  const w = r.waiting;
4117
4201
  const assigned = w.assigned ?? [];
4118
4202
  const stalled = w.stalled ?? [];
4119
- const others = w.stalledOthers ?? [];
4203
+ const others = w.others;
4120
4204
  const rings = w.rings ?? [];
4121
4205
  const owed = r.events.filter((e) => e.kind === "question");
4122
4206
  const refused = (r.acknowledged ?? []).filter((a) => a.refused);
4123
4207
  return compact({
4124
4208
  events: r.events.map((e) => compact({ ...e })),
4209
+ calls: w.calls,
4125
4210
  hasMore: r.hasMore || void 0,
4126
4211
  waitOutcome: r.waitOutcome,
4127
4212
  acknowledged: r.acknowledged?.filter((a) => a.acknowledged).map((a) => a.eventId),
@@ -4131,9 +4216,10 @@ function receivedView(r, now = Date.now()) {
4131
4216
  // THE WORK WAITING ON YOU NEXT (owner, 2026-09-27: "Wake on any work"): the predicate that starts a
4132
4217
  // sleeping agent, so "nothing is waiting" is never said while work is.
4133
4218
  claimable: w.claimable,
4134
- // YOUR STALLED WORK (#2257), and OTHER AGENTS' (owner, 2026-09-23): any agent may take it over.
4219
+ // YOUR STALLED WORK (#2257), and HOW MUCH OF OTHER AGENTS' HAS GONE QUIET (owner, 2026-10-08:
4220
+ // "Keep a count and instructions on how to find them"), counted rather than listed.
4135
4221
  stalled,
4136
- stalledOthers: others,
4222
+ others,
4137
4223
  // WHEN THE PHONE RINGS AGAIN FOR YOUR ASKS (owner, 2026-10-08): your Call went unheard and closed.
4138
4224
  rings: rings.length ? rings : void 0,
4139
4225
  // The person's standing rules for how their agents work (owner, 2026-10-08). On the read an agent makes
@@ -4141,24 +4227,38 @@ function receivedView(r, now = Date.now()) {
4141
4227
  // held wait, which would repeat them window after window.
4142
4228
  houseRules: r.waitOutcome === "not_waited" ? w.houseRules : void 0,
4143
4229
  next: [
4144
- r.events.length ? `Handle each event, then acknowledge the ones you handled: contact({ ackEventIds: [${r.events.filter((e) => e.kind !== "question").map((e) => `"${e.eventId}"`).join(", ")}] }).` : w.claimable || assigned.length || rings.length ? "No messages." : "Nothing is waiting.",
4230
+ r.events.length ? `Handle each event, then acknowledge the ones you handled: contact({ ackEventIds: [${r.events.filter((e) => e.kind !== "question").map((e) => `"${e.eventId}"`).join(", ")}] }).` : w.claimable || assigned.length || rings.length || w.calls?.some((c) => c.callState !== "ended") ? "No messages." : "Nothing is waiting.",
4145
4231
  ...owed.length ? [`You owe ${owed.length === 1 ? "an answer" : `${owed.length} answers`}: contact({ answers: [{ questionId: "<questionId>", answer: { text: <your answer> } }] }) for each question; a question is answered, never acknowledged.`] : [],
4146
4232
  ...r.hasMore ? ["More are waiting: acknowledge these, then receive again."] : [],
4147
4233
  ...r.waitOutcome === "expired" ? ["Nothing arrived in the window; receive again to keep waiting, without sending again."] : [],
4148
- ...rings.map((r2) => rerings(r2.ringAt, now)),
4234
+ ...(w.calls ?? []).filter((c) => c.callState !== "ended").map((c) => `Read the whole ask with get_delivery({deliveryId: "${c.deliveryId}"}); follow its current calls[].callOutcome while receiving.`),
4235
+ ...rings.map((r2) => rerings(r2, now)),
4149
4236
  ...assigned.length ? [`${assigned.length} of your Goals are assigned to you and not started (assigned): read one with get_goal({goalId}); your first write to it starts it.`] : [],
4150
4237
  ...w.claimable && !assigned.length ? [`Next waiting on you: ${w.claimable.title ?? w.claimable.goalId} (get_goal({ goalId: "${w.claimable.goalId}" })).`] : [],
4151
4238
  ...stalled.length ? [`${stalled.length} of your Goals have had no progress${stalled.length === 1 ? " " : ""}${quietFor(stalled, now)}: report on each with a contact update, or finish or cancel it with manage_goals.`] : [],
4152
- ...others.length ? [`${others.length} of other agents' Goals have gone quiet${others.length === 1 ? " " : ""}${quietFor(others, now)}: read one with get_goal({goalId}); a write to it puts you on it without changing its owner.`] : [],
4239
+ // The COUNT, oldest three, and where to read them (owner, 2026-10-08): it was 34 rows of
4240
+ // other agents' work on every window, ahead of this agent's own next step.
4241
+ ...others ? [`${others.count} of other agents' Goals have gone quiet${others.count === 1 ? " " : ""}${quietFor([{ since: others.oldestSince }], now, others.count)}: The oldest three are in others.goals: get_goal({goalId}) reads one in full. A write to it puts you on it without changing its owner.`] : [],
4153
4242
  // No name of its own (#2525): the API's ask, verbatim.
4154
4243
  ...w.unnamed ? [w.unnamed] : []
4155
4244
  ].join(" ")
4156
4245
  });
4157
4246
  }
4158
- function rerings(ringAt, now) {
4159
- if (!ringAt) return "A Call of yours went unanswered and will not ring again: its questions wait on the person's card. Collect the answers on your next wake; nothing needs resending.";
4160
- const minutes = Math.max(0, Math.round((Date.parse(ringAt) - now) / 6e4));
4161
- return `A Call of yours went unanswered; the phone rings again by itself at ${ringAt.slice(11, 16)} UTC (in ${minutes} min), carrying the same asks. Nothing needs resending: schedule a wake-up for then and receive again.`;
4247
+ function rerings(r, now) {
4248
+ const held = [r.held, r.said].filter(Boolean).join(" ");
4249
+ if (!r.ringAt) {
4250
+ return [
4251
+ held || "A Call of yours went unanswered.",
4252
+ "The ladder has no ring armed for its card: collect the answers on your next wake, and nothing needs resending."
4253
+ ].join(" ");
4254
+ }
4255
+ const minutes = Math.max(0, Math.round((Date.parse(r.ringAt) - now) / 6e4));
4256
+ const when = `the phone rings again by itself at ${r.ringAt.slice(11, 16)} UTC (in ${minutes} min), carrying the same asks.`;
4257
+ return [
4258
+ held || "A Call of yours went unanswered;",
4259
+ held ? `Then ${when}` : when,
4260
+ "Nothing needs resending: schedule a wake-up for then and receive again."
4261
+ ].join(" ");
4162
4262
  }
4163
4263
  function managedView(m, changes) {
4164
4264
  const results = m.results ?? [];
@@ -4185,6 +4285,9 @@ async function runTool(name, args, opts) {
4185
4285
  const { waits, signal, ...client } = opts;
4186
4286
  const input = args ?? {};
4187
4287
  switch (name) {
4288
+ case "configure":
4289
+ ConfigureIdentitySchema.parse(input);
4290
+ return readIdentity(client);
4188
4291
  case "contact": {
4189
4292
  const parsed = ContactSchema.parse(input);
4190
4293
  if (!sendsAnything(parsed)) return receivedView(await receiveContact(parsed, { ...client, signal, waits }));
@@ -4207,6 +4310,8 @@ async function runTool(name, args, opts) {
4207
4310
  for (const g of managed.goals ?? []) remember(client.token, g.goalId, g.revision);
4208
4311
  return managedView(managed, changes);
4209
4312
  }
4313
+ case "get_delivery":
4314
+ return deliveryReadView(await readDelivery(GetDeliverySchema.parse(input).deliveryId, { ...client, signal }));
4210
4315
  case "get_goal": {
4211
4316
  const { goalId, history, diagnose } = GetGoalSchema.parse(input);
4212
4317
  const goal = read2(client.token, await getGoal(goalId, client, { history, diagnose }));