@paigy/mcp 0.40.41 → 0.40.42
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.
- package/README.md +19 -1
- package/dist/{chunk-AX55W57P.js → chunk-6V4X3EFA.js} +1 -1
- package/dist/{chunk-UVVW32KH.js → chunk-I3WDI2JV.js} +3 -3
- package/dist/{chunk-NYSDESST.js → chunk-NNB3HQTF.js} +884 -746
- package/dist/{chunk-CPDYOHSY.js → chunk-W3FK4FD6.js} +799 -727
- package/dist/{dist-VYRT3PHE.js → dist-ZBYGV7QX.js} +5 -1
- package/dist/enable.js +6 -3
- package/dist/index.js +22 -5
- package/dist/listen.js +97 -28
- package/dist/onboard.js +4 -4
- package/dist/slot.js +1 -1
- package/dist/stalled.js +1 -1
- package/dist/statusline.js +1 -1
- package/package.json +1 -1
|
@@ -7,21 +7,22 @@ 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
|
|
10
|
+
import { z as z13 } from "zod";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import { z as z3 } from "zod";
|
|
13
13
|
import { z as z2 } from "zod";
|
|
14
|
-
import { z as
|
|
14
|
+
import { z as z6 } from "zod";
|
|
15
15
|
import { ZodFirstPartyTypeKind as ZodFirstPartyTypeKind3 } from "zod/v3";
|
|
16
16
|
import { ZodFirstPartyTypeKind } from "zod/v3";
|
|
17
17
|
import { ZodFirstPartyTypeKind as ZodFirstPartyTypeKind2 } from "zod/v3";
|
|
18
18
|
import { z as z4 } from "zod";
|
|
19
|
-
import { z as
|
|
19
|
+
import { z as z5 } 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
23
|
import { z as z10 } from "zod";
|
|
24
24
|
import { z as z11 } from "zod";
|
|
25
|
+
import { z as z12 } from "zod";
|
|
25
26
|
import { closeSync, existsSync, mkdirSync, openSync, readFileSync as readFileSync2, rmSync, statSync, writeFileSync } from "fs";
|
|
26
27
|
import { homedir as homedir2 } from "os";
|
|
27
28
|
import { join as join2 } from "path";
|
|
@@ -1643,7 +1644,7 @@ var ASKING_RULES = `HOW TO ASK:
|
|
|
1643
1644
|
6. Read the Goal before asking; never re-ask what was answered or shipped. \`replied\` means they chose no option: it is still yours to settle.
|
|
1644
1645
|
7. Give options when you have them. Each label names its choice in full (never "Option 2"); never add "Other". \`pickMode\`: one (default), many, rank.
|
|
1645
1646
|
8. A diagnosis says when, why and how it happens, then proposes one fix.
|
|
1646
|
-
9. Give a report its \`reply\`: one line in THEIR voice for THAT report, so you learn whether they verified it or only received it. Required when it
|
|
1647
|
+
9. Give a report its \`reply\`: one line in THEIR voice for THAT report, so you learn whether they verified it or only received it. Required when it is delivered or its Goal is done.`;
|
|
1647
1648
|
function draft2020(node) {
|
|
1648
1649
|
if (Array.isArray(node)) return node.map(draft2020);
|
|
1649
1650
|
if (node && typeof node === "object") {
|
|
@@ -1741,11 +1742,11 @@ var questionFields = {
|
|
|
1741
1742
|
),
|
|
1742
1743
|
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."),
|
|
1743
1744
|
units,
|
|
1744
|
-
options: z4.array(OptionInputSchema).min(1).max(6).optional().describe("The choices, when you have them. Each label stands on its own, at most 50 characters; a hint, at most 200. They can always answer in their own words, so no 'Other' or 'None of these'."),
|
|
1745
|
+
options: z4.array(OptionInputSchema).min(1).max(6).optional().describe("The choices, when you have them. Each label stands on its own and differs from the others (duplicate_option_label), at most 50 characters; a hint, at most 200. They can always answer in their own words, so no 'Other' or 'None of these'."),
|
|
1745
1746
|
// HOW THE OPTIONS ARE ANSWERED, SAID BY THE AGENT (owner, 2026-10-02: "one and many makes sense";
|
|
1746
1747
|
// brain_prompts.md §1: structured agent questions need no model). The app draws all three.
|
|
1747
1748
|
pickMode: z4.enum(["one", "many", "rank"]).optional().describe(
|
|
1748
|
-
'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.'
|
|
1749
|
+
'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; "many" and "rank" need at least two (too_few_options).'
|
|
1749
1750
|
),
|
|
1750
1751
|
// WHAT THE QUESTION HOLDS UP (brain_prompts.md §2.1): replaces `waiting: 'hard'`. A question that
|
|
1751
1752
|
// blocks work asks for a call (the person's settings and ring cooldowns still decide).
|
|
@@ -1757,11 +1758,39 @@ var questionFields = {
|
|
|
1757
1758
|
var refineQuestion = (q, ctx) => {
|
|
1758
1759
|
refuseOverCaps(q.question, q.units, "question", ctx);
|
|
1759
1760
|
if (q.pickMode && !q.options) ctx.addIssue({ code: z4.ZodIssueCode.custom, path: ["pickMode"], message: "pickMode comes only with options" });
|
|
1761
|
+
refuseThinOptions(q, ctx);
|
|
1760
1762
|
const ids = (q.options ?? []).map((o) => o.id);
|
|
1761
1763
|
if (ids.some((id2) => id2) && (ids.some((id2) => !id2) || new Set(ids).size !== ids.length)) {
|
|
1762
1764
|
ctx.addIssue({ code: z4.ZodIssueCode.custom, path: ["options"], message: "give every option a distinct id, or none" });
|
|
1763
1765
|
}
|
|
1764
1766
|
};
|
|
1767
|
+
var MIN_LIST_OPTIONS = 2;
|
|
1768
|
+
function refuseThinOptions(q, ctx) {
|
|
1769
|
+
const options = q.options ?? [];
|
|
1770
|
+
if ((q.pickMode === "many" || q.pickMode === "rank") && options.length < MIN_LIST_OPTIONS) {
|
|
1771
|
+
ctx.addIssue({
|
|
1772
|
+
code: z4.ZodIssueCode.custom,
|
|
1773
|
+
path: ["options"],
|
|
1774
|
+
params: { refusal: "too_few_options", length: options.length, min: MIN_LIST_OPTIONS },
|
|
1775
|
+
message: `too_few_options: pickMode "${q.pickMode}" needs at least ${MIN_LIST_OPTIONS} options; this question has ${options.length}. Add the other choices, or leave pickMode out.`
|
|
1776
|
+
});
|
|
1777
|
+
}
|
|
1778
|
+
const seen = /* @__PURE__ */ new Map();
|
|
1779
|
+
options.forEach((o, index) => {
|
|
1780
|
+
const key2 = o.label.trim().toLowerCase();
|
|
1781
|
+
const first = seen.get(key2);
|
|
1782
|
+
if (first === void 0) {
|
|
1783
|
+
seen.set(key2, index);
|
|
1784
|
+
return;
|
|
1785
|
+
}
|
|
1786
|
+
ctx.addIssue({
|
|
1787
|
+
code: z4.ZodIssueCode.custom,
|
|
1788
|
+
path: ["options", index, "label"],
|
|
1789
|
+
params: { refusal: "duplicate_option_label", index, first },
|
|
1790
|
+
message: `duplicate_option_label: options[${index}] repeats the label of options[${first}]. Each option names a different choice.`
|
|
1791
|
+
});
|
|
1792
|
+
});
|
|
1793
|
+
}
|
|
1765
1794
|
var QuestionInputSchema = z4.object({
|
|
1766
1795
|
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."),
|
|
1767
1796
|
...questionFields
|
|
@@ -1793,6 +1822,9 @@ var sendFields = {
|
|
|
1793
1822
|
withdrawQuestionIds: z4.array(questionHandle).min(1).max(10).optional().describe(
|
|
1794
1823
|
"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."
|
|
1795
1824
|
),
|
|
1825
|
+
bumpQuestionIds: z4.array(questionHandle).min(1).max(10).optional().describe(
|
|
1826
|
+
"Your own questions still waiting on the person that you want them to notice again. Each moves back to the top of its card with one new notification; nothing is resent and no second card is made."
|
|
1827
|
+
),
|
|
1796
1828
|
questionDependencies: z4.array(QuestionDependencySchema).min(1).max(20).optional().describe(
|
|
1797
1829
|
"Add or remove what a Question you asked holds up, after asking it."
|
|
1798
1830
|
)
|
|
@@ -1808,7 +1840,7 @@ var ContactSchema = z4.object({
|
|
|
1808
1840
|
"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`."
|
|
1809
1841
|
)
|
|
1810
1842
|
}).strict();
|
|
1811
|
-
var sendsAnything = (c) => !!(c.completions?.length || c.updates?.length || c.questions?.length || c.answers?.length || c.withdrawQuestionIds?.length || c.questionDependencies?.length);
|
|
1843
|
+
var sendsAnything = (c) => !!(c.completions?.length || c.updates?.length || c.questions?.length || c.answers?.length || c.withdrawQuestionIds?.length || c.bumpQuestionIds?.length || c.questionDependencies?.length);
|
|
1812
1844
|
var ContactWireSchema = z4.object({
|
|
1813
1845
|
operationId: z4.string().uuid(),
|
|
1814
1846
|
...sendFields,
|
|
@@ -1822,13 +1854,42 @@ LENGTH: the question, message or answer is the one point, at most ${ASK_MAX} cha
|
|
|
1822
1854
|
UPDATES ask nothing. One reaches the person only when they asked for it, it answers something they said, or its Goal is done; else it is kept as progress. One that reaches them joins an open report card or a live call.
|
|
1823
1855
|
|
|
1824
1856
|
RECEIVING: contact({}) waits ~45 s; contact({wait:false}) returns \`events\` at once. Confirm the ones you handled with contact({ackEventIds}).`;
|
|
1825
|
-
var
|
|
1826
|
-
|
|
1857
|
+
var GUIDE = '# Paigy\n\nThe user is remote. Reach them only through Paigy\'s tools, never the terminal. The server\'s own instructions and each tool\'s description are the contract: read them. Every read ends in `next`, the one step to take.\n\nThis same guide is inside the MCP: the `help` tool (whole, or one `topic`) and the `/mcp__paigy__help` prompt. `/mcp__paigy__welcome` starts a session.\n\nHosted (no machine): skip Pairing and Listening; answers wake you.\n\n## Pairing\n\n- Call `configure` first. With a device credential on this machine it hatches you at once.\n- Otherwise print its `user_message` to the user, then do what the result says:\n - `awaiting_approval`: call `configure` again with its `device_code` in the same turn. On `pending`, call again.\n - `awaiting_confirmation`: end your turn with the code as your whole reply; call `configure` with the `device_code` next turn. Calling it in the same turn drops the code.\n- When it returns `enable_command`, print it for the user to run. Do not run it yourself.\n- `configure({ logOut: true })` logs out only this agent, and only when the user asks.\n\n## Listening\n\n- Call `listen` once per session.\n - `listening`: done.\n - `receiving`: a listener runs but cannot wake you. Do not start a second.\n - `unpaired`: call `configure`.\n - `start`: run its `command` exactly, now.\n- Claude Code: run it with the **Monitor** tool, never a background Bash command. Start it again whenever the monitor expires.\n- Codex: run its `command` as a long-running background process. It queues each answer into this thread (`CODEX_THREAD_ID`).\n- With no `listen` tool, run `npx -y -p @paigy/mcp@latest paigy-listen --brief` the same way.\n- One listener per session. A `paigy-listen` in `ps` belongs to another session; ask `listen`, never `ps`.\n- Each line it prints is work: receive, read the Goal, act.\n\n## Receiving\n\n- On startup and after every wake or listener line: `contact({ wait: false })`.\n- Events: `question` (you owe an answer: send `answers`), `update` (something new on your Goal: an answer, a reply, a review), `instruction` (work sent to you).\n- Read the Goal with `get_goals` before acting. An answer arrives as an `update` event and lands on the question\'s Goal. A question reading `replied` means they chose no option: settle it from their words.\n- Acknowledge each event you handled: `contact({ ackEventIds })`. Reading acknowledges nothing; events repeat until acknowledged. A `question` event is answered, never acknowledged away.\n- `contact({ wait: true })` waits about 45 s. On `expired`, wait again without re-sending, or stop. No while-loops: while any Call is open, keep receiving through empty windows; otherwise stop at one empty window.\n\n## Asking\n\n- One question per object in `questions`, at most 80 characters. Context goes in `units`: at most 12, title \u226450, body \u2264200, one idea each.\n- `goalId` names an existing Goal. Create it with `manage_goals` first.\n- Give options when you have them: up to 6, label \u226450 naming the choice in full, `hint` \u2264200 saying what it does. Never "Other" or "Option 2". `pickMode`: `one` (default), `many`, `rank`.\n- `workItBlocks` only when you are truly stopped: it asks for a call.\n- Read the Goal before asking. Never re-ask an open or answered question, or one whose work shipped.\n- Take back a question that no longer matters: `withdrawQuestionIds`.\n- An answer you give (`answers`) is at most 80 characters.\n\n## Updates and completions\n\n- An update (`updates`: `message` \u226480, `goalIds`) asks nothing. It reaches the user only when they asked for it, when it answers something they said, or when its Goal is done; otherwise it stays on the Goal as progress.\n- Updates never complete a Goal.\n- `reply` is the button in the user\'s voice instead of "Got it", \u226450 characters ("Sounds good, I\'ll test later"). Required (`reply_required`) when the update is delivered on request (`userExplicitlyRequested`) or any Goal it names is already done.\n- Set `userExplicitlyRequested` only to relay the user\'s own words: `"any"` for "send it to me", `"call"` for "call me". Never to make a message louder.\n- Finish with a completion (`contact.completions`, or `manage_goals` kind `complete`): `goalId`, `message` \u226450, `reply` \u226450, optional `units`, optional next-step `options` {label, hint}. It closes and reports in one step. Say only what your evidence supports.\n- Read `results`: each item applies on its own, and a failed one names why.\n\n## Goals\n\n- `manage_goals` `changes`, applied in order:\n - `create`: `title` (1-5 words) and `outcome` (one paragraph, \u2264500). More work is child Goals: `parentGoalId`. New ids come back in `results[i].goalId`.\n - `assign`: `ownerId`, a participant as `check_activity` shows it.\n - `defer`: `until`. You are woken when it passes. This is how you follow up later.\n - `dependency`: `add`/`remove`; `goalId` waits on `dependsOnGoalId` to `start` or `complete`.\n - `edit`, `move`, `state` (open, completed, canceled).\n- Any open question on a Goal, anyone\'s, blocks its completion (`goal_blocked`). Before completing, withdraw yours, finish or move its required children, and clear its dependencies.\n- On `goal_revision_conflict`, read the Goal again and reconsider.\n- Before overlapping work, read `check_activity` and the Goal\'s other contributors. Every Goal of your person is open to you; your first write puts you on it.\n- `search` finds earlier words, Goals and answers. Nothing found is not proof of absence.\n\n## Calls\n\n- Call only when the user asked: `userExplicitlyRequested: "call"` on that item. A question with `workItBlocks` may ring too.\n- Any contact while the user is on a call joins that call (`joinedCall` in `results`). Several questions arrive as one call.\n- While any Call is open, keep receiving.\n- An open Call Delivery is not proof it rang. `get_delivery` reads a Call\'s state, and with `transcript: true` what was said.\n';
|
|
1858
|
+
var HELP_TOPICS = ["pairing", "listening", "receiving", "asking", "updates", "goals", "calls"];
|
|
1859
|
+
var unknownTopic = (topic) => `unknown_topic: ${JSON.stringify(topic)} is not a section of the guide. Topics: ${HELP_TOPICS.join(", ")}; or omit topic for the whole guide.`;
|
|
1860
|
+
var HelpSchema = z5.object({
|
|
1861
|
+
topic: z5.enum(HELP_TOPICS, { errorMap: (_issue, ctx) => ({ message: unknownTopic(ctx.data) }) }).optional().describe("One section of the guide. Omit it for the whole guide.")
|
|
1862
|
+
}).strict();
|
|
1863
|
+
var HELP_DESCRIPTION = "Start here: how to use Paigy, in full \u2014 pairing, listening, receiving, asking, updates and completions, Goals and calls. Pass a topic for one section. Read-only; needs no setup.";
|
|
1864
|
+
function section(topic) {
|
|
1865
|
+
const parts = GUIDE.split(/^(?=## )/m);
|
|
1866
|
+
const found = parts.find((p) => p.slice(3).toLowerCase().startsWith(topic));
|
|
1867
|
+
if (!found) throw new Error(`help_section_missing: the guide has no "## ${topic}" section`);
|
|
1868
|
+
return found.trim() + "\n";
|
|
1869
|
+
}
|
|
1870
|
+
function helpView({ topic }) {
|
|
1871
|
+
return {
|
|
1872
|
+
topic: topic ?? "all",
|
|
1873
|
+
guide: topic ? section(topic) : GUIDE,
|
|
1874
|
+
topics: [...HELP_TOPICS],
|
|
1875
|
+
next: "Not set up? Call configure. Then contact({wait:false}) for the work addressed to you."
|
|
1876
|
+
};
|
|
1877
|
+
}
|
|
1878
|
+
var AGENT_PROMPTS = [
|
|
1879
|
+
{
|
|
1880
|
+
name: "help",
|
|
1881
|
+
description: "How to use Paigy: the whole guide, or one topic of it.",
|
|
1882
|
+
arguments: [{ name: "topic", description: `One section: ${HELP_TOPICS.join(", ")}. Omit it for the whole guide.`, required: false }]
|
|
1883
|
+
},
|
|
1884
|
+
{ name: "welcome", description: "Start here: who you are on Paigy, then listen and collect your open work." }
|
|
1885
|
+
];
|
|
1886
|
+
var CreateGoalSchema = z6.object({
|
|
1887
|
+
outcome: z6.string().trim().min(1).max(1e4),
|
|
1827
1888
|
/** The work's NAME (#2115) — one to five words, how a person refers to it out loud ("the night
|
|
1828
1889
|
* rings"). Omit it and the brain writes one at admission from the outcome. */
|
|
1829
|
-
title:
|
|
1830
|
-
ownerParticipant:
|
|
1831
|
-
idempotencyKey:
|
|
1890
|
+
title: z6.string().trim().min(1).max(80).optional(),
|
|
1891
|
+
ownerParticipant: z6.string().trim().min(1).optional(),
|
|
1892
|
+
idempotencyKey: z6.string().trim().min(1).max(200),
|
|
1832
1893
|
/** THE GOAL THIS ONE BELONGS UNDER (owner, 2026-09-15: "the ask I gave for the design doc
|
|
1833
1894
|
* didn't get created as a child goal of the voice UI goal, which is how it should've
|
|
1834
1895
|
* worked"). It could not have been: this door took no parent, so the only route was
|
|
@@ -1836,63 +1897,63 @@ var CreateGoalSchema = z5.object({
|
|
|
1836
1897
|
* took the short one. The hierarchy has been modelled since Goals existed and had been used
|
|
1837
1898
|
* ZERO times in 2,031 of them. Absent, the server judges it against the caller's open Goals
|
|
1838
1899
|
* (`apps/api/src/goal/intake.ts`). The writer refuses a Goal belonging to another account. */
|
|
1839
|
-
parentGoalId:
|
|
1900
|
+
parentGoalId: z6.string().uuid().optional(),
|
|
1840
1901
|
/** The repository or project identifier this Goal belongs to (#2280) — e.g. "owner/repo" or
|
|
1841
1902
|
* repo name. Delegated work inherits this from its parent Goal when omitted. */
|
|
1842
|
-
repo:
|
|
1903
|
+
repo: z6.string().trim().min(1).max(200).optional()
|
|
1843
1904
|
});
|
|
1844
|
-
var UpdateGoalSchema =
|
|
1845
|
-
revision:
|
|
1846
|
-
changes:
|
|
1847
|
-
outcome:
|
|
1905
|
+
var UpdateGoalSchema = z6.object({
|
|
1906
|
+
revision: z6.number().int().positive(),
|
|
1907
|
+
changes: z6.object({
|
|
1908
|
+
outcome: z6.string().trim().min(1).max(1e4).optional(),
|
|
1848
1909
|
/** The work's NAME (#2115) — one to five words, how a person refers to it out loud. The
|
|
1849
1910
|
* brain writes one at admission; this is the owner saying it better. Null clears it. */
|
|
1850
|
-
title:
|
|
1851
|
-
ownerParticipant:
|
|
1852
|
-
parentGoalId:
|
|
1853
|
-
dependencies:
|
|
1854
|
-
children:
|
|
1855
|
-
state:
|
|
1856
|
-
progress:
|
|
1857
|
-
reviewed:
|
|
1858
|
-
dueAt:
|
|
1911
|
+
title: z6.string().trim().min(1).max(80).nullable().optional(),
|
|
1912
|
+
ownerParticipant: z6.string().trim().min(1).optional(),
|
|
1913
|
+
parentGoalId: z6.string().uuid().nullable().optional(),
|
|
1914
|
+
dependencies: z6.array(z6.object({ goalId: z6.string().uuid(), gate: z6.enum(["start", "finish"]) }).strict()).optional(),
|
|
1915
|
+
children: z6.array(z6.object({ outcome: z6.string().trim().min(1).max(1e4), ownerParticipant: z6.string().trim().min(1), gate: z6.enum(["start", "finish"]).optional() }).strict()).optional(),
|
|
1916
|
+
state: z6.enum(["active", "done", "cancelled"]).optional(),
|
|
1917
|
+
progress: z6.string().trim().min(1).max(1e4).optional(),
|
|
1918
|
+
reviewed: z6.literal(true).optional(),
|
|
1919
|
+
dueAt: z6.string().datetime({ offset: true }).nullable().optional()
|
|
1859
1920
|
}).strict().refine((v) => Object.keys(v).length > 0),
|
|
1860
|
-
reason:
|
|
1861
|
-
operationId:
|
|
1921
|
+
reason: z6.string().trim().min(1).max(2e3),
|
|
1922
|
+
operationId: z6.string().uuid().optional()
|
|
1862
1923
|
}).strict();
|
|
1863
|
-
var changedGoal =
|
|
1864
|
-
var goalTitle =
|
|
1924
|
+
var changedGoal = z6.string().uuid().describe("The Goal to change, as a read shows it.");
|
|
1925
|
+
var goalTitle = z6.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.");
|
|
1865
1926
|
var GOAL_OUTCOME_MAX = 500;
|
|
1866
|
-
var goalOutcome =
|
|
1867
|
-
var CreateChange =
|
|
1868
|
-
kind:
|
|
1927
|
+
var goalOutcome = z6.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.`);
|
|
1928
|
+
var CreateChange = z6.object({
|
|
1929
|
+
kind: z6.literal("create"),
|
|
1869
1930
|
title: goalTitle,
|
|
1870
1931
|
outcome: goalOutcome,
|
|
1871
|
-
ownerId:
|
|
1872
|
-
parentGoalId:
|
|
1873
|
-
sourceEntryIds:
|
|
1932
|
+
ownerId: z6.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."),
|
|
1933
|
+
parentGoalId: z6.string().uuid().optional().describe("The Goal it belongs under. Omitted: a root."),
|
|
1934
|
+
sourceEntryIds: z6.array(z6.string().uuid()).max(20).optional().describe("The whole Entries the work came from, ones you can read.")
|
|
1874
1935
|
}).strict();
|
|
1875
|
-
var EditChange =
|
|
1876
|
-
var StateChange =
|
|
1936
|
+
var EditChange = z6.object({ kind: z6.literal("edit"), goalId: changedGoal, title: goalTitle.optional(), outcome: goalOutcome.optional() }).strict();
|
|
1937
|
+
var StateChange = z6.object({ kind: z6.literal("state"), goalId: changedGoal, state: z6.enum(["open", "completed", "canceled"]).describe(
|
|
1877
1938
|
"completed: the Goal's own work is done now (refused while required children are open); open: reopen it; canceled: it will not be done."
|
|
1878
1939
|
) }).strict();
|
|
1879
|
-
var AssignChange =
|
|
1880
|
-
var DeferChange =
|
|
1940
|
+
var AssignChange = z6.object({ kind: z6.literal("assign"), goalId: changedGoal, ownerId: z6.string().trim().min(1).describe("The new owner's participant.") }).strict();
|
|
1941
|
+
var DeferChange = z6.object({ kind: z6.literal("defer"), goalId: changedGoal, until: z6.string().datetime({ offset: true }).nullable().describe(
|
|
1881
1942
|
"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."
|
|
1882
1943
|
) }).strict();
|
|
1883
|
-
var MoveChange =
|
|
1944
|
+
var MoveChange = z6.object({ kind: z6.literal("move"), goalId: changedGoal, parentGoalId: z6.string().uuid().nullable().describe(
|
|
1884
1945
|
"Its new parent, or null for a root. Only this Goal moves; its new parent's other children stay."
|
|
1885
1946
|
) }).strict();
|
|
1886
|
-
var DependencyChange =
|
|
1887
|
-
kind:
|
|
1888
|
-
change:
|
|
1947
|
+
var DependencyChange = z6.object({
|
|
1948
|
+
kind: z6.literal("dependency"),
|
|
1949
|
+
change: z6.enum(["add", "remove"]),
|
|
1889
1950
|
goalId: changedGoal,
|
|
1890
|
-
dependsOnGoalId:
|
|
1891
|
-
action:
|
|
1892
|
-
reason:
|
|
1951
|
+
dependsOnGoalId: z6.string().uuid().describe("The Goal it waits on."),
|
|
1952
|
+
action: z6.enum(["start", "complete"]).describe("What waits: starting goalId, or completing it."),
|
|
1953
|
+
reason: z6.string().trim().min(1).max(250).optional().describe("Why, at most 250 characters, as an explanation, never as policy.")
|
|
1893
1954
|
}).strict();
|
|
1894
|
-
var read = { revision:
|
|
1895
|
-
var GoalChangeSchema =
|
|
1955
|
+
var read = { revision: z6.number().int().positive().optional() };
|
|
1956
|
+
var GoalChangeSchema = z6.discriminatedUnion("kind", [
|
|
1896
1957
|
CreateChange,
|
|
1897
1958
|
CompleteChangeSchema.extend(read),
|
|
1898
1959
|
EditChange.extend(read),
|
|
@@ -1904,46 +1965,46 @@ var GoalChangeSchema = z5.discriminatedUnion("kind", [
|
|
|
1904
1965
|
]);
|
|
1905
1966
|
var editNames = (changes, ctx) => changes.forEach((c, i) => {
|
|
1906
1967
|
if (c.kind === "edit" && c.title === void 0 && c.outcome === void 0) {
|
|
1907
|
-
ctx.addIssue({ code:
|
|
1968
|
+
ctx.addIssue({ code: z6.ZodIssueCode.custom, path: ["changes", i], message: "an edit supplies title, outcome, or both" });
|
|
1908
1969
|
}
|
|
1909
1970
|
});
|
|
1910
|
-
var ManageGoalsSchema =
|
|
1911
|
-
requestId:
|
|
1912
|
-
changes:
|
|
1971
|
+
var ManageGoalsSchema = z6.object({
|
|
1972
|
+
requestId: z6.string().uuid().optional(),
|
|
1973
|
+
changes: z6.array(GoalChangeSchema).min(1).max(50)
|
|
1913
1974
|
}).strict().superRefine((v, ctx) => editNames(v.changes, ctx));
|
|
1914
|
-
var ManageGoalsToolSchema =
|
|
1915
|
-
changes:
|
|
1975
|
+
var ManageGoalsToolSchema = z6.object({
|
|
1976
|
+
changes: z6.array(z6.discriminatedUnion("kind", [CreateChange, CompleteChangeSchema, EditChange, StateChange, AssignChange, DeferChange, MoveChange, DependencyChange])).min(1).max(50).describe("The changes, applied in order, each on its own.")
|
|
1916
1977
|
}).strict().superRefine((v, ctx) => editNames(v.changes, ctx));
|
|
1917
1978
|
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.";
|
|
1918
|
-
var GetGoalsSchema =
|
|
1919
|
-
goalIds:
|
|
1979
|
+
var GetGoalsSchema = z6.object({
|
|
1980
|
+
goalIds: z6.array(z6.string().uuid()).min(1).max(10).describe("The Goals to read, in order; one to ten IDs."),
|
|
1920
1981
|
/** Every entry in full. Without it the read carries the person's words, open questions and your
|
|
1921
1982
|
* newest entry, and counts what it left out (`apps/api/src/goal/collapse.ts`). */
|
|
1922
|
-
history:
|
|
1983
|
+
history: z6.boolean().optional()
|
|
1923
1984
|
}).strict();
|
|
1924
|
-
var GetDeliverySchema =
|
|
1925
|
-
deliveryId:
|
|
1985
|
+
var GetDeliverySchema = z6.object({
|
|
1986
|
+
deliveryId: z6.string().uuid().describe("The Delivery id returned by contact or receive."),
|
|
1926
1987
|
// WHAT WAS SAID ON A CALL (owner, 2026-10-26, Goal c743f4a4: "A flag on get_delivery", "Any of my agents").
|
|
1927
|
-
transcript:
|
|
1928
|
-
after:
|
|
1988
|
+
transcript: z6.boolean().optional().describe("For a Call: also return what was said on it, one page of spoken lines."),
|
|
1989
|
+
after: z6.string().max(40).optional().describe("With transcript: the next value the previous page returned, to read the next page.")
|
|
1929
1990
|
}).strict();
|
|
1930
1991
|
var GET_DELIVERY_DESCRIPTION = "Read a Delivery in full: its whole ask, units, options and answers, plus current callState and callOutcome for a Call. For a Call, transcript: true adds what was said: each spoken line in order, who said it, and when from pickup, a page at a time. A line from the room, not the person, is marked room. 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.";
|
|
1931
1992
|
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.";
|
|
1932
|
-
var SearchToolSchema =
|
|
1933
|
-
query:
|
|
1934
|
-
types:
|
|
1935
|
-
goalId:
|
|
1936
|
-
limit:
|
|
1993
|
+
var SearchToolSchema = z6.object({
|
|
1994
|
+
query: z6.string().trim().min(1).max(500),
|
|
1995
|
+
types: z6.array(z6.enum(["entry", "goal", "answer"])).min(1).optional(),
|
|
1996
|
+
goalId: z6.string().uuid().optional(),
|
|
1997
|
+
limit: z6.number().int().min(1).max(20).optional()
|
|
1937
1998
|
}).strict();
|
|
1938
1999
|
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.";
|
|
1939
|
-
var ConfigureIdentitySchema =
|
|
2000
|
+
var ConfigureIdentitySchema = z6.object({}).strict();
|
|
1940
2001
|
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.";
|
|
1941
|
-
var CheckActivitySchema =
|
|
2002
|
+
var CheckActivitySchema = z6.object({}).strict();
|
|
1942
2003
|
var FEEDBACK_TEXT_MAX = 5e4;
|
|
1943
|
-
var SendFeedbackSchema =
|
|
1944
|
-
text:
|
|
1945
|
-
title:
|
|
1946
|
-
kind:
|
|
2004
|
+
var SendFeedbackSchema = z6.object({
|
|
2005
|
+
text: z6.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.`),
|
|
2006
|
+
title: z6.string().trim().min(1).max(200).optional().describe("One line naming it."),
|
|
2007
|
+
kind: z6.enum(["bug", "idea", "other"]).default("other").describe("bug: something Paigy does wrong. idea: something it should do. other: anything else.")
|
|
1947
2008
|
}).strict();
|
|
1948
2009
|
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.";
|
|
1949
2010
|
var AGENT_TOOLS = [
|
|
@@ -1954,166 +2015,168 @@ var AGENT_TOOLS = [
|
|
|
1954
2015
|
{ name: "get_goals", description: GET_GOALS_DESCRIPTION, inputSchema: mcpInputSchema(GetGoalsSchema) },
|
|
1955
2016
|
{ name: "search", description: SEARCH_DESCRIPTION, inputSchema: mcpInputSchema(SearchToolSchema) },
|
|
1956
2017
|
{ 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) },
|
|
1957
|
-
{ name: "send_feedback", description: SEND_FEEDBACK_DESCRIPTION, inputSchema: mcpInputSchema(SendFeedbackSchema) }
|
|
2018
|
+
{ name: "send_feedback", description: SEND_FEEDBACK_DESCRIPTION, inputSchema: mcpInputSchema(SendFeedbackSchema) },
|
|
2019
|
+
// THE GUIDE FROM INSIDE THE MCP (owner, 2026-10-27): the skill's text, needing no identity (`help.ts`).
|
|
2020
|
+
{ name: "help", description: HELP_DESCRIPTION, inputSchema: mcpInputSchema(HelpSchema) }
|
|
1958
2021
|
];
|
|
1959
2022
|
var AGENT_TOOL_NAMES = AGENT_TOOLS.map((t) => t.name);
|
|
1960
|
-
var id =
|
|
1961
|
-
var key =
|
|
1962
|
-
var participant =
|
|
1963
|
-
var SourceSchema =
|
|
1964
|
-
var ResultRefSchema =
|
|
1965
|
-
var NodeRefSchema =
|
|
1966
|
-
var DependencySchema =
|
|
2023
|
+
var id = z7.string().uuid();
|
|
2024
|
+
var key = z7.string().min(1).max(40);
|
|
2025
|
+
var participant = z7.string().regex(/^(human|agent):.+$/, "a participant ID such as agent:<uuid>");
|
|
2026
|
+
var SourceSchema = z7.object({ entryId: id }).strict();
|
|
2027
|
+
var ResultRefSchema = z7.union([z7.object({ id }).strict(), z7.object({ local: key }).strict()]);
|
|
2028
|
+
var NodeRefSchema = z7.object({ type: z7.enum(["goal", "question"]), id }).strict();
|
|
2029
|
+
var DependencySchema = z7.object({
|
|
1967
2030
|
blocker: NodeRefSchema,
|
|
1968
2031
|
blocked: NodeRefSchema,
|
|
1969
|
-
action:
|
|
1970
|
-
reason:
|
|
2032
|
+
action: z7.enum(["start", "complete", "answer"]),
|
|
2033
|
+
reason: z7.string().max(500).optional()
|
|
1971
2034
|
}).strict();
|
|
1972
|
-
var goalState =
|
|
2035
|
+
var goalState = z7.enum(["open", "completed", "canceled"]);
|
|
1973
2036
|
var existingGoalChanges = [
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
kind:
|
|
1981
|
-
change:
|
|
2037
|
+
z7.object({ kind: z7.literal("edit"), goalId: id, title: z7.string().min(1).max(120).optional(), outcome: z7.string().min(1).optional() }).strict().refine((c) => c.title !== void 0 || c.outcome !== void 0, "an edit changes the title or the outcome"),
|
|
2038
|
+
z7.object({ kind: z7.literal("state"), goalId: id, state: goalState }).strict(),
|
|
2039
|
+
z7.object({ kind: z7.literal("assign"), goalId: id, ownerId: participant }).strict(),
|
|
2040
|
+
z7.object({ kind: z7.literal("defer"), goalId: id, until: z7.string().datetime().nullable() }).strict(),
|
|
2041
|
+
z7.object({ kind: z7.literal("move"), goalId: id, parentGoalId: id.nullable() }).strict(),
|
|
2042
|
+
z7.object({
|
|
2043
|
+
kind: z7.literal("dependency"),
|
|
2044
|
+
change: z7.enum(["add", "remove"]),
|
|
1982
2045
|
goalId: id,
|
|
1983
2046
|
dependsOnGoalId: id,
|
|
1984
|
-
action:
|
|
1985
|
-
reason:
|
|
2047
|
+
action: z7.enum(["start", "complete"]),
|
|
2048
|
+
reason: z7.string().max(500).optional()
|
|
1986
2049
|
}).strict()
|
|
1987
2050
|
];
|
|
1988
|
-
var BrainGoalChangeSchema =
|
|
2051
|
+
var BrainGoalChangeSchema = z7.union([
|
|
1989
2052
|
// newSession: Paigy starts a session to own it (owner, 2026-10-06); until it has, the person owns it.
|
|
1990
|
-
|
|
1991
|
-
kind:
|
|
1992
|
-
outcome:
|
|
1993
|
-
title:
|
|
2053
|
+
z7.object({
|
|
2054
|
+
kind: z7.literal("create"),
|
|
2055
|
+
outcome: z7.string().min(1),
|
|
2056
|
+
title: z7.string().min(1).max(120),
|
|
1994
2057
|
ownerId: participant,
|
|
1995
2058
|
parentGoal: ResultRefSchema.nullable(),
|
|
1996
|
-
newSession:
|
|
2059
|
+
newSession: z7.literal(true).optional()
|
|
1997
2060
|
}).strict(),
|
|
1998
2061
|
...existingGoalChanges
|
|
1999
2062
|
]);
|
|
2000
|
-
var option =
|
|
2001
|
-
var QuestionChangeSchema =
|
|
2002
|
-
|
|
2003
|
-
kind:
|
|
2004
|
-
text:
|
|
2005
|
-
summary:
|
|
2063
|
+
var option = z7.object({ id: z7.string().min(1).max(40), label: z7.string().min(1), hint: z7.string().optional() }).strict();
|
|
2064
|
+
var QuestionChangeSchema = z7.union([
|
|
2065
|
+
z7.object({
|
|
2066
|
+
kind: z7.literal("create"),
|
|
2067
|
+
text: z7.string().min(1),
|
|
2068
|
+
summary: z7.string().optional(),
|
|
2006
2069
|
answererId: participant,
|
|
2007
2070
|
goal: ResultRefSchema.optional(),
|
|
2008
|
-
blocks:
|
|
2009
|
-
options:
|
|
2010
|
-
pickMode:
|
|
2071
|
+
blocks: z7.array(z7.object({ question: ResultRefSchema }).strict()),
|
|
2072
|
+
options: z7.array(option).min(2).optional(),
|
|
2073
|
+
pickMode: z7.enum(["one", "many", "rank"]).optional()
|
|
2011
2074
|
}).strict().refine((c) => c.options === void 0 === (c.pickMode === void 0), "options and pickMode come together"),
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2075
|
+
z7.object({ kind: z7.literal("edit"), questionId: id, text: z7.string().min(1) }).strict(),
|
|
2076
|
+
z7.object({ kind: z7.literal("assign"), questionId: id, answererId: participant }).strict(),
|
|
2077
|
+
z7.object({ kind: z7.literal("withdraw"), questionId: id }).strict(),
|
|
2078
|
+
z7.object({ kind: z7.literal("dependency"), change: z7.enum(["add", "remove"]), edge: DependencySchema }).strict()
|
|
2016
2079
|
]);
|
|
2017
|
-
var lessonScope =
|
|
2018
|
-
|
|
2019
|
-
|
|
2080
|
+
var lessonScope = z7.union([
|
|
2081
|
+
z7.object({ kind: z7.literal("user") }).strict(),
|
|
2082
|
+
z7.object({ kind: z7.literal("goal"), goal: ResultRefSchema }).strict()
|
|
2020
2083
|
]);
|
|
2021
|
-
var LessonChangeSchema =
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2084
|
+
var LessonChangeSchema = z7.union([
|
|
2085
|
+
z7.object({ kind: z7.literal("remember"), text: z7.string().min(1), scope: lessonScope }).strict(),
|
|
2086
|
+
z7.object({ kind: z7.literal("revise"), lessonId: id, text: z7.string().min(1), scope: lessonScope }).strict(),
|
|
2087
|
+
z7.object({ kind: z7.literal("withdraw"), lessonId: id }).strict()
|
|
2025
2088
|
]);
|
|
2026
|
-
var BrainNextSchema =
|
|
2027
|
-
instructions:
|
|
2028
|
-
say:
|
|
2029
|
-
then:
|
|
2030
|
-
waitFor:
|
|
2031
|
-
reason:
|
|
2089
|
+
var BrainNextSchema = z7.object({
|
|
2090
|
+
instructions: z7.array(z7.object({ entryKeys: z7.array(key).min(1) }).strict()),
|
|
2091
|
+
say: z7.array(key),
|
|
2092
|
+
then: z7.enum(["listen", "hold", "end", "none"]),
|
|
2093
|
+
waitFor: z7.array(ResultRefSchema),
|
|
2094
|
+
reason: z7.string()
|
|
2032
2095
|
}).strict();
|
|
2033
2096
|
var messageBase = {
|
|
2034
2097
|
key,
|
|
2035
|
-
text:
|
|
2036
|
-
goals:
|
|
2037
|
-
questions:
|
|
2038
|
-
entryKeys:
|
|
2039
|
-
obligationIds:
|
|
2098
|
+
text: z7.string().min(1),
|
|
2099
|
+
goals: z7.array(ResultRefSchema),
|
|
2100
|
+
questions: z7.array(ResultRefSchema),
|
|
2101
|
+
entryKeys: z7.array(key),
|
|
2102
|
+
obligationIds: z7.array(id)
|
|
2040
2103
|
};
|
|
2041
|
-
var BrainMessageSchema =
|
|
2104
|
+
var BrainMessageSchema = z7.union([
|
|
2042
2105
|
// A MESSAGE TO THE PERSON KEEPS ITS SENTENCES (turns.md): the talker writes them one by one, and each is
|
|
2043
2106
|
// its own unit of speech (`<cycle>:<key>:<n>`). `text` is the same words joined, for every reader of a
|
|
2044
2107
|
// message's words. Absent on results written before sentences.
|
|
2045
|
-
|
|
2108
|
+
z7.object({
|
|
2046
2109
|
...messageBase,
|
|
2047
|
-
to:
|
|
2048
|
-
sentences:
|
|
2110
|
+
to: z7.object({ kind: z7.literal("user") }).strict(),
|
|
2111
|
+
sentences: z7.array(z7.string().min(1)).min(1).optional(),
|
|
2049
2112
|
// THE REPORTS IT TELLS, BY THEIR OWN IDENTITY (call 9d1c096c, 2026-10-15): the talker's message names the report
|
|
2050
2113
|
// Entries it speaks of, so the plan's line names that report rather than re-finding it by its Goal. Absent on
|
|
2051
2114
|
// results written before it.
|
|
2052
|
-
tells:
|
|
2115
|
+
tells: z7.array(z7.object({ id }).strict()).optional()
|
|
2053
2116
|
}).strict(),
|
|
2054
|
-
|
|
2117
|
+
z7.object({
|
|
2055
2118
|
...messageBase,
|
|
2056
|
-
to:
|
|
2057
|
-
call:
|
|
2119
|
+
to: z7.object({ kind: z7.literal("agent"), agentId: z7.string().regex(/^agent:(?!paigy$)\S+$/) }).strict(),
|
|
2120
|
+
call: z7.object({ callId: id, listen: z7.literal(true) }).strict().optional(),
|
|
2058
2121
|
// WHAT IT ASKS THE AGENT, IN UNDER TEN WORDS (owner, 2026-10-15: "Yes, add the summary"): the talker's own, stored
|
|
2059
2122
|
// as the sent Entry's summary, which the recap's "Sent to <agent>: …" row shows. Absent on results written before it.
|
|
2060
|
-
summary:
|
|
2123
|
+
summary: z7.string().optional(),
|
|
2061
2124
|
// THE PERSON ASKED TO BE CALLED BACK ONCE THIS AGENT'S WORK IS DONE (turns.md, step 0): the agent owes
|
|
2062
2125
|
// the call, and its next contact about it rings them (`public.callbacks`).
|
|
2063
|
-
callback:
|
|
2126
|
+
callback: z7.literal(true).optional()
|
|
2064
2127
|
}).strict()
|
|
2065
2128
|
]);
|
|
2066
|
-
var BrainSearchSchema =
|
|
2067
|
-
query:
|
|
2068
|
-
within:
|
|
2129
|
+
var BrainSearchSchema = z7.object({
|
|
2130
|
+
query: z7.string().min(1).max(500),
|
|
2131
|
+
within: z7.array(z7.enum(["entries", "goals", "answers"])).min(1),
|
|
2069
2132
|
goalId: id.optional()
|
|
2070
2133
|
}).strict();
|
|
2071
|
-
var BrainResultSchema =
|
|
2072
|
-
messages:
|
|
2073
|
-
entries:
|
|
2074
|
-
questions:
|
|
2075
|
-
answers:
|
|
2134
|
+
var BrainResultSchema = z7.object({
|
|
2135
|
+
messages: z7.array(BrainMessageSchema),
|
|
2136
|
+
entries: z7.array(z7.object({ key, sources: z7.array(SourceSchema).min(1), goals: z7.array(ResultRefSchema), summary: z7.string().optional() }).strict()),
|
|
2137
|
+
questions: z7.array(z7.object({ key, entryKeys: z7.array(key), change: QuestionChangeSchema }).strict()),
|
|
2138
|
+
answers: z7.array(z7.object({
|
|
2076
2139
|
question: ResultRefSchema,
|
|
2077
|
-
entryKeys:
|
|
2078
|
-
summary:
|
|
2079
|
-
selectedOptionIds:
|
|
2140
|
+
entryKeys: z7.array(key).min(1),
|
|
2141
|
+
summary: z7.string(),
|
|
2142
|
+
selectedOptionIds: z7.array(z7.string().min(1)).optional()
|
|
2080
2143
|
}).strict()),
|
|
2081
|
-
goals:
|
|
2082
|
-
feedback:
|
|
2083
|
-
lessons:
|
|
2144
|
+
goals: z7.array(z7.object({ key, entryKeys: z7.array(key), change: BrainGoalChangeSchema }).strict()),
|
|
2145
|
+
feedback: z7.array(z7.object({ entryKeys: z7.array(key).min(1) }).strict()),
|
|
2146
|
+
lessons: z7.array(z7.object({ entryKeys: z7.array(key).min(1), change: LessonChangeSchema }).strict()),
|
|
2084
2147
|
next: BrainNextSchema,
|
|
2085
2148
|
search: BrainSearchSchema.optional()
|
|
2086
2149
|
}).strict();
|
|
2087
|
-
var str2 =
|
|
2088
|
-
var strs =
|
|
2089
|
-
var CompactResultSchema =
|
|
2090
|
-
next:
|
|
2091
|
-
messages:
|
|
2092
|
-
entries:
|
|
2093
|
-
answers:
|
|
2094
|
-
changes:
|
|
2150
|
+
var str2 = z7.string();
|
|
2151
|
+
var strs = z7.array(z7.string());
|
|
2152
|
+
var CompactResultSchema = z7.object({
|
|
2153
|
+
next: z7.object({ say: strs, then: z7.enum(["listen", "hold", "end", "none"]), waitFor: strs, reason: str2, instructions: strs }).strict(),
|
|
2154
|
+
messages: z7.array(z7.object({ key: str2, to: str2, text: str2, about: strs, entries: strs, owed: strs, inviteToCall: z7.boolean() }).strict()),
|
|
2155
|
+
entries: z7.array(z7.object({ key: str2, from: str2, on: strs }).strict()),
|
|
2156
|
+
answers: z7.array(z7.object({ question: str2, entries: strs, summary: str2, picked: strs }).strict()),
|
|
2157
|
+
changes: z7.array(z7.object({
|
|
2095
2158
|
key: str2,
|
|
2096
|
-
what:
|
|
2097
|
-
op:
|
|
2159
|
+
what: z7.enum(["goal", "question", "lesson"]),
|
|
2160
|
+
op: z7.enum(["create", "edit", "assign", "open", "complete", "cancel", "defer", "move", "block", "unblock", "withdraw", "remember", "revise"]),
|
|
2098
2161
|
id: str2,
|
|
2099
2162
|
text: str2,
|
|
2100
2163
|
title: str2,
|
|
2101
2164
|
who: str2,
|
|
2102
2165
|
under: str2,
|
|
2103
|
-
gate:
|
|
2104
|
-
options:
|
|
2105
|
-
pick:
|
|
2166
|
+
gate: z7.enum(["start", "complete", "answer", "none"]),
|
|
2167
|
+
options: z7.array(z7.object({ id: str2, label: str2 }).strict()),
|
|
2168
|
+
pick: z7.enum(["one", "many", "rank", "words"]),
|
|
2106
2169
|
entries: strs
|
|
2107
2170
|
}).strict()),
|
|
2108
|
-
feedback:
|
|
2109
|
-
search:
|
|
2171
|
+
feedback: z7.array(strs),
|
|
2172
|
+
search: z7.object({ query: str2, within: strs, goal: str2 }).strict()
|
|
2110
2173
|
}).strict();
|
|
2111
2174
|
var COMPACT_RESULT_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
|
|
2112
2175
|
zodToJsonSchema(CompactResultSchema, { $refStrategy: "none" })
|
|
2113
2176
|
);
|
|
2114
|
-
var str3 =
|
|
2115
|
-
var strs2 =
|
|
2116
|
-
var TalkerReplySchema =
|
|
2177
|
+
var str3 = z8.string();
|
|
2178
|
+
var strs2 = z8.array(z8.string());
|
|
2179
|
+
var TalkerReplySchema = z8.object({
|
|
2117
2180
|
/** What to say and send, messages to the person first: spoken in the order written. `to` is "user"
|
|
2118
2181
|
* or an agent's handle; `sentences` is what a message to the person says, one short sentence each
|
|
2119
2182
|
* ([] to an agent); `text` is what a message to an agent says ("" to the person); `summary` is what it
|
|
@@ -2122,36 +2185,36 @@ var TalkerReplySchema = z7.object({
|
|
|
2122
2185
|
* handles; `blocks` is the item a question to an agent must be answered before ("" for none);
|
|
2123
2186
|
* `callback` is true on a message to the agent doing work the person asked to be called back about
|
|
2124
2187
|
* once it is done (false otherwise): that agent then owes the call (turns.md, step 0). */
|
|
2125
|
-
messages:
|
|
2188
|
+
messages: z8.array(z8.object({ key: str3, to: str3, sentences: strs2, text: str3, summary: str3, about: strs2, blocks: str3, callback: z8.boolean() }).strict()),
|
|
2126
2189
|
/** What the call does next: listen, hold (the person asked for a moment) or end (they asked to). */
|
|
2127
|
-
then:
|
|
2190
|
+
then: z8.enum(["listen", "hold", "end"]),
|
|
2128
2191
|
/** The person's replies to items (replies, owner 2026-10-07): the item's handle, the chosen option
|
|
2129
2192
|
* IDs, the line handles, how they replied in under ten words (keeping any condition), and `defer`:
|
|
2130
2193
|
* "" when their words settle the item, else what a reply that puts it off waits for -- "call" (the
|
|
2131
2194
|
* end of this call), a question's handle (that question's answer) or an ISO time. */
|
|
2132
|
-
replies:
|
|
2195
|
+
replies: z8.array(z8.object({ item: str3, options: strs2, lines: strs2, summary: str3, defer: str3 }).strict()),
|
|
2133
2196
|
/** The line handles that tell the talker how to run this call; they last until it ends and reach no agent. */
|
|
2134
2197
|
instruction: strs2,
|
|
2135
2198
|
/** The line handles the filer acts on, and the only ones it reads (3e): new work, a change to existing
|
|
2136
2199
|
* work, feedback on Paigy, anything said to an agent, and any rule meant to outlast the call. */
|
|
2137
2200
|
file: strs2,
|
|
2138
2201
|
/** Evidence to fetch for a second round: a search, an item's full text, or an agent by name. */
|
|
2139
|
-
need:
|
|
2202
|
+
need: z8.object({ kind: z8.enum(["search", "item", "agent", ""]), text: str3 }).strict(),
|
|
2140
2203
|
/** The handle of the item to explain ("" for none). */
|
|
2141
2204
|
explain: str3
|
|
2142
2205
|
}).strict();
|
|
2143
2206
|
var TALKER_REPLY_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
|
|
2144
2207
|
zodToJsonSchema(TalkerReplySchema, { $refStrategy: "none" })
|
|
2145
2208
|
);
|
|
2146
|
-
var str4 =
|
|
2147
|
-
var strs3 =
|
|
2148
|
-
var FilerReplySchema =
|
|
2209
|
+
var str4 = z9.string();
|
|
2210
|
+
var strs3 = z9.array(z9.string());
|
|
2211
|
+
var FilerReplySchema = z9.object({
|
|
2149
2212
|
/** Which Goals each new line goes on: a line's handle, Goal handles (or keys of new Goals: a line that asks
|
|
2150
2213
|
* for new work goes on the Goal it creates, owner 2026-10-26), and what the line says in at most twenty
|
|
2151
2214
|
* words (owner, 2026-10-26: "bump it from 10 to 20 words"). */
|
|
2152
|
-
filed:
|
|
2153
|
-
goals:
|
|
2154
|
-
op:
|
|
2215
|
+
filed: z9.array(z9.object({ line: str4, goals: strs3, summary: str4 }).strict()),
|
|
2216
|
+
goals: z9.array(z9.object({
|
|
2217
|
+
op: z9.enum(["create", "edit", "complete", "cancel", "reopen", "assign", "defer", "move", "block", "unblock"]),
|
|
2155
2218
|
key: str4,
|
|
2156
2219
|
goal: str4,
|
|
2157
2220
|
title: str4,
|
|
@@ -2160,33 +2223,33 @@ var FilerReplySchema = z8.object({
|
|
|
2160
2223
|
under: str4,
|
|
2161
2224
|
until: str4,
|
|
2162
2225
|
on: str4,
|
|
2163
|
-
gate:
|
|
2226
|
+
gate: z9.enum(["start", "complete", "answer", ""]),
|
|
2164
2227
|
why: str4
|
|
2165
2228
|
}).strict()),
|
|
2166
|
-
questions:
|
|
2167
|
-
op:
|
|
2229
|
+
questions: z9.array(z9.object({
|
|
2230
|
+
op: z9.enum(["create", "edit", "assign", "withdraw"]),
|
|
2168
2231
|
key: str4,
|
|
2169
2232
|
question: str4,
|
|
2170
2233
|
text: str4,
|
|
2171
2234
|
summary: str4,
|
|
2172
2235
|
to: str4,
|
|
2173
2236
|
goal: str4,
|
|
2174
|
-
options:
|
|
2175
|
-
pick:
|
|
2237
|
+
options: z9.array(z9.object({ id: str4, label: str4 }).strict()),
|
|
2238
|
+
pick: z9.enum(["one", "many", "rank", "words", ""]),
|
|
2176
2239
|
blocks: str4
|
|
2177
2240
|
}).strict()),
|
|
2178
|
-
lessons:
|
|
2241
|
+
lessons: z9.array(z9.object({ op: z9.enum(["remember", "revise", "withdraw"]), lesson: str4, text: str4, scope: str4 }).strict()),
|
|
2179
2242
|
/** Line handles whose words comment on Paigy itself. */
|
|
2180
2243
|
feedback: strs3
|
|
2181
2244
|
}).strict();
|
|
2182
2245
|
var FILER_REPLY_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
|
|
2183
2246
|
zodToJsonSchema(FilerReplySchema, { $refStrategy: "none" })
|
|
2184
2247
|
);
|
|
2185
|
-
var ExplainerReplySchema =
|
|
2248
|
+
var ExplainerReplySchema = z10.object({
|
|
2186
2249
|
/** The explanation, as sentences, spoken in order. */
|
|
2187
|
-
say:
|
|
2250
|
+
say: z10.array(z10.string()),
|
|
2188
2251
|
/** Questions to an agent about gaps in what it read: the agent's handle and the question. */
|
|
2189
|
-
followUps:
|
|
2252
|
+
followUps: z10.array(z10.object({ to: z10.string(), text: z10.string() }).strict())
|
|
2190
2253
|
}).strict();
|
|
2191
2254
|
var EXPLAINER_REPLY_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
|
|
2192
2255
|
zodToJsonSchema(ExplainerReplySchema, { $refStrategy: "none" })
|
|
@@ -2209,49 +2272,49 @@ var DISTILLER_DEFECTS = [
|
|
|
2209
2272
|
"dropped"
|
|
2210
2273
|
// something it had to say never played and was never said later (owner, 2026-10-08, call 65433a9d)
|
|
2211
2274
|
];
|
|
2212
|
-
var DistillerReplySchema =
|
|
2213
|
-
defects:
|
|
2214
|
-
kind:
|
|
2275
|
+
var DistillerReplySchema = z11.object({
|
|
2276
|
+
defects: z11.array(z11.object({
|
|
2277
|
+
kind: z11.enum(DISTILLER_DEFECTS),
|
|
2215
2278
|
/** The handles of the lines it shows in. */
|
|
2216
|
-
lines:
|
|
2279
|
+
lines: z11.array(z11.string()),
|
|
2217
2280
|
/** The handle of the record it concerns, or "". */
|
|
2218
|
-
about:
|
|
2281
|
+
about: z11.string(),
|
|
2219
2282
|
/** One plain sentence, in words, never handles: it is what the feedback row keeps. */
|
|
2220
|
-
why:
|
|
2283
|
+
why: z11.string()
|
|
2221
2284
|
}).strict())
|
|
2222
2285
|
}).strict();
|
|
2223
2286
|
var DISTILLER_REPLY_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
|
|
2224
2287
|
zodToJsonSchema(DistillerReplySchema, { $refStrategy: "none" })
|
|
2225
2288
|
);
|
|
2226
2289
|
var TIDY_AUDIENCES = ["talker", "filer", "agents"];
|
|
2227
|
-
var TidyReplySchema =
|
|
2228
|
-
lessons:
|
|
2229
|
-
lesson:
|
|
2230
|
-
op:
|
|
2231
|
-
text:
|
|
2232
|
-
for:
|
|
2233
|
-
into:
|
|
2290
|
+
var TidyReplySchema = z11.object({
|
|
2291
|
+
lessons: z11.array(z11.object({
|
|
2292
|
+
lesson: z11.string(),
|
|
2293
|
+
op: z11.enum(["keep", "revise", "withdraw"]),
|
|
2294
|
+
text: z11.string(),
|
|
2295
|
+
for: z11.enum([...TIDY_AUDIENCES, ""]),
|
|
2296
|
+
into: z11.string()
|
|
2234
2297
|
}).strict())
|
|
2235
2298
|
}).strict();
|
|
2236
2299
|
var TIDY_REPLY_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
|
|
2237
2300
|
zodToJsonSchema(TidyReplySchema, { $refStrategy: "none" })
|
|
2238
2301
|
);
|
|
2239
|
-
var HandoutReplySchema =
|
|
2240
|
-
assign:
|
|
2302
|
+
var HandoutReplySchema = z12.object({
|
|
2303
|
+
assign: z12.array(z12.object({
|
|
2241
2304
|
/** The Goal's handle (G). */
|
|
2242
|
-
goal:
|
|
2305
|
+
goal: z12.string(),
|
|
2243
2306
|
/** The agent's handle (A). */
|
|
2244
|
-
to:
|
|
2307
|
+
to: z12.string(),
|
|
2245
2308
|
/** At most ten words, naming the Goal of theirs it is most like: the reason the hand-out records. */
|
|
2246
|
-
why:
|
|
2309
|
+
why: z12.string()
|
|
2247
2310
|
}).strict()),
|
|
2248
2311
|
/** The Goals no listed agent's work is even loosely like: Paigy starts a session for them (owner, 2026-10-24,
|
|
2249
2312
|
* Goal 37603006, "One per family of related Goals"). */
|
|
2250
|
-
new:
|
|
2313
|
+
new: z12.array(z12.object({
|
|
2251
2314
|
/** The Goal's handle (G). */
|
|
2252
|
-
goal:
|
|
2315
|
+
goal: z12.string(),
|
|
2253
2316
|
/** At most ten words: why nothing active fits it. */
|
|
2254
|
-
why:
|
|
2317
|
+
why: z12.string()
|
|
2255
2318
|
}).strict())
|
|
2256
2319
|
}).strict();
|
|
2257
2320
|
var HANDOUT_REPLY_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
|
|
@@ -2292,20 +2355,20 @@ var LIVE_MS = 3 * 6e4;
|
|
|
2292
2355
|
var WORKING_MS = 60 * 6e4;
|
|
2293
2356
|
var WORKING_TIER_MS = 2 * 60 * 6e4;
|
|
2294
2357
|
var RECENT_TIER_MS = 24 * 60 * 6e4;
|
|
2295
|
-
var ContextSchema =
|
|
2296
|
-
title:
|
|
2297
|
-
description:
|
|
2358
|
+
var ContextSchema = z13.object({
|
|
2359
|
+
title: z13.string().min(1).describe("One-line headline of what you need (required, non-empty)."),
|
|
2360
|
+
description: z13.array(z13.string().min(1)).describe(
|
|
2298
2361
|
"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."
|
|
2299
2362
|
),
|
|
2300
2363
|
/** THE ASK'S UNITS (3c): its context as titled units, in order. The app lists the titles and opens
|
|
2301
2364
|
* a body on a tap. Absent on an ask sent without units, which renders as before. */
|
|
2302
|
-
units:
|
|
2365
|
+
units: z13.array(z13.object({ title: z13.string(), body: z13.string() })).optional()
|
|
2303
2366
|
});
|
|
2304
|
-
var ParticipantSchema =
|
|
2305
|
-
kind:
|
|
2306
|
-
id:
|
|
2367
|
+
var ParticipantSchema = z13.object({
|
|
2368
|
+
kind: z13.enum(["human", "agent"]),
|
|
2369
|
+
id: z13.string()
|
|
2307
2370
|
});
|
|
2308
|
-
var TransformSchema =
|
|
2371
|
+
var TransformSchema = z13.enum([
|
|
2309
2372
|
"structure",
|
|
2310
2373
|
// shape intent into an answer contract; pick channel/urgency — broker `ask`, `select` shapes, `points`
|
|
2311
2374
|
"request_more",
|
|
@@ -2328,13 +2391,13 @@ var PAIGY_SELF = { kind: "agent", id: "paigy" };
|
|
|
2328
2391
|
function isPaigy(ref) {
|
|
2329
2392
|
return ref === participantRef(PAIGY_SELF);
|
|
2330
2393
|
}
|
|
2331
|
-
var VisualSchema =
|
|
2332
|
-
url:
|
|
2333
|
-
label:
|
|
2394
|
+
var VisualSchema = z13.object({
|
|
2395
|
+
url: z13.string().url(),
|
|
2396
|
+
label: z13.string().optional()
|
|
2334
2397
|
});
|
|
2335
|
-
var NotifyLevelSchema =
|
|
2336
|
-
var SelectShapeSchema =
|
|
2337
|
-
var ReceiptEventSchema =
|
|
2398
|
+
var NotifyLevelSchema = z13.enum(["inbox", "push", "banner", "call"]);
|
|
2399
|
+
var SelectShapeSchema = z13.enum(["one", "many", "rank", "confirm", "text"]);
|
|
2400
|
+
var ReceiptEventSchema = z13.enum([
|
|
2338
2401
|
"delivered",
|
|
2339
2402
|
// the bundle reached the recipient at some level
|
|
2340
2403
|
"seen",
|
|
@@ -2364,47 +2427,47 @@ var ReceiptEventSchema = z12.enum([
|
|
|
2364
2427
|
// be rewound by a writer that forgot to advance it.
|
|
2365
2428
|
"restarted"
|
|
2366
2429
|
]);
|
|
2367
|
-
var AttentionSchema =
|
|
2430
|
+
var AttentionSchema = z13.object({
|
|
2368
2431
|
urgency: NotifyLevelSchema,
|
|
2369
2432
|
/** The required answer shape, or null for a plain notify that asks nothing back. */
|
|
2370
2433
|
select: SelectShapeSchema.nullable(),
|
|
2371
2434
|
/** Coverage contract (#396) — points the answer must address; null = none declared. */
|
|
2372
|
-
points:
|
|
2435
|
+
points: z13.array(z13.string()).nullable(),
|
|
2373
2436
|
/** Whether the ask blocks the sender — what lets arbitration escalate it on silence. */
|
|
2374
|
-
blocking:
|
|
2437
|
+
blocking: z13.boolean(),
|
|
2375
2438
|
/** Reserved (docs/model/model.md lists it): a response deadline. No row column yet — a later Phase 2
|
|
2376
2439
|
* slice wires it; optional so today's rows/callers project cleanly. */
|
|
2377
|
-
deadline:
|
|
2440
|
+
deadline: z13.string().datetime().nullable().optional()
|
|
2378
2441
|
});
|
|
2379
|
-
var NotifyRequestFields =
|
|
2442
|
+
var NotifyRequestFields = z13.object({
|
|
2380
2443
|
/** Plaintext message content. Present on the plaintext path (today's shape);
|
|
2381
2444
|
* ABSENT on the E2EE path, where the sealed `envelope` below carries it. The
|
|
2382
2445
|
* superRefine at the bottom enforces exactly one of the two. */
|
|
2383
2446
|
context: ContextSchema.optional(),
|
|
2384
|
-
options:
|
|
2447
|
+
options: z13.array(OptionSchema.omit({ id: true }).extend({ label: z13.string().trim().min(1).max(1e3) }).strict()).min(OPTIONS_MIN).max(OPTIONS_MAX).optional().describe(
|
|
2385
2448
|
"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)."
|
|
2386
2449
|
),
|
|
2387
|
-
points:
|
|
2450
|
+
points: z13.array(z13.string().min(1)).optional().describe(
|
|
2388
2451
|
"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."
|
|
2389
2452
|
),
|
|
2390
|
-
visuals:
|
|
2453
|
+
visuals: z13.array(VisualSchema).optional().describe(
|
|
2391
2454
|
"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."
|
|
2392
2455
|
),
|
|
2393
2456
|
/** Git repo the agent is working in ("owner/name"). Local MCP fills this from the checkout — omit unless overriding. */
|
|
2394
|
-
repo:
|
|
2457
|
+
repo: z13.string().optional(),
|
|
2395
2458
|
/** Git branch the agent is on. Local MCP fills this from the checkout — omit unless overriding. */
|
|
2396
|
-
branch:
|
|
2459
|
+
branch: z13.string().optional(),
|
|
2397
2460
|
/** Continue an existing conversation — the id of any notification in it (its root
|
|
2398
2461
|
* is the conversation's identity). Omitted = start a new conversation. Renamed
|
|
2399
2462
|
* from `parentId` (2026-08-03): one linkage system, the parent; the API edge
|
|
2400
2463
|
* still accepts the old name from older clients. */
|
|
2401
|
-
parentId:
|
|
2464
|
+
parentId: z13.string().uuid().optional(),
|
|
2402
2465
|
/** The durable outcome this contact advances. Optional during the notification-to-Work
|
|
2403
2466
|
* migration; when present, a blocking ask creates a DecisionNeed for this Work. */
|
|
2404
|
-
workId:
|
|
2467
|
+
workId: z13.string().uuid().optional(),
|
|
2405
2468
|
/** Target Goal scope. During staged migration this is accepted by the shared contract but
|
|
2406
2469
|
* target delivery activation remains model-gated; workId and goalId are mutually exclusive. */
|
|
2407
|
-
goalId:
|
|
2470
|
+
goalId: z13.string().uuid().optional(),
|
|
2408
2471
|
urgency: NotifyLevelSchema.default("inbox").describe(
|
|
2409
2472
|
"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."
|
|
2410
2473
|
),
|
|
@@ -2412,7 +2475,7 @@ var NotifyRequestFields = z12.object({
|
|
|
2412
2475
|
* visible and marks it needs_input. Renamed from the old `parentId` (2026-08-03)
|
|
2413
2476
|
* when `parentId` became the conversation handle: `parentId` says WHERE, this
|
|
2414
2477
|
* says HOW. */
|
|
2415
|
-
clarifies:
|
|
2478
|
+
clarifies: z13.string().optional(),
|
|
2416
2479
|
select: SelectShapeSchema.optional().describe(
|
|
2417
2480
|
"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."
|
|
2418
2481
|
),
|
|
@@ -2426,20 +2489,20 @@ var NotifyRequestFields = z12.object({
|
|
|
2426
2489
|
// (docs/history/agenda-design.md) — not by a wire cap the agent has to pre-summarize under.
|
|
2427
2490
|
// Owner, 2026-07-28: "our actual limitation on how long something is to the user should
|
|
2428
2491
|
// come from the broker splitting and summarizing." The cap that remains is a size guard.
|
|
2429
|
-
ask:
|
|
2492
|
+
ask: z13.string().min(1).max(1e4).optional().describe(
|
|
2430
2493
|
'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.'
|
|
2431
2494
|
),
|
|
2432
|
-
needs:
|
|
2495
|
+
needs: z13.array(z13.string().min(1)).optional().describe(
|
|
2433
2496
|
"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."
|
|
2434
2497
|
),
|
|
2435
|
-
urgencyHint:
|
|
2498
|
+
urgencyHint: z13.enum(["whenever", "soon", "now"]).optional().describe(
|
|
2436
2499
|
"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."
|
|
2437
2500
|
),
|
|
2438
2501
|
/** #575: the ONE self-report that replaces urgencyHint + blocking — what happens
|
|
2439
2502
|
* to the agent's work while it waits. Normalized server-side into those two
|
|
2440
2503
|
* fields (normalizeWaiting) so everything downstream is untouched; explicit
|
|
2441
2504
|
* urgencyHint/blocking win when both are sent. */
|
|
2442
|
-
waiting:
|
|
2505
|
+
waiting: z13.enum(["none", "soft", "hard"]).optional().describe(
|
|
2443
2506
|
"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."
|
|
2444
2507
|
),
|
|
2445
2508
|
/** Δ9b (#895): HOLD this claim so the sender can correct the plan before anyone is
|
|
@@ -2447,98 +2510,98 @@ var NotifyRequestFields = z12.object({
|
|
|
2447
2510
|
* holding by default would charge every quiet claim that minute before any agent could
|
|
2448
2511
|
* correct anything. Ignored for `waiting: 'hard'`: a blocking ask rings on what we have,
|
|
2449
2512
|
* and the enrichment can still land mid-call (#781 re-plans the unspoken tail). */
|
|
2450
|
-
confirm:
|
|
2513
|
+
confirm: z13.boolean().optional().describe(
|
|
2451
2514
|
"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'."
|
|
2452
2515
|
),
|
|
2453
2516
|
/** #575: a RELAY of the user's explicitly stated preference, never the agent's
|
|
2454
2517
|
* choice. Outranks waiting in both directions: 'call' rings even for a
|
|
2455
2518
|
* waiting:'none' "call me when it's done"; 'message' never rings even for
|
|
2456
2519
|
* waiting:'hard'. */
|
|
2457
|
-
channel:
|
|
2520
|
+
channel: z13.enum(["call", "message"]).optional().describe(
|
|
2458
2521
|
"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."
|
|
2459
2522
|
),
|
|
2460
|
-
confirmStyle:
|
|
2523
|
+
confirmStyle: z13.enum(["yesno", "approve"]).default("yesno").describe(
|
|
2461
2524
|
"Labels for a select:'confirm' paige \u2014 'yesno' (Yes/No) or 'approve' (Approve/Deny). Ignored unless select is 'confirm'."
|
|
2462
2525
|
),
|
|
2463
|
-
blocking:
|
|
2526
|
+
blocking: z13.boolean().default(false).describe(
|
|
2464
2527
|
"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."
|
|
2465
2528
|
)
|
|
2466
2529
|
});
|
|
2467
2530
|
var NotifyRequestSchema = NotifyRequestFields.superRefine((r, ctx) => {
|
|
2468
|
-
if (r.workId && r.goalId) ctx.addIssue({ code:
|
|
2531
|
+
if (r.workId && r.goalId) ctx.addIssue({ code: z13.ZodIssueCode.custom, path: ["goalId"], message: "pass goalId or workId, not both" });
|
|
2469
2532
|
if (r.ask !== void 0) {
|
|
2470
2533
|
for (const f of ["context", "select", "points"]) {
|
|
2471
2534
|
if (r[f] !== void 0)
|
|
2472
|
-
ctx.addIssue({ code:
|
|
2535
|
+
ctx.addIssue({ code: z13.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.` });
|
|
2473
2536
|
}
|
|
2474
2537
|
return;
|
|
2475
2538
|
}
|
|
2476
2539
|
if (r.needs !== void 0 || r.urgencyHint !== void 0)
|
|
2477
|
-
ctx.addIssue({ code:
|
|
2540
|
+
ctx.addIssue({ code: z13.ZodIssueCode.custom, path: ["needs"], message: "needs/urgencyHint belong to the simplified `ask` form \u2014 with a shaped request use points/urgency" });
|
|
2478
2541
|
if (!r.context)
|
|
2479
|
-
ctx.addIssue({ code:
|
|
2542
|
+
ctx.addIssue({ code: z13.ZodIssueCode.custom, path: ["context"], message: "context is required (plaintext path)" });
|
|
2480
2543
|
if (!r.select)
|
|
2481
|
-
ctx.addIssue({ code:
|
|
2544
|
+
ctx.addIssue({ code: z13.ZodIssueCode.custom, path: ["select"], message: "select is required on the shaped form" });
|
|
2482
2545
|
const needsOptions = r.select === "one" || r.select === "many" || r.select === "rank";
|
|
2483
2546
|
if (needsOptions && !r.options?.length)
|
|
2484
|
-
ctx.addIssue({ code:
|
|
2547
|
+
ctx.addIssue({ code: z13.ZodIssueCode.custom, path: ["options"], message: `select:'${r.select}' requires options` });
|
|
2485
2548
|
if (!needsOptions && r.options?.length)
|
|
2486
|
-
ctx.addIssue({ code:
|
|
2549
|
+
ctx.addIssue({ code: z13.ZodIssueCode.custom, path: ["options"], message: `select:'${r.select}' takes no options` });
|
|
2487
2550
|
});
|
|
2488
|
-
var NotifyStatusSchema =
|
|
2489
|
-
var AgentStateSchema =
|
|
2490
|
-
var TurnSchema =
|
|
2491
|
-
prompt:
|
|
2492
|
-
reply:
|
|
2551
|
+
var NotifyStatusSchema = z13.enum(["pending", "answered", "ignored"]);
|
|
2552
|
+
var AgentStateSchema = z13.enum(["idle", "in_progress", "completed", "needs_input"]);
|
|
2553
|
+
var TurnSchema = z13.object({
|
|
2554
|
+
prompt: z13.string(),
|
|
2555
|
+
reply: z13.string()
|
|
2493
2556
|
});
|
|
2494
|
-
var UserAnswerSchema =
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2557
|
+
var UserAnswerSchema = z13.discriminatedUnion("kind", [
|
|
2558
|
+
z13.object({ kind: z13.literal("option"), optionId: z13.string(), label: z13.string().optional() }),
|
|
2559
|
+
z13.object({ kind: z13.literal("text"), text: z13.string() }),
|
|
2560
|
+
z13.object({ kind: z13.literal("ignored") }),
|
|
2561
|
+
z13.object({ kind: z13.literal("multi"), optionIds: z13.array(z13.string()), labels: z13.array(z13.string()).optional() }),
|
|
2562
|
+
z13.object({ kind: z13.literal("ranked"), optionIds: z13.array(z13.string()), labels: z13.array(z13.string()).optional() }),
|
|
2563
|
+
z13.object({ kind: z13.literal("clarify"), chunks: z13.array(z13.string()).min(1) }),
|
|
2564
|
+
z13.object({ kind: z13.literal("confirm"), approved: z13.boolean() }),
|
|
2565
|
+
z13.object({ kind: z13.literal("turns"), turns: z13.array(TurnSchema).min(1) }),
|
|
2503
2566
|
/** An auto-answer derived from the user's PAST decisions (docs/history/precedent-design.md §2):
|
|
2504
2567
|
* delivered through the same settle/await path as a human answer, carrying the judge's
|
|
2505
2568
|
* derivation and the precedent ids it grew from. Always paired with a visible trail
|
|
2506
2569
|
* card the user can reply to — the broker never overrides the user. */
|
|
2507
|
-
|
|
2570
|
+
z13.object({ kind: z13.literal("precedent"), answer: z13.string(), derivation: z13.string(), sources: z13.array(z13.string()).min(1) })
|
|
2508
2571
|
]);
|
|
2509
|
-
var IntentSchema =
|
|
2572
|
+
var IntentSchema = z13.object({
|
|
2510
2573
|
// The full vocabulary the bot's mapper emits (mapper.INTENT_KINDS) — the schema lagged
|
|
2511
2574
|
// it by two ("detail", "feedback"), and because the settle handler parsed the array
|
|
2512
2575
|
// all-or-nothing, ONE feedback act silently dropped EVERY intent on the call,
|
|
2513
2576
|
// questions included. Found auditing five calls' stored feedback, 2026-08-01.
|
|
2514
|
-
kind:
|
|
2515
|
-
detail:
|
|
2577
|
+
kind: z13.enum(["defer", "delegate", "channel", "question", "detail", "feedback", "command", "control"]),
|
|
2578
|
+
detail: z13.string(),
|
|
2516
2579
|
/** Defer only: seconds until the callback the caller asked for, when something upstream
|
|
2517
2580
|
* already read the time. Nothing sets it today (#397 documented an MCP parser that was
|
|
2518
2581
|
* never written) — the API reads the defer's `detail` itself with `notes/when.ts`
|
|
2519
2582
|
* (`parseDelay`, #1292), and a value here simply wins over that reading. */
|
|
2520
|
-
dueInSeconds:
|
|
2583
|
+
dueInSeconds: z13.number().int().positive().optional(),
|
|
2521
2584
|
/** Feedback only (#812): WHICH failure the complaint names — typed by the mapper that
|
|
2522
2585
|
* already read the utterance, so `signals.kind` stops defaulting to
|
|
2523
2586
|
* 'other' on every row. A table that records that something was wrong and nothing
|
|
2524
2587
|
* about what cannot answer "is the bot looping less this week?". */
|
|
2525
|
-
fault:
|
|
2588
|
+
fault: z13.enum(["loop", "unanswered", "overridden", "misheard", "slow", "other"]).optional()
|
|
2526
2589
|
});
|
|
2527
|
-
var RideAlongSchema =
|
|
2590
|
+
var RideAlongSchema = z13.object({
|
|
2528
2591
|
/** The note this came from — assign/clarify/close it through /api/notes/:id. */
|
|
2529
|
-
noteId:
|
|
2592
|
+
noteId: z13.string(),
|
|
2530
2593
|
/** What to do, in the owner's own words (the note's headline). Never model-rewritten. */
|
|
2531
|
-
text:
|
|
2594
|
+
text: z13.string(),
|
|
2532
2595
|
/** The thread to report back on, when the note was dispatched over the request rail. */
|
|
2533
|
-
parentId:
|
|
2596
|
+
parentId: z13.string().nullable()
|
|
2534
2597
|
});
|
|
2535
|
-
var AwaitItemSchema =
|
|
2536
|
-
|
|
2537
|
-
type:
|
|
2538
|
-
parentId:
|
|
2539
|
-
notificationId:
|
|
2540
|
-
workId:
|
|
2541
|
-
decisionId:
|
|
2598
|
+
var AwaitItemSchema = z13.discriminatedUnion("type", [
|
|
2599
|
+
z13.object({
|
|
2600
|
+
type: z13.literal("reply"),
|
|
2601
|
+
parentId: z13.string(),
|
|
2602
|
+
notificationId: z13.string(),
|
|
2603
|
+
workId: z13.string().uuid().optional(),
|
|
2604
|
+
decisionId: z13.string().uuid().optional(),
|
|
2542
2605
|
answer: UserAnswerSchema,
|
|
2543
2606
|
/** WHAT THE AGENT CANNOT KNOW FROM THE FIELDS BESIDE IT (owner, 2026-09-04, issue
|
|
2544
2607
|
* #1537). One line, built from the record: the ask and the caller's reply VERBATIM,
|
|
@@ -2548,109 +2611,109 @@ var AwaitItemSchema = z12.discriminatedUnion("type", [
|
|
|
2548
2611
|
* "call me back after you merge" in their own words decides for itself what to do,
|
|
2549
2612
|
* and now knows exactly which call to make. Absent when either half is missing —
|
|
2550
2613
|
* a sentence with a hole in it is worse than no sentence. */
|
|
2551
|
-
note:
|
|
2614
|
+
note: z13.string().optional(),
|
|
2552
2615
|
/** The call record rendered for THIS agent (`docs/brain/voice/record-design.md`): the words the
|
|
2553
2616
|
* shaped answer was mapped from, filtered to its own claims. There is no second list
|
|
2554
2617
|
* of labels beside it — the acts went 2026-09-04 and `intents` went with them (owner,
|
|
2555
2618
|
* 2026-09-04): the agent reads the sentence and decides. */
|
|
2556
|
-
transcript:
|
|
2619
|
+
transcript: z13.string().optional(),
|
|
2557
2620
|
/** Coverage report (#396), when the ask declared `points`: which of them this
|
|
2558
2621
|
* answer addressed. Missing points = re-ask or proceed knowingly partial. */
|
|
2559
|
-
covered:
|
|
2622
|
+
covered: z13.array(z13.string()).optional(),
|
|
2560
2623
|
/** Ride-alongs (RideAlongSchema) — pending work for you, attached to the moment you
|
|
2561
2624
|
* became free. Only `reply` and `idle` carry it: those are the two outcomes that
|
|
2562
2625
|
* END a wait. `remind`, `superseded` and `turn` are mid-flight, and handing an
|
|
2563
2626
|
* agent a side-quest while it is still holding the line is how the main thing gets
|
|
2564
2627
|
* dropped. Absent/empty = nothing owed. */
|
|
2565
|
-
also:
|
|
2628
|
+
also: z13.array(RideAlongSchema).optional()
|
|
2566
2629
|
}),
|
|
2567
|
-
|
|
2568
|
-
type:
|
|
2569
|
-
parentId:
|
|
2570
|
-
notificationId:
|
|
2571
|
-
remindAt:
|
|
2630
|
+
z13.object({
|
|
2631
|
+
type: z13.literal("remind"),
|
|
2632
|
+
parentId: z13.string(),
|
|
2633
|
+
notificationId: z13.string(),
|
|
2634
|
+
remindAt: z13.string().datetime({ offset: true }),
|
|
2572
2635
|
/** Seconds until remindAt, server-computed — pass straight to ScheduleWakeup. */
|
|
2573
|
-
remindInSeconds:
|
|
2636
|
+
remindInSeconds: z13.number()
|
|
2574
2637
|
}),
|
|
2575
2638
|
/** The awaited ask was REPLACED by a newer notification on its thread (e.g. a
|
|
2576
2639
|
* post-feedback revision, #633) — the user will never answer this id. Stop
|
|
2577
2640
|
* awaiting it; the live ask is the thread's newest turn (await that one, or
|
|
2578
2641
|
* re-orient via contact({})). */
|
|
2579
|
-
|
|
2580
|
-
type:
|
|
2581
|
-
parentId:
|
|
2582
|
-
notificationId:
|
|
2642
|
+
z13.object({
|
|
2643
|
+
type: z13.literal("superseded"),
|
|
2644
|
+
parentId: z13.string(),
|
|
2645
|
+
notificationId: z13.string()
|
|
2583
2646
|
}),
|
|
2584
2647
|
/** A LIVE call's turn, streamed as it lands (#783). PROVISIONAL: the user can still
|
|
2585
2648
|
* revise any of these until the final reply arrives — partial = intelligence,
|
|
2586
2649
|
* settled = authorization. Use it to PREPARE (fetch, draft, warm), never to act
|
|
2587
2650
|
* irreversibly. If `acts` carries a question aimed at you and you know the answer,
|
|
2588
2651
|
* contact on the same thread right away — the caller hears it on the same call. */
|
|
2589
|
-
|
|
2590
|
-
type:
|
|
2591
|
-
notificationId:
|
|
2592
|
-
inFlight:
|
|
2593
|
-
turn:
|
|
2594
|
-
idx:
|
|
2595
|
-
prompt:
|
|
2596
|
-
reply:
|
|
2597
|
-
acts:
|
|
2652
|
+
z13.object({
|
|
2653
|
+
type: z13.literal("partial"),
|
|
2654
|
+
notificationId: z13.string(),
|
|
2655
|
+
inFlight: z13.literal(true),
|
|
2656
|
+
turn: z13.object({
|
|
2657
|
+
idx: z13.number(),
|
|
2658
|
+
prompt: z13.string(),
|
|
2659
|
+
reply: z13.string(),
|
|
2660
|
+
acts: z13.array(IntentSchema).nullable().optional()
|
|
2598
2661
|
})
|
|
2599
2662
|
}),
|
|
2600
|
-
|
|
2601
|
-
type:
|
|
2602
|
-
also:
|
|
2663
|
+
z13.object({
|
|
2664
|
+
type: z13.literal("idle"),
|
|
2665
|
+
also: z13.array(RideAlongSchema).optional(),
|
|
2603
2666
|
/** Is a call live for this agent's user right now? The SDK polls the partial stream
|
|
2604
2667
|
* (#783) between idle ticks ONLY while this is not `false` — a partial can only exist
|
|
2605
2668
|
* during a live call, and polling for one on a banner/message was a wasted HTTP call +
|
|
2606
2669
|
* 3 queries on every idle tick of every waiting agent (~80% of all traffic at scale).
|
|
2607
2670
|
* Absent = an older API → the SDK keeps polling, exactly as before. */
|
|
2608
|
-
inFlight:
|
|
2671
|
+
inFlight: z13.boolean().optional()
|
|
2609
2672
|
})
|
|
2610
2673
|
]);
|
|
2611
|
-
var VoiceKeySchema =
|
|
2612
|
-
var AgendaTurnSchema =
|
|
2674
|
+
var VoiceKeySchema = z13.enum(["rachel", "george", "jessica", "brian", "lily"]);
|
|
2675
|
+
var AgendaTurnSchema = z13.object({
|
|
2613
2676
|
/** THE TURN'S IDENTITY (the first-sentence stream, 2026-09-09): the brain call that wrote
|
|
2614
2677
|
* it and its place in that reply — `<brainCallId>:<index>`, with `:p` on the first
|
|
2615
2678
|
* sentence a re-plan publishes ahead of the rest. A turn is spoken once, by this id: the
|
|
2616
2679
|
* completion of a streamed re-plan carries the published sentence again, and the walk
|
|
2617
2680
|
* drops what it already said by identity, never by the API's guess of what was polled.
|
|
2618
2681
|
* Absent on plans nothing streams (a ring plan, a floor). */
|
|
2619
|
-
id:
|
|
2682
|
+
id: z13.string().optional(),
|
|
2620
2683
|
/** Twin coverage (#1089): sibling claim ids this asking turn's answer ALSO settles —
|
|
2621
2684
|
* the planner declares duplicates instead of asking them twice. */
|
|
2622
|
-
coveredIds:
|
|
2685
|
+
coveredIds: z13.array(z13.string()).optional(),
|
|
2623
2686
|
/** The spoken sentences of the turn, in order. No count: how long a turn is is the brain's call
|
|
2624
2687
|
* (owner, 2026-09-25), and a count here refused whole plans. */
|
|
2625
|
-
info:
|
|
2688
|
+
info: z13.array(z13.string().min(1)).default([]),
|
|
2626
2689
|
/** THE ID OF EACH SENTENCE, when the plan names them (turns.md): a talker message's sentences are its
|
|
2627
2690
|
* `info`, one piece each, and `units[i]` is the id the bot's line receipt carries for `info[i]`
|
|
2628
2691
|
* (`<cycle>:<key>:<n>`), so what was heard is known per sentence. Absent on every other turn. */
|
|
2629
|
-
units:
|
|
2630
|
-
question:
|
|
2692
|
+
units: z13.array(z13.string().min(1)).optional(),
|
|
2693
|
+
question: z13.string().min(1).nullable(),
|
|
2631
2694
|
/** True on the one turn carrying the agent's own declared question. */
|
|
2632
|
-
asks:
|
|
2695
|
+
asks: z13.boolean().optional(),
|
|
2633
2696
|
/** The claim this turn belongs to (#781) — the RETURN identity: answers route by it.
|
|
2634
2697
|
* Absent on a single-claim plan (the session's own claim) and on shared context turns,
|
|
2635
2698
|
* which route nothing. */
|
|
2636
|
-
claimId:
|
|
2699
|
+
claimId: z13.string().optional(),
|
|
2637
2700
|
/** The claim's voice key (#462) — the OUTBOUND identity, audible who-is-asking. */
|
|
2638
|
-
voice:
|
|
2701
|
+
voice: z13.string().optional(),
|
|
2639
2702
|
/** The claim's AGENT NAME (#838) — the spoken identity. A voice alone doesn't say
|
|
2640
2703
|
* whose request this is: an item that folded in from another agent arrived as a bare
|
|
2641
2704
|
* non-sequitur ("First real production sign-in is yours to make whenever you want.")
|
|
2642
2705
|
* and the owner answered "What?". The bot names the agent before its first turn. */
|
|
2643
|
-
agent:
|
|
2706
|
+
agent: z13.string().optional(),
|
|
2644
2707
|
/** The claim's agent by ID — the pairing's connection id (`notifications.token_id`), the
|
|
2645
2708
|
* same id a face is minted from. A name is not an identity: two pairings may be called
|
|
2646
2709
|
* "Claude", and a name cannot be joined on. The record's entries carry it (`agent_id`)
|
|
2647
2710
|
* so "who said that" survives the call, and it rides PER TURN because a coalesced call
|
|
2648
2711
|
* speaks for several agents — the turn is the only place that knows which. */
|
|
2649
|
-
agentId:
|
|
2712
|
+
agentId: z13.string().optional(),
|
|
2650
2713
|
/** ITS QUESTION IS ON THE TABLE (#3292): a talker line about a question the person owes. The walk tells
|
|
2651
2714
|
* the phone (`asking`, so the agenda goes gold and its options show) without treating the line as a
|
|
2652
2715
|
* question turn — the talker owns re-asking and the waits, so `question` stays null. */
|
|
2653
|
-
onTable:
|
|
2716
|
+
onTable: z13.boolean().optional(),
|
|
2654
2717
|
/** THE CARRIED ITEM THIS LINE TELLS (Goal 2a1e50eb, owner 2026-10-14: "Build the whole design") — a
|
|
2655
2718
|
* request the Call carries that asks NOTHING: a report, a progress note, another agent's waiting news.
|
|
2656
2719
|
* Its request Entry id, so the phone can make that agenda row the current one while it is read
|
|
@@ -2660,14 +2723,14 @@ var AgendaTurnSchema = z12.object({
|
|
|
2660
2723
|
* record tags the line with it (`workId`) — and an answer must never route to an Entry that asks
|
|
2661
2724
|
* nothing. Absent on a turn speaking for a question (`claimId` says that) and on one speaking for no
|
|
2662
2725
|
* carried item at all (an opener, a sign-off, Paigy's own line). */
|
|
2663
|
-
telling:
|
|
2726
|
+
telling: z13.string().optional(),
|
|
2664
2727
|
/** PAIGY'S OWN LINE (owner, 2026-10-15; calls ed2cbdce, ad50ad25): a turn that speaks for no item -- an
|
|
2665
2728
|
* opener, a sign-off, a reply about nothing an agent asked or told -- is recorded as Paigy's, not as the
|
|
2666
2729
|
* agent that rang. Absent on every turn that speaks for an item (`agentId` names whose), and on plans
|
|
2667
2730
|
* from before it: a bot that does not know it records the ringing agent, as before. */
|
|
2668
|
-
speaksFor:
|
|
2731
|
+
speaksFor: z13.literal("paigy").optional(),
|
|
2669
2732
|
select: SelectShapeSchema.optional(),
|
|
2670
|
-
options:
|
|
2733
|
+
options: z13.array(OptionSchema.omit({ id: true })).optional(),
|
|
2671
2734
|
/* `pace` STOOD HERE (#826). A turn could carry seconds and the model chose them. The walk
|
|
2672
2735
|
paces itself now — a short beat between the sentences of a turn, the longer one at its end
|
|
2673
2736
|
(owner, 2026-09-30: "remove the bot deciding pace") — and it does that where the words are
|
|
@@ -2676,58 +2739,58 @@ var AgendaTurnSchema = z12.object({
|
|
|
2676
2739
|
/** Whether the walk WAITS for an answer before moving on. Absent = derived as today
|
|
2677
2740
|
* (a question blocks, context flows). blocking:false on a question = ask and move
|
|
2678
2741
|
* on, the claim stays pending; blocking:true on context = hold for a reply. */
|
|
2679
|
-
blocking:
|
|
2742
|
+
blocking: z13.boolean().optional(),
|
|
2680
2743
|
/** SPOKEN ONLY IF THEY SAY NOTHING (owner, 2026-10-01, call 812de935: "you're gonna re-ask, but it
|
|
2681
2744
|
* shouldn't be the same words … more like, hey, are you still there, or are you able to answer, or
|
|
2682
2745
|
* would you need more information"). The walk holds this turn out of its queue; at the queue's end it
|
|
2683
2746
|
* listens for the last word, and only if that listen is silent is this turn said and asked. If they
|
|
2684
2747
|
* speak, it is dropped and their words are taken like any reply. */
|
|
2685
|
-
ifSilent:
|
|
2748
|
+
ifSilent: z13.boolean().optional()
|
|
2686
2749
|
});
|
|
2687
2750
|
var CLAIM_STALE_MS = 30 * 6e4;
|
|
2688
|
-
var CallQuestionSchema =
|
|
2689
|
-
id:
|
|
2690
|
-
entryId:
|
|
2691
|
-
title:
|
|
2692
|
-
state:
|
|
2693
|
-
answer:
|
|
2751
|
+
var CallQuestionSchema = z13.object({
|
|
2752
|
+
id: z13.string(),
|
|
2753
|
+
entryId: z13.string(),
|
|
2754
|
+
title: z13.string(),
|
|
2755
|
+
state: z13.enum(["open", "answered"]),
|
|
2756
|
+
answer: z13.string().nullable(),
|
|
2694
2757
|
/** WHO ASKED IT (owner, 2026-09-23, Goal a345e906: each agenda row wears its agent's face) — the
|
|
2695
2758
|
* request Entry's author, as the same three facts the item's own `tokenId`/`name`/`voice`
|
|
2696
2759
|
* carry for the call's one agent, so the phone draws it with the same seed. Absent when the
|
|
2697
2760
|
* author is not an agent this account holds (unpaired since, or a person). */
|
|
2698
|
-
agent:
|
|
2761
|
+
agent: z13.object({ tokenId: z13.string(), name: z13.string(), voice: VoiceKeySchema.optional() }).optional(),
|
|
2699
2762
|
/** ITS OPTIONS, WHEN THERE IS SOMETHING TO SEE (owner, 2026-09-25: "Yes, add it"): the options
|
|
2700
2763
|
* its need offers, exactly as its own card carries them, present only when one of them has a
|
|
2701
2764
|
* preview (`html` or `image`). The call screen opens them from the agenda row, so a preview is
|
|
2702
2765
|
* never re-sent as a second card to be seen mid-call. Words-only options are `choices`. */
|
|
2703
|
-
options:
|
|
2766
|
+
options: z13.array(OptionSchema).optional(),
|
|
2704
2767
|
/** ITS OPTIONS WHEN THEY ARE WORDS (owner, 2026-10-02, on a call: "whenever there are pre-made
|
|
2705
2768
|
* options … now for a checklist, we should also show them on the screen"; design C, 2026-10-08):
|
|
2706
2769
|
* numbered chips above the call's controls, so a checklist is never only something read aloud. A
|
|
2707
2770
|
* field of its own so `options` keeps meaning "previews": a phone on an older bundle opens the
|
|
2708
2771
|
* preview layout for any `options`, and must see exactly what it did. */
|
|
2709
|
-
choices:
|
|
2772
|
+
choices: z13.array(OptionSchema).optional(),
|
|
2710
2773
|
/** HOW MANY MAY BE PICKED, beside its `choices`: one, any (`many`) or an order (`rank`). */
|
|
2711
|
-
select:
|
|
2774
|
+
select: z13.enum(["one", "many", "rank"]).optional()
|
|
2712
2775
|
});
|
|
2713
|
-
var InboxItemSchema =
|
|
2714
|
-
id:
|
|
2715
|
-
tokenId:
|
|
2776
|
+
var InboxItemSchema = z13.object({
|
|
2777
|
+
id: z13.string(),
|
|
2778
|
+
tokenId: z13.string().optional(),
|
|
2716
2779
|
status: NotifyStatusSchema,
|
|
2717
2780
|
context: ContextSchema,
|
|
2718
|
-
options:
|
|
2781
|
+
options: z13.array(OptionSchema).optional(),
|
|
2719
2782
|
/** The ask's declared coverage points (#396), when the agent sent them. */
|
|
2720
|
-
points:
|
|
2783
|
+
points: z13.array(z13.string()).optional(),
|
|
2721
2784
|
/** Does this claim want an ANSWER, or is it telling you something? Written per row from
|
|
2722
2785
|
* `requestAsks` — the agent's own declaration, not a guess. `false` is what earns a card
|
|
2723
2786
|
* its acknowledge affordance: without it a status update offers a text box and a dismiss,
|
|
2724
2787
|
* and neither of those is "got it" (owner, 2026-08-10). */
|
|
2725
|
-
asks:
|
|
2788
|
+
asks: z13.boolean().optional(),
|
|
2726
2789
|
/** When a live process last pulsed for this row's agent — the liveness input for
|
|
2727
2790
|
* "working requires a pulse" (#928): the list said "Working…" from agent_state alone
|
|
2728
2791
|
* while the party called the same dead claim stalled. Absent = no token/no data,
|
|
2729
2792
|
* which must never CLAIM stalled. */
|
|
2730
|
-
lastSeenAt:
|
|
2793
|
+
lastSeenAt: z13.string().optional(),
|
|
2731
2794
|
/** WHEN THE AGENT LAST SAID ANYTHING ABOUT THIS CLAIM — the newest `agent_state` row in
|
|
2732
2795
|
* the `notification_events` ledger (trigger-written since 20260621010000, so every row a
|
|
2733
2796
|
* user can see has one). The age input for `CLAIM_STALE_MS`, and it has to be this rather
|
|
@@ -2737,7 +2800,7 @@ var InboxItemSchema = z12.object({
|
|
|
2737
2800
|
* work. Reading the row's birth as the claim's age brands that "No update in 8h" the
|
|
2738
2801
|
* instant the agent picks it up (#997). Absent = pre-trigger row; fall back to
|
|
2739
2802
|
* `createdAt`. */
|
|
2740
|
-
agentStateAt:
|
|
2803
|
+
agentStateAt: z13.string().datetime().optional(),
|
|
2741
2804
|
/** THE QUESTIONS A CALL CARRIES — the call screen's agenda spine (docs/clients/app/walk/design.md §11, owner
|
|
2742
2805
|
* 2026-09-22). One per DecisionNeed on the Call, in the Call's order, answered or open (a
|
|
2743
2806
|
* superseded or cancelled need is no longer a question anyone is asked). Present only on a
|
|
@@ -2751,40 +2814,35 @@ var InboxItemSchema = z12.object({
|
|
|
2751
2814
|
* `turn` topic (`asking`, `settled`), because the bot never sees a DecisionNeed id. `title` is
|
|
2752
2815
|
* the card's own concise heading; `answer` the accepted answer in words, null while open. It
|
|
2753
2816
|
* REPLACED `agenda` (turns), which nothing ever filled. */
|
|
2754
|
-
questions:
|
|
2817
|
+
questions: z13.array(CallQuestionSchema).optional(),
|
|
2755
2818
|
/** The same call carrying order, including request Entries with no DecisionNeed as reports.
|
|
2756
2819
|
* Additive: questions stays decision-only for every other surface and older bundles. */
|
|
2757
|
-
callItems:
|
|
2758
|
-
visuals:
|
|
2820
|
+
callItems: z13.array(CallQuestionSchema.extend({ state: z13.enum(["open", "answered", "report"]), acknowledged: z13.boolean().optional() })).optional(),
|
|
2821
|
+
visuals: z13.array(VisualSchema).optional(),
|
|
2759
2822
|
/** The connected agent's name (the single pairing name — user-typed, or the
|
|
2760
2823
|
* agent's suggestion, or a default silly name). */
|
|
2761
|
-
name:
|
|
2824
|
+
name: z13.string(),
|
|
2762
2825
|
/** The pairing's assigned voice (#462); absent = the default voice. */
|
|
2763
2826
|
voice: VoiceKeySchema.optional(),
|
|
2764
|
-
repo:
|
|
2765
|
-
branch:
|
|
2766
|
-
createdAt:
|
|
2767
|
-
snoozedUntil:
|
|
2827
|
+
repo: z13.string().optional(),
|
|
2828
|
+
branch: z13.string().optional(),
|
|
2829
|
+
createdAt: z13.string().datetime(),
|
|
2830
|
+
snoozedUntil: z13.string().datetime().optional(),
|
|
2768
2831
|
agentState: AgentStateSchema.default("idle"),
|
|
2769
2832
|
/** Whose action the item is waiting on: "you" = an agent asked you (the default,
|
|
2770
2833
|
* every agent→user notification); "agent" = you sent a request and it's awaiting the
|
|
2771
2834
|
* agent (held in the inbox until the agent replies on the thread). */
|
|
2772
|
-
turn:
|
|
2835
|
+
turn: z13.enum(["you", "agent"]).default("you"),
|
|
2773
2836
|
/** Hard error reason on an awaiting request (turn="agent") — the wake failed to reach
|
|
2774
2837
|
* the agent (provider-agnostic; set server-side). Absent = no hard error. Drives the inbox
|
|
2775
2838
|
* error badge + Retry. */
|
|
2776
|
-
error:
|
|
2777
|
-
|
|
2778
|
-
* with nothing said), or absent while it is not stalled. The inbox's stalled badge reads
|
|
2779
|
-
* this and nothing else (2026-09-23: a 3-minute age rule badged every live Goal stalled,
|
|
2780
|
-
* and "dismiss the stalled ones" cancelled 37 pieces of live work). */
|
|
2781
|
-
cold: z12.string().datetime().optional(),
|
|
2782
|
-
clarifies: z12.string().optional(),
|
|
2839
|
+
error: z13.string().optional(),
|
|
2840
|
+
clarifies: z13.string().optional(),
|
|
2783
2841
|
/** THIS CARD'S QUESTION IS ON A LIVE CALL (owner, 2026-09-24: "Mark it while the call is
|
|
2784
2842
|
* live"). Present only while an open Call Delivery carries the card's request Entry — read
|
|
2785
2843
|
* off the same open list the card came from, so it clears when the Call does. A card is the
|
|
2786
2844
|
* backup for a call not taken; while the call has it, the call is where it is answered. */
|
|
2787
|
-
onCall:
|
|
2845
|
+
onCall: z13.literal(true).optional(),
|
|
2788
2846
|
/** THE RING, ON THE ITEM (docs/clients/app/walk/design.md §12 §17, #2251): the last ring on this card was
|
|
2789
2847
|
* declined, and what the ladder will do next — read off the cron's own row, never computed
|
|
2790
2848
|
* on the phone. Present only while a `declined` receipt stands on the card's last Call.
|
|
@@ -2794,31 +2852,31 @@ var InboxItemSchema = z12.object({
|
|
|
2794
2852
|
* It replaced `gaveUp` (deleted 2026-09-22): "the ladder spent" was a boolean the projection
|
|
2795
2853
|
* never set, and it is `nextRingAt === null` here — the party's *Missed you* (`party/dress.ts`)
|
|
2796
2854
|
* and the roster's `unreached` read `declinedAt`, and stand while it does. */
|
|
2797
|
-
ring:
|
|
2798
|
-
declinedAt:
|
|
2799
|
-
anchorAt:
|
|
2800
|
-
nextRingAt:
|
|
2801
|
-
step:
|
|
2855
|
+
ring: z13.object({
|
|
2856
|
+
declinedAt: z13.string().datetime(),
|
|
2857
|
+
anchorAt: z13.string().datetime(),
|
|
2858
|
+
nextRingAt: z13.string().datetime().nullable(),
|
|
2859
|
+
step: z13.number().int()
|
|
2802
2860
|
}).optional(),
|
|
2803
2861
|
/** Why this arrived the way it did, read back off the delivery receipt (`notify/why.ts`).
|
|
2804
2862
|
* Absent for anything never delivered through a push, and for older rows written before
|
|
2805
2863
|
* the reason was recorded. Deliberately a debug affordance, shown small (owner,
|
|
2806
2864
|
* 2026-08-07) — its real job is to give "this didn't need a call" something to be
|
|
2807
2865
|
* feedback ABOUT. */
|
|
2808
|
-
why:
|
|
2866
|
+
why: z13.object({
|
|
2809
2867
|
asked: NotifyLevelSchema,
|
|
2810
2868
|
got: NotifyLevelSchema,
|
|
2811
|
-
because:
|
|
2812
|
-
line:
|
|
2869
|
+
because: z13.enum(["unresponsive", "dismissed", "not_permitted", "silent", "coalesced", "agent_capped", "unplanned", "learned_raise"]).optional(),
|
|
2870
|
+
line: z13.string()
|
|
2813
2871
|
}).optional(),
|
|
2814
|
-
select:
|
|
2815
|
-
confirmStyle:
|
|
2872
|
+
select: z13.enum(["one", "many", "rank", "confirm", "text"]).default("one"),
|
|
2873
|
+
confirmStyle: z13.enum(["yesno", "approve"]).default("yesno").describe(
|
|
2816
2874
|
"Labels for a select:'confirm' paige \u2014 'yesno' (Yes/No) or 'approve' (Approve/Deny). Ignored unless select is 'confirm'."
|
|
2817
2875
|
),
|
|
2818
2876
|
/** Real downstream work is stuck behind this one — set by the agent, independent of
|
|
2819
2877
|
* urgency (see the main README's "premier use case" + docs/history/notify-states.md). Drives the
|
|
2820
2878
|
* inbox's blocking badge and the extra confirm step before dismissing it. */
|
|
2821
|
-
blocking:
|
|
2879
|
+
blocking: z13.boolean().default(false),
|
|
2822
2880
|
/** WHAT FREED THIS QUESTION (owner, 2026-10-16, Goal 2383ef14: "we don't really show the question
|
|
2823
2881
|
* at the top until the question it could reply to with is resolved. And then we show it again
|
|
2824
2882
|
* with the context of the other thing that was resolved"; asked how it should carry that, "The
|
|
@@ -2826,20 +2884,25 @@ var InboxItemSchema = z12.object({
|
|
|
2826
2884
|
* (`private.ask_back`) and drops out of the front while it waits; when it comes back, the card
|
|
2827
2885
|
* draws their question and the answer it got ABOVE the ask, as one card. Absent on a question
|
|
2828
2886
|
* nothing ever held back. */
|
|
2829
|
-
freedBy:
|
|
2830
|
-
questionId:
|
|
2831
|
-
asked:
|
|
2832
|
-
answer:
|
|
2833
|
-
answeredAt:
|
|
2887
|
+
freedBy: z13.object({
|
|
2888
|
+
questionId: z13.string(),
|
|
2889
|
+
asked: z13.string(),
|
|
2890
|
+
answer: z13.string(),
|
|
2891
|
+
answeredAt: z13.string(),
|
|
2834
2892
|
/** The answer in ten words, when the talker wrote one beside it. */
|
|
2835
|
-
summary:
|
|
2893
|
+
summary: z13.string().optional()
|
|
2836
2894
|
}).optional(),
|
|
2837
2895
|
/** WHAT THIS CARD ANSWERS (owner, 2026-10-27, Goal 81b6a9d6: "this reads very clearly as an answer to
|
|
2838
2896
|
* something I asked, but I don't see the question… To show the question near the top of the card").
|
|
2839
2897
|
* An agent's card that is its answer to one of the person's own questions carries that question's
|
|
2840
2898
|
* words, drawn above it as "You asked" (`public.questions_answered_by`, read beside the card read).
|
|
2841
2899
|
* Absent on every card that answers nothing of theirs, and on a held question, which has `freedBy`. */
|
|
2842
|
-
answering:
|
|
2900
|
+
answering: z13.object({ asked: z13.string() }).optional(),
|
|
2901
|
+
/** WHEN ITS AGENT LAST BUMPED THIS QUESTION (#2855, `contact`'s `bumpQuestionIds`): the agent asked
|
|
2902
|
+
* the person to notice it again, and For you puts it first, the latest bump on top
|
|
2903
|
+
* (`question/order.ts`). Absent on a question never bumped, and on every card from an API older
|
|
2904
|
+
* than the bump. */
|
|
2905
|
+
bumpedAt: z13.string().optional(),
|
|
2843
2906
|
/** The user's locked-in answer; present only for replied items (GET /api/replied/:id). */
|
|
2844
2907
|
answer: UserAnswerSchema.optional(),
|
|
2845
2908
|
/** THE TARGET FACTS A CARD RENDERS (#1796 point 5, 2026-09-11): the Delivery it is a view of,
|
|
@@ -2847,17 +2910,17 @@ var InboxItemSchema = z12.object({
|
|
|
2847
2910
|
* for a request that asks nothing), whether its content is sealed, and that Goal's state. The
|
|
2848
2911
|
* answer writer (`POST /api/entries`) and the disposition (`close_delivery`) take their ids from
|
|
2849
2912
|
* here. The server projects it (`apps/api/src/inbox/project.ts`); a client never builds it. */
|
|
2850
|
-
communication:
|
|
2851
|
-
deliveryId:
|
|
2852
|
-
kind:
|
|
2853
|
-
entryId:
|
|
2854
|
-
goalIds:
|
|
2855
|
-
decisionNeedId:
|
|
2856
|
-
sealed:
|
|
2857
|
-
goalState:
|
|
2913
|
+
communication: z13.object({
|
|
2914
|
+
deliveryId: z13.string(),
|
|
2915
|
+
kind: z13.enum(["notification", "call"]),
|
|
2916
|
+
entryId: z13.string(),
|
|
2917
|
+
goalIds: z13.array(z13.string()),
|
|
2918
|
+
decisionNeedId: z13.string().optional(),
|
|
2919
|
+
sealed: z13.boolean(),
|
|
2920
|
+
goalState: z13.string().optional(),
|
|
2858
2921
|
/** THAT GOAL'S NAME (#2416) — what Activity's row is headed by, since a row there is one Goal
|
|
2859
2922
|
* and the cards it holds sit behind it. Stamped by the same read as `goalState`. */
|
|
2860
|
-
goalTitle:
|
|
2923
|
+
goalTitle: z13.string().optional()
|
|
2861
2924
|
}).optional(),
|
|
2862
2925
|
/** WHAT THIS CARD IS, IN TWELVE CHARACTERS (#3019) — the hash of every other field on it, stamped
|
|
2863
2926
|
* by the one read that serves the open list (`apps/api/src/inbox/project.ts` `inboxFor`). It is
|
|
@@ -2866,30 +2929,30 @@ var InboxItemSchema = z12.object({
|
|
|
2866
2929
|
*
|
|
2867
2930
|
* THE PAYLOAD'S OWN HASH, NEVER A STAMP ON THE WORK — the same mechanism as `QueueItem.rev`
|
|
2868
2931
|
* (#2928) and an entry's (#3018), for the same reason: a card shows facts no `updated_at` of its
|
|
2869
|
-
* own moves (its Goal's state and name,
|
|
2932
|
+
* own moves (its Goal's state and name, whether a ring is
|
|
2870
2933
|
* live). Optional, so a fixture, the demo and the archive lens need not spell one, and a card
|
|
2871
2934
|
* with no rev is simply always re-sent. */
|
|
2872
|
-
rev:
|
|
2935
|
+
rev: z13.string().optional()
|
|
2873
2936
|
});
|
|
2874
2937
|
var APNS_TOKEN_RE = /^[0-9a-fA-F]{64}$/;
|
|
2875
|
-
var PushTokenSchema =
|
|
2876
|
-
voipToken:
|
|
2877
|
-
alertToken:
|
|
2878
|
-
fcmToken:
|
|
2879
|
-
platform:
|
|
2938
|
+
var PushTokenSchema = z13.object({
|
|
2939
|
+
voipToken: z13.string().min(1).optional(),
|
|
2940
|
+
alertToken: z13.string().min(1).optional(),
|
|
2941
|
+
fcmToken: z13.string().min(1).optional(),
|
|
2942
|
+
platform: z13.enum(["ios", "android"])
|
|
2880
2943
|
}).superRefine((v, ctx) => {
|
|
2881
2944
|
if (v.platform !== "ios") return;
|
|
2882
2945
|
for (const field of ["voipToken", "alertToken"]) {
|
|
2883
2946
|
const token = v[field];
|
|
2884
2947
|
if (token === void 0 || APNS_TOKEN_RE.test(token)) continue;
|
|
2885
2948
|
ctx.addIssue({
|
|
2886
|
-
code:
|
|
2949
|
+
code: z13.ZodIssueCode.custom,
|
|
2887
2950
|
path: [field],
|
|
2888
2951
|
message: `not an APNs device token (want 64 hex chars, got ${token.length})`
|
|
2889
2952
|
});
|
|
2890
2953
|
}
|
|
2891
2954
|
});
|
|
2892
|
-
var MissedCallSchema =
|
|
2955
|
+
var MissedCallSchema = z13.enum([
|
|
2893
2956
|
"retry_10m",
|
|
2894
2957
|
"retry_30m",
|
|
2895
2958
|
"retry_60m",
|
|
@@ -2902,31 +2965,31 @@ var MissedCallSchema = z12.enum([
|
|
|
2902
2965
|
var clock = (h) => h === 0 ? "midnight" : h === 12 ? "noon" : h < 12 ? `${h} am` : `${h - 12} pm`;
|
|
2903
2966
|
var QUIET = ` Nothing rings from ${clock(NIGHT.from)} to ${clock(NIGHT.to)} your time; the count waits for morning.`;
|
|
2904
2967
|
var THEIR_QUIET = ` Nothing rings from ${clock(NIGHT.from)} to ${clock(NIGHT.to)} their time; the count waits for morning.`;
|
|
2905
|
-
var BrokerTuningSchema =
|
|
2968
|
+
var BrokerTuningSchema = z13.object({
|
|
2906
2969
|
/** 'none' = skip the spoken ack after a mapped answer (power users find it slow). */
|
|
2907
|
-
ackVerbosity:
|
|
2970
|
+
ackVerbosity: z13.enum(["normal", "none"]).optional(),
|
|
2908
2971
|
/** How readily the mapper asks its one clarification: 'low' = only when truly
|
|
2909
2972
|
* uninterpretable, 'high' = whenever not fully certain. */
|
|
2910
|
-
clarifyEagerness:
|
|
2973
|
+
clarifyEagerness: z13.enum(["low", "normal", "high"]).optional(),
|
|
2911
2974
|
/** The user's own shorthand: when they say `say`, they mean `mean`. */
|
|
2912
|
-
phrasebook:
|
|
2975
|
+
phrasebook: z13.array(z13.object({ say: z13.string().min(1).max(60), mean: z13.string().min(1).max(120) })).max(24).optional(),
|
|
2913
2976
|
/** The language calls are PLANNED in, when the account has chosen one (#1272). Absent —
|
|
2914
2977
|
* which is every account today — means the agent's own words decide, per ask: a call
|
|
2915
2978
|
* about an English ask opens in English. This is the only thing that overrides that,
|
|
2916
2979
|
* and a live caller who switches language mid-call still outranks it (broker/lang.ts).
|
|
2917
2980
|
* Set per user (no UI yet), like `voiceTuning`. */
|
|
2918
|
-
language:
|
|
2981
|
+
language: z13.enum(["en", "es"]).optional()
|
|
2919
2982
|
});
|
|
2920
|
-
var UserSettingsSchema =
|
|
2921
|
-
permissions:
|
|
2922
|
-
call:
|
|
2923
|
-
banner:
|
|
2924
|
-
push:
|
|
2983
|
+
var UserSettingsSchema = z13.object({
|
|
2984
|
+
permissions: z13.object({
|
|
2985
|
+
call: z13.boolean(),
|
|
2986
|
+
banner: z13.boolean(),
|
|
2987
|
+
push: z13.boolean()
|
|
2925
2988
|
}),
|
|
2926
2989
|
/** LockedIn / Default / DateNight on screen; the stored words are unchanged on purpose —
|
|
2927
2990
|
* they are an enum on a live column across every account, and the rename is a rename of
|
|
2928
2991
|
* what people read (owner, 2026-09-30). */
|
|
2929
|
-
sessionMode:
|
|
2992
|
+
sessionMode: z13.enum(["default", "all_calls", "silent"]),
|
|
2930
2993
|
/** `silentPush` lived here until #2813 and is now GONE, field and column both. It was kept as an
|
|
2931
2994
|
* optional long after DateNight stopped reading it, on the theory that a phone on an older
|
|
2932
2995
|
* bundle PATCHing the whole settings object would be REFUSED for sending a key we had stopped
|
|
@@ -2935,7 +2998,7 @@ var UserSettingsSchema = z12.object({
|
|
|
2935
2998
|
* an old bundle's `silentPush` is accepted and ignored. Worth remembering before keeping the
|
|
2936
2999
|
* next dead field for the same reason. */
|
|
2937
3000
|
/** Opt-in (default false) to using your content to improve Paigy and train models. */
|
|
2938
|
-
improveConsent:
|
|
3001
|
+
improveConsent: z13.boolean(),
|
|
2939
3002
|
missedCall: MissedCallSchema.default("backoff_standard"),
|
|
2940
3003
|
/** Where voice audio is processed. 'hosted' (default) = Paigy's voice services
|
|
2941
3004
|
* (ElevenLabs TTS, faster-whisper STT, the call bot); 'on_device' = the phone
|
|
@@ -2943,17 +3006,14 @@ var UserSettingsSchema = z12.object({
|
|
|
2943
3006
|
* Optional, NOT defaulted: a stale client PATCHing the full settings object
|
|
2944
3007
|
* must not silently reset this privacy choice. Absent = leave unchanged on
|
|
2945
3008
|
* write, 'hosted' on read (see store.ts). */
|
|
2946
|
-
voiceMode:
|
|
2947
|
-
/**
|
|
2948
|
-
*
|
|
2949
|
-
*
|
|
2950
|
-
* object must not silently turn it back on. Absent = leave unchanged on write, true on
|
|
2951
|
-
* read (see store.ts). */
|
|
2952
|
-
talk: z12.boolean().optional(),
|
|
3009
|
+
voiceMode: z13.enum(["hosted", "on_device"]).optional(),
|
|
3010
|
+
/** `talk` lived here until #2373: it gated auto-play, which went in #2374. An older bundle's
|
|
3011
|
+
* `talk` is stripped like `silentPush` was; the `user_settings.talk` column outlives it until
|
|
3012
|
+
* its own drop migration (#2373, step two). */
|
|
2953
3013
|
/** CALL DIAGNOSTICS (owner, 2026-10-01): the call report carries each listen and the bot's own
|
|
2954
3014
|
* load timings. SERVER-SET, no UI — on for every account that existed on 2026-10-01, off for
|
|
2955
3015
|
* newer ones (migration 20261001132859). Read-only here: the settings PATCH never writes it. */
|
|
2956
|
-
callDiagnostics:
|
|
3016
|
+
callDiagnostics: z13.boolean().optional(),
|
|
2957
3017
|
/** Per-user ring budget (#603): calls per rolling day before further calls
|
|
2958
3018
|
* degrade to banner. Absent = the global default (25). A number, never a
|
|
2959
3019
|
* bypass — every account keeps a ceiling. No UI; set per user for testing. */
|
|
@@ -2961,7 +3021,7 @@ var UserSettingsSchema = z12.object({
|
|
|
2961
3021
|
* payload['tuning'] (e.g. { silence_s: 3.5 } — a longer pause window for a
|
|
2962
3022
|
* slower speaker). No API-side semantics; the bot resolves each key with its
|
|
2963
3023
|
* own defaults. Set per user (no UI yet); absent = bot defaults. */
|
|
2964
|
-
voiceTuning:
|
|
3024
|
+
voiceTuning: z13.record(z13.string(), z13.union([z13.number(), z13.string()])).optional(),
|
|
2965
3025
|
/** The user's IANA timezone (e.g. "America/Bogota"), recorded by the app — it is the
|
|
2966
3026
|
* only party that knows it. REMINDERS are why it exists: "remind me at ten" becomes
|
|
2967
3027
|
* an absolute `due_at` only if we know whose ten. Optional and never defaulted, for
|
|
@@ -2970,71 +3030,71 @@ var UserSettingsSchema = z12.object({
|
|
|
2970
3030
|
* that failure reads as the reminder rail being unreliable rather than as a missing
|
|
2971
3031
|
* setting. Absent = a spoken time can't be landed, so the reminder rides the next
|
|
2972
3032
|
* call — honest about what we know. */
|
|
2973
|
-
timezone:
|
|
3033
|
+
timezone: z13.string().min(1).max(64).optional(),
|
|
2974
3034
|
/** Rung-2 broker tuning (#381). Optional and NOT defaulted, same stale-client
|
|
2975
3035
|
* clobber guard as voiceMode: absent = leave unchanged on write. */
|
|
2976
3036
|
broker: BrokerTuningSchema.optional()
|
|
2977
3037
|
});
|
|
2978
|
-
var GoalLatestSchema =
|
|
2979
|
-
from:
|
|
2980
|
-
said:
|
|
2981
|
-
at:
|
|
2982
|
-
entryId:
|
|
3038
|
+
var GoalLatestSchema = z13.object({
|
|
3039
|
+
from: z13.enum(["person", "agent"]),
|
|
3040
|
+
said: z13.string(),
|
|
3041
|
+
at: z13.string(),
|
|
3042
|
+
entryId: z13.string(),
|
|
2983
3043
|
/** ITS SUMMARY IN AT MOST TEN WORDS (owner, 2026-10-08: "the same switch to the more summarized sources
|
|
2984
3044
|
* at the work tab top level screen too"): what the talker or filer wrote on the Entry; absent when
|
|
2985
3045
|
* none was. The Work row reads it before `said`. */
|
|
2986
|
-
summary:
|
|
3046
|
+
summary: z13.string().optional(),
|
|
2987
3047
|
/** AN AGENT'S UPDATE OR QUESTION AS ITS UNITS' TITLES (owner, 2026-10-08: "send the 50 chars from the title
|
|
2988
3048
|
* of each unit"): each at most 50 characters, in order; absent when it has none. */
|
|
2989
|
-
titles:
|
|
3049
|
+
titles: z13.array(z13.string()).optional(),
|
|
2990
3050
|
/** A PROGRESS NOTE'S ONE POINT ("An agent's progress note -> maybe let's cap it at 200 chars"): the
|
|
2991
3051
|
* update's own line, before its units; the row caps it at 200. Absent on anything else. */
|
|
2992
|
-
line:
|
|
3052
|
+
line: z13.string().optional()
|
|
2993
3053
|
});
|
|
2994
|
-
var HistoryWorkSchema =
|
|
2995
|
-
id:
|
|
2996
|
-
title:
|
|
2997
|
-
state:
|
|
3054
|
+
var HistoryWorkSchema = z13.object({
|
|
3055
|
+
id: z13.string(),
|
|
3056
|
+
title: z13.string(),
|
|
3057
|
+
state: z13.enum(["done", "cancelled"]),
|
|
2998
3058
|
/** Who held it (`agent:<tokenId>` or `human:<userId>`). */
|
|
2999
|
-
assignee:
|
|
3059
|
+
assignee: z13.string(),
|
|
3000
3060
|
latest: GoalLatestSchema.nullable().optional()
|
|
3001
3061
|
});
|
|
3002
|
-
var HistoryEntrySchema =
|
|
3003
|
-
|
|
3004
|
-
|
|
3062
|
+
var HistoryEntrySchema = z13.union([
|
|
3063
|
+
z13.object({ at: z13.string(), card: InboxItemSchema }),
|
|
3064
|
+
z13.object({ at: z13.string(), work: HistoryWorkSchema })
|
|
3005
3065
|
]);
|
|
3006
|
-
var HistoryPageSchema =
|
|
3007
|
-
entries:
|
|
3008
|
-
next:
|
|
3066
|
+
var HistoryPageSchema = z13.object({
|
|
3067
|
+
entries: z13.array(HistoryEntrySchema),
|
|
3068
|
+
next: z13.string().nullable()
|
|
3009
3069
|
});
|
|
3010
3070
|
var ACTIVITY_LINES = 2;
|
|
3011
3071
|
var ACTIVITY_LINE_MAX = 80;
|
|
3012
|
-
var AgentActivitySchema =
|
|
3072
|
+
var AgentActivitySchema = z13.object({
|
|
3013
3073
|
/** Oldest first, so the newest line is last — the one that replaces in place. */
|
|
3014
|
-
lines:
|
|
3074
|
+
lines: z13.array(z13.string().max(ACTIVITY_LINE_MAX)).max(ACTIVITY_LINES),
|
|
3015
3075
|
/** When the harness observed this tail. Its own timestamp, not the heartbeat's: a beat
|
|
3016
3076
|
* that carries an UNCHANGED tail must not make a stalled agent look like it just moved. */
|
|
3017
|
-
at:
|
|
3077
|
+
at: z13.string().datetime()
|
|
3018
3078
|
});
|
|
3019
|
-
var ConnectionSummarySchema =
|
|
3079
|
+
var ConnectionSummarySchema = z13.object({
|
|
3020
3080
|
/** The connection = the agent's token id (used to address a request). */
|
|
3021
|
-
id:
|
|
3081
|
+
id: z13.string(),
|
|
3022
3082
|
/** The credential kind: "device" = a paired machine (mint-only — it hosts and mints, it
|
|
3023
3083
|
* never talks); "agent" = an identity that sends. The roster and devices surfaces split
|
|
3024
3084
|
* on this. Optional/absent reads as "agent" (a row predating the kind column). See
|
|
3025
3085
|
* docs/server/tokens/devices-vs-agents-design.md. */
|
|
3026
|
-
kind:
|
|
3086
|
+
kind: z13.enum(["device", "agent"]).optional(),
|
|
3027
3087
|
/** For an agent, the token id of the DEVICE that minted it — so agents group under their
|
|
3028
3088
|
* machine, and revoking a device cascades to them. Null on devices, and on unlinked
|
|
3029
3089
|
* agents (provider-managed, hatched by another agent, or minted before the link existed);
|
|
3030
3090
|
* a phone-launched agent is linked to the computer it runs on since #1602. */
|
|
3031
|
-
mintedByDevice:
|
|
3032
|
-
device:
|
|
3091
|
+
mintedByDevice: z13.string().nullable().optional(),
|
|
3092
|
+
device: z13.string().nullable(),
|
|
3033
3093
|
/** The agent's display name (the single pairing name). */
|
|
3034
|
-
name:
|
|
3094
|
+
name: z13.string(),
|
|
3035
3095
|
/** For a managed connection, the provider key (e.g. "cma") that agentOrigin maps to a
|
|
3036
3096
|
* label; null for a local connection. Sourced from the token's provider, not the name. */
|
|
3037
|
-
provider:
|
|
3097
|
+
provider: z13.string().nullable(),
|
|
3038
3098
|
/** The pairing's assigned voice (#462); null = the default voice. */
|
|
3039
3099
|
voice: VoiceKeySchema.nullable(),
|
|
3040
3100
|
/** The LOUDEST this agent may ever reach you — a ceiling on `NOTIFY_LADDER`, set by the
|
|
@@ -3045,34 +3105,34 @@ var ConnectionSummarySchema = z12.object({
|
|
|
3045
3105
|
* every surface at once and outranks even `sessionMode: all_calls` — a mode the user
|
|
3046
3106
|
* set once must not overrule a rule they set about one agent. */
|
|
3047
3107
|
reach: NotifyLevelSchema.nullable().optional(),
|
|
3048
|
-
createdAt:
|
|
3108
|
+
createdAt: z13.string().datetime(),
|
|
3049
3109
|
/** Most recent notification on this connection, either direction. Null = no contact yet.
|
|
3050
3110
|
* Drives the agents-page recency grouping (Today / This week / …). */
|
|
3051
|
-
lastContactAt:
|
|
3111
|
+
lastContactAt: z13.string().datetime().nullable(),
|
|
3052
3112
|
/** Last presence heartbeat from a running agent process (POST /api/presence) — the
|
|
3053
3113
|
* desktop app while open. Null = never seen; stale = offline. */
|
|
3054
|
-
lastSeenAt:
|
|
3114
|
+
lastSeenAt: z13.string().datetime().nullable().optional(),
|
|
3055
3115
|
/** WORKING, NOT JUST CONNECTED (owner, 2026-09-30): the last time the agent itself acted on one of
|
|
3056
3116
|
* its Goals — wrote on one or recorded an operation (`tokens.last_worked_at`). Within
|
|
3057
3117
|
* `WORKING_MS` it is working; otherwise it is connected but idle. Null = not seen working yet. */
|
|
3058
|
-
lastWorkedAt:
|
|
3118
|
+
lastWorkedAt: z13.string().datetime().nullable().optional(),
|
|
3059
3119
|
/** The oldest of its Goals that is `ready` for it — work handed to it that nobody has started.
|
|
3060
3120
|
* With no work of its own for `WORKING_MS`, an agent sitting on this is not taking its work. */
|
|
3061
|
-
oldestReadyAt:
|
|
3121
|
+
oldestReadyAt: z13.string().datetime().nullable().optional(),
|
|
3062
3122
|
/** What a live desktop can run (docs/clients/desktop/companion.md §2.2), advertised on its heartbeat:
|
|
3063
3123
|
* harness availabilities + granted workspaces — the option set the phone's
|
|
3064
3124
|
* "new session" sheet offers. Absent for ordinary MCP agents. */
|
|
3065
|
-
runtime:
|
|
3125
|
+
runtime: z13.object({
|
|
3066
3126
|
/** The @paigy/harness this host is running — a machine the self-update has not reached
|
|
3067
3127
|
* shows its age here (`apps/desktop/src/update.ts`). */
|
|
3068
|
-
version:
|
|
3069
|
-
harnesses:
|
|
3070
|
-
workspaces:
|
|
3128
|
+
version: z13.string().optional(),
|
|
3129
|
+
harnesses: z13.array(z13.object({ name: z13.string(), label: z13.string(), status: z13.string(), models: z13.array(z13.string()).optional() })).optional(),
|
|
3130
|
+
workspaces: z13.array(z13.string()).optional(),
|
|
3071
3131
|
/** THE GIT REPOS IN THOSE FOLDERS (2026-10-01, Goal 26982211): each granted folder that is a
|
|
3072
3132
|
* repo, and each repo directly inside one, with its `origin` remote. A session started for
|
|
3073
3133
|
* work on `mauurda/paigy` opens in that repo rather than the folder above it, where the repo's
|
|
3074
3134
|
* own AGENTS.md is never read (`workspaceForRepo`). Absent on hosts that predate it. */
|
|
3075
|
-
repos:
|
|
3135
|
+
repos: z13.array(z13.object({ path: z13.string(), remote: z13.string() })).optional()
|
|
3076
3136
|
}).optional(),
|
|
3077
3137
|
/** The tail of this agent's working log, when a harness is driving it — the agent page's
|
|
3078
3138
|
* live strip. Absent for anything the desktop harness isn't running (a hatched identity
|
|
@@ -3081,151 +3141,151 @@ var ConnectionSummarySchema = z12.object({
|
|
|
3081
3141
|
activity: AgentActivitySchema.optional(),
|
|
3082
3142
|
/** True = a provider-managed agent running in the provider's cloud (e.g. Anthropic CMA);
|
|
3083
3143
|
* false = a local MCP connection running on the user's computer (Claude Code/Codex/…). */
|
|
3084
|
-
managed:
|
|
3144
|
+
managed: z13.boolean()
|
|
3085
3145
|
});
|
|
3086
|
-
var LedgerItemSchema =
|
|
3087
|
-
var AgentLedgerSchema =
|
|
3146
|
+
var LedgerItemSchema = z13.object({ id: z13.string(), parentId: z13.string(), title: z13.string(), createdAt: z13.string() });
|
|
3147
|
+
var AgentLedgerSchema = z13.object({
|
|
3088
3148
|
/** Null when the agent has not named itself yet — never a placeholder (owner, 2026-10-01). */
|
|
3089
|
-
agent:
|
|
3149
|
+
agent: z13.object({ id: z13.string(), name: z13.string().nullable(), revokedAt: z13.string().nullable() }),
|
|
3090
3150
|
/** Its own questions you have not answered. */
|
|
3091
|
-
asks:
|
|
3151
|
+
asks: z13.array(LedgerItemSchema),
|
|
3092
3152
|
/** Its questions you answered that nobody acted on — still owed to somebody. */
|
|
3093
|
-
answered:
|
|
3153
|
+
answered: z13.array(LedgerItemSchema),
|
|
3094
3154
|
/** Requests you sent it that it never took. */
|
|
3095
|
-
requests:
|
|
3096
|
-
goals:
|
|
3097
|
-
callbacks:
|
|
3155
|
+
requests: z13.array(LedgerItemSchema),
|
|
3156
|
+
goals: z13.array(z13.object({ id: z13.string(), outcome: z13.string(), state: z13.string() })),
|
|
3157
|
+
callbacks: z13.array(z13.object({ id: z13.string(), parentId: z13.string(), trigger: z13.string(), note: z13.string(), dueAt: z13.string().nullable() }))
|
|
3098
3158
|
});
|
|
3099
|
-
var ReassignResultSchema =
|
|
3100
|
-
moved:
|
|
3101
|
-
parentId:
|
|
3159
|
+
var ReassignResultSchema = z13.object({
|
|
3160
|
+
moved: z13.object({ asks: z13.number(), answered: z13.number(), requests: z13.number(), goals: z13.number(), callbacks: z13.number() }),
|
|
3161
|
+
parentId: z13.string().nullable()
|
|
3102
3162
|
});
|
|
3103
|
-
var LessonStateSchema =
|
|
3104
|
-
var LessonViewSchema =
|
|
3105
|
-
id:
|
|
3106
|
-
text:
|
|
3163
|
+
var LessonStateSchema = z13.enum(["active", "proposed", "retired"]);
|
|
3164
|
+
var LessonViewSchema = z13.object({
|
|
3165
|
+
id: z13.string(),
|
|
3166
|
+
text: z13.string(),
|
|
3107
3167
|
state: LessonStateSchema,
|
|
3108
3168
|
/** The Goal it is scoped to; null = the whole account. */
|
|
3109
|
-
scopeGoalId:
|
|
3110
|
-
goalTitle:
|
|
3111
|
-
version:
|
|
3112
|
-
pinned:
|
|
3169
|
+
scopeGoalId: z13.string().nullable(),
|
|
3170
|
+
goalTitle: z13.string().nullable(),
|
|
3171
|
+
version: z13.number(),
|
|
3172
|
+
pinned: z13.boolean(),
|
|
3113
3173
|
/** When the person last wrote its text themselves. */
|
|
3114
|
-
editedAt:
|
|
3115
|
-
createdAt:
|
|
3116
|
-
updatedAt:
|
|
3174
|
+
editedAt: z13.string().nullable(),
|
|
3175
|
+
createdAt: z13.string(),
|
|
3176
|
+
updatedAt: z13.string(),
|
|
3117
3177
|
/** The Entries it came from, oldest first; `words` is null when an Entry has none to show (sealed). */
|
|
3118
|
-
sources:
|
|
3178
|
+
sources: z13.array(z13.object({ entryId: z13.string(), words: z13.string().nullable(), at: z13.string() }))
|
|
3119
3179
|
});
|
|
3120
|
-
var QueueQuestionSchema =
|
|
3180
|
+
var QueueQuestionSchema = z13.object({
|
|
3121
3181
|
/** The decision need's id — what an answer is accepted against. */
|
|
3122
|
-
id:
|
|
3182
|
+
id: z13.string(),
|
|
3123
3183
|
/** The words that were asked, from the request Entry that asked them. */
|
|
3124
|
-
question:
|
|
3184
|
+
question: z13.string(),
|
|
3125
3185
|
/** Where it was asked — which is where the ruling goes (`POST /api/entries`). Null only
|
|
3126
3186
|
* for a need whose request Entry is carried by no interactive Delivery, which nothing
|
|
3127
3187
|
* can answer. */
|
|
3128
|
-
deliveryId:
|
|
3188
|
+
deliveryId: z13.string().nullable().default(null),
|
|
3129
3189
|
/** The Entry the ruling is about. */
|
|
3130
|
-
aboutId:
|
|
3190
|
+
aboutId: z13.string().nullable().default(null),
|
|
3131
3191
|
/** Empty for a free-text question. */
|
|
3132
|
-
options:
|
|
3133
|
-
select:
|
|
3134
|
-
askedAt:
|
|
3192
|
+
options: z13.array(OptionSchema).default([]),
|
|
3193
|
+
select: z13.enum(["one", "many", "rank", "confirm", "text"]).default("text"),
|
|
3194
|
+
askedAt: z13.string(),
|
|
3135
3195
|
/** Null while the question is open — which is how the page tells the two apart. */
|
|
3136
|
-
answeredAt:
|
|
3196
|
+
answeredAt: z13.string().nullable().default(null),
|
|
3137
3197
|
/** The ruling in the person's own words, from the contribution that replied — not the
|
|
3138
3198
|
* option id, which is not something anyone reads back. Null while it is open, and null
|
|
3139
3199
|
* for a settled question whose reply carried nothing readable. */
|
|
3140
|
-
answer:
|
|
3200
|
+
answer: z13.string().nullable().default(null),
|
|
3141
3201
|
/** The Goal this question belongs to — a step knows its Goal on its own, not only through
|
|
3142
3202
|
* an `InboxItem`'s `communication.goalIds[0]` (docs/clients/app/walk/design.md §12 item 3).
|
|
3143
3203
|
* READ BY `apps/client/src/walk/order.ts`, which stamps it onto every `WalkStep`: the walk's
|
|
3144
3204
|
* order, its route, home's trees and the list of steps all take a step's Goal from here, so
|
|
3145
3205
|
* this is the field they agree through rather than each re-deriving it from the row it
|
|
3146
3206
|
* arrived under. Required because the API projects it on every need it sends. */
|
|
3147
|
-
goalId:
|
|
3207
|
+
goalId: z13.string(),
|
|
3148
3208
|
/** True only while an unmet START gate holds the Goal — a Goal that merely waits to
|
|
3149
3209
|
* *finish* does not stop a person from answering (owner, 2026-09-16: "per need gate from
|
|
3150
3210
|
* the API"; §4's dashed node). Not the same fact as `QueueItem.blocked`, which counts any
|
|
3151
3211
|
* gate at all. */
|
|
3152
|
-
blocked:
|
|
3212
|
+
blocked: z13.boolean().default(false)
|
|
3153
3213
|
});
|
|
3154
|
-
var QueueReplySchema =
|
|
3214
|
+
var QueueReplySchema = z13.object({
|
|
3155
3215
|
/** The card this note was (`deliveryId:requestEntryId`, minted by the server like every card
|
|
3156
3216
|
* id) — so the phone can tell a reply it just sent from one the queue already carries, and the
|
|
3157
3217
|
* walk can name it in its zoom. */
|
|
3158
|
-
id:
|
|
3218
|
+
id: z13.string(),
|
|
3159
3219
|
/** The Goal the note is on. */
|
|
3160
|
-
goalId:
|
|
3220
|
+
goalId: z13.string(),
|
|
3161
3221
|
/** What the note said. */
|
|
3162
|
-
note:
|
|
3222
|
+
note: z13.string(),
|
|
3163
3223
|
/** Where it was carried — where a second reply goes (`POST /api/entries`, #2252). */
|
|
3164
|
-
deliveryId:
|
|
3165
|
-
requestEntryId:
|
|
3166
|
-
askedAt:
|
|
3224
|
+
deliveryId: z13.string(),
|
|
3225
|
+
requestEntryId: z13.string(),
|
|
3226
|
+
askedAt: z13.string(),
|
|
3167
3227
|
/** When the person last replied — the window's start. */
|
|
3168
|
-
repliedAt:
|
|
3228
|
+
repliedAt: z13.string(),
|
|
3169
3229
|
/** The person's latest words about it; null when there is nothing readable in them. */
|
|
3170
|
-
reply:
|
|
3230
|
+
reply: z13.string().nullable()
|
|
3171
3231
|
});
|
|
3172
|
-
var QueueItemSchema =
|
|
3173
|
-
id:
|
|
3232
|
+
var QueueItemSchema = z13.object({
|
|
3233
|
+
id: z13.string(),
|
|
3174
3234
|
/** One-line headline — the first sentence of the outcome. */
|
|
3175
|
-
title:
|
|
3235
|
+
title: z13.string(),
|
|
3176
3236
|
/** The outcome in full, verbatim: the person's own words are what an assignee sees. */
|
|
3177
|
-
intent:
|
|
3237
|
+
intent: z13.string(),
|
|
3178
3238
|
/** `ready` | `active` | `waiting` | `done` | `cancelled`, straight off the Goal. */
|
|
3179
|
-
state:
|
|
3239
|
+
state: z13.string(),
|
|
3180
3240
|
/** Who holds it (a participant ref); null when nobody does yet. */
|
|
3181
|
-
assignee:
|
|
3241
|
+
assignee: z13.string().nullable().default(null),
|
|
3182
3242
|
/** What the agent last said it was doing; null if it has said nothing. */
|
|
3183
|
-
progress:
|
|
3243
|
+
progress: z13.string().nullable().default(null),
|
|
3184
3244
|
/** HOME'S LINE FOR THAT NOTE (owner, 2026-09-23): a few plain words one read wrote from `progress`,
|
|
3185
3245
|
* served only while it was written for the current note. Null means show the Goal's name. */
|
|
3186
|
-
progressLine:
|
|
3187
|
-
reviewPending:
|
|
3188
|
-
dueAt:
|
|
3246
|
+
progressLine: z13.string().nullable().optional(),
|
|
3247
|
+
reviewPending: z13.boolean().default(false),
|
|
3248
|
+
dueAt: z13.string().nullable().default(null),
|
|
3189
3249
|
/** WHEN ITS OWNER SAID DONE WHILE CHILDREN WERE OPEN (#2704): its own work is finished and it closes
|
|
3190
3250
|
* with its last open child. Null otherwise; optional, so hand-built queues need not spell it. */
|
|
3191
|
-
finishedAt:
|
|
3251
|
+
finishedAt: z13.string().nullable().optional(),
|
|
3192
3252
|
/** The Goal this one was opened under; null at the root. */
|
|
3193
|
-
parentGoalId:
|
|
3253
|
+
parentGoalId: z13.string().nullable().default(null),
|
|
3194
3254
|
/** Goals opened under this one — only those the same list holds. */
|
|
3195
|
-
childGoalIds:
|
|
3255
|
+
childGoalIds: z13.array(z13.string()).default([]),
|
|
3196
3256
|
/** Goals this one waits on (start or finish gates). */
|
|
3197
|
-
dependencyGoalIds:
|
|
3257
|
+
dependencyGoalIds: z13.array(z13.string()).default([]),
|
|
3198
3258
|
/** True while any gate is on a Goal that is not done — the walk draws it dashed. */
|
|
3199
|
-
blocked:
|
|
3259
|
+
blocked: z13.boolean().default(false),
|
|
3200
3260
|
/** Its questions: every OPEN one, and at most ten settled, newest settled first
|
|
3201
3261
|
* (20260929133308) — the page decides which of them to show. NOT the whole set: `asked` and
|
|
3202
3262
|
* `answered` are, and a settled one's words are a line (280 characters), its body read when the
|
|
3203
3263
|
* question is opened. Never a CANCELLED one (withdrawn, dismissed, or its Goal or call ended): it
|
|
3204
3264
|
* asks nothing of anyone (#3723). */
|
|
3205
|
-
questions:
|
|
3265
|
+
questions: z13.array(QueueQuestionSchema).default([]),
|
|
3206
3266
|
/** HOW MANY QUESTIONS THIS WORK HAS ASKED, and how many are answered — the Goal's own totals,
|
|
3207
3267
|
* bounded at 100 server-side. A tally counted off `questions` is a wrong number that looks
|
|
3208
3268
|
* right once the cap bites (`walk/trees.ts` `tallyOf`). Optional, and defaulted from the array
|
|
3209
3269
|
* by the projection, so hand-built queues (fixtures, the demo) need not spell them. A cancelled
|
|
3210
3270
|
* question is not asked (#3725). */
|
|
3211
|
-
asked:
|
|
3212
|
-
answered:
|
|
3271
|
+
asked: z13.number().optional(),
|
|
3272
|
+
answered: z13.number().optional(),
|
|
3213
3273
|
/** Every note on it the person replied to (`QueueReplySchema`) — the page decides which to show.
|
|
3214
3274
|
* Optional, not defaulted: absent is none, and every hand-built queue (fixtures, the demo) need
|
|
3215
3275
|
* not spell an empty list. */
|
|
3216
|
-
replies:
|
|
3276
|
+
replies: z13.array(QueueReplySchema).optional(),
|
|
3217
3277
|
/** The repository or project identifier this Goal belongs to (#2280), null if untracked. */
|
|
3218
|
-
repo:
|
|
3219
|
-
createdAt:
|
|
3220
|
-
updatedAt:
|
|
3278
|
+
repo: z13.string().nullable().optional(),
|
|
3279
|
+
createdAt: z13.string(),
|
|
3280
|
+
updatedAt: z13.string().nullable().default(null),
|
|
3221
3281
|
/** When its owner last SAID something about it (the newest `progress` Entry: a contact update kept
|
|
3222
3282
|
* as progress). `updatedAt` moves for reasons nobody chose — a
|
|
3223
3283
|
* state recomputed, a review flag — so it cannot tell work in hand from work gone quiet. */
|
|
3224
|
-
lastProgressAt:
|
|
3284
|
+
lastProgressAt: z13.string().nullable().optional(),
|
|
3225
3285
|
/** WHEN AN AGENT LAST ACTED ON IT (owner, 2026-10-27: "Move it now", Goal 567258dc): its newest agent write, an
|
|
3226
3286
|
* Entry or a Goal change, Paigy's excluded (`goals.worked_at`). What keeps work an agent is writing on from
|
|
3227
3287
|
* reading as gone quiet (`coldSince`); absent on a door that does not carry it. */
|
|
3228
|
-
workedAt:
|
|
3288
|
+
workedAt: z13.string().nullable().optional(),
|
|
3229
3289
|
/** THE GOAL'S NEWEST WORD, FROM EITHER SIDE (owner, 2026-09-27): the newest Entry on it, of any
|
|
3230
3290
|
* kind — what the person added ("Add to this"), their reply, the agent's ask or its progress
|
|
3231
3291
|
* note. A progress note is an Entry, so this is already the newer of the two: the person's note
|
|
@@ -3244,7 +3304,7 @@ var QueueItemSchema = z12.object({
|
|
|
3244
3304
|
* minute after the person speaks erases their instant from it, and the durable traces the client
|
|
3245
3305
|
* can see (`replies`, `questions[].answeredAt`) miss a spontaneous note entirely — a `request`
|
|
3246
3306
|
* Entry with no `about_id` is in neither. */
|
|
3247
|
-
lastPersonAt:
|
|
3307
|
+
lastPersonAt: z13.string().nullable().optional(),
|
|
3248
3308
|
/** EACH SIDE'S NEWEST WORD IN THE LAST DAY (owner, 2026-10-13, the Work tab's order): the person's
|
|
3249
3309
|
* (`yours`) and the agents' (`theirs`), each null when that side wrote nothing on it in 24 hours.
|
|
3250
3310
|
* `latest` holds one Entry, so whichever side wrote first is hidden there; Work orders a Goal by
|
|
@@ -3262,40 +3322,40 @@ var QueueItemSchema = z12.object({
|
|
|
3262
3322
|
* the row shows that no `updated_at` moves for (`active` lapsing, a dependency's state, a
|
|
3263
3323
|
* sibling appearing in `childGoalIds`) cannot go unnoticed. Optional because a hand-built
|
|
3264
3324
|
* queue (a fixture, the demo) spells none, and a row with no rev is simply always re-sent. */
|
|
3265
|
-
rev:
|
|
3325
|
+
rev: z13.string().optional()
|
|
3266
3326
|
});
|
|
3267
|
-
var QueueDeltaSchema =
|
|
3268
|
-
ids:
|
|
3269
|
-
items:
|
|
3327
|
+
var QueueDeltaSchema = z13.object({
|
|
3328
|
+
ids: z13.array(z13.string()),
|
|
3329
|
+
items: z13.array(QueueItemSchema)
|
|
3270
3330
|
});
|
|
3271
3331
|
var COLD_AFTER_MS = 3 * 24 * 60 * 60 * 1e3;
|
|
3272
|
-
var NoteSourceSchema =
|
|
3273
|
-
var NoteStatusSchema =
|
|
3274
|
-
var NoteRepeatSchema =
|
|
3275
|
-
var DecisionSchema =
|
|
3276
|
-
id:
|
|
3332
|
+
var NoteSourceSchema = z13.enum(["app", "call"]);
|
|
3333
|
+
var NoteStatusSchema = z13.enum(["open", "assigned", "in_progress", "done"]);
|
|
3334
|
+
var NoteRepeatSchema = z13.enum(["once", "until_done"]);
|
|
3335
|
+
var DecisionSchema = z13.object({
|
|
3336
|
+
id: z13.string(),
|
|
3277
3337
|
/** The note this decision refines; null = recorded on a bare thread (the
|
|
3278
3338
|
* extensibility seam — any conversation can accrue decisions). */
|
|
3279
|
-
noteId:
|
|
3339
|
+
noteId: z13.string().nullable(),
|
|
3280
3340
|
/** What was ambiguous — the broker's (or the user's own) question. */
|
|
3281
|
-
question:
|
|
3341
|
+
question: z13.string(),
|
|
3282
3342
|
/** The user's ruling; null while the question is open. */
|
|
3283
|
-
answer:
|
|
3284
|
-
decidedAt:
|
|
3285
|
-
createdAt:
|
|
3343
|
+
answer: z13.string().nullable(),
|
|
3344
|
+
decidedAt: z13.string().nullable(),
|
|
3345
|
+
createdAt: z13.string()
|
|
3286
3346
|
});
|
|
3287
|
-
var NoteSchema =
|
|
3288
|
-
id:
|
|
3347
|
+
var NoteSchema = z13.object({
|
|
3348
|
+
id: z13.string(),
|
|
3289
3349
|
/** One-line headline (broker-titled; deterministic floor). */
|
|
3290
|
-
title:
|
|
3350
|
+
title: z13.string(),
|
|
3291
3351
|
/** The original intent, verbatim — assignees always see the user's own words. */
|
|
3292
|
-
intent:
|
|
3352
|
+
intent: z13.string(),
|
|
3293
3353
|
source: NoteSourceSchema,
|
|
3294
3354
|
status: NoteStatusSchema,
|
|
3295
3355
|
/** Who it was assigned to (a participant ref, 'agent:<tokenId>'); null = unassigned. */
|
|
3296
|
-
assignee:
|
|
3356
|
+
assignee: z13.string().nullable(),
|
|
3297
3357
|
/** The request thread minted at assignment; null until assigned. */
|
|
3298
|
-
parentId:
|
|
3358
|
+
parentId: z13.string().nullable(),
|
|
3299
3359
|
/** REMINDERS (docs/model/notes/reminders-design.md): the NOT-BEFORE this becomes eligible to ride a
|
|
3300
3360
|
* call — never a deadline. It only ever comes from the user's own words, so when it
|
|
3301
3361
|
* passes Paigy rings ONCE (#1293, owner 2026-08-26: a time said out loud is consent to
|
|
@@ -3304,102 +3364,102 @@ var NoteSchema = z12.object({
|
|
|
3304
3364
|
// Defaulted, not required: a Note from an API deploy older than the reminders
|
|
3305
3365
|
// migration has none of these, and the defaults ARE what it means — no not-before,
|
|
3306
3366
|
// one ride, never ridden. Parsing must not fail across a rolling deploy.
|
|
3307
|
-
dueAt:
|
|
3367
|
+
dueAt: z13.string().nullable().default(null),
|
|
3308
3368
|
repeat: NoteRepeatSchema.default("once"),
|
|
3309
3369
|
/** How many calls have already carried it — the fatigue cap counts rides, not days. */
|
|
3310
|
-
rides:
|
|
3311
|
-
lastRideAt:
|
|
3312
|
-
createdAt:
|
|
3370
|
+
rides: z13.number().int().default(0),
|
|
3371
|
+
lastRideAt: z13.string().nullable().default(null),
|
|
3372
|
+
createdAt: z13.string()
|
|
3313
3373
|
});
|
|
3314
|
-
var DeliveryModeSchema =
|
|
3374
|
+
var DeliveryModeSchema = z13.enum(["poll", "self_hosted"]);
|
|
3315
3375
|
var WAKE_EVENT = "wake";
|
|
3316
3376
|
var wakeChannel = (tokenId) => `wake:${tokenId}`;
|
|
3317
|
-
var RegisterDeliverySchema =
|
|
3318
|
-
var OAuthStartSchema =
|
|
3319
|
-
provider:
|
|
3320
|
-
returnTo:
|
|
3377
|
+
var RegisterDeliverySchema = z13.object({ mode: DeliveryModeSchema });
|
|
3378
|
+
var OAuthStartSchema = z13.object({
|
|
3379
|
+
provider: z13.enum(["cma"]),
|
|
3380
|
+
returnTo: z13.string().min(1)
|
|
3321
3381
|
});
|
|
3322
|
-
var DeliveryConfigSchema =
|
|
3323
|
-
tokenId:
|
|
3382
|
+
var DeliveryConfigSchema = z13.object({
|
|
3383
|
+
tokenId: z13.string(),
|
|
3324
3384
|
mode: DeliveryModeSchema,
|
|
3325
3385
|
/** null when the deployment has no anon key configured. `self_hosted` is then REFUSED
|
|
3326
3386
|
* (503 `self_hosted_unavailable`) rather than registered, so a self_hosted config always
|
|
3327
3387
|
* carries credentials; only a `poll` registration can come back with null here. */
|
|
3328
|
-
realtime:
|
|
3388
|
+
realtime: z13.object({ url: z13.string(), anonKey: z13.string() }).nullable()
|
|
3329
3389
|
});
|
|
3330
|
-
var HostDecisionSchema =
|
|
3390
|
+
var HostDecisionSchema = z13.object({
|
|
3331
3391
|
/** The agent's token id: the row's `recipient`. */
|
|
3332
|
-
agent:
|
|
3333
|
-
decision:
|
|
3392
|
+
agent: z13.string().uuid(),
|
|
3393
|
+
decision: z13.enum(["stood_back", "took_over"]),
|
|
3334
3394
|
/** The work it was about: the Goal waiting on that agent next (`claimable` on its `contact({})` read). */
|
|
3335
|
-
goalId:
|
|
3395
|
+
goalId: z13.string().uuid().nullable().optional(),
|
|
3336
3396
|
/** When the server last heard from the agent, as the host read it: the presence it stood back for. */
|
|
3337
|
-
seenAt:
|
|
3397
|
+
seenAt: z13.string().datetime().nullable().optional(),
|
|
3338
3398
|
/** When that work last moved (`claimable.since` on an agent's `contact({})` read), the fact the bound is judged on. */
|
|
3339
|
-
since:
|
|
3399
|
+
since: z13.string().datetime().nullable().optional(),
|
|
3340
3400
|
/** What the host said, in its log's own words: why it stood back, or what the take-over did. */
|
|
3341
|
-
said:
|
|
3401
|
+
said: z13.string().max(300).optional()
|
|
3342
3402
|
});
|
|
3343
|
-
var WakeNudgeSchema =
|
|
3344
|
-
kind:
|
|
3345
|
-
notificationId:
|
|
3346
|
-
parentId:
|
|
3403
|
+
var WakeNudgeSchema = z13.object({
|
|
3404
|
+
kind: z13.enum(["reply", "request", "callback"]),
|
|
3405
|
+
notificationId: z13.string().optional(),
|
|
3406
|
+
parentId: z13.string()
|
|
3347
3407
|
});
|
|
3348
|
-
var PairingStatusSchema =
|
|
3349
|
-
var DeviceCodeSchema =
|
|
3350
|
-
device_code:
|
|
3351
|
-
user_code:
|
|
3352
|
-
verification_uri:
|
|
3353
|
-
verification_uri_complete:
|
|
3354
|
-
interval:
|
|
3355
|
-
expires_in:
|
|
3408
|
+
var PairingStatusSchema = z13.enum(["pending", "approved", "denied", "expired"]);
|
|
3409
|
+
var DeviceCodeSchema = z13.object({
|
|
3410
|
+
device_code: z13.string(),
|
|
3411
|
+
user_code: z13.string(),
|
|
3412
|
+
verification_uri: z13.string().url(),
|
|
3413
|
+
verification_uri_complete: z13.string().url(),
|
|
3414
|
+
interval: z13.number(),
|
|
3415
|
+
expires_in: z13.number()
|
|
3356
3416
|
});
|
|
3357
|
-
var DeviceInfoSchema =
|
|
3358
|
-
code:
|
|
3417
|
+
var DeviceInfoSchema = z13.object({
|
|
3418
|
+
code: z13.string(),
|
|
3359
3419
|
/** The agent's suggested name (from /device/code) — shown on the approval screen,
|
|
3360
3420
|
* pre-filling the name field the human can edit. */
|
|
3361
|
-
name:
|
|
3421
|
+
name: z13.string(),
|
|
3362
3422
|
/** @deprecated Legacy alias of `name` for the pre-#531 embedded bundle in App Store
|
|
3363
3423
|
* build 35, whose DeviceFlow renders `info.agent.slice(0, 2)` — without this a FRESH
|
|
3364
3424
|
* install crashes on the pairing screen on first launch, before the OTA lands
|
|
3365
3425
|
* (seen live: PAIGY-5T, 2026-07-21). Remove once a newer binary is the floor. */
|
|
3366
|
-
agent:
|
|
3367
|
-
device:
|
|
3426
|
+
agent: z13.string().optional(),
|
|
3427
|
+
device: z13.string().nullable(),
|
|
3368
3428
|
status: PairingStatusSchema
|
|
3369
3429
|
});
|
|
3370
|
-
var DeviceTokenSchema =
|
|
3371
|
-
access_token:
|
|
3430
|
+
var DeviceTokenSchema = z13.object({
|
|
3431
|
+
access_token: z13.string(),
|
|
3372
3432
|
/** The pairing's single name (user-typed at approval, the agent's suggestion, or
|
|
3373
3433
|
* a default silly name). */
|
|
3374
|
-
name:
|
|
3375
|
-
device:
|
|
3434
|
+
name: z13.string(),
|
|
3435
|
+
device: z13.string().nullable(),
|
|
3376
3436
|
/** The pairing's assigned voice, cached so the desktop can seed the SAME face the phone
|
|
3377
3437
|
* draws — voice is the third ingredient of a hatchling's build (party/traits.ts). */
|
|
3378
|
-
voice:
|
|
3438
|
+
voice: z13.string().nullable().optional(),
|
|
3379
3439
|
/** The token's server-side id — the face's COLOUR anchor, and the only seed ingredient
|
|
3380
3440
|
* that survives a rename. Cached by the host's identity beat. */
|
|
3381
|
-
token_id:
|
|
3441
|
+
token_id: z13.string().nullable().optional(),
|
|
3382
3442
|
/** WHERE this identity works — the folder a wake should land it in. Written by the host
|
|
3383
3443
|
* at spawn and by `paigy-harness handoff` from a live terminal. Without it every wake
|
|
3384
3444
|
* landed in the FIRST granted workspace and the agent rediscovered its own repo from
|
|
3385
3445
|
* the thread each time (host.ts, live catch 2026-08-06 — prompt-papered until now). */
|
|
3386
|
-
workspace:
|
|
3446
|
+
workspace: z13.string().nullable().optional(),
|
|
3387
3447
|
/** Local host recovery must preserve the launch's runtime and Paigy identity. */
|
|
3388
|
-
harness:
|
|
3389
|
-
session_id:
|
|
3448
|
+
harness: z13.enum(["claude", "codex", "agy"]).optional(),
|
|
3449
|
+
session_id: z13.string().uuid().optional(),
|
|
3390
3450
|
/** A conversation the host must not resume: its context is full, so every turn fails
|
|
3391
3451
|
* ("Prompt is too long"). Written when a run hits it (`run.ts` `onFull`); the host skips a slot
|
|
3392
3452
|
* whose resumable session is this one, so its Goals reach the dead-agent handoff instead of a
|
|
3393
3453
|
* copy that types the person's words into a turn that cannot run (Calls, 2026-10-06). */
|
|
3394
|
-
full_session:
|
|
3395
|
-
uik_pub:
|
|
3454
|
+
full_session: z13.string().optional(),
|
|
3455
|
+
uik_pub: z13.string().nullable().optional()
|
|
3396
3456
|
});
|
|
3397
|
-
var SupportRequestSchema =
|
|
3398
|
-
email:
|
|
3399
|
-
message:
|
|
3400
|
-
name:
|
|
3457
|
+
var SupportRequestSchema = z13.object({
|
|
3458
|
+
email: z13.string().email().max(320),
|
|
3459
|
+
message: z13.string().trim().min(1).max(5e3),
|
|
3460
|
+
name: z13.string().trim().max(120).optional()
|
|
3401
3461
|
});
|
|
3402
|
-
var NotificationFeedbackKindSchema =
|
|
3462
|
+
var NotificationFeedbackKindSchema = z13.enum([
|
|
3403
3463
|
"break_down",
|
|
3404
3464
|
// "This should be more than one ask — break it down."
|
|
3405
3465
|
"regenerate_options",
|
|
@@ -3414,136 +3474,133 @@ var NotificationFeedbackKindSchema = z12.enum([
|
|
|
3414
3474
|
// anything else — the note carries it.
|
|
3415
3475
|
]);
|
|
3416
3476
|
var SlimOptionSchema = OptionSchema.omit({ html: true });
|
|
3417
|
-
var QuestionRowSchema =
|
|
3477
|
+
var QuestionRowSchema = z13.object({
|
|
3418
3478
|
/** The card's id (`deliveryId:needId`, or `deliveryId:entryId` for an update), as the inbox mints it. */
|
|
3419
|
-
id:
|
|
3420
|
-
deliveryId:
|
|
3421
|
-
entryId:
|
|
3479
|
+
id: z13.string(),
|
|
3480
|
+
deliveryId: z13.string(),
|
|
3481
|
+
entryId: z13.string(),
|
|
3422
3482
|
/** The decision it waits on; null for an update, which asks nothing. */
|
|
3423
|
-
needId:
|
|
3424
|
-
goalIds:
|
|
3483
|
+
needId: z13.string().nullable(),
|
|
3484
|
+
goalIds: z13.array(z13.string()),
|
|
3425
3485
|
/** The name of the work it is about, when the read could word it. */
|
|
3426
|
-
goalTitle:
|
|
3427
|
-
tokenId:
|
|
3428
|
-
name:
|
|
3429
|
-
title:
|
|
3430
|
-
body:
|
|
3431
|
-
select:
|
|
3432
|
-
options:
|
|
3433
|
-
hasPreview:
|
|
3434
|
-
blocking:
|
|
3435
|
-
askedAt:
|
|
3486
|
+
goalTitle: z13.string().optional(),
|
|
3487
|
+
tokenId: z13.string().optional(),
|
|
3488
|
+
name: z13.string(),
|
|
3489
|
+
title: z13.string(),
|
|
3490
|
+
body: z13.string(),
|
|
3491
|
+
select: z13.enum(["one", "many", "rank", "confirm", "text"]),
|
|
3492
|
+
options: z13.array(SlimOptionSchema),
|
|
3493
|
+
hasPreview: z13.boolean(),
|
|
3494
|
+
blocking: z13.boolean(),
|
|
3495
|
+
askedAt: z13.string().datetime(),
|
|
3436
3496
|
ring: InboxItemSchema.shape.ring,
|
|
3437
|
-
onCall:
|
|
3438
|
-
sealed:
|
|
3497
|
+
onCall: z13.literal(true).optional(),
|
|
3498
|
+
sealed: z13.boolean()
|
|
3439
3499
|
});
|
|
3440
|
-
var WorkStateSchema =
|
|
3441
|
-
var WorkRowSchema =
|
|
3442
|
-
id:
|
|
3443
|
-
parentId:
|
|
3444
|
-
title:
|
|
3500
|
+
var WorkStateSchema = z13.enum(["ready", "active", "waiting", "done", "cancelled"]);
|
|
3501
|
+
var WorkRowSchema = z13.object({
|
|
3502
|
+
id: z13.string(),
|
|
3503
|
+
parentId: z13.string().nullable(),
|
|
3504
|
+
title: z13.string(),
|
|
3445
3505
|
/** Straight off the Goal. */
|
|
3446
3506
|
state: WorkStateSchema,
|
|
3447
|
-
owner:
|
|
3448
|
-
revision:
|
|
3507
|
+
owner: z13.string().nullable(),
|
|
3508
|
+
revision: z13.number().int(),
|
|
3449
3509
|
/** Open questions on it, counted to 100. */
|
|
3450
|
-
waiting:
|
|
3510
|
+
waiting: z13.number().int(),
|
|
3451
3511
|
/** Held by a gate on work that is not done. */
|
|
3452
|
-
blocked:
|
|
3453
|
-
lastProgressAt:
|
|
3512
|
+
blocked: z13.boolean(),
|
|
3513
|
+
lastProgressAt: z13.string().datetime().nullable(),
|
|
3454
3514
|
/** The line written for its newest progress note, else that note's first words. */
|
|
3455
|
-
line:
|
|
3515
|
+
line: z13.string().nullable(),
|
|
3456
3516
|
/** Work directly under it, counted to 100; the list carries up to 12 of them. */
|
|
3457
|
-
children:
|
|
3458
|
-
createdAt:
|
|
3459
|
-
updatedAt:
|
|
3517
|
+
children: z13.number().int(),
|
|
3518
|
+
createdAt: z13.string().datetime(),
|
|
3519
|
+
updatedAt: z13.string().datetime(),
|
|
3460
3520
|
/** When anything at or under it last moved — the order the list is in. */
|
|
3461
|
-
activeAt:
|
|
3521
|
+
activeAt: z13.string().datetime(),
|
|
3462
3522
|
/** A sealed outcome has no title here; the work's page opens it. */
|
|
3463
|
-
sealed:
|
|
3523
|
+
sealed: z13.boolean()
|
|
3464
3524
|
});
|
|
3465
3525
|
var ComputerRowSchema = ConnectionSummarySchema.omit({ activity: true });
|
|
3466
3526
|
var AgentRowSchema = ComputerRowSchema.extend({
|
|
3467
3527
|
/** Open questions it is asking the person, over every open card; null when that read failed. */
|
|
3468
|
-
asking:
|
|
3469
|
-
oldestAskAt:
|
|
3528
|
+
asking: z13.number().int().nullable(),
|
|
3529
|
+
oldestAskAt: z13.string().datetime().nullable(),
|
|
3470
3530
|
/** Up to three of the live Goals it holds, oldest first (the order it picks them up), and how
|
|
3471
3531
|
* many in all among the account's 200 most recently active agent-held live Goals
|
|
3472
3532
|
* (`agent_holds`); null when that read failed. */
|
|
3473
|
-
holds:
|
|
3474
|
-
held:
|
|
3475
|
-
/** The earliest instant any Goal it holds went quiet, by the one rule (`coldSince`); null
|
|
3476
|
-
* while none has, or when that read failed. */
|
|
3477
|
-
cold: z12.string().datetime().nullable(),
|
|
3533
|
+
holds: z13.array(z13.object({ id: z13.string(), title: z13.string() })).nullable(),
|
|
3534
|
+
held: z13.number().int().nullable(),
|
|
3478
3535
|
/** The newest line of its working log, and when the harness saw it. */
|
|
3479
|
-
line:
|
|
3480
|
-
lineAt:
|
|
3536
|
+
line: z13.string().nullable(),
|
|
3537
|
+
lineAt: z13.string().datetime().nullable()
|
|
3481
3538
|
});
|
|
3482
|
-
var SnapshotSchema =
|
|
3539
|
+
var SnapshotSchema = z13.object({
|
|
3483
3540
|
/** The API's clock, taken before the first read: what a later delta will start from. */
|
|
3484
|
-
at:
|
|
3485
|
-
questions:
|
|
3541
|
+
at: z13.string().datetime(),
|
|
3542
|
+
questions: z13.object({
|
|
3486
3543
|
/** The newest 30 open cards, questions before updates. */
|
|
3487
|
-
items:
|
|
3544
|
+
items: z13.array(QuestionRowSchema),
|
|
3488
3545
|
/** Every open question, and apart from them every update, and what was put off. */
|
|
3489
|
-
total:
|
|
3490
|
-
updates:
|
|
3491
|
-
putOff:
|
|
3546
|
+
total: z13.number().int(),
|
|
3547
|
+
updates: z13.number().int(),
|
|
3548
|
+
putOff: z13.number().int()
|
|
3492
3549
|
}).nullable(),
|
|
3493
|
-
agents:
|
|
3550
|
+
agents: z13.object({
|
|
3494
3551
|
/** Up to 60, most recently seen first. */
|
|
3495
|
-
items:
|
|
3496
|
-
more:
|
|
3552
|
+
items: z13.array(AgentRowSchema),
|
|
3553
|
+
more: z13.boolean()
|
|
3497
3554
|
}).nullable(),
|
|
3498
|
-
work:
|
|
3555
|
+
work: z13.object({
|
|
3499
3556
|
/** The 60 most recently active roots, each followed by up to 12 children; 240 rows at most. */
|
|
3500
|
-
items:
|
|
3557
|
+
items: z13.array(WorkRowSchema),
|
|
3501
3558
|
/** How much work is behind each of the Work tab's four filters, each counted to 100, read with
|
|
3502
3559
|
* the rows. `work_list` (20260928023533) owns the predicates: Live is `ready`, `active` or
|
|
3503
3560
|
* `waiting`; Waiting on you is live work with an open question or an unmet gate; Not started
|
|
3504
3561
|
* is `ready`; Done is `done` or `cancelled`. */
|
|
3505
|
-
counts:
|
|
3562
|
+
counts: z13.object({ live: z13.number().int(), waiting: z13.number().int(), notStarted: z13.number().int(), done: z13.number().int() })
|
|
3506
3563
|
}).nullable(),
|
|
3507
|
-
you:
|
|
3564
|
+
you: z13.object({
|
|
3508
3565
|
settings: UserSettingsSchema,
|
|
3509
|
-
callable:
|
|
3566
|
+
callable: z13.boolean(),
|
|
3510
3567
|
/** Up to 20 paired computers; null when the roster read failed. */
|
|
3511
|
-
computers:
|
|
3568
|
+
computers: z13.array(ComputerRowSchema).nullable()
|
|
3512
3569
|
}).nullable()
|
|
3513
3570
|
});
|
|
3514
|
-
var CallRecapSchema =
|
|
3515
|
-
call:
|
|
3516
|
-
status:
|
|
3517
|
-
startedAt:
|
|
3518
|
-
durationMs:
|
|
3571
|
+
var CallRecapSchema = z13.object({
|
|
3572
|
+
call: z13.object({
|
|
3573
|
+
status: z13.string(),
|
|
3574
|
+
startedAt: z13.string(),
|
|
3575
|
+
durationMs: z13.number().nullable(),
|
|
3519
3576
|
/** Bot-clock pickup offset; absent before the timestamp release, null before its report lands. */
|
|
3520
|
-
pickupMs:
|
|
3577
|
+
pickupMs: z13.number().nullable().optional(),
|
|
3521
3578
|
/** STILL FILING (20261026182117): the call has not ended on the server, or it has and a brain cycle on it is
|
|
3522
3579
|
* still pending, the next writer, which may still settle, file or start something. What the close itself
|
|
3523
3580
|
* waits for (`private.close_call`). `status` cannot say it: nothing writes "finalizing", and a call reads
|
|
3524
3581
|
* "open" until the sweep closes it, after nothing is pending. Absent from an API before it. */
|
|
3525
|
-
filing:
|
|
3526
|
-
agents:
|
|
3582
|
+
filing: z13.boolean().optional(),
|
|
3583
|
+
agents: z13.array(z13.object({ id: z13.string(), name: z13.string().nullable() }))
|
|
3527
3584
|
}),
|
|
3528
|
-
topics:
|
|
3529
|
-
goalId:
|
|
3530
|
-
title:
|
|
3531
|
-
owner:
|
|
3532
|
-
state:
|
|
3585
|
+
topics: z13.array(z13.object({
|
|
3586
|
+
goalId: z13.string().uuid(),
|
|
3587
|
+
title: z13.string(),
|
|
3588
|
+
owner: z13.string(),
|
|
3589
|
+
state: z13.string(),
|
|
3533
3590
|
/** Presented Entry content and its author, separately from the current Goal owner. */
|
|
3534
|
-
items:
|
|
3591
|
+
items: z13.array(z13.object({ entryId: z13.string(), author: z13.string(), text: z13.string(), summary: z13.string().nullable(), acknowledged: z13.boolean().optional() })).optional(),
|
|
3535
3592
|
/** Whether the call put it to the person. An item it carried and never said has no row on the
|
|
3536
3593
|
* review (owner, 2026-10-08: "why do we get the third one when it didn't happen in the call?"). */
|
|
3537
|
-
presented:
|
|
3594
|
+
presented: z13.boolean(),
|
|
3538
3595
|
/** Whether THIS call created it — the third way a call touches work, beside carrying a request
|
|
3539
3596
|
* there and filing words there (owner, 2026-10-08, Goal `5b4b1a0a`: "Show the new work, keep my
|
|
3540
3597
|
* words under it"). Created work is never carried, so it is never `presented`; without this the
|
|
3541
3598
|
* row is dropped by the "only what happened on the call" filter. False on a database before
|
|
3542
3599
|
* 20261013080133. */
|
|
3543
|
-
created:
|
|
3600
|
+
created: z13.boolean(),
|
|
3544
3601
|
/** `request` is the Entry that asked it — what a line's `about` names when the line answered or put
|
|
3545
3602
|
* it off. Optional: an older API sent none. */
|
|
3546
|
-
questions:
|
|
3603
|
+
questions: z13.array(z13.object({ id: z13.string().uuid(), state: z13.string(), title: z13.string(), request: z13.string().optional() })),
|
|
3547
3604
|
/** `words` is always what they SAID, verbatim — the record, never replaced. `summary` is what
|
|
3548
3605
|
* the line says in ten words (owner, 2026-10-07): the filer's, or the talker's for the answer it
|
|
3549
3606
|
* gave, so the row scans like a chosen option and their own words stay under it. Absent when
|
|
@@ -3553,34 +3610,34 @@ var CallRecapSchema = z12.object({
|
|
|
3553
3610
|
/** `reply` is the reply the line makes up (an answer, an ok, a deferral), so one reply is one row
|
|
3554
3611
|
* however many lines it cites; `at` is the call lines it came from, so a filed line an answer already
|
|
3555
3612
|
* said is not drawn again (owner, 2026-10-07: "fix them all"); `replyKind` says which replies are answers. */
|
|
3556
|
-
lines:
|
|
3557
|
-
entryId:
|
|
3558
|
-
words:
|
|
3559
|
-
summary:
|
|
3560
|
-
about:
|
|
3561
|
-
reply:
|
|
3562
|
-
replyKind:
|
|
3563
|
-
at:
|
|
3613
|
+
lines: z13.array(z13.object({
|
|
3614
|
+
entryId: z13.string().uuid(),
|
|
3615
|
+
words: z13.string(),
|
|
3616
|
+
summary: z13.string().optional(),
|
|
3617
|
+
about: z13.string().nullable().optional(),
|
|
3618
|
+
reply: z13.string().nullable().optional(),
|
|
3619
|
+
replyKind: z13.string().nullable().optional(),
|
|
3620
|
+
at: z13.array(z13.number()).optional()
|
|
3564
3621
|
}))
|
|
3565
3622
|
})),
|
|
3566
|
-
unfiled:
|
|
3623
|
+
unfiled: z13.array(z13.object({ lineId: z13.string().uuid(), words: z13.string(), atMs: z13.number() })),
|
|
3567
3624
|
/** THE PUBLIC TRANSCRIPT — every line said on the call, in the order it was said, and WHO SAID IT
|
|
3568
3625
|
* (owner, 2026-10-08: "the public view should only have the lines and who said them, and that's
|
|
3569
3626
|
* it"; `docs/brain/phase-three/modular.md` build step 3). `speaker` is the role: "user" is the
|
|
3570
3627
|
* person, "agent" an agent speaking, named in `agent`. The timeline's action lines are ours, not
|
|
3571
3628
|
* theirs, and are not here; nor is a sealed line, which the server has no words for. It stands
|
|
3572
3629
|
* BESIDE `topics` and `unfiled` — what the call did with the words — never instead of them. */
|
|
3573
|
-
said:
|
|
3574
|
-
lineId:
|
|
3575
|
-
speaker:
|
|
3576
|
-
agent:
|
|
3577
|
-
words:
|
|
3578
|
-
atMs:
|
|
3630
|
+
said: z13.array(z13.object({
|
|
3631
|
+
lineId: z13.string().uuid(),
|
|
3632
|
+
speaker: z13.enum(["user", "agent"]),
|
|
3633
|
+
agent: z13.object({ id: z13.string().nullable(), name: z13.string().nullable() }).nullable(),
|
|
3634
|
+
words: z13.string(),
|
|
3635
|
+
atMs: z13.number()
|
|
3579
3636
|
})),
|
|
3580
3637
|
/** What did not fit, counted. `settles` counts items past the recap's 100; absent before 20261026165518. */
|
|
3581
|
-
more:
|
|
3638
|
+
more: z13.object({ lines: z13.number(), entries: z13.number(), topics: z13.number(), settles: z13.number().optional() }),
|
|
3582
3639
|
/** Last stored position on this page when another exists; absent before paging shipped. */
|
|
3583
|
-
next:
|
|
3640
|
+
next: z13.number().int().nonnegative().nullable().optional(),
|
|
3584
3641
|
/** THE CALL AS ONE LIST OF ROWS (owner, 2026-10-14: "we only really want a thing like transcript but
|
|
3585
3642
|
* built from the summaries", then "the transcript tabs should show the same but with full words").
|
|
3586
3643
|
* Both tabs draw these rows, in this order: Summary from `summary`, Transcript from `words`.
|
|
@@ -3591,32 +3648,32 @@ var CallRecapSchema = z12.object({
|
|
|
3591
3648
|
* `by` is the row's real author, never inferred from `kind`: a relay Paigy sent to an agent is
|
|
3592
3649
|
* Paigy's, not the person's. Optional and additive (owner: "make sure whatever you do is backward
|
|
3593
3650
|
* compatible"): an API before it sends none, and the screen falls back to `topics` and `said`. */
|
|
3594
|
-
timeline:
|
|
3595
|
-
id:
|
|
3596
|
-
position:
|
|
3597
|
-
atMs:
|
|
3598
|
-
kind:
|
|
3599
|
-
by:
|
|
3600
|
-
goalId:
|
|
3601
|
-
requestId:
|
|
3602
|
-
summary:
|
|
3603
|
-
words:
|
|
3651
|
+
timeline: z13.array(z13.object({
|
|
3652
|
+
id: z13.string(),
|
|
3653
|
+
position: z13.number(),
|
|
3654
|
+
atMs: z13.number(),
|
|
3655
|
+
kind: z13.enum(["put", "said", "did"]),
|
|
3656
|
+
by: z13.object({ participant: z13.string().nullable(), agentId: z13.string().nullable(), name: z13.string().nullable() }),
|
|
3657
|
+
goalId: z13.string().uuid().nullable(),
|
|
3658
|
+
requestId: z13.string().nullable(),
|
|
3659
|
+
summary: z13.string().nullable(),
|
|
3660
|
+
words: z13.string(),
|
|
3604
3661
|
/** Paigy's sentences folded into this row: on a `put` row, what it said putting the item to the
|
|
3605
3662
|
* person (before their next row); on a `said` row, what it said in reply (until their next row).
|
|
3606
3663
|
* `atMs` is when each was said; optional, absent before 2026-10-14's fix. */
|
|
3607
|
-
spoken:
|
|
3664
|
+
spoken: z13.array(z13.object({ lineId: z13.string(), words: z13.string(), atMs: z13.number().optional() })),
|
|
3608
3665
|
/** On a `said` row: the work these words were filed on, and whether they answered (recorded) a
|
|
3609
3666
|
* question. They replace the "Filed on ..." and "Recorded: ..." rows that repeated the person's own
|
|
3610
3667
|
* summary (Brain, 2026-10-14). Optional: absent from an API before it. */
|
|
3611
|
-
filedOn:
|
|
3612
|
-
recorded:
|
|
3613
|
-
settled:
|
|
3614
|
-
acknowledged:
|
|
3668
|
+
filedOn: z13.array(z13.object({ goalId: z13.string().uuid(), title: z13.string() })).optional(),
|
|
3669
|
+
recorded: z13.boolean().optional(),
|
|
3670
|
+
settled: z13.object({ requestId: z13.string(), answer: z13.string() }).nullable().optional(),
|
|
3671
|
+
acknowledged: z13.boolean().optional(),
|
|
3615
3672
|
/** On a `put` row: still waiting for the person's answer (not settled, not answered, not put off).
|
|
3616
3673
|
* The server's judgement; the screen draws "Still waiting for your answer" from it. Optional: absent
|
|
3617
3674
|
* from an API before it, where the screen falls back to its own reading. */
|
|
3618
|
-
waiting:
|
|
3619
|
-
lineIds:
|
|
3675
|
+
waiting: z13.boolean().optional(),
|
|
3676
|
+
lineIds: z13.array(z13.string())
|
|
3620
3677
|
})).optional(),
|
|
3621
3678
|
/** THE RECAP (owner, 2026-10-26: "the transcript should just be the entries that settled or
|
|
3622
3679
|
* acknowledged the items; that's it"). Each item the person's words settled on this call, in the
|
|
@@ -3628,13 +3685,13 @@ var CallRecapSchema = z12.object({
|
|
|
3628
3685
|
* with `requestId` null and the Goal's name as `title`; a started Goal may have no `lines` yet. `kind`
|
|
3629
3686
|
* is a string, not an enum, so a later kind never fails an older build's parse; `requestId` is the
|
|
3630
3687
|
* request the words settled. On the first page only; absent from an API before it. */
|
|
3631
|
-
settles:
|
|
3632
|
-
requestId:
|
|
3633
|
-
kind:
|
|
3634
|
-
by:
|
|
3635
|
-
goalId:
|
|
3636
|
-
title:
|
|
3637
|
-
lines:
|
|
3688
|
+
settles: z13.array(z13.object({
|
|
3689
|
+
requestId: z13.string().nullable(),
|
|
3690
|
+
kind: z13.string(),
|
|
3691
|
+
by: z13.object({ participant: z13.string(), agentId: z13.string().nullable(), name: z13.string() }),
|
|
3692
|
+
goalId: z13.string().uuid().nullable(),
|
|
3693
|
+
title: z13.string(),
|
|
3694
|
+
lines: z13.array(z13.object({ lineId: z13.string(), words: z13.string(), atMs: z13.number() }))
|
|
3638
3695
|
})).optional()
|
|
3639
3696
|
});
|
|
3640
3697
|
function sessionSlot(sessionId2) {
|
|
@@ -4008,6 +4065,7 @@ async function contact(input, opts = {}) {
|
|
|
4008
4065
|
...questions ? { questions } : {},
|
|
4009
4066
|
...parsed.answers ? { answers: parsed.answers } : {},
|
|
4010
4067
|
...parsed.withdrawQuestionIds ? { withdrawQuestionIds: parsed.withdrawQuestionIds } : {},
|
|
4068
|
+
...parsed.bumpQuestionIds ? { bumpQuestionIds: parsed.bumpQuestionIds } : {},
|
|
4011
4069
|
...parsed.questionDependencies ? { questionDependencies: parsed.questionDependencies } : {}
|
|
4012
4070
|
})
|
|
4013
4071
|
}));
|
|
@@ -4036,7 +4094,9 @@ async function contact(input, opts = {}) {
|
|
|
4036
4094
|
// IT WENT ONTO A CALL ALREADY HAPPENING (owner, 2026-09-28): the view words it as that call.
|
|
4037
4095
|
...lead.joinedCall ? { joinedCall: true } : {},
|
|
4038
4096
|
...demoted ? { demoted } : {},
|
|
4039
|
-
...acked
|
|
4097
|
+
...acked,
|
|
4098
|
+
...receipt.ringPolicy ? { ringPolicy: receipt.ringPolicy, ...receipt.message ? { ringHeld: receipt.message } : {} } : {},
|
|
4099
|
+
...receipt.recheckAt ? { recheckAt: receipt.recheckAt } : {}
|
|
4040
4100
|
};
|
|
4041
4101
|
};
|
|
4042
4102
|
const settled = (d) => d.state === "closed" || d.answers.length > 0 || d.entries.some((e) => e.kind === "contribution" && !entryUnit(e));
|
|
@@ -4240,7 +4300,7 @@ var JOINED_CALL = "This joined the call the person is ALREADY ON \u2014 no ring,
|
|
|
4240
4300
|
function failures(results) {
|
|
4241
4301
|
const failed = (results ?? []).filter((r) => r.status === "failed");
|
|
4242
4302
|
if (!failed.length) return void 0;
|
|
4243
|
-
const plural = { update: "updates", completion: "completions", question: "questions", answer: "answers", withdraw: "withdrawQuestionIds", dependency: "questionDependencies" };
|
|
4303
|
+
const plural = { update: "updates", completion: "completions", question: "questions", answer: "answers", withdraw: "withdrawQuestionIds", bump: "bumpQuestionIds", dependency: "questionDependencies" };
|
|
4244
4304
|
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("; ") + ".";
|
|
4245
4305
|
}
|
|
4246
4306
|
var itemsView = (results) => (results ?? []).map((r) => compact({
|
|
@@ -4301,9 +4361,14 @@ function deliveryView(d) {
|
|
|
4301
4361
|
callOutcome: d.callOutcome,
|
|
4302
4362
|
waitOutcome: d.waitOutcome,
|
|
4303
4363
|
acknowledged: d.acknowledged?.filter((a) => a.acknowledged).map((a) => a.eventId),
|
|
4364
|
+
// THE CALL IT PLACED WILL BE HELD (owner, 2026-10-27): the person's ring policy, and when the phone rings.
|
|
4365
|
+
ringPolicy: d.ringPolicy,
|
|
4366
|
+
// NO CALL WAS PLACED; THE ASKS WAIT ON THEIR CARDS (owner, 2026-10-27, Goal 2d147edd): when to check back.
|
|
4367
|
+
recheckAt: d.recheckAt,
|
|
4304
4368
|
next: [
|
|
4305
4369
|
failures(d.results),
|
|
4306
|
-
d.
|
|
4370
|
+
d.ringHeld,
|
|
4371
|
+
d.joinedCall ? `${JOINED_CALL}${d.message ? ` ${d.message}` : ""}` : d.recheckAt && d.ringHeld ? void 0 : 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
|
|
4307
4372
|
].filter(Boolean).join(" ")
|
|
4308
4373
|
});
|
|
4309
4374
|
}
|
|
@@ -4460,6 +4525,11 @@ async function runTool(name, args, opts) {
|
|
|
4460
4525
|
}
|
|
4461
4526
|
case "search":
|
|
4462
4527
|
return searchRecords(SearchToolSchema.parse(input), client);
|
|
4528
|
+
case "help": {
|
|
4529
|
+
const asked2 = HelpSchema.safeParse(input);
|
|
4530
|
+
if (!asked2.success) throw new Error(asked2.error.issues[0].message);
|
|
4531
|
+
return helpView(asked2.data);
|
|
4532
|
+
}
|
|
4463
4533
|
default:
|
|
4464
4534
|
throw new Error(`Unknown tool: ${name}`);
|
|
4465
4535
|
}
|
|
@@ -4749,6 +4819,8 @@ export {
|
|
|
4749
4819
|
acknowledge,
|
|
4750
4820
|
pendingEvents,
|
|
4751
4821
|
receiveContact,
|
|
4822
|
+
viaLine,
|
|
4823
|
+
decided,
|
|
4752
4824
|
runTool,
|
|
4753
4825
|
subscribeWake,
|
|
4754
4826
|
parseDue,
|