@paigy/mcp 0.40.25 → 0.40.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,9 +5,9 @@ import { createHash, randomUUID } from "crypto";
5
5
  import { readFileSync } from "fs";
6
6
  import { homedir } from "os";
7
7
  import { join } from "path";
8
- import { randomUUID as randomUUID3 } from "crypto";
8
+ import { randomUUID as randomUUID2 } from "crypto";
9
9
  import { setTimeout as sleep2 } from "timers/promises";
10
- import { z as z5 } from "zod";
10
+ import { z as z7 } 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";
@@ -15,13 +15,14 @@ import { ZodFirstPartyTypeKind } from "zod/v3";
15
15
  import { ZodFirstPartyTypeKind as ZodFirstPartyTypeKind2 } from "zod/v3";
16
16
  import { z as z2 } from "zod";
17
17
  import { z as z4 } from "zod";
18
- import { randomUUID as randomUUID2 } from "crypto";
18
+ import { z as z5 } from "zod";
19
+ import { z as z6 } from "zod";
19
20
  import { closeSync, existsSync, mkdirSync, openSync, readFileSync as readFileSync2, rmSync, statSync, writeFileSync } from "fs";
20
21
  import { homedir as homedir2 } from "os";
21
22
  import { join as join2 } from "path";
22
- import { execFileSync as execFileSync2 } from "child_process";
23
- import { randomUUID as randomUUID4 } from "crypto";
23
+ import { randomUUID as randomUUID3 } from "crypto";
24
24
  import { WebSocket } from "undici";
25
+ import { execFileSync as execFileSync2 } from "child_process";
25
26
  var require2 = __sdkCreateRequire(import.meta.url);
26
27
  var CODEX_ENV = ["CODEX_THREAD_ID", "CODEX_SESSION_ID", "CODEX_HOME", "PAIGY_TOKEN", "PAIGY_SESSION_ID", "PAIGY_HARNESS", "PAIGY_INSTANCE_ID", "PAIGY_ON_WAKE"];
27
28
  var BACKEND_URL = process.env.PAIGY_BACKEND_URL ?? "https://paigy.ai";
@@ -1320,14 +1321,20 @@ var OptionSchema = z.object({
1320
1321
  // .describe() flows into the MCP contact JSON schema (zodToJsonSchema), so
1321
1322
  // the constraints below are what an agent reads when deciding to use these.
1322
1323
  html: z.string().max(16384).describe(
1323
- "Optional sandboxed HTML/CSS preview for a visual 'pick one' (shown in the option card). Untrusted-sandboxed: NO JavaScript, NO external network or images \u2014 inline CSS and data: URIs only; <=16KB. Rendered edge-to-edge in a responsive card that is 200pt tall (about 320pt wide on a phone, with the next option peeking beside it); make your HTML fit that viewport. Use for layout/CSS mockups, tables, diffs. For a hosted image use `image` instead."
1324
+ "Optional sandboxed HTML/CSS preview for a visual 'pick one' (shown in the option card). Untrusted-sandboxed: NO JavaScript, NO external network or images \u2014 inline CSS and data: URIs only; <=16KB. Rendered edge-to-edge in a responsive card that is 200pt tall (about 320pt wide on a phone, with the next option peeking beside it); make your HTML fit that viewport. Use for layout/CSS mockups, tables, diffs. For a hosted image use the image URL instead."
1324
1325
  ).optional(),
1325
1326
  image: z.string().url().describe(
1326
- "Optional image URL rendered as the option's preview (plain image, not sandboxed). For agent-generated HTML/CSS mockups, use `html` instead."
1327
+ "Optional image URL rendered as the option's preview (plain image, not sandboxed). For agent-generated HTML/CSS mockups, use the HTML preview instead."
1327
1328
  ).optional()
1328
1329
  });
