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