@paigy/mcp 0.40.33 → 0.40.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,19 +7,21 @@ import { homedir } from "os";
7
7
  import { join } from "path";
8
8
  import { randomUUID as randomUUID2 } from "crypto";
9
9
  import { setTimeout as sleep2 } from "timers/promises";
10
- import { z as z10 } from "zod";
10
+ import { z as z12 } from "zod";
11
11
  import { z } from "zod";
12
12
  import { z as z3 } from "zod";
13
+ import { z as z2 } from "zod";
14
+ import { z as z5 } from "zod";
13
15
  import { ZodFirstPartyTypeKind as ZodFirstPartyTypeKind3 } from "zod/v3";
14
16
  import { ZodFirstPartyTypeKind } from "zod/v3";
15
17
  import { ZodFirstPartyTypeKind as ZodFirstPartyTypeKind2 } from "zod/v3";
16
- import { z as z2 } from "zod";
17
18
  import { z as z4 } from "zod";
18
- import { z as z5 } from "zod";
19
19
  import { z as z6 } from "zod";
20
20
  import { z as z7 } from "zod";
21
21
  import { z as z8 } from "zod";
22
22
  import { z as z9 } from "zod";
23
+ import { z as z10 } from "zod";
24
+ import { z as z11 } from "zod";
23
25
  import { closeSync, existsSync, mkdirSync, openSync, readFileSync as readFileSync2, rmSync, statSync, writeFileSync } from "fs";
24
26
  import { homedir as homedir2 } from "os";
25
27
  import { join as join2 } from "path";
@@ -1549,45 +1551,6 @@ function parseDelay(said2, tz, nowMs, read22 = "earliest") {
1549
1551
  return Math.max(0, Math.round((Date.parse(at2) - nowMs) / 1e3));
1550
1552
  }
1551
1553
  var NIGHT = { from: 23, to: 7 };
1552
- var ASKING_RULES = `HOW TO ASK:
1553
- 1. Write one question per object. Five questions are five objects in \`questions\`, in one contact, so each can be answered on its own; one question with five parts settles nothing until all five are answered.
1554
- 2. Name the Goal you are working on as the question's \`goalId\`: the question goes onto that Goal and its answer comes back there. It must exist: create it with manage_goals first.
1555
- 3. \`workItBlocks\` only for work you are truly blocked on (it asks for a call); leave it out for a question you can keep working around.
1556
- 4. Never hold the process open with while-loops. A wait that comes back \`expired\` is not a finished conversation: wait again with contact({wait:true}) only while you have nothing else to do. While a Call you placed is open, keep receiving window after window until it ends, even when a window is empty: the person may give follow-ups or instructions. With no open Call, STOP WAITING when a window comes back with nothing new \u2014 the question stays open, and its answer reaches you on the Goal. Otherwise, yield only with a working listener or scheduled wakeup, and collect answers with \`contact({wait:false})\` or \`get_goal\` on that wake.
1557
- 5. One question, one row. Never restate a question that is still waiting inside a new contact: keep waiting on the original, or the answer lands on one copy and the other stays open. Take back one that no longer matters with \`withdrawQuestionIds\`.
1558
- 6. Read the Goal's conversation before asking. Never ask again what was answered or already shipped \u2014 and tell its states apart: \`answered\` carries the choice in \`answer\`, while \`replied\` means they said something and chose none of your options, so that question is still yours to settle and their words are the line beside it.
1559
- 7. A question carries its options when you have them; a free-text question may omit them. Each option\u2019s label must stand on its own and name its choice in full -- never \`All three\` or \`Option 2\`. \`pickMode: "many"\` makes the card a checklist (options they may want several of); \`"one"\`, the default, a pick (one rules out the others); \`"rank"\` an ordering. Each question is sent exactly as written, with no reading in between. They can always answer in their own words, so never add an 'Other' option.
1560
- 8. A diagnosis says when, why and how it happens, then proposes one fix. Never options first.
1561
- 9. GIVE A REPORT ITS REPLY: an update takes \`reply\` too, one line the person can tap instead of typing, written in THEIR voice for THAT report ("Sounds good, I'll test later") \u2014 the same care you give a question's options. What they tap is what you read back, which tells you whether they verified your work or only received it. One line, because a report has one way to close, and it may not change what happens next: a reply that would is a question. Requested delivery and completed-Goal reports require a reply (reply_required); ordinary progress may omit it.`;
1562
- function draft2020(node) {
1563
- if (Array.isArray(node)) return node.map(draft2020);
1564
- if (node && typeof node === "object") {
1565
- const o = node;
1566
- if (Array.isArray(o.items)) {
1567
- o.prefixItems = o.items;
1568
- if ("additionalItems" in o) {
1569
- o.items = o.additionalItems;
1570
- delete o.additionalItems;
1571
- } else delete o.items;
1572
- }
1573
- for (const [excl, lim] of [["exclusiveMinimum", "minimum"], ["exclusiveMaximum", "maximum"]]) {
1574
- if (typeof o[excl] === "boolean") {
1575
- if (o[excl] === true && typeof o[lim] === "number") {
1576
- o[excl] = o[lim];
1577
- delete o[lim];
1578
- } else delete o[excl];
1579
- }
1580
- }
1581
- for (const k of Object.keys(o)) o[k] = draft2020(o[k]);
1582
- return o;
1583
- }
1584
- return node;
1585
- }
1586
- function mcpInputSchema(s) {
1587
- const schema = zodToJsonSchema(s, { target: "jsonSchema2019-09", $refStrategy: "none" });
1588
- delete schema.$schema;
1589
- return draft2020(schema);
1590
- }
1591
1554
  var ASK_MAX = 250;
1592
1555
  var UNITS_MAX = 12;
1593
1556
  var UNIT_TITLE_MAX = 50;