1329
- var OptionInputSchema = OptionSchema.omit({ id: true }).extend({
1330
- label: z.string().trim().min(1).max(1e3)
1330
+ var OptionInputSchema = z.object({
1331
+ id: z.string().trim().min(1).max(64).regex(/^[A-Za-z0-9_.:-]+$/).optional().describe(
1332
+ `Optional: this option's own id, which answers name it by (selectedOptionIds). Give every option one, or none: without them the options are numbered "1", "2", \u2026 in order.`
1333
+ ),
1334
+ label: z.string().trim().min(1).max(1e3),
1335
+ hint: OptionSchema.shape.hint,
1336
+ htmlPreview: OptionSchema.shape.html,
1337
+ imgUrl: OptionSchema.shape.image
1331
1338
  }).strict();
1332
1339
  function tzOffsetMinutes(tz, atMs) {
1333
1340
  try {
@@ -1527,41 +1534,162 @@ function mcpInputSchema(s) {
1527
1534
  delete schema.$schema;
1528
1535
  return draft2020(schema);
1529
1536
  }
1530
- var AskInputSchema = z2.object({
1531
- id: z2.string().optional().describe("Optional idempotency key or client-side ID for this specific ask."),
1532
- parentId: z2.string().uuid().optional().describe("The Goal this question is about \u2014 usually the one you are working on. The question goes onto that Goal and its answer comes back there. Omit it and the question starts a new Goal of yours."),
1533
- repo: z2.string().optional().describe("Optional repository context."),
1534
- ask: z2.string().trim().min(1).max(1e4).describe(
1535
- "ONE question, and only what is needed to answer it. Several questions are several asks in the array, one each: an answer settles the one ask it was given in the shape that ask declares, so a person who answers the part of a bundled ask that interested them settles nothing and is asked again. Paigy sends each ask exactly as you wrote it: a bundled ask arrives as one card. News, progress and findings are their own contact; ANY contact for a person already on a call JOINS that call, whatever channel you asked for, so several arrive as one call."
1537
+ var ASK_MAX = 250;
1538
+ var UNITS_MAX = 12;
1539
+ var UNIT_TITLE_MAX = 50;
1540
+ var UNIT_BODY_MAX = 200;
1541
+ var UnitInputSchema = z2.object({
1542
+ title: z2.string().trim().min(1).describe(`What this unit is about, at most ${UNIT_TITLE_MAX} characters. The app lists the titles; the person taps one to read its body.`),
1543
+ body: z2.string().trim().min(1).describe(`The unit itself, at most ${UNIT_BODY_MAX} characters.`)
1544
+ }).strict();
1545
+ function capRefusals(text, units2, field) {
1546
+ const out = [];
1547
+ const name = field === "text" ? "answer" : field;
1548
+ if (text.length > ASK_MAX) out.push({
1549
+ refusal: "ask_too_long",
1550
+ length: text.length,
1551
+ cap: ASK_MAX,
1552
+ path: field === "text" ? ["answer", "text"] : [field],
1553
+ message: `ask_too_long: the ${name} is ${text.length} characters; the cap is ${ASK_MAX}. Keep the one point in the ${name} and move the context into units.`
1554
+ });
1555
+ const all = units2 ?? [];
1556
+ if (all.length > UNITS_MAX) out.push({
1557
+ refusal: "too_many_units",
1558
+ length: all.length,
1559
+ cap: UNITS_MAX,
1560
+ path: ["units"],
1561
+ message: `too_many_units: ${all.length} units; the cap is ${UNITS_MAX}. Keep only the context this ${name} needs.`
1562
+ });
1563
+ all.forEach((unit, index) => {
1564
+ if (unit.title.length > UNIT_TITLE_MAX) out.push({
1565
+ refusal: "unit_title_too_long",
1566
+ index,
1567
+ length: unit.title.length,
1568
+ cap: UNIT_TITLE_MAX,
1569
+ path: ["units", index, "title"],
1570
+ message: `unit_title_too_long: units[${index}]'s title is ${unit.title.length} characters; the cap is ${UNIT_TITLE_MAX}.`
1571
+ });
1572
+ if (unit.body.length > UNIT_BODY_MAX) out.push({
1573
+ refusal: "unit_body_too_long",
1574
+ index,
1575
+ length: unit.body.length,
1576
+ cap: UNIT_BODY_MAX,
1577
+ path: ["units", index, "body"],
1578
+ message: `unit_body_too_long: units[${index}]'s body is ${unit.body.length} characters; the cap is ${UNIT_BODY_MAX}. Cut it into two units.`
1579
+ });
1580
+ });
1581
+ return out;
1582
+ }
1583
+ function refuseOverCaps(text, units2, field, ctx) {
1584
+ for (const { path, message, ...params } of capRefusals(text, units2, field)) ctx.addIssue({ code: z2.ZodIssueCode.custom, path, message, params });
1585
+ }
1586
+ var questionHandle = z2.string().trim().regex(/^[0-9a-fA-F-]{8,36}$/, "a question id, whole or its first eight characters");
1587
+ var NodeRef = z2.object({
1588
+ type: z2.enum(["goal", "question"]),
1589
+ id: z2.string().uuid()
1590
+ }).strict().describe("A Goal or a Question, by its id.");
1591
+ var BlockedAction = z2.enum(["start", "complete", "answer"]).describe("What waits: starting or completing a Goal, or answering a Question.");
1592
+ var reason = z2.string().trim().min(1).max(500).describe("Why, as an explanation, never as policy.");
1593
+ var actionFits = (b) => b.blocked.type === "goal" === (b.action !== "answer");
1594
+ var ACTION_FITS = "a goal is blocked from start or complete; a question from answer";
1595
+ var userExplicitlyRequested = z2.enum(["any", "call"]).optional().describe(
1596
+ `Only what the person said about THIS message, in so many words: "any" when they asked you to send it to them ("send it to my phone", "message me the result"), "call" when they asked to be called about it. It is then delivered (a call rings for the whole contact, and carries everything waiting on them); omitted, an update is only recorded as the Goal's progress unless the person needs it. Never set it to make a message louder.`
1597
+ );
1598
+ var units = z2.array(UnitInputSchema).optional().describe(
1599
+ `The context this message needs, as up to ${UNITS_MAX} units in reading order, each {title, body}: a title of at most ${UNIT_TITLE_MAX} characters and a body of at most ${UNIT_BODY_MAX}. One idea per unit. Leave it out when the main text says it all.`
1600
+ );
1601
+ var UpdateInputSchema = z2.object({
1602
+ message: z2.string().trim().min(1).describe(`The one point, at most ${ASK_MAX} characters; the context goes in units.`),
1603
+ goalIds: z2.array(z2.string().uuid()).min(1).max(10).describe("The Goals it is about, each one that exists: the one it is mainly about first."),
1604
+ units,
1605
+ userExplicitlyRequested
1606
+ }).strict().superRefine((u, ctx) => refuseOverCaps(u.message, u.units, "message", ctx));
1607
+ var questionFields = {
1608
+ question: z2.string().trim().min(1).describe(
1609
+ `ONE question, in at most ${ASK_MAX} characters, and only what is needed to answer it; the context goes in units. Several questions are several objects, one each: an answer settles the one question it was given, so a person who answers the part of a bundled question that interested them settles nothing and is asked again. Separate questions cost nothing: ANY contact for a person already on a call JOINS that call, so several arrive as one call.`
1536
1610
  ),
1537
- options: z2.array(OptionInputSchema).min(1).max(6).optional(),
1611
+ goalId: z2.string().uuid().describe("The Goal the question is about, which must exist (create it with manage_goals first). Its answer comes back there."),
1612
+ units,
1613
+ options: z2.array(OptionInputSchema).min(1).max(6).optional().describe("The choices, when you have them. Each label stands on its own."),
1538
1614
  // HOW THE OPTIONS ARE ANSWERED, SAID BY THE AGENT (owner, 2026-10-02: "one and many makes sense";
1539
- // brain_prompts.md §1: structured agent questions need no model). Every card was pick-one while no
1540
- // agent sent this; no read reshapes cards any more, so this is the card's shape, and the
1541
- // description says so plainly.
1542
- select: z2.enum(["one", "many"]).optional().describe(
1543
- 'How the options are answered: "many" makes a checklist (they may want several, e.g. independent fixes), "one" (the default) a pick (choosing one rules out the others). Send "many" whenever more than one option could be wanted at once. The person can always answer in their own words as well. Ignored without options.'
1615
+ // brain_prompts.md §1: structured agent questions need no model). The app draws all three.
1616
+ pickMode: z2.enum(["one", "many", "rank"]).optional().describe(
1617
+ 'How the options are answered: "one" (the default) a pick, for alternatives; "many" a checklist, for independent options they may want several of; "rank" an order of all of them. Only with options.'
1544
1618
  ),
1545
- answers: z2.string().trim().regex(/^[0-9a-fA-F-]{8,36}$/).optional().describe(
1546
- "Your reply answers a question the person asked you: the id the conversation shows for it (8 characters or whole). Their question closes with this reply as its answer, and any decision of yours it was holding back goes back to them. parentId is optional here: the question's own Goal is used. The reply is sent to them as it is; to also ask something new, send that as its own ask."
1547
- )
1548
- }).strict();
1549
- var StartContactSchema = z2.object({
1550
- asks: z2.array(AskInputSchema).min(1).describe("The questions to pose, one per object. An ask with a parentId is filed on that Goal as it is; an ask naming no Goal starts a new Goal of yours."),
1551
- waiting: z2.enum(["none", "hard"]).default("none").describe("hard requests a call even when channel is notification; user permissions and ring cooldowns still apply."),
1552
- channel: z2.enum(["notification", "call"]).default("notification")
1553
- }).strict();
1554
- var ReceiveContactSchema = z2.object({
1555
- wait: z2.boolean().optional().describe(
1556
- "Only controls when this returns. true (the default when you send and acknowledge nothing): wait up to about 45 seconds for incoming communication addressed to you, and return as soon as some is available. false: return what is waiting now. It does not mean work is blocked, set urgency, or ask for a call. `waitOutcome` says which happened: `available`, `expired` (nothing arrived in the window; wait again without sending again), or `not_waited` (a hosted connection never holds a wait)."
1619
+ // WHAT THE QUESTION HOLDS UP (brain_prompts.md §2.1): replaces `waiting: 'hard'`. A question that
1620
+ // blocks work asks for a call (the person's settings and ring cooldowns still decide).
1621
+ workItBlocks: z2.array(z2.object({ blocked: NodeRef, action: BlockedAction, reason: reason.optional() }).strict().refine(actionFits, ACTION_FITS)).min(1).max(10).optional().describe(
1622
+ "The work that cannot go on until this is answered: a Goal's start or completion, or another Question's answer. Only for work truly blocked; it asks for a call. Leave it out for a question you can keep working around."
1557
1623
  ),
1624
+ userExplicitlyRequested
1625
+ };
1626
+ var refineQuestion = (q, ctx) => {
1627
+ refuseOverCaps(q.question, q.units, "question", ctx);
1628
+ if (q.pickMode && !q.options) ctx.addIssue({ code: z2.ZodIssueCode.custom, path: ["pickMode"], message: "pickMode comes only with options" });
1629
+ const ids = (q.options ?? []).map((o) => o.id);
1630
+ if (ids.some((id2) => id2) && (ids.some((id2) => !id2) || new Set(ids).size !== ids.length)) {
1631
+ ctx.addIssue({ code: z2.ZodIssueCode.custom, path: ["options"], message: "give every option a distinct id, or none" });
1632
+ }
1633
+ };
1634
+ var QuestionInputSchema = z2.object({
1635
+ questionId: z2.string().uuid().optional().describe("Optional: your own stable id for this question (a UUID), so a resend is the same question. Minted for you when omitted; the result returns it."),
1636
+ ...questionFields
1637
+ }).strict().superRefine(refineQuestion);
1638
+ var QuestionWireSchema = z2.object({ questionId: z2.string().uuid(), ...questionFields }).strict().superRefine(refineQuestion);
1639
+ var AnswerInputSchema = z2.object({
1640
+ questionId: questionHandle.describe("The Question you answer: its id as the event or the conversation shows it (8 characters or whole)."),
1641
+ answer: z2.object({
1642
+ text: z2.string().trim().min(1).describe(`Your answer in your own words, at most ${ASK_MAX} characters; the context goes in units.`),
1643
+ selectedOptionIds: z2.array(z2.string().trim().min(1)).min(1).max(6).optional().describe("The ids of the options you choose, when the Question offered options (in order, for a ranking).")
1644
+ }).strict(),
1645
+ units
1646
+ }).strict().superRefine((a, ctx) => refuseOverCaps(a.answer.text, a.units, "text", ctx));
1647
+ var QuestionDependencySchema = z2.object({
1648
+ questionId: questionHandle.describe("A Question you asked."),
1649
+ change: z2.enum(["add", "remove"]),
1650
+ blocked: NodeRef,
1651
+ action: BlockedAction,
1652
+ reason: reason.optional()
1653
+ }).strict().refine(actionFits, ACTION_FITS);
1654
+ var sendFields = {
1655
+ updates: z2.array(UpdateInputSchema).min(1).max(20).optional().describe(
1656
+ "News: progress, findings, a result. An update asks nothing. It reaches the person only when they asked for it (userExplicitlyRequested), when it answers something they said, or once its Goal is done; otherwise it is recorded as the Goal's progress and nobody is notified."
1657
+ ),
1658
+ answers: z2.array(AnswerInputSchema).min(1).max(20).optional().describe("Answers to Questions addressed to you."),
1659
+ withdrawQuestionIds: z2.array(questionHandle).min(1).max(10).optional().describe(
1660
+ "Questions you asked that no longer need an answer: you acted on them yourself, they no longer matter, or you asked wrongly. Each is cancelled, not answered: its card closes and nothing rings for it."
1661
+ ),
1662
+ questionDependencies: z2.array(QuestionDependencySchema).min(1).max(20).optional().describe(
1663
+ "Add or remove what a Question you asked holds up, after asking it."
1664
+ )
1665
+ };
1666
+ var ContactSchema = z2.object({
1667
+ ...sendFields,
1668
+ questions: z2.array(QuestionInputSchema).min(1).max(20).optional().describe("Questions for the person, one per object."),
1669
+ /** RECEIVING (2I, I2; brain_prompts.md §2.2): the events this agent handled. */
1558
1670
  ackEventIds: z2.array(z2.string().uuid()).min(1).max(100).optional().describe(
1559
- "The exact eventIds of the events you have handled: an acknowledgment (ACK). Reading alone acknowledges nothing, so an event comes back until you acknowledge it; after that the next batch can come. Each recipient acknowledges separately, for itself only. A Question you owe is answered (an ask with `answers`), never acknowledged away: that id is refused until it is answered."
1671
+ "The exact eventIds of the events you have handled: an acknowledgment (ACK). Reading alone acknowledges nothing, so an event comes back until you acknowledge it; after that the next batch can come. Each recipient acknowledges separately, for itself only. A Question you owe is answered (answers), never acknowledged away."
1672
+ ),
1673
+ wait: z2.boolean().optional().describe(
1674
+ "Only controls when this returns. Sending: false (the default) returns at once; true waits up to about 45 seconds for a response to what you sent. Sending nothing: true (the default) waits up to about 45 seconds for anything addressed to you; false returns what is waiting now. It does not mean work is blocked, set urgency, or ask for a call. `waitOutcome` says which happened: `available`, `expired` (nothing arrived; wait again without sending again), or `not_waited`."
1560
1675
  )
1561
1676
  }).strict();
1562
- var ContactSchema = z2.union([StartContactSchema, z2.object({ deliveryId: z2.string().uuid() }).strict(), ReceiveContactSchema]);
1677
+ var sendsAnything = (c) => !!(c.updates?.length || c.questions?.length || c.answers?.length || c.withdrawQuestionIds?.length || c.questionDependencies?.length);
1678
+ var ContactWireSchema = z2.object({
1679
+ operationId: z2.string().uuid(),
1680
+ ...sendFields,
1681
+ questions: z2.array(QuestionWireSchema).min(1).max(20).optional()
1682
+ }).strict().refine(sendsAnything, "a contact sends at least one update, question, answer, withdrawal or question dependency");
1563
1683
  var CONTACT_SCHEMA = { type: "object", ...mcpInputSchema(ContactSchema) };
1564
- var CONTACT_DESCRIPTION = "Contact the user with one or more asks/questions. Pass an array of asks (each with 'ask', optional 'options', 'select', 'id', 'parentId', 'repo'), plus channel:'notification'|'call', and waiting:'none'|'hard'. An ask that names a Goal (parentId) goes onto that Goal; one that names none starts a new Goal of yours. Notification returns immediately; collect answers by receiving (below). On stdio, a Call holds one cancellable ~45s window; continue with ONLY {deliveryId}. One question per 'ask'; several questions are several objects in 'asks'. Each ask is sent exactly as written, with no reading in between: a bundled ask arrives as one card, so separate questions are separate asks. An ask with no options that is not blocking is a report, never a claim on them, so no answer is owed and none should be awaited. A report reaches the person only when it answers something they asked you, or once the Goal is done; any other report is recorded as the Goal's progress and nobody is notified. So when the work is finished, mark the Goal done first, then send one message saying what is done and anything they need to do or check. On a Goal whose report card is still open, a report that does reach them is added to that card, with no new push. Send options (or waiting:'hard') when you actually need an answer. Each option's label must stand on its own \u2014 the person may see only the labels \u2014 so never a label that points into your text ('All three', 'Option 2', '1 and 3 only'). select:'many' makes the card a checklist, for independent options they may want several of; select:'one' (the default) a pick, for alternatives. The person can always answer in their own words, so never add an 'Other' option. If the person is already on a call, a contact that reaches them joins that call automatically \u2014 whatever channel you asked for, with no ring \u2014 and the Delivery it returns IS that call: reread it with contact({deliveryId}) to see everything answered on it so far, and contact again while it is live to add information or a further question to the same call.\n\nRECEIVING: contact with no asks sends nothing and returns `events`, a limited batch of what is addressed to you (not a history page): `question`, a Question you owe (answer it with an ask whose `answers` is its questionId); `update`, something new on one of your Goals (a reply, an answer: read it with get_goal); `instruction`, a request or note sent to you. `hasMore` says more are waiting. Reading acknowledges nothing: once you have handled events, confirm their eventIds with contact({ackEventIds}), and the next batch can come. contact({}) waits up to about 45 seconds for something to arrive; contact({wait:false}) returns at once. It also lists work given to you that nobody has started (`assigned`; claim_goal starts it) and your work gone quiet (`stalled`).";
1684
+ 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.
1685
+
1686
+ 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.
1687
+
1688
+ 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.
1689
+
1690
+ 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.
1691
+
1692
+ RECEIVING: a contact that sends nothing returns \`events\`, a limited batch of what is addressed to you (not a history page): \`question\`, a Question you owe (answer it in answers, with its questionId); \`update\`, something new on one of your Goals (a reply, an answer: read it with get_goal); \`instruction\`, a request or note sent to you. \`hasMore\` says more are waiting. Reading acknowledges nothing: once you have handled events, confirm their eventIds with contact({ackEventIds}), and the next batch can come. contact({}) waits up to about 45 seconds for something to arrive; contact({wait:false}) returns at once. It also lists work given to you that nobody has started (\`assigned\`; claim_goal starts it) and your work gone quiet (\`stalled\`).`;
1565
1693
  var CreateGoalSchema = z3.object({
1566
1694
  outcome: z3.string().trim().min(1).max(1e4),
1567
1695
  /** The work's NAME (#2115) — one to five words, how a person refers to it out loud ("the night
@@ -1595,21 +1723,11 @@ var UpdateGoalSchema = z3.object({
1595
1723
  state: z3.enum(["active", "done", "cancelled"]).optional(),
1596
1724
  progress: z3.string().trim().min(1).max(1e4).optional(),
1597
1725
  reviewed: z3.literal(true).optional(),
1598
- dueAt: z3.string().datetime({ offset: true }).nullable().optional(),
1599
- /** WITHDRAW YOUR OWN QUESTION (#2777, owner 2026-09-30). The question's id as every read shows it
1600
- * (the conversation's `id`, eight characters, or the whole request Entry id), on THIS Goal, asked
1601
- * by you and still open. It is cancelled, not answered: its cards close and nothing rings for it. */
1602
- withdraw: z3.array(z3.string().trim().regex(/^[0-9a-fA-F-]{8,36}$/)).min(1).max(10).optional()
1726
+ dueAt: z3.string().datetime({ offset: true }).nullable().optional()
1603
1727
  }).strict().refine((v) => Object.keys(v).length > 0),
1604
1728
  reason: z3.string().trim().min(1).max(2e3),
1605
1729
  operationId: z3.string().uuid().optional()
1606
1730
  }).strict();
1607
- var UpdateGoalToolSchema = z3.object({
1608
- goalId: z3.string().uuid(),
1609
- revision: UpdateGoalSchema.shape.revision,
1610
- changes: UpdateGoalSchema.shape.changes.innerType().pick({ progress: true, reviewed: true, dueAt: true, withdraw: true }).strict().refine((v) => Object.keys(v).length > 0),
1611
- reason: UpdateGoalSchema.shape.reason
1612
- }).strict();
1613
1731
  var changedGoal = z3.string().uuid().describe("The Goal to change, as a read shows it.");
1614
1732
  var goalTitle = z3.string().trim().min(1).max(80).describe("The Goal's short display name: one to five words, how a person refers to it out loud.");
1615
1733
  var goalOutcome = z3.string().trim().min(1).max(1e4).describe("The full desired result. There is no third description field.");
@@ -1627,7 +1745,7 @@ var StateChange = z3.object({ kind: z3.literal("state"), goalId: changedGoal, st
1627
1745
  ) }).strict();
1628
1746
  var AssignChange = z3.object({ kind: z3.literal("assign"), goalId: changedGoal, ownerId: z3.string().trim().min(1).describe("The new owner's participant.") }).strict();
1629
1747
  var DeferChange = z3.object({ kind: z3.literal("defer"), goalId: changedGoal, until: z3.string().datetime({ offset: true }).nullable().describe(
1630
- "Postpone it until this instant (its owner is woken then), or null to take the postponement back."
1748
+ "Postpone it until this instant: it waits until then, and its owner is woken when it passes (a promise to follow up later). null takes the postponement back."
1631
1749
  ) }).strict();
1632
1750
  var MoveChange = z3.object({ kind: z3.literal("move"), goalId: changedGoal, parentGoalId: z3.string().uuid().nullable().describe(
1633
1751
  "Its new parent, or null for a root. Only this Goal moves; its new parent's other children stay."
@@ -1662,7 +1780,7 @@ var ManageGoalsSchema = z3.object({
1662
1780
  var ManageGoalsToolSchema = z3.object({
1663
1781
  changes: z3.array(z3.discriminatedUnion("kind", [CreateChange, EditChange, StateChange, AssignChange, DeferChange, MoveChange, DependencyChange])).min(1).max(50).describe("The changes, applied in order, each on its own.")
1664
1782
  }).strict().superRefine((v, ctx) => editNames(v.changes, ctx));
1665
- var MANAGE_GOALS_DESCRIPTION = "Create, edit, assign, organize or close work. Every change here changes Goals; answering, withdrawing or asking Questions stays in contact. Each change applies independently: a refused one names why (`results[i].error`, e.g. goal_revision_conflict, goal_children_open, goal_not_joined, goal_not_found) and the rest still apply, so read every result: a partial result is never a complete success. Kinds: create (title, outcome, ownerId, parentGoalId, sourceEntryIds) returns the new Goal's id in `results[i].goalId`, in the order requested, to use in later calls; edit (title and/or outcome); state (open, completed, canceled); assign (ownerId); defer (until, or null); move (parentGoalId, or null for a root: only this Goal moves); dependency (add or remove: goalId waits on dependsOnGoalId to start or to complete). A Goal cannot be completed while its required children or dependencies remain open: finish or move them first. Finishing the children does not prove the parent's own work is done. An edit applies at the version you last read: if someone changed the Goal since, it is refused as goal_revision_conflict, so read it again (get_goal) and reconsider. You may change a Goal you own or have written on. Returns `ok` (every change applied), `results` per change (applied or failed), and `goals`, each changed Goal's id, state, title, outcome and revision.";
1783
+ var MANAGE_GOALS_DESCRIPTION = "Create, edit, assign, organize or close work. Every change here changes Goals; answering, withdrawing or asking Questions stays in contact. Each change applies independently: a refused one names why (`results[i].error`, e.g. goal_revision_conflict, goal_children_open, goal_not_joined, goal_not_found) and the rest still apply, so read every result: a partial result is never a complete success. Kinds: create (title, outcome, ownerId, parentGoalId, sourceEntryIds) returns the new Goal's id in `results[i].goalId`, in the order requested, to use in later calls; edit (title and/or outcome); state (open, completed, canceled); assign (ownerId); defer (until: the Goal waits until then and its owner is woken when it passes; null takes it back); move (parentGoalId, or null for a root: only this Goal moves); dependency (add or remove: goalId waits on dependsOnGoalId to start or to complete). A Goal cannot be completed while its required children or dependencies remain open: finish or move them first. Finishing the children does not prove the parent's own work is done. An edit applies at the version you last read: if someone changed the Goal since, it is refused as goal_revision_conflict, so read it again (get_goal) and reconsider. You may change a Goal you own or have written on. Returns `ok` (every change applied), `results` per change (applied or failed), and `goals`, each changed Goal's id, state, title, outcome and revision.";
1666
1784
  var ClaimGoalSchema = z3.object({ goalId: z3.string().uuid().optional() }).strict();
1667
1785
  var GetGoalSchema = z3.object({
1668
1786
  goalId: z3.string().uuid(),
@@ -1675,7 +1793,6 @@ var GetGoalSchema = z3.object({
1675
1793
  diagnose: z3.boolean().optional()
1676
1794
  }).strict();
1677
1795
  var GET_GOAL_DESCRIPTION = "Read one Goal without claiming it, including others (the ten most recent other contributors, with names, latest entry headlines and times): its outcome, state, revision, progress, blockers, the conversation on it (each question with its options and what was decided), `next`, the one step to take, and `more`, where to read further. A question in that conversation reads `open` (nothing yet), `answered` (a choice was made, and `answer` carries it), `replied` (they said something and the read settled the question on their words \u2014 NO option of yours was chosen, and the words are the reply line beside it, so read that before you act), or `closed`. The conversation carries everything the person said, every open question and your newest entry; your older entries are left out and counted \u2014 history: true reads every entry in full. Every Goal of your person is readable, whichever of their agents owns it; another account's Goals are not disclosed.\n\ndiagnose: true is for when a read has CONFUSED you \u2014 not for the working loop. It adds `diagnosis`, which asks every reader that already answers a question about your work and NAMES the reader behind every value, so you never guess which of two places to look: what state your work is really in (the stored `goals.state` beside the derived `goal_execution_state`, which can differ); whether anything is armed to ring and when (`ladder_candidates`, with the ladder's own last decision); whether a wake fired for you and what it did (durable `wake.*` events, beside when your process was last heard from); and what has reached you (`list_waiting` \u2014 review flags, unstarted work, open questions, the person's newest words). Read `diagnosis.disagreements` FIRST: each one is two readers giving different values for the same fact, with both values and both sources, and it never chooses between them \u2014 that is yours to do, from the Goal's own history. `diagnosis.looked` names every reader asked, including any that could not answer, so an empty answer is never confused with a broken one.";
1678
- var UPDATE_GOAL_DESCRIPTION = "Report work on a Goal you are on, at an exact revision: progress, review acknowledgement, when to wake for it, and withdrawing a question of yours. What the Goal is (its title, outcome, state, owner, parent, dependencies) changes with manage_goals. You are on a Goal you own, or one you have written on (an update with progress, or a contact on it); any of your person's agents may write on any of their Goals, and one that never touched a Goal is refused (409 goal_not_joined). Stale revisions are rejected. A CONTACT ON THIS GOAL MOVES ITS REVISION: a question filed on a Goal is a change to it, so an update prepared before a contact and sent after it is refused as stale (409 goal_revision_conflict) \u2014 re-read the Goal, then write. progress says where the work stands. reviewed: true acknowledges new evidence and closes the Deliveries addressed to you on that Goal, never over an open decision (contact({ackEventIds}) does the same for an `update` event). dueAt (an ISO instant, or null) makes the Goal wait until then; when it passes you are woken for it \u2014 use it for a promise to follow up later. withdraw: [questionId] takes back a question YOU asked on this Goal that is still open \u2014 because you acted on it yourself, it no longer matters, or you asked it wrongly (e.g. waiting: hard when nothing was blocked): it is cancelled, not answered, its card closes and it stops ringing; the id is the one the conversation shows. Returns the Goal as get_goal reads it, at its new revision.";
1679
1796
  var CLAIM_GOAL_DESCRIPTION = "Claim a pending answer to your question or the oldest runnable or review-pending Goal you own. Pass goalId to join any Goal of your person; its assignment stays unchanged. Read others before overlapping another agent\u2019s work. Joining lets you contribute and change it; use manage_goals (assign) when the assignment itself should change. Returns the Goal as get_goal reads it, and marks you as on it, which never shuts another agent out: other agents of your person may write on it and change it too, and two changes at once are told apart by revision (409 goal_revision_conflict).";
1680
1797
  var SearchToolSchema = z3.object({
1681
1798
  query: z3.string().trim().min(1).max(500),
@@ -1685,14 +1802,21 @@ var SearchToolSchema = z3.object({
1685
1802
  }).strict();
1686
1803
  var SEARCH_DESCRIPTION = "Search your person's history across all of their agents: Entries (what anyone said or wrote, typed or spoken on a call), Goals (by title and outcome) and Answers (found by their Question or by the words that gave them). query is words to look for; records sharing more of its words rank first, and exact names work. types narrows it to entry, goal and/or answer (default: all three). goalId searches under one Goal: its Entries, its Questions' Answers, and it and its immediate children. limit is matches per type, 1 to 20 (default 8). Read-only. Each match carries its whole saved words, its ID and its links (an Answer carries its Question, the choice made and the Entries that support it); `omitted` counts what matched but was left out, so narrow the words or add a goalId to see it. Nothing found is not proof that nothing exists; a refused search says why. Sealed (encrypted) content is never searched or returned.";
1687
1804
  var WhoIsWorkingSchema = z3.object({}).strict();
1805
+ var FEEDBACK_TEXT_MAX = 5e4;
1806
+ var SendFeedbackSchema = z3.object({
1807
+ text: z3.string().trim().min(1).max(FEEDBACK_TEXT_MAX).describe(`The report, in markdown: what happened, what was expected, how to reproduce it, versions, evidence. At most ${FEEDBACK_TEXT_MAX} characters.`),
1808
+ title: z3.string().trim().min(1).max(200).optional().describe("One line naming it."),
1809
+ kind: z3.enum(["bug", "idea", "other"]).default("other").describe("bug: something Paigy does wrong. idea: something it should do. other: anything else.")
1810
+ }).strict();
1811
+ 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.";
1688
1812
  var AGENT_TOOLS = [
1689
1813
  { name: "who_is_working", description: "Read your person's agents that contributed in the last 24 hours, newest first: at most 30 agents and their five most recently touched Goals, with their latest entry headline and time. Use get_goal to read a Goal and its other contributors before starting overlapping work. Read-only; no arguments.", inputSchema: mcpInputSchema(WhoIsWorkingSchema) },
1690
1814
  { name: "contact", description: CONTACT_DESCRIPTION, inputSchema: CONTACT_SCHEMA },
1691
1815
  { name: "manage_goals", description: MANAGE_GOALS_DESCRIPTION, inputSchema: mcpInputSchema(ManageGoalsToolSchema) },
1692
1816
  { name: "claim_goal", description: CLAIM_GOAL_DESCRIPTION, inputSchema: mcpInputSchema(ClaimGoalSchema) },
1693
1817
  { name: "get_goal", description: GET_GOAL_DESCRIPTION, inputSchema: mcpInputSchema(GetGoalSchema) },
1694
- { name: "update_goal", description: UPDATE_GOAL_DESCRIPTION, inputSchema: mcpInputSchema(UpdateGoalToolSchema) },
1695
- { name: "search", description: SEARCH_DESCRIPTION, inputSchema: mcpInputSchema(SearchToolSchema) }
1818
+ { name: "search", description: SEARCH_DESCRIPTION, inputSchema: mcpInputSchema(SearchToolSchema) },
1819
+ { name: "send_feedback", description: SEND_FEEDBACK_DESCRIPTION, inputSchema: mcpInputSchema(SendFeedbackSchema) }
1696
1820
  ];
1697
1821
  var AGENT_TOOL_NAMES = AGENT_TOOLS.map((t) => t.name);
1698
1822
  var id = z4.string().uuid();
@@ -1831,6 +1955,66 @@ var CompactResultSchema = z4.object({
1831
1955
  var COMPACT_RESULT_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
1832
1956
  zodToJsonSchema(CompactResultSchema, { $refStrategy: "none" })
1833
1957
  );
1958
+ var str2 = z5.string();
1959
+ var strs2 = z5.array(z5.string());
1960
+ var TalkerReplySchema = z5.object({
1961
+ /** What to say and send, messages to the person first: spoken in the order written. `to` is "user"
1962
+ * or an agent's handle; `about` names handles; `blocks` is the item a question to an agent must be
1963
+ * answered before ("" for none). */
1964
+ messages: z5.array(z5.object({ key: str2, to: str2, text: str2, about: strs2, blocks: str2 }).strict()),
1965
+ /** What the call does next: listen, hold (the person asked for a moment) or end (they asked to). */
1966
+ then: z5.enum(["listen", "hold", "end"]),
1967
+ /** Items the person's words settle: the item's handle, the chosen option IDs, the line handles. */
1968
+ answers: z5.array(z5.object({ item: str2, options: strs2, lines: strs2 }).strict()),
1969
+ /** The line handles that hold a new instruction from the person. */
1970
+ instruction: strs2,
1971
+ /** The line handles that ask for new work, a change to existing work, or a standing rule: the filer
1972
+ * reads only these (3e). */
1973
+ file: strs2,
1974
+ /** Evidence to fetch for a second round: a search, an item's full text, or an agent by name. */
1975
+ need: z5.object({ kind: z5.enum(["search", "item", "agent", ""]), text: str2 }).strict(),
1976
+ /** The handle of the item to explain ("" for none). */
1977
+ explain: str2
1978
+ }).strict();
1979
+ var TALKER_REPLY_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
1980
+ zodToJsonSchema(TalkerReplySchema, { $refStrategy: "none" })
1981
+ );
1982
+ var str3 = z6.string();
1983
+ var strs3 = z6.array(z6.string());
1984
+ var FilerReplySchema = z6.object({
1985
+ /** Which Goals each new line goes on: a line's handle and Goal handles (or keys of new Goals). */
1986
+ filed: z6.array(z6.object({ line: str3, goals: strs3 }).strict()),
1987
+ goals: z6.array(z6.object({
1988
+ op: z6.enum(["create", "edit", "complete", "cancel", "reopen", "assign", "defer", "move", "block", "unblock"]),
1989
+ key: str3,
1990
+ goal: str3,
1991
+ title: str3,
1992
+ outcome: str3,
1993
+ owner: str3,
1994
+ under: str3,
1995
+ until: str3,
1996
+ on: str3,
1997
+ gate: z6.enum(["start", "complete", "answer", ""]),
1998
+ why: str3
1999
+ }).strict()),
2000
+ questions: z6.array(z6.object({
2001
+ op: z6.enum(["create", "edit", "assign", "withdraw"]),
2002
+ key: str3,
2003
+ question: str3,
2004
+ text: str3,
2005
+ to: str3,
2006
+ goal: str3,
2007
+ options: z6.array(z6.object({ id: str3, label: str3 }).strict()),
2008
+ pick: z6.enum(["one", "many", "rank", "words", ""]),
2009
+ blocks: str3
2010
+ }).strict()),
2011
+ lessons: z6.array(z6.object({ op: z6.enum(["remember", "revise", "withdraw"]), lesson: str3, text: str3, scope: str3 }).strict()),
2012
+ /** Line handles whose words comment on Paigy itself. */
2013
+ feedback: strs3
2014
+ }).strict();
2015
+ var FILER_REPLY_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
2016
+ zodToJsonSchema(FilerReplySchema, { $refStrategy: "none" })
2017
+ );
1834
2018
  function entryWords(entry) {
1835
2019
  const content = entry.content;
1836
2020
  if (content && "sealed" in content) return "";
@@ -1848,19 +2032,36 @@ function entryWords(entry) {
1848
2032
  }
1849
2033
  return entry.sources.map((source) => source.text).join("\n");
1850
2034
  }
2035
+ function entryUnit(entry) {
2036
+ if (entry.kind !== "contribution" || !entry.aboutId) return null;
2037
+ const plain = entry.content && "plain" in entry.content ? entry.content.plain : null;
2038
+ if (!plain || typeof plain !== "object") return null;
2039
+ const { title, text } = plain;
2040
+ return typeof title === "string" && typeof text === "string" ? { title, body: text } : null;
2041
+ }
2042
+ function askUnits(request, entries) {
2043
+ return entries.flatMap((entry) => {
2044
+ if (entry.aboutId !== request.entryId || entry.authorParticipant !== request.authorParticipant) return [];
2045
+ const unit = entryUnit(entry);
2046
+ return unit ? [unit] : [];
2047
+ });
2048
+ }
1851
2049
  var LIVE_MS = 3 * 6e4;
1852
2050
  var WORKING_MS = 60 * 6e4;
1853
- var ContextSchema = z5.object({
1854
- title: z5.string().min(1).describe("One-line headline of what you need (required, non-empty)."),
1855
- description: z5.array(z5.string().min(1)).describe(
2051
+ var ContextSchema = z7.object({
2052
+ title: z7.string().min(1).describe("One-line headline of what you need (required, non-empty)."),
2053
+ description: z7.array(z7.string().min(1)).describe(
1856
2054
  "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."
1857
- )
2055
+ ),
2056
+ /** THE ASK'S UNITS (3c): its context as titled units, in order. The app lists the titles and opens
2057
+ * a body on a tap. Absent on an ask sent without units, which renders as before. */
2058
+ units: z7.array(z7.object({ title: z7.string(), body: z7.string() })).optional()
1858
2059
  });
1859
- var ParticipantSchema = z5.object({
1860
- kind: z5.enum(["human", "agent"]),
1861
- id: z5.string()
2060
+ var ParticipantSchema = z7.object({
2061
+ kind: z7.enum(["human", "agent"]),
2062
+ id: z7.string()
1862
2063
  });
1863
- var TransformSchema = z5.enum([
2064
+ var TransformSchema = z7.enum([
1864
2065
  "structure",
1865
2066
  // shape intent into an answer contract; pick channel/urgency — broker `ask`, `select` shapes, `points`
1866
2067
  "request_more",
@@ -1883,13 +2084,13 @@ var PAIGY_SELF = { kind: "agent", id: "paigy" };
1883
2084
  function isPaigy(ref) {
1884
2085
  return ref === participantRef(PAIGY_SELF);
1885
2086
  }
1886
- var VisualSchema = z5.object({
1887
- url: z5.string().url(),
1888
- label: z5.string().optional()
2087
+ var VisualSchema = z7.object({
2088
+ url: z7.string().url(),
2089
+ label: z7.string().optional()
1889
2090
  });
1890
- var NotifyLevelSchema = z5.enum(["inbox", "push", "banner", "call"]);
1891
- var SelectShapeSchema = z5.enum(["one", "many", "rank", "confirm", "text"]);
1892
- var ReceiptEventSchema = z5.enum([
2091
+ var NotifyLevelSchema = z7.enum(["inbox", "push", "banner", "call"]);
2092
+ var SelectShapeSchema = z7.enum(["one", "many", "rank", "confirm", "text"]);
2093
+ var ReceiptEventSchema = z7.enum([
1893
2094
  "delivered",
1894
2095
  // the bundle reached the recipient at some level
1895
2096
  "seen",
@@ -1919,47 +2120,47 @@ var ReceiptEventSchema = z5.enum([
1919
2120
  // be rewound by a writer that forgot to advance it.
1920
2121
  "restarted"
1921
2122
  ]);
1922
- var AttentionSchema = z5.object({
2123
+ var AttentionSchema = z7.object({
1923
2124
  urgency: NotifyLevelSchema,
1924
2125
  /** The required answer shape, or null for a plain notify that asks nothing back. */
1925
2126
  select: SelectShapeSchema.nullable(),
1926
2127
  /** Coverage contract (#396) — points the answer must address; null = none declared. */
1927
- points: z5.array(z5.string()).nullable(),
2128
+ points: z7.array(z7.string()).nullable(),
1928
2129
  /** Whether the ask blocks the sender — what lets arbitration escalate it on silence. */
1929
- blocking: z5.boolean(),
2130
+ blocking: z7.boolean(),
1930
2131
  /** Reserved (docs/model/model.md lists it): a response deadline. No row column yet — a later Phase 2
1931
2132
  * slice wires it; optional so today's rows/callers project cleanly. */
1932
- deadline: z5.string().datetime().nullable().optional()
2133
+ deadline: z7.string().datetime().nullable().optional()
1933
2134
  });
1934
- var NotifyRequestFields = z5.object({
2135
+ var NotifyRequestFields = z7.object({
1935
2136
  /** Plaintext message content. Present on the plaintext path (today's shape);
1936
2137
  * ABSENT on the E2EE path, where the sealed `envelope` below carries it. The
1937
2138
  * superRefine at the bottom enforces exactly one of the two. */
1938
2139
  context: ContextSchema.optional(),
1939
- options: z5.array(OptionInputSchema).min(OPTIONS_MIN).max(OPTIONS_MAX).optional().describe(
2140
+ options: z7.array(OptionSchema.omit({ id: true }).extend({ label: z7.string().trim().min(1).max(1e3) }).strict()).min(OPTIONS_MIN).max(OPTIONS_MAX).optional().describe(
1940
2141
  "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)."
1941
2142
  ),
1942
- points: z5.array(z5.string().min(1)).optional().describe(
2143
+ points: z7.array(z7.string().min(1)).optional().describe(
1943
2144
  "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."
1944
2145
  ),
1945
- visuals: z5.array(VisualSchema).optional().describe(
2146
+ visuals: z7.array(VisualSchema).optional().describe(
1946
2147
  "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."
1947
2148
  ),
1948
2149
  /** Git repo the agent is working in ("owner/name"). Local MCP fills this from the checkout — omit unless overriding. */
1949
- repo: z5.string().optional(),
2150
+ repo: z7.string().optional(),
1950
2151
  /** Git branch the agent is on. Local MCP fills this from the checkout — omit unless overriding. */
1951
- branch: z5.string().optional(),
2152
+ branch: z7.string().optional(),
1952
2153
  /** Continue an existing conversation — the id of any notification in it (its root
1953
2154
  * is the conversation's identity). Omitted = start a new conversation. Renamed
1954
2155
  * from `parentId` (2026-08-03): one linkage system, the parent; the API edge
1955
2156
  * still accepts the old name from older clients. */
1956
- parentId: z5.string().uuid().optional(),
2157
+ parentId: z7.string().uuid().optional(),
1957
2158
  /** The durable outcome this contact advances. Optional during the notification-to-Work
1958
2159
  * migration; when present, a blocking ask creates a DecisionNeed for this Work. */
1959
- workId: z5.string().uuid().optional(),
2160
+ workId: z7.string().uuid().optional(),
1960
2161
  /** Target Goal scope. During staged migration this is accepted by the shared contract but
1961
2162
  * target delivery activation remains model-gated; workId and goalId are mutually exclusive. */
1962
- goalId: z5.string().uuid().optional(),
2163
+ goalId: z7.string().uuid().optional(),
1963
2164
  urgency: NotifyLevelSchema.default("inbox").describe(
1964
2165
  "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."
1965
2166
  ),
@@ -1967,7 +2168,7 @@ var NotifyRequestFields = z5.object({
1967
2168
  * visible and marks it needs_input. Renamed from the old `parentId` (2026-08-03)
1968
2169
  * when `parentId` became the conversation handle: `parentId` says WHERE, this
1969
2170
  * says HOW. */
1970
- clarifies: z5.string().optional(),
2171
+ clarifies: z7.string().optional(),
1971
2172
  select: SelectShapeSchema.optional().describe(
1972
2173
  "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."
1973
2174
  ),
@@ -1981,20 +2182,20 @@ var NotifyRequestFields = z5.object({
1981
2182
  // (docs/brain/broker/agenda-design.md) — not by a wire cap the agent has to pre-summarize under.
1982
2183
  // Owner, 2026-07-28: "our actual limitation on how long something is to the user should
1983
2184
  // come from the broker splitting and summarizing." The cap that remains is a size guard.
1984
- ask: z5.string().min(1).max(1e4).optional().describe(
2185
+ ask: z7.string().min(1).max(1e4).optional().describe(
1985
2186
  '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.'
1986
2187
  ),
1987
- needs: z5.array(z5.string().min(1)).optional().describe(
2188
+ needs: z7.array(z7.string().min(1)).optional().describe(
1988
2189
  "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."
1989
2190
  ),
1990
- urgencyHint: z5.enum(["whenever", "soon", "now"]).optional().describe(
2191
+ urgencyHint: z7.enum(["whenever", "soon", "now"]).optional().describe(
1991
2192
  "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."
1992
2193
  ),
1993
2194
  /** #575: the ONE self-report that replaces urgencyHint + blocking — what happens
1994
2195
  * to the agent's work while it waits. Normalized server-side into those two
1995
2196
  * fields (normalizeWaiting) so everything downstream is untouched; explicit
1996
2197
  * urgencyHint/blocking win when both are sent. */
1997
- waiting: z5.enum(["none", "soft", "hard"]).optional().describe(
2198
+ waiting: z7.enum(["none", "soft", "hard"]).optional().describe(
1998
2199
  "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."
1999
2200
  ),
2000
2201
  /** Δ9b (#895): HOLD this claim so the sender can correct the plan before anyone is
@@ -2002,98 +2203,98 @@ var NotifyRequestFields = z5.object({
2002
2203
  * holding by default would charge every quiet claim that minute before any agent could
2003
2204
  * correct anything. Ignored for `waiting: 'hard'`: a blocking ask rings on what we have,
2004
2205
  * and the enrichment can still land mid-call (#781 re-plans the unspoken tail). */
2005
- confirm: z5.boolean().optional().describe(
2206
+ confirm: z7.boolean().optional().describe(
2006
2207
  "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'."
2007
2208
  ),
2008
2209
  /** #575: a RELAY of the user's explicitly stated preference, never the agent's
2009
2210
  * choice. Outranks waiting in both directions: 'call' rings even for a
2010
2211
  * waiting:'none' "call me when it's done"; 'message' never rings even for
2011
2212
  * waiting:'hard'. */
2012
- channel: z5.enum(["call", "message"]).optional().describe(
2213
+ channel: z7.enum(["call", "message"]).optional().describe(
2013
2214
  "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."
2014
2215
  ),
2015
- confirmStyle: z5.enum(["yesno", "approve"]).default("yesno").describe(
2216
+ confirmStyle: z7.enum(["yesno", "approve"]).default("yesno").describe(
2016
2217
  "Labels for a select:'confirm' paige \u2014 'yesno' (Yes/No) or 'approve' (Approve/Deny). Ignored unless select is 'confirm'."
2017
2218
  ),
2018
- blocking: z5.boolean().default(false).describe(
2219
+ blocking: z7.boolean().default(false).describe(
2019
2220
  "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."
2020
2221
  )
2021
2222
  });
2022
2223
  var NotifyRequestSchema = NotifyRequestFields.superRefine((r, ctx) => {
2023
- if (r.workId && r.goalId) ctx.addIssue({ code: z5.ZodIssueCode.custom, path: ["goalId"], message: "pass goalId or workId, not both" });
2224
+ if (r.workId && r.goalId) ctx.addIssue({ code: z7.ZodIssueCode.custom, path: ["goalId"], message: "pass goalId or workId, not both" });
2024
2225
  if (r.ask !== void 0) {
2025
2226
  for (const f of ["context", "select", "points"]) {
2026
2227
  if (r[f] !== void 0)
2027
- ctx.addIssue({ code: z5.ZodIssueCode.custom, path: [f], message: `the simplified \`ask\` form takes no ${f} \u2014 the broker derives the answer shape from your prose. Drop ${f} and say it in \`ask\` instead ("should I\u2026" for approve/deny, "which of these\u2026" for a pick), passing \`options\` when you're offering concrete alternatives.` });
2228
+ ctx.addIssue({ code: z7.ZodIssueCode.custom, path: [f], message: `the simplified \`ask\` form takes no ${f} \u2014 the broker derives the answer shape from your prose. Drop ${f} and say it in \`ask\` instead ("should I\u2026" for approve/deny, "which of these\u2026" for a pick), passing \`options\` when you're offering concrete alternatives.` });
2028
2229
  }
2029
2230
  return;
2030
2231
  }
2031
2232
  if (r.needs !== void 0 || r.urgencyHint !== void 0)
2032
- ctx.addIssue({ code: z5.ZodIssueCode.custom, path: ["needs"], message: "needs/urgencyHint belong to the simplified `ask` form \u2014 with a shaped request use points/urgency" });
2233
+ ctx.addIssue({ code: z7.ZodIssueCode.custom, path: ["needs"], message: "needs/urgencyHint belong to the simplified `ask` form \u2014 with a shaped request use points/urgency" });
2033
2234
  if (!r.context)
2034
- ctx.addIssue({ code: z5.ZodIssueCode.custom, path: ["context"], message: "context is required (plaintext path)" });
2235
+ ctx.addIssue({ code: z7.ZodIssueCode.custom, path: ["context"], message: "context is required (plaintext path)" });
2035
2236
  if (!r.select)
2036
- ctx.addIssue({ code: z5.ZodIssueCode.custom, path: ["select"], message: "select is required on the shaped form" });
2237
+ ctx.addIssue({ code: z7.ZodIssueCode.custom, path: ["select"], message: "select is required on the shaped form" });
2037
2238
  const needsOptions = r.select === "one" || r.select === "many" || r.select === "rank";
2038
2239
  if (needsOptions && !r.options?.length)
2039
- ctx.addIssue({ code: z5.ZodIssueCode.custom, path: ["options"], message: `select:'${r.select}' requires options` });
2240
+ ctx.addIssue({ code: z7.ZodIssueCode.custom, path: ["options"], message: `select:'${r.select}' requires options` });
2040
2241
  if (!needsOptions && r.options?.length)
2041
- ctx.addIssue({ code: z5.ZodIssueCode.custom, path: ["options"], message: `select:'${r.select}' takes no options` });
2242
+ ctx.addIssue({ code: z7.ZodIssueCode.custom, path: ["options"], message: `select:'${r.select}' takes no options` });
2042
2243
  });
2043
- var NotifyStatusSchema = z5.enum(["pending", "answered", "ignored"]);
2044
- var AgentStateSchema = z5.enum(["idle", "in_progress", "completed", "needs_input"]);
2045
- var TurnSchema = z5.object({
2046
- prompt: z5.string(),
2047
- reply: z5.string()
2244
+ var NotifyStatusSchema = z7.enum(["pending", "answered", "ignored"]);
2245
+ var AgentStateSchema = z7.enum(["idle", "in_progress", "completed", "needs_input"]);
2246
+ var TurnSchema = z7.object({
2247
+ prompt: z7.string(),
2248
+ reply: z7.string()
2048
2249
  });
2049
- var UserAnswerSchema = z5.discriminatedUnion("kind", [
2050
- z5.object({ kind: z5.literal("option"), optionId: z5.string(), label: z5.string().optional() }),
2051
- z5.object({ kind: z5.literal("text"), text: z5.string() }),
2052
- z5.object({ kind: z5.literal("ignored") }),
2053
- z5.object({ kind: z5.literal("multi"), optionIds: z5.array(z5.string()), labels: z5.array(z5.string()).optional() }),
2054
- z5.object({ kind: z5.literal("ranked"), optionIds: z5.array(z5.string()), labels: z5.array(z5.string()).optional() }),
2055
- z5.object({ kind: z5.literal("clarify"), chunks: z5.array(z5.string()).min(1) }),
2056
- z5.object({ kind: z5.literal("confirm"), approved: z5.boolean() }),
2057
- z5.object({ kind: z5.literal("turns"), turns: z5.array(TurnSchema).min(1) }),
2250
+ var UserAnswerSchema = z7.discriminatedUnion("kind", [
2251
+ z7.object({ kind: z7.literal("option"), optionId: z7.string(), label: z7.string().optional() }),
2252
+ z7.object({ kind: z7.literal("text"), text: z7.string() }),
2253
+ z7.object({ kind: z7.literal("ignored") }),
2254
+ z7.object({ kind: z7.literal("multi"), optionIds: z7.array(z7.string()), labels: z7.array(z7.string()).optional() }),
2255
+ z7.object({ kind: z7.literal("ranked"), optionIds: z7.array(z7.string()), labels: z7.array(z7.string()).optional() }),
2256
+ z7.object({ kind: z7.literal("clarify"), chunks: z7.array(z7.string()).min(1) }),
2257
+ z7.object({ kind: z7.literal("confirm"), approved: z7.boolean() }),
2258
+ z7.object({ kind: z7.literal("turns"), turns: z7.array(TurnSchema).min(1) }),
2058
2259
  /** An auto-answer derived from the user's PAST decisions (docs/brain/broker/precedent-design.md §2):
2059
2260
  * delivered through the same settle/await path as a human answer, carrying the judge's
2060
2261
  * derivation and the precedent ids it grew from. Always paired with a visible trail
2061
2262
  * card the user can reply to — the broker never overrides the user. */
2062
- z5.object({ kind: z5.literal("precedent"), answer: z5.string(), derivation: z5.string(), sources: z5.array(z5.string()).min(1) })
2263
+ z7.object({ kind: z7.literal("precedent"), answer: z7.string(), derivation: z7.string(), sources: z7.array(z7.string()).min(1) })
2063
2264
  ]);
2064
- var IntentSchema = z5.object({
2265
+ var IntentSchema = z7.object({
2065
2266
  // The full vocabulary the bot's mapper emits (mapper.INTENT_KINDS) — the schema lagged
2066
2267
  // it by two ("detail", "feedback"), and because the settle handler parsed the array
2067
2268
  // all-or-nothing, ONE feedback act silently dropped EVERY intent on the call,
2068
2269
  // questions included. Found auditing five calls' stored feedback, 2026-08-01.
2069
- kind: z5.enum(["defer", "delegate", "channel", "question", "detail", "feedback", "command", "control"]),
2070
- detail: z5.string(),
2270
+ kind: z7.enum(["defer", "delegate", "channel", "question", "detail", "feedback", "command", "control"]),
2271
+ detail: z7.string(),
2071
2272
  /** Defer only: seconds until the callback the caller asked for, when something upstream
2072
2273
  * already read the time. Nothing sets it today (#397 documented an MCP parser that was
2073
2274
  * never written) — the API reads the defer's `detail` itself with `notes/when.ts`
2074
2275
  * (`parseDelay`, #1292), and a value here simply wins over that reading. */
2075
- dueInSeconds: z5.number().int().positive().optional(),
2276
+ dueInSeconds: z7.number().int().positive().optional(),
2076
2277
  /** Feedback only (#812): WHICH failure the complaint names — typed by the mapper that
2077
2278
  * already read the utterance, so `signals.kind` stops defaulting to
2078
2279
  * 'other' on every row. A table that records that something was wrong and nothing
2079
2280
  * about what cannot answer "is the bot looping less this week?". */
2080
- fault: z5.enum(["loop", "unanswered", "overridden", "misheard", "slow", "other"]).optional()
2281
+ fault: z7.enum(["loop", "unanswered", "overridden", "misheard", "slow", "other"]).optional()
2081
2282
  });
2082
- var RideAlongSchema = z5.object({
2283
+ var RideAlongSchema = z7.object({
2083
2284
  /** The note this came from — assign/clarify/close it through /api/notes/:id. */
2084
- noteId: z5.string(),
2285
+ noteId: z7.string(),
2085
2286
  /** What to do, in the owner's own words (the note's headline). Never model-rewritten. */
2086
- text: z5.string(),
2287
+ text: z7.string(),
2087
2288
  /** The thread to report back on, when the note was dispatched over the request rail. */
2088
- parentId: z5.string().nullable()
2289
+ parentId: z7.string().nullable()
2089
2290
  });
2090
- var AwaitItemSchema = z5.discriminatedUnion("type", [
2091
- z5.object({
2092
- type: z5.literal("reply"),
2093
- parentId: z5.string(),
2094
- notificationId: z5.string(),
2095
- workId: z5.string().uuid().optional(),
2096
- decisionId: z5.string().uuid().optional(),
2291
+ var AwaitItemSchema = z7.discriminatedUnion("type", [
2292
+ z7.object({
2293
+ type: z7.literal("reply"),
2294
+ parentId: z7.string(),
2295
+ notificationId: z7.string(),
2296
+ workId: z7.string().uuid().optional(),
2297
+ decisionId: z7.string().uuid().optional(),
2097
2298
  answer: UserAnswerSchema,
2098
2299
  /** WHAT THE AGENT CANNOT KNOW FROM THE FIELDS BESIDE IT (owner, 2026-09-04, issue
2099
2300
  * #1537). One line, built from the record: the ask and the caller's reply VERBATIM,
@@ -2103,103 +2304,103 @@ var AwaitItemSchema = z5.discriminatedUnion("type", [
2103
2304
  * "call me back after you merge" in their own words decides for itself what to do,
2104
2305
  * and now knows exactly which call to make. Absent when either half is missing —
2105
2306
  * a sentence with a hole in it is worse than no sentence. */
2106
- note: z5.string().optional(),
2307
+ note: z7.string().optional(),
2107
2308
  /** The call record rendered for THIS agent (`docs/brain/voice/record-design.md`): the words the
2108
2309
  * shaped answer was mapped from, filtered to its own claims. There is no second list
2109
2310
  * of labels beside it — the acts went 2026-09-04 and `intents` went with them (owner,
2110
2311
  * 2026-09-04): the agent reads the sentence and decides. */
2111
- transcript: z5.string().optional(),
2312
+ transcript: z7.string().optional(),
2112
2313
  /** Coverage report (#396), when the ask declared `points`: which of them this
2113
2314
  * answer addressed. Missing points = re-ask or proceed knowingly partial. */
2114
- covered: z5.array(z5.string()).optional(),
2315
+ covered: z7.array(z7.string()).optional(),
2115
2316
  /** Ride-alongs (RideAlongSchema) — pending work for you, attached to the moment you
2116
2317
  * became free. Only `reply` and `idle` carry it: those are the two outcomes that
2117
2318
  * END a wait. `remind`, `superseded` and `turn` are mid-flight, and handing an
2118
2319
  * agent a side-quest while it is still holding the line is how the main thing gets
2119
2320
  * dropped. Absent/empty = nothing owed. */
2120
- also: z5.array(RideAlongSchema).optional()
2321
+ also: z7.array(RideAlongSchema).optional()
2121
2322
  }),
2122
- z5.object({
2123
- type: z5.literal("remind"),
2124
- parentId: z5.string(),
2125
- notificationId: z5.string(),
2126
- remindAt: z5.string().datetime({ offset: true }),
2323
+ z7.object({
2324
+ type: z7.literal("remind"),
2325
+ parentId: z7.string(),
2326
+ notificationId: z7.string(),
2327
+ remindAt: z7.string().datetime({ offset: true }),
2127
2328
  /** Seconds until remindAt, server-computed — pass straight to ScheduleWakeup. */
2128
- remindInSeconds: z5.number()
2329
+ remindInSeconds: z7.number()
2129
2330
  }),
2130
2331
  /** The awaited ask was REPLACED by a newer notification on its thread (e.g. a
2131
2332
  * post-feedback revision, #633) — the user will never answer this id. Stop
2132
2333
  * awaiting it; the live ask is the thread's newest turn (await that one, or
2133
2334
  * re-orient via contact({})). */
2134
- z5.object({
2135
- type: z5.literal("superseded"),
2136
- parentId: z5.string(),
2137
- notificationId: z5.string()
2335
+ z7.object({
2336
+ type: z7.literal("superseded"),
2337
+ parentId: z7.string(),
2338
+ notificationId: z7.string()
2138
2339
  }),
2139
2340
  /** A LIVE call's turn, streamed as it lands (#783). PROVISIONAL: the user can still
2140
2341
  * revise any of these until the final reply arrives — partial = intelligence,
2141
2342
  * settled = authorization. Use it to PREPARE (fetch, draft, warm), never to act
2142
2343
  * irreversibly. If `acts` carries a question aimed at you and you know the answer,
2143
2344
  * contact on the same thread right away — the caller hears it on the same call. */
2144
- z5.object({
2145
- type: z5.literal("partial"),
2146
- notificationId: z5.string(),
2147
- inFlight: z5.literal(true),
2148
- turn: z5.object({
2149
- idx: z5.number(),
2150
- prompt: z5.string(),
2151
- reply: z5.string(),
2152
- acts: z5.array(IntentSchema).nullable().optional()
2345
+ z7.object({
2346
+ type: z7.literal("partial"),
2347
+ notificationId: z7.string(),
2348
+ inFlight: z7.literal(true),
2349
+ turn: z7.object({
2350
+ idx: z7.number(),
2351
+ prompt: z7.string(),
2352
+ reply: z7.string(),
2353
+ acts: z7.array(IntentSchema).nullable().optional()
2153
2354
  })
2154
2355
  }),
2155
- z5.object({
2156
- type: z5.literal("idle"),
2157
- also: z5.array(RideAlongSchema).optional(),
2356
+ z7.object({
2357
+ type: z7.literal("idle"),
2358
+ also: z7.array(RideAlongSchema).optional(),
2158
2359
  /** Is a call live for this agent's user right now? The SDK polls the partial stream
2159
2360
  * (#783) between idle ticks ONLY while this is not `false` — a partial can only exist
2160
2361
  * during a live call, and polling for one on a banner/message was a wasted HTTP call +
2161
2362
  * 3 queries on every idle tick of every waiting agent (~80% of all traffic at scale).
2162
2363
  * Absent = an older API → the SDK keeps polling, exactly as before. */
2163
- inFlight: z5.boolean().optional()
2364
+ inFlight: z7.boolean().optional()
2164
2365
  })
2165
2366
  ]);
2166
- var VoiceKeySchema = z5.enum(["rachel", "george", "jessica", "brian", "lily"]);
2167
- var AgendaTurnSchema = z5.object({
2367
+ var VoiceKeySchema = z7.enum(["rachel", "george", "jessica", "brian", "lily"]);
2368
+ var AgendaTurnSchema = z7.object({
2168
2369
  /** THE TURN'S IDENTITY (the first-sentence stream, 2026-09-09): the brain call that wrote
2169
2370
  * it and its place in that reply — `<brainCallId>:<index>`, with `:p` on the first
2170
2371
  * sentence a re-plan publishes ahead of the rest. A turn is spoken once, by this id: the
2171
2372
  * completion of a streamed re-plan carries the published sentence again, and the walk
2172
2373
  * drops what it already said by identity, never by the API's guess of what was polled.
2173
2374
  * Absent on plans nothing streams (a ring plan, a floor). */
2174
- id: z5.string().optional(),
2375
+ id: z7.string().optional(),
2175
2376
  /** Twin coverage (#1089): sibling claim ids this asking turn's answer ALSO settles —
2176
2377
  * the planner declares duplicates instead of asking them twice. */
2177
- coveredIds: z5.array(z5.string()).optional(),
2378
+ coveredIds: z7.array(z7.string()).optional(),
2178
2379
  /** The spoken sentences of the turn, in order. No count: how long a turn is is the brain's call
2179
2380
  * (owner, 2026-09-25), and a count here refused whole plans. */
2180
- info: z5.array(z5.string().min(1)).default([]),
2181
- question: z5.string().min(1).nullable(),
2381
+ info: z7.array(z7.string().min(1)).default([]),
2382
+ question: z7.string().min(1).nullable(),
2182
2383
  /** True on the one turn carrying the agent's own declared question. */
2183
- asks: z5.boolean().optional(),
2384
+ asks: z7.boolean().optional(),
2184
2385
  /** The claim this turn belongs to (#781) — the RETURN identity: answers route by it.
2185
2386
  * Absent on a single-claim plan (the session's own claim) and on shared context turns,
2186
2387
  * which route nothing. */
2187
- claimId: z5.string().optional(),
2388
+ claimId: z7.string().optional(),
2188
2389
  /** The claim's voice key (#462) — the OUTBOUND identity, audible who-is-asking. */
2189
- voice: z5.string().optional(),
2390
+ voice: z7.string().optional(),
2190
2391
  /** The claim's AGENT NAME (#838) — the spoken identity. A voice alone doesn't say
2191
2392
  * whose request this is: an item that folded in from another agent arrived as a bare
2192
2393
  * non-sequitur ("First real production sign-in is yours to make whenever you want.")
2193
2394
  * and the owner answered "What?". The bot names the agent before its first turn. */
2194
- agent: z5.string().optional(),
2395
+ agent: z7.string().optional(),
2195
2396
  /** The claim's agent by ID — the pairing's connection id (`notifications.token_id`), the
2196
2397
  * same id a face is minted from. A name is not an identity: two pairings may be called
2197
2398
  * "Claude", and a name cannot be joined on. The record's entries carry it (`agent_id`)
2198
2399
  * so "who said that" survives the call, and it rides PER TURN because a coalesced call
2199
2400
  * speaks for several agents — the turn is the only place that knows which. */
2200
- agentId: z5.string().optional(),
2401
+ agentId: z7.string().optional(),
2201
2402
  select: SelectShapeSchema.optional(),
2202
- options: z5.array(OptionSchema.omit({ id: true })).optional(),
2403
+ options: z7.array(OptionSchema.omit({ id: true })).optional(),
2203
2404
  /* `pace` STOOD HERE (#826). A turn could carry seconds and the model chose them. The walk
2204
2405
  paces itself now — a short beat between the sentences of a turn, the longer one at its end
2205
2406
  (owner, 2026-09-30: "remove the bot deciding pace") — and it does that where the words are
@@ -2208,33 +2409,33 @@ var AgendaTurnSchema = z5.object({
2208
2409
  /** Whether the walk WAITS for an answer before moving on. Absent = derived as today
2209
2410
  * (a question blocks, context flows). blocking:false on a question = ask and move
2210
2411
  * on, the claim stays pending; blocking:true on context = hold for a reply. */
2211
- blocking: z5.boolean().optional(),
2412
+ blocking: z7.boolean().optional(),
2212
2413
  /** SPOKEN ONLY IF THEY SAY NOTHING (owner, 2026-10-01, call 812de935: "you're gonna re-ask, but it
2213
2414
  * shouldn't be the same words … more like, hey, are you still there, or are you able to answer, or
2214
2415
  * would you need more information"). The walk holds this turn out of its queue; at the queue's end it
2215
2416
  * listens for the last word, and only if that listen is silent is this turn said and asked. If they
2216
2417
  * speak, it is dropped and their words are taken like any reply. */
2217
- ifSilent: z5.boolean().optional()
2418
+ ifSilent: z7.boolean().optional()
2218
2419
  });
2219
2420
  var CLAIM_STALE_MS = 30 * 6e4;
2220
- var InboxItemSchema = z5.object({
2221
- id: z5.string(),
2222
- tokenId: z5.string().optional(),
2421
+ var InboxItemSchema = z7.object({
2422
+ id: z7.string(),
2423
+ tokenId: z7.string().optional(),
2223
2424
  status: NotifyStatusSchema,
2224
2425
  context: ContextSchema,
2225
- options: z5.array(OptionSchema).optional(),
2426
+ options: z7.array(OptionSchema).optional(),
2226
2427
  /** The ask's declared coverage points (#396), when the agent sent them. */
2227
- points: z5.array(z5.string()).optional(),
2428
+ points: z7.array(z7.string()).optional(),
2228
2429
  /** Does this claim want an ANSWER, or is it telling you something? Written per row from
2229
2430
  * `requestAsks` — the agent's own declaration, not a guess. `false` is what earns a card
2230
2431
  * its acknowledge affordance: without it a status update offers a text box and a dismiss,
2231
2432
  * and neither of those is "got it" (owner, 2026-08-10). */
2232
- asks: z5.boolean().optional(),
2433
+ asks: z7.boolean().optional(),
2233
2434
  /** When a live process last pulsed for this row's agent — the liveness input for
2234
2435
  * "working requires a pulse" (#928): the list said "Working…" from agent_state alone
2235
2436
  * while the party called the same dead claim stalled. Absent = no token/no data,
2236
2437
  * which must never CLAIM stalled. */
2237
- lastSeenAt: z5.string().optional(),
2438
+ lastSeenAt: z7.string().optional(),
2238
2439
  /** WHEN THE AGENT LAST SAID ANYTHING ABOUT THIS CLAIM — the newest `agent_state` row in
2239
2440
  * the `notification_events` ledger (trigger-written since 20260621010000, so every row a
2240
2441
  * user can see has one). The age input for `CLAIM_STALE_MS`, and it has to be this rather
@@ -2244,7 +2445,7 @@ var InboxItemSchema = z5.object({
2244
2445
  * work. Reading the row's birth as the claim's age brands that "No update in 8h" the
2245
2446
  * instant the agent picks it up (#997). Absent = pre-trigger row; fall back to
2246
2447
  * `createdAt`. */
2247
- agentStateAt: z5.string().datetime().optional(),
2448
+ agentStateAt: z7.string().datetime().optional(),
2248
2449
  /** THE QUESTIONS A CALL CARRIES — the call screen's agenda spine (docs/clients/app/walk/design.md §11, owner
2249
2450
  * 2026-09-22). One per DecisionNeed on the Call, in the Call's order, answered or open (a
2250
2451
  * superseded or cancelled need is no longer a question anyone is asked). Present only on a
@@ -2258,54 +2459,54 @@ var InboxItemSchema = z5.object({
2258
2459
  * `turn` topic (`asking`, `settled`), because the bot never sees a DecisionNeed id. `title` is
2259
2460
  * the card's own concise heading; `answer` the accepted answer in words, null while open. It
2260
2461
  * REPLACED `agenda` (turns), which nothing ever filled. */
2261
- questions: z5.array(z5.object({
2262
- id: z5.string(),
2263
- entryId: z5.string(),
2264
- title: z5.string(),
2265
- state: z5.enum(["open", "answered"]),
2266
- answer: z5.string().nullable(),
2462
+ questions: z7.array(z7.object({
2463
+ id: z7.string(),
2464
+ entryId: z7.string(),
2465
+ title: z7.string(),
2466
+ state: z7.enum(["open", "answered"]),
2467
+ answer: z7.string().nullable(),
2267
2468
  /** WHO ASKED IT (owner, 2026-09-23, Goal a345e906: each agenda row wears its agent's face) — the
2268
2469
  * request Entry's author, as the same three facts the item's own `tokenId`/`name`/`voice`
2269
2470
  * carry for the call's one agent, so the phone draws it with the same seed. Absent when the
2270
2471
  * author is not an agent this account holds (unpaired since, or a person). */
2271
- agent: z5.object({ tokenId: z5.string(), name: z5.string(), voice: VoiceKeySchema.optional() }).optional(),
2472
+ agent: z7.object({ tokenId: z7.string(), name: z7.string(), voice: VoiceKeySchema.optional() }).optional(),
2272
2473
  /** ITS OPTIONS, WHEN THERE IS SOMETHING TO SEE (owner, 2026-09-25: "Yes, add it"): the options
2273
2474
  * its need offers, exactly as its own card carries them, present only when one of them has a
2274
2475
  * preview (`html` or `image`). The call screen opens them from the agenda row, so a preview is
2275
2476
  * never re-sent as a second card to be seen mid-call. Words-only options are absent — the bot
2276
2477
  * says those, and the list stays small (an `html` is up to 16 KB). */
2277
- options: z5.array(OptionSchema).optional()
2478
+ options: z7.array(OptionSchema).optional()
2278
2479
  })).optional(),
2279
- visuals: z5.array(VisualSchema).optional(),
2480
+ visuals: z7.array(VisualSchema).optional(),
2280
2481
  /** The connected agent's name (the single pairing name — user-typed, or the
2281
2482
  * agent's suggestion, or a default silly name). */
2282
- name: z5.string(),
2483
+ name: z7.string(),
2283
2484
  /** The pairing's assigned voice (#462); absent = the default voice. */
2284
2485
  voice: VoiceKeySchema.optional(),
2285
- repo: z5.string().optional(),
2286
- branch: z5.string().optional(),
2287
- createdAt: z5.string().datetime(),
2288
- snoozedUntil: z5.string().datetime().optional(),
2486
+ repo: z7.string().optional(),
2487
+ branch: z7.string().optional(),
2488
+ createdAt: z7.string().datetime(),
2489
+ snoozedUntil: z7.string().datetime().optional(),
2289
2490
  agentState: AgentStateSchema.default("idle"),
2290
2491
  /** Whose action the item is waiting on: "you" = an agent asked you (the default,
2291
2492
  * every agent→user notification); "agent" = you sent a request and it's awaiting the
2292
2493
  * agent (held in the inbox until the agent replies on the thread). */
2293
- turn: z5.enum(["you", "agent"]).default("you"),
2494
+ turn: z7.enum(["you", "agent"]).default("you"),
2294
2495
  /** Hard error reason on an awaiting request (turn="agent") — the wake failed to reach
2295
2496
  * the agent (provider-agnostic; set server-side). Absent = no hard error. Drives the inbox
2296
2497
  * error badge + Retry. */
2297
- error: z5.string().optional(),
2498
+ error: z7.string().optional(),
2298
2499
  /** WHEN THIS AGENT WORK WENT QUIET (turn="agent"), by the one rule (`coldSince`: three days
2299
2500
  * with nothing said), or absent while it is not stalled. The inbox's stalled badge reads
2300
2501
  * this and nothing else (2026-09-23: a 3-minute age rule badged every live Goal stalled,
2301
2502
  * and "dismiss the stalled ones" cancelled 37 pieces of live work). */
2302
- cold: z5.string().datetime().optional(),
2303
- clarifies: z5.string().optional(),
2503
+ cold: z7.string().datetime().optional(),
2504
+ clarifies: z7.string().optional(),
2304
2505
  /** THIS CARD'S QUESTION IS ON A LIVE CALL (owner, 2026-09-24: "Mark it while the call is
2305
2506
  * live"). Present only while an open Call Delivery carries the card's request Entry — read
2306
2507
  * off the same open list the card came from, so it clears when the Call does. A card is the
2307
2508
  * backup for a call not taken; while the call has it, the call is where it is answered. */
2308
- onCall: z5.literal(true).optional(),
2509
+ onCall: z7.literal(true).optional(),
2309
2510
  /** THE RING, ON THE ITEM (docs/clients/app/walk/design.md §12 §17, #2251): the last ring on this card was
2310
2511
  * declined, and what the ladder will do next — read off the cron's own row, never computed
2311
2512
  * on the phone. Present only while a `declined` receipt stands on the card's last Call.
@@ -2315,31 +2516,31 @@ var InboxItemSchema = z5.object({
2315
2516
  * It replaced `gaveUp` (deleted 2026-09-22): "the ladder spent" was a boolean the projection
2316
2517
  * never set, and it is `nextRingAt === null` here — the party's *Missed you* (`party/dress.ts`)
2317
2518
  * and the roster's `unreached` read `declinedAt`, and stand while it does. */
2318
- ring: z5.object({
2319
- declinedAt: z5.string().datetime(),
2320
- anchorAt: z5.string().datetime(),
2321
- nextRingAt: z5.string().datetime().nullable(),
2322
- step: z5.number().int()
2519
+ ring: z7.object({
2520
+ declinedAt: z7.string().datetime(),
2521
+ anchorAt: z7.string().datetime(),
2522
+ nextRingAt: z7.string().datetime().nullable(),
2523
+ step: z7.number().int()
2323
2524
  }).optional(),
2324
2525
  /** Why this arrived the way it did, read back off the delivery receipt (`notify/why.ts`).
2325
2526
  * Absent for anything never delivered through a push, and for older rows written before
2326
2527
  * the reason was recorded. Deliberately a debug affordance, shown small (owner,
2327
2528
  * 2026-08-07) — its real job is to give "this didn't need a call" something to be
2328
2529
  * feedback ABOUT. */
2329
- why: z5.object({
2530
+ why: z7.object({
2330
2531
  asked: NotifyLevelSchema,
2331
2532
  got: NotifyLevelSchema,
2332
- because: z5.enum(["unresponsive", "dismissed", "not_permitted", "silent", "coalesced", "agent_capped", "unplanned", "learned_raise"]).optional(),
2333
- line: z5.string()
2533
+ because: z7.enum(["unresponsive", "dismissed", "not_permitted", "silent", "coalesced", "agent_capped", "unplanned", "learned_raise"]).optional(),
2534
+ line: z7.string()
2334
2535
  }).optional(),
2335
- select: z5.enum(["one", "many", "rank", "confirm", "text"]).default("one"),
2336
- confirmStyle: z5.enum(["yesno", "approve"]).default("yesno").describe(
2536
+ select: z7.enum(["one", "many", "rank", "confirm", "text"]).default("one"),
2537
+ confirmStyle: z7.enum(["yesno", "approve"]).default("yesno").describe(
2337
2538
  "Labels for a select:'confirm' paige \u2014 'yesno' (Yes/No) or 'approve' (Approve/Deny). Ignored unless select is 'confirm'."
2338
2539
  ),
2339
2540
  /** Real downstream work is stuck behind this one — set by the agent, independent of
2340
2541
  * urgency (see the main README's "premier use case" + docs/delivery/notify/states.md). Drives the
2341
2542
  * inbox's blocking badge and the extra confirm step before dismissing it. */
2342
- blocking: z5.boolean().default(false),
2543
+ blocking: z7.boolean().default(false),
2343
2544
  /** The user's locked-in answer; present only for replied items (GET /api/replied/:id). */
2344
2545
  answer: UserAnswerSchema.optional(),
2345
2546
  /** THE TARGET FACTS A CARD RENDERS (#1796 point 5, 2026-09-11): the Delivery it is a view of,
@@ -2347,17 +2548,17 @@ var InboxItemSchema = z5.object({
2347
2548
  * for a request that asks nothing), whether its content is sealed, and that Goal's state. The
2348
2549
  * answer writer (`POST /api/entries`) and the disposition (`close_delivery`) take their ids from
2349
2550
  * here. The server projects it (`apps/api/src/inbox/project.ts`); a client never builds it. */
2350
- communication: z5.object({
2351
- deliveryId: z5.string(),
2352
- kind: z5.enum(["notification", "call"]),
2353
- entryId: z5.string(),
2354
- goalIds: z5.array(z5.string()),
2355
- decisionNeedId: z5.string().optional(),
2356
- sealed: z5.boolean(),
2357
- goalState: z5.string().optional(),
2551
+ communication: z7.object({
2552
+ deliveryId: z7.string(),
2553
+ kind: z7.enum(["notification", "call"]),
2554
+ entryId: z7.string(),
2555
+ goalIds: z7.array(z7.string()),
2556
+ decisionNeedId: z7.string().optional(),
2557
+ sealed: z7.boolean(),
2558
+ goalState: z7.string().optional(),
2358
2559
  /** THAT GOAL'S NAME (#2416) — what Activity's row is headed by, since a row there is one Goal
2359
2560
  * and the cards it holds sit behind it. Stamped by the same read as `goalState`. */
2360
- goalTitle: z5.string().optional()
2561
+ goalTitle: z7.string().optional()
2361
2562
  }).optional(),
2362
2563
  /** WHAT THIS CARD IS, IN TWELVE CHARACTERS (#3019) — the hash of every other field on it, stamped
2363
2564
  * by the one read that serves the open list (`apps/api/src/inbox/project.ts` `inboxFor`). It is
@@ -2369,27 +2570,27 @@ var InboxItemSchema = z5.object({
2369
2570
  * own moves (its Goal's state and name, how cold the work behind it has gone, whether a ring is
2370
2571
  * live). Optional, so a fixture, the demo and the archive lens need not spell one, and a card
2371
2572
  * with no rev is simply always re-sent. */
2372
- rev: z5.string().optional()
2573
+ rev: z7.string().optional()
2373
2574
  });
2374
2575
  var APNS_TOKEN_RE = /^[0-9a-fA-F]{64}$/;
2375
- var PushTokenSchema = z5.object({
2376
- voipToken: z5.string().min(1).optional(),
2377
- alertToken: z5.string().min(1).optional(),
2378
- fcmToken: z5.string().min(1).optional(),
2379
- platform: z5.enum(["ios", "android"])
2576
+ var PushTokenSchema = z7.object({
2577
+ voipToken: z7.string().min(1).optional(),
2578
+ alertToken: z7.string().min(1).optional(),
2579
+ fcmToken: z7.string().min(1).optional(),
2580
+ platform: z7.enum(["ios", "android"])
2380
2581
  }).superRefine((v, ctx) => {
2381
2582
  if (v.platform !== "ios") return;
2382
2583
  for (const field of ["voipToken", "alertToken"]) {
2383
2584
  const token = v[field];
2384
2585
  if (token === void 0 || APNS_TOKEN_RE.test(token)) continue;
2385
2586
  ctx.addIssue({
2386
- code: z5.ZodIssueCode.custom,
2587
+ code: z7.ZodIssueCode.custom,
2387
2588
  path: [field],
2388
2589
  message: `not an APNs device token (want 64 hex chars, got ${token.length})`
2389
2590
  });
2390
2591
  }
2391
2592
  });
2392
- var MissedCallSchema = z5.enum([
2593
+ var MissedCallSchema = z7.enum([
2393
2594
  "retry_10m",
2394
2595
  "retry_30m",
2395
2596
  "retry_60m",
@@ -2401,31 +2602,31 @@ var MissedCallSchema = z5.enum([
2401
2602
  ]);
2402
2603
  var clock = (h) => h === 0 ? "midnight" : h === 12 ? "noon" : h < 12 ? `${h} am` : `${h - 12} pm`;
2403
2604
  var QUIET = ` Nothing rings from ${clock(NIGHT.from)} to ${clock(NIGHT.to)} your time; the count waits for morning.`;
2404
- var BrokerTuningSchema = z5.object({
2605
+ var BrokerTuningSchema = z7.object({
2405
2606
  /** 'none' = skip the spoken ack after a mapped answer (power users find it slow). */
2406
- ackVerbosity: z5.enum(["normal", "none"]).optional(),
2607
+ ackVerbosity: z7.enum(["normal", "none"]).optional(),
2407
2608
  /** How readily the mapper asks its one clarification: 'low' = only when truly
2408
2609
  * uninterpretable, 'high' = whenever not fully certain. */
2409
- clarifyEagerness: z5.enum(["low", "normal", "high"]).optional(),
2610
+ clarifyEagerness: z7.enum(["low", "normal", "high"]).optional(),
2410
2611
  /** The user's own shorthand: when they say `say`, they mean `mean`. */
2411
- phrasebook: z5.array(z5.object({ say: z5.string().min(1).max(60), mean: z5.string().min(1).max(120) })).max(24).optional(),
2612
+ phrasebook: z7.array(z7.object({ say: z7.string().min(1).max(60), mean: z7.string().min(1).max(120) })).max(24).optional(),
2412
2613
  /** The language calls are PLANNED in, when the account has chosen one (#1272). Absent —
2413
2614
  * which is every account today — means the agent's own words decide, per ask: a call
2414
2615
  * about an English ask opens in English. This is the only thing that overrides that,
2415
2616
  * and a live caller who switches language mid-call still outranks it (broker/lang.ts).
2416
2617
  * Set per user (no UI yet), like `voiceTuning`. */
2417
- language: z5.enum(["en", "es"]).optional()
2618
+ language: z7.enum(["en", "es"]).optional()
2418
2619
  });
2419
- var UserSettingsSchema = z5.object({
2420
- permissions: z5.object({
2421
- call: z5.boolean(),
2422
- banner: z5.boolean(),
2423
- push: z5.boolean()
2620
+ var UserSettingsSchema = z7.object({
2621
+ permissions: z7.object({
2622
+ call: z7.boolean(),
2623
+ banner: z7.boolean(),
2624
+ push: z7.boolean()
2424
2625
  }),
2425
2626
  /** LockedIn / Default / DateNight on screen; the stored words are unchanged on purpose —
2426
2627
  * they are an enum on a live column across every account, and the rename is a rename of
2427
2628
  * what people read (owner, 2026-09-30). */
2428
- sessionMode: z5.enum(["default", "all_calls", "silent"]),
2629
+ sessionMode: z7.enum(["default", "all_calls", "silent"]),
2429
2630
  /** `silentPush` lived here until #2813 and is now GONE, field and column both. It was kept as an
2430
2631
  * optional long after DateNight stopped reading it, on the theory that a phone on an older
2431
2632
  * bundle PATCHing the whole settings object would be REFUSED for sending a key we had stopped
@@ -2434,7 +2635,7 @@ var UserSettingsSchema = z5.object({
2434
2635
  * an old bundle's `silentPush` is accepted and ignored. Worth remembering before keeping the
2435
2636
  * next dead field for the same reason. */
2436
2637
  /** Opt-in (default false) to using your content to improve Paigy and train models. */
2437
- improveConsent: z5.boolean(),
2638
+ improveConsent: z7.boolean(),
2438
2639
  missedCall: MissedCallSchema.default("backoff_standard"),
2439
2640
  /** Where voice audio is processed. 'hosted' (default) = Paigy's voice services
2440
2641
  * (ElevenLabs TTS, faster-whisper STT, the call bot); 'on_device' = the phone
@@ -2442,17 +2643,17 @@ var UserSettingsSchema = z5.object({
2442
2643
  * Optional, NOT defaulted: a stale client PATCHing the full settings object
2443
2644
  * must not silently reset this privacy choice. Absent = leave unchanged on
2444
2645
  * write, 'hosted' on read (see store.ts). */
2445
- voiceMode: z5.enum(["hosted", "on_device"]).optional(),
2646
+ voiceMode: z7.enum(["hosted", "on_device"]).optional(),
2446
2647
  /** Talk — after you answer, the next step is read aloud (docs/clients/app/walk/design.md §6). ALWAYS ON until
2447
2648
  * turned off (owner, 2026-09-18, #2249): a setting, not a per-walk toggle. Optional, NOT
2448
2649
  * defaulted, for the same reason `voiceMode` is: a stale client PATCHing the full settings
2449
2650
  * object must not silently turn it back on. Absent = leave unchanged on write, true on
2450
2651
  * read (see store.ts). */
2451
- talk: z5.boolean().optional(),
2652
+ talk: z7.boolean().optional(),
2452
2653
  /** CALL DIAGNOSTICS (owner, 2026-10-01): the call report carries each listen and the bot's own
2453
2654
  * load timings. SERVER-SET, no UI — on for every account that existed on 2026-10-01, off for
2454
2655
  * newer ones (migration 20261001132859). Read-only here: the settings PATCH never writes it. */
2455
- callDiagnostics: z5.boolean().optional(),
2656
+ callDiagnostics: z7.boolean().optional(),
2456
2657
  /** Per-user ring budget (#603): calls per rolling day before further calls
2457
2658
  * degrade to banner. Absent = the global default (25). A number, never a
2458
2659
  * bypass — every account keeps a ceiling. No UI; set per user for testing. */
@@ -2460,7 +2661,7 @@ var UserSettingsSchema = z5.object({
2460
2661
  * payload['tuning'] (e.g. { silence_s: 3.5 } — a longer pause window for a
2461
2662
  * slower speaker). No API-side semantics; the bot resolves each key with its
2462
2663
  * own defaults. Set per user (no UI yet); absent = bot defaults. */
2463
- voiceTuning: z5.record(z5.string(), z5.union([z5.number(), z5.string()])).optional(),
2664
+ voiceTuning: z7.record(z7.string(), z7.union([z7.number(), z7.string()])).optional(),
2464
2665
  /** The user's IANA timezone (e.g. "America/Bogota"), recorded by the app — it is the
2465
2666
  * only party that knows it. REMINDERS are why it exists: "remind me at ten" becomes
2466
2667
  * an absolute `due_at` only if we know whose ten. Optional and never defaulted, for
@@ -2469,53 +2670,53 @@ var UserSettingsSchema = z5.object({
2469
2670
  * that failure reads as the reminder rail being unreliable rather than as a missing
2470
2671
  * setting. Absent = a spoken time can't be landed, so the reminder rides the next
2471
2672
  * call — honest about what we know. */
2472
- timezone: z5.string().min(1).max(64).optional(),
2673
+ timezone: z7.string().min(1).max(64).optional(),
2473
2674
  /** Rung-2 broker tuning (#381). Optional and NOT defaulted, same stale-client
2474
2675
  * clobber guard as voiceMode: absent = leave unchanged on write. */
2475
2676
  broker: BrokerTuningSchema.optional()
2476
2677
  });
2477
- var HistoryWorkSchema = z5.object({
2478
- id: z5.string(),
2479
- title: z5.string(),
2480
- state: z5.enum(["done", "cancelled"]),
2678
+ var HistoryWorkSchema = z7.object({
2679
+ id: z7.string(),
2680
+ title: z7.string(),
2681
+ state: z7.enum(["done", "cancelled"]),
2481
2682
  /** Who held it (`agent:<tokenId>` or `human:<userId>`). */
2482
- assignee: z5.string()
2683
+ assignee: z7.string()
2483
2684
  });
2484
- var HistoryEntrySchema = z5.union([
2485
- z5.object({ at: z5.string(), card: InboxItemSchema }),
2486
- z5.object({ at: z5.string(), work: HistoryWorkSchema })
2685
+ var HistoryEntrySchema = z7.union([
2686
+ z7.object({ at: z7.string(), card: InboxItemSchema }),
2687
+ z7.object({ at: z7.string(), work: HistoryWorkSchema })
2487
2688
  ]);
2488
- var HistoryPageSchema = z5.object({
2489
- entries: z5.array(HistoryEntrySchema),
2490
- next: z5.string().nullable()
2689
+ var HistoryPageSchema = z7.object({
2690
+ entries: z7.array(HistoryEntrySchema),
2691
+ next: z7.string().nullable()
2491
2692
  });
2492
2693
  var ACTIVITY_LINES = 2;
2493
2694
  var ACTIVITY_LINE_MAX = 80;
2494
- var AgentActivitySchema = z5.object({
2695
+ var AgentActivitySchema = z7.object({
2495
2696
  /** Oldest first, so the newest line is last — the one that replaces in place. */
2496
- lines: z5.array(z5.string().max(ACTIVITY_LINE_MAX)).max(ACTIVITY_LINES),
2697
+ lines: z7.array(z7.string().max(ACTIVITY_LINE_MAX)).max(ACTIVITY_LINES),
2497
2698
  /** When the harness observed this tail. Its own timestamp, not the heartbeat's: a beat
2498
2699
  * that carries an UNCHANGED tail must not make a stalled agent look like it just moved. */
2499
- at: z5.string().datetime()
2700
+ at: z7.string().datetime()
2500
2701
  });
2501
- var ConnectionSummarySchema = z5.object({
2702
+ var ConnectionSummarySchema = z7.object({
2502
2703
  /** The connection = the agent's token id (used to address a request). */
2503
- id: z5.string(),
2704
+ id: z7.string(),
2504
2705
  /** The credential kind: "device" = a paired machine (mint-only — it hosts and mints, it
2505
2706
  * never talks); "agent" = an identity that sends. The roster and devices surfaces split
2506
2707
  * on this. Optional/absent reads as "agent" (a row predating the kind column). See
2507
2708
  * docs/server/tokens/devices-vs-agents-design.md. */
2508
- kind: z5.enum(["device", "agent"]).optional(),
2709
+ kind: z7.enum(["device", "agent"]).optional(),
2509
2710
  /** For an agent, the token id of the DEVICE that minted it — so agents group under their
2510
2711
  * machine, and revoking a device cascades to them. Null on devices, and on unlinked
2511
2712
  * agents (phone-launched, provider-managed, or minted before the link existed). */
2512
- mintedByDevice: z5.string().nullable().optional(),
2513
- device: z5.string().nullable(),
2713
+ mintedByDevice: z7.string().nullable().optional(),
2714
+ device: z7.string().nullable(),
2514
2715
  /** The agent's display name (the single pairing name). */
2515
- name: z5.string(),
2716
+ name: z7.string(),
2516
2717
  /** For a managed connection, the provider key (e.g. "cma") that agentOrigin maps to a
2517
2718
  * label; null for a local connection. Sourced from the token's provider, not the name. */
2518
- provider: z5.string().nullable(),
2719
+ provider: z7.string().nullable(),
2519
2720
  /** The pairing's assigned voice (#462); null = the default voice. */
2520
2721
  voice: VoiceKeySchema.nullable(),
2521
2722
  /** The LOUDEST this agent may ever reach you — a ceiling on `NOTIFY_LADDER`, set by the
@@ -2526,34 +2727,34 @@ var ConnectionSummarySchema = z5.object({
2526
2727
  * every surface at once and outranks even `sessionMode: all_calls` — a mode the user
2527
2728
  * set once must not overrule a rule they set about one agent. */
2528
2729
  reach: NotifyLevelSchema.nullable().optional(),
2529
- createdAt: z5.string().datetime(),
2730
+ createdAt: z7.string().datetime(),
2530
2731
  /** Most recent notification on this connection, either direction. Null = no contact yet.
2531
2732
  * Drives the agents-page recency grouping (Today / This week / …). */
2532
- lastContactAt: z5.string().datetime().nullable(),
2733
+ lastContactAt: z7.string().datetime().nullable(),
2533
2734
  /** Last presence heartbeat from a running agent process (POST /api/presence) — the
2534
2735
  * desktop app while open. Null = never seen; stale = offline. */
2535
- lastSeenAt: z5.string().datetime().nullable().optional(),
2736
+ lastSeenAt: z7.string().datetime().nullable().optional(),
2536
2737
  /** WORKING, NOT JUST CONNECTED (owner, 2026-09-30): the last time the agent itself acted on one of
2537
2738
  * its Goals — took its lease or recorded an operation (`tokens.last_worked_at`). Within
2538
2739
  * `WORKING_MS` it is working; otherwise it is connected but idle. Null = not seen working yet. */
2539
- lastWorkedAt: z5.string().datetime().nullable().optional(),
2740
+ lastWorkedAt: z7.string().datetime().nullable().optional(),
2540
2741
  /** The oldest of its Goals that is `ready` for it — work handed to it that nobody has started.
2541
2742
  * With no work of its own for `WORKING_MS`, an agent sitting on this is not taking its work. */
2542
- oldestReadyAt: z5.string().datetime().nullable().optional(),
2743
+ oldestReadyAt: z7.string().datetime().nullable().optional(),
2543
2744
  /** What a live desktop can run (docs/clients/desktop/companion.md §2.2), advertised on its heartbeat:
2544
2745
  * harness availabilities + granted workspaces — the option set the phone's
2545
2746
  * "new session" sheet offers. Absent for ordinary MCP agents. */
2546
- runtime: z5.object({
2747
+ runtime: z7.object({
2547
2748
  /** The @paigy/harness this host is running — a machine the self-update has not reached
2548
2749
  * shows its age here (`apps/desktop/src/update.ts`). */
2549
- version: z5.string().optional(),
2550
- harnesses: z5.array(z5.object({ name: z5.string(), label: z5.string(), status: z5.string() })).optional(),
2551
- workspaces: z5.array(z5.string()).optional(),
2750
+ version: z7.string().optional(),
2751
+ harnesses: z7.array(z7.object({ name: z7.string(), label: z7.string(), status: z7.string() })).optional(),
2752
+ workspaces: z7.array(z7.string()).optional(),
2552
2753
  /** THE GIT REPOS IN THOSE FOLDERS (2026-10-01, Goal 26982211): each granted folder that is a
2553
2754
  * repo, and each repo directly inside one, with its `origin` remote. A session started for
2554
2755
  * work on `mauurda/paigy` opens in that repo rather than the folder above it, where the repo's
2555
2756
  * own AGENTS.md is never read (`workspaceForRepo`). Absent on hosts that predate it. */
2556
- repos: z5.array(z5.object({ path: z5.string(), remote: z5.string() })).optional()
2757
+ repos: z7.array(z7.object({ path: z7.string(), remote: z7.string() })).optional()
2557
2758
  }).optional(),
2558
2759
  /** The tail of this agent's working log, when a harness is driving it — the agent page's
2559
2760
  * live strip. Absent for anything the desktop harness isn't running (a hatched identity
@@ -2562,156 +2763,156 @@ var ConnectionSummarySchema = z5.object({
2562
2763
  activity: AgentActivitySchema.optional(),
2563
2764
  /** True = a provider-managed agent running in the provider's cloud (e.g. Anthropic CMA);
2564
2765
  * false = a local MCP connection running on the user's computer (Claude Code/Codex/…). */
2565
- managed: z5.boolean()
2766
+ managed: z7.boolean()
2566
2767
  });
2567
- var LedgerItemSchema = z5.object({ id: z5.string(), parentId: z5.string(), title: z5.string(), createdAt: z5.string() });
2568
- var AgentLedgerSchema = z5.object({
2768
+ var LedgerItemSchema = z7.object({ id: z7.string(), parentId: z7.string(), title: z7.string(), createdAt: z7.string() });
2769
+ var AgentLedgerSchema = z7.object({
2569
2770
  /** Null when the agent has not named itself yet — never a placeholder (owner, 2026-10-01). */
2570
- agent: z5.object({ id: z5.string(), name: z5.string().nullable(), revokedAt: z5.string().nullable() }),
2771
+ agent: z7.object({ id: z7.string(), name: z7.string().nullable(), revokedAt: z7.string().nullable() }),
2571
2772
  /** Its own questions you have not answered. */
2572
- asks: z5.array(LedgerItemSchema),
2773
+ asks: z7.array(LedgerItemSchema),
2573
2774
  /** Its questions you answered that nobody acted on — still owed to somebody. */
2574
- answered: z5.array(LedgerItemSchema),
2775
+ answered: z7.array(LedgerItemSchema),
2575
2776
  /** Requests you sent it that it never took. */
2576
- requests: z5.array(LedgerItemSchema),
2577
- goals: z5.array(z5.object({ id: z5.string(), outcome: z5.string(), state: z5.string() })),
2578
- callbacks: z5.array(z5.object({ id: z5.string(), parentId: z5.string(), trigger: z5.string(), note: z5.string(), dueAt: z5.string().nullable() }))
2777
+ requests: z7.array(LedgerItemSchema),
2778
+ goals: z7.array(z7.object({ id: z7.string(), outcome: z7.string(), state: z7.string() })),
2779
+ callbacks: z7.array(z7.object({ id: z7.string(), parentId: z7.string(), trigger: z7.string(), note: z7.string(), dueAt: z7.string().nullable() }))
2579
2780
  });
2580
- var ReassignResultSchema = z5.object({
2581
- moved: z5.object({ asks: z5.number(), answered: z5.number(), requests: z5.number(), goals: z5.number(), callbacks: z5.number() }),
2582
- parentId: z5.string().nullable()
2781
+ var ReassignResultSchema = z7.object({
2782
+ moved: z7.object({ asks: z7.number(), answered: z7.number(), requests: z7.number(), goals: z7.number(), callbacks: z7.number() }),
2783
+ parentId: z7.string().nullable()
2583
2784
  });
2584
- var LessonStateSchema = z5.enum(["active", "proposed", "retired"]);
2585
- var LessonViewSchema = z5.object({
2586
- id: z5.string(),
2587
- text: z5.string(),
2785
+ var LessonStateSchema = z7.enum(["active", "proposed", "retired"]);
2786
+ var LessonViewSchema = z7.object({
2787
+ id: z7.string(),
2788
+ text: z7.string(),
2588
2789
  state: LessonStateSchema,
2589
2790
  /** The Goal it is scoped to; null = the whole account. */
2590
- scopeGoalId: z5.string().nullable(),
2591
- goalTitle: z5.string().nullable(),
2592
- version: z5.number(),
2593
- pinned: z5.boolean(),
2791
+ scopeGoalId: z7.string().nullable(),
2792
+ goalTitle: z7.string().nullable(),
2793
+ version: z7.number(),
2794
+ pinned: z7.boolean(),
2594
2795
  /** When the person last wrote its text themselves. */
2595
- editedAt: z5.string().nullable(),
2596
- createdAt: z5.string(),
2597
- updatedAt: z5.string(),
2796
+ editedAt: z7.string().nullable(),
2797
+ createdAt: z7.string(),
2798
+ updatedAt: z7.string(),
2598
2799
  /** The Entries it came from, oldest first; `words` is null when an Entry has none to show (sealed). */
2599
- sources: z5.array(z5.object({ entryId: z5.string(), words: z5.string().nullable(), at: z5.string() }))
2800
+ sources: z7.array(z7.object({ entryId: z7.string(), words: z7.string().nullable(), at: z7.string() }))
2600
2801
  });
2601
- var QueueQuestionSchema = z5.object({
2802
+ var QueueQuestionSchema = z7.object({
2602
2803
  /** The decision need's id — what an answer is accepted against. */
2603
- id: z5.string(),
2804
+ id: z7.string(),
2604
2805
  /** The words that were asked, from the request Entry that asked them. */
2605
- question: z5.string(),
2806
+ question: z7.string(),
2606
2807
  /** Where it was asked — which is where the ruling goes (`POST /api/entries`). Null only
2607
2808
  * for a need whose request Entry is carried by no interactive Delivery, which nothing
2608
2809
  * can answer. */
2609
- deliveryId: z5.string().nullable().default(null),
2810
+ deliveryId: z7.string().nullable().default(null),
2610
2811
  /** The Entry the ruling is about. */
2611
- aboutId: z5.string().nullable().default(null),
2812
+ aboutId: z7.string().nullable().default(null),
2612
2813
  /** Empty for a free-text question. */
2613
- options: z5.array(OptionSchema).default([]),
2614
- select: z5.enum(["one", "many", "rank", "confirm", "text"]).default("text"),
2615
- askedAt: z5.string(),
2814
+ options: z7.array(OptionSchema).default([]),
2815
+ select: z7.enum(["one", "many", "rank", "confirm", "text"]).default("text"),
2816
+ askedAt: z7.string(),
2616
2817
  /** Null while the question is open — which is how the page tells the two apart. */
2617
- answeredAt: z5.string().nullable().default(null),
2818
+ answeredAt: z7.string().nullable().default(null),
2618
2819
  /** The ruling in the person's own words, from the contribution that replied — not the
2619
2820
  * option id, which is not something anyone reads back. Null while it is open, and null
2620
2821
  * for a settled question whose reply carried nothing readable. */
2621
- answer: z5.string().nullable().default(null),
2822
+ answer: z7.string().nullable().default(null),
2622
2823
  /** The Goal this question belongs to — a step knows its Goal on its own, not only through
2623
2824
  * an `InboxItem`'s `communication.goalIds[0]` (docs/clients/app/walk/design.md §12 item 3).
2624
2825
  * READ BY `apps/client/src/walk/order.ts`, which stamps it onto every `WalkStep`: the walk's
2625
2826
  * order, its route, home's trees and the list of steps all take a step's Goal from here, so
2626
2827
  * this is the field they agree through rather than each re-deriving it from the row it
2627
2828
  * arrived under. Required because the API projects it on every need it sends. */
2628
- goalId: z5.string(),
2829
+ goalId: z7.string(),
2629
2830
  /** True only while an unmet START gate holds the Goal — a Goal that merely waits to
2630
2831
  * *finish* does not stop a person from answering (owner, 2026-09-16: "per need gate from
2631
2832
  * the API"; §4's dashed node). Not the same fact as `QueueItem.blocked`, which counts any
2632
2833
  * gate at all. */
2633
- blocked: z5.boolean().default(false)
2834
+ blocked: z7.boolean().default(false)
2634
2835
  });
2635
- var QueueReplySchema = z5.object({
2836
+ var QueueReplySchema = z7.object({
2636
2837
  /** The card this note was (`deliveryId:requestEntryId`, minted by the server like every card
2637
2838
  * id) — so the phone can tell a reply it just sent from one the queue already carries, and the
2638
2839
  * walk can name it in its zoom. */
2639
- id: z5.string(),
2840
+ id: z7.string(),
2640
2841
  /** The Goal the note is on. */
2641
- goalId: z5.string(),
2842
+ goalId: z7.string(),
2642
2843
  /** What the note said. */
2643
- note: z5.string(),
2844
+ note: z7.string(),
2644
2845
  /** Where it was carried — where a second reply goes (`POST /api/entries`, #2252). */
2645
- deliveryId: z5.string(),
2646
- requestEntryId: z5.string(),
2647
- askedAt: z5.string(),
2846
+ deliveryId: z7.string(),
2847
+ requestEntryId: z7.string(),
2848
+ askedAt: z7.string(),
2648
2849
  /** When the person last replied — the window's start. */
2649
- repliedAt: z5.string(),
2850
+ repliedAt: z7.string(),
2650
2851
  /** The person's latest words about it; null when there is nothing readable in them. */
2651
- reply: z5.string().nullable()
2852
+ reply: z7.string().nullable()
2652
2853
  });
2653
- var QueueItemSchema = z5.object({
2654
- id: z5.string(),
2854
+ var QueueItemSchema = z7.object({
2855
+ id: z7.string(),
2655
2856
  /** One-line headline — the first sentence of the outcome. */
2656
- title: z5.string(),
2857
+ title: z7.string(),
2657
2858
  /** The outcome in full, verbatim: the person's own words are what an assignee sees. */
2658
- intent: z5.string(),
2859
+ intent: z7.string(),
2659
2860
  /** `ready` | `active` | `waiting` | `done` | `cancelled`, straight off the Goal. */
2660
- state: z5.string(),
2861
+ state: z7.string(),
2661
2862
  /** Who holds it (a participant ref); null when nobody does yet. */
2662
- assignee: z5.string().nullable().default(null),
2863
+ assignee: z7.string().nullable().default(null),
2663
2864
  /** What the agent last said it was doing; null if it has said nothing. */
2664
- progress: z5.string().nullable().default(null),
2865
+ progress: z7.string().nullable().default(null),
2665
2866
  /** HOME'S LINE FOR THAT NOTE (owner, 2026-09-23): a few plain words one read wrote from `progress`,
2666
2867
  * served only while it was written for the current note. Null means show the Goal's name. */
2667
- progressLine: z5.string().nullable().optional(),
2668
- reviewPending: z5.boolean().default(false),
2669
- dueAt: z5.string().nullable().default(null),
2868
+ progressLine: z7.string().nullable().optional(),
2869
+ reviewPending: z7.boolean().default(false),
2870
+ dueAt: z7.string().nullable().default(null),
2670
2871
  /** WHEN ITS OWNER SAID DONE WHILE CHILDREN WERE OPEN (#2704): its own work is finished and it closes
2671
2872
  * with its last open child. Null otherwise; optional, so hand-built queues need not spell it. */
2672
- finishedAt: z5.string().nullable().optional(),
2873
+ finishedAt: z7.string().nullable().optional(),
2673
2874
  /** The Goal this one was opened under; null at the root. */
2674
- parentGoalId: z5.string().nullable().default(null),
2875
+ parentGoalId: z7.string().nullable().default(null),
2675
2876
  /** Goals opened under this one — only those the same list holds. */
2676
- childGoalIds: z5.array(z5.string()).default([]),
2877
+ childGoalIds: z7.array(z7.string()).default([]),
2677
2878
  /** Goals this one waits on (start or finish gates). */
2678
- dependencyGoalIds: z5.array(z5.string()).default([]),
2879
+ dependencyGoalIds: z7.array(z7.string()).default([]),
2679
2880
  /** True while any gate is on a Goal that is not done — the walk draws it dashed. */
2680
- blocked: z5.boolean().default(false),
2881
+ blocked: z7.boolean().default(false),
2681
2882
  /** Its questions: every OPEN one, and at most ten settled, newest settled first
2682
2883
  * (20260929133308) — the page decides which of them to show. NOT the whole set: `asked` and
2683
2884
  * `answered` are, and a settled one's words are a line (280 characters), its body read when the
2684
2885
  * question is opened. */
2685
- questions: z5.array(QueueQuestionSchema).default([]),
2886
+ questions: z7.array(QueueQuestionSchema).default([]),
2686
2887
  /** HOW MANY QUESTIONS THIS WORK HAS ASKED, and how many are answered — the Goal's own totals,
2687
2888
  * bounded at 100 server-side. A tally counted off `questions` is a wrong number that looks
2688
2889
  * right once the cap bites (`walk/trees.ts` `tallyOf`). Optional, and defaulted from the array
2689
2890
  * by the projection, so hand-built queues (fixtures, the demo) need not spell them. */
2690
- asked: z5.number().optional(),
2691
- answered: z5.number().optional(),
2891
+ asked: z7.number().optional(),
2892
+ answered: z7.number().optional(),
2692
2893
  /** Every note on it the person replied to (`QueueReplySchema`) — the page decides which to show.
2693
2894
  * Optional, not defaulted: absent is none, and every hand-built queue (fixtures, the demo) need
2694
2895
  * not spell an empty list. */
2695
- replies: z5.array(QueueReplySchema).optional(),
2896
+ replies: z7.array(QueueReplySchema).optional(),
2696
2897
  /** The repository or project identifier this Goal belongs to (#2280), null if untracked. */
2697
- repo: z5.string().nullable().optional(),
2698
- createdAt: z5.string(),
2699
- updatedAt: z5.string().nullable().default(null),
2700
- /** When its owner last SAID something about it (`goals.last_progress_at`, written by every
2701
- * `update_goal` that changes `progress`). `updatedAt` moves for reasons nobody chose — a
2898
+ repo: z7.string().nullable().optional(),
2899
+ createdAt: z7.string(),
2900
+ updatedAt: z7.string().nullable().default(null),
2901
+ /** When its owner last SAID something about it (the newest `progress` Entry: a contact update kept
2902
+ * as progress). `updatedAt` moves for reasons nobody chose — a
2702
2903
  * state recomputed, a review flag — so it cannot tell work in hand from work gone quiet. */
2703
- lastProgressAt: z5.string().nullable().optional(),
2904
+ lastProgressAt: z7.string().nullable().optional(),
2704
2905
  /** THE GOAL'S NEWEST WORD, FROM EITHER SIDE (owner, 2026-09-27): the newest Entry on it, of any
2705
2906
  * kind — what the person added ("Add to this"), their reply, the agent's ask or its progress
2706
2907
  * note. A progress note is an Entry, so this is already the newer of the two: the person's note
2707
2908
  * shows the moment it is written, and the agent's reply or next note replaces it by being newer.
2708
2909
  * `said` is bounded to 280 characters server-side (a line, not the conversation). Null when the
2709
2910
  * Goal carries no readable Entry; optional, so hand-built queues need not spell it. */
2710
- latest: z5.object({
2711
- from: z5.enum(["person", "agent"]),
2712
- said: z5.string(),
2713
- at: z5.string(),
2714
- entryId: z5.string()
2911
+ latest: z7.object({
2912
+ from: z7.enum(["person", "agent"]),
2913
+ said: z7.string(),
2914
+ at: z7.string(),
2915
+ entryId: z7.string()
2715
2916
  }).nullable().optional(),
2716
2917
  /** WHEN THIS PERSON LAST PUT A HAND ON IT THEMSELVES (owner, Paigy Goal 16d18f51, 2026-09-30):
2717
2918
  * the newest Entry on the Goal they wrote, of any kind — a line they added, a reply to a note, an
@@ -2724,7 +2925,7 @@ var QueueItemSchema = z5.object({
2724
2925
  * minute after the person speaks erases their instant from it, and the durable traces the client
2725
2926
  * can see (`replies`, `questions[].answeredAt`) miss a spontaneous note entirely — a `request`
2726
2927
  * Entry with no `about_id` is in neither. */
2727
- lastPersonAt: z5.string().nullable().optional(),
2928
+ lastPersonAt: z7.string().nullable().optional(),
2728
2929
  /** WHAT THIS ROW IS, IN TWELVE CHARACTERS (#2928) — the hash of every other field on it, stamped
2729
2930
  * by the one projection that builds the row (`apps/api/src/goal/queue.ts`). It is how the
2730
2931
  * incremental read knows a row has not moved: the phone echoes back the revs it holds
@@ -2735,40 +2936,40 @@ var QueueItemSchema = z5.object({
2735
2936
  * the row shows that no `updated_at` moves for (a lease lapsing, a dependency's state, a
2736
2937
  * sibling appearing in `childGoalIds`) cannot go unnoticed. Optional because a hand-built
2737
2938
  * queue (a fixture, the demo) spells none, and a row with no rev is simply always re-sent. */
2738
- rev: z5.string().optional()
2939
+ rev: z7.string().optional()
2739
2940
  });
2740
- var QueueDeltaSchema = z5.object({
2741
- ids: z5.array(z5.string()),
2742
- items: z5.array(QueueItemSchema)
2941
+ var QueueDeltaSchema = z7.object({
2942
+ ids: z7.array(z7.string()),
2943
+ items: z7.array(QueueItemSchema)
2743
2944
  });
2744
2945
  var COLD_AFTER_MS = 3 * 24 * 60 * 60 * 1e3;
2745
- var NoteSourceSchema = z5.enum(["app", "call"]);
2746
- var NoteStatusSchema = z5.enum(["open", "assigned", "in_progress", "done"]);
2747
- var NoteRepeatSchema = z5.enum(["once", "until_done"]);
2748
- var DecisionSchema = z5.object({
2749
- id: z5.string(),
2946
+ var NoteSourceSchema = z7.enum(["app", "call"]);
2947
+ var NoteStatusSchema = z7.enum(["open", "assigned", "in_progress", "done"]);
2948
+ var NoteRepeatSchema = z7.enum(["once", "until_done"]);
2949
+ var DecisionSchema = z7.object({
2950
+ id: z7.string(),
2750
2951
  /** The note this decision refines; null = recorded on a bare thread (the
2751
2952
  * extensibility seam — any conversation can accrue decisions). */
2752
- noteId: z5.string().nullable(),
2953
+ noteId: z7.string().nullable(),
2753
2954
  /** What was ambiguous — the broker's (or the user's own) question. */
2754
- question: z5.string(),
2955
+ question: z7.string(),
2755
2956
  /** The user's ruling; null while the question is open. */
2756
- answer: z5.string().nullable(),
2757
- decidedAt: z5.string().nullable(),
2758
- createdAt: z5.string()
2957
+ answer: z7.string().nullable(),
2958
+ decidedAt: z7.string().nullable(),
2959
+ createdAt: z7.string()
2759
2960
  });
2760
- var NoteSchema = z5.object({
2761
- id: z5.string(),
2961
+ var NoteSchema = z7.object({
2962
+ id: z7.string(),
2762
2963
  /** One-line headline (broker-titled; deterministic floor). */
2763
- title: z5.string(),
2964
+ title: z7.string(),
2764
2965
  /** The original intent, verbatim — assignees always see the user's own words. */
2765
- intent: z5.string(),
2966
+ intent: z7.string(),
2766
2967
  source: NoteSourceSchema,
2767
2968
  status: NoteStatusSchema,
2768
2969
  /** Who it was assigned to (a participant ref, 'agent:<tokenId>'); null = unassigned. */
2769
- assignee: z5.string().nullable(),
2970
+ assignee: z7.string().nullable(),
2770
2971
  /** The request thread minted at assignment; null until assigned. */
2771
- parentId: z5.string().nullable(),
2972
+ parentId: z7.string().nullable(),
2772
2973
  /** REMINDERS (docs/model/notes/reminders-design.md): the NOT-BEFORE this becomes eligible to ride a
2773
2974
  * call — never a deadline. It only ever comes from the user's own words, so when it
2774
2975
  * passes Paigy rings ONCE (#1293, owner 2026-08-26: a time said out loud is consent to
@@ -2777,154 +2978,154 @@ var NoteSchema = z5.object({
2777
2978
  // Defaulted, not required: a Note from an API deploy older than the reminders
2778
2979
  // migration has none of these, and the defaults ARE what it means — no not-before,
2779
2980
  // one ride, never ridden. Parsing must not fail across a rolling deploy.
2780
- dueAt: z5.string().nullable().default(null),
2981
+ dueAt: z7.string().nullable().default(null),
2781
2982
  repeat: NoteRepeatSchema.default("once"),
2782
2983
  /** How many calls have already carried it — the fatigue cap counts rides, not days. */
2783
- rides: z5.number().int().default(0),
2784
- lastRideAt: z5.string().nullable().default(null),
2785
- createdAt: z5.string()
2984
+ rides: z7.number().int().default(0),
2985
+ lastRideAt: z7.string().nullable().default(null),
2986
+ createdAt: z7.string()
2786
2987
  });
2787
- var TriageItemSchema = z5.object({
2788
- noteId: z5.string(),
2988
+ var TriageItemSchema = z7.object({
2989
+ noteId: z7.string(),
2789
2990
  /** The note's headline at run time. */
2790
- title: z5.string(),
2991
+ title: z7.string(),
2791
2992
  /** WHY, in one short human line, evidence first — this is read on a phone underneath
2792
2993
  * the note's title: "no movement in 34 days", "worked 3 notes in this repo this week".
2793
2994
  * Never a model's reasoning transcript, never an id. */
2794
- why: z5.string()
2995
+ why: z7.string()
2795
2996
  });
2796
- var TriageAssignmentSchema = z5.object({
2997
+ var TriageAssignmentSchema = z7.object({
2797
2998
  /** The agent's token id — what `dispatchNote` resolves and what a request is addressed to. */
2798
- agent: z5.string(),
2999
+ agent: z7.string(),
2799
3000
  /** Its display name at run time (the name on the hatchling's card). Denormalized for the
2800
3001
  * same reason as `title`: the card must render from the proposal alone. */
2801
- agentName: z5.string(),
2802
- notes: z5.array(TriageItemSchema)
3002
+ agentName: z7.string(),
3003
+ notes: z7.array(TriageItemSchema)
2803
3004
  });
2804
- var TriageStatusSchema = z5.enum(["open", "superseded", "dismissed"]);
2805
- var SubmitTriageSchema = z5.object({
3005
+ var TriageStatusSchema = z7.enum(["open", "superseded", "dismissed"]);
3006
+ var SubmitTriageSchema = z7.object({
2806
3007
  /** Which runtime judged: "ollama" (inference never left the machine) or a harness the
2807
3008
  * user already runs under their own credentials ("claude" / "codex" / "agy"). Recorded
2808
3009
  * so the phone can say where the content went — an unattributed privacy claim is worth
2809
3010
  * nothing, and #1106's promise is precisely "Paigy's servers never see this". */
2810
- provider: z5.string().min(1).max(60),
3011
+ provider: z7.string().min(1).max(60),
2811
3012
  /** The concrete model when the provider names one (an ollama tag); null otherwise. */
2812
- model: z5.string().max(200).nullable().optional(),
3013
+ model: z7.string().max(200).nullable().optional(),
2813
3014
  /** How many open notes the run actually looked at — the denominator on the phone
2814
3015
  * ("6 of 50"), and the honest answer to "did it read the whole queue?". */
2815
- reviewed: z5.number().int().min(0).max(1e4).default(0),
2816
- close: z5.array(TriageItemSchema).max(200).default([]),
2817
- stale: z5.array(TriageItemSchema).max(200).default([]),
2818
- assign: z5.array(TriageAssignmentSchema).max(50).default([])
3016
+ reviewed: z7.number().int().min(0).max(1e4).default(0),
3017
+ close: z7.array(TriageItemSchema).max(200).default([]),
3018
+ stale: z7.array(TriageItemSchema).max(200).default([]),
3019
+ assign: z7.array(TriageAssignmentSchema).max(50).default([])
2819
3020
  });
2820
3021
  var TriageProposalSchema = SubmitTriageSchema.extend({
2821
- id: z5.string(),
2822
- runAt: z5.string(),
3022
+ id: z7.string(),
3023
+ runAt: z7.string(),
2823
3024
  status: TriageStatusSchema,
2824
- model: z5.string().nullable().default(null)
3025
+ model: z7.string().nullable().default(null)
2825
3026
  });
2826
- var AcceptTriageSchema = z5.discriminatedUnion("group", [
2827
- z5.object({ group: z5.literal("close"), noteIds: z5.array(z5.string()).max(200).optional() }),
2828
- z5.object({ group: z5.literal("stale"), noteIds: z5.array(z5.string()).max(200).optional() }),
2829
- z5.object({
2830
- group: z5.literal("assign"),
2831
- agent: z5.string().min(1),
2832
- noteIds: z5.array(z5.string()).max(200).optional()
3027
+ var AcceptTriageSchema = z7.discriminatedUnion("group", [
3028
+ z7.object({ group: z7.literal("close"), noteIds: z7.array(z7.string()).max(200).optional() }),
3029
+ z7.object({ group: z7.literal("stale"), noteIds: z7.array(z7.string()).max(200).optional() }),
3030
+ z7.object({
3031
+ group: z7.literal("assign"),
3032
+ agent: z7.string().min(1),
3033
+ noteIds: z7.array(z7.string()).max(200).optional()
2833
3034
  })
2834
3035
  ]);
2835
- var AcceptTriageResultSchema = z5.object({
2836
- accepted: z5.array(z5.string()),
2837
- failed: z5.array(z5.object({ noteId: z5.string(), reason: z5.string() }))
3036
+ var AcceptTriageResultSchema = z7.object({
3037
+ accepted: z7.array(z7.string()),
3038
+ failed: z7.array(z7.object({ noteId: z7.string(), reason: z7.string() }))
2838
3039
  });
2839
- var DeliveryModeSchema = z5.enum(["poll", "self_hosted"]);
3040
+ var DeliveryModeSchema = z7.enum(["poll", "self_hosted"]);
2840
3041
  var WAKE_EVENT = "wake";
2841
3042
  var wakeChannel = (tokenId) => `wake:${tokenId}`;
2842
- var RegisterDeliverySchema = z5.object({ mode: DeliveryModeSchema });
2843
- var OAuthStartSchema = z5.object({
2844
- provider: z5.enum(["cma"]),
2845
- returnTo: z5.string().min(1)
3043
+ var RegisterDeliverySchema = z7.object({ mode: DeliveryModeSchema });
3044
+ var OAuthStartSchema = z7.object({
3045
+ provider: z7.enum(["cma"]),
3046
+ returnTo: z7.string().min(1)
2846
3047
  });
2847
- var DeliveryConfigSchema = z5.object({
2848
- tokenId: z5.string(),
3048
+ var DeliveryConfigSchema = z7.object({
3049
+ tokenId: z7.string(),
2849
3050
  mode: DeliveryModeSchema,
2850
3051
  /** null when the deployment has no anon key configured. `self_hosted` is then REFUSED
2851
3052
  * (503 `self_hosted_unavailable`) rather than registered, so a self_hosted config always
2852
3053
  * carries credentials; only a `poll` registration can come back with null here. */
2853
- realtime: z5.object({ url: z5.string(), anonKey: z5.string() }).nullable()
3054
+ realtime: z7.object({ url: z7.string(), anonKey: z7.string() }).nullable()
2854
3055
  });
2855
- var HostDecisionSchema = z5.object({
3056
+ var HostDecisionSchema = z7.object({
2856
3057
  /** The agent's token id: the row's `recipient`. */
2857
- agent: z5.string().uuid(),
2858
- decision: z5.enum(["stood_back", "took_over"]),
3058
+ agent: z7.string().uuid(),
3059
+ decision: z7.enum(["stood_back", "took_over"]),
2859
3060
  /** The work it was about: the Goal `claim_goal` would hand that agent next. */
2860
- goalId: z5.string().uuid().nullable().optional(),
3061
+ goalId: z7.string().uuid().nullable().optional(),
2861
3062
  /** When the server last heard from the agent, as the host read it: the presence it stood back for. */
2862
- seenAt: z5.string().datetime().nullable().optional(),
3063
+ seenAt: z7.string().datetime().nullable().optional(),
2863
3064
  /** When that work last moved (`claimable.since` on an agent's `contact({})` read), the fact the bound is judged on. */
2864
- since: z5.string().datetime().nullable().optional(),
3065
+ since: z7.string().datetime().nullable().optional(),
2865
3066
  /** What the host said, in its log's own words: why it stood back, or what the take-over did. */
2866
- said: z5.string().max(300).optional()
3067
+ said: z7.string().max(300).optional()
2867
3068
  });
2868
- var WakeNudgeSchema = z5.object({
2869
- kind: z5.enum(["reply", "request", "callback"]),
2870
- notificationId: z5.string().optional(),
2871
- parentId: z5.string()
3069
+ var WakeNudgeSchema = z7.object({
3070
+ kind: z7.enum(["reply", "request", "callback"]),
3071
+ notificationId: z7.string().optional(),
3072
+ parentId: z7.string()
2872
3073
  });
2873
- var PairingStatusSchema = z5.enum(["pending", "approved", "denied", "expired"]);
2874
- var DeviceCodeSchema = z5.object({
2875
- device_code: z5.string(),
2876
- user_code: z5.string(),
2877
- verification_uri: z5.string().url(),
2878
- verification_uri_complete: z5.string().url(),
2879
- interval: z5.number(),
2880
- expires_in: z5.number()
3074
+ var PairingStatusSchema = z7.enum(["pending", "approved", "denied", "expired"]);
3075
+ var DeviceCodeSchema = z7.object({
3076
+ device_code: z7.string(),
3077
+ user_code: z7.string(),
3078
+ verification_uri: z7.string().url(),
3079
+ verification_uri_complete: z7.string().url(),
3080
+ interval: z7.number(),
3081
+ expires_in: z7.number()
2881
3082
  });
2882
- var DeviceInfoSchema = z5.object({
2883
- code: z5.string(),
3083
+ var DeviceInfoSchema = z7.object({
3084
+ code: z7.string(),
2884
3085
  /** The agent's suggested name (from /device/code) — shown on the approval screen,
2885
3086
  * pre-filling the name field the human can edit. */
2886
- name: z5.string(),
3087
+ name: z7.string(),
2887
3088
  /** @deprecated Legacy alias of `name` for the pre-#531 embedded bundle in App Store
2888
3089
  * build 35, whose DeviceFlow renders `info.agent.slice(0, 2)` — without this a FRESH
2889
3090
  * install crashes on the pairing screen on first launch, before the OTA lands
2890
3091
  * (seen live: PAIGY-5T, 2026-07-21). Remove once a newer binary is the floor. */
2891
- agent: z5.string().optional(),
2892
- device: z5.string().nullable(),
3092
+ agent: z7.string().optional(),
3093
+ device: z7.string().nullable(),
2893
3094
  status: PairingStatusSchema
2894
3095
  });
2895
- var DeviceTokenSchema = z5.object({
2896
- access_token: z5.string(),
3096
+ var DeviceTokenSchema = z7.object({
3097
+ access_token: z7.string(),
2897
3098
  /** The pairing's single name (user-typed at approval, the agent's suggestion, or
2898
3099
  * a default silly name). */
2899
- name: z5.string(),
2900
- device: z5.string().nullable(),
3100
+ name: z7.string(),
3101
+ device: z7.string().nullable(),
2901
3102
  /** The pairing's assigned voice, cached so the desktop can seed the SAME face the phone
2902
3103
  * draws — voice is the third ingredient of a hatchling's build (party/traits.ts). */
2903
- voice: z5.string().nullable().optional(),
3104
+ voice: z7.string().nullable().optional(),
2904
3105
  /** The token's server-side id — the face's COLOUR anchor, and the only seed ingredient
2905
3106
  * that survives a rename. Cached by the host's identity beat. */
2906
- token_id: z5.string().nullable().optional(),
3107
+ token_id: z7.string().nullable().optional(),
2907
3108
  /** WHERE this identity works — the folder a wake should land it in. Written by the host
2908
3109
  * at spawn and by `paigy-harness handoff` from a live terminal. Without it every wake
2909
3110
  * landed in the FIRST granted workspace and the agent rediscovered its own repo from
2910
3111
  * the thread each time (host.ts, live catch 2026-08-06 — prompt-papered until now). */
2911
- workspace: z5.string().nullable().optional(),
3112
+ workspace: z7.string().nullable().optional(),
2912
3113
  /** Local host recovery must preserve the launch's runtime and Paigy identity. */
2913
- harness: z5.enum(["claude", "codex", "agy"]).optional(),
2914
- session_id: z5.string().uuid().optional(),
3114
+ harness: z7.enum(["claude", "codex", "agy"]).optional(),
3115
+ session_id: z7.string().uuid().optional(),
2915
3116
  /** A conversation the host must not resume: its context is full, so every turn fails
2916
3117
  * ("Prompt is too long"). Written when a run hits it (`run.ts` `onFull`); the host skips a slot
2917
3118
  * whose resumable session is this one, so its Goals reach the dead-agent handoff instead of a
2918
3119
  * copy that types the person's words into a turn that cannot run (Calls, 2026-10-06). */
2919
- full_session: z5.string().optional(),
2920
- uik_pub: z5.string().nullable().optional()
3120
+ full_session: z7.string().optional(),
3121
+ uik_pub: z7.string().nullable().optional()
2921
3122
  });
2922
- var SupportRequestSchema = z5.object({
2923
- email: z5.string().email().max(320),
2924
- message: z5.string().trim().min(1).max(5e3),
2925
- name: z5.string().trim().max(120).optional()
3123
+ var SupportRequestSchema = z7.object({
3124
+ email: z7.string().email().max(320),
3125
+ message: z7.string().trim().min(1).max(5e3),
3126
+ name: z7.string().trim().max(120).optional()
2926
3127
  });
2927
- var NotificationFeedbackKindSchema = z5.enum([
3128
+ var NotificationFeedbackKindSchema = z7.enum([
2928
3129
  "break_down",
2929
3130
  // "This should be more than one ask — break it down."
2930
3131
  "regenerate_options",
@@ -2939,116 +3140,116 @@ var NotificationFeedbackKindSchema = z5.enum([
2939
3140
  // anything else — the note carries it.
2940
3141
  ]);
2941
3142
  var SlimOptionSchema = OptionSchema.omit({ html: true });
2942
- var QuestionRowSchema = z5.object({
3143
+ var QuestionRowSchema = z7.object({
2943
3144
  /** The card's id (`deliveryId:needId`, or `deliveryId:entryId` for an update), as the inbox mints it. */
2944
- id: z5.string(),
2945
- deliveryId: z5.string(),
2946
- entryId: z5.string(),
3145
+ id: z7.string(),
3146
+ deliveryId: z7.string(),
3147
+ entryId: z7.string(),
2947
3148
  /** The decision it waits on; null for an update, which asks nothing. */
2948
- needId: z5.string().nullable(),
2949
- goalIds: z5.array(z5.string()),
3149
+ needId: z7.string().nullable(),
3150
+ goalIds: z7.array(z7.string()),
2950
3151
  /** The name of the work it is about, when the read could word it. */
2951
- goalTitle: z5.string().optional(),
2952
- tokenId: z5.string().optional(),
2953
- name: z5.string(),
2954
- title: z5.string(),
2955
- body: z5.string(),
2956
- select: z5.enum(["one", "many", "rank", "confirm", "text"]),
2957
- options: z5.array(SlimOptionSchema),
2958
- hasPreview: z5.boolean(),
2959
- blocking: z5.boolean(),
2960
- askedAt: z5.string().datetime(),
3152
+ goalTitle: z7.string().optional(),
3153
+ tokenId: z7.string().optional(),
3154
+ name: z7.string(),
3155
+ title: z7.string(),
3156
+ body: z7.string(),
3157
+ select: z7.enum(["one", "many", "rank", "confirm", "text"]),
3158
+ options: z7.array(SlimOptionSchema),
3159
+ hasPreview: z7.boolean(),
3160
+ blocking: z7.boolean(),
3161
+ askedAt: z7.string().datetime(),
2961
3162
  ring: InboxItemSchema.shape.ring,
2962
- onCall: z5.literal(true).optional(),
2963
- sealed: z5.boolean()
3163
+ onCall: z7.literal(true).optional(),
3164
+ sealed: z7.boolean()
2964
3165
  });
2965
- var WorkStateSchema = z5.enum(["ready", "active", "waiting", "done", "cancelled"]);
2966
- var WorkRowSchema = z5.object({
2967
- id: z5.string(),
2968
- parentId: z5.string().nullable(),
2969
- title: z5.string(),
3166
+ var WorkStateSchema = z7.enum(["ready", "active", "waiting", "done", "cancelled"]);
3167
+ var WorkRowSchema = z7.object({
3168
+ id: z7.string(),
3169
+ parentId: z7.string().nullable(),
3170
+ title: z7.string(),
2970
3171
  /** Straight off the Goal. */
2971
3172
  state: WorkStateSchema,
2972
- owner: z5.string().nullable(),
2973
- revision: z5.number().int(),
3173
+ owner: z7.string().nullable(),
3174
+ revision: z7.number().int(),
2974
3175
  /** Open questions on it, counted to 100. */
2975
- waiting: z5.number().int(),
3176
+ waiting: z7.number().int(),
2976
3177
  /** Held by a gate on work that is not done. */
2977
- blocked: z5.boolean(),
2978
- lastProgressAt: z5.string().datetime().nullable(),
3178
+ blocked: z7.boolean(),
3179
+ lastProgressAt: z7.string().datetime().nullable(),
2979
3180
  /** The line written for its newest progress note, else that note's first words. */
2980
- line: z5.string().nullable(),
3181
+ line: z7.string().nullable(),
2981
3182
  /** Work directly under it, counted to 100; the list carries up to 12 of them. */
2982
- children: z5.number().int(),
2983
- createdAt: z5.string().datetime(),
2984
- updatedAt: z5.string().datetime(),
3183
+ children: z7.number().int(),
3184
+ createdAt: z7.string().datetime(),
3185
+ updatedAt: z7.string().datetime(),
2985
3186
  /** When anything at or under it last moved — the order the list is in. */
2986
- activeAt: z5.string().datetime(),
3187
+ activeAt: z7.string().datetime(),
2987
3188
  /** A sealed outcome has no title here; the work's page opens it. */
2988
- sealed: z5.boolean()
3189
+ sealed: z7.boolean()
2989
3190
  });
2990
3191
  var ComputerRowSchema = ConnectionSummarySchema.omit({ activity: true });
2991
3192
  var AgentRowSchema = ComputerRowSchema.extend({
2992
3193
  /** Open questions it is asking the person, over every open card; null when that read failed. */
2993
- asking: z5.number().int().nullable(),
2994
- oldestAskAt: z5.string().datetime().nullable(),
3194
+ asking: z7.number().int().nullable(),
3195
+ oldestAskAt: z7.string().datetime().nullable(),
2995
3196
  /** Up to three of the live Goals it holds, oldest first (the order it picks them up), and how
2996
3197
  * many in all among the account's 200 most recently active agent-held live Goals
2997
3198
  * (`agent_holds`); null when that read failed. */
2998
- holds: z5.array(z5.object({ id: z5.string(), title: z5.string() })).nullable(),
2999
- held: z5.number().int().nullable(),
3199
+ holds: z7.array(z7.object({ id: z7.string(), title: z7.string() })).nullable(),
3200
+ held: z7.number().int().nullable(),
3000
3201
  /** The earliest instant any Goal it holds went quiet, by the one rule (`coldSince`); null
3001
3202
  * while none has, or when that read failed. */
3002
- cold: z5.string().datetime().nullable(),
3203
+ cold: z7.string().datetime().nullable(),
3003
3204
  /** The newest line of its working log, and when the harness saw it. */
3004
- line: z5.string().nullable(),
3005
- lineAt: z5.string().datetime().nullable()
3205
+ line: z7.string().nullable(),
3206
+ lineAt: z7.string().datetime().nullable()
3006
3207
  });
3007
- var SnapshotSchema = z5.object({
3208
+ var SnapshotSchema = z7.object({
3008
3209
  /** The API's clock, taken before the first read: what a later delta will start from. */
3009
- at: z5.string().datetime(),
3010
- questions: z5.object({
3210
+ at: z7.string().datetime(),
3211
+ questions: z7.object({
3011
3212
  /** The newest 30 open cards, questions before updates. */
3012
- items: z5.array(QuestionRowSchema),
3213
+ items: z7.array(QuestionRowSchema),
3013
3214
  /** Every open question, and apart from them every update, and what was put off. */
3014
- total: z5.number().int(),
3015
- updates: z5.number().int(),
3016
- putOff: z5.number().int()
3215
+ total: z7.number().int(),
3216
+ updates: z7.number().int(),
3217
+ putOff: z7.number().int()
3017
3218
  }).nullable(),
3018
- agents: z5.object({
3219
+ agents: z7.object({
3019
3220
  /** Up to 60, most recently seen first. */
3020
- items: z5.array(AgentRowSchema),
3021
- more: z5.boolean()
3221
+ items: z7.array(AgentRowSchema),
3222
+ more: z7.boolean()
3022
3223
  }).nullable(),
3023
- work: z5.object({
3224
+ work: z7.object({
3024
3225
  /** The 60 most recently active roots, each followed by up to 12 children; 240 rows at most. */
3025
- items: z5.array(WorkRowSchema),
3226
+ items: z7.array(WorkRowSchema),
3026
3227
  /** How much work is behind each of the Work tab's four filters, each counted to 100, read with
3027
3228
  * the rows. `work_list` (20260928023533) owns the predicates: Live is `ready`, `active` or
3028
3229
  * `waiting`; Waiting on you is live work with an open question or an unmet gate; Not started
3029
3230
  * is `ready`; Done is `done` or `cancelled`. */
3030
- counts: z5.object({ live: z5.number().int(), waiting: z5.number().int(), notStarted: z5.number().int(), done: z5.number().int() })
3231
+ counts: z7.object({ live: z7.number().int(), waiting: z7.number().int(), notStarted: z7.number().int(), done: z7.number().int() })
3031
3232
  }).nullable(),
3032
- you: z5.object({
3233
+ you: z7.object({
3033
3234
  settings: UserSettingsSchema,
3034
- callable: z5.boolean(),
3235
+ callable: z7.boolean(),
3035
3236
  /** Up to 20 paired computers; null when the roster read failed. */
3036
- computers: z5.array(ComputerRowSchema).nullable()
3237
+ computers: z7.array(ComputerRowSchema).nullable()
3037
3238
  }).nullable()
3038
3239
  });
3039
- var CallRecapSchema = z5.object({
3040
- call: z5.object({
3041
- status: z5.string(),
3042
- startedAt: z5.string(),
3043
- durationMs: z5.number().nullable(),
3044
- agents: z5.array(z5.object({ id: z5.string(), name: z5.string().nullable() }))
3240
+ var CallRecapSchema = z7.object({
3241
+ call: z7.object({
3242
+ status: z7.string(),
3243
+ startedAt: z7.string(),
3244
+ durationMs: z7.number().nullable(),
3245
+ agents: z7.array(z7.object({ id: z7.string(), name: z7.string().nullable() }))
3045
3246
  }),
3046
- topics: z5.array(z5.object({
3047
- goalId: z5.string().uuid(),
3048
- title: z5.string(),
3049
- owner: z5.string(),
3050
- state: z5.string(),
3051
- questions: z5.array(z5.object({ id: z5.string().uuid(), state: z5.string(), title: z5.string() })),
3247
+ topics: z7.array(z7.object({
3248
+ goalId: z7.string().uuid(),
3249
+ title: z7.string(),
3250
+ owner: z7.string(),
3251
+ state: z7.string(),
3252
+ questions: z7.array(z7.object({ id: z7.string().uuid(), state: z7.string(), title: z7.string() })),
3052
3253
  /** `words` is always what they SAID, verbatim — the record, never replaced. `headline` is
3053
3254
  * their answer on one line when the call's read wrote one (owner, 2026-10-01: "render them
3054
3255
  * summarized like a pre-made option is"), so the row scans like a chosen option and their
@@ -3056,10 +3257,10 @@ var CallRecapSchema = z5.object({
3056
3257
  * anything that is not an answer. */
3057
3258
  /** `about` is the request the line answered (its question), null for words that answered none —
3058
3259
  * the key the screen groups on, so one question is one row however many times it was answered. */
3059
- lines: z5.array(z5.object({ entryId: z5.string().uuid(), words: z5.string(), headline: z5.string().optional(), about: z5.string().nullable().optional() }))
3260
+ lines: z7.array(z7.object({ entryId: z7.string().uuid(), words: z7.string(), headline: z7.string().optional(), about: z7.string().nullable().optional() }))
3060
3261
  })),
3061
- unfiled: z5.array(z5.object({ lineId: z5.string().uuid(), words: z5.string(), atMs: z5.number() })),
3062
- more: z5.object({ lines: z5.number(), entries: z5.number(), topics: z5.number() })
3262
+ unfiled: z7.array(z7.object({ lineId: z7.string().uuid(), words: z7.string(), atMs: z7.number() })),
3263
+ more: z7.object({ lines: z7.number(), entries: z7.number(), topics: z7.number() })
3063
3264
  });
3064
3265
  function sessionSlot(sessionId2) {
3065
3266
  const id2 = sessionId2 ?? sessionId();
@@ -3253,13 +3454,6 @@ async function getGoal(goalId, opts = {}, read3 = {}) {
3253
3454
  if (!res.ok) await fail("get_goal", res);
3254
3455
  return await res.json();
3255
3456
  }
3256
- async function updateGoal(goalId, input, opts = {}) {
3257
- const token = authToken(opts.token) ?? "";
3258
- const operationId = input.operationId ?? randomUUID2();
3259
- const res = await ensureAuthed(await (opts.reach ?? reach)(`${BACKEND_URL}/api/goals/${encodeURIComponent(goalId)}`, { method: "PATCH", headers: { "content-type": "application/json", authorization: `Bearer ${token}` }, body: JSON.stringify({ ...input, operationId }) }));
3260
- if (!res.ok) await fail("update_goal", res);
3261
- return await res.json();
3262
- }
3263
3457
  var AWAIT_WINDOW_MS = 45e3;
3264
3458
  async function hatch(name, voice = null, opts = {}) {
3265
3459
  const res = await ensureAuthed(await (opts.reach ?? reach)(`${BACKEND_URL}/api/hatch`, {
@@ -3419,6 +3613,15 @@ async function searchRecords(input, opts = {}) {
3419
3613
  if (!res.ok) await fail("search", res);
3420
3614
  return await res.json();
3421
3615
  }
3616
+ async function sendFeedback(input, opts = {}) {
3617
+ const res = await ensureAuthed(await (opts.reach ?? reach)(`${BACKEND_URL}/api/reports`, {
3618
+ method: "POST",
3619
+ headers: { "content-type": "application/json", authorization: `Bearer ${authToken(opts.token) ?? ""}` },
3620
+ body: JSON.stringify(input)
3621
+ }));
3622
+ if (!res.ok) await fail("send_feedback", res);
3623
+ return await res.json();
3624
+ }
3422
3625
  async function whoIsWorking(opts = {}) {
3423
3626
  const res = await ensureAuthed(await (opts.reach ?? reach)(`${BACKEND_URL}/api/agents/working`, {
3424
3627
  headers: { authorization: `Bearer ${authToken(opts.token) ?? ""}` }
@@ -3426,99 +3629,67 @@ async function whoIsWorking(opts = {}) {
3426
3629
  if (!res.ok) await fail("who_is_working", res);
3427
3630
  return await res.json();
3428
3631
  }
3429
- function repoFromRemote(url) {
3430
- const said = (url ?? "").trim();
3431
- if (!said) return null;
3432
- const path = said.replace(/^[a-z+]+:\/\/[^/]+\//i, "").replace(/^[^@]+@[^:]+:/, "").replace(/\.git$/i, "").replace(/\/+$/, "");
3433
- const parts = path.split("/").filter(Boolean);
3434
- if (parts.length < 2) return null;
3435
- const [owner, name] = parts.slice(-2);
3436
- if (!owner || !name) return null;
3437
- return `${owner}/${name}`.toLowerCase();
3438
- }
3439
- var asked;
3440
- function currentRepo(cwd = process.cwd()) {
3441
- if (asked !== void 0) return asked;
3442
- try {
3443
- const url = execFileSync2("git", ["remote", "get-url", "origin"], {
3444
- cwd,
3445
- encoding: "utf8",
3446
- timeout: 2e3,
3447
- stdio: ["ignore", "pipe", "ignore"]
3448
- });
3449
- asked = repoFromRemote(url);
3450
- } catch {
3451
- asked = null;
3452
- }
3453
- return asked;
3632
+ var NOT_SENT = `Recorded as the Goal's progress, not sent: nobody was notified. The person is told only a question, an answer to one they asked you, and what you say once the Goal is done. To close the work, mark the Goal done first, then send the one update saying what is done and anything they need to do or check. If the person asked you, in so many words, to send them this, send it again with userExplicitlyRequested: "any" on that update.`;
3633
+ var APPLIED = "Applied; nothing was sent to the person.";
3634
+ var DEMOTED = "Delivered as a card, not a call: the person's settings do not allow a call right now (silent, quiet hours, or a mode). It has reached them; do not send it again.";
3635
+ async function readDelivery(deliveryId, opts = {}) {
3636
+ const res = await ensureAuthed(await (opts.reach ?? reach)(`${BACKEND_URL}/api/deliveries/${encodeURIComponent(deliveryId)}`, {
3637
+ headers: { authorization: `Bearer ${authToken(opts.token) ?? ""}` },
3638
+ signal: opts.signal
3639
+ }));
3640
+ if (!res.ok) await fail("read_delivery", res);
3641
+ return await res.json();
3454
3642
  }
3455
- var NOT_SENT = "Recorded as the Goal's progress, not sent: nobody was notified. The person is told only a question, an answer to one they asked you, and what you say once the Goal is done. To close the work, mark the Goal done first, then send the one message saying what is done and anything they need to do or check.";
3456
- var DEMOTED = "Delivered as a card, not a call: the person's settings do not allow a call right now (silent, quiet hours, or a mode). It has reached them; do not send it again, with or without a Goal.";
3457
3643
  async function contact(input, opts = {}) {
3458
3644
  const parsed = ContactSchema.parse(input);
3459
- if (!("asks" in parsed) && !("deliveryId" in parsed)) throw new Error("contact with nothing to send receives: call receiveContact");
3645
+ if (!sendsAnything(parsed)) throw new Error("contact with nothing to send receives: call receiveContact");
3460
3646
  opts.signal?.throwIfAborted();
3461
3647
  const send2 = opts.reach ?? reach;
3462
- const headers = { "content-type": "application/json", authorization: `Bearer ${authToken(opts.token) ?? ""}` };
3463
- let deliveryId;
3464
- let deliveries = [];
3465
- let recorded = [];
3466
- let demoted;
3467
- if ("deliveryId" in parsed) {
3468
- deliveryId = parsed.deliveryId;
3469
- } else {
3470
- const reqAsks = parsed.asks.map((a) => ({
3471
- id: a.id,
3472
- parentId: a.parentId,
3473
- // Derived, not asked for (#2315): the agent's own remote, in one spelling, so a project's
3474
- // work does not grow three trees for "paigy", "mauurda/paigy" and "Paigy". An explicit one
3475
- // still wins — normalised the same way — because a caller that names one knows something
3476
- // this cannot see.
3477
- repo: repoFromRemote(a.repo) ?? a.repo ?? currentRepo() ?? void 0,
3478
- ask: a.ask,
3479
- options: a.options ?? [],
3480
- ...a.select ? { select: a.select } : {},
3481
- ...a.answers ? { answers: a.answers } : {}
3482
- }));
3483
- const res = await ensureAuthed(await send2(`${BACKEND_URL}/api/goals/contact`, {
3484
- method: "POST",
3485
- headers,
3486
- signal: opts.signal,
3487
- body: JSON.stringify({
3488
- operationId: opts.operationId ?? randomUUID3(),
3489
- asks: reqAsks,
3490
- waiting: parsed.waiting,
3491
- channel: parsed.channel === "call" ? "call" : "message"
3492
- })
3493
- }));
3494
- if (!res.ok) await fail("batch contact", res);
3495
- const receipt = await res.json();
3496
- deliveries = receipt.deliveries ?? [];
3497
- if (parsed.channel === "call" && receipt.channel && receipt.channel !== "call") demoted = DEMOTED;
3498
- recorded = receipt.recorded ?? [];
3499
- if (deliveries.length === 0 && recorded.length) return { sent: false, recorded, message: NOT_SENT };
3500
- if (deliveries.length === 0) throw new Error("Goal contact returned no Delivery identities");
3501
- deliveryId = deliveries[0]?.deliveryId ?? "";
3502
- if (!deliveryId) throw new Error("Goal contact returned no valid Delivery identity");
3503
- }
3504
- const all = deliveries.filter((d) => !!d.deliveryId && !!d.goalId).map(({ id: id2, deliveryId: deliveryId2, goalId }) => ({ ...id2 ? { id: id2 } : {}, deliveryId: deliveryId2, goalId }));
3505
- const joinedCard = deliveries[0]?.joinedCard === true;
3506
- const joinedCall = deliveries[0]?.joinedCall === true;
3648
+ const acknowledged = parsed.ackEventIds?.length ? await acknowledge(parsed.ackEventIds, opts) : void 0;
3649
+ const questions = parsed.questions?.map((q) => ({ ...q, questionId: q.questionId ?? randomUUID2() }));
3650
+ const res = await ensureAuthed(await send2(`${BACKEND_URL}/api/goals/contact`, {
3651
+ method: "POST",
3652
+ signal: opts.signal,
3653
+ headers: { "content-type": "application/json", authorization: `Bearer ${authToken(opts.token) ?? ""}` },
3654
+ body: JSON.stringify({
3655
+ operationId: opts.operationId ?? randomUUID2(),
3656
+ ...parsed.updates ? { updates: parsed.updates } : {},
3657
+ ...questions ? { questions } : {},
3658
+ ...parsed.answers ? { answers: parsed.answers } : {},
3659
+ ...parsed.withdrawQuestionIds ? { withdrawQuestionIds: parsed.withdrawQuestionIds } : {},
3660
+ ...parsed.questionDependencies ? { questionDependencies: parsed.questionDependencies } : {}
3661
+ })
3662
+ }));
3663
+ if (!res.ok) await fail("contact", res);
3664
+ const receipt = await res.json();
3665
+ const results = receipt.results ?? [];
3666
+ const ok = receipt.ok ?? results.every((r) => r.status !== "failed");
3667
+ const deliveries = receipt.deliveries ?? [];
3668
+ const recorded = results.filter((r) => r.status === "recorded" && r.goalId).map((r) => ({ goalId: r.goalId }));
3669
+ const askedCall = [...parsed.updates ?? [], ...questions ?? []].some((m) => m.userExplicitlyRequested === "call") || !!questions?.some((q) => q.workItBlocks?.length);
3670
+ const demoted = askedCall && receipt.channel && receipt.channel !== "call" ? DEMOTED : void 0;
3671
+ const acked = acknowledged ? { acknowledged } : {};
3672
+ if (!deliveries.length) {
3673
+ return { sent: false, ok, results, ...recorded.length ? { recorded } : {}, message: recorded.length ? NOT_SENT : APPLIED, waitOutcome: "not_waited", ...acked };
3674
+ }
3675
+ const lead = deliveries.find((d) => d.kind === "question") ?? deliveries[0];
3507
3676
  const read3 = async (signal2) => {
3508
- const res = await ensureAuthed(await send2(`${BACKEND_URL}/api/deliveries/${encodeURIComponent(deliveryId)}`, { headers, signal: signal2 }));
3509
- if (!res.ok) await fail("read_delivery", res);
3510
- const one = await res.json();
3677
+ const one = await readDelivery(lead.deliveryId, { ...opts, signal: signal2 });
3511
3678
  return {
3512
3679
  ...one,
3513
- ...all.length > 1 ? { deliveries: all } : {},
3680
+ ok,
3681
+ results,
3682
+ ...deliveries.length > 1 ? { deliveries: deliveries.map(({ deliveryId, goalId, kind, questionId }) => ({ deliveryId, goalId, kind, ...questionId ? { questionId } : {} })) } : {},
3514
3683
  ...recorded.length ? { recorded, notSent: NOT_SENT } : {},
3515
- ...joinedCard ? { joinedCard: true } : {},
3516
- ...joinedCall ? { joinedCall: true } : {},
3517
- ...demoted ? { demoted } : {}
3684
+ ...lead.joinedCard ? { joinedCard: true } : {},
3685
+ // IT WENT ONTO A CALL ALREADY HAPPENING (owner, 2026-09-28): the view words it as that call.
3686
+ ...lead.joinedCall ? { joinedCall: true } : {},
3687
+ ...demoted ? { demoted } : {},
3688
+ ...acked
3518
3689
  };
3519
3690
  };
3520
- const settled = (d) => d.kind === "notification" || d.state === "closed" || d.answers.length > 0 || d.entries.some((e) => e.kind === "contribution");
3521
- if (opts.waits === false) return read3(opts.signal);
3691
+ const settled = (d) => d.state === "closed" || d.answers.length > 0 || d.entries.some((e) => e.kind === "contribution" && !entryUnit(e));
3692
+ if (parsed.wait !== true || opts.waits === false) return { ...await read3(opts.signal), waitOutcome: "not_waited" };
3522
3693
  const window = AbortSignal.timeout(AWAIT_WINDOW_MS);
3523
3694
  const signal = opts.signal ? AbortSignal.any([opts.signal, window]) : window;
3524
3695
  let latest;
@@ -3526,12 +3697,12 @@ async function contact(input, opts = {}) {
3526
3697
  while (true) {
3527
3698
  signal.throwIfAborted();
3528
3699
  latest = await read3(signal);
3529
- if (settled(latest)) return latest;
3700
+ if (settled(latest)) return { ...latest, waitOutcome: "available" };
3530
3701
  await sleep2(5e3, void 0, { signal });
3531
3702
  }
3532
3703
  } catch (error) {
3533
3704
  opts.signal?.throwIfAborted();
3534
- if (window.aborted && latest) return latest;
3705
+ if (window.aborted && latest) return { ...latest, waitOutcome: "expired" };
3535
3706
  throw error;
3536
3707
  }
3537
3708
  }
@@ -3628,8 +3799,9 @@ var handle = (entryId) => entryId.slice(0, 8);
3628
3799
  function conversation(e) {
3629
3800
  const answers = new Map((e.answers ?? []).map((a) => [a.decisionNeedId, a]));
3630
3801
  const shown = new Set((e.entries ?? []).map((entry) => entry.entryId));
3631
- const repliedTo = new Set((e.entries ?? []).flatMap((entry) => entry.aboutId && shown.has(entry.aboutId) ? [entry.aboutId] : []));
3632
- return (e.entries ?? []).map((entry) => {
3802
+ const entries = (e.entries ?? []).filter((entry) => !entryUnit(entry));
3803
+ const repliedTo = new Set(entries.flatMap((entry) => entry.aboutId && shown.has(entry.aboutId) ? [entry.aboutId] : []));
3804
+ return entries.map((entry) => {
3633
3805
  const sealed = !!entry.content && "sealed" in entry.content;
3634
3806
  const plain = entry.content && "plain" in entry.content ? entry.content.plain : null;
3635
3807
  const options = plain && typeof plain === "object" && Array.isArray(plain.options) ? plain.options.map((o) => o.label).filter((l) => typeof l === "string") : [];
@@ -3642,6 +3814,7 @@ function conversation(e) {
3642
3814
  from: who(entry.authorParticipant),
3643
3815
  at: at(entry.createdAt),
3644
3816
  said: sealed ? "[encrypted]" : entryWords(entry).trim(),
3817
+ units: askUnits(entry, e.entries ?? []).map((u) => `${u.title}: ${u.body}`),
3645
3818
  re: entry.aboutId && shown.has(entry.aboutId) ? handle(entry.aboutId) : void 0,
3646
3819
  options,
3647
3820
  decision: need ? compact({ state: stateOf(need.state, answer, decision), answer: decision }) : void 0
@@ -3661,7 +3834,7 @@ function goalView(g) {
3661
3834
  if (!g.goalId) return compact({ state: g.state, next: g.message });
3662
3835
  const lines2 = conversation(g);
3663
3836
  const owed = lines2.filter((l) => l.from === "person" && l.decision?.state === "open" && l.id);
3664
- const owes = owed.length ? `The person asked you ${owed.length === 1 ? "a question" : `${owed.length} questions`} (${owed.map((l) => `id ${l.id}: "${l.said.slice(0, 80)}"`).join("; ")}) \u2014 answer with contact({ asks: [{ ask: <your answer>, answers: "<id>" }] }). ` : "";
3837
+ const owes = owed.length ? `The person asked you ${owed.length === 1 ? "a question" : `${owed.length} questions`} (${owed.map((l) => `id ${l.id}: "${l.said.slice(0, 80)}"`).join("; ")}) \u2014 answer with contact({ answers: [{ questionId: "<id>", answer: { text: <your answer> } }] }). ` : "";
3665
3838
  const newest = [...lines2].reverse().find((l) => l.from === "agent");
3666
3839
  return compact({
3667
3840
  goalId: g.goalId,
@@ -3671,6 +3844,8 @@ function goalView(g) {
3671
3844
  progress: g.progress && g.progress.trim() !== newest?.said ? g.progress : void 0,
3672
3845
  reviewPending: g.reviewPending || void 0,
3673
3846
  reviewSince: g.reviewSince,
3847
+ // What acknowledges the review: contact({ ackEventIds: [reviewEventId] }) (update_goal's reviewed: true is gone).
3848
+ reviewEventId: g.reviewEventId,
3674
3849
  owner: g.ownerParticipant,
3675
3850
  others: g.others,
3676
3851
  parentGoalId: g.parentGoalId,
@@ -3692,26 +3867,67 @@ function goalView(g) {
3692
3867
  more: more(g)
3693
3868
  });
3694
3869
  }
3695
- var JOINED_CALL = "This ask joined the call the person is ALREADY ON \u2014 no ring, no card of its own. `conversation` above is that whole call, so the answers already given on it before your ask arrived are in it. Yours is queued for the bot's next turn: call contact({deliveryId}) again to keep reading this same call until your answer lands \u2014 do not resend the ask. To add information or a further question to the same call, contact again while it is live; that joins it too.";
3870
+ var JOINED_CALL = "This joined the call the person is ALREADY ON \u2014 no ring, no card of its own. `conversation` above is that whole call, so the answers already given on it before yours arrived are in it. Yours is queued for the bot's next turn: wait for the answer with contact({wait:true}) and read it on its Goal with get_goal \u2014 do not resend it. To add information or a further question to the same call, contact again while it is live; that joins it too.";
3871
+ function failures(results) {
3872
+ const failed = (results ?? []).filter((r) => r.status === "failed");
3873
+ if (!failed.length) return void 0;
3874
+ const plural = { update: "updates", question: "questions", answer: "answers", withdraw: "withdrawQuestionIds", dependency: "questionDependencies" };
3875
+ return `${failed.length} of ${(results ?? []).length} items did not apply; the rest did: ` + failed.map((r) => `${plural[r.kind]}[${r.index}] ${r.error}${r.detail ? ` (${r.detail})` : ""}`).join("; ") + ".";
3876
+ }
3877
+ var itemsView = (results) => (results ?? []).map((r) => compact({
3878
+ kind: r.kind,
3879
+ index: r.index,
3880
+ status: r.status,
3881
+ questionId: r.questionId,
3882
+ goalId: r.goalId,
3883
+ error: r.error,
3884
+ detail: r.detail
3885
+ }));
3696
3886
  function deliveryView(d) {
3697
- const answers = "Answers land on the Goal: read them with claim_goal or get_goal. Do not poll this notification.";
3887
+ const answers = "Answers land on the Goal: collect them with contact({wait:true}) or get_goal. Do not resend it.";
3888
+ const pending = d.state === "open" && d.decisionNeeds.some((n) => n.state === "open");
3698
3889
  return compact({
3890
+ ok: d.ok,
3891
+ results: itemsView(d.results),
3699
3892
  deliveryId: d.deliveryId,
3700
3893
  kind: d.kind,
3701
3894
  state: d.state,
3702
3895
  goalIds: d.goalIds,
3703
3896
  conversation: conversation(d),
3704
- // Each ask's own Delivery when a contact carried several — the only handle on the others.
3897
+ // Each item's own Delivery when a contact reached several.
3705
3898
  deliveries: d.deliveries,
3706
- // WHAT THIS CONTACT DID NOT SEND (#2450): asks the intake read kept as progress, by name.
3899
+ // WHAT THIS CONTACT DID NOT SEND (#2450): updates kept as progress, by Goal.
3707
3900
  recorded: d.recorded,
3708
3901
  notSent: d.notSent,
3709
3902
  joinedCard: d.joinedCard,
3710
3903
  joinedCall: d.joinedCall,
3711
- next: d.joinedCall ? `${JOINED_CALL}${d.message ? ` ${d.message}` : ""}` : d.kind === "notification" ? `${d.demoted ? `${d.demoted} ` : ""}${d.joinedCard ? `Added to the open report card on its Goal; no new push was sent. ${answers}` : answers}` : d.state === "open" && d.decisionNeeds.some((n) => n.state === "open") ? `Decision pending. Call contact(${JSON.stringify({ deliveryId: d.deliveryId })}) to continue this same Call \u2014 each call is ONE bounded window, and never resend the ask. When a window comes back with nothing new said, they are not typing: stop rereading, leave the question open, and collect the answer with contact({ wait: false }) or claim_goal on your next wake. ${d.message ?? ""}`.trim() : d.message
3904
+ waitOutcome: d.waitOutcome,
3905
+ acknowledged: d.acknowledged?.filter((a) => a.acknowledged).map((a) => a.eventId),
3906
+ next: [
3907
+ failures(d.results),
3908
+ d.joinedCall ? `${JOINED_CALL}${d.message ? ` ${d.message}` : ""}` : d.kind === "notification" ? `${d.demoted ? `${d.demoted} ` : ""}${d.joinedCard ? `Added to the open report card on its Goal; no new push was sent. ${answers}` : answers}` : pending ? `${d.demoted ? `${d.demoted} ` : ""}Decision pending on this call. ${d.waitOutcome === "expired" ? "Nothing was said in the window. " : ""}Wait for the answer with contact({wait:true}) \u2014 one bounded window each time, and never resend the question. When a window comes back with nothing new, they are not typing: stop waiting, leave the question open, and collect the answer with contact({wait:false}) or claim_goal on your next wake. ${d.message ?? ""}`.trim() : d.message
3909
+ ].filter(Boolean).join(" ")
3910
+ });
3911
+ }
3912
+ function notSentView(n) {
3913
+ return compact({
3914
+ sent: false,
3915
+ ok: n.ok,
3916
+ results: itemsView(n.results),
3917
+ recorded: n.recorded,
3918
+ acknowledged: n.acknowledged?.filter((a) => a.acknowledged).map((a) => a.eventId),
3919
+ next: [failures(n.results), n.message].filter(Boolean).join(" ")
3712
3920
  });
3713
3921
  }
3714
- function receivedView(r) {
3922
+ function quietDays(items, now) {
3923
+ const oldest = Math.min(...items.map((i) => Date.parse(i.since ?? "")).filter(Number.isFinite));
3924
+ return Number.isFinite(oldest) ? Math.max(3, Math.round((now - oldest) / 864e5)) : 3;
3925
+ }
3926
+ var quietFor = (items, now) => {
3927
+ const days = quietDays(items, now);
3928
+ return items.length === 1 ? `for ${days} days` : `, the longest for ${days} days`;
3929
+ };
3930
+ function receivedView(r, now = Date.now()) {
3715
3931
  const w = r.waiting;
3716
3932
  const assigned = w.assigned ?? [];
3717
3933
  const stalled = w.stalled ?? [];
@@ -3734,13 +3950,13 @@ function receivedView(r) {
3734
3950
  stalledOthers: others,
3735
3951
  next: [
3736
3952
  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 ? "No messages." : "Nothing is waiting.",
3737
- ...owed.length ? [`You owe ${owed.length === 1 ? "an answer" : `${owed.length} answers`}: contact({ asks: [{ ask: <your answer>, answers: "<questionId>" }] }) for each question; a question is answered, never acknowledged.`] : [],
3953
+ ...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.`] : [],
3738
3954
  ...r.hasMore ? ["More are waiting: acknowledge these, then receive again."] : [],
3739
3955
  ...r.waitOutcome === "expired" ? ["Nothing arrived in the window; receive again to keep waiting, without sending again."] : [],
3740
3956
  ...assigned.length ? [`${assigned.length} of your Goals are assigned to you and not started (assigned): claim_goal({goalId}) to start one.`] : [],
3741
3957
  ...w.claimable && !assigned.length ? [`claim_goal() hands you ${w.claimable.title ?? w.claimable.goalId} next.`] : [],
3742
- ...stalled.length ? [`${stalled.length} of your Goals have had no progress for 3 days: update_goal each with progress, or finish or cancel it with manage_goals.`] : [],
3743
- ...others.length ? [`${others.length} of other agents' Goals have gone quiet for 3 days: claim_goal({goalId}) joins one without changing its owner.`] : [],
3958
+ ...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.`] : [],
3959
+ ...others.length ? [`${others.length} of other agents' Goals have gone quiet${others.length === 1 ? " " : ""}${quietFor(others, now)}: claim_goal({goalId}) joins one without changing its owner.`] : [],
3744
3960
  // No name of its own (#2525): the API's ask, verbatim.
3745
3961
  ...w.unnamed ? [w.unnamed] : []
3746
3962
  ].join(" ")
@@ -3773,13 +3989,15 @@ async function runTool(name, args, opts) {
3773
3989
  switch (name) {
3774
3990
  case "contact": {
3775
3991
  const parsed = ContactSchema.parse(input);
3776
- if (!("asks" in parsed) && !("deliveryId" in parsed)) return receivedView(await receiveContact(parsed, { ...client, signal, waits }));
3992
+ if (!sendsAnything(parsed)) return receivedView(await receiveContact(parsed, { ...client, signal, waits }));
3777
3993
  const sent = await contact(parsed, { ...client, signal, waits });
3778
- return "sent" in sent ? sent : deliveryView(sent);
3994
+ return "sent" in sent ? notSentView(sent) : deliveryView(sent);
3779
3995
  }
3780
3996
  case "who_is_working":
3781
3997
  WhoIsWorkingSchema.parse(input);
3782
3998
  return whoIsWorking(client);
3999
+ case "send_feedback":
4000
+ return sendFeedback(SendFeedbackSchema.parse(input), client);
3783
4001
  case "manage_goals": {
3784
4002
  const { changes } = ManageGoalsToolSchema.parse(input);
3785
4003
  const versioned = changes.map((c) => {
@@ -3787,7 +4005,7 @@ async function runTool(name, args, opts) {
3787
4005
  const revision = lastRead.get(readKey(client.token, c.goalId));
3788
4006
  return revision === void 0 ? c : { ...c, revision };
3789
4007
  });
3790
- const managed = await manageGoals({ requestId: randomUUID4(), changes: versioned }, client);
4008
+ const managed = await manageGoals({ requestId: randomUUID3(), changes: versioned }, client);
3791
4009
  for (const g of managed.goals ?? []) remember(client.token, g.goalId, g.revision);
3792
4010
  return managedView(managed, changes);
3793
4011
  }
@@ -3802,10 +4020,6 @@ async function runTool(name, args, opts) {
3802
4020
  const diagnosis = goal.diagnosis;
3803
4021
  return diagnosis === void 0 ? view : { ...view, diagnosis };
3804
4022
  }
3805
- case "update_goal": {
3806
- const { goalId, ...body } = UpdateGoalToolSchema.parse(input);
3807
- return goalView(read2(client.token, await updateGoal(goalId, body, client)));
3808
- }
3809
4023
  case "search":
3810
4024
  return searchRecords(SearchToolSchema.parse(input), client);
3811
4025
  default:
@@ -3989,6 +4203,32 @@ function machineZone() {
3989
4203
  return null;
3990
4204
  }
3991
4205
  }
4206
+ function repoFromRemote(url) {
4207
+ const said = (url ?? "").trim();
4208
+ if (!said) return null;
4209
+ const path = said.replace(/^[a-z+]+:\/\/[^/]+\//i, "").replace(/^[^@]+@[^:]+:/, "").replace(/\.git$/i, "").replace(/\/+$/, "");
4210
+ const parts = path.split("/").filter(Boolean);
4211
+ if (parts.length < 2) return null;
4212
+ const [owner, name] = parts.slice(-2);
4213
+ if (!owner || !name) return null;
4214
+ return `${owner}/${name}`.toLowerCase();
4215
+ }
4216
+ var asked;
4217
+ function currentRepo(cwd = process.cwd()) {
4218
+ if (asked !== void 0) return asked;
4219
+ try {
4220
+ const url = execFileSync2("git", ["remote", "get-url", "origin"], {
4221
+ cwd,
4222
+ encoding: "utf8",
4223
+ timeout: 2e3,
4224
+ stdio: ["ignore", "pipe", "ignore"]
4225
+ });
4226
+ asked = repoFromRemote(url);
4227
+ } catch {
4228
+ asked = null;
4229
+ }
4230
+ return asked;
4231
+ }
3992
4232
  function withCodexEnv(text) {
3993
4233
  const head = /^\[mcp_servers\.paigy\][ \t]*(?:#[^\n]*)?\r?\n/m.exec(text);
3994
4234
  if (!head) return null;
@@ -4049,7 +4289,6 @@ export {
4049
4289
  manageGoals,
4050
4290
  claimGoal,
4051
4291
  getGoal,
4052
- updateGoal,
4053
4292
  AWAIT_WINDOW_MS,
4054
4293
  hatch,
4055
4294
  whoAmI,
@@ -4069,8 +4308,7 @@ export {
4069
4308
  dismissTriage,
4070
4309
  searchRecords,
4071
4310
  whoIsWorking,
4072
- repoFromRemote,
4073
- currentRepo,
4311
+ readDelivery,
4074
4312
  contact,
4075
4313
  receive,
4076
4314
  acknowledge,
@@ -4079,5 +4317,7 @@ export {
4079
4317
  runTool,
4080
4318
  subscribeWake,
4081
4319
  parseDue,
4320
+ repoFromRemote,
4321
+ currentRepo,
4082
4322
  withCodexEnv
4083
4323
  };