@@ -1637,24 +1600,78 @@ function capRefusals(text, units2, field) {
1637
1600
  function refuseOverCaps(text, units2, field, ctx) {
1638
1601
  for (const { path, message, ...params } of capRefusals(text, units2, field)) ctx.addIssue({ code: z2.ZodIssueCode.custom, path, message, params });
1639
1602
  }
1640
- var questionHandle = z2.string().trim().regex(/^[0-9a-fA-F-]{8,36}$/, "a question id, whole or its first eight characters");
1641
- var NodeRef = z2.object({
1642
- type: z2.enum(["goal", "question"]),
1643
- id: z2.string().uuid()
1603
+ var COMPLETION_MESSAGE_MAX = 50;
1604
+ var CompletionSchema = z3.object({
1605
+ goalId: z3.string().uuid().describe("The existing Goal to complete."),
1606
+ message: z3.string().trim().min(1).max(COMPLETION_MESSAGE_MAX, "completion_message_too_long: at most 50 characters; put detail in units.").describe("Completion headline, at most 50 characters."),
1607
+ units: z3.array(UnitInputSchema.extend({
1608
+ title: z3.string().trim().min(1).max(UNIT_TITLE_MAX),
1609
+ body: z3.string().trim().min(1).max(UNIT_BODY_MAX)
1610
+ })).max(UNITS_MAX).optional().describe("Suggest initial state, changes, current state with verification and limits, and next steps / leftover work with its owner when useful. One idea per unit; omit unnecessary sections."),
1611
+ reply: z3.string().trim().min(1).max(OPTION_LABEL_MAX).describe("One acknowledgement in the person's voice, at most 50 characters. Acknowledgement alone requests no follow-up and does not claim they tested the work."),
1612
+ options: z3.array(z3.object({
1613
+ label: z3.string().trim().min(1).max(OPTION_LABEL_MAX),
1614
+ hint: z3.string().trim().min(1).max(OPTION_HINT_MAX)
1615
+ }).strict()).max(5).optional().describe("Optional next steps the person may initiate: label (50 characters) and consequence in hint (200). Selecting one acknowledges the report and requests that step from its author; it never reopens this Goal.")
1616
+ }).strict();
1617
+ var CompleteChangeSchema = CompletionSchema.extend({ kind: z3.literal("complete") });
1618
+ var ASKING_RULES = `HOW TO ASK:
1619
+ 1. Write one question per object. Five questions are five objects in \`questions\`, in one contact, so each can be answered on its own; one question with five parts settles nothing until all five are answered.
1620
+ 2. Name the Goal you are working on as the question's \`goalId\`: the question goes onto that Goal and its answer comes back there. It must exist: create it with manage_goals first.
1621
+ 3. \`workItBlocks\` only for work you are truly blocked on (it asks for a call); leave it out for a question you can keep working around.
1622
+ 4. Never hold the process open with while-loops. A wait that comes back \`expired\` is not a finished conversation: wait again with contact({wait:true}) only while you have nothing else to do. While a Call you placed is open, keep receiving window after window until it ends, even when a window is empty: the person may give follow-ups or instructions. With no open Call, STOP WAITING when a window comes back with nothing new \u2014 the question stays open, and its answer reaches you on the Goal. Otherwise, yield only with a working listener or scheduled wakeup, and collect answers with \`contact({wait:false})\` or \`get_goals\` on that wake.
1623
+ 5. One question, one row. Never restate a question that is still waiting inside a new contact: keep waiting on the original, or the answer lands on one copy and the other stays open. Take back one that no longer matters with \`withdrawQuestionIds\`.
1624
+ 6. Read the Goal's conversation before asking. Never ask again what was answered or already shipped \u2014 and tell its states apart: \`answered\` carries the choice in \`answer\`, while \`replied\` means they said something and chose none of your options, so that question is still yours to settle and their words are the line beside it.
1625
+ 7. A question carries its options when you have them; a free-text question may omit them. Each option\u2019s label must stand on its own and name its choice in full -- never \`All three\` or \`Option 2\`. \`pickMode: "many"\` makes the card a checklist (options they may want several of); \`"one"\`, the default, a pick (one rules out the others); \`"rank"\` an ordering. Each question is sent exactly as written, with no reading in between. They can always answer in their own words, so never add an 'Other' option.
1626
+ 8. A diagnosis says when, why and how it happens, then proposes one fix. Never options first.
1627
+ 9. GIVE A REPORT ITS REPLY: an update takes \`reply\` too, one line the person can tap instead of typing, written in THEIR voice for THAT report ("Sounds good, I'll test later") \u2014 the same care you give a question's options. What they tap is what you read back, which tells you whether they verified your work or only received it. One line, because a report has one way to close, and it may not change what happens next: a reply that would is a question. Requested delivery and completed-Goal reports require a reply (reply_required); ordinary progress may omit it.`;
1628
+ function draft2020(node) {
1629
+ if (Array.isArray(node)) return node.map(draft2020);
1630
+ if (node && typeof node === "object") {
1631
+ const o = node;
1632
+ if (Array.isArray(o.items)) {
1633
+ o.prefixItems = o.items;
1634
+ if ("additionalItems" in o) {
1635
+ o.items = o.additionalItems;
1636
+ delete o.additionalItems;
1637
+ } else delete o.items;
1638
+ }
1639
+ for (const [excl, lim] of [["exclusiveMinimum", "minimum"], ["exclusiveMaximum", "maximum"]]) {
1640
+ if (typeof o[excl] === "boolean") {
1641
+ if (o[excl] === true && typeof o[lim] === "number") {
1642
+ o[excl] = o[lim];
1643
+ delete o[lim];
1644
+ } else delete o[excl];
1645
+ }
1646
+ }
1647
+ for (const k of Object.keys(o)) o[k] = draft2020(o[k]);
1648
+ return o;
1649
+ }
1650
+ return node;
1651
+ }
1652
+ function mcpInputSchema(s) {
1653
+ const schema = zodToJsonSchema(s, { target: "jsonSchema2019-09", $refStrategy: "none" });
1654
+ delete schema.$schema;
1655
+ return draft2020(schema);
1656
+ }
1657
+ var questionHandle = z4.string().trim().regex(/^[0-9a-fA-F-]{8,36}$/, "a question id, whole or its first eight characters");
1658
+ var NodeRef = z4.object({
1659
+ type: z4.enum(["goal", "question"]),
1660
+ id: z4.string().uuid()
1644
1661
  }).strict().describe("A Goal or a Question, by its id.");
1645
- var BlockedAction = z2.enum(["start", "complete", "answer"]).describe("What waits: starting or completing a Goal, or answering a Question.");
1646
- var reason = z2.string().trim().min(1).max(500).describe("Why, as an explanation, never as policy.");
1662
+ var BlockedAction = z4.enum(["start", "complete", "answer"]).describe("What waits: starting or completing a Goal, or answering a Question.");
1663
+ var reason = z4.string().trim().min(1).max(500).describe("Why, as an explanation, never as policy.");
1647
1664
  var actionFits = (b) => b.blocked.type === "goal" === (b.action !== "answer");
1648
1665
  var ACTION_FITS = "a goal is blocked from start or complete; a question from answer";
1649
- var userExplicitlyRequested = z2.enum(["any", "call"]).optional().describe(
1666
+ var userExplicitlyRequested = z4.enum(["any", "call"]).optional().describe(
1650
1667
  `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.`
1651
1668
  );
1652
- var units = z2.array(UnitInputSchema).optional().describe(
1669
+ var units = z4.array(UnitInputSchema).optional().describe(
1653
1670
  `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.`
1654
1671
  );
1655
- var UpdateInputSchema = z2.object({
1656
- message: z2.string().trim().min(1).describe(`The one point, at most ${ASK_MAX} characters; the context goes in units.`),
1657
- 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."),
1672
+ var UpdateInputSchema = z4.object({
1673
+ message: z4.string().trim().min(1).describe(`The one point, at most ${ASK_MAX} characters; the context goes in units.`),
1674
+ goalIds: z4.array(z4.string().uuid()).min(1).max(10).describe("The Goals it is about, each one that exists: the one it is mainly about first."),
1658
1675
  units,
1659
1676
  // A REPORT KEEPS ITS TAP (#2799, #3260; owner, 2026-10-08, settling #2776: "keep the reports open
1660
1677
  // until the user acknowledges them"). A report asks nothing, so it opens no Question -- but it
@@ -1676,14 +1693,14 @@ var UpdateInputSchema = z2.object({
1676
1693
  // `options` and this field are one job: the list is deleted, not deprecated (ONE JOB, ONE
1677
1694
  // MECHANISM). It rides the door as the report's single stored option (`storedOption`,
1678
1695
  // `apps/api/src/goal/router.ts`), so no reader below the door learns a second shape.
1679
- reply: z2.string().trim().min(1).describe(
1696
+ reply: z4.string().trim().min(1).describe(
1680
1697
  `What this report's button says instead of "Got it", at most ${OPTION_LABEL_MAX} characters, written in THEIR voice for THIS report ("Sounds good, I'll test later") -- the care you give a question's options, so what they tap tells you whether they verified your work or only received it. One tap sends exactly these words back to you. Words that would CHANGE what happens next are a question, not a reply to a report: it still asks nothing and still owes you no answer. The reply is required for requested delivery and completed Goals; ordinary progress may omit it.`
1681
1698
  ).optional(),
1682
1699
  userExplicitlyRequested
1683
1700
  }).strict().superRefine((u, ctx) => {
1684
1701
  if (u.userExplicitlyRequested && !u.reply) {
1685
1702
  ctx.addIssue({
1686
- code: z2.ZodIssueCode.custom,
1703
+ code: z4.ZodIssueCode.custom,
1687
1704
  path: ["reply"],
1688
1705
  params: { refusal: "reply_required" },
1689
1706
  message: "reply_required: an update requested for delivery needs one reply, written in the person\u2019s voice for this report."
@@ -1692,7 +1709,7 @@ var UpdateInputSchema = z2.object({
1692
1709
  refuseOverCaps(u.message, u.units, "message", ctx);
1693
1710
  if (u.reply && u.reply.length > OPTION_LABEL_MAX) {
1694
1711
  ctx.addIssue({
1695
- code: z2.ZodIssueCode.custom,
1712
+ code: z4.ZodIssueCode.custom,
1696
1713
  path: ["reply"],
1697
1714
  params: { refusal: "reply_too_long", length: u.reply.length, cap: OPTION_LABEL_MAX },
1698
1715
  message: `reply_too_long: the reply is ${u.reply.length} characters; the cap is ${OPTION_LABEL_MAX}. It is a button's words, so say it in a breath.`
@@ -1700,96 +1717,99 @@ var UpdateInputSchema = z2.object({
1700
1717
  }
1701
1718
  });
1702
1719
  var questionFields = {
1703
- question: z2.string().trim().min(1).describe(
1720
+ question: z4.string().trim().min(1).describe(
1704
1721
  `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.`
1705
1722
  ),
1706
- 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."),
1723
+ goalId: z4.string().uuid().describe("The Goal the question is about, which must exist (create it with manage_goals first). Its answer comes back there."),
1707
1724
  units,
1708
- options: z2.array(OptionInputSchema).min(1).max(6).optional().describe("The choices, when you have them. Each label stands on its own, at most 50 characters; a hint, at most 200."),
1725
+ options: z4.array(OptionInputSchema).min(1).max(6).optional().describe("The choices, when you have them. Each label stands on its own, at most 50 characters; a hint, at most 200."),
1709
1726
  // HOW THE OPTIONS ARE ANSWERED, SAID BY THE AGENT (owner, 2026-10-02: "one and many makes sense";
1710
1727
  // brain_prompts.md §1: structured agent questions need no model). The app draws all three.
1711
- pickMode: z2.enum(["one", "many", "rank"]).optional().describe(
1728
+ pickMode: z4.enum(["one", "many", "rank"]).optional().describe(
1712
1729
  '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.'
1713
1730
  ),
1714
1731
  // WHAT THE QUESTION HOLDS UP (brain_prompts.md §2.1): replaces `waiting: 'hard'`. A question that
1715
1732
  // blocks work asks for a call (the person's settings and ring cooldowns still decide).
1716
- workItBlocks: z2.array(z2.object({ blocked: NodeRef, action: BlockedAction, reason: reason.optional() }).strict().refine(actionFits, ACTION_FITS)).min(1).max(10).optional().describe(
1733
+ workItBlocks: z4.array(z4.object({ blocked: NodeRef, action: BlockedAction, reason: reason.optional() }).strict().refine(actionFits, ACTION_FITS)).min(1).max(10).optional().describe(
1717
1734
  "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."
1718
1735
  ),
1719
1736
  userExplicitlyRequested
1720
1737
  };
1721
1738
  var refineQuestion = (q, ctx) => {
1722
1739
  refuseOverCaps(q.question, q.units, "question", ctx);
1723
- if (q.pickMode && !q.options) ctx.addIssue({ code: z2.ZodIssueCode.custom, path: ["pickMode"], message: "pickMode comes only with options" });
1740
+ if (q.pickMode && !q.options) ctx.addIssue({ code: z4.ZodIssueCode.custom, path: ["pickMode"], message: "pickMode comes only with options" });
1724
1741
  const ids = (q.options ?? []).map((o) => o.id);
1725
1742
  if (ids.some((id2) => id2) && (ids.some((id2) => !id2) || new Set(ids).size !== ids.length)) {
1726
- ctx.addIssue({ code: z2.ZodIssueCode.custom, path: ["options"], message: "give every option a distinct id, or none" });
1743
+ ctx.addIssue({ code: z4.ZodIssueCode.custom, path: ["options"], message: "give every option a distinct id, or none" });
1727
1744
  }
1728
1745
  };
1729
- var QuestionInputSchema = z2.object({
1730
- 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."),
1746
+ var QuestionInputSchema = z4.object({
1747
+ questionId: z4.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."),
1731
1748
  ...questionFields
1732
1749
  }).strict().superRefine(refineQuestion);
1733
- var QuestionWireSchema = z2.object({ questionId: z2.string().uuid(), ...questionFields }).strict().superRefine(refineQuestion);
1734
- var AnswerInputSchema = z2.object({
1750
+ var QuestionWireSchema = z4.object({ questionId: z4.string().uuid(), ...questionFields }).strict().superRefine(refineQuestion);
1751
+ var AnswerInputSchema = z4.object({
1735
1752
  questionId: questionHandle.describe("The Question you answer: its id as the event or the conversation shows it (8 characters or whole)."),
1736
- answer: z2.object({
1737
- text: z2.string().trim().min(1).describe(`Your answer in your own words, at most ${ASK_MAX} characters; the context goes in units.`),
1738
- 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).")
1753
+ answer: z4.object({
1754
+ text: z4.string().trim().min(1).describe(`Your answer in your own words, at most ${ASK_MAX} characters; the context goes in units.`),
1755
+ selectedOptionIds: z4.array(z4.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).")
1739
1756
  }).strict(),
1740
1757
  units
1741
1758
  }).strict().superRefine((a, ctx) => refuseOverCaps(a.answer.text, a.units, "text", ctx));
1742
- var QuestionDependencySchema = z2.object({
1759
+ var QuestionDependencySchema = z4.object({
1743
1760
  questionId: questionHandle.describe("A Question you asked."),
1744
- change: z2.enum(["add", "remove"]),
1761
+ change: z4.enum(["add", "remove"]),
1745
1762
  blocked: NodeRef,
1746
1763
  action: BlockedAction,
1747
1764
  reason: reason.optional()
1748
1765
  }).strict().refine(actionFits, ACTION_FITS);
1749
1766
  var sendFields = {
1750
- updates: z2.array(UpdateInputSchema).min(1).max(20).optional().describe(
1767
+ completions: z4.array(CompletionSchema).min(1).max(20).optional().describe("Close existing Goals and deliver their completion reports atomically. Ordinary updates never close work."),
1768
+ updates: z4.array(UpdateInputSchema).min(1).max(20).optional().describe(
1751
1769
  "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."
1752
1770
  ),
1753
- answers: z2.array(AnswerInputSchema).min(1).max(20).optional().describe("Answers to Questions addressed to you."),
1754
- withdrawQuestionIds: z2.array(questionHandle).min(1).max(10).optional().describe(
1771
+ answers: z4.array(AnswerInputSchema).min(1).max(20).optional().describe("Answers to Questions addressed to you."),
1772
+ withdrawQuestionIds: z4.array(questionHandle).min(1).max(10).optional().describe(
1755
1773
  "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."
1756
1774
  ),
1757
- questionDependencies: z2.array(QuestionDependencySchema).min(1).max(20).optional().describe(
1775
+ questionDependencies: z4.array(QuestionDependencySchema).min(1).max(20).optional().describe(
1758
1776
  "Add or remove what a Question you asked holds up, after asking it."
1759
1777
  )
1760
1778
  };
1761
- var ContactSchema = z2.object({
1779
+ var ContactSchema = z4.object({
1762
1780
  ...sendFields,
1763
- questions: z2.array(QuestionInputSchema).min(1).max(20).optional().describe("Questions for the person, one per object."),
1781
+ questions: z4.array(QuestionInputSchema).min(1).max(20).optional().describe("Questions for the person, one per object."),
1764
1782
  /** RECEIVING (2I, I2; brain_prompts.md §2.2): the events this agent handled. */
1765
- ackEventIds: z2.array(z2.string().uuid()).min(1).max(100).optional().describe(
1783
+ ackEventIds: z4.array(z4.string().uuid()).min(1).max(100).optional().describe(
1766
1784
  "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."
1767
1785
  ),
1768
- wait: z2.boolean().optional().describe(
1786
+ wait: z4.boolean().optional().describe(
1769
1787
  "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`."
1770
1788
  )
1771
1789
  }).strict();
1772
- var sendsAnything = (c) => !!(c.updates?.length || c.questions?.length || c.answers?.length || c.withdrawQuestionIds?.length || c.questionDependencies?.length);
1773
- var ContactWireSchema = z2.object({
1774
- operationId: z2.string().uuid(),
1790
+ var sendsAnything = (c) => !!(c.completions?.length || c.updates?.length || c.questions?.length || c.answers?.length || c.withdrawQuestionIds?.length || c.questionDependencies?.length);
1791
+ var ContactWireSchema = z4.object({
1792
+ operationId: z4.string().uuid(),
1775
1793
  ...sendFields,
1776
- questions: z2.array(QuestionWireSchema).min(1).max(20).optional()
1794
+ questions: z4.array(QuestionWireSchema).min(1).max(20).optional()
1777
1795
  }).strict().refine(sendsAnything, "a contact sends at least one update, question, answer, withdrawal or question dependency");
1778
1796
  var CONTACT_SCHEMA = { type: "object", ...mcpInputSchema(ContactSchema) };
1779
- var CONTACT_DESCRIPTION = "Send to and receive from the person: updates, questions, answers to questions addressed to you, withdrawals of your own questions, and what a question holds up. Every Goal you name must already exist: create it with manage_goals first; an unknown Goal is refused and nothing is sent. Every item applies on its own: read `results`, where a failed item names why while the rest still apply.\n\n" + ASKING_RULES + `
1797
+ var CONTACT_DESCRIPTION = "Send to and receive from the person: completions, updates, questions, answers to questions addressed to you, withdrawals of your own questions, and what a question holds up. Every Goal you name must already exist: create it with manage_goals first; an unknown Goal is refused and nothing is sent. Every item applies on its own: read `results`, where a failed item names why while the rest still apply.\n\n" + ASKING_RULES + `
1780
1798
 
1781
1799
  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.
1782
1800
 
1783
- UPDATES ask nothing, so no answer is owed and none should be awaited. An update reaches the person only when they asked you for it (userExplicitlyRequested), when it answers something they said, or once its Goal is done; any other is recorded as the Goal's progress and nobody is notified. So when the work is finished, mark the Goal done first (manage_goals), then send one update saying what is done and anything they need to do or check. On a Goal whose report card is still open, an update that reaches them is added to that card, with no new push. If the person is already on a call, anything that reaches them joins that call, with no ring.
1801
+ UPDATES ask nothing, so no answer is owed and none should be awaited. An update reaches the person only when they asked you for it (userExplicitlyRequested), when it answers something they said, or once its Goal is done; any other is recorded as the Goal's progress and nobody is notified. Ordinary updates never close a Goal. On a Goal whose report card is still open, an update that reaches them is added to that card, with no new push. If the person is already on a call, anything that reaches them joins that call, with no ring.
1784
1802
 
1785
- RECEIVING: a contact that sends nothing returns \`events\`, a limited batch of what is addressed to you (not a history page): \`question\`, a Question you owe (answer it in answers, with its questionId); \`update\`, something new on one of your Goals (a reply, an answer: read it with get_goal); \`instruction\`, a request or note sent to you. \`hasMore\` says more are waiting. Reading acknowledges nothing: once you have handled events, confirm their eventIds with contact({ackEventIds}), and the next batch can come. contact({}) waits up to about 45 seconds for something to arrive; contact({wait:false}) returns at once. It also lists work given to you that nobody has started (\`assigned\`; your first write to it starts it) and your work gone quiet (\`stalled\`).`;
1786
- var CreateGoalSchema = z3.object({
1787
- outcome: z3.string().trim().min(1).max(1e4),
1803
+ COMPLETIONS close and report in one operation: completions:[{goalId,message,units?,reply,options?}]. The same contract works in manage_goals changes with kind:complete. message is at most 50 characters; use units when useful for initial state, changes, current state (verification and limits), and next steps / leftover work with its owner. reply is one acknowledgement in the person's voice. Optional options:[{label,hint}] suggest next steps: a tap acknowledges the report and requests that step from its author. It never reopens the completed Goal; follow-up work needs a new Goal. Closure and the report commit together or neither does. Required children and dependencies must already be finished. No Reviewer rejudges your completion; say only what your evidence supports.
1804
+
1805
+ RECEIVING: a contact that sends nothing returns \`events\`, a limited batch of what is addressed to you (not a history page): \`question\`, a Question you owe (answer it in answers, with its questionId); \`update\`, something new on one of your Goals (a reply, an answer: read it with get_goals); \`instruction\`, a request or note sent to you. \`hasMore\` says more are waiting. Reading acknowledges nothing: once you have handled events, confirm their eventIds with contact({ackEventIds}), and the next batch can come. contact({}) waits up to about 45 seconds for something to arrive; contact({wait:false}) returns at once. It also lists work given to you that nobody has started (\`assigned\`; your first write to it starts it) and your work gone quiet (\`stalled\`).`;
1806
+ var CreateGoalSchema = z5.object({
1807
+ outcome: z5.string().trim().min(1).max(1e4),
1788
1808
  /** The work's NAME (#2115) — one to five words, how a person refers to it out loud ("the night
1789
1809
  * rings"). Omit it and the brain writes one at admission from the outcome. */
1790
- title: z3.string().trim().min(1).max(80).optional(),
1791
- ownerParticipant: z3.string().trim().min(1).optional(),
1792
- idempotencyKey: z3.string().trim().min(1).max(200),
1810
+ title: z5.string().trim().min(1).max(80).optional(),
1811
+ ownerParticipant: z5.string().trim().min(1).optional(),
1812
+ idempotencyKey: z5.string().trim().min(1).max(200),
1793
1813
  /** THE GOAL THIS ONE BELONGS UNDER (owner, 2026-09-15: "the ask I gave for the design doc
1794
1814
  * didn't get created as a child goal of the voice UI goal, which is how it should've
1795
1815
  * worked"). It could not have been: this door took no parent, so the only route was
@@ -1797,64 +1817,65 @@ var CreateGoalSchema = z3.object({
1797
1817
  * took the short one. The hierarchy has been modelled since Goals existed and had been used
1798
1818
  * ZERO times in 2,031 of them. Absent, the server judges it against the caller's open Goals
1799
1819
  * (`apps/api/src/goal/intake.ts`). The writer refuses a Goal belonging to another account. */
1800
- parentGoalId: z3.string().uuid().optional(),
1820
+ parentGoalId: z5.string().uuid().optional(),
1801
1821
  /** The repository or project identifier this Goal belongs to (#2280) — e.g. "owner/repo" or
1802
1822
  * repo name. Delegated work inherits this from its parent Goal when omitted. */
1803
- repo: z3.string().trim().min(1).max(200).optional()
1823
+ repo: z5.string().trim().min(1).max(200).optional()
1804
1824
  });
1805
- var UpdateGoalSchema = z3.object({
1806
- revision: z3.number().int().positive(),
1807
- changes: z3.object({
1808
- outcome: z3.string().trim().min(1).max(1e4).optional(),
1825
+ var UpdateGoalSchema = z5.object({
1826
+ revision: z5.number().int().positive(),
1827
+ changes: z5.object({
1828
+ outcome: z5.string().trim().min(1).max(1e4).optional(),
1809
1829
  /** The work's NAME (#2115) — one to five words, how a person refers to it out loud. The
1810
1830
  * brain writes one at admission; this is the owner saying it better. Null clears it. */
1811
- title: z3.string().trim().min(1).max(80).nullable().optional(),
1812
- ownerParticipant: z3.string().trim().min(1).optional(),
1813
- parentGoalId: z3.string().uuid().nullable().optional(),
1814
- dependencies: z3.array(z3.object({ goalId: z3.string().uuid(), gate: z3.enum(["start", "finish"]) }).strict()).optional(),
1815
- children: z3.array(z3.object({ outcome: z3.string().trim().min(1).max(1e4), ownerParticipant: z3.string().trim().min(1), gate: z3.enum(["start", "finish"]).optional() }).strict()).optional(),
1816
- state: z3.enum(["active", "done", "cancelled"]).optional(),
1817
- progress: z3.string().trim().min(1).max(1e4).optional(),
1818
- reviewed: z3.literal(true).optional(),
1819
- dueAt: z3.string().datetime({ offset: true }).nullable().optional()
1831
+ title: z5.string().trim().min(1).max(80).nullable().optional(),
1832
+ ownerParticipant: z5.string().trim().min(1).optional(),
1833
+ parentGoalId: z5.string().uuid().nullable().optional(),
1834
+ dependencies: z5.array(z5.object({ goalId: z5.string().uuid(), gate: z5.enum(["start", "finish"]) }).strict()).optional(),
1835
+ children: z5.array(z5.object({ outcome: z5.string().trim().min(1).max(1e4), ownerParticipant: z5.string().trim().min(1), gate: z5.enum(["start", "finish"]).optional() }).strict()).optional(),
1836
+ state: z5.enum(["active", "done", "cancelled"]).optional(),
1837
+ progress: z5.string().trim().min(1).max(1e4).optional(),
1838
+ reviewed: z5.literal(true).optional(),
1839
+ dueAt: z5.string().datetime({ offset: true }).nullable().optional()
1820
1840
  }).strict().refine((v) => Object.keys(v).length > 0),
1821
- reason: z3.string().trim().min(1).max(2e3),
1822
- operationId: z3.string().uuid().optional()
1841
+ reason: z5.string().trim().min(1).max(2e3),
1842
+ operationId: z5.string().uuid().optional()
1823
1843
  }).strict();
1824
- var changedGoal = z3.string().uuid().describe("The Goal to change, as a read shows it.");
1825
- 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.");
1844
+ var changedGoal = z5.string().uuid().describe("The Goal to change, as a read shows it.");
1845
+ var goalTitle = z5.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.");
1826
1846
  var GOAL_OUTCOME_MAX = 500;
1827
- var goalOutcome = z3.string().trim().min(1).max(GOAL_OUTCOME_MAX, `outcome_too_long: a Goal's outcome is one paragraph, at most ${GOAL_OUTCOME_MAX} characters; split the rest into child Goals (create with parentGoalId).`).describe(`The desired result, one paragraph of at most ${GOAL_OUTCOME_MAX} characters. More than that is more work: create child Goals under it (parentGoalId). There is no third description field.`);
1828
- var CreateChange = z3.object({
1829
- kind: z3.literal("create"),
1847
+ var goalOutcome = z5.string().trim().min(1).max(GOAL_OUTCOME_MAX, `outcome_too_long: a Goal's outcome is one paragraph, at most ${GOAL_OUTCOME_MAX} characters; split the rest into child Goals (create with parentGoalId).`).describe(`The desired result, one paragraph of at most ${GOAL_OUTCOME_MAX} characters. More than that is more work: create child Goals under it (parentGoalId). There is no third description field.`);
1848
+ var CreateChange = z5.object({
1849
+ kind: z5.literal("create"),
1830
1850
  title: goalTitle,
1831
1851
  outcome: goalOutcome,
1832
- ownerId: z3.string().trim().min(1).optional().describe("Who owns the work: an agent's participant (as check_activity shows it) or the person's. Omitted: you."),
1833
- parentGoalId: z3.string().uuid().optional().describe("The Goal it belongs under. Omitted: a root."),
1834
- sourceEntryIds: z3.array(z3.string().uuid()).max(20).optional().describe("The whole Entries the work came from, ones you can read.")
1852
+ ownerId: z5.string().trim().min(1).optional().describe("Who owns the work: an agent's participant (as check_activity shows it) or the person's. Omitted: you."),
1853
+ parentGoalId: z5.string().uuid().optional().describe("The Goal it belongs under. Omitted: a root."),
1854
+ sourceEntryIds: z5.array(z5.string().uuid()).max(20).optional().describe("The whole Entries the work came from, ones you can read.")
1835
1855
  }).strict();
1836
- var EditChange = z3.object({ kind: z3.literal("edit"), goalId: changedGoal, title: goalTitle.optional(), outcome: goalOutcome.optional() }).strict();
1837
- var StateChange = z3.object({ kind: z3.literal("state"), goalId: changedGoal, state: z3.enum(["open", "completed", "canceled"]).describe(
1856
+ var EditChange = z5.object({ kind: z5.literal("edit"), goalId: changedGoal, title: goalTitle.optional(), outcome: goalOutcome.optional() }).strict();
1857
+ var StateChange = z5.object({ kind: z5.literal("state"), goalId: changedGoal, state: z5.enum(["open", "completed", "canceled"]).describe(
1838
1858
  "completed: the Goal's own work is done now (refused while required children are open); open: reopen it; canceled: it will not be done."
1839
1859
  ) }).strict();
1840
- var AssignChange = z3.object({ kind: z3.literal("assign"), goalId: changedGoal, ownerId: z3.string().trim().min(1).describe("The new owner's participant.") }).strict();
1841
- var DeferChange = z3.object({ kind: z3.literal("defer"), goalId: changedGoal, until: z3.string().datetime({ offset: true }).nullable().describe(
1860
+ var AssignChange = z5.object({ kind: z5.literal("assign"), goalId: changedGoal, ownerId: z5.string().trim().min(1).describe("The new owner's participant.") }).strict();
1861
+ var DeferChange = z5.object({ kind: z5.literal("defer"), goalId: changedGoal, until: z5.string().datetime({ offset: true }).nullable().describe(
1842
1862
  "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."
1843
1863
  ) }).strict();
1844
- var MoveChange = z3.object({ kind: z3.literal("move"), goalId: changedGoal, parentGoalId: z3.string().uuid().nullable().describe(
1864
+ var MoveChange = z5.object({ kind: z5.literal("move"), goalId: changedGoal, parentGoalId: z5.string().uuid().nullable().describe(
1845
1865
  "Its new parent, or null for a root. Only this Goal moves; its new parent's other children stay."
1846
1866
  ) }).strict();
1847
- var DependencyChange = z3.object({
1848
- kind: z3.literal("dependency"),
1849
- change: z3.enum(["add", "remove"]),
1867
+ var DependencyChange = z5.object({
1868
+ kind: z5.literal("dependency"),
1869
+ change: z5.enum(["add", "remove"]),
1850
1870
  goalId: changedGoal,
1851
- dependsOnGoalId: z3.string().uuid().describe("The Goal it waits on."),
1852
- action: z3.enum(["start", "complete"]).describe("What waits: starting goalId, or completing it."),
1853
- reason: z3.string().trim().min(1).max(250).optional().describe("Why, at most 250 characters, as an explanation, never as policy.")
1871
+ dependsOnGoalId: z5.string().uuid().describe("The Goal it waits on."),
1872
+ action: z5.enum(["start", "complete"]).describe("What waits: starting goalId, or completing it."),
1873
+ reason: z5.string().trim().min(1).max(250).optional().describe("Why, at most 250 characters, as an explanation, never as policy.")
1854
1874
  }).strict();
1855
- var read = { revision: z3.number().int().positive().optional() };
1856
- var GoalChangeSchema = z3.discriminatedUnion("kind", [
1875
+ var read = { revision: z5.number().int().positive().optional() };
1876
+ var GoalChangeSchema = z5.discriminatedUnion("kind", [
1857
1877
  CreateChange,
1878
+ CompleteChangeSchema.extend(read),
1858
1879
  EditChange.extend(read),
1859
1880
  StateChange.extend(read),
1860
1881
  AssignChange.extend(read),
@@ -1864,47 +1885,43 @@ var GoalChangeSchema = z3.discriminatedUnion("kind", [
1864
1885
  ]);
1865
1886
  var editNames = (changes, ctx) => changes.forEach((c, i) => {
1866
1887
  if (c.kind === "edit" && c.title === void 0 && c.outcome === void 0) {
1867
- ctx.addIssue({ code: z3.ZodIssueCode.custom, path: ["changes", i], message: "an edit supplies title, outcome, or both" });
1888
+ ctx.addIssue({ code: z5.ZodIssueCode.custom, path: ["changes", i], message: "an edit supplies title, outcome, or both" });
1868
1889
  }
1869
1890
  });
1870
- var ManageGoalsSchema = z3.object({
1871
- requestId: z3.string().uuid().optional(),
1872
- changes: z3.array(GoalChangeSchema).min(1).max(50)
1891
+ var ManageGoalsSchema = z5.object({
1892
+ requestId: z5.string().uuid().optional(),
1893
+ changes: z5.array(GoalChangeSchema).min(1).max(50)
1873
1894
  }).strict().superRefine((v, ctx) => editNames(v.changes, ctx));
1874
- var ManageGoalsToolSchema = z3.object({
1875
- 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.")
1895
+ var ManageGoalsToolSchema = z5.object({
1896
+ changes: z5.array(z5.discriminatedUnion("kind", [CreateChange, CompleteChangeSchema, EditChange, StateChange, AssignChange, DeferChange, MoveChange, DependencyChange])).min(1).max(50).describe("The changes, applied in order, each on its own.")
1876
1897
  }).strict().superRefine((v, ctx) => editNames(v.changes, ctx));
1877
- 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_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 (an outcome is one paragraph, at most 500 characters: split more into child Goals with parentGoalId); 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 any Goal of your person; a change puts you on it. Returns `ok` (every change applied), `results` per change (applied or failed), and `goals`, each changed Goal's id, state, title, outcome and revision.";
1878
- var GetGoalSchema = z3.object({
1879
- goalId: z3.string().uuid(),
1898
+ 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_found) and the rest still apply, so read every result: a partial result is never a complete success. Kinds: complete (goalId, message capped at 50 characters, units, reply, optional next-step options {label, hint}) closes and reports atomically, exactly as contact.completions; 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 (an outcome is one paragraph, at most 500 characters: split more into child Goals with parentGoalId); 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_goals) and reconsider. You may change any Goal of your person; a change puts you on it. Returns `ok` (every change applied), `results` per change (applied or failed), and `goals`, each changed Goal's id, state, title, outcome and revision.";
1899
+ var GetGoalsSchema = z5.object({
1900
+ goalIds: z5.array(z5.string().uuid()).min(1).max(10).describe("The Goals to read, in order; one to ten IDs."),
1880
1901
  /** Every entry in full. Without it the read carries the person's words, open questions and your
1881
1902
  * newest entry, and counts what it left out (`apps/api/src/goal/collapse.ts`). */
1882
- history: z3.boolean().optional(),
1883
- /** WHEN A READ HAS CONFUSED YOU. Adds `diagnosis`: every reader that already answers a question
1884
- * about this work, each answer attributed to the reader that gave it, and every disagreement
1885
- * between two of them named. Off by default; `docs/model/goal/diagnose-design.md`. */
1886
- diagnose: z3.boolean().optional()
1903
+ history: z5.boolean().optional()
1887
1904
  }).strict();
1888
- var GetDeliverySchema = z3.object({
1889
- deliveryId: z3.string().uuid().describe("The Delivery id returned by contact or receive.")
1905
+ var GetDeliverySchema = z5.object({
1906
+ deliveryId: z5.string().uuid().describe("The Delivery id returned by contact or receive.")
1890
1907
  }).strict();
1891
1908
  var GET_DELIVERY_DESCRIPTION = "Read a Delivery in full: its whole ask, units, options and answers, plus current callState and callOutcome for a Call. Any agent of the same account may read it; another account is not disclosed. Reading never acknowledges or resends anything. Use this after a call or when receive names a Call you are waiting on.";
1892
- var GET_GOAL_DESCRIPTION = "Read one Goal (a read never puts you on it), including others (the ten most recent other contributors, with names, latest entry headlines and times): its outcome, state, revision, progress, blockers, the conversation on it (each question with its options and what was decided), `next`, the one step to take, and `more`, where to read further. A question in that conversation reads `open` (nothing yet), `answered` (a choice was made, and `answer` carries it), `replied` (they said something and the read settled the question on their words \u2014 NO option of yours was chosen, and the words are the reply line beside it, so read that before you act), or `closed`. The conversation carries everything the person said, every open question and your newest entry; your older entries are left out and counted \u2014 history: true reads every entry in full. Every Goal of your person is readable, whichever of their agents owns it; another account's Goals are not disclosed.\n\ndiagnose: true is for when a read has CONFUSED you \u2014 not for the working loop. It adds `diagnosis`, which asks every reader that already answers a question about your work and NAMES the reader behind every value, so you never guess which of two places to look: what state your work is really in (the stored `goals.state` beside the derived `goal_execution_state`, which can differ); whether anything is armed to ring and when (`ladder_candidates`, with the ladder's own last decision); whether a wake fired for you and what it did (durable `wake.*` events, beside when your process was last heard from); and what has reached you (`list_waiting` \u2014 review flags, unstarted work, open questions, the person's newest words). Read `diagnosis.disagreements` FIRST: each one is two readers giving different values for the same fact, with both values and both sources, and it never chooses between them \u2014 that is yours to do, from the Goal's own history. `diagnosis.looked` names every reader asked, including any that could not answer, so an empty answer is never confused with a broken one.";
1893
- var SearchToolSchema = z3.object({
1894
- query: z3.string().trim().min(1).max(500),
1895
- types: z3.array(z3.enum(["entry", "goal", "answer"])).min(1).optional(),
1896
- goalId: z3.string().uuid().optional(),
1897
- limit: z3.number().int().min(1).max(20).optional()
1909
+ var GET_GOALS_DESCRIPTION = "Read one to ten Goals by goalIds, returned in the same order under goals (a read never puts you on them). history applies to every requested Goal. A refused read fails the call with its original refusal; no partial result is presented as complete. Each Goal includes its ten most recent other contributors (names, latest entry headlines and times), 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.";
1910
+ var SearchToolSchema = z5.object({
1911
+ query: z5.string().trim().min(1).max(500),
1912
+ types: z5.array(z5.enum(["entry", "goal", "answer"])).min(1).optional(),
1913
+ goalId: z5.string().uuid().optional(),
1914
+ limit: z5.number().int().min(1).max(20).optional()
1898
1915
  }).strict();
1899
1916
  var SEARCH_DESCRIPTION = "Search your person's history across all of their agents: Entries (what anyone said or wrote, typed or spoken on a call), Goals (by title and outcome) and replies -- the person's answers, acknowledgements and deferrals (type answer; found by their summary, by the question or report they reply to, or by the words that gave them). query is words to look for; records sharing more of its words rank first, and exact names work. types narrows it to entry, goal and/or answer (default: all three). goalId searches under one Goal: its Entries, the replies to its items, and it and its immediate children. limit is matches per type, 1 to 20 (default 8). Read-only. Each match carries its whole saved words, its ID and its links (a reply carries its kind -- answered, acknowledged or deferred -- whether it is closed (a deferral is not), its summary in under ten words, its question or report, the choice made and the Entries that support it); `omitted` counts what matched but was left out, so narrow the words or add a goalId to see it. Nothing found is not proof that nothing exists; a refused search says why. Sealed (encrypted) content is never searched or returned.";
1900
- var ConfigureIdentitySchema = z3.object({}).strict();
1917
+ var ConfigureIdentitySchema = z5.object({}).strict();
1901
1918
  var CONFIGURE_IDENTITY_DESCRIPTION = "Read this authenticated agent\u2019s current name, voice and token ID. Read-only; no arguments. Pairing, renaming and logout are available only through the local configure driver.";
1902
- var CheckActivitySchema = z3.object({}).strict();
1919
+ var CheckActivitySchema = z5.object({}).strict();
1903
1920
  var FEEDBACK_TEXT_MAX = 5e4;
1904
- var SendFeedbackSchema = z3.object({
1905
- 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.`),
1906
- title: z3.string().trim().min(1).max(200).optional().describe("One line naming it."),
1907
- kind: z3.enum(["bug", "idea", "other"]).default("other").describe("bug: something Paigy does wrong. idea: something it should do. other: anything else.")
1921
+ var SendFeedbackSchema = z5.object({
1922
+ text: z5.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.`),
1923
+ title: z5.string().trim().min(1).max(200).optional().describe("One line naming it."),
1924
+ kind: z5.enum(["bug", "idea", "other"]).default("other").describe("bug: something Paigy does wrong. idea: something it should do. other: anything else.")
1908
1925
  }).strict();
1909
1926
  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.";
1910
1927
  var AGENT_TOOLS = [
@@ -1912,184 +1929,184 @@ var AGENT_TOOLS = [
1912
1929
  { name: "contact", description: CONTACT_DESCRIPTION, inputSchema: CONTACT_SCHEMA },
1913
1930
  { name: "manage_goals", description: MANAGE_GOALS_DESCRIPTION, inputSchema: mcpInputSchema(ManageGoalsToolSchema) },
1914
1931
  { name: "get_delivery", description: GET_DELIVERY_DESCRIPTION, inputSchema: mcpInputSchema(GetDeliverySchema) },
1915
- { name: "get_goal", description: GET_GOAL_DESCRIPTION, inputSchema: mcpInputSchema(GetGoalSchema) },
1932
+ { name: "get_goals", description: GET_GOALS_DESCRIPTION, inputSchema: mcpInputSchema(GetGoalsSchema) },
1916
1933
  { name: "search", description: SEARCH_DESCRIPTION, inputSchema: mcpInputSchema(SearchToolSchema) },
1917
- { name: "check_activity", description: "Read your person's agents that contributed in the last 24 hours, newest first: at most 30 agents and their five most recently touched Goals, with their latest entry headline and time. Use get_goal to read a Goal and its other contributors before starting overlapping work. Read-only; no arguments.", inputSchema: mcpInputSchema(CheckActivitySchema) },
1934
+ { name: "check_activity", description: "Read your person's agents that contributed in the last 24 hours, newest first: at most 30 agents and their five most recently touched Goals, with their latest entry headline and time. Use get_goals to read a Goal and its other contributors before starting overlapping work. Read-only; no arguments.", inputSchema: mcpInputSchema(CheckActivitySchema) },
1918
1935
  { name: "send_feedback", description: SEND_FEEDBACK_DESCRIPTION, inputSchema: mcpInputSchema(SendFeedbackSchema) }
1919
1936
  ];
1920
1937
  var AGENT_TOOL_NAMES = AGENT_TOOLS.map((t) => t.name);
1921
- var id = z4.string().uuid();
1922
- var key = z4.string().min(1).max(40);
1923
- var participant = z4.string().regex(/^(human|agent):.+$/, "a participant ID such as agent:<uuid>");
1924
- var SourceSchema = z4.object({ entryId: id }).strict();
1925
- var ResultRefSchema = z4.union([z4.object({ id }).strict(), z4.object({ local: key }).strict()]);
1926
- var NodeRefSchema = z4.object({ type: z4.enum(["goal", "question"]), id }).strict();
1927
- var DependencySchema = z4.object({
1938
+ var id = z6.string().uuid();
1939
+ var key = z6.string().min(1).max(40);
1940
+ var participant = z6.string().regex(/^(human|agent):.+$/, "a participant ID such as agent:<uuid>");
1941
+ var SourceSchema = z6.object({ entryId: id }).strict();
1942
+ var ResultRefSchema = z6.union([z6.object({ id }).strict(), z6.object({ local: key }).strict()]);
1943
+ var NodeRefSchema = z6.object({ type: z6.enum(["goal", "question"]), id }).strict();
1944
+ var DependencySchema = z6.object({
1928
1945
  blocker: NodeRefSchema,
1929
1946
  blocked: NodeRefSchema,
1930
- action: z4.enum(["start", "complete", "answer"]),
1931
- reason: z4.string().max(500).optional()
1947
+ action: z6.enum(["start", "complete", "answer"]),
1948
+ reason: z6.string().max(500).optional()
1932
1949
  }).strict();
1933
- var goalState = z4.enum(["open", "completed", "canceled"]);
1950
+ var goalState = z6.enum(["open", "completed", "canceled"]);
1934
1951
  var existingGoalChanges = [
1935
- z4.object({ kind: z4.literal("edit"), goalId: id, title: z4.string().min(1).max(120).optional(), outcome: z4.string().min(1).optional() }).strict().refine((c) => c.title !== void 0 || c.outcome !== void 0, "an edit changes the title or the outcome"),
1936
- z4.object({ kind: z4.literal("state"), goalId: id, state: goalState }).strict(),
1937
- z4.object({ kind: z4.literal("assign"), goalId: id, ownerId: participant }).strict(),
1938
- z4.object({ kind: z4.literal("defer"), goalId: id, until: z4.string().datetime().nullable() }).strict(),
1939
- z4.object({ kind: z4.literal("move"), goalId: id, parentGoalId: id.nullable() }).strict(),
1940
- z4.object({
1941
- kind: z4.literal("dependency"),
1942
- change: z4.enum(["add", "remove"]),
1952
+ z6.object({ kind: z6.literal("edit"), goalId: id, title: z6.string().min(1).max(120).optional(), outcome: z6.string().min(1).optional() }).strict().refine((c) => c.title !== void 0 || c.outcome !== void 0, "an edit changes the title or the outcome"),
1953
+ z6.object({ kind: z6.literal("state"), goalId: id, state: goalState }).strict(),
1954
+ z6.object({ kind: z6.literal("assign"), goalId: id, ownerId: participant }).strict(),
1955
+ z6.object({ kind: z6.literal("defer"), goalId: id, until: z6.string().datetime().nullable() }).strict(),
1956
+ z6.object({ kind: z6.literal("move"), goalId: id, parentGoalId: id.nullable() }).strict(),
1957
+ z6.object({
1958
+ kind: z6.literal("dependency"),
1959
+ change: z6.enum(["add", "remove"]),
1943
1960
  goalId: id,
1944
1961
  dependsOnGoalId: id,
1945
- action: z4.enum(["start", "complete"]),
1946
- reason: z4.string().max(500).optional()
1962
+ action: z6.enum(["start", "complete"]),
1963
+ reason: z6.string().max(500).optional()
1947
1964
  }).strict()
1948
1965
  ];
1949
- var BrainGoalChangeSchema = z4.union([
1966
+ var BrainGoalChangeSchema = z6.union([
1950
1967
  // newSession: Paigy starts a session to own it (owner, 2026-10-06); until it has, the person owns it.
1951
- z4.object({
1952
- kind: z4.literal("create"),
1953
- outcome: z4.string().min(1),
1954
- title: z4.string().min(1).max(120),
1968
+ z6.object({
1969
+ kind: z6.literal("create"),
1970
+ outcome: z6.string().min(1),
1971
+ title: z6.string().min(1).max(120),
1955
1972
  ownerId: participant,
1956
1973
  parentGoal: ResultRefSchema.nullable(),
1957
- newSession: z4.literal(true).optional()
1974
+ newSession: z6.literal(true).optional()
1958
1975
  }).strict(),
1959
1976
  ...existingGoalChanges
1960
1977
  ]);
1961
- var option = z4.object({ id: z4.string().min(1).max(40), label: z4.string().min(1), hint: z4.string().optional() }).strict();
1962
- var QuestionChangeSchema = z4.union([
1963
- z4.object({
1964
- kind: z4.literal("create"),
1965
- text: z4.string().min(1),
1966
- summary: z4.string().optional(),
1978
+ var option = z6.object({ id: z6.string().min(1).max(40), label: z6.string().min(1), hint: z6.string().optional() }).strict();
1979
+ var QuestionChangeSchema = z6.union([
1980
+ z6.object({
1981
+ kind: z6.literal("create"),
1982
+ text: z6.string().min(1),
1983
+ summary: z6.string().optional(),
1967
1984
  answererId: participant,
1968
1985
  goal: ResultRefSchema.optional(),
1969
- blocks: z4.array(z4.object({ question: ResultRefSchema }).strict()),
1970
- options: z4.array(option).min(2).optional(),
1971
- pickMode: z4.enum(["one", "many", "rank"]).optional()
1986
+ blocks: z6.array(z6.object({ question: ResultRefSchema }).strict()),
1987
+ options: z6.array(option).min(2).optional(),
1988
+ pickMode: z6.enum(["one", "many", "rank"]).optional()
1972
1989
  }).strict().refine((c) => c.options === void 0 === (c.pickMode === void 0), "options and pickMode come together"),
1973
- z4.object({ kind: z4.literal("edit"), questionId: id, text: z4.string().min(1) }).strict(),
1974
- z4.object({ kind: z4.literal("assign"), questionId: id, answererId: participant }).strict(),
1975
- z4.object({ kind: z4.literal("withdraw"), questionId: id }).strict(),
1976
- z4.object({ kind: z4.literal("dependency"), change: z4.enum(["add", "remove"]), edge: DependencySchema }).strict()
1990
+ z6.object({ kind: z6.literal("edit"), questionId: id, text: z6.string().min(1) }).strict(),
1991
+ z6.object({ kind: z6.literal("assign"), questionId: id, answererId: participant }).strict(),
1992
+ z6.object({ kind: z6.literal("withdraw"), questionId: id }).strict(),
1993
+ z6.object({ kind: z6.literal("dependency"), change: z6.enum(["add", "remove"]), edge: DependencySchema }).strict()
1977
1994
  ]);
1978
- var lessonScope = z4.union([
1979
- z4.object({ kind: z4.literal("user") }).strict(),
1980
- z4.object({ kind: z4.literal("goal"), goal: ResultRefSchema }).strict()
1995
+ var lessonScope = z6.union([
1996
+ z6.object({ kind: z6.literal("user") }).strict(),
1997
+ z6.object({ kind: z6.literal("goal"), goal: ResultRefSchema }).strict()
1981
1998
  ]);
1982
- var LessonChangeSchema = z4.union([
1983
- z4.object({ kind: z4.literal("remember"), text: z4.string().min(1), scope: lessonScope }).strict(),
1984
- z4.object({ kind: z4.literal("revise"), lessonId: id, text: z4.string().min(1), scope: lessonScope }).strict(),
1985
- z4.object({ kind: z4.literal("withdraw"), lessonId: id }).strict()
1999
+ var LessonChangeSchema = z6.union([
2000
+ z6.object({ kind: z6.literal("remember"), text: z6.string().min(1), scope: lessonScope }).strict(),
2001
+ z6.object({ kind: z6.literal("revise"), lessonId: id, text: z6.string().min(1), scope: lessonScope }).strict(),
2002
+ z6.object({ kind: z6.literal("withdraw"), lessonId: id }).strict()
1986
2003
  ]);
1987
- var BrainNextSchema = z4.object({
1988
- instructions: z4.array(z4.object({ entryKeys: z4.array(key).min(1) }).strict()),
1989
- say: z4.array(key),
1990
- then: z4.enum(["listen", "hold", "end", "none"]),
1991
- waitFor: z4.array(ResultRefSchema),
1992
- reason: z4.string()
2004
+ var BrainNextSchema = z6.object({
2005
+ instructions: z6.array(z6.object({ entryKeys: z6.array(key).min(1) }).strict()),
2006
+ say: z6.array(key),
2007
+ then: z6.enum(["listen", "hold", "end", "none"]),
2008
+ waitFor: z6.array(ResultRefSchema),
2009
+ reason: z6.string()
1993
2010
  }).strict();
1994
2011
  var messageBase = {
1995
2012
  key,
1996
- text: z4.string().min(1),
1997
- goals: z4.array(ResultRefSchema),
1998
- questions: z4.array(ResultRefSchema),
1999
- entryKeys: z4.array(key),
2000
- obligationIds: z4.array(id)
2013
+ text: z6.string().min(1),
2014
+ goals: z6.array(ResultRefSchema),
2015
+ questions: z6.array(ResultRefSchema),
2016
+ entryKeys: z6.array(key),
2017
+ obligationIds: z6.array(id)
2001
2018
  };
2002
- var BrainMessageSchema = z4.union([
2003
- z4.object({ ...messageBase, to: z4.object({ kind: z4.literal("user") }).strict() }).strict(),
2004
- z4.object({
2019
+ var BrainMessageSchema = z6.union([
2020
+ z6.object({ ...messageBase, to: z6.object({ kind: z6.literal("user") }).strict() }).strict(),
2021
+ z6.object({
2005
2022
  ...messageBase,
2006
- to: z4.object({ kind: z4.literal("agent"), agentId: z4.string().regex(/^agent:(?!paigy$)\S+$/) }).strict(),
2007
- call: z4.object({ callId: id, listen: z4.literal(true) }).strict().optional()
2023
+ to: z6.object({ kind: z6.literal("agent"), agentId: z6.string().regex(/^agent:(?!paigy$)\S+$/) }).strict(),
2024
+ call: z6.object({ callId: id, listen: z6.literal(true) }).strict().optional()
2008
2025
  }).strict()
2009
2026
  ]);
2010
- var BrainSearchSchema = z4.object({
2011
- query: z4.string().min(1).max(500),
2012
- within: z4.array(z4.enum(["entries", "goals", "answers"])).min(1),
2027
+ var BrainSearchSchema = z6.object({
2028
+ query: z6.string().min(1).max(500),
2029
+ within: z6.array(z6.enum(["entries", "goals", "answers"])).min(1),
2013
2030
  goalId: id.optional()
2014
2031
  }).strict();
2015
- var BrainResultSchema = z4.object({
2016
- messages: z4.array(BrainMessageSchema),
2017
- entries: z4.array(z4.object({ key, sources: z4.array(SourceSchema).min(1), goals: z4.array(ResultRefSchema), summary: z4.string().optional() }).strict()),
2018
- questions: z4.array(z4.object({ key, entryKeys: z4.array(key), change: QuestionChangeSchema }).strict()),
2019
- answers: z4.array(z4.object({
2032
+ var BrainResultSchema = z6.object({
2033
+ messages: z6.array(BrainMessageSchema),
2034
+ entries: z6.array(z6.object({ key, sources: z6.array(SourceSchema).min(1), goals: z6.array(ResultRefSchema), summary: z6.string().optional() }).strict()),
2035
+ questions: z6.array(z6.object({ key, entryKeys: z6.array(key), change: QuestionChangeSchema }).strict()),
2036
+ answers: z6.array(z6.object({
2020
2037
  question: ResultRefSchema,
2021
- entryKeys: z4.array(key).min(1),
2022
- summary: z4.string(),
2023
- selectedOptionIds: z4.array(z4.string().min(1)).optional()
2038
+ entryKeys: z6.array(key).min(1),
2039
+ summary: z6.string(),
2040
+ selectedOptionIds: z6.array(z6.string().min(1)).optional()
2024
2041
  }).strict()),
2025
- goals: z4.array(z4.object({ key, entryKeys: z4.array(key), change: BrainGoalChangeSchema }).strict()),
2026
- feedback: z4.array(z4.object({ entryKeys: z4.array(key).min(1) }).strict()),
2027
- lessons: z4.array(z4.object({ entryKeys: z4.array(key).min(1), change: LessonChangeSchema }).strict()),
2042
+ goals: z6.array(z6.object({ key, entryKeys: z6.array(key), change: BrainGoalChangeSchema }).strict()),
2043
+ feedback: z6.array(z6.object({ entryKeys: z6.array(key).min(1) }).strict()),
2044
+ lessons: z6.array(z6.object({ entryKeys: z6.array(key).min(1), change: LessonChangeSchema }).strict()),
2028
2045
  next: BrainNextSchema,
2029
2046
  search: BrainSearchSchema.optional()
2030
2047
  }).strict();
2031
- var str = z4.string();
2032
- var strs = z4.array(z4.string());
2033
- var CompactResultSchema = z4.object({
2034
- next: z4.object({ say: strs, then: z4.enum(["listen", "hold", "end", "none"]), waitFor: strs, reason: str, instructions: strs }).strict(),
2035
- messages: z4.array(z4.object({ key: str, to: str, text: str, about: strs, entries: strs, owed: strs, inviteToCall: z4.boolean() }).strict()),
2036
- entries: z4.array(z4.object({ key: str, from: str, on: strs }).strict()),
2037
- answers: z4.array(z4.object({ question: str, entries: strs, summary: str, picked: strs }).strict()),
2038
- changes: z4.array(z4.object({
2048
+ var str = z6.string();
2049
+ var strs = z6.array(z6.string());
2050
+ var CompactResultSchema = z6.object({
2051
+ next: z6.object({ say: strs, then: z6.enum(["listen", "hold", "end", "none"]), waitFor: strs, reason: str, instructions: strs }).strict(),
2052
+ messages: z6.array(z6.object({ key: str, to: str, text: str, about: strs, entries: strs, owed: strs, inviteToCall: z6.boolean() }).strict()),
2053
+ entries: z6.array(z6.object({ key: str, from: str, on: strs }).strict()),
2054
+ answers: z6.array(z6.object({ question: str, entries: strs, summary: str, picked: strs }).strict()),
2055
+ changes: z6.array(z6.object({
2039
2056
  key: str,
2040
- what: z4.enum(["goal", "question", "lesson"]),
2041
- op: z4.enum(["create", "edit", "assign", "open", "complete", "cancel", "defer", "move", "block", "unblock", "withdraw", "remember", "revise"]),
2057
+ what: z6.enum(["goal", "question", "lesson"]),
2058
+ op: z6.enum(["create", "edit", "assign", "open", "complete", "cancel", "defer", "move", "block", "unblock", "withdraw", "remember", "revise"]),
2042
2059
  id: str,
2043
2060
  text: str,
2044
2061
  title: str,
2045
2062
  who: str,
2046
2063
  under: str,
2047
- gate: z4.enum(["start", "complete", "answer", "none"]),
2048
- options: z4.array(z4.object({ id: str, label: str }).strict()),
2049
- pick: z4.enum(["one", "many", "rank", "words"]),
2064
+ gate: z6.enum(["start", "complete", "answer", "none"]),
2065
+ options: z6.array(z6.object({ id: str, label: str }).strict()),
2066
+ pick: z6.enum(["one", "many", "rank", "words"]),
2050
2067
  entries: strs
2051
2068
  }).strict()),
2052
- feedback: z4.array(strs),
2053
- search: z4.object({ query: str, within: strs, goal: str }).strict()
2069
+ feedback: z6.array(strs),
2070
+ search: z6.object({ query: str, within: strs, goal: str }).strict()
2054
2071
  }).strict();
2055
2072
  var COMPACT_RESULT_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
2056
2073
  zodToJsonSchema(CompactResultSchema, { $refStrategy: "none" })
2057
2074
  );
2058
- var str2 = z5.string();
2059
- var strs2 = z5.array(z5.string());
2060
- var TalkerReplySchema = z5.object({
2075
+ var str2 = z7.string();
2076
+ var strs2 = z7.array(z7.string());
2077
+ var TalkerReplySchema = z7.object({
2061
2078
  /** What to say and send, messages to the person first: spoken in the order written. `to` is "user"
2062
2079
  * or an agent's handle; `about` names handles; `blocks` is the item a question to an agent must be
2063
2080
  * answered before ("" for none). */
2064
- messages: z5.array(z5.object({ key: str2, to: str2, text: str2, about: strs2, blocks: str2 }).strict()),
2081
+ messages: z7.array(z7.object({ key: str2, to: str2, text: str2, about: strs2, blocks: str2 }).strict()),
2065
2082
  /** What the call does next: listen, hold (the person asked for a moment) or end (they asked to). */
2066
- then: z5.enum(["listen", "hold", "end"]),
2083
+ then: z7.enum(["listen", "hold", "end"]),
2067
2084
  /** The person's replies to items (replies, owner 2026-10-07): the item's handle, the chosen option
2068
2085
  * IDs, the line handles, how they replied in under ten words (keeping any condition), and `defer`:
2069
2086
  * "" when their words settle the item, else what a reply that puts it off waits for -- "call" (the
2070
2087
  * end of this call), a question's handle (that question's answer) or an ISO time. */
2071
- replies: z5.array(z5.object({ item: str2, options: strs2, lines: strs2, summary: str2, defer: str2 }).strict()),
2088
+ replies: z7.array(z7.object({ item: str2, options: strs2, lines: strs2, summary: str2, defer: str2 }).strict()),
2072
2089
  /** The line handles that tell the talker how to run this call; they last until it ends and reach no agent. */
2073
2090
  instruction: strs2,
2074
2091
  /** The line handles the filer acts on, and the only ones it reads (3e): new work, a change to existing
2075
2092
  * work, feedback on Paigy, anything said to an agent, and any rule meant to outlast the call. */
2076
2093
  file: strs2,
2077
2094
  /** Evidence to fetch for a second round: a search, an item's full text, or an agent by name. */
2078
- need: z5.object({ kind: z5.enum(["search", "item", "agent", ""]), text: str2 }).strict(),
2095
+ need: z7.object({ kind: z7.enum(["search", "item", "agent", ""]), text: str2 }).strict(),
2079
2096
  /** The handle of the item to explain ("" for none). */
2080
2097
  explain: str2
2081
2098
  }).strict();
2082
2099
  var TALKER_REPLY_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
2083
2100
  zodToJsonSchema(TalkerReplySchema, { $refStrategy: "none" })
2084
2101
  );
2085
- var str3 = z6.string();
2086
- var strs3 = z6.array(z6.string());
2087
- var FilerReplySchema = z6.object({
2102
+ var str3 = z8.string();
2103
+ var strs3 = z8.array(z8.string());
2104
+ var FilerReplySchema = z8.object({
2088
2105
  /** Which Goals each new line goes on: a line's handle, Goal handles (or keys of new Goals), and what
2089
2106
  * the line says in at most ten words. */
2090
- filed: z6.array(z6.object({ line: str3, goals: strs3, summary: str3 }).strict()),
2091
- goals: z6.array(z6.object({
2092
- op: z6.enum(["create", "edit", "complete", "cancel", "reopen", "assign", "defer", "move", "block", "unblock"]),
2107
+ filed: z8.array(z8.object({ line: str3, goals: strs3, summary: str3 }).strict()),
2108
+ goals: z8.array(z8.object({
2109
+ op: z8.enum(["create", "edit", "complete", "cancel", "reopen", "assign", "defer", "move", "block", "unblock"]),
2093
2110
  key: str3,
2094
2111
  goal: str3,
2095
2112
  title: str3,
@@ -2098,33 +2115,33 @@ var FilerReplySchema = z6.object({
2098
2115
  under: str3,
2099
2116
  until: str3,
2100
2117
  on: str3,
2101
- gate: z6.enum(["start", "complete", "answer", ""]),
2118
+ gate: z8.enum(["start", "complete", "answer", ""]),
2102
2119
  why: str3
2103
2120
  }).strict()),
2104
- questions: z6.array(z6.object({
2105
- op: z6.enum(["create", "edit", "assign", "withdraw"]),
2121
+ questions: z8.array(z8.object({
2122
+ op: z8.enum(["create", "edit", "assign", "withdraw"]),
2106
2123
  key: str3,
2107
2124
  question: str3,
2108
2125
  text: str3,
2109
2126
  summary: str3,
2110
2127
  to: str3,
2111
2128
  goal: str3,
2112
- options: z6.array(z6.object({ id: str3, label: str3 }).strict()),
2113
- pick: z6.enum(["one", "many", "rank", "words", ""]),
2129
+ options: z8.array(z8.object({ id: str3, label: str3 }).strict()),
2130
+ pick: z8.enum(["one", "many", "rank", "words", ""]),
2114
2131
  blocks: str3
2115
2132
  }).strict()),
2116
- lessons: z6.array(z6.object({ op: z6.enum(["remember", "revise", "withdraw"]), lesson: str3, text: str3, scope: str3 }).strict()),
2133
+ lessons: z8.array(z8.object({ op: z8.enum(["remember", "revise", "withdraw"]), lesson: str3, text: str3, scope: str3 }).strict()),
2117
2134
  /** Line handles whose words comment on Paigy itself. */
2118
2135
  feedback: strs3
2119
2136
  }).strict();
2120
2137
  var FILER_REPLY_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
2121
2138
  zodToJsonSchema(FilerReplySchema, { $refStrategy: "none" })
2122
2139
  );
2123
- var ExplainerReplySchema = z7.object({
2140
+ var ExplainerReplySchema = z9.object({
2124
2141
  /** The explanation, as sentences, spoken in order. */
2125
- say: z7.array(z7.string()),
2142
+ say: z9.array(z9.string()),
2126
2143
  /** Questions to an agent about gaps in what it read: the agent's handle and the question. */
2127
- followUps: z7.array(z7.object({ to: z7.string(), text: z7.string() }).strict())
2144
+ followUps: z9.array(z9.object({ to: z9.string(), text: z9.string() }).strict())
2128
2145
  }).strict();
2129
2146
  var EXPLAINER_REPLY_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
2130
2147
  zodToJsonSchema(ExplainerReplySchema, { $refStrategy: "none" })
@@ -2147,28 +2164,28 @@ var DISTILLER_DEFECTS = [
2147
2164
  "dropped"
2148
2165
  // something it had to say never played and was never said later (owner, 2026-10-08, call 65433a9d)
2149
2166
  ];
2150
- var DistillerReplySchema = z8.object({
2151
- defects: z8.array(z8.object({
2152
- kind: z8.enum(DISTILLER_DEFECTS),
2167
+ var DistillerReplySchema = z10.object({
2168
+ defects: z10.array(z10.object({
2169
+ kind: z10.enum(DISTILLER_DEFECTS),
2153
2170
  /** The handles of the lines it shows in. */
2154
- lines: z8.array(z8.string()),
2171
+ lines: z10.array(z10.string()),
2155
2172
  /** The handle of the record it concerns, or "". */
2156
- about: z8.string(),
2173
+ about: z10.string(),
2157
2174
  /** One plain sentence, in words, never handles: it is what the feedback row keeps. */
2158
- why: z8.string()
2175
+ why: z10.string()
2159
2176
  }).strict())
2160
2177
  }).strict();
2161
2178
  var DISTILLER_REPLY_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
2162
2179
  zodToJsonSchema(DistillerReplySchema, { $refStrategy: "none" })
2163
2180
  );
2164
2181
  var TIDY_AUDIENCES = ["talker", "filer", "agents"];
2165
- var TidyReplySchema = z8.object({
2166
- lessons: z8.array(z8.object({
2167
- lesson: z8.string(),
2168
- op: z8.enum(["keep", "revise", "withdraw"]),
2169
- text: z8.string(),
2170
- for: z8.enum([...TIDY_AUDIENCES, ""]),
2171
- into: z8.string()
2182
+ var TidyReplySchema = z10.object({
2183
+ lessons: z10.array(z10.object({
2184
+ lesson: z10.string(),
2185
+ op: z10.enum(["keep", "revise", "withdraw"]),
2186
+ text: z10.string(),
2187
+ for: z10.enum([...TIDY_AUDIENCES, ""]),
2188
+ into: z10.string()
2172
2189
  }).strict())
2173
2190
  }).strict();
2174
2191
  var TIDY_REPLY_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
@@ -2209,27 +2226,27 @@ var LIVE_MS = 3 * 6e4;
2209
2226
  var WORKING_MS = 60 * 6e4;
2210
2227
  var WORKING_TIER_MS = 2 * 60 * 6e4;
2211
2228
  var RECENT_TIER_MS = 24 * 60 * 6e4;
2212
- var json = z9.lazy(() => z9.union([
2213
- z9.string(),
2214
- z9.number().finite(),
2215
- z9.boolean(),
2216
- z9.null(),
2217
- z9.array(json),
2218
- z9.record(json)
2229
+ var json = z11.lazy(() => z11.union([
2230
+ z11.string(),
2231
+ z11.number().finite(),
2232
+ z11.boolean(),
2233
+ z11.null(),
2234
+ z11.array(json),
2235
+ z11.record(json)
2219
2236
  ]));
2220
- var clock = z9.number().int().nonnegative().safe();
2221
- var HeardEventSchema = z9.object({
2222
- eventId: z9.string().uuid(),
2223
- source: z9.enum(["phone", "bot"]),
2237
+ var clock = z11.number().int().nonnegative().safe();
2238
+ var HeardEventSchema = z11.object({
2239
+ eventId: z11.string().uuid(),
2240
+ source: z11.enum(["phone", "bot"]),
2224
2241
  sequence: clock,
2225
- kind: z9.string().min(1),
2242
+ kind: z11.string().min(1),
2226
2243
  phoneAtMs: clock.optional(),
2227
2244
  botAtMs: clock.optional(),
2228
- payload: z9.record(json)
2245
+ payload: z11.record(json)
2229
2246
  }).strict();
2230
2247
  var HeardCursorSchema = HeardEventSchema.pick({ source: true, sequence: true, eventId: true });
2231
- var HeardPageSchema = z9.object({
2232
- events: z9.array(HeardEventSchema).max(200),
2248
+ var HeardPageSchema = z11.object({
2249
+ events: z11.array(HeardEventSchema).max(200),
2233
2250
  next: HeardCursorSchema.nullable()
2234
2251
  }).strict();
2235
2252
  var MAX_EVENTS = 50;
@@ -2242,23 +2259,23 @@ var batchBytes = (events) => {
2242
2259
  }
2243
2260
  return bytes;
2244
2261
  };
2245
- var HeardBatchSchema = z9.object({
2246
- events: z9.array(HeardEventSchema).min(1).max(MAX_EVENTS)
2262
+ var HeardBatchSchema = z11.object({
2263
+ events: z11.array(HeardEventSchema).min(1).max(MAX_EVENTS)
2247
2264
  }).strict().refine((value) => batchBytes(value.events) <= MAX_BYTES, "heard_batch_too_large");
2248
- var ContextSchema = z10.object({
2249
- title: z10.string().min(1).describe("One-line headline of what you need (required, non-empty)."),
2250
- description: z10.array(z10.string().min(1)).describe(
2265
+ var ContextSchema = z12.object({
2266
+ title: z12.string().min(1).describe("One-line headline of what you need (required, non-empty)."),
2267
+ description: z12.array(z12.string().min(1)).describe(
2251
2268
  "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."
2252
2269
  ),
2253
2270
  /** THE ASK'S UNITS (3c): its context as titled units, in order. The app lists the titles and opens
2254
2271
  * a body on a tap. Absent on an ask sent without units, which renders as before. */
2255
- units: z10.array(z10.object({ title: z10.string(), body: z10.string() })).optional()
2272
+ units: z12.array(z12.object({ title: z12.string(), body: z12.string() })).optional()
2256
2273
  });
2257
- var ParticipantSchema = z10.object({
2258
- kind: z10.enum(["human", "agent"]),
2259
- id: z10.string()
2274
+ var ParticipantSchema = z12.object({
2275
+ kind: z12.enum(["human", "agent"]),
2276
+ id: z12.string()
2260
2277
  });
2261
- var TransformSchema = z10.enum([
2278
+ var TransformSchema = z12.enum([
2262
2279
  "structure",
2263
2280
  // shape intent into an answer contract; pick channel/urgency — broker `ask`, `select` shapes, `points`
2264
2281
  "request_more",
@@ -2281,13 +2298,13 @@ var PAIGY_SELF = { kind: "agent", id: "paigy" };
2281
2298
  function isPaigy(ref) {
2282
2299
  return ref === participantRef(PAIGY_SELF);
2283
2300
  }
2284
- var VisualSchema = z10.object({
2285
- url: z10.string().url(),
2286
- label: z10.string().optional()
2301
+ var VisualSchema = z12.object({
2302
+ url: z12.string().url(),
2303
+ label: z12.string().optional()
2287
2304
  });
2288
- var NotifyLevelSchema = z10.enum(["inbox", "push", "banner", "call"]);
2289
- var SelectShapeSchema = z10.enum(["one", "many", "rank", "confirm", "text"]);
2290
- var ReceiptEventSchema = z10.enum([
2305
+ var NotifyLevelSchema = z12.enum(["inbox", "push", "banner", "call"]);
2306
+ var SelectShapeSchema = z12.enum(["one", "many", "rank", "confirm", "text"]);
2307
+ var ReceiptEventSchema = z12.enum([
2291
2308
  "delivered",
2292
2309
  // the bundle reached the recipient at some level
2293
2310
  "seen",
@@ -2317,47 +2334,47 @@ var ReceiptEventSchema = z10.enum([
2317
2334
  // be rewound by a writer that forgot to advance it.
2318
2335
  "restarted"
2319
2336
  ]);
2320
- var AttentionSchema = z10.object({
2337
+ var AttentionSchema = z12.object({
2321
2338
  urgency: NotifyLevelSchema,
2322
2339
  /** The required answer shape, or null for a plain notify that asks nothing back. */
2323
2340
  select: SelectShapeSchema.nullable(),
2324
2341
  /** Coverage contract (#396) — points the answer must address; null = none declared. */
2325
- points: z10.array(z10.string()).nullable(),
2342
+ points: z12.array(z12.string()).nullable(),
2326
2343
  /** Whether the ask blocks the sender — what lets arbitration escalate it on silence. */
2327
- blocking: z10.boolean(),
2344
+ blocking: z12.boolean(),
2328
2345
  /** Reserved (docs/model/model.md lists it): a response deadline. No row column yet — a later Phase 2
2329
2346
  * slice wires it; optional so today's rows/callers project cleanly. */
2330
- deadline: z10.string().datetime().nullable().optional()
2347
+ deadline: z12.string().datetime().nullable().optional()
2331
2348
  });
2332
- var NotifyRequestFields = z10.object({
2349
+ var NotifyRequestFields = z12.object({
2333
2350
  /** Plaintext message content. Present on the plaintext path (today's shape);
2334
2351
  * ABSENT on the E2EE path, where the sealed `envelope` below carries it. The
2335
2352
  * superRefine at the bottom enforces exactly one of the two. */
2336
2353
  context: ContextSchema.optional(),
2337
- options: z10.array(OptionSchema.omit({ id: true }).extend({ label: z10.string().trim().min(1).max(1e3) }).strict()).min(OPTIONS_MIN).max(OPTIONS_MAX).optional().describe(
2354
+ options: z12.array(OptionSchema.omit({ id: true }).extend({ label: z12.string().trim().min(1).max(1e3) }).strict()).min(OPTIONS_MIN).max(OPTIONS_MAX).optional().describe(
2338
2355
  "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)."
2339
2356
  ),
2340
- points: z10.array(z10.string().min(1)).optional().describe(
2357
+ points: z12.array(z12.string().min(1)).optional().describe(
2341
2358
  "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."
2342
2359
  ),
2343
- visuals: z10.array(VisualSchema).optional().describe(
2360
+ visuals: z12.array(VisualSchema).optional().describe(
2344
2361
  "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."
2345
2362
  ),
2346
2363
  /** Git repo the agent is working in ("owner/name"). Local MCP fills this from the checkout — omit unless overriding. */
2347
- repo: z10.string().optional(),
2364
+ repo: z12.string().optional(),
2348
2365
  /** Git branch the agent is on. Local MCP fills this from the checkout — omit unless overriding. */
2349
- branch: z10.string().optional(),
2366
+ branch: z12.string().optional(),
2350
2367
  /** Continue an existing conversation — the id of any notification in it (its root
2351
2368
  * is the conversation's identity). Omitted = start a new conversation. Renamed
2352
2369
  * from `parentId` (2026-08-03): one linkage system, the parent; the API edge
2353
2370
  * still accepts the old name from older clients. */
2354
- parentId: z10.string().uuid().optional(),
2371
+ parentId: z12.string().uuid().optional(),
2355
2372
  /** The durable outcome this contact advances. Optional during the notification-to-Work
2356
2373
  * migration; when present, a blocking ask creates a DecisionNeed for this Work. */
2357
- workId: z10.string().uuid().optional(),
2374
+ workId: z12.string().uuid().optional(),
2358
2375
  /** Target Goal scope. During staged migration this is accepted by the shared contract but
2359
2376
  * target delivery activation remains model-gated; workId and goalId are mutually exclusive. */
2360
- goalId: z10.string().uuid().optional(),
2377
+ goalId: z12.string().uuid().optional(),
2361
2378
  urgency: NotifyLevelSchema.default("inbox").describe(
2362
2379
  "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."
2363
2380
  ),
@@ -2365,7 +2382,7 @@ var NotifyRequestFields = z10.object({
2365
2382
  * visible and marks it needs_input. Renamed from the old `parentId` (2026-08-03)
2366
2383
  * when `parentId` became the conversation handle: `parentId` says WHERE, this
2367
2384
  * says HOW. */
2368
- clarifies: z10.string().optional(),
2385
+ clarifies: z12.string().optional(),
2369
2386
  select: SelectShapeSchema.optional().describe(
2370
2387
  "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."
2371
2388
  ),
@@ -2379,20 +2396,20 @@ var NotifyRequestFields = z10.object({
2379
2396
  // (docs/brain/broker/agenda-design.md) — not by a wire cap the agent has to pre-summarize under.
2380
2397
  // Owner, 2026-07-28: "our actual limitation on how long something is to the user should
2381
2398
  // come from the broker splitting and summarizing." The cap that remains is a size guard.
2382
- ask: z10.string().min(1).max(1e4).optional().describe(
2399
+ ask: z12.string().min(1).max(1e4).optional().describe(
2383
2400
  '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.'
2384
2401
  ),
2385
- needs: z10.array(z10.string().min(1)).optional().describe(
2402
+ needs: z12.array(z12.string().min(1)).optional().describe(
2386
2403
  "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."
2387
2404
  ),
2388
- urgencyHint: z10.enum(["whenever", "soon", "now"]).optional().describe(
2405
+ urgencyHint: z12.enum(["whenever", "soon", "now"]).optional().describe(
2389
2406
  "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."
2390
2407
  ),
2391
2408
  /** #575: the ONE self-report that replaces urgencyHint + blocking — what happens
2392
2409
  * to the agent's work while it waits. Normalized server-side into those two
2393
2410
  * fields (normalizeWaiting) so everything downstream is untouched; explicit
2394
2411
  * urgencyHint/blocking win when both are sent. */
2395
- waiting: z10.enum(["none", "soft", "hard"]).optional().describe(
2412
+ waiting: z12.enum(["none", "soft", "hard"]).optional().describe(
2396
2413
  "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."
2397
2414
  ),
2398
2415
  /** Δ9b (#895): HOLD this claim so the sender can correct the plan before anyone is
@@ -2400,98 +2417,98 @@ var NotifyRequestFields = z10.object({
2400
2417
  * holding by default would charge every quiet claim that minute before any agent could
2401
2418
  * correct anything. Ignored for `waiting: 'hard'`: a blocking ask rings on what we have,
2402
2419
  * and the enrichment can still land mid-call (#781 re-plans the unspoken tail). */
2403
- confirm: z10.boolean().optional().describe(
2420
+ confirm: z12.boolean().optional().describe(
2404
2421
  "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'."
2405
2422
  ),
2406
2423
  /** #575: a RELAY of the user's explicitly stated preference, never the agent's
2407
2424
  * choice. Outranks waiting in both directions: 'call' rings even for a
2408
2425
  * waiting:'none' "call me when it's done"; 'message' never rings even for
2409
2426
  * waiting:'hard'. */
2410
- channel: z10.enum(["call", "message"]).optional().describe(
2427
+ channel: z12.enum(["call", "message"]).optional().describe(
2411
2428
  "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."
2412
2429
  ),
2413
- confirmStyle: z10.enum(["yesno", "approve"]).default("yesno").describe(
2430
+ confirmStyle: z12.enum(["yesno", "approve"]).default("yesno").describe(
2414
2431
  "Labels for a select:'confirm' paige \u2014 'yesno' (Yes/No) or 'approve' (Approve/Deny). Ignored unless select is 'confirm'."
2415
2432
  ),
2416
- blocking: z10.boolean().default(false).describe(
2433
+ blocking: z12.boolean().default(false).describe(
2417
2434
  "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."
2418
2435
  )
2419
2436
  });
2420
2437
  var NotifyRequestSchema = NotifyRequestFields.superRefine((r, ctx) => {
2421
- if (r.workId && r.goalId) ctx.addIssue({ code: z10.ZodIssueCode.custom, path: ["goalId"], message: "pass goalId or workId, not both" });
2438
+ if (r.workId && r.goalId) ctx.addIssue({ code: z12.ZodIssueCode.custom, path: ["goalId"], message: "pass goalId or workId, not both" });
2422
2439
  if (r.ask !== void 0) {
2423
2440
  for (const f of ["context", "select", "points"]) {
2424
2441
  if (r[f] !== void 0)
2425
- ctx.addIssue({ code: z10.ZodIssueCode.custom, path: [f], message: `the simplified \`ask\` form takes no ${f} \u2014 the broker derives the answer shape from your prose. Drop ${f} and say it in \`ask\` instead ("should I\u2026" for approve/deny, "which of these\u2026" for a pick), passing \`options\` when you're offering concrete alternatives.` });
2442
+ ctx.addIssue({ code: z12.ZodIssueCode.custom, path: [f], message: `the simplified \`ask\` form takes no ${f} \u2014 the broker derives the answer shape from your prose. Drop ${f} and say it in \`ask\` instead ("should I\u2026" for approve/deny, "which of these\u2026" for a pick), passing \`options\` when you're offering concrete alternatives.` });
2426
2443
  }
2427
2444
  return;
2428
2445
  }
2429
2446
  if (r.needs !== void 0 || r.urgencyHint !== void 0)
2430
- ctx.addIssue({ code: z10.ZodIssueCode.custom, path: ["needs"], message: "needs/urgencyHint belong to the simplified `ask` form \u2014 with a shaped request use points/urgency" });
2447
+ ctx.addIssue({ code: z12.ZodIssueCode.custom, path: ["needs"], message: "needs/urgencyHint belong to the simplified `ask` form \u2014 with a shaped request use points/urgency" });
2431
2448
  if (!r.context)
2432
- ctx.addIssue({ code: z10.ZodIssueCode.custom, path: ["context"], message: "context is required (plaintext path)" });
2449
+ ctx.addIssue({ code: z12.ZodIssueCode.custom, path: ["context"], message: "context is required (plaintext path)" });
2433
2450
  if (!r.select)
2434
- ctx.addIssue({ code: z10.ZodIssueCode.custom, path: ["select"], message: "select is required on the shaped form" });
2451
+ ctx.addIssue({ code: z12.ZodIssueCode.custom, path: ["select"], message: "select is required on the shaped form" });
2435
2452
  const needsOptions = r.select === "one" || r.select === "many" || r.select === "rank";
2436
2453
  if (needsOptions && !r.options?.length)
2437
- ctx.addIssue({ code: z10.ZodIssueCode.custom, path: ["options"], message: `select:'${r.select}' requires options` });
2454
+ ctx.addIssue({ code: z12.ZodIssueCode.custom, path: ["options"], message: `select:'${r.select}' requires options` });
2438
2455
  if (!needsOptions && r.options?.length)
2439
- ctx.addIssue({ code: z10.ZodIssueCode.custom, path: ["options"], message: `select:'${r.select}' takes no options` });
2456
+ ctx.addIssue({ code: z12.ZodIssueCode.custom, path: ["options"], message: `select:'${r.select}' takes no options` });
2440
2457
  });
2441
- var NotifyStatusSchema = z10.enum(["pending", "answered", "ignored"]);
2442
- var AgentStateSchema = z10.enum(["idle", "in_progress", "completed", "needs_input"]);
2443
- var TurnSchema = z10.object({
2444
- prompt: z10.string(),
2445
- reply: z10.string()
2458
+ var NotifyStatusSchema = z12.enum(["pending", "answered", "ignored"]);
2459
+ var AgentStateSchema = z12.enum(["idle", "in_progress", "completed", "needs_input"]);
2460
+ var TurnSchema = z12.object({
2461
+ prompt: z12.string(),
2462
+ reply: z12.string()
2446
2463
  });
2447
- var UserAnswerSchema = z10.discriminatedUnion("kind", [
2448
- z10.object({ kind: z10.literal("option"), optionId: z10.string(), label: z10.string().optional() }),
2449
- z10.object({ kind: z10.literal("text"), text: z10.string() }),
2450
- z10.object({ kind: z10.literal("ignored") }),
2451
- z10.object({ kind: z10.literal("multi"), optionIds: z10.array(z10.string()), labels: z10.array(z10.string()).optional() }),
2452
- z10.object({ kind: z10.literal("ranked"), optionIds: z10.array(z10.string()), labels: z10.array(z10.string()).optional() }),
2453
- z10.object({ kind: z10.literal("clarify"), chunks: z10.array(z10.string()).min(1) }),
2454
- z10.object({ kind: z10.literal("confirm"), approved: z10.boolean() }),
2455
- z10.object({ kind: z10.literal("turns"), turns: z10.array(TurnSchema).min(1) }),
2464
+ var UserAnswerSchema = z12.discriminatedUnion("kind", [
2465
+ z12.object({ kind: z12.literal("option"), optionId: z12.string(), label: z12.string().optional() }),
2466
+ z12.object({ kind: z12.literal("text"), text: z12.string() }),
2467
+ z12.object({ kind: z12.literal("ignored") }),
2468
+ z12.object({ kind: z12.literal("multi"), optionIds: z12.array(z12.string()), labels: z12.array(z12.string()).optional() }),
2469
+ z12.object({ kind: z12.literal("ranked"), optionIds: z12.array(z12.string()), labels: z12.array(z12.string()).optional() }),
2470
+ z12.object({ kind: z12.literal("clarify"), chunks: z12.array(z12.string()).min(1) }),
2471
+ z12.object({ kind: z12.literal("confirm"), approved: z12.boolean() }),
2472
+ z12.object({ kind: z12.literal("turns"), turns: z12.array(TurnSchema).min(1) }),
2456
2473
  /** An auto-answer derived from the user's PAST decisions (docs/brain/broker/precedent-design.md §2):
2457
2474
  * delivered through the same settle/await path as a human answer, carrying the judge's
2458
2475
  * derivation and the precedent ids it grew from. Always paired with a visible trail
2459
2476
  * card the user can reply to — the broker never overrides the user. */
2460
- z10.object({ kind: z10.literal("precedent"), answer: z10.string(), derivation: z10.string(), sources: z10.array(z10.string()).min(1) })
2477
+ z12.object({ kind: z12.literal("precedent"), answer: z12.string(), derivation: z12.string(), sources: z12.array(z12.string()).min(1) })
2461
2478
  ]);
2462
- var IntentSchema = z10.object({
2479
+ var IntentSchema = z12.object({
2463
2480
  // The full vocabulary the bot's mapper emits (mapper.INTENT_KINDS) — the schema lagged
2464
2481
  // it by two ("detail", "feedback"), and because the settle handler parsed the array
2465
2482
  // all-or-nothing, ONE feedback act silently dropped EVERY intent on the call,
2466
2483
  // questions included. Found auditing five calls' stored feedback, 2026-08-01.
2467
- kind: z10.enum(["defer", "delegate", "channel", "question", "detail", "feedback", "command", "control"]),
2468
- detail: z10.string(),
2484
+ kind: z12.enum(["defer", "delegate", "channel", "question", "detail", "feedback", "command", "control"]),
2485
+ detail: z12.string(),
2469
2486
  /** Defer only: seconds until the callback the caller asked for, when something upstream
2470
2487
  * already read the time. Nothing sets it today (#397 documented an MCP parser that was
2471
2488
  * never written) — the API reads the defer's `detail` itself with `notes/when.ts`
2472
2489
  * (`parseDelay`, #1292), and a value here simply wins over that reading. */
2473
- dueInSeconds: z10.number().int().positive().optional(),
2490
+ dueInSeconds: z12.number().int().positive().optional(),
2474
2491
  /** Feedback only (#812): WHICH failure the complaint names — typed by the mapper that
2475
2492
  * already read the utterance, so `signals.kind` stops defaulting to
2476
2493
  * 'other' on every row. A table that records that something was wrong and nothing
2477
2494
  * about what cannot answer "is the bot looping less this week?". */
2478
- fault: z10.enum(["loop", "unanswered", "overridden", "misheard", "slow", "other"]).optional()
2495
+ fault: z12.enum(["loop", "unanswered", "overridden", "misheard", "slow", "other"]).optional()
2479
2496
  });
2480
- var RideAlongSchema = z10.object({
2497
+ var RideAlongSchema = z12.object({
2481
2498
  /** The note this came from — assign/clarify/close it through /api/notes/:id. */
2482
- noteId: z10.string(),
2499
+ noteId: z12.string(),
2483
2500
  /** What to do, in the owner's own words (the note's headline). Never model-rewritten. */
2484
- text: z10.string(),
2501
+ text: z12.string(),
2485
2502
  /** The thread to report back on, when the note was dispatched over the request rail. */
2486
- parentId: z10.string().nullable()
2503
+ parentId: z12.string().nullable()
2487
2504
  });
2488
- var AwaitItemSchema = z10.discriminatedUnion("type", [
2489
- z10.object({
2490
- type: z10.literal("reply"),
2491
- parentId: z10.string(),
2492
- notificationId: z10.string(),
2493
- workId: z10.string().uuid().optional(),
2494
- decisionId: z10.string().uuid().optional(),
2505
+ var AwaitItemSchema = z12.discriminatedUnion("type", [
2506
+ z12.object({
2507
+ type: z12.literal("reply"),
2508
+ parentId: z12.string(),
2509
+ notificationId: z12.string(),
2510
+ workId: z12.string().uuid().optional(),
2511
+ decisionId: z12.string().uuid().optional(),
2495
2512
  answer: UserAnswerSchema,
2496
2513
  /** WHAT THE AGENT CANNOT KNOW FROM THE FIELDS BESIDE IT (owner, 2026-09-04, issue
2497
2514
  * #1537). One line, built from the record: the ask and the caller's reply VERBATIM,
@@ -2501,107 +2518,107 @@ var AwaitItemSchema = z10.discriminatedUnion("type", [
2501
2518
  * "call me back after you merge" in their own words decides for itself what to do,
2502
2519
  * and now knows exactly which call to make. Absent when either half is missing —
2503
2520
  * a sentence with a hole in it is worse than no sentence. */
2504
- note: z10.string().optional(),
2521
+ note: z12.string().optional(),
2505
2522
  /** The call record rendered for THIS agent (`docs/brain/voice/record-design.md`): the words the
2506
2523
  * shaped answer was mapped from, filtered to its own claims. There is no second list
2507
2524
  * of labels beside it — the acts went 2026-09-04 and `intents` went with them (owner,
2508
2525
  * 2026-09-04): the agent reads the sentence and decides. */
2509
- transcript: z10.string().optional(),
2526
+ transcript: z12.string().optional(),
2510
2527
  /** Coverage report (#396), when the ask declared `points`: which of them this
2511
2528
  * answer addressed. Missing points = re-ask or proceed knowingly partial. */
2512
- covered: z10.array(z10.string()).optional(),
2529
+ covered: z12.array(z12.string()).optional(),
2513
2530
  /** Ride-alongs (RideAlongSchema) — pending work for you, attached to the moment you
2514
2531
  * became free. Only `reply` and `idle` carry it: those are the two outcomes that
2515
2532
  * END a wait. `remind`, `superseded` and `turn` are mid-flight, and handing an
2516
2533
  * agent a side-quest while it is still holding the line is how the main thing gets
2517
2534
  * dropped. Absent/empty = nothing owed. */
2518
- also: z10.array(RideAlongSchema).optional()
2535
+ also: z12.array(RideAlongSchema).optional()
2519
2536
  }),
2520
- z10.object({
2521
- type: z10.literal("remind"),
2522
- parentId: z10.string(),
2523
- notificationId: z10.string(),
2524
- remindAt: z10.string().datetime({ offset: true }),
2537
+ z12.object({
2538
+ type: z12.literal("remind"),
2539
+ parentId: z12.string(),
2540
+ notificationId: z12.string(),
2541
+ remindAt: z12.string().datetime({ offset: true }),
2525
2542
  /** Seconds until remindAt, server-computed — pass straight to ScheduleWakeup. */
2526
- remindInSeconds: z10.number()
2543
+ remindInSeconds: z12.number()
2527
2544
  }),
2528
2545
  /** The awaited ask was REPLACED by a newer notification on its thread (e.g. a
2529
2546
  * post-feedback revision, #633) — the user will never answer this id. Stop
2530
2547
  * awaiting it; the live ask is the thread's newest turn (await that one, or
2531
2548
  * re-orient via contact({})). */
2532
- z10.object({
2533
- type: z10.literal("superseded"),
2534
- parentId: z10.string(),
2535
- notificationId: z10.string()
2549
+ z12.object({
2550
+ type: z12.literal("superseded"),
2551
+ parentId: z12.string(),
2552
+ notificationId: z12.string()
2536
2553
  }),
2537
2554
  /** A LIVE call's turn, streamed as it lands (#783). PROVISIONAL: the user can still
2538
2555
  * revise any of these until the final reply arrives — partial = intelligence,
2539
2556
  * settled = authorization. Use it to PREPARE (fetch, draft, warm), never to act
2540
2557
  * irreversibly. If `acts` carries a question aimed at you and you know the answer,
2541
2558
  * contact on the same thread right away — the caller hears it on the same call. */
2542
- z10.object({
2543
- type: z10.literal("partial"),
2544
- notificationId: z10.string(),
2545
- inFlight: z10.literal(true),
2546
- turn: z10.object({
2547
- idx: z10.number(),
2548
- prompt: z10.string(),
2549
- reply: z10.string(),
2550
- acts: z10.array(IntentSchema).nullable().optional()
2559
+ z12.object({
2560
+ type: z12.literal("partial"),
2561
+ notificationId: z12.string(),
2562
+ inFlight: z12.literal(true),
2563
+ turn: z12.object({
2564
+ idx: z12.number(),
2565
+ prompt: z12.string(),
2566
+ reply: z12.string(),
2567
+ acts: z12.array(IntentSchema).nullable().optional()
2551
2568
  })
2552
2569
  }),
2553
- z10.object({
2554
- type: z10.literal("idle"),
2555
- also: z10.array(RideAlongSchema).optional(),
2570
+ z12.object({
2571
+ type: z12.literal("idle"),
2572
+ also: z12.array(RideAlongSchema).optional(),
2556
2573
  /** Is a call live for this agent's user right now? The SDK polls the partial stream
2557
2574
  * (#783) between idle ticks ONLY while this is not `false` — a partial can only exist
2558
2575
  * during a live call, and polling for one on a banner/message was a wasted HTTP call +
2559
2576
  * 3 queries on every idle tick of every waiting agent (~80% of all traffic at scale).
2560
2577
  * Absent = an older API → the SDK keeps polling, exactly as before. */
2561
- inFlight: z10.boolean().optional()
2578
+ inFlight: z12.boolean().optional()
2562
2579
  })
2563
2580
  ]);
2564
- var VoiceKeySchema = z10.enum(["rachel", "george", "jessica", "brian", "lily"]);
2565
- var AgendaTurnSchema = z10.object({
2581
+ var VoiceKeySchema = z12.enum(["rachel", "george", "jessica", "brian", "lily"]);
2582
+ var AgendaTurnSchema = z12.object({
2566
2583
  /** THE TURN'S IDENTITY (the first-sentence stream, 2026-09-09): the brain call that wrote
2567
2584
  * it and its place in that reply — `<brainCallId>:<index>`, with `:p` on the first
2568
2585
  * sentence a re-plan publishes ahead of the rest. A turn is spoken once, by this id: the
2569
2586
  * completion of a streamed re-plan carries the published sentence again, and the walk
2570
2587
  * drops what it already said by identity, never by the API's guess of what was polled.
2571
2588
  * Absent on plans nothing streams (a ring plan, a floor). */
2572
- id: z10.string().optional(),
2589
+ id: z12.string().optional(),
2573
2590
  /** Twin coverage (#1089): sibling claim ids this asking turn's answer ALSO settles —
2574
2591
  * the planner declares duplicates instead of asking them twice. */
2575
- coveredIds: z10.array(z10.string()).optional(),
2592
+ coveredIds: z12.array(z12.string()).optional(),
2576
2593
  /** The spoken sentences of the turn, in order. No count: how long a turn is is the brain's call
2577
2594
  * (owner, 2026-09-25), and a count here refused whole plans. */
2578
- info: z10.array(z10.string().min(1)).default([]),
2579
- question: z10.string().min(1).nullable(),
2595
+ info: z12.array(z12.string().min(1)).default([]),
2596
+ question: z12.string().min(1).nullable(),
2580
2597
  /** True on the one turn carrying the agent's own declared question. */
2581
- asks: z10.boolean().optional(),
2598
+ asks: z12.boolean().optional(),
2582
2599
  /** The claim this turn belongs to (#781) — the RETURN identity: answers route by it.
2583
2600
  * Absent on a single-claim plan (the session's own claim) and on shared context turns,
2584
2601
  * which route nothing. */
2585
- claimId: z10.string().optional(),
2602
+ claimId: z12.string().optional(),
2586
2603
  /** The claim's voice key (#462) — the OUTBOUND identity, audible who-is-asking. */
2587
- voice: z10.string().optional(),
2604
+ voice: z12.string().optional(),
2588
2605
  /** The claim's AGENT NAME (#838) — the spoken identity. A voice alone doesn't say
2589
2606
  * whose request this is: an item that folded in from another agent arrived as a bare
2590
2607
  * non-sequitur ("First real production sign-in is yours to make whenever you want.")
2591
2608
  * and the owner answered "What?". The bot names the agent before its first turn. */
2592
- agent: z10.string().optional(),
2609
+ agent: z12.string().optional(),
2593
2610
  /** The claim's agent by ID — the pairing's connection id (`notifications.token_id`), the
2594
2611
  * same id a face is minted from. A name is not an identity: two pairings may be called
2595
2612
  * "Claude", and a name cannot be joined on. The record's entries carry it (`agent_id`)
2596
2613
  * so "who said that" survives the call, and it rides PER TURN because a coalesced call
2597
2614
  * speaks for several agents — the turn is the only place that knows which. */
2598
- agentId: z10.string().optional(),
2615
+ agentId: z12.string().optional(),
2599
2616
  /** ITS QUESTION IS ON THE TABLE (#3292): a talker line about a question the person owes. The walk tells
2600
2617
  * the phone (`asking`, so the agenda goes gold and its options show) without treating the line as a
2601
2618
  * question turn — the talker owns re-asking and the waits, so `question` stays null. */
2602
- onTable: z10.boolean().optional(),
2619
+ onTable: z12.boolean().optional(),
2603
2620
  select: SelectShapeSchema.optional(),
2604
- options: z10.array(OptionSchema.omit({ id: true })).optional(),
2621
+ options: z12.array(OptionSchema.omit({ id: true })).optional(),
2605
2622
  /* `pace` STOOD HERE (#826). A turn could carry seconds and the model chose them. The walk
2606
2623
  paces itself now — a short beat between the sentences of a turn, the longer one at its end
2607
2624
  (owner, 2026-09-30: "remove the bot deciding pace") — and it does that where the words are
@@ -2610,33 +2627,33 @@ var AgendaTurnSchema = z10.object({
2610
2627
  /** Whether the walk WAITS for an answer before moving on. Absent = derived as today
2611
2628
  * (a question blocks, context flows). blocking:false on a question = ask and move
2612
2629
  * on, the claim stays pending; blocking:true on context = hold for a reply. */
2613
- blocking: z10.boolean().optional(),
2630
+ blocking: z12.boolean().optional(),
2614
2631
  /** SPOKEN ONLY IF THEY SAY NOTHING (owner, 2026-10-01, call 812de935: "you're gonna re-ask, but it
2615
2632
  * shouldn't be the same words … more like, hey, are you still there, or are you able to answer, or
2616
2633
  * would you need more information"). The walk holds this turn out of its queue; at the queue's end it
2617
2634
  * listens for the last word, and only if that listen is silent is this turn said and asked. If they
2618
2635
  * speak, it is dropped and their words are taken like any reply. */
2619
- ifSilent: z10.boolean().optional()
2636
+ ifSilent: z12.boolean().optional()
2620
2637
  });
2621
2638
  var CLAIM_STALE_MS = 30 * 6e4;
2622
- var InboxItemSchema = z10.object({
2623
- id: z10.string(),
2624
- tokenId: z10.string().optional(),
2639
+ var InboxItemSchema = z12.object({
2640
+ id: z12.string(),
2641
+ tokenId: z12.string().optional(),
2625
2642
  status: NotifyStatusSchema,
2626
2643
  context: ContextSchema,
2627
- options: z10.array(OptionSchema).optional(),
2644
+ options: z12.array(OptionSchema).optional(),
2628
2645
  /** The ask's declared coverage points (#396), when the agent sent them. */
2629
- points: z10.array(z10.string()).optional(),
2646
+ points: z12.array(z12.string()).optional(),
2630
2647
  /** Does this claim want an ANSWER, or is it telling you something? Written per row from
2631
2648
  * `requestAsks` — the agent's own declaration, not a guess. `false` is what earns a card
2632
2649
  * its acknowledge affordance: without it a status update offers a text box and a dismiss,
2633
2650
  * and neither of those is "got it" (owner, 2026-08-10). */
2634
- asks: z10.boolean().optional(),
2651
+ asks: z12.boolean().optional(),
2635
2652
  /** When a live process last pulsed for this row's agent — the liveness input for
2636
2653
  * "working requires a pulse" (#928): the list said "Working…" from agent_state alone
2637
2654
  * while the party called the same dead claim stalled. Absent = no token/no data,
2638
2655
  * which must never CLAIM stalled. */
2639
- lastSeenAt: z10.string().optional(),
2656
+ lastSeenAt: z12.string().optional(),
2640
2657
  /** WHEN THE AGENT LAST SAID ANYTHING ABOUT THIS CLAIM — the newest `agent_state` row in
2641
2658
  * the `notification_events` ledger (trigger-written since 20260621010000, so every row a
2642
2659
  * user can see has one). The age input for `CLAIM_STALE_MS`, and it has to be this rather
@@ -2646,7 +2663,7 @@ var InboxItemSchema = z10.object({
2646
2663
  * work. Reading the row's birth as the claim's age brands that "No update in 8h" the
2647
2664
  * instant the agent picks it up (#997). Absent = pre-trigger row; fall back to
2648
2665
  * `createdAt`. */
2649
- agentStateAt: z10.string().datetime().optional(),
2666
+ agentStateAt: z12.string().datetime().optional(),
2650
2667
  /** THE QUESTIONS A CALL CARRIES — the call screen's agenda spine (docs/clients/app/walk/design.md §11, owner
2651
2668
  * 2026-09-22). One per DecisionNeed on the Call, in the Call's order, answered or open (a
2652
2669
  * superseded or cancelled need is no longer a question anyone is asked). Present only on a
@@ -2660,61 +2677,61 @@ var InboxItemSchema = z10.object({
2660
2677
  * `turn` topic (`asking`, `settled`), because the bot never sees a DecisionNeed id. `title` is
2661
2678
  * the card's own concise heading; `answer` the accepted answer in words, null while open. It
2662
2679
  * REPLACED `agenda` (turns), which nothing ever filled. */
2663
- questions: z10.array(z10.object({
2664
- id: z10.string(),
2665
- entryId: z10.string(),
2666
- title: z10.string(),
2667
- state: z10.enum(["open", "answered"]),
2668
- answer: z10.string().nullable(),
2680
+ questions: z12.array(z12.object({
2681
+ id: z12.string(),
2682
+ entryId: z12.string(),
2683
+ title: z12.string(),
2684
+ state: z12.enum(["open", "answered"]),
2685
+ answer: z12.string().nullable(),
2669
2686
  /** WHO ASKED IT (owner, 2026-09-23, Goal a345e906: each agenda row wears its agent's face) — the
2670
2687
  * request Entry's author, as the same three facts the item's own `tokenId`/`name`/`voice`
2671
2688
  * carry for the call's one agent, so the phone draws it with the same seed. Absent when the
2672
2689
  * author is not an agent this account holds (unpaired since, or a person). */
2673
- agent: z10.object({ tokenId: z10.string(), name: z10.string(), voice: VoiceKeySchema.optional() }).optional(),
2690
+ agent: z12.object({ tokenId: z12.string(), name: z12.string(), voice: VoiceKeySchema.optional() }).optional(),
2674
2691
  /** ITS OPTIONS, WHEN THERE IS SOMETHING TO SEE (owner, 2026-09-25: "Yes, add it"): the options
2675
2692
  * its need offers, exactly as its own card carries them, present only when one of them has a
2676
2693
  * preview (`html` or `image`). The call screen opens them from the agenda row, so a preview is
2677
2694
  * never re-sent as a second card to be seen mid-call. Words-only options are `choices`. */
2678
- options: z10.array(OptionSchema).optional(),
2695
+ options: z12.array(OptionSchema).optional(),
2679
2696
  /** ITS OPTIONS WHEN THEY ARE WORDS (owner, 2026-10-02, on a call: "whenever there are pre-made
2680
2697
  * options … now for a checklist, we should also show them on the screen"; design C, 2026-10-08):
2681
2698
  * numbered chips above the call's controls, so a checklist is never only something read aloud. A
2682
2699
  * field of its own so `options` keeps meaning "previews": a phone on an older bundle opens the
2683
2700
  * preview layout for any `options`, and must see exactly what it did. */
2684
- choices: z10.array(OptionSchema).optional(),
2701
+ choices: z12.array(OptionSchema).optional(),
2685
2702
  /** HOW MANY MAY BE PICKED, beside its `choices`: one, any (`many`) or an order (`rank`). */
2686
- select: z10.enum(["one", "many", "rank"]).optional()
2703
+ select: z12.enum(["one", "many", "rank"]).optional()
2687
2704
  })).optional(),
2688
- visuals: z10.array(VisualSchema).optional(),
2705
+ visuals: z12.array(VisualSchema).optional(),
2689
2706
  /** The connected agent's name (the single pairing name — user-typed, or the
2690
2707
  * agent's suggestion, or a default silly name). */
2691
- name: z10.string(),
2708
+ name: z12.string(),
2692
2709
  /** The pairing's assigned voice (#462); absent = the default voice. */
2693
2710
  voice: VoiceKeySchema.optional(),
2694
- repo: z10.string().optional(),
2695
- branch: z10.string().optional(),
2696
- createdAt: z10.string().datetime(),
2697
- snoozedUntil: z10.string().datetime().optional(),
2711
+ repo: z12.string().optional(),
2712
+ branch: z12.string().optional(),
2713
+ createdAt: z12.string().datetime(),
2714
+ snoozedUntil: z12.string().datetime().optional(),
2698
2715
  agentState: AgentStateSchema.default("idle"),
2699
2716
  /** Whose action the item is waiting on: "you" = an agent asked you (the default,
2700
2717
  * every agent→user notification); "agent" = you sent a request and it's awaiting the
2701
2718
  * agent (held in the inbox until the agent replies on the thread). */
2702
- turn: z10.enum(["you", "agent"]).default("you"),
2719
+ turn: z12.enum(["you", "agent"]).default("you"),
2703
2720
  /** Hard error reason on an awaiting request (turn="agent") — the wake failed to reach
2704
2721
  * the agent (provider-agnostic; set server-side). Absent = no hard error. Drives the inbox
2705
2722
  * error badge + Retry. */
2706
- error: z10.string().optional(),
2723
+ error: z12.string().optional(),
2707
2724
  /** WHEN THIS AGENT WORK WENT QUIET (turn="agent"), by the one rule (`coldSince`: three days
2708
2725
  * with nothing said), or absent while it is not stalled. The inbox's stalled badge reads
2709
2726
  * this and nothing else (2026-09-23: a 3-minute age rule badged every live Goal stalled,
2710
2727
  * and "dismiss the stalled ones" cancelled 37 pieces of live work). */
2711
- cold: z10.string().datetime().optional(),
2712
- clarifies: z10.string().optional(),
2728
+ cold: z12.string().datetime().optional(),
2729
+ clarifies: z12.string().optional(),
2713
2730
  /** THIS CARD'S QUESTION IS ON A LIVE CALL (owner, 2026-09-24: "Mark it while the call is
2714
2731
  * live"). Present only while an open Call Delivery carries the card's request Entry — read
2715
2732
  * off the same open list the card came from, so it clears when the Call does. A card is the
2716
2733
  * backup for a call not taken; while the call has it, the call is where it is answered. */
2717
- onCall: z10.literal(true).optional(),
2734
+ onCall: z12.literal(true).optional(),
2718
2735
  /** THE RING, ON THE ITEM (docs/clients/app/walk/design.md §12 §17, #2251): the last ring on this card was
2719
2736
  * declined, and what the ladder will do next — read off the cron's own row, never computed
2720
2737
  * on the phone. Present only while a `declined` receipt stands on the card's last Call.
@@ -2724,31 +2741,31 @@ var InboxItemSchema = z10.object({
2724
2741
  * It replaced `gaveUp` (deleted 2026-09-22): "the ladder spent" was a boolean the projection
2725
2742
  * never set, and it is `nextRingAt === null` here — the party's *Missed you* (`party/dress.ts`)
2726
2743
  * and the roster's `unreached` read `declinedAt`, and stand while it does. */
2727
- ring: z10.object({
2728
- declinedAt: z10.string().datetime(),
2729
- anchorAt: z10.string().datetime(),
2730
- nextRingAt: z10.string().datetime().nullable(),
2731
- step: z10.number().int()
2744
+ ring: z12.object({
2745
+ declinedAt: z12.string().datetime(),
2746
+ anchorAt: z12.string().datetime(),
2747
+ nextRingAt: z12.string().datetime().nullable(),
2748
+ step: z12.number().int()
2732
2749
  }).optional(),
2733
2750
  /** Why this arrived the way it did, read back off the delivery receipt (`notify/why.ts`).
2734
2751
  * Absent for anything never delivered through a push, and for older rows written before
2735
2752
  * the reason was recorded. Deliberately a debug affordance, shown small (owner,
2736
2753
  * 2026-08-07) — its real job is to give "this didn't need a call" something to be
2737
2754
  * feedback ABOUT. */
2738
- why: z10.object({
2755
+ why: z12.object({
2739
2756
  asked: NotifyLevelSchema,
2740
2757
  got: NotifyLevelSchema,
2741
- because: z10.enum(["unresponsive", "dismissed", "not_permitted", "silent", "coalesced", "agent_capped", "unplanned", "learned_raise"]).optional(),
2742
- line: z10.string()
2758
+ because: z12.enum(["unresponsive", "dismissed", "not_permitted", "silent", "coalesced", "agent_capped", "unplanned", "learned_raise"]).optional(),
2759
+ line: z12.string()
2743
2760
  }).optional(),
2744
- select: z10.enum(["one", "many", "rank", "confirm", "text"]).default("one"),
2745
- confirmStyle: z10.enum(["yesno", "approve"]).default("yesno").describe(
2761
+ select: z12.enum(["one", "many", "rank", "confirm", "text"]).default("one"),
2762
+ confirmStyle: z12.enum(["yesno", "approve"]).default("yesno").describe(
2746
2763
  "Labels for a select:'confirm' paige \u2014 'yesno' (Yes/No) or 'approve' (Approve/Deny). Ignored unless select is 'confirm'."
2747
2764
  ),
2748
2765
  /** Real downstream work is stuck behind this one — set by the agent, independent of
2749
2766
  * urgency (see the main README's "premier use case" + docs/delivery/notify/states.md). Drives the
2750
2767
  * inbox's blocking badge and the extra confirm step before dismissing it. */
2751
- blocking: z10.boolean().default(false),
2768
+ blocking: z12.boolean().default(false),
2752
2769
  /** The user's locked-in answer; present only for replied items (GET /api/replied/:id). */
2753
2770
  answer: UserAnswerSchema.optional(),
2754
2771
  /** THE TARGET FACTS A CARD RENDERS (#1796 point 5, 2026-09-11): the Delivery it is a view of,
@@ -2756,17 +2773,17 @@ var InboxItemSchema = z10.object({
2756
2773
  * for a request that asks nothing), whether its content is sealed, and that Goal's state. The
2757
2774
  * answer writer (`POST /api/entries`) and the disposition (`close_delivery`) take their ids from
2758
2775
  * here. The server projects it (`apps/api/src/inbox/project.ts`); a client never builds it. */
2759
- communication: z10.object({
2760
- deliveryId: z10.string(),
2761
- kind: z10.enum(["notification", "call"]),
2762
- entryId: z10.string(),
2763
- goalIds: z10.array(z10.string()),
2764
- decisionNeedId: z10.string().optional(),
2765
- sealed: z10.boolean(),
2766
- goalState: z10.string().optional(),
2776
+ communication: z12.object({
2777
+ deliveryId: z12.string(),
2778
+ kind: z12.enum(["notification", "call"]),
2779
+ entryId: z12.string(),
2780
+ goalIds: z12.array(z12.string()),
2781
+ decisionNeedId: z12.string().optional(),
2782
+ sealed: z12.boolean(),
2783
+ goalState: z12.string().optional(),
2767
2784
  /** THAT GOAL'S NAME (#2416) — what Activity's row is headed by, since a row there is one Goal
2768
2785
  * and the cards it holds sit behind it. Stamped by the same read as `goalState`. */
2769
- goalTitle: z10.string().optional()
2786
+ goalTitle: z12.string().optional()
2770
2787
  }).optional(),
2771
2788
  /** WHAT THIS CARD IS, IN TWELVE CHARACTERS (#3019) — the hash of every other field on it, stamped
2772
2789
  * by the one read that serves the open list (`apps/api/src/inbox/project.ts` `inboxFor`). It is
@@ -2778,27 +2795,27 @@ var InboxItemSchema = z10.object({
2778
2795
  * own moves (its Goal's state and name, how cold the work behind it has gone, whether a ring is
2779
2796
  * live). Optional, so a fixture, the demo and the archive lens need not spell one, and a card
2780
2797
  * with no rev is simply always re-sent. */
2781
- rev: z10.string().optional()
2798
+ rev: z12.string().optional()
2782
2799
  });
2783
2800
  var APNS_TOKEN_RE = /^[0-9a-fA-F]{64}$/;
2784
- var PushTokenSchema = z10.object({
2785
- voipToken: z10.string().min(1).optional(),
2786
- alertToken: z10.string().min(1).optional(),
2787
- fcmToken: z10.string().min(1).optional(),
2788
- platform: z10.enum(["ios", "android"])
2801
+ var PushTokenSchema = z12.object({
2802
+ voipToken: z12.string().min(1).optional(),
2803
+ alertToken: z12.string().min(1).optional(),
2804
+ fcmToken: z12.string().min(1).optional(),
2805
+ platform: z12.enum(["ios", "android"])
2789
2806
  }).superRefine((v, ctx) => {
2790
2807
  if (v.platform !== "ios") return;
2791
2808
  for (const field of ["voipToken", "alertToken"]) {
2792
2809
  const token = v[field];
2793
2810
  if (token === void 0 || APNS_TOKEN_RE.test(token)) continue;
2794
2811
  ctx.addIssue({
2795
- code: z10.ZodIssueCode.custom,
2812
+ code: z12.ZodIssueCode.custom,
2796
2813
  path: [field],
2797
2814
  message: `not an APNs device token (want 64 hex chars, got ${token.length})`
2798
2815
  });
2799
2816
  }
2800
2817
  });
2801
- var MissedCallSchema = z10.enum([
2818
+ var MissedCallSchema = z12.enum([
2802
2819
  "retry_10m",
2803
2820
  "retry_30m",
2804
2821
  "retry_60m",
@@ -2810,31 +2827,31 @@ var MissedCallSchema = z10.enum([
2810
2827
  ]);
2811
2828
  var clock2 = (h) => h === 0 ? "midnight" : h === 12 ? "noon" : h < 12 ? `${h} am` : `${h - 12} pm`;
2812
2829
  var QUIET = ` Nothing rings from ${clock2(NIGHT.from)} to ${clock2(NIGHT.to)} your time; the count waits for morning.`;
2813
- var BrokerTuningSchema = z10.object({
2830
+ var BrokerTuningSchema = z12.object({
2814
2831
  /** 'none' = skip the spoken ack after a mapped answer (power users find it slow). */
2815
- ackVerbosity: z10.enum(["normal", "none"]).optional(),
2832
+ ackVerbosity: z12.enum(["normal", "none"]).optional(),
2816
2833
  /** How readily the mapper asks its one clarification: 'low' = only when truly
2817
2834
  * uninterpretable, 'high' = whenever not fully certain. */
2818
- clarifyEagerness: z10.enum(["low", "normal", "high"]).optional(),
2835
+ clarifyEagerness: z12.enum(["low", "normal", "high"]).optional(),
2819
2836
  /** The user's own shorthand: when they say `say`, they mean `mean`. */
2820
- phrasebook: z10.array(z10.object({ say: z10.string().min(1).max(60), mean: z10.string().min(1).max(120) })).max(24).optional(),
2837
+ phrasebook: z12.array(z12.object({ say: z12.string().min(1).max(60), mean: z12.string().min(1).max(120) })).max(24).optional(),
2821
2838
  /** The language calls are PLANNED in, when the account has chosen one (#1272). Absent —
2822
2839
  * which is every account today — means the agent's own words decide, per ask: a call
2823
2840
  * about an English ask opens in English. This is the only thing that overrides that,
2824
2841
  * and a live caller who switches language mid-call still outranks it (broker/lang.ts).
2825
2842
  * Set per user (no UI yet), like `voiceTuning`. */
2826
- language: z10.enum(["en", "es"]).optional()
2843
+ language: z12.enum(["en", "es"]).optional()
2827
2844
  });
2828
- var UserSettingsSchema = z10.object({
2829
- permissions: z10.object({
2830
- call: z10.boolean(),
2831
- banner: z10.boolean(),
2832
- push: z10.boolean()
2845
+ var UserSettingsSchema = z12.object({
2846
+ permissions: z12.object({
2847
+ call: z12.boolean(),
2848
+ banner: z12.boolean(),
2849
+ push: z12.boolean()
2833
2850
  }),
2834
2851
  /** LockedIn / Default / DateNight on screen; the stored words are unchanged on purpose —
2835
2852
  * they are an enum on a live column across every account, and the rename is a rename of
2836
2853
  * what people read (owner, 2026-09-30). */
2837
- sessionMode: z10.enum(["default", "all_calls", "silent"]),
2854
+ sessionMode: z12.enum(["default", "all_calls", "silent"]),
2838
2855
  /** `silentPush` lived here until #2813 and is now GONE, field and column both. It was kept as an
2839
2856
  * optional long after DateNight stopped reading it, on the theory that a phone on an older
2840
2857
  * bundle PATCHing the whole settings object would be REFUSED for sending a key we had stopped
@@ -2843,7 +2860,7 @@ var UserSettingsSchema = z10.object({
2843
2860
  * an old bundle's `silentPush` is accepted and ignored. Worth remembering before keeping the
2844
2861
  * next dead field for the same reason. */
2845
2862
  /** Opt-in (default false) to using your content to improve Paigy and train models. */
2846
- improveConsent: z10.boolean(),
2863
+ improveConsent: z12.boolean(),
2847
2864
  missedCall: MissedCallSchema.default("backoff_standard"),
2848
2865
  /** Where voice audio is processed. 'hosted' (default) = Paigy's voice services
2849
2866
  * (ElevenLabs TTS, faster-whisper STT, the call bot); 'on_device' = the phone
@@ -2851,17 +2868,17 @@ var UserSettingsSchema = z10.object({
2851
2868
  * Optional, NOT defaulted: a stale client PATCHing the full settings object
2852
2869
  * must not silently reset this privacy choice. Absent = leave unchanged on
2853
2870
  * write, 'hosted' on read (see store.ts). */
2854
- voiceMode: z10.enum(["hosted", "on_device"]).optional(),
2871
+ voiceMode: z12.enum(["hosted", "on_device"]).optional(),
2855
2872
  /** Talk — after you answer, the next step is read aloud (docs/clients/app/walk/design.md §6). ALWAYS ON until
2856
2873
  * turned off (owner, 2026-09-18, #2249): a setting, not a per-walk toggle. Optional, NOT
2857
2874
  * defaulted, for the same reason `voiceMode` is: a stale client PATCHing the full settings
2858
2875
  * object must not silently turn it back on. Absent = leave unchanged on write, true on
2859
2876
  * read (see store.ts). */
2860
- talk: z10.boolean().optional(),
2877
+ talk: z12.boolean().optional(),
2861
2878
  /** CALL DIAGNOSTICS (owner, 2026-10-01): the call report carries each listen and the bot's own
2862
2879
  * load timings. SERVER-SET, no UI — on for every account that existed on 2026-10-01, off for
2863
2880
  * newer ones (migration 20261001132859). Read-only here: the settings PATCH never writes it. */
2864
- callDiagnostics: z10.boolean().optional(),
2881
+ callDiagnostics: z12.boolean().optional(),
2865
2882
  /** Per-user ring budget (#603): calls per rolling day before further calls
2866
2883
  * degrade to banner. Absent = the global default (25). A number, never a
2867
2884
  * bypass — every account keeps a ceiling. No UI; set per user for testing. */
@@ -2869,7 +2886,7 @@ var UserSettingsSchema = z10.object({
2869
2886
  * payload['tuning'] (e.g. { silence_s: 3.5 } — a longer pause window for a
2870
2887
  * slower speaker). No API-side semantics; the bot resolves each key with its
2871
2888
  * own defaults. Set per user (no UI yet); absent = bot defaults. */
2872
- voiceTuning: z10.record(z10.string(), z10.union([z10.number(), z10.string()])).optional(),
2889
+ voiceTuning: z12.record(z12.string(), z12.union([z12.number(), z12.string()])).optional(),
2873
2890
  /** The user's IANA timezone (e.g. "America/Bogota"), recorded by the app — it is the
2874
2891
  * only party that knows it. REMINDERS are why it exists: "remind me at ten" becomes
2875
2892
  * an absolute `due_at` only if we know whose ten. Optional and never defaulted, for
@@ -2878,53 +2895,53 @@ var UserSettingsSchema = z10.object({
2878
2895
  * that failure reads as the reminder rail being unreliable rather than as a missing
2879
2896
  * setting. Absent = a spoken time can't be landed, so the reminder rides the next
2880
2897
  * call — honest about what we know. */
2881
- timezone: z10.string().min(1).max(64).optional(),
2898
+ timezone: z12.string().min(1).max(64).optional(),
2882
2899
  /** Rung-2 broker tuning (#381). Optional and NOT defaulted, same stale-client
2883
2900
  * clobber guard as voiceMode: absent = leave unchanged on write. */
2884
2901
  broker: BrokerTuningSchema.optional()
2885
2902
  });
2886
- var HistoryWorkSchema = z10.object({
2887
- id: z10.string(),
2888
- title: z10.string(),
2889
- state: z10.enum(["done", "cancelled"]),
2903
+ var HistoryWorkSchema = z12.object({
2904
+ id: z12.string(),
2905
+ title: z12.string(),
2906
+ state: z12.enum(["done", "cancelled"]),
2890
2907
  /** Who held it (`agent:<tokenId>` or `human:<userId>`). */
2891
- assignee: z10.string()
2908
+ assignee: z12.string()
2892
2909
  });
2893
- var HistoryEntrySchema = z10.union([
2894
- z10.object({ at: z10.string(), card: InboxItemSchema }),
2895
- z10.object({ at: z10.string(), work: HistoryWorkSchema })
2910
+ var HistoryEntrySchema = z12.union([
2911
+ z12.object({ at: z12.string(), card: InboxItemSchema }),
2912
+ z12.object({ at: z12.string(), work: HistoryWorkSchema })
2896
2913
  ]);
2897
- var HistoryPageSchema = z10.object({
2898
- entries: z10.array(HistoryEntrySchema),
2899
- next: z10.string().nullable()
2914
+ var HistoryPageSchema = z12.object({
2915
+ entries: z12.array(HistoryEntrySchema),
2916
+ next: z12.string().nullable()
2900
2917
  });
2901
2918
  var ACTIVITY_LINES = 2;
2902
2919
  var ACTIVITY_LINE_MAX = 80;
2903
- var AgentActivitySchema = z10.object({
2920
+ var AgentActivitySchema = z12.object({
2904
2921
  /** Oldest first, so the newest line is last — the one that replaces in place. */
2905
- lines: z10.array(z10.string().max(ACTIVITY_LINE_MAX)).max(ACTIVITY_LINES),
2922
+ lines: z12.array(z12.string().max(ACTIVITY_LINE_MAX)).max(ACTIVITY_LINES),
2906
2923
  /** When the harness observed this tail. Its own timestamp, not the heartbeat's: a beat
2907
2924
  * that carries an UNCHANGED tail must not make a stalled agent look like it just moved. */
2908
- at: z10.string().datetime()
2925
+ at: z12.string().datetime()
2909
2926
  });
2910
- var ConnectionSummarySchema = z10.object({
2927
+ var ConnectionSummarySchema = z12.object({
2911
2928
  /** The connection = the agent's token id (used to address a request). */
2912
- id: z10.string(),
2929
+ id: z12.string(),
2913
2930
  /** The credential kind: "device" = a paired machine (mint-only — it hosts and mints, it
2914
2931
  * never talks); "agent" = an identity that sends. The roster and devices surfaces split
2915
2932
  * on this. Optional/absent reads as "agent" (a row predating the kind column). See
2916
2933
  * docs/server/tokens/devices-vs-agents-design.md. */
2917
- kind: z10.enum(["device", "agent"]).optional(),
2934
+ kind: z12.enum(["device", "agent"]).optional(),
2918
2935
  /** For an agent, the token id of the DEVICE that minted it — so agents group under their
2919
2936
  * machine, and revoking a device cascades to them. Null on devices, and on unlinked
2920
2937
  * agents (phone-launched, provider-managed, or minted before the link existed). */
2921
- mintedByDevice: z10.string().nullable().optional(),
2922
- device: z10.string().nullable(),
2938
+ mintedByDevice: z12.string().nullable().optional(),
2939
+ device: z12.string().nullable(),
2923
2940
  /** The agent's display name (the single pairing name). */
2924
- name: z10.string(),
2941
+ name: z12.string(),
2925
2942
  /** For a managed connection, the provider key (e.g. "cma") that agentOrigin maps to a
2926
2943
  * label; null for a local connection. Sourced from the token's provider, not the name. */
2927
- provider: z10.string().nullable(),
2944
+ provider: z12.string().nullable(),
2928
2945
  /** The pairing's assigned voice (#462); null = the default voice. */
2929
2946
  voice: VoiceKeySchema.nullable(),
2930
2947
  /** The LOUDEST this agent may ever reach you — a ceiling on `NOTIFY_LADDER`, set by the
@@ -2935,34 +2952,34 @@ var ConnectionSummarySchema = z10.object({
2935
2952
  * every surface at once and outranks even `sessionMode: all_calls` — a mode the user
2936
2953
  * set once must not overrule a rule they set about one agent. */
2937
2954
  reach: NotifyLevelSchema.nullable().optional(),
2938
- createdAt: z10.string().datetime(),
2955
+ createdAt: z12.string().datetime(),
2939
2956
  /** Most recent notification on this connection, either direction. Null = no contact yet.
2940
2957
  * Drives the agents-page recency grouping (Today / This week / …). */
2941
- lastContactAt: z10.string().datetime().nullable(),
2958
+ lastContactAt: z12.string().datetime().nullable(),
2942
2959
  /** Last presence heartbeat from a running agent process (POST /api/presence) — the
2943
2960
  * desktop app while open. Null = never seen; stale = offline. */
2944
- lastSeenAt: z10.string().datetime().nullable().optional(),
2961
+ lastSeenAt: z12.string().datetime().nullable().optional(),
2945
2962
  /** WORKING, NOT JUST CONNECTED (owner, 2026-09-30): the last time the agent itself acted on one of
2946
2963
  * its Goals — wrote on one or recorded an operation (`tokens.last_worked_at`). Within
2947
2964
  * `WORKING_MS` it is working; otherwise it is connected but idle. Null = not seen working yet. */
2948
- lastWorkedAt: z10.string().datetime().nullable().optional(),
2965
+ lastWorkedAt: z12.string().datetime().nullable().optional(),
2949
2966
  /** The oldest of its Goals that is `ready` for it — work handed to it that nobody has started.
2950
2967
  * With no work of its own for `WORKING_MS`, an agent sitting on this is not taking its work. */
2951
- oldestReadyAt: z10.string().datetime().nullable().optional(),
2968
+ oldestReadyAt: z12.string().datetime().nullable().optional(),
2952
2969
  /** What a live desktop can run (docs/clients/desktop/companion.md §2.2), advertised on its heartbeat:
2953
2970
  * harness availabilities + granted workspaces — the option set the phone's
2954
2971
  * "new session" sheet offers. Absent for ordinary MCP agents. */
2955
- runtime: z10.object({
2972
+ runtime: z12.object({
2956
2973
  /** The @paigy/harness this host is running — a machine the self-update has not reached
2957
2974
  * shows its age here (`apps/desktop/src/update.ts`). */
2958
- version: z10.string().optional(),
2959
- harnesses: z10.array(z10.object({ name: z10.string(), label: z10.string(), status: z10.string() })).optional(),
2960
- workspaces: z10.array(z10.string()).optional(),
2975
+ version: z12.string().optional(),
2976
+ harnesses: z12.array(z12.object({ name: z12.string(), label: z12.string(), status: z12.string() })).optional(),
2977
+ workspaces: z12.array(z12.string()).optional(),
2961
2978
  /** THE GIT REPOS IN THOSE FOLDERS (2026-10-01, Goal 26982211): each granted folder that is a
2962
2979
  * repo, and each repo directly inside one, with its `origin` remote. A session started for
2963
2980
  * work on `mauurda/paigy` opens in that repo rather than the folder above it, where the repo's
2964
2981
  * own AGENTS.md is never read (`workspaceForRepo`). Absent on hosts that predate it. */
2965
- repos: z10.array(z10.object({ path: z10.string(), remote: z10.string() })).optional()
2982
+ repos: z12.array(z12.object({ path: z12.string(), remote: z12.string() })).optional()
2966
2983
  }).optional(),
2967
2984
  /** The tail of this agent's working log, when a harness is driving it — the agent page's
2968
2985
  * live strip. Absent for anything the desktop harness isn't running (a hatched identity
@@ -2971,166 +2988,166 @@ var ConnectionSummarySchema = z10.object({
2971
2988
  activity: AgentActivitySchema.optional(),
2972
2989
  /** True = a provider-managed agent running in the provider's cloud (e.g. Anthropic CMA);
2973
2990
  * false = a local MCP connection running on the user's computer (Claude Code/Codex/…). */
2974
- managed: z10.boolean()
2991
+ managed: z12.boolean()
2975
2992
  });
2976
- var LedgerItemSchema = z10.object({ id: z10.string(), parentId: z10.string(), title: z10.string(), createdAt: z10.string() });
2977
- var AgentLedgerSchema = z10.object({
2993
+ var LedgerItemSchema = z12.object({ id: z12.string(), parentId: z12.string(), title: z12.string(), createdAt: z12.string() });
2994
+ var AgentLedgerSchema = z12.object({
2978
2995
  /** Null when the agent has not named itself yet — never a placeholder (owner, 2026-10-01). */
2979
- agent: z10.object({ id: z10.string(), name: z10.string().nullable(), revokedAt: z10.string().nullable() }),
2996
+ agent: z12.object({ id: z12.string(), name: z12.string().nullable(), revokedAt: z12.string().nullable() }),
2980
2997
  /** Its own questions you have not answered. */
2981
- asks: z10.array(LedgerItemSchema),
2998
+ asks: z12.array(LedgerItemSchema),
2982
2999
  /** Its questions you answered that nobody acted on — still owed to somebody. */
2983
- answered: z10.array(LedgerItemSchema),
3000
+ answered: z12.array(LedgerItemSchema),
2984
3001
  /** Requests you sent it that it never took. */
2985
- requests: z10.array(LedgerItemSchema),
2986
- goals: z10.array(z10.object({ id: z10.string(), outcome: z10.string(), state: z10.string() })),
2987
- callbacks: z10.array(z10.object({ id: z10.string(), parentId: z10.string(), trigger: z10.string(), note: z10.string(), dueAt: z10.string().nullable() }))
3002
+ requests: z12.array(LedgerItemSchema),
3003
+ goals: z12.array(z12.object({ id: z12.string(), outcome: z12.string(), state: z12.string() })),
3004
+ callbacks: z12.array(z12.object({ id: z12.string(), parentId: z12.string(), trigger: z12.string(), note: z12.string(), dueAt: z12.string().nullable() }))
2988
3005
  });
2989
- var ReassignResultSchema = z10.object({
2990
- moved: z10.object({ asks: z10.number(), answered: z10.number(), requests: z10.number(), goals: z10.number(), callbacks: z10.number() }),
2991
- parentId: z10.string().nullable()
3006
+ var ReassignResultSchema = z12.object({
3007
+ moved: z12.object({ asks: z12.number(), answered: z12.number(), requests: z12.number(), goals: z12.number(), callbacks: z12.number() }),
3008
+ parentId: z12.string().nullable()
2992
3009
  });
2993
- var LessonStateSchema = z10.enum(["active", "proposed", "retired"]);
2994
- var LessonViewSchema = z10.object({
2995
- id: z10.string(),
2996
- text: z10.string(),
3010
+ var LessonStateSchema = z12.enum(["active", "proposed", "retired"]);
3011
+ var LessonViewSchema = z12.object({
3012
+ id: z12.string(),
3013
+ text: z12.string(),
2997
3014
  state: LessonStateSchema,
2998
3015
  /** The Goal it is scoped to; null = the whole account. */
2999
- scopeGoalId: z10.string().nullable(),
3000
- goalTitle: z10.string().nullable(),
3001
- version: z10.number(),
3002
- pinned: z10.boolean(),
3016
+ scopeGoalId: z12.string().nullable(),
3017
+ goalTitle: z12.string().nullable(),
3018
+ version: z12.number(),
3019
+ pinned: z12.boolean(),
3003
3020
  /** When the person last wrote its text themselves. */
3004
- editedAt: z10.string().nullable(),
3005
- createdAt: z10.string(),
3006
- updatedAt: z10.string(),
3021
+ editedAt: z12.string().nullable(),
3022
+ createdAt: z12.string(),
3023
+ updatedAt: z12.string(),
3007
3024
  /** The Entries it came from, oldest first; `words` is null when an Entry has none to show (sealed). */
3008
- sources: z10.array(z10.object({ entryId: z10.string(), words: z10.string().nullable(), at: z10.string() }))
3025
+ sources: z12.array(z12.object({ entryId: z12.string(), words: z12.string().nullable(), at: z12.string() }))
3009
3026
  });
3010
- var QueueQuestionSchema = z10.object({
3027
+ var QueueQuestionSchema = z12.object({
3011
3028
  /** The decision need's id — what an answer is accepted against. */
3012
- id: z10.string(),
3029
+ id: z12.string(),
3013
3030
  /** The words that were asked, from the request Entry that asked them. */
3014
- question: z10.string(),
3031
+ question: z12.string(),
3015
3032
  /** Where it was asked — which is where the ruling goes (`POST /api/entries`). Null only
3016
3033
  * for a need whose request Entry is carried by no interactive Delivery, which nothing
3017
3034
  * can answer. */
3018
- deliveryId: z10.string().nullable().default(null),
3035
+ deliveryId: z12.string().nullable().default(null),
3019
3036
  /** The Entry the ruling is about. */
3020
- aboutId: z10.string().nullable().default(null),
3037
+ aboutId: z12.string().nullable().default(null),
3021
3038
  /** Empty for a free-text question. */
3022
- options: z10.array(OptionSchema).default([]),
3023
- select: z10.enum(["one", "many", "rank", "confirm", "text"]).default("text"),
3024
- askedAt: z10.string(),
3039
+ options: z12.array(OptionSchema).default([]),
3040
+ select: z12.enum(["one", "many", "rank", "confirm", "text"]).default("text"),
3041
+ askedAt: z12.string(),
3025
3042
  /** Null while the question is open — which is how the page tells the two apart. */
3026
- answeredAt: z10.string().nullable().default(null),
3043
+ answeredAt: z12.string().nullable().default(null),
3027
3044
  /** The ruling in the person's own words, from the contribution that replied — not the
3028
3045
  * option id, which is not something anyone reads back. Null while it is open, and null
3029
3046
  * for a settled question whose reply carried nothing readable. */
3030
- answer: z10.string().nullable().default(null),
3047
+ answer: z12.string().nullable().default(null),
3031
3048
  /** The Goal this question belongs to — a step knows its Goal on its own, not only through
3032
3049
  * an `InboxItem`'s `communication.goalIds[0]` (docs/clients/app/walk/design.md §12 item 3).
3033
3050
  * READ BY `apps/client/src/walk/order.ts`, which stamps it onto every `WalkStep`: the walk's
3034
3051
  * order, its route, home's trees and the list of steps all take a step's Goal from here, so
3035
3052
  * this is the field they agree through rather than each re-deriving it from the row it
3036
3053
  * arrived under. Required because the API projects it on every need it sends. */
3037
- goalId: z10.string(),
3054
+ goalId: z12.string(),
3038
3055
  /** True only while an unmet START gate holds the Goal — a Goal that merely waits to
3039
3056
  * *finish* does not stop a person from answering (owner, 2026-09-16: "per need gate from
3040
3057
  * the API"; §4's dashed node). Not the same fact as `QueueItem.blocked`, which counts any
3041
3058
  * gate at all. */
3042
- blocked: z10.boolean().default(false)
3059
+ blocked: z12.boolean().default(false)
3043
3060
  });
3044
- var QueueReplySchema = z10.object({
3061
+ var QueueReplySchema = z12.object({
3045
3062
  /** The card this note was (`deliveryId:requestEntryId`, minted by the server like every card
3046
3063
  * id) — so the phone can tell a reply it just sent from one the queue already carries, and the
3047
3064
  * walk can name it in its zoom. */
3048
- id: z10.string(),
3065
+ id: z12.string(),
3049
3066
  /** The Goal the note is on. */
3050
- goalId: z10.string(),
3067
+ goalId: z12.string(),
3051
3068
  /** What the note said. */
3052
- note: z10.string(),
3069
+ note: z12.string(),
3053
3070
  /** Where it was carried — where a second reply goes (`POST /api/entries`, #2252). */
3054
- deliveryId: z10.string(),
3055
- requestEntryId: z10.string(),
3056
- askedAt: z10.string(),
3071
+ deliveryId: z12.string(),
3072
+ requestEntryId: z12.string(),
3073
+ askedAt: z12.string(),
3057
3074
  /** When the person last replied — the window's start. */
3058
- repliedAt: z10.string(),
3075
+ repliedAt: z12.string(),
3059
3076
  /** The person's latest words about it; null when there is nothing readable in them. */
3060
- reply: z10.string().nullable()
3077
+ reply: z12.string().nullable()
3061
3078
  });
3062
- var QueueItemSchema = z10.object({
3063
- id: z10.string(),
3079
+ var QueueItemSchema = z12.object({
3080
+ id: z12.string(),
3064
3081
  /** One-line headline — the first sentence of the outcome. */
3065
- title: z10.string(),
3082
+ title: z12.string(),
3066
3083
  /** The outcome in full, verbatim: the person's own words are what an assignee sees. */
3067
- intent: z10.string(),
3084
+ intent: z12.string(),
3068
3085
  /** `ready` | `active` | `waiting` | `done` | `cancelled`, straight off the Goal. */
3069
- state: z10.string(),
3086
+ state: z12.string(),
3070
3087
  /** Who holds it (a participant ref); null when nobody does yet. */
3071
- assignee: z10.string().nullable().default(null),
3088
+ assignee: z12.string().nullable().default(null),
3072
3089
  /** What the agent last said it was doing; null if it has said nothing. */
3073
- progress: z10.string().nullable().default(null),
3090
+ progress: z12.string().nullable().default(null),
3074
3091
  /** HOME'S LINE FOR THAT NOTE (owner, 2026-09-23): a few plain words one read wrote from `progress`,
3075
3092
  * served only while it was written for the current note. Null means show the Goal's name. */
3076
- progressLine: z10.string().nullable().optional(),
3077
- reviewPending: z10.boolean().default(false),
3078
- dueAt: z10.string().nullable().default(null),
3093
+ progressLine: z12.string().nullable().optional(),
3094
+ reviewPending: z12.boolean().default(false),
3095
+ dueAt: z12.string().nullable().default(null),
3079
3096
  /** WHEN ITS OWNER SAID DONE WHILE CHILDREN WERE OPEN (#2704): its own work is finished and it closes
3080
3097
  * with its last open child. Null otherwise; optional, so hand-built queues need not spell it. */
3081
- finishedAt: z10.string().nullable().optional(),
3098
+ finishedAt: z12.string().nullable().optional(),
3082
3099
  /** The Goal this one was opened under; null at the root. */
3083
- parentGoalId: z10.string().nullable().default(null),
3100
+ parentGoalId: z12.string().nullable().default(null),
3084
3101
  /** Goals opened under this one — only those the same list holds. */
3085
- childGoalIds: z10.array(z10.string()).default([]),
3102
+ childGoalIds: z12.array(z12.string()).default([]),
3086
3103
  /** Goals this one waits on (start or finish gates). */
3087
- dependencyGoalIds: z10.array(z10.string()).default([]),
3104
+ dependencyGoalIds: z12.array(z12.string()).default([]),
3088
3105
  /** True while any gate is on a Goal that is not done — the walk draws it dashed. */
3089
- blocked: z10.boolean().default(false),
3106
+ blocked: z12.boolean().default(false),
3090
3107
  /** Its questions: every OPEN one, and at most ten settled, newest settled first
3091
3108
  * (20260929133308) — the page decides which of them to show. NOT the whole set: `asked` and
3092
3109
  * `answered` are, and a settled one's words are a line (280 characters), its body read when the
3093
3110
  * question is opened. */
3094
- questions: z10.array(QueueQuestionSchema).default([]),
3111
+ questions: z12.array(QueueQuestionSchema).default([]),
3095
3112
  /** HOW MANY QUESTIONS THIS WORK HAS ASKED, and how many are answered — the Goal's own totals,
3096
3113
  * bounded at 100 server-side. A tally counted off `questions` is a wrong number that looks
3097
3114
  * right once the cap bites (`walk/trees.ts` `tallyOf`). Optional, and defaulted from the array
3098
3115
  * by the projection, so hand-built queues (fixtures, the demo) need not spell them. */
3099
- asked: z10.number().optional(),
3100
- answered: z10.number().optional(),
3116
+ asked: z12.number().optional(),
3117
+ answered: z12.number().optional(),
3101
3118
  /** Every note on it the person replied to (`QueueReplySchema`) — the page decides which to show.
3102
3119
  * Optional, not defaulted: absent is none, and every hand-built queue (fixtures, the demo) need
3103
3120
  * not spell an empty list. */
3104
- replies: z10.array(QueueReplySchema).optional(),
3121
+ replies: z12.array(QueueReplySchema).optional(),
3105
3122
  /** The repository or project identifier this Goal belongs to (#2280), null if untracked. */
3106
- repo: z10.string().nullable().optional(),
3107
- createdAt: z10.string(),
3108
- updatedAt: z10.string().nullable().default(null),
3123
+ repo: z12.string().nullable().optional(),
3124
+ createdAt: z12.string(),
3125
+ updatedAt: z12.string().nullable().default(null),
3109
3126
  /** When its owner last SAID something about it (the newest `progress` Entry: a contact update kept
3110
3127
  * as progress). `updatedAt` moves for reasons nobody chose — a
3111
3128
  * state recomputed, a review flag — so it cannot tell work in hand from work gone quiet. */
3112
- lastProgressAt: z10.string().nullable().optional(),
3129
+ lastProgressAt: z12.string().nullable().optional(),
3113
3130
  /** THE GOAL'S NEWEST WORD, FROM EITHER SIDE (owner, 2026-09-27): the newest Entry on it, of any
3114
3131
  * kind — what the person added ("Add to this"), their reply, the agent's ask or its progress
3115
3132
  * note. A progress note is an Entry, so this is already the newer of the two: the person's note
3116
3133
  * shows the moment it is written, and the agent's reply or next note replaces it by being newer.
3117
3134
  * `said` is bounded to 280 characters server-side (a line, not the conversation). Null when the
3118
3135
  * Goal carries no readable Entry; optional, so hand-built queues need not spell it. */
3119
- latest: z10.object({
3120
- from: z10.enum(["person", "agent"]),
3121
- said: z10.string(),
3122
- at: z10.string(),
3123
- entryId: z10.string(),
3136
+ latest: z12.object({
3137
+ from: z12.enum(["person", "agent"]),
3138
+ said: z12.string(),
3139
+ at: z12.string(),
3140
+ entryId: z12.string(),
3124
3141
  /** ITS SUMMARY IN AT MOST TEN WORDS (owner, 2026-10-08: "the same switch to the more summarized sources
3125
3142
  * at the work tab top level screen too"): what the talker or filer wrote on the Entry; absent when
3126
3143
  * none was. The Work row reads it before `said`. */
3127
- summary: z10.string().optional(),
3144
+ summary: z12.string().optional(),
3128
3145
  /** AN AGENT'S UPDATE OR QUESTION AS ITS UNITS' TITLES (owner, 2026-10-08: "send the 50 chars from the title
3129
3146
  * of each unit"): each at most 50 characters, in order; absent when it has none. */
3130
- titles: z10.array(z10.string()).optional(),
3147
+ titles: z12.array(z12.string()).optional(),
3131
3148
  /** A PROGRESS NOTE'S ONE POINT ("An agent's progress note -> maybe let's cap it at 200 chars"): the
3132
3149
  * update's own line, before its units; the row caps it at 200. Absent on anything else. */
3133
- line: z10.string().optional()
3150
+ line: z12.string().optional()
3134
3151
  }).nullable().optional(),
3135
3152
  /** WHEN THIS PERSON LAST PUT A HAND ON IT THEMSELVES (owner, Paigy Goal 16d18f51, 2026-09-30):
3136
3153
  * the newest Entry on the Goal they wrote, of any kind — a line they added, a reply to a note, an
@@ -3143,7 +3160,7 @@ var QueueItemSchema = z10.object({
3143
3160
  * minute after the person speaks erases their instant from it, and the durable traces the client
3144
3161
  * can see (`replies`, `questions[].answeredAt`) miss a spontaneous note entirely — a `request`
3145
3162
  * Entry with no `about_id` is in neither. */
3146
- lastPersonAt: z10.string().nullable().optional(),
3163
+ lastPersonAt: z12.string().nullable().optional(),
3147
3164
  /** WHAT THIS ROW IS, IN TWELVE CHARACTERS (#2928) — the hash of every other field on it, stamped
3148
3165
  * by the one projection that builds the row (`apps/api/src/goal/queue.ts`). It is how the
3149
3166
  * incremental read knows a row has not moved: the phone echoes back the revs it holds
@@ -3154,40 +3171,40 @@ var QueueItemSchema = z10.object({
3154
3171
  * the row shows that no `updated_at` moves for (`active` lapsing, a dependency's state, a
3155
3172
  * sibling appearing in `childGoalIds`) cannot go unnoticed. Optional because a hand-built
3156
3173
  * queue (a fixture, the demo) spells none, and a row with no rev is simply always re-sent. */
3157
- rev: z10.string().optional()
3174
+ rev: z12.string().optional()
3158
3175
  });
3159
- var QueueDeltaSchema = z10.object({
3160
- ids: z10.array(z10.string()),
3161
- items: z10.array(QueueItemSchema)
3176
+ var QueueDeltaSchema = z12.object({
3177
+ ids: z12.array(z12.string()),
3178
+ items: z12.array(QueueItemSchema)
3162
3179
  });
3163
3180
  var COLD_AFTER_MS = 3 * 24 * 60 * 60 * 1e3;
3164
- var NoteSourceSchema = z10.enum(["app", "call"]);
3165
- var NoteStatusSchema = z10.enum(["open", "assigned", "in_progress", "done"]);
3166
- var NoteRepeatSchema = z10.enum(["once", "until_done"]);
3167
- var DecisionSchema = z10.object({
3168
- id: z10.string(),
3181
+ var NoteSourceSchema = z12.enum(["app", "call"]);
3182
+ var NoteStatusSchema = z12.enum(["open", "assigned", "in_progress", "done"]);
3183
+ var NoteRepeatSchema = z12.enum(["once", "until_done"]);
3184
+ var DecisionSchema = z12.object({
3185
+ id: z12.string(),
3169
3186
  /** The note this decision refines; null = recorded on a bare thread (the
3170
3187
  * extensibility seam — any conversation can accrue decisions). */
3171
- noteId: z10.string().nullable(),
3188
+ noteId: z12.string().nullable(),
3172
3189
  /** What was ambiguous — the broker's (or the user's own) question. */
3173
- question: z10.string(),
3190
+ question: z12.string(),
3174
3191
  /** The user's ruling; null while the question is open. */
3175
- answer: z10.string().nullable(),
3176
- decidedAt: z10.string().nullable(),
3177
- createdAt: z10.string()
3192
+ answer: z12.string().nullable(),
3193
+ decidedAt: z12.string().nullable(),
3194
+ createdAt: z12.string()
3178
3195
  });
3179
- var NoteSchema = z10.object({
3180
- id: z10.string(),
3196
+ var NoteSchema = z12.object({
3197
+ id: z12.string(),
3181
3198
  /** One-line headline (broker-titled; deterministic floor). */
3182
- title: z10.string(),
3199
+ title: z12.string(),
3183
3200
  /** The original intent, verbatim — assignees always see the user's own words. */
3184
- intent: z10.string(),
3201
+ intent: z12.string(),
3185
3202
  source: NoteSourceSchema,
3186
3203
  status: NoteStatusSchema,
3187
3204
  /** Who it was assigned to (a participant ref, 'agent:<tokenId>'); null = unassigned. */
3188
- assignee: z10.string().nullable(),
3205
+ assignee: z12.string().nullable(),
3189
3206
  /** The request thread minted at assignment; null until assigned. */
3190
- parentId: z10.string().nullable(),
3207
+ parentId: z12.string().nullable(),
3191
3208
  /** REMINDERS (docs/model/notes/reminders-design.md): the NOT-BEFORE this becomes eligible to ride a
3192
3209
  * call — never a deadline. It only ever comes from the user's own words, so when it
3193
3210
  * passes Paigy rings ONCE (#1293, owner 2026-08-26: a time said out loud is consent to
@@ -3196,154 +3213,154 @@ var NoteSchema = z10.object({
3196
3213
  // Defaulted, not required: a Note from an API deploy older than the reminders
3197
3214
  // migration has none of these, and the defaults ARE what it means — no not-before,
3198
3215
  // one ride, never ridden. Parsing must not fail across a rolling deploy.
3199
- dueAt: z10.string().nullable().default(null),
3216
+ dueAt: z12.string().nullable().default(null),
3200
3217
  repeat: NoteRepeatSchema.default("once"),
3201
3218
  /** How many calls have already carried it — the fatigue cap counts rides, not days. */
3202
- rides: z10.number().int().default(0),
3203
- lastRideAt: z10.string().nullable().default(null),
3204
- createdAt: z10.string()
3219
+ rides: z12.number().int().default(0),
3220
+ lastRideAt: z12.string().nullable().default(null),
3221
+ createdAt: z12.string()
3205
3222
  });
3206
- var TriageItemSchema = z10.object({
3207
- noteId: z10.string(),
3223
+ var TriageItemSchema = z12.object({
3224
+ noteId: z12.string(),
3208
3225
  /** The note's headline at run time. */
3209
- title: z10.string(),
3226
+ title: z12.string(),
3210
3227
  /** WHY, in one short human line, evidence first — this is read on a phone underneath
3211
3228
  * the note's title: "no movement in 34 days", "worked 3 notes in this repo this week".
3212
3229
  * Never a model's reasoning transcript, never an id. */
3213
- why: z10.string()
3230
+ why: z12.string()
3214
3231
  });
3215
- var TriageAssignmentSchema = z10.object({
3232
+ var TriageAssignmentSchema = z12.object({
3216
3233
  /** The agent's token id — what `dispatchNote` resolves and what a request is addressed to. */
3217
- agent: z10.string(),
3234
+ agent: z12.string(),
3218
3235
  /** Its display name at run time (the name on the hatchling's card). Denormalized for the
3219
3236
  * same reason as `title`: the card must render from the proposal alone. */
3220
- agentName: z10.string(),
3221
- notes: z10.array(TriageItemSchema)
3237
+ agentName: z12.string(),
3238
+ notes: z12.array(TriageItemSchema)
3222
3239
  });
3223
- var TriageStatusSchema = z10.enum(["open", "superseded", "dismissed"]);
3224
- var SubmitTriageSchema = z10.object({
3240
+ var TriageStatusSchema = z12.enum(["open", "superseded", "dismissed"]);
3241
+ var SubmitTriageSchema = z12.object({
3225
3242
  /** Which runtime judged: "ollama" (inference never left the machine) or a harness the
3226
3243
  * user already runs under their own credentials ("claude" / "codex" / "agy"). Recorded
3227
3244
  * so the phone can say where the content went — an unattributed privacy claim is worth
3228
3245
  * nothing, and #1106's promise is precisely "Paigy's servers never see this". */
3229
- provider: z10.string().min(1).max(60),
3246
+ provider: z12.string().min(1).max(60),
3230
3247
  /** The concrete model when the provider names one (an ollama tag); null otherwise. */
3231
- model: z10.string().max(200).nullable().optional(),
3248
+ model: z12.string().max(200).nullable().optional(),
3232
3249
  /** How many open notes the run actually looked at — the denominator on the phone
3233
3250
  * ("6 of 50"), and the honest answer to "did it read the whole queue?". */
3234
- reviewed: z10.number().int().min(0).max(1e4).default(0),
3235
- close: z10.array(TriageItemSchema).max(200).default([]),
3236
- stale: z10.array(TriageItemSchema).max(200).default([]),
3237
- assign: z10.array(TriageAssignmentSchema).max(50).default([])
3251
+ reviewed: z12.number().int().min(0).max(1e4).default(0),
3252
+ close: z12.array(TriageItemSchema).max(200).default([]),
3253
+ stale: z12.array(TriageItemSchema).max(200).default([]),
3254
+ assign: z12.array(TriageAssignmentSchema).max(50).default([])
3238
3255
  });
3239
3256
  var TriageProposalSchema = SubmitTriageSchema.extend({
3240
- id: z10.string(),
3241
- runAt: z10.string(),
3257
+ id: z12.string(),
3258
+ runAt: z12.string(),
3242
3259
  status: TriageStatusSchema,
3243
- model: z10.string().nullable().default(null)
3260
+ model: z12.string().nullable().default(null)
3244
3261
  });
3245
- var AcceptTriageSchema = z10.discriminatedUnion("group", [
3246
- z10.object({ group: z10.literal("close"), noteIds: z10.array(z10.string()).max(200).optional() }),
3247
- z10.object({ group: z10.literal("stale"), noteIds: z10.array(z10.string()).max(200).optional() }),
3248
- z10.object({
3249
- group: z10.literal("assign"),
3250
- agent: z10.string().min(1),
3251
- noteIds: z10.array(z10.string()).max(200).optional()
3262
+ var AcceptTriageSchema = z12.discriminatedUnion("group", [
3263
+ z12.object({ group: z12.literal("close"), noteIds: z12.array(z12.string()).max(200).optional() }),
3264
+ z12.object({ group: z12.literal("stale"), noteIds: z12.array(z12.string()).max(200).optional() }),
3265
+ z12.object({
3266
+ group: z12.literal("assign"),
3267
+ agent: z12.string().min(1),
3268
+ noteIds: z12.array(z12.string()).max(200).optional()
3252
3269
  })
3253
3270
  ]);
3254
- var AcceptTriageResultSchema = z10.object({
3255
- accepted: z10.array(z10.string()),
3256
- failed: z10.array(z10.object({ noteId: z10.string(), reason: z10.string() }))
3271
+ var AcceptTriageResultSchema = z12.object({
3272
+ accepted: z12.array(z12.string()),
3273
+ failed: z12.array(z12.object({ noteId: z12.string(), reason: z12.string() }))
3257
3274
  });
3258
- var DeliveryModeSchema = z10.enum(["poll", "self_hosted"]);
3275
+ var DeliveryModeSchema = z12.enum(["poll", "self_hosted"]);
3259
3276
  var WAKE_EVENT = "wake";
3260
3277
  var wakeChannel = (tokenId) => `wake:${tokenId}`;
3261
- var RegisterDeliverySchema = z10.object({ mode: DeliveryModeSchema });
3262
- var OAuthStartSchema = z10.object({
3263
- provider: z10.enum(["cma"]),
3264
- returnTo: z10.string().min(1)
3278
+ var RegisterDeliverySchema = z12.object({ mode: DeliveryModeSchema });
3279
+ var OAuthStartSchema = z12.object({
3280
+ provider: z12.enum(["cma"]),
3281
+ returnTo: z12.string().min(1)
3265
3282
  });
3266
- var DeliveryConfigSchema = z10.object({
3267
- tokenId: z10.string(),
3283
+ var DeliveryConfigSchema = z12.object({
3284
+ tokenId: z12.string(),
3268
3285
  mode: DeliveryModeSchema,
3269
3286
  /** null when the deployment has no anon key configured. `self_hosted` is then REFUSED
3270
3287
  * (503 `self_hosted_unavailable`) rather than registered, so a self_hosted config always
3271
3288
  * carries credentials; only a `poll` registration can come back with null here. */
3272
- realtime: z10.object({ url: z10.string(), anonKey: z10.string() }).nullable()
3289
+ realtime: z12.object({ url: z12.string(), anonKey: z12.string() }).nullable()
3273
3290
  });
3274
- var HostDecisionSchema = z10.object({
3291
+ var HostDecisionSchema = z12.object({
3275
3292
  /** The agent's token id: the row's `recipient`. */
3276
- agent: z10.string().uuid(),
3277
- decision: z10.enum(["stood_back", "took_over"]),
3293
+ agent: z12.string().uuid(),
3294
+ decision: z12.enum(["stood_back", "took_over"]),
3278
3295
  /** The work it was about: the Goal waiting on that agent next (`claimable` on its `contact({})` read). */
3279
- goalId: z10.string().uuid().nullable().optional(),
3296
+ goalId: z12.string().uuid().nullable().optional(),
3280
3297
  /** When the server last heard from the agent, as the host read it: the presence it stood back for. */
3281
- seenAt: z10.string().datetime().nullable().optional(),
3298
+ seenAt: z12.string().datetime().nullable().optional(),
3282
3299
  /** When that work last moved (`claimable.since` on an agent's `contact({})` read), the fact the bound is judged on. */
3283
- since: z10.string().datetime().nullable().optional(),
3300
+ since: z12.string().datetime().nullable().optional(),
3284
3301
  /** What the host said, in its log's own words: why it stood back, or what the take-over did. */
3285
- said: z10.string().max(300).optional()
3302
+ said: z12.string().max(300).optional()
3286
3303
  });
3287
- var WakeNudgeSchema = z10.object({
3288
- kind: z10.enum(["reply", "request", "callback"]),
3289
- notificationId: z10.string().optional(),
3290
- parentId: z10.string()
3304
+ var WakeNudgeSchema = z12.object({
3305
+ kind: z12.enum(["reply", "request", "callback"]),
3306
+ notificationId: z12.string().optional(),
3307
+ parentId: z12.string()
3291
3308
  });
3292
- var PairingStatusSchema = z10.enum(["pending", "approved", "denied", "expired"]);
3293
- var DeviceCodeSchema = z10.object({
3294
- device_code: z10.string(),
3295
- user_code: z10.string(),
3296
- verification_uri: z10.string().url(),
3297
- verification_uri_complete: z10.string().url(),
3298
- interval: z10.number(),
3299
- expires_in: z10.number()
3309
+ var PairingStatusSchema = z12.enum(["pending", "approved", "denied", "expired"]);
3310
+ var DeviceCodeSchema = z12.object({
3311
+ device_code: z12.string(),
3312
+ user_code: z12.string(),
3313
+ verification_uri: z12.string().url(),
3314
+ verification_uri_complete: z12.string().url(),
3315
+ interval: z12.number(),
3316
+ expires_in: z12.number()
3300
3317
  });
3301
- var DeviceInfoSchema = z10.object({
3302
- code: z10.string(),
3318
+ var DeviceInfoSchema = z12.object({
3319
+ code: z12.string(),
3303
3320
  /** The agent's suggested name (from /device/code) — shown on the approval screen,
3304
3321
  * pre-filling the name field the human can edit. */
3305
- name: z10.string(),
3322
+ name: z12.string(),
3306
3323
  /** @deprecated Legacy alias of `name` for the pre-#531 embedded bundle in App Store
3307
3324
  * build 35, whose DeviceFlow renders `info.agent.slice(0, 2)` — without this a FRESH
3308
3325
  * install crashes on the pairing screen on first launch, before the OTA lands
3309
3326
  * (seen live: PAIGY-5T, 2026-07-21). Remove once a newer binary is the floor. */
3310
- agent: z10.string().optional(),
3311
- device: z10.string().nullable(),
3327
+ agent: z12.string().optional(),
3328
+ device: z12.string().nullable(),
3312
3329
  status: PairingStatusSchema
3313
3330
  });
3314
- var DeviceTokenSchema = z10.object({
3315
- access_token: z10.string(),
3331
+ var DeviceTokenSchema = z12.object({
3332
+ access_token: z12.string(),
3316
3333
  /** The pairing's single name (user-typed at approval, the agent's suggestion, or
3317
3334
  * a default silly name). */
3318
- name: z10.string(),
3319
- device: z10.string().nullable(),
3335
+ name: z12.string(),
3336
+ device: z12.string().nullable(),
3320
3337
  /** The pairing's assigned voice, cached so the desktop can seed the SAME face the phone
3321
3338
  * draws — voice is the third ingredient of a hatchling's build (party/traits.ts). */
3322
- voice: z10.string().nullable().optional(),
3339
+ voice: z12.string().nullable().optional(),
3323
3340
  /** The token's server-side id — the face's COLOUR anchor, and the only seed ingredient
3324
3341
  * that survives a rename. Cached by the host's identity beat. */
3325
- token_id: z10.string().nullable().optional(),
3342
+ token_id: z12.string().nullable().optional(),
3326
3343
  /** WHERE this identity works — the folder a wake should land it in. Written by the host
3327
3344
  * at spawn and by `paigy-harness handoff` from a live terminal. Without it every wake
3328
3345
  * landed in the FIRST granted workspace and the agent rediscovered its own repo from
3329
3346
  * the thread each time (host.ts, live catch 2026-08-06 — prompt-papered until now). */
3330
- workspace: z10.string().nullable().optional(),
3347
+ workspace: z12.string().nullable().optional(),
3331
3348
  /** Local host recovery must preserve the launch's runtime and Paigy identity. */
3332
- harness: z10.enum(["claude", "codex", "agy"]).optional(),
3333
- session_id: z10.string().uuid().optional(),
3349
+ harness: z12.enum(["claude", "codex", "agy"]).optional(),
3350
+ session_id: z12.string().uuid().optional(),
3334
3351
  /** A conversation the host must not resume: its context is full, so every turn fails
3335
3352
  * ("Prompt is too long"). Written when a run hits it (`run.ts` `onFull`); the host skips a slot
3336
3353
  * whose resumable session is this one, so its Goals reach the dead-agent handoff instead of a
3337
3354
  * copy that types the person's words into a turn that cannot run (Calls, 2026-10-06). */
3338
- full_session: z10.string().optional(),
3339
- uik_pub: z10.string().nullable().optional()
3355
+ full_session: z12.string().optional(),
3356
+ uik_pub: z12.string().nullable().optional()
3340
3357
  });
3341
- var SupportRequestSchema = z10.object({
3342
- email: z10.string().email().max(320),
3343
- message: z10.string().trim().min(1).max(5e3),
3344
- name: z10.string().trim().max(120).optional()
3358
+ var SupportRequestSchema = z12.object({
3359
+ email: z12.string().email().max(320),
3360
+ message: z12.string().trim().min(1).max(5e3),
3361
+ name: z12.string().trim().max(120).optional()
3345
3362
  });
3346
- var NotificationFeedbackKindSchema = z10.enum([
3363
+ var NotificationFeedbackKindSchema = z12.enum([
3347
3364
  "break_down",
3348
3365
  // "This should be more than one ask — break it down."
3349
3366
  "regenerate_options",
@@ -3358,119 +3375,121 @@ var NotificationFeedbackKindSchema = z10.enum([
3358
3375
  // anything else — the note carries it.
3359
3376
  ]);
3360
3377
  var SlimOptionSchema = OptionSchema.omit({ html: true });
3361
- var QuestionRowSchema = z10.object({
3378
+ var QuestionRowSchema = z12.object({
3362
3379
  /** The card's id (`deliveryId:needId`, or `deliveryId:entryId` for an update), as the inbox mints it. */
3363
- id: z10.string(),
3364
- deliveryId: z10.string(),
3365
- entryId: z10.string(),
3380
+ id: z12.string(),
3381
+ deliveryId: z12.string(),
3382
+ entryId: z12.string(),
3366
3383
  /** The decision it waits on; null for an update, which asks nothing. */
3367
- needId: z10.string().nullable(),
3368
- goalIds: z10.array(z10.string()),
3384
+ needId: z12.string().nullable(),
3385
+ goalIds: z12.array(z12.string()),
3369
3386
  /** The name of the work it is about, when the read could word it. */
3370
- goalTitle: z10.string().optional(),
3371
- tokenId: z10.string().optional(),
3372
- name: z10.string(),
3373
- title: z10.string(),
3374
- body: z10.string(),
3375
- select: z10.enum(["one", "many", "rank", "confirm", "text"]),
3376
- options: z10.array(SlimOptionSchema),
3377
- hasPreview: z10.boolean(),
3378
- blocking: z10.boolean(),
3379
- askedAt: z10.string().datetime(),
3387
+ goalTitle: z12.string().optional(),
3388
+ tokenId: z12.string().optional(),
3389
+ name: z12.string(),
3390
+ title: z12.string(),
3391
+ body: z12.string(),
3392
+ select: z12.enum(["one", "many", "rank", "confirm", "text"]),
3393
+ options: z12.array(SlimOptionSchema),
3394
+ hasPreview: z12.boolean(),
3395
+ blocking: z12.boolean(),
3396
+ askedAt: z12.string().datetime(),
3380
3397
  ring: InboxItemSchema.shape.ring,
3381
- onCall: z10.literal(true).optional(),
3382
- sealed: z10.boolean()
3398
+ onCall: z12.literal(true).optional(),
3399
+ sealed: z12.boolean()
3383
3400
  });
3384
- var WorkStateSchema = z10.enum(["ready", "active", "waiting", "done", "cancelled"]);
3385
- var WorkRowSchema = z10.object({
3386
- id: z10.string(),
3387
- parentId: z10.string().nullable(),
3388
- title: z10.string(),
3401
+ var WorkStateSchema = z12.enum(["ready", "active", "waiting", "done", "cancelled"]);
3402
+ var WorkRowSchema = z12.object({
3403
+ id: z12.string(),
3404
+ parentId: z12.string().nullable(),
3405
+ title: z12.string(),
3389
3406
  /** Straight off the Goal. */
3390
3407
  state: WorkStateSchema,
3391
- owner: z10.string().nullable(),
3392
- revision: z10.number().int(),
3408
+ owner: z12.string().nullable(),
3409
+ revision: z12.number().int(),
3393
3410
  /** Open questions on it, counted to 100. */
3394
- waiting: z10.number().int(),
3411
+ waiting: z12.number().int(),
3395
3412
  /** Held by a gate on work that is not done. */
3396
- blocked: z10.boolean(),
3397
- lastProgressAt: z10.string().datetime().nullable(),
3413
+ blocked: z12.boolean(),
3414
+ lastProgressAt: z12.string().datetime().nullable(),
3398
3415
  /** The line written for its newest progress note, else that note's first words. */
3399
- line: z10.string().nullable(),
3416
+ line: z12.string().nullable(),
3400
3417
  /** Work directly under it, counted to 100; the list carries up to 12 of them. */
3401
- children: z10.number().int(),
3402
- createdAt: z10.string().datetime(),
3403
- updatedAt: z10.string().datetime(),
3418
+ children: z12.number().int(),
3419
+ createdAt: z12.string().datetime(),
3420
+ updatedAt: z12.string().datetime(),
3404
3421
  /** When anything at or under it last moved — the order the list is in. */
3405
- activeAt: z10.string().datetime(),
3422
+ activeAt: z12.string().datetime(),
3406
3423
  /** A sealed outcome has no title here; the work's page opens it. */
3407
- sealed: z10.boolean()
3424
+ sealed: z12.boolean()
3408
3425
  });
3409
3426
  var ComputerRowSchema = ConnectionSummarySchema.omit({ activity: true });
3410
3427
  var AgentRowSchema = ComputerRowSchema.extend({
3411
3428
  /** Open questions it is asking the person, over every open card; null when that read failed. */
3412
- asking: z10.number().int().nullable(),
3413
- oldestAskAt: z10.string().datetime().nullable(),
3429
+ asking: z12.number().int().nullable(),
3430
+ oldestAskAt: z12.string().datetime().nullable(),
3414
3431
  /** Up to three of the live Goals it holds, oldest first (the order it picks them up), and how
3415
3432
  * many in all among the account's 200 most recently active agent-held live Goals
3416
3433
  * (`agent_holds`); null when that read failed. */
3417
- holds: z10.array(z10.object({ id: z10.string(), title: z10.string() })).nullable(),
3418
- held: z10.number().int().nullable(),
3434
+ holds: z12.array(z12.object({ id: z12.string(), title: z12.string() })).nullable(),
3435
+ held: z12.number().int().nullable(),
3419
3436
  /** The earliest instant any Goal it holds went quiet, by the one rule (`coldSince`); null
3420
3437
  * while none has, or when that read failed. */
3421
- cold: z10.string().datetime().nullable(),
3438
+ cold: z12.string().datetime().nullable(),
3422
3439
  /** The newest line of its working log, and when the harness saw it. */
3423
- line: z10.string().nullable(),
3424
- lineAt: z10.string().datetime().nullable()
3440
+ line: z12.string().nullable(),
3441
+ lineAt: z12.string().datetime().nullable()
3425
3442
  });
3426
- var SnapshotSchema = z10.object({
3443
+ var SnapshotSchema = z12.object({
3427
3444
  /** The API's clock, taken before the first read: what a later delta will start from. */
3428
- at: z10.string().datetime(),
3429
- questions: z10.object({
3445
+ at: z12.string().datetime(),
3446
+ questions: z12.object({
3430
3447
  /** The newest 30 open cards, questions before updates. */
3431
- items: z10.array(QuestionRowSchema),
3448
+ items: z12.array(QuestionRowSchema),
3432
3449
  /** Every open question, and apart from them every update, and what was put off. */
3433
- total: z10.number().int(),
3434
- updates: z10.number().int(),
3435
- putOff: z10.number().int()
3450
+ total: z12.number().int(),
3451
+ updates: z12.number().int(),
3452
+ putOff: z12.number().int()
3436
3453
  }).nullable(),
3437
- agents: z10.object({
3454
+ agents: z12.object({
3438
3455
  /** Up to 60, most recently seen first. */
3439
- items: z10.array(AgentRowSchema),
3440
- more: z10.boolean()
3456
+ items: z12.array(AgentRowSchema),
3457
+ more: z12.boolean()
3441
3458
  }).nullable(),
3442
- work: z10.object({
3459
+ work: z12.object({
3443
3460
  /** The 60 most recently active roots, each followed by up to 12 children; 240 rows at most. */
3444
- items: z10.array(WorkRowSchema),
3461
+ items: z12.array(WorkRowSchema),
3445
3462
  /** How much work is behind each of the Work tab's four filters, each counted to 100, read with
3446
3463
  * the rows. `work_list` (20260928023533) owns the predicates: Live is `ready`, `active` or
3447
3464
  * `waiting`; Waiting on you is live work with an open question or an unmet gate; Not started
3448
3465
  * is `ready`; Done is `done` or `cancelled`. */
3449
- counts: z10.object({ live: z10.number().int(), waiting: z10.number().int(), notStarted: z10.number().int(), done: z10.number().int() })
3466
+ counts: z12.object({ live: z12.number().int(), waiting: z12.number().int(), notStarted: z12.number().int(), done: z12.number().int() })
3450
3467
  }).nullable(),
3451
- you: z10.object({
3468
+ you: z12.object({
3452
3469
  settings: UserSettingsSchema,
3453
- callable: z10.boolean(),
3470
+ callable: z12.boolean(),
3454
3471
  /** Up to 20 paired computers; null when the roster read failed. */
3455
- computers: z10.array(ComputerRowSchema).nullable()
3472
+ computers: z12.array(ComputerRowSchema).nullable()
3456
3473
  }).nullable()
3457
3474
  });
3458
- var CallRecapSchema = z10.object({
3459
- call: z10.object({
3460
- status: z10.string(),
3461
- startedAt: z10.string(),
3462
- durationMs: z10.number().nullable(),
3463
- agents: z10.array(z10.object({ id: z10.string(), name: z10.string().nullable() }))
3475
+ var CallRecapSchema = z12.object({
3476
+ call: z12.object({
3477
+ status: z12.string(),
3478
+ startedAt: z12.string(),
3479
+ durationMs: z12.number().nullable(),
3480
+ /** Bot-clock pickup offset; absent before the timestamp release, null before its report lands. */
3481
+ pickupMs: z12.number().nullable().optional(),
3482
+ agents: z12.array(z12.object({ id: z12.string(), name: z12.string().nullable() }))
3464
3483
  }),
3465
- topics: z10.array(z10.object({
3466
- goalId: z10.string().uuid(),
3467
- title: z10.string(),
3468
- owner: z10.string(),
3469
- state: z10.string(),
3484
+ topics: z12.array(z12.object({
3485
+ goalId: z12.string().uuid(),
3486
+ title: z12.string(),
3487
+ owner: z12.string(),
3488
+ state: z12.string(),
3470
3489
  /** Whether the call put it to the person. An item it carried and never said has no row on the
3471
3490
  * review (owner, 2026-10-08: "why do we get the third one when it didn't happen in the call?"). */
3472
- presented: z10.boolean(),
3473
- questions: z10.array(z10.object({ id: z10.string().uuid(), state: z10.string(), title: z10.string() })),
3491
+ presented: z12.boolean(),
3492
+ questions: z12.array(z12.object({ id: z12.string().uuid(), state: z12.string(), title: z12.string() })),
3474
3493
  /** `words` is always what they SAID, verbatim — the record, never replaced. `summary` is what
3475
3494
  * the line says in ten words (owner, 2026-10-07): the filer's, or the talker's for the answer it
3476
3495
  * gave, so the row scans like a chosen option and their own words stay under it. Absent when
@@ -3480,33 +3499,33 @@ var CallRecapSchema = z10.object({
3480
3499
  /** `reply` is the reply the line makes up (an answer, an ok, a deferral), so one reply is one row
3481
3500
  * however many lines it cites; `at` is the call lines it came from, so a filed line an answer already
3482
3501
  * said is not drawn again (owner, 2026-10-07: "fix them all"); `replyKind` says which replies are answers. */
3483
- lines: z10.array(z10.object({
3484
- entryId: z10.string().uuid(),
3485
- words: z10.string(),
3486
- summary: z10.string().optional(),
3487
- about: z10.string().nullable().optional(),
3488
- reply: z10.string().nullable().optional(),
3489
- replyKind: z10.string().nullable().optional(),
3490
- at: z10.array(z10.number()).optional()
3502
+ lines: z12.array(z12.object({
3503
+ entryId: z12.string().uuid(),
3504
+ words: z12.string(),
3505
+ summary: z12.string().optional(),
3506
+ about: z12.string().nullable().optional(),
3507
+ reply: z12.string().nullable().optional(),
3508
+ replyKind: z12.string().nullable().optional(),
3509
+ at: z12.array(z12.number()).optional()
3491
3510
  }))
3492
3511
  })),
3493
- unfiled: z10.array(z10.object({ lineId: z10.string().uuid(), words: z10.string(), atMs: z10.number() })),
3512
+ unfiled: z12.array(z12.object({ lineId: z12.string().uuid(), words: z12.string(), atMs: z12.number() })),
3494
3513
  /** THE PUBLIC TRANSCRIPT — every line said on the call, in the order it was said, and WHO SAID IT
3495
3514
  * (owner, 2026-10-08: "the public view should only have the lines and who said them, and that's
3496
3515
  * it"; `docs/brain/phase-three/modular.md` build step 3). `speaker` is the role: "user" is the
3497
3516
  * person, "agent" an agent speaking, named in `agent`. The timeline's action lines are ours, not
3498
3517
  * theirs, and are not here; nor is a sealed line, which the server has no words for. It stands
3499
3518
  * BESIDE `topics` and `unfiled` — what the call did with the words — never instead of them. */
3500
- said: z10.array(z10.object({
3501
- lineId: z10.string().uuid(),
3502
- speaker: z10.enum(["user", "agent"]),
3503
- agent: z10.object({ id: z10.string().nullable(), name: z10.string().nullable() }).nullable(),
3504
- words: z10.string(),
3505
- atMs: z10.number()
3519
+ said: z12.array(z12.object({
3520
+ lineId: z12.string().uuid(),
3521
+ speaker: z12.enum(["user", "agent"]),
3522
+ agent: z12.object({ id: z12.string().nullable(), name: z12.string().nullable() }).nullable(),
3523
+ words: z12.string(),
3524
+ atMs: z12.number()
3506
3525
  })),
3507
- more: z10.object({ lines: z10.number(), entries: z10.number(), topics: z10.number() }),
3526
+ more: z12.object({ lines: z12.number(), entries: z12.number(), topics: z12.number() }),
3508
3527
  /** Last stored position on this page when another exists; absent before paging shipped. */
3509
- next: z10.number().int().nonnegative().nullable().optional()
3528
+ next: z12.number().int().nonnegative().nullable().optional()
3510
3529
  });
3511
3530
  function sessionSlot(sessionId2) {
3512
3531
  const id2 = sessionId2 ?? sessionId();
@@ -3684,15 +3703,15 @@ async function manageGoals(input, opts = {}) {
3684
3703
  if (!res.ok) await fail("manage_goals", res);
3685
3704
  return await res.json();
3686
3705
  }
3687
- async function getGoal(goalId, opts = {}, read3 = {}) {
3706
+ async function getGoals(goalIds, opts = {}, read3 = {}) {
3688
3707
  const token = authToken(opts.token) ?? "";
3689
- const query = [read3.history ? "history=1" : "", read3.diagnose ? "diagnose=1" : ""].filter(Boolean).join("&");
3690
- const res = await ensureAuthed(await (opts.reach ?? reach)(`${BACKEND_URL}/api/goals/${encodeURIComponent(goalId)}${query ? `?${query}` : ""}`, {
3691
- method: "GET",
3692
- headers: { authorization: `Bearer ${token}` }
3708
+ const res = await ensureAuthed(await (opts.reach ?? reach)(`${BACKEND_URL}/api/goals/read`, {
3709
+ method: "POST",
3710
+ headers: { "content-type": "application/json", authorization: `Bearer ${token}` },
3711
+ body: JSON.stringify({ goalIds, ...read3 })
3693
3712
  }));
3694
- if (!res.ok) await fail("get_goal", res);
3695
- return await res.json();
3713
+ if (!res.ok) await fail("get_goals", res);
3714
+ return (await res.json()).goals;
3696
3715
  }
3697
3716
  var AWAIT_WINDOW_MS = 45e3;
3698
3717
  async function hatch(name, voice = null, opts = {}) {
@@ -3873,7 +3892,7 @@ async function checkActivity(opts = {}) {
3873
3892
  if (!res.ok) await fail("check_activity", res);
3874
3893
  return await res.json();
3875
3894
  }
3876
- 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.`;
3895
+ 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, send contact.completions or manage_goals kind:complete with the shared completion report, closing and reporting together. If the person asked you, in so many words, to send them this, send it again with userExplicitlyRequested: "any" on that update.`;
3877
3896
  var APPLIED = "Applied; nothing was sent to the person.";
3878
3897
  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.";
3879
3898
  async function readDelivery(deliveryId, opts = {}) {
@@ -3898,6 +3917,7 @@ async function contact(input, opts = {}) {
3898
3917
  body: JSON.stringify({
3899
3918
  operationId: opts.operationId ?? randomUUID2(),
3900
3919
  ...parsed.updates ? { updates: parsed.updates } : {},
3920
+ ...parsed.completions ? { completions: parsed.completions } : {},
3901
3921
  ...questions ? { questions } : {},
3902
3922
  ...parsed.answers ? { answers: parsed.answers } : {},
3903
3923
  ...parsed.withdrawQuestionIds ? { withdrawQuestionIds: parsed.withdrawQuestionIds } : {},
@@ -4072,11 +4092,11 @@ function conversation(e) {
4072
4092
  });
4073
4093
  }
4074
4094
  function more(g) {
4075
- const earlier = g.earlier && g.earlier.omitted + g.earlier.shortened ? `${[g.earlier.omitted ? `${g.earlier.omitted} earlier entries left out` : "", g.earlier.shortened ? `${g.earlier.shortened} shortened to their headline` : ""].filter(Boolean).join(", ")}: get_goal({ goalId: "${g.goalId}", history: true }) reads every one in full.` : null;
4095
+ const earlier = g.earlier && g.earlier.omitted + g.earlier.shortened ? `${[g.earlier.omitted ? `${g.earlier.omitted} earlier entries left out` : "", g.earlier.shortened ? `${g.earlier.shortened} shortened to their headline` : ""].filter(Boolean).join(", ")}: get_goals({ goalIds: ["${g.goalId}"], history: true }) reads every one in full.` : null;
4076
4096
  return [
4077
4097
  earlier,
4078
- g.subtree?.length ? "A Goal below, in full: get_goal({ goalId }) with its goalId above." : null,
4079
- g.parentGoalId ? `The Goal above: get_goal({ goalId: "${g.parentGoalId}" }).` : null,
4098
+ g.subtree?.length ? "A Goal below, in full: get_goals({ goalIds: [goalId] }) with its goalId above." : null,
4099
+ g.parentGoalId ? `The Goal above: get_goals({ goalIds: ["${g.parentGoalId}"] }).` : null,
4080
4100
  "Anything else addressed to you (requests, answers, questions you owe): contact({ wait: false })."
4081
4101
  ].filter((line) => !!line);
4082
4102
  }
@@ -4119,11 +4139,11 @@ function goalView(g) {
4119
4139
  more: more(g)
4120
4140
  });
4121
4141
  }
4122
- 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.";
4142
+ 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_goals \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.";
4123
4143
  function failures(results) {
4124
4144
  const failed = (results ?? []).filter((r) => r.status === "failed");
4125
4145
  if (!failed.length) return void 0;
4126
- const plural = { update: "updates", question: "questions", answer: "answers", withdraw: "withdrawQuestionIds", dependency: "questionDependencies" };
4146
+ const plural = { update: "updates", completion: "completions", question: "questions", answer: "answers", withdraw: "withdrawQuestionIds", dependency: "questionDependencies" };
4127
4147
  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("; ") + ".";
4128
4148
  }
4129
4149
  var itemsView = (results) => (results ?? []).map((r) => compact({
@@ -4148,7 +4168,7 @@ function deliveryReadView(d) {
4148
4168
  });
4149
4169
  }
4150
4170
  function deliveryView(d) {
4151
- const answers = "Answers land on the Goal: collect them with contact({wait:true}) or get_goal. Do not resend it.";
4171
+ const answers = "Answers land on the Goal: collect them with contact({wait:true}) or get_goals. Do not resend it.";
4152
4172
  const pending = d.state === "open" && d.decisionNeeds.some((n) => n.state === "open");
4153
4173
  return compact({
4154
4174
  ok: d.ok,
@@ -4174,7 +4194,7 @@ function deliveryView(d) {
4174
4194
  acknowledged: d.acknowledged?.filter((a) => a.acknowledged).map((a) => a.eventId),
4175
4195
  next: [
4176
4196
  failures(d.results),
4177
- 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. While the Call is open, keep waiting window after window: a quiet window is the call still going, and the person may give you follow-ups or instructions on it. Once the Call has ended, stop waiting, leave any question open, and collect the answer with contact({wait:false}) or get_goal on your next wake. ${d.message ?? ""}`.trim() : d.message
4197
+ 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. While the Call is open, keep waiting window after window: a quiet window is the call still going, and the person may give you follow-ups or instructions on it. Once the Call has ended, stop waiting, leave any question open, and collect the answer with contact({wait:false}) or get_goals on your next wake. ${d.message ?? ""}`.trim() : d.message
4178
4198
  ].filter(Boolean).join(" ")
4179
4199
  });
4180
4200
  }
@@ -4233,12 +4253,12 @@ function receivedView(r, now = Date.now()) {
4233
4253
  ...r.waitOutcome === "expired" ? ["Nothing arrived in the window; receive again to keep waiting, without sending again."] : [],
4234
4254
  ...(w.calls ?? []).filter((c) => c.callState !== "ended").map((c) => `Read the whole ask with get_delivery({deliveryId: "${c.deliveryId}"}); follow its current calls[].callOutcome while receiving.`),
4235
4255
  ...rings.map((r2) => rerings(r2, now)),
4236
- ...assigned.length ? [`${assigned.length} of your Goals are assigned to you and not started (assigned): read one with get_goal({goalId}); your first write to it starts it.`] : [],
4237
- ...w.claimable && !assigned.length ? [`Next waiting on you: ${w.claimable.title ?? w.claimable.goalId} (get_goal({ goalId: "${w.claimable.goalId}" })).`] : [],
4256
+ ...assigned.length ? [`${assigned.length} of your Goals are assigned to you and not started (assigned): read one with get_goals({goalIds:[goalId]}); your first write to it starts it.`] : [],
4257
+ ...w.claimable && !assigned.length ? [`Next waiting on you: ${w.claimable.title ?? w.claimable.goalId} (get_goals({ goalIds: ["${w.claimable.goalId}"] })).`] : [],
4238
4258
  ...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.`] : [],
4239
4259
  // The COUNT, oldest three, and where to read them (owner, 2026-10-08): it was 34 rows of
4240
4260
  // other agents' work on every window, ahead of this agent's own next step.
4241
- ...others ? [`${others.count} of other agents' Goals have gone quiet${others.count === 1 ? " " : ""}${quietFor([{ since: others.oldestSince }], now, others.count)}: The oldest three are in others.goals: get_goal({goalId}) reads one in full. A write to it puts you on it without changing its owner.`] : [],
4261
+ ...others ? [`${others.count} of other agents' Goals have gone quiet${others.count === 1 ? " " : ""}${quietFor([{ since: others.oldestSince }], now, others.count)}: The oldest three are in others.goals: get_goals({goalIds:[goalId]}) reads one in full. A write to it puts you on it without changing its owner.`] : [],
4242
4262
  // No name of its own (#2525): the API's ask, verbatim.
4243
4263
  ...w.unnamed ? [w.unnamed] : []
4244
4264
  ].join(" ")
@@ -4265,9 +4285,9 @@ function managedView(m, changes) {
4265
4285
  const failed = results.filter((r) => r.status !== "applied");
4266
4286
  return compact({
4267
4287
  ok: m.ok,
4268
- results: results.map((r) => compact({ index: r.index, kind: changes[r.index]?.kind, status: r.status, goalId: r.goalId, error: r.error })),
4288
+ results: results.map((r) => compact({ index: r.index, kind: changes[r.index]?.kind, status: r.status, goalId: r.goalId, error: r.error, completion: r.contact })),
4269
4289
  goals: m.goals,
4270
- next: failed.length ? `${failed.length} of ${results.length} changes did not apply (see results[].error); the rest did. A goal_revision_conflict means the Goal changed since you read it: read it with get_goal and decide again.` : void 0
4290
+ next: failed.length ? `${failed.length} of ${results.length} changes did not apply (see results[].error); the rest did. A goal_revision_conflict means the Goal changed since you read it: read it with get_goals and decide again.` : void 0
4271
4291
  });
4272
4292
  }
4273
4293
  var lastRead = /* @__PURE__ */ new Map();
@@ -4312,12 +4332,12 @@ async function runTool(name, args, opts) {
4312
4332
  }
4313
4333
  case "get_delivery":
4314
4334
  return deliveryReadView(await readDelivery(GetDeliverySchema.parse(input).deliveryId, { ...client, signal }));
4315
- case "get_goal": {
4316
- const { goalId, history, diagnose } = GetGoalSchema.parse(input);
4317
- const goal = read2(client.token, await getGoal(goalId, client, { history, diagnose }));
4318
- const view = goalView(goal);
4319
- const diagnosis = goal.diagnosis;
4320
- return diagnosis === void 0 ? view : { ...view, diagnosis };
4335
+ case "get_goals": {
4336
+ const { goalIds, history } = GetGoalsSchema.parse(input);
4337
+ const rows = await getGoals(goalIds, client, { history });
4338
+ const goals = rows.map(goalView);
4339
+ for (const goal of rows) read2(client.token, goal);
4340
+ return { goals };
4321
4341
  }
4322
4342
  case "search":
4323
4343
  return searchRecords(SearchToolSchema.parse(input), client);
@@ -4587,7 +4607,7 @@ export {
4587
4607
  overrideToken,
4588
4608
  authToken,
4589
4609
  manageGoals,
4590
- getGoal,
4610
+ getGoals,
4591
4611
  AWAIT_WINDOW_MS,
4592
4612
  hatch,
4593
4613
  whoAmI,