@paigy/mcp 0.40.28 → 0.40.31
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/dist/{chunk-632JM6QA.js → chunk-AWI252HQ.js} +590 -477
- package/dist/{chunk-AHLJPVEP.js → chunk-CULBHBFU.js} +614 -480
- package/dist/{chunk-WKAXAJEM.js → chunk-FAS3IB2F.js} +1 -1
- package/dist/{chunk-ZP6NBVEE.js → chunk-NHPLQOQP.js} +2 -2
- package/dist/{dist-JTZJFUWD.js → dist-2WLAZWSH.js} +1 -1
- package/dist/enable.js +3 -3
- 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,7 +7,7 @@ import { homedir } from "os";
|
|
|
7
7
|
import { join } from "path";
|
|
8
8
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
9
9
|
import { setTimeout as sleep2 } from "timers/promises";
|
|
10
|
-
import { z as
|
|
10
|
+
import { z as z9 } from "zod";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import { z as z3 } from "zod";
|
|
13
13
|
import { ZodFirstPartyTypeKind as ZodFirstPartyTypeKind3 } from "zod/v3";
|
|
@@ -17,6 +17,8 @@ import { z as z2 } from "zod";
|
|
|
17
17
|
import { z as z4 } from "zod";
|
|
18
18
|
import { z as z5 } from "zod";
|
|
19
19
|
import { z as z6 } from "zod";
|
|
20
|
+
import { z as z7 } from "zod";
|
|
21
|
+
import { z as z8 } from "zod";
|
|
20
22
|
import { closeSync, existsSync, mkdirSync, openSync, readFileSync as readFileSync2, rmSync, statSync, writeFileSync } from "fs";
|
|
21
23
|
import { homedir as homedir2 } from "os";
|
|
22
24
|
import { join as join2 } from "path";
|
|
@@ -1606,8 +1608,41 @@ var UpdateInputSchema = z2.object({
|
|
|
1606
1608
|
message: z2.string().trim().min(1).describe(`The one point, at most ${ASK_MAX} characters; the context goes in units.`),
|
|
1607
1609
|
goalIds: z2.array(z2.string().uuid()).min(1).max(10).describe("The Goals it is about, each one that exists: the one it is mainly about first."),
|
|
1608
1610
|
units,
|
|
1611
|
+
// A REPORT KEEPS ITS TAP (#2799, #3260; owner, 2026-10-08, settling #2776: "keep the reports open
|
|
1612
|
+
// until the user acknowledges them"). A report asks nothing, so it opens no Question -- but it
|
|
1613
|
+
// still waits to be acknowledged, and it carries the ONE tap that closes it. Never a decision: the
|
|
1614
|
+
// tap lands as a contribution, the person's own words on the Goal, because there is no Question
|
|
1615
|
+
// for it to answer.
|
|
1616
|
+
//
|
|
1617
|
+
// AND ITS WORDS ARE WRITTEN FOR THIS REPORT (owner, 2026-10-08, Goal 3c12d3c6: "Agent
|
|
1618
|
+
// acknowledgments vary (e.g. 'sounds good, I will test later') instead of always 'got it'"). `Got
|
|
1619
|
+
// it` and `Noted` say only that a card was cleared, where "Sounds good, I'll test later" says the
|
|
1620
|
+
// work was RECEIVED and not verified -- the distinction a session spent an hour recovering from a
|
|
1621
|
+
// call transcript on 2026-10-07, having read "not quite" as a defect report when it meant *not
|
|
1622
|
+
// tested yet*. The words are worth writing because the agent reads them back.
|
|
1623
|
+
//
|
|
1624
|
+
// ONE STRING, NOT A LIST (owner, 2026-10-08 15:47, Goal 31a1e2ac, asked whether an agent should
|
|
1625
|
+
// write up to four of them: "just on the cards, but it should be more like just they should only
|
|
1626
|
+
// get one basically string value that they can enter that replaces got it"). A report has exactly
|
|
1627
|
+
// one way to close, so the only thing an agent writes is what that button SAYS. #3260's 1..6
|
|
1628
|
+
// `options` and this field are one job: the list is deleted, not deprecated (ONE JOB, ONE
|
|
1629
|
+
// MECHANISM). It rides the door as the report's single stored option (`storedOption`,
|
|
1630
|
+
// `apps/api/src/goal/router.ts`), so no reader below the door learns a second shape.
|
|
1631
|
+
reply: z2.string().trim().min(1).describe(
|
|
1632
|
+
`What this report's button says instead of "Got it", at most ${OPTION_LABEL_MAX} characters, written in THEIR voice for THIS report ("Sounds good, I'll test later") -- the care you give a question's options, so what they tap tells you whether they verified your work or only received it. One tap sends exactly these words back to you. Words that would CHANGE what happens next are a question, not a reply to a report: it still asks nothing and still owes you no answer. Left out, the button says "Got it", as every card did.`
|
|
1633
|
+
).optional(),
|
|
1609
1634
|
userExplicitlyRequested
|
|
1610
|
-
}).strict().superRefine((u, ctx) =>
|
|
1635
|
+
}).strict().superRefine((u, ctx) => {
|
|
1636
|
+
refuseOverCaps(u.message, u.units, "message", ctx);
|
|
1637
|
+
if (u.reply && u.reply.length > OPTION_LABEL_MAX) {
|
|
1638
|
+
ctx.addIssue({
|
|
1639
|
+
code: z2.ZodIssueCode.custom,
|
|
1640
|
+
path: ["reply"],
|
|
1641
|
+
params: { refusal: "reply_too_long", length: u.reply.length, cap: OPTION_LABEL_MAX },
|
|
1642
|
+
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.`
|
|
1643
|
+
});
|
|
1644
|
+
}
|
|
1645
|
+
});
|
|
1611
1646
|
var questionFields = {
|
|
1612
1647
|
question: z2.string().trim().min(1).describe(
|
|
1613
1648
|
`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.`
|
|
@@ -1691,6 +1726,8 @@ QUESTIONS: one question per object; several questions are several objects in one
|
|
|
1691
1726
|
|
|
1692
1727
|
CUT A LONG MESSAGE BEFORE YOU SEND IT: a question, an update's message or an answer is the one point, in at most ${ASK_MAX} characters; everything else it needs goes in 'units', up to ${UNITS_MAX} {title, body} in reading order, one idea each, every title at most ${UNIT_TITLE_MAX} characters and every body at most ${UNIT_BODY_MAX}. The person sees the main text and the titles, and opens a unit to read its body. Over a cap is refused by name (ask_too_long, too_many_units, unit_title_too_long, unit_body_too_long) and nothing is sent.
|
|
1693
1728
|
|
|
1729
|
+
GIVE A REPORT ITS REPLY: an update takes \`reply\` too, one line the person can tap instead of typing, written in THEIR voice for THAT report ("Sounds good, I'll test later") \u2014 the same care you give a question's options. It is what their button says instead of "Got it", and what they tap is what you read back, which tells you whether they verified your work or only received it. One line, because a report has one way to close, and it may not change what happens next: a reply that would is a question. Nothing is owed on it either way, and a report that writes none offers "Got it".
|
|
1730
|
+
|
|
1694
1731
|
UPDATES ask nothing, so no answer is owed and none should be awaited. An update reaches the person only when they asked you for it (userExplicitlyRequested), when it answers something they said, or once its Goal is done; any other is recorded as the Goal's progress and nobody is notified. So when the work is finished, mark the Goal done first (manage_goals), then send one update saying what is done and anything they need to do or check. On a Goal whose report card is still open, an update that reaches them is added to that card, with no new push. If the person is already on a call, anything that reaches them joins that call, with no ring.
|
|
1695
1732
|
|
|
1696
1733
|
RECEIVING: a contact that sends nothing returns \`events\`, a limited batch of what is addressed to you (not a history page): \`question\`, a Question you owe (answer it in answers, with its questionId); \`update\`, something new on one of your Goals (a reply, an answer: read it with get_goal); \`instruction\`, a request or note sent to you. \`hasMore\` says more are waiting. Reading acknowledges nothing: once you have handled events, confirm their eventIds with contact({ackEventIds}), and the next batch can come. contact({}) waits up to about 45 seconds for something to arrive; contact({wait:false}) returns at once. It also lists work given to you that nobody has started (\`assigned\`; your first write to it starts it) and your work gone quiet (\`stalled\`).`;
|
|
@@ -1803,7 +1840,7 @@ var SearchToolSchema = z3.object({
|
|
|
1803
1840
|
goalId: z3.string().uuid().optional(),
|
|
1804
1841
|
limit: z3.number().int().min(1).max(20).optional()
|
|
1805
1842
|
}).strict();
|
|
1806
|
-
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
|
|
1843
|
+
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.";
|
|
1807
1844
|
var CheckActivitySchema = z3.object({}).strict();
|
|
1808
1845
|
var FEEDBACK_TEXT_MAX = 5e4;
|
|
1809
1846
|
var SendFeedbackSchema = z3.object({
|
|
@@ -1967,13 +2004,15 @@ var TalkerReplySchema = z5.object({
|
|
|
1967
2004
|
messages: z5.array(z5.object({ key: str2, to: str2, text: str2, about: strs2, blocks: str2 }).strict()),
|
|
1968
2005
|
/** What the call does next: listen, hold (the person asked for a moment) or end (they asked to). */
|
|
1969
2006
|
then: z5.enum(["listen", "hold", "end"]),
|
|
1970
|
-
/**
|
|
1971
|
-
* the
|
|
1972
|
-
|
|
1973
|
-
|
|
2007
|
+
/** The person's replies to items (replies, owner 2026-10-07): the item's handle, the chosen option
|
|
2008
|
+
* IDs, the line handles, how they replied in under ten words (keeping any condition), and `defer`:
|
|
2009
|
+
* "" when their words settle the item, else what a reply that puts it off waits for -- "call" (the
|
|
2010
|
+
* end of this call), a question's handle (that question's answer) or an ISO time. */
|
|
2011
|
+
replies: z5.array(z5.object({ item: str2, options: strs2, lines: strs2, summary: str2, defer: str2 }).strict()),
|
|
2012
|
+
/** The line handles that tell the talker how to run this call; they last until it ends and reach no agent. */
|
|
1974
2013
|
instruction: strs2,
|
|
1975
|
-
/** The line handles
|
|
1976
|
-
*
|
|
2014
|
+
/** The line handles the filer acts on, and the only ones it reads (3e): new work, a change to existing
|
|
2015
|
+
* work, feedback on Paigy, anything said to an agent, and any rule meant to outlast the call. */
|
|
1977
2016
|
file: strs2,
|
|
1978
2017
|
/** Evidence to fetch for a second round: a search, an item's full text, or an agent by name. */
|
|
1979
2018
|
need: z5.object({ kind: z5.enum(["search", "item", "agent", ""]), text: str2 }).strict(),
|
|
@@ -2021,6 +2060,60 @@ var FilerReplySchema = z6.object({
|
|
|
2021
2060
|
var FILER_REPLY_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
|
|
2022
2061
|
zodToJsonSchema(FilerReplySchema, { $refStrategy: "none" })
|
|
2023
2062
|
);
|
|
2063
|
+
var ExplainerReplySchema = z7.object({
|
|
2064
|
+
/** The explanation, as sentences, spoken in order. */
|
|
2065
|
+
say: z7.array(z7.string()),
|
|
2066
|
+
/** Questions to an agent about gaps in what it read: the agent's handle and the question. */
|
|
2067
|
+
followUps: z7.array(z7.object({ to: z7.string(), text: z7.string() }).strict())
|
|
2068
|
+
}).strict();
|
|
2069
|
+
var EXPLAINER_REPLY_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
|
|
2070
|
+
zodToJsonSchema(ExplainerReplySchema, { $refStrategy: "none" })
|
|
2071
|
+
);
|
|
2072
|
+
var DISTILLER_DEFECTS = [
|
|
2073
|
+
"reasked",
|
|
2074
|
+
// a question put to the person again after they answered it
|
|
2075
|
+
"unsupported",
|
|
2076
|
+
// a fact stated that nothing in the input supports
|
|
2077
|
+
"unsaid",
|
|
2078
|
+
// an agent's answer arrived during the call and was never said
|
|
2079
|
+
"skipped",
|
|
2080
|
+
// an agenda item never put to the person
|
|
2081
|
+
"unsaved",
|
|
2082
|
+
// something the person answered or asked for did not save, was refused or dropped
|
|
2083
|
+
"ignored",
|
|
2084
|
+
// the person asked or said something and was never answered (the critic's ignored_a_question)
|
|
2085
|
+
"promised",
|
|
2086
|
+
// said it did or would do something, and nothing shows it done (the critic's broken_promise)
|
|
2087
|
+
"dropped"
|
|
2088
|
+
// something it had to say never played and was never said later (owner, 2026-10-08, call 65433a9d)
|
|
2089
|
+
];
|
|
2090
|
+
var DistillerReplySchema = z8.object({
|
|
2091
|
+
defects: z8.array(z8.object({
|
|
2092
|
+
kind: z8.enum(DISTILLER_DEFECTS),
|
|
2093
|
+
/** The handles of the lines it shows in. */
|
|
2094
|
+
lines: z8.array(z8.string()),
|
|
2095
|
+
/** The handle of the record it concerns, or "". */
|
|
2096
|
+
about: z8.string(),
|
|
2097
|
+
/** One plain sentence, in words, never handles: it is what the feedback row keeps. */
|
|
2098
|
+
why: z8.string()
|
|
2099
|
+
}).strict())
|
|
2100
|
+
}).strict();
|
|
2101
|
+
var DISTILLER_REPLY_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
|
|
2102
|
+
zodToJsonSchema(DistillerReplySchema, { $refStrategy: "none" })
|
|
2103
|
+
);
|
|
2104
|
+
var TIDY_AUDIENCES = ["talker", "filer", "agents"];
|
|
2105
|
+
var TidyReplySchema = z8.object({
|
|
2106
|
+
lessons: z8.array(z8.object({
|
|
2107
|
+
lesson: z8.string(),
|
|
2108
|
+
op: z8.enum(["keep", "revise", "withdraw"]),
|
|
2109
|
+
text: z8.string(),
|
|
2110
|
+
for: z8.enum([...TIDY_AUDIENCES, ""]),
|
|
2111
|
+
into: z8.string()
|
|
2112
|
+
}).strict())
|
|
2113
|
+
}).strict();
|
|
2114
|
+
var TIDY_REPLY_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
|
|
2115
|
+
zodToJsonSchema(TidyReplySchema, { $refStrategy: "none" })
|
|
2116
|
+
);
|
|
2024
2117
|
function entryWords(entry) {
|
|
2025
2118
|
const content = entry.content;
|
|
2026
2119
|
if (content && "sealed" in content) return "";
|
|
@@ -2054,20 +2147,20 @@ function askUnits(request, entries) {
|
|
|
2054
2147
|
}
|
|
2055
2148
|
var LIVE_MS = 3 * 6e4;
|
|
2056
2149
|
var WORKING_MS = 60 * 6e4;
|
|
2057
|
-
var ContextSchema =
|
|
2058
|
-
title:
|
|
2059
|
-
description:
|
|
2150
|
+
var ContextSchema = z9.object({
|
|
2151
|
+
title: z9.string().min(1).describe("One-line headline of what you need (required, non-empty)."),
|
|
2152
|
+
description: z9.array(z9.string().min(1)).describe(
|
|
2060
2153
|
"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."
|
|
2061
2154
|
),
|
|
2062
2155
|
/** THE ASK'S UNITS (3c): its context as titled units, in order. The app lists the titles and opens
|
|
2063
2156
|
* a body on a tap. Absent on an ask sent without units, which renders as before. */
|
|
2064
|
-
units:
|
|
2157
|
+
units: z9.array(z9.object({ title: z9.string(), body: z9.string() })).optional()
|
|
2065
2158
|
});
|
|
2066
|
-
var ParticipantSchema =
|
|
2067
|
-
kind:
|
|
2068
|
-
id:
|
|
2159
|
+
var ParticipantSchema = z9.object({
|
|
2160
|
+
kind: z9.enum(["human", "agent"]),
|
|
2161
|
+
id: z9.string()
|
|
2069
2162
|
});
|
|
2070
|
-
var TransformSchema =
|
|
2163
|
+
var TransformSchema = z9.enum([
|
|
2071
2164
|
"structure",
|
|
2072
2165
|
// shape intent into an answer contract; pick channel/urgency — broker `ask`, `select` shapes, `points`
|
|
2073
2166
|
"request_more",
|
|
@@ -2090,13 +2183,13 @@ var PAIGY_SELF = { kind: "agent", id: "paigy" };
|
|
|
2090
2183
|
function isPaigy(ref) {
|
|
2091
2184
|
return ref === participantRef(PAIGY_SELF);
|
|
2092
2185
|
}
|
|
2093
|
-
var VisualSchema =
|
|
2094
|
-
url:
|
|
2095
|
-
label:
|
|
2186
|
+
var VisualSchema = z9.object({
|
|
2187
|
+
url: z9.string().url(),
|
|
2188
|
+
label: z9.string().optional()
|
|
2096
2189
|
});
|
|
2097
|
-
var NotifyLevelSchema =
|
|
2098
|
-
var SelectShapeSchema =
|
|
2099
|
-
var ReceiptEventSchema =
|
|
2190
|
+
var NotifyLevelSchema = z9.enum(["inbox", "push", "banner", "call"]);
|
|
2191
|
+
var SelectShapeSchema = z9.enum(["one", "many", "rank", "confirm", "text"]);
|
|
2192
|
+
var ReceiptEventSchema = z9.enum([
|
|
2100
2193
|
"delivered",
|
|
2101
2194
|
// the bundle reached the recipient at some level
|
|
2102
2195
|
"seen",
|
|
@@ -2126,47 +2219,47 @@ var ReceiptEventSchema = z7.enum([
|
|
|
2126
2219
|
// be rewound by a writer that forgot to advance it.
|
|
2127
2220
|
"restarted"
|
|
2128
2221
|
]);
|
|
2129
|
-
var AttentionSchema =
|
|
2222
|
+
var AttentionSchema = z9.object({
|
|
2130
2223
|
urgency: NotifyLevelSchema,
|
|
2131
2224
|
/** The required answer shape, or null for a plain notify that asks nothing back. */
|
|
2132
2225
|
select: SelectShapeSchema.nullable(),
|
|
2133
2226
|
/** Coverage contract (#396) — points the answer must address; null = none declared. */
|
|
2134
|
-
points:
|
|
2227
|
+
points: z9.array(z9.string()).nullable(),
|
|
2135
2228
|
/** Whether the ask blocks the sender — what lets arbitration escalate it on silence. */
|
|
2136
|
-
blocking:
|
|
2229
|
+
blocking: z9.boolean(),
|
|
2137
2230
|
/** Reserved (docs/model/model.md lists it): a response deadline. No row column yet — a later Phase 2
|
|
2138
2231
|
* slice wires it; optional so today's rows/callers project cleanly. */
|
|
2139
|
-
deadline:
|
|
2232
|
+
deadline: z9.string().datetime().nullable().optional()
|
|
2140
2233
|
});
|
|
2141
|
-
var NotifyRequestFields =
|
|
2234
|
+
var NotifyRequestFields = z9.object({
|
|
2142
2235
|
/** Plaintext message content. Present on the plaintext path (today's shape);
|
|
2143
2236
|
* ABSENT on the E2EE path, where the sealed `envelope` below carries it. The
|
|
2144
2237
|
* superRefine at the bottom enforces exactly one of the two. */
|
|
2145
2238
|
context: ContextSchema.optional(),
|
|
2146
|
-
options:
|
|
2239
|
+
options: z9.array(OptionSchema.omit({ id: true }).extend({ label: z9.string().trim().min(1).max(1e3) }).strict()).min(OPTIONS_MIN).max(OPTIONS_MAX).optional().describe(
|
|
2147
2240
|
"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)."
|
|
2148
2241
|
),
|
|
2149
|
-
points:
|
|
2242
|
+
points: z9.array(z9.string().min(1)).optional().describe(
|
|
2150
2243
|
"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."
|
|
2151
2244
|
),
|
|
2152
|
-
visuals:
|
|
2245
|
+
visuals: z9.array(VisualSchema).optional().describe(
|
|
2153
2246
|
"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."
|
|
2154
2247
|
),
|
|
2155
2248
|
/** Git repo the agent is working in ("owner/name"). Local MCP fills this from the checkout — omit unless overriding. */
|
|
2156
|
-
repo:
|
|
2249
|
+
repo: z9.string().optional(),
|
|
2157
2250
|
/** Git branch the agent is on. Local MCP fills this from the checkout — omit unless overriding. */
|
|
2158
|
-
branch:
|
|
2251
|
+
branch: z9.string().optional(),
|
|
2159
2252
|
/** Continue an existing conversation — the id of any notification in it (its root
|
|
2160
2253
|
* is the conversation's identity). Omitted = start a new conversation. Renamed
|
|
2161
2254
|
* from `parentId` (2026-08-03): one linkage system, the parent; the API edge
|
|
2162
2255
|
* still accepts the old name from older clients. */
|
|
2163
|
-
parentId:
|
|
2256
|
+
parentId: z9.string().uuid().optional(),
|
|
2164
2257
|
/** The durable outcome this contact advances. Optional during the notification-to-Work
|
|
2165
2258
|
* migration; when present, a blocking ask creates a DecisionNeed for this Work. */
|
|
2166
|
-
workId:
|
|
2259
|
+
workId: z9.string().uuid().optional(),
|
|
2167
2260
|
/** Target Goal scope. During staged migration this is accepted by the shared contract but
|
|
2168
2261
|
* target delivery activation remains model-gated; workId and goalId are mutually exclusive. */
|
|
2169
|
-
goalId:
|
|
2262
|
+
goalId: z9.string().uuid().optional(),
|
|
2170
2263
|
urgency: NotifyLevelSchema.default("inbox").describe(
|
|
2171
2264
|
"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."
|
|
2172
2265
|
),
|
|
@@ -2174,7 +2267,7 @@ var NotifyRequestFields = z7.object({
|
|
|
2174
2267
|
* visible and marks it needs_input. Renamed from the old `parentId` (2026-08-03)
|
|
2175
2268
|
* when `parentId` became the conversation handle: `parentId` says WHERE, this
|
|
2176
2269
|
* says HOW. */
|
|
2177
|
-
clarifies:
|
|
2270
|
+
clarifies: z9.string().optional(),
|
|
2178
2271
|
select: SelectShapeSchema.optional().describe(
|
|
2179
2272
|
"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."
|
|
2180
2273
|
),
|
|
@@ -2188,20 +2281,20 @@ var NotifyRequestFields = z7.object({
|
|
|
2188
2281
|
// (docs/brain/broker/agenda-design.md) — not by a wire cap the agent has to pre-summarize under.
|
|
2189
2282
|
// Owner, 2026-07-28: "our actual limitation on how long something is to the user should
|
|
2190
2283
|
// come from the broker splitting and summarizing." The cap that remains is a size guard.
|
|
2191
|
-
ask:
|
|
2284
|
+
ask: z9.string().min(1).max(1e4).optional().describe(
|
|
2192
2285
|
'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.'
|
|
2193
2286
|
),
|
|
2194
|
-
needs:
|
|
2287
|
+
needs: z9.array(z9.string().min(1)).optional().describe(
|
|
2195
2288
|
"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."
|
|
2196
2289
|
),
|
|
2197
|
-
urgencyHint:
|
|
2290
|
+
urgencyHint: z9.enum(["whenever", "soon", "now"]).optional().describe(
|
|
2198
2291
|
"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."
|
|
2199
2292
|
),
|
|
2200
2293
|
/** #575: the ONE self-report that replaces urgencyHint + blocking — what happens
|
|
2201
2294
|
* to the agent's work while it waits. Normalized server-side into those two
|
|
2202
2295
|
* fields (normalizeWaiting) so everything downstream is untouched; explicit
|
|
2203
2296
|
* urgencyHint/blocking win when both are sent. */
|
|
2204
|
-
waiting:
|
|
2297
|
+
waiting: z9.enum(["none", "soft", "hard"]).optional().describe(
|
|
2205
2298
|
"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."
|
|
2206
2299
|
),
|
|
2207
2300
|
/** Δ9b (#895): HOLD this claim so the sender can correct the plan before anyone is
|
|
@@ -2209,98 +2302,98 @@ var NotifyRequestFields = z7.object({
|
|
|
2209
2302
|
* holding by default would charge every quiet claim that minute before any agent could
|
|
2210
2303
|
* correct anything. Ignored for `waiting: 'hard'`: a blocking ask rings on what we have,
|
|
2211
2304
|
* and the enrichment can still land mid-call (#781 re-plans the unspoken tail). */
|
|
2212
|
-
confirm:
|
|
2305
|
+
confirm: z9.boolean().optional().describe(
|
|
2213
2306
|
"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'."
|
|
2214
2307
|
),
|
|
2215
2308
|
/** #575: a RELAY of the user's explicitly stated preference, never the agent's
|
|
2216
2309
|
* choice. Outranks waiting in both directions: 'call' rings even for a
|
|
2217
2310
|
* waiting:'none' "call me when it's done"; 'message' never rings even for
|
|
2218
2311
|
* waiting:'hard'. */
|
|
2219
|
-
channel:
|
|
2312
|
+
channel: z9.enum(["call", "message"]).optional().describe(
|
|
2220
2313
|
"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."
|
|
2221
2314
|
),
|
|
2222
|
-
confirmStyle:
|
|
2315
|
+
confirmStyle: z9.enum(["yesno", "approve"]).default("yesno").describe(
|
|
2223
2316
|
"Labels for a select:'confirm' paige \u2014 'yesno' (Yes/No) or 'approve' (Approve/Deny). Ignored unless select is 'confirm'."
|
|
2224
2317
|
),
|
|
2225
|
-
blocking:
|
|
2318
|
+
blocking: z9.boolean().default(false).describe(
|
|
2226
2319
|
"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."
|
|
2227
2320
|
)
|
|
2228
2321
|
});
|
|
2229
2322
|
var NotifyRequestSchema = NotifyRequestFields.superRefine((r, ctx) => {
|
|
2230
|
-
if (r.workId && r.goalId) ctx.addIssue({ code:
|
|
2323
|
+
if (r.workId && r.goalId) ctx.addIssue({ code: z9.ZodIssueCode.custom, path: ["goalId"], message: "pass goalId or workId, not both" });
|
|
2231
2324
|
if (r.ask !== void 0) {
|
|
2232
2325
|
for (const f of ["context", "select", "points"]) {
|
|
2233
2326
|
if (r[f] !== void 0)
|
|
2234
|
-
ctx.addIssue({ code:
|
|
2327
|
+
ctx.addIssue({ code: z9.ZodIssueCode.custom, path: [f], message: `the simplified \`ask\` form takes no ${f} \u2014 the broker derives the answer shape from your prose. Drop ${f} and say it in \`ask\` instead ("should I\u2026" for approve/deny, "which of these\u2026" for a pick), passing \`options\` when you're offering concrete alternatives.` });
|
|
2235
2328
|
}
|
|
2236
2329
|
return;
|
|
2237
2330
|
}
|
|
2238
2331
|
if (r.needs !== void 0 || r.urgencyHint !== void 0)
|
|
2239
|
-
ctx.addIssue({ code:
|
|
2332
|
+
ctx.addIssue({ code: z9.ZodIssueCode.custom, path: ["needs"], message: "needs/urgencyHint belong to the simplified `ask` form \u2014 with a shaped request use points/urgency" });
|
|
2240
2333
|
if (!r.context)
|
|
2241
|
-
ctx.addIssue({ code:
|
|
2334
|
+
ctx.addIssue({ code: z9.ZodIssueCode.custom, path: ["context"], message: "context is required (plaintext path)" });
|
|
2242
2335
|
if (!r.select)
|
|
2243
|
-
ctx.addIssue({ code:
|
|
2336
|
+
ctx.addIssue({ code: z9.ZodIssueCode.custom, path: ["select"], message: "select is required on the shaped form" });
|
|
2244
2337
|
const needsOptions = r.select === "one" || r.select === "many" || r.select === "rank";
|
|
2245
2338
|
if (needsOptions && !r.options?.length)
|
|
2246
|
-
ctx.addIssue({ code:
|
|
2339
|
+
ctx.addIssue({ code: z9.ZodIssueCode.custom, path: ["options"], message: `select:'${r.select}' requires options` });
|
|
2247
2340
|
if (!needsOptions && r.options?.length)
|
|
2248
|
-
ctx.addIssue({ code:
|
|
2341
|
+
ctx.addIssue({ code: z9.ZodIssueCode.custom, path: ["options"], message: `select:'${r.select}' takes no options` });
|
|
2249
2342
|
});
|
|
2250
|
-
var NotifyStatusSchema =
|
|
2251
|
-
var AgentStateSchema =
|
|
2252
|
-
var TurnSchema =
|
|
2253
|
-
prompt:
|
|
2254
|
-
reply:
|
|
2343
|
+
var NotifyStatusSchema = z9.enum(["pending", "answered", "ignored"]);
|
|
2344
|
+
var AgentStateSchema = z9.enum(["idle", "in_progress", "completed", "needs_input"]);
|
|
2345
|
+
var TurnSchema = z9.object({
|
|
2346
|
+
prompt: z9.string(),
|
|
2347
|
+
reply: z9.string()
|
|
2255
2348
|
});
|
|
2256
|
-
var UserAnswerSchema =
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2349
|
+
var UserAnswerSchema = z9.discriminatedUnion("kind", [
|
|
2350
|
+
z9.object({ kind: z9.literal("option"), optionId: z9.string(), label: z9.string().optional() }),
|
|
2351
|
+
z9.object({ kind: z9.literal("text"), text: z9.string() }),
|
|
2352
|
+
z9.object({ kind: z9.literal("ignored") }),
|
|
2353
|
+
z9.object({ kind: z9.literal("multi"), optionIds: z9.array(z9.string()), labels: z9.array(z9.string()).optional() }),
|
|
2354
|
+
z9.object({ kind: z9.literal("ranked"), optionIds: z9.array(z9.string()), labels: z9.array(z9.string()).optional() }),
|
|
2355
|
+
z9.object({ kind: z9.literal("clarify"), chunks: z9.array(z9.string()).min(1) }),
|
|
2356
|
+
z9.object({ kind: z9.literal("confirm"), approved: z9.boolean() }),
|
|
2357
|
+
z9.object({ kind: z9.literal("turns"), turns: z9.array(TurnSchema).min(1) }),
|
|
2265
2358
|
/** An auto-answer derived from the user's PAST decisions (docs/brain/broker/precedent-design.md §2):
|
|
2266
2359
|
* delivered through the same settle/await path as a human answer, carrying the judge's
|
|
2267
2360
|
* derivation and the precedent ids it grew from. Always paired with a visible trail
|
|
2268
2361
|
* card the user can reply to — the broker never overrides the user. */
|
|
2269
|
-
|
|
2362
|
+
z9.object({ kind: z9.literal("precedent"), answer: z9.string(), derivation: z9.string(), sources: z9.array(z9.string()).min(1) })
|
|
2270
2363
|
]);
|
|
2271
|
-
var IntentSchema =
|
|
2364
|
+
var IntentSchema = z9.object({
|
|
2272
2365
|
// The full vocabulary the bot's mapper emits (mapper.INTENT_KINDS) — the schema lagged
|
|
2273
2366
|
// it by two ("detail", "feedback"), and because the settle handler parsed the array
|
|
2274
2367
|
// all-or-nothing, ONE feedback act silently dropped EVERY intent on the call,
|
|
2275
2368
|
// questions included. Found auditing five calls' stored feedback, 2026-08-01.
|
|
2276
|
-
kind:
|
|
2277
|
-
detail:
|
|
2369
|
+
kind: z9.enum(["defer", "delegate", "channel", "question", "detail", "feedback", "command", "control"]),
|
|
2370
|
+
detail: z9.string(),
|
|
2278
2371
|
/** Defer only: seconds until the callback the caller asked for, when something upstream
|
|
2279
2372
|
* already read the time. Nothing sets it today (#397 documented an MCP parser that was
|
|
2280
2373
|
* never written) — the API reads the defer's `detail` itself with `notes/when.ts`
|
|
2281
2374
|
* (`parseDelay`, #1292), and a value here simply wins over that reading. */
|
|
2282
|
-
dueInSeconds:
|
|
2375
|
+
dueInSeconds: z9.number().int().positive().optional(),
|
|
2283
2376
|
/** Feedback only (#812): WHICH failure the complaint names — typed by the mapper that
|
|
2284
2377
|
* already read the utterance, so `signals.kind` stops defaulting to
|
|
2285
2378
|
* 'other' on every row. A table that records that something was wrong and nothing
|
|
2286
2379
|
* about what cannot answer "is the bot looping less this week?". */
|
|
2287
|
-
fault:
|
|
2380
|
+
fault: z9.enum(["loop", "unanswered", "overridden", "misheard", "slow", "other"]).optional()
|
|
2288
2381
|
});
|
|
2289
|
-
var RideAlongSchema =
|
|
2382
|
+
var RideAlongSchema = z9.object({
|
|
2290
2383
|
/** The note this came from — assign/clarify/close it through /api/notes/:id. */
|
|
2291
|
-
noteId:
|
|
2384
|
+
noteId: z9.string(),
|
|
2292
2385
|
/** What to do, in the owner's own words (the note's headline). Never model-rewritten. */
|
|
2293
|
-
text:
|
|
2386
|
+
text: z9.string(),
|
|
2294
2387
|
/** The thread to report back on, when the note was dispatched over the request rail. */
|
|
2295
|
-
parentId:
|
|
2388
|
+
parentId: z9.string().nullable()
|
|
2296
2389
|
});
|
|
2297
|
-
var AwaitItemSchema =
|
|
2298
|
-
|
|
2299
|
-
type:
|
|
2300
|
-
parentId:
|
|
2301
|
-
notificationId:
|
|
2302
|
-
workId:
|
|
2303
|
-
decisionId:
|
|
2390
|
+
var AwaitItemSchema = z9.discriminatedUnion("type", [
|
|
2391
|
+
z9.object({
|
|
2392
|
+
type: z9.literal("reply"),
|
|
2393
|
+
parentId: z9.string(),
|
|
2394
|
+
notificationId: z9.string(),
|
|
2395
|
+
workId: z9.string().uuid().optional(),
|
|
2396
|
+
decisionId: z9.string().uuid().optional(),
|
|
2304
2397
|
answer: UserAnswerSchema,
|
|
2305
2398
|
/** WHAT THE AGENT CANNOT KNOW FROM THE FIELDS BESIDE IT (owner, 2026-09-04, issue
|
|
2306
2399
|
* #1537). One line, built from the record: the ask and the caller's reply VERBATIM,
|
|
@@ -2310,103 +2403,103 @@ var AwaitItemSchema = z7.discriminatedUnion("type", [
|
|
|
2310
2403
|
* "call me back after you merge" in their own words decides for itself what to do,
|
|
2311
2404
|
* and now knows exactly which call to make. Absent when either half is missing —
|
|
2312
2405
|
* a sentence with a hole in it is worse than no sentence. */
|
|
2313
|
-
note:
|
|
2406
|
+
note: z9.string().optional(),
|
|
2314
2407
|
/** The call record rendered for THIS agent (`docs/brain/voice/record-design.md`): the words the
|
|
2315
2408
|
* shaped answer was mapped from, filtered to its own claims. There is no second list
|
|
2316
2409
|
* of labels beside it — the acts went 2026-09-04 and `intents` went with them (owner,
|
|
2317
2410
|
* 2026-09-04): the agent reads the sentence and decides. */
|
|
2318
|
-
transcript:
|
|
2411
|
+
transcript: z9.string().optional(),
|
|
2319
2412
|
/** Coverage report (#396), when the ask declared `points`: which of them this
|
|
2320
2413
|
* answer addressed. Missing points = re-ask or proceed knowingly partial. */
|
|
2321
|
-
covered:
|
|
2414
|
+
covered: z9.array(z9.string()).optional(),
|
|
2322
2415
|
/** Ride-alongs (RideAlongSchema) — pending work for you, attached to the moment you
|
|
2323
2416
|
* became free. Only `reply` and `idle` carry it: those are the two outcomes that
|
|
2324
2417
|
* END a wait. `remind`, `superseded` and `turn` are mid-flight, and handing an
|
|
2325
2418
|
* agent a side-quest while it is still holding the line is how the main thing gets
|
|
2326
2419
|
* dropped. Absent/empty = nothing owed. */
|
|
2327
|
-
also:
|
|
2420
|
+
also: z9.array(RideAlongSchema).optional()
|
|
2328
2421
|
}),
|
|
2329
|
-
|
|
2330
|
-
type:
|
|
2331
|
-
parentId:
|
|
2332
|
-
notificationId:
|
|
2333
|
-
remindAt:
|
|
2422
|
+
z9.object({
|
|
2423
|
+
type: z9.literal("remind"),
|
|
2424
|
+
parentId: z9.string(),
|
|
2425
|
+
notificationId: z9.string(),
|
|
2426
|
+
remindAt: z9.string().datetime({ offset: true }),
|
|
2334
2427
|
/** Seconds until remindAt, server-computed — pass straight to ScheduleWakeup. */
|
|
2335
|
-
remindInSeconds:
|
|
2428
|
+
remindInSeconds: z9.number()
|
|
2336
2429
|
}),
|
|
2337
2430
|
/** The awaited ask was REPLACED by a newer notification on its thread (e.g. a
|
|
2338
2431
|
* post-feedback revision, #633) — the user will never answer this id. Stop
|
|
2339
2432
|
* awaiting it; the live ask is the thread's newest turn (await that one, or
|
|
2340
2433
|
* re-orient via contact({})). */
|
|
2341
|
-
|
|
2342
|
-
type:
|
|
2343
|
-
parentId:
|
|
2344
|
-
notificationId:
|
|
2434
|
+
z9.object({
|
|
2435
|
+
type: z9.literal("superseded"),
|
|
2436
|
+
parentId: z9.string(),
|
|
2437
|
+
notificationId: z9.string()
|
|
2345
2438
|
}),
|
|
2346
2439
|
/** A LIVE call's turn, streamed as it lands (#783). PROVISIONAL: the user can still
|
|
2347
2440
|
* revise any of these until the final reply arrives — partial = intelligence,
|
|
2348
2441
|
* settled = authorization. Use it to PREPARE (fetch, draft, warm), never to act
|
|
2349
2442
|
* irreversibly. If `acts` carries a question aimed at you and you know the answer,
|
|
2350
2443
|
* contact on the same thread right away — the caller hears it on the same call. */
|
|
2351
|
-
|
|
2352
|
-
type:
|
|
2353
|
-
notificationId:
|
|
2354
|
-
inFlight:
|
|
2355
|
-
turn:
|
|
2356
|
-
idx:
|
|
2357
|
-
prompt:
|
|
2358
|
-
reply:
|
|
2359
|
-
acts:
|
|
2444
|
+
z9.object({
|
|
2445
|
+
type: z9.literal("partial"),
|
|
2446
|
+
notificationId: z9.string(),
|
|
2447
|
+
inFlight: z9.literal(true),
|
|
2448
|
+
turn: z9.object({
|
|
2449
|
+
idx: z9.number(),
|
|
2450
|
+
prompt: z9.string(),
|
|
2451
|
+
reply: z9.string(),
|
|
2452
|
+
acts: z9.array(IntentSchema).nullable().optional()
|
|
2360
2453
|
})
|
|
2361
2454
|
}),
|
|
2362
|
-
|
|
2363
|
-
type:
|
|
2364
|
-
also:
|
|
2455
|
+
z9.object({
|
|
2456
|
+
type: z9.literal("idle"),
|
|
2457
|
+
also: z9.array(RideAlongSchema).optional(),
|
|
2365
2458
|
/** Is a call live for this agent's user right now? The SDK polls the partial stream
|
|
2366
2459
|
* (#783) between idle ticks ONLY while this is not `false` — a partial can only exist
|
|
2367
2460
|
* during a live call, and polling for one on a banner/message was a wasted HTTP call +
|
|
2368
2461
|
* 3 queries on every idle tick of every waiting agent (~80% of all traffic at scale).
|
|
2369
2462
|
* Absent = an older API → the SDK keeps polling, exactly as before. */
|
|
2370
|
-
inFlight:
|
|
2463
|
+
inFlight: z9.boolean().optional()
|
|
2371
2464
|
})
|
|
2372
2465
|
]);
|
|
2373
|
-
var VoiceKeySchema =
|
|
2374
|
-
var AgendaTurnSchema =
|
|
2466
|
+
var VoiceKeySchema = z9.enum(["rachel", "george", "jessica", "brian", "lily"]);
|
|
2467
|
+
var AgendaTurnSchema = z9.object({
|
|
2375
2468
|
/** THE TURN'S IDENTITY (the first-sentence stream, 2026-09-09): the brain call that wrote
|
|
2376
2469
|
* it and its place in that reply — `<brainCallId>:<index>`, with `:p` on the first
|
|
2377
2470
|
* sentence a re-plan publishes ahead of the rest. A turn is spoken once, by this id: the
|
|
2378
2471
|
* completion of a streamed re-plan carries the published sentence again, and the walk
|
|
2379
2472
|
* drops what it already said by identity, never by the API's guess of what was polled.
|
|
2380
2473
|
* Absent on plans nothing streams (a ring plan, a floor). */
|
|
2381
|
-
id:
|
|
2474
|
+
id: z9.string().optional(),
|
|
2382
2475
|
/** Twin coverage (#1089): sibling claim ids this asking turn's answer ALSO settles —
|
|
2383
2476
|
* the planner declares duplicates instead of asking them twice. */
|
|
2384
|
-
coveredIds:
|
|
2477
|
+
coveredIds: z9.array(z9.string()).optional(),
|
|
2385
2478
|
/** The spoken sentences of the turn, in order. No count: how long a turn is is the brain's call
|
|
2386
2479
|
* (owner, 2026-09-25), and a count here refused whole plans. */
|
|
2387
|
-
info:
|
|
2388
|
-
question:
|
|
2480
|
+
info: z9.array(z9.string().min(1)).default([]),
|
|
2481
|
+
question: z9.string().min(1).nullable(),
|
|
2389
2482
|
/** True on the one turn carrying the agent's own declared question. */
|
|
2390
|
-
asks:
|
|
2483
|
+
asks: z9.boolean().optional(),
|
|
2391
2484
|
/** The claim this turn belongs to (#781) — the RETURN identity: answers route by it.
|
|
2392
2485
|
* Absent on a single-claim plan (the session's own claim) and on shared context turns,
|
|
2393
2486
|
* which route nothing. */
|
|
2394
|
-
claimId:
|
|
2487
|
+
claimId: z9.string().optional(),
|
|
2395
2488
|
/** The claim's voice key (#462) — the OUTBOUND identity, audible who-is-asking. */
|
|
2396
|
-
voice:
|
|
2489
|
+
voice: z9.string().optional(),
|
|
2397
2490
|
/** The claim's AGENT NAME (#838) — the spoken identity. A voice alone doesn't say
|
|
2398
2491
|
* whose request this is: an item that folded in from another agent arrived as a bare
|
|
2399
2492
|
* non-sequitur ("First real production sign-in is yours to make whenever you want.")
|
|
2400
2493
|
* and the owner answered "What?". The bot names the agent before its first turn. */
|
|
2401
|
-
agent:
|
|
2494
|
+
agent: z9.string().optional(),
|
|
2402
2495
|
/** The claim's agent by ID — the pairing's connection id (`notifications.token_id`), the
|
|
2403
2496
|
* same id a face is minted from. A name is not an identity: two pairings may be called
|
|
2404
2497
|
* "Claude", and a name cannot be joined on. The record's entries carry it (`agent_id`)
|
|
2405
2498
|
* so "who said that" survives the call, and it rides PER TURN because a coalesced call
|
|
2406
2499
|
* speaks for several agents — the turn is the only place that knows which. */
|
|
2407
|
-
agentId:
|
|
2500
|
+
agentId: z9.string().optional(),
|
|
2408
2501
|
select: SelectShapeSchema.optional(),
|
|
2409
|
-
options:
|
|
2502
|
+
options: z9.array(OptionSchema.omit({ id: true })).optional(),
|
|
2410
2503
|
/* `pace` STOOD HERE (#826). A turn could carry seconds and the model chose them. The walk
|
|
2411
2504
|
paces itself now — a short beat between the sentences of a turn, the longer one at its end
|
|
2412
2505
|
(owner, 2026-09-30: "remove the bot deciding pace") — and it does that where the words are
|
|
@@ -2415,33 +2508,33 @@ var AgendaTurnSchema = z7.object({
|
|
|
2415
2508
|
/** Whether the walk WAITS for an answer before moving on. Absent = derived as today
|
|
2416
2509
|
* (a question blocks, context flows). blocking:false on a question = ask and move
|
|
2417
2510
|
* on, the claim stays pending; blocking:true on context = hold for a reply. */
|
|
2418
|
-
blocking:
|
|
2511
|
+
blocking: z9.boolean().optional(),
|
|
2419
2512
|
/** SPOKEN ONLY IF THEY SAY NOTHING (owner, 2026-10-01, call 812de935: "you're gonna re-ask, but it
|
|
2420
2513
|
* shouldn't be the same words … more like, hey, are you still there, or are you able to answer, or
|
|
2421
2514
|
* would you need more information"). The walk holds this turn out of its queue; at the queue's end it
|
|
2422
2515
|
* listens for the last word, and only if that listen is silent is this turn said and asked. If they
|
|
2423
2516
|
* speak, it is dropped and their words are taken like any reply. */
|
|
2424
|
-
ifSilent:
|
|
2517
|
+
ifSilent: z9.boolean().optional()
|
|
2425
2518
|
});
|
|
2426
2519
|
var CLAIM_STALE_MS = 30 * 6e4;
|
|
2427
|
-
var InboxItemSchema =
|
|
2428
|
-
id:
|
|
2429
|
-
tokenId:
|
|
2520
|
+
var InboxItemSchema = z9.object({
|
|
2521
|
+
id: z9.string(),
|
|
2522
|
+
tokenId: z9.string().optional(),
|
|
2430
2523
|
status: NotifyStatusSchema,
|
|
2431
2524
|
context: ContextSchema,
|
|
2432
|
-
options:
|
|
2525
|
+
options: z9.array(OptionSchema).optional(),
|
|
2433
2526
|
/** The ask's declared coverage points (#396), when the agent sent them. */
|
|
2434
|
-
points:
|
|
2527
|
+
points: z9.array(z9.string()).optional(),
|
|
2435
2528
|
/** Does this claim want an ANSWER, or is it telling you something? Written per row from
|
|
2436
2529
|
* `requestAsks` — the agent's own declaration, not a guess. `false` is what earns a card
|
|
2437
2530
|
* its acknowledge affordance: without it a status update offers a text box and a dismiss,
|
|
2438
2531
|
* and neither of those is "got it" (owner, 2026-08-10). */
|
|
2439
|
-
asks:
|
|
2532
|
+
asks: z9.boolean().optional(),
|
|
2440
2533
|
/** When a live process last pulsed for this row's agent — the liveness input for
|
|
2441
2534
|
* "working requires a pulse" (#928): the list said "Working…" from agent_state alone
|
|
2442
2535
|
* while the party called the same dead claim stalled. Absent = no token/no data,
|
|
2443
2536
|
* which must never CLAIM stalled. */
|
|
2444
|
-
lastSeenAt:
|
|
2537
|
+
lastSeenAt: z9.string().optional(),
|
|
2445
2538
|
/** WHEN THE AGENT LAST SAID ANYTHING ABOUT THIS CLAIM — the newest `agent_state` row in
|
|
2446
2539
|
* the `notification_events` ledger (trigger-written since 20260621010000, so every row a
|
|
2447
2540
|
* user can see has one). The age input for `CLAIM_STALE_MS`, and it has to be this rather
|
|
@@ -2451,7 +2544,7 @@ var InboxItemSchema = z7.object({
|
|
|
2451
2544
|
* work. Reading the row's birth as the claim's age brands that "No update in 8h" the
|
|
2452
2545
|
* instant the agent picks it up (#997). Absent = pre-trigger row; fall back to
|
|
2453
2546
|
* `createdAt`. */
|
|
2454
|
-
agentStateAt:
|
|
2547
|
+
agentStateAt: z9.string().datetime().optional(),
|
|
2455
2548
|
/** THE QUESTIONS A CALL CARRIES — the call screen's agenda spine (docs/clients/app/walk/design.md §11, owner
|
|
2456
2549
|
* 2026-09-22). One per DecisionNeed on the Call, in the Call's order, answered or open (a
|
|
2457
2550
|
* superseded or cancelled need is no longer a question anyone is asked). Present only on a
|
|
@@ -2465,54 +2558,61 @@ var InboxItemSchema = z7.object({
|
|
|
2465
2558
|
* `turn` topic (`asking`, `settled`), because the bot never sees a DecisionNeed id. `title` is
|
|
2466
2559
|
* the card's own concise heading; `answer` the accepted answer in words, null while open. It
|
|
2467
2560
|
* REPLACED `agenda` (turns), which nothing ever filled. */
|
|
2468
|
-
questions:
|
|
2469
|
-
id:
|
|
2470
|
-
entryId:
|
|
2471
|
-
title:
|
|
2472
|
-
state:
|
|
2473
|
-
answer:
|
|
2561
|
+
questions: z9.array(z9.object({
|
|
2562
|
+
id: z9.string(),
|
|
2563
|
+
entryId: z9.string(),
|
|
2564
|
+
title: z9.string(),
|
|
2565
|
+
state: z9.enum(["open", "answered"]),
|
|
2566
|
+
answer: z9.string().nullable(),
|
|
2474
2567
|
/** WHO ASKED IT (owner, 2026-09-23, Goal a345e906: each agenda row wears its agent's face) — the
|
|
2475
2568
|
* request Entry's author, as the same three facts the item's own `tokenId`/`name`/`voice`
|
|
2476
2569
|
* carry for the call's one agent, so the phone draws it with the same seed. Absent when the
|
|
2477
2570
|
* author is not an agent this account holds (unpaired since, or a person). */
|
|
2478
|
-
agent:
|
|
2571
|
+
agent: z9.object({ tokenId: z9.string(), name: z9.string(), voice: VoiceKeySchema.optional() }).optional(),
|
|
2479
2572
|
/** ITS OPTIONS, WHEN THERE IS SOMETHING TO SEE (owner, 2026-09-25: "Yes, add it"): the options
|
|
2480
2573
|
* its need offers, exactly as its own card carries them, present only when one of them has a
|
|
2481
2574
|
* preview (`html` or `image`). The call screen opens them from the agenda row, so a preview is
|
|
2482
|
-
* never re-sent as a second card to be seen mid-call. Words-only options are
|
|
2483
|
-
|
|
2484
|
-
|
|
2575
|
+
* never re-sent as a second card to be seen mid-call. Words-only options are `choices`. */
|
|
2576
|
+
options: z9.array(OptionSchema).optional(),
|
|
2577
|
+
/** ITS OPTIONS WHEN THEY ARE WORDS (owner, 2026-10-02, on a call: "whenever there are pre-made
|
|
2578
|
+
* options … now for a checklist, we should also show them on the screen"; design C, 2026-10-08):
|
|
2579
|
+
* numbered chips above the call's controls, so a checklist is never only something read aloud. A
|
|
2580
|
+
* field of its own so `options` keeps meaning "previews": a phone on an older bundle opens the
|
|
2581
|
+
* preview layout for any `options`, and must see exactly what it did. */
|
|
2582
|
+
choices: z9.array(OptionSchema).optional(),
|
|
2583
|
+
/** HOW MANY MAY BE PICKED, beside its `choices`: one, any (`many`) or an order (`rank`). */
|
|
2584
|
+
select: z9.enum(["one", "many", "rank"]).optional()
|
|
2485
2585
|
})).optional(),
|
|
2486
|
-
visuals:
|
|
2586
|
+
visuals: z9.array(VisualSchema).optional(),
|
|
2487
2587
|
/** The connected agent's name (the single pairing name — user-typed, or the
|
|
2488
2588
|
* agent's suggestion, or a default silly name). */
|
|
2489
|
-
name:
|
|
2589
|
+
name: z9.string(),
|
|
2490
2590
|
/** The pairing's assigned voice (#462); absent = the default voice. */
|
|
2491
2591
|
voice: VoiceKeySchema.optional(),
|
|
2492
|
-
repo:
|
|
2493
|
-
branch:
|
|
2494
|
-
createdAt:
|
|
2495
|
-
snoozedUntil:
|
|
2592
|
+
repo: z9.string().optional(),
|
|
2593
|
+
branch: z9.string().optional(),
|
|
2594
|
+
createdAt: z9.string().datetime(),
|
|
2595
|
+
snoozedUntil: z9.string().datetime().optional(),
|
|
2496
2596
|
agentState: AgentStateSchema.default("idle"),
|
|
2497
2597
|
/** Whose action the item is waiting on: "you" = an agent asked you (the default,
|
|
2498
2598
|
* every agent→user notification); "agent" = you sent a request and it's awaiting the
|
|
2499
2599
|
* agent (held in the inbox until the agent replies on the thread). */
|
|
2500
|
-
turn:
|
|
2600
|
+
turn: z9.enum(["you", "agent"]).default("you"),
|
|
2501
2601
|
/** Hard error reason on an awaiting request (turn="agent") — the wake failed to reach
|
|
2502
2602
|
* the agent (provider-agnostic; set server-side). Absent = no hard error. Drives the inbox
|
|
2503
2603
|
* error badge + Retry. */
|
|
2504
|
-
error:
|
|
2604
|
+
error: z9.string().optional(),
|
|
2505
2605
|
/** WHEN THIS AGENT WORK WENT QUIET (turn="agent"), by the one rule (`coldSince`: three days
|
|
2506
2606
|
* with nothing said), or absent while it is not stalled. The inbox's stalled badge reads
|
|
2507
2607
|
* this and nothing else (2026-09-23: a 3-minute age rule badged every live Goal stalled,
|
|
2508
2608
|
* and "dismiss the stalled ones" cancelled 37 pieces of live work). */
|
|
2509
|
-
cold:
|
|
2510
|
-
clarifies:
|
|
2609
|
+
cold: z9.string().datetime().optional(),
|
|
2610
|
+
clarifies: z9.string().optional(),
|
|
2511
2611
|
/** THIS CARD'S QUESTION IS ON A LIVE CALL (owner, 2026-09-24: "Mark it while the call is
|
|
2512
2612
|
* live"). Present only while an open Call Delivery carries the card's request Entry — read
|
|
2513
2613
|
* off the same open list the card came from, so it clears when the Call does. A card is the
|
|
2514
2614
|
* backup for a call not taken; while the call has it, the call is where it is answered. */
|
|
2515
|
-
onCall:
|
|
2615
|
+
onCall: z9.literal(true).optional(),
|
|
2516
2616
|
/** THE RING, ON THE ITEM (docs/clients/app/walk/design.md §12 §17, #2251): the last ring on this card was
|
|
2517
2617
|
* declined, and what the ladder will do next — read off the cron's own row, never computed
|
|
2518
2618
|
* on the phone. Present only while a `declined` receipt stands on the card's last Call.
|
|
@@ -2522,31 +2622,31 @@ var InboxItemSchema = z7.object({
|
|
|
2522
2622
|
* It replaced `gaveUp` (deleted 2026-09-22): "the ladder spent" was a boolean the projection
|
|
2523
2623
|
* never set, and it is `nextRingAt === null` here — the party's *Missed you* (`party/dress.ts`)
|
|
2524
2624
|
* and the roster's `unreached` read `declinedAt`, and stand while it does. */
|
|
2525
|
-
ring:
|
|
2526
|
-
declinedAt:
|
|
2527
|
-
anchorAt:
|
|
2528
|
-
nextRingAt:
|
|
2529
|
-
step:
|
|
2625
|
+
ring: z9.object({
|
|
2626
|
+
declinedAt: z9.string().datetime(),
|
|
2627
|
+
anchorAt: z9.string().datetime(),
|
|
2628
|
+
nextRingAt: z9.string().datetime().nullable(),
|
|
2629
|
+
step: z9.number().int()
|
|
2530
2630
|
}).optional(),
|
|
2531
2631
|
/** Why this arrived the way it did, read back off the delivery receipt (`notify/why.ts`).
|
|
2532
2632
|
* Absent for anything never delivered through a push, and for older rows written before
|
|
2533
2633
|
* the reason was recorded. Deliberately a debug affordance, shown small (owner,
|
|
2534
2634
|
* 2026-08-07) — its real job is to give "this didn't need a call" something to be
|
|
2535
2635
|
* feedback ABOUT. */
|
|
2536
|
-
why:
|
|
2636
|
+
why: z9.object({
|
|
2537
2637
|
asked: NotifyLevelSchema,
|
|
2538
2638
|
got: NotifyLevelSchema,
|
|
2539
|
-
because:
|
|
2540
|
-
line:
|
|
2639
|
+
because: z9.enum(["unresponsive", "dismissed", "not_permitted", "silent", "coalesced", "agent_capped", "unplanned", "learned_raise"]).optional(),
|
|
2640
|
+
line: z9.string()
|
|
2541
2641
|
}).optional(),
|
|
2542
|
-
select:
|
|
2543
|
-
confirmStyle:
|
|
2642
|
+
select: z9.enum(["one", "many", "rank", "confirm", "text"]).default("one"),
|
|
2643
|
+
confirmStyle: z9.enum(["yesno", "approve"]).default("yesno").describe(
|
|
2544
2644
|
"Labels for a select:'confirm' paige \u2014 'yesno' (Yes/No) or 'approve' (Approve/Deny). Ignored unless select is 'confirm'."
|
|
2545
2645
|
),
|
|
2546
2646
|
/** Real downstream work is stuck behind this one — set by the agent, independent of
|
|
2547
2647
|
* urgency (see the main README's "premier use case" + docs/delivery/notify/states.md). Drives the
|
|
2548
2648
|
* inbox's blocking badge and the extra confirm step before dismissing it. */
|
|
2549
|
-
blocking:
|
|
2649
|
+
blocking: z9.boolean().default(false),
|
|
2550
2650
|
/** The user's locked-in answer; present only for replied items (GET /api/replied/:id). */
|
|
2551
2651
|
answer: UserAnswerSchema.optional(),
|
|
2552
2652
|
/** THE TARGET FACTS A CARD RENDERS (#1796 point 5, 2026-09-11): the Delivery it is a view of,
|
|
@@ -2554,17 +2654,17 @@ var InboxItemSchema = z7.object({
|
|
|
2554
2654
|
* for a request that asks nothing), whether its content is sealed, and that Goal's state. The
|
|
2555
2655
|
* answer writer (`POST /api/entries`) and the disposition (`close_delivery`) take their ids from
|
|
2556
2656
|
* here. The server projects it (`apps/api/src/inbox/project.ts`); a client never builds it. */
|
|
2557
|
-
communication:
|
|
2558
|
-
deliveryId:
|
|
2559
|
-
kind:
|
|
2560
|
-
entryId:
|
|
2561
|
-
goalIds:
|
|
2562
|
-
decisionNeedId:
|
|
2563
|
-
sealed:
|
|
2564
|
-
goalState:
|
|
2657
|
+
communication: z9.object({
|
|
2658
|
+
deliveryId: z9.string(),
|
|
2659
|
+
kind: z9.enum(["notification", "call"]),
|
|
2660
|
+
entryId: z9.string(),
|
|
2661
|
+
goalIds: z9.array(z9.string()),
|
|
2662
|
+
decisionNeedId: z9.string().optional(),
|
|
2663
|
+
sealed: z9.boolean(),
|
|
2664
|
+
goalState: z9.string().optional(),
|
|
2565
2665
|
/** THAT GOAL'S NAME (#2416) — what Activity's row is headed by, since a row there is one Goal
|
|
2566
2666
|
* and the cards it holds sit behind it. Stamped by the same read as `goalState`. */
|
|
2567
|
-
goalTitle:
|
|
2667
|
+
goalTitle: z9.string().optional()
|
|
2568
2668
|
}).optional(),
|
|
2569
2669
|
/** WHAT THIS CARD IS, IN TWELVE CHARACTERS (#3019) — the hash of every other field on it, stamped
|
|
2570
2670
|
* by the one read that serves the open list (`apps/api/src/inbox/project.ts` `inboxFor`). It is
|
|
@@ -2576,27 +2676,27 @@ var InboxItemSchema = z7.object({
|
|
|
2576
2676
|
* own moves (its Goal's state and name, how cold the work behind it has gone, whether a ring is
|
|
2577
2677
|
* live). Optional, so a fixture, the demo and the archive lens need not spell one, and a card
|
|
2578
2678
|
* with no rev is simply always re-sent. */
|
|
2579
|
-
rev:
|
|
2679
|
+
rev: z9.string().optional()
|
|
2580
2680
|
});
|
|
2581
2681
|
var APNS_TOKEN_RE = /^[0-9a-fA-F]{64}$/;
|
|
2582
|
-
var PushTokenSchema =
|
|
2583
|
-
voipToken:
|
|
2584
|
-
alertToken:
|
|
2585
|
-
fcmToken:
|
|
2586
|
-
platform:
|
|
2682
|
+
var PushTokenSchema = z9.object({
|
|
2683
|
+
voipToken: z9.string().min(1).optional(),
|
|
2684
|
+
alertToken: z9.string().min(1).optional(),
|
|
2685
|
+
fcmToken: z9.string().min(1).optional(),
|
|
2686
|
+
platform: z9.enum(["ios", "android"])
|
|
2587
2687
|
}).superRefine((v, ctx) => {
|
|
2588
2688
|
if (v.platform !== "ios") return;
|
|
2589
2689
|
for (const field of ["voipToken", "alertToken"]) {
|
|
2590
2690
|
const token = v[field];
|
|
2591
2691
|
if (token === void 0 || APNS_TOKEN_RE.test(token)) continue;
|
|
2592
2692
|
ctx.addIssue({
|
|
2593
|
-
code:
|
|
2693
|
+
code: z9.ZodIssueCode.custom,
|
|
2594
2694
|
path: [field],
|
|
2595
2695
|
message: `not an APNs device token (want 64 hex chars, got ${token.length})`
|
|
2596
2696
|
});
|
|
2597
2697
|
}
|
|
2598
2698
|
});
|
|
2599
|
-
var MissedCallSchema =
|
|
2699
|
+
var MissedCallSchema = z9.enum([
|
|
2600
2700
|
"retry_10m",
|
|
2601
2701
|
"retry_30m",
|
|
2602
2702
|
"retry_60m",
|
|
@@ -2608,31 +2708,31 @@ var MissedCallSchema = z7.enum([
|
|
|
2608
2708
|
]);
|
|
2609
2709
|
var clock = (h) => h === 0 ? "midnight" : h === 12 ? "noon" : h < 12 ? `${h} am` : `${h - 12} pm`;
|
|
2610
2710
|
var QUIET = ` Nothing rings from ${clock(NIGHT.from)} to ${clock(NIGHT.to)} your time; the count waits for morning.`;
|
|
2611
|
-
var BrokerTuningSchema =
|
|
2711
|
+
var BrokerTuningSchema = z9.object({
|
|
2612
2712
|
/** 'none' = skip the spoken ack after a mapped answer (power users find it slow). */
|
|
2613
|
-
ackVerbosity:
|
|
2713
|
+
ackVerbosity: z9.enum(["normal", "none"]).optional(),
|
|
2614
2714
|
/** How readily the mapper asks its one clarification: 'low' = only when truly
|
|
2615
2715
|
* uninterpretable, 'high' = whenever not fully certain. */
|
|
2616
|
-
clarifyEagerness:
|
|
2716
|
+
clarifyEagerness: z9.enum(["low", "normal", "high"]).optional(),
|
|
2617
2717
|
/** The user's own shorthand: when they say `say`, they mean `mean`. */
|
|
2618
|
-
phrasebook:
|
|
2718
|
+
phrasebook: z9.array(z9.object({ say: z9.string().min(1).max(60), mean: z9.string().min(1).max(120) })).max(24).optional(),
|
|
2619
2719
|
/** The language calls are PLANNED in, when the account has chosen one (#1272). Absent —
|
|
2620
2720
|
* which is every account today — means the agent's own words decide, per ask: a call
|
|
2621
2721
|
* about an English ask opens in English. This is the only thing that overrides that,
|
|
2622
2722
|
* and a live caller who switches language mid-call still outranks it (broker/lang.ts).
|
|
2623
2723
|
* Set per user (no UI yet), like `voiceTuning`. */
|
|
2624
|
-
language:
|
|
2724
|
+
language: z9.enum(["en", "es"]).optional()
|
|
2625
2725
|
});
|
|
2626
|
-
var UserSettingsSchema =
|
|
2627
|
-
permissions:
|
|
2628
|
-
call:
|
|
2629
|
-
banner:
|
|
2630
|
-
push:
|
|
2726
|
+
var UserSettingsSchema = z9.object({
|
|
2727
|
+
permissions: z9.object({
|
|
2728
|
+
call: z9.boolean(),
|
|
2729
|
+
banner: z9.boolean(),
|
|
2730
|
+
push: z9.boolean()
|
|
2631
2731
|
}),
|
|
2632
2732
|
/** LockedIn / Default / DateNight on screen; the stored words are unchanged on purpose —
|
|
2633
2733
|
* they are an enum on a live column across every account, and the rename is a rename of
|
|
2634
2734
|
* what people read (owner, 2026-09-30). */
|
|
2635
|
-
sessionMode:
|
|
2735
|
+
sessionMode: z9.enum(["default", "all_calls", "silent"]),
|
|
2636
2736
|
/** `silentPush` lived here until #2813 and is now GONE, field and column both. It was kept as an
|
|
2637
2737
|
* optional long after DateNight stopped reading it, on the theory that a phone on an older
|
|
2638
2738
|
* bundle PATCHing the whole settings object would be REFUSED for sending a key we had stopped
|
|
@@ -2641,7 +2741,7 @@ var UserSettingsSchema = z7.object({
|
|
|
2641
2741
|
* an old bundle's `silentPush` is accepted and ignored. Worth remembering before keeping the
|
|
2642
2742
|
* next dead field for the same reason. */
|
|
2643
2743
|
/** Opt-in (default false) to using your content to improve Paigy and train models. */
|
|
2644
|
-
improveConsent:
|
|
2744
|
+
improveConsent: z9.boolean(),
|
|
2645
2745
|
missedCall: MissedCallSchema.default("backoff_standard"),
|
|
2646
2746
|
/** Where voice audio is processed. 'hosted' (default) = Paigy's voice services
|
|
2647
2747
|
* (ElevenLabs TTS, faster-whisper STT, the call bot); 'on_device' = the phone
|
|
@@ -2649,17 +2749,17 @@ var UserSettingsSchema = z7.object({
|
|
|
2649
2749
|
* Optional, NOT defaulted: a stale client PATCHing the full settings object
|
|
2650
2750
|
* must not silently reset this privacy choice. Absent = leave unchanged on
|
|
2651
2751
|
* write, 'hosted' on read (see store.ts). */
|
|
2652
|
-
voiceMode:
|
|
2752
|
+
voiceMode: z9.enum(["hosted", "on_device"]).optional(),
|
|
2653
2753
|
/** Talk — after you answer, the next step is read aloud (docs/clients/app/walk/design.md §6). ALWAYS ON until
|
|
2654
2754
|
* turned off (owner, 2026-09-18, #2249): a setting, not a per-walk toggle. Optional, NOT
|
|
2655
2755
|
* defaulted, for the same reason `voiceMode` is: a stale client PATCHing the full settings
|
|
2656
2756
|
* object must not silently turn it back on. Absent = leave unchanged on write, true on
|
|
2657
2757
|
* read (see store.ts). */
|
|
2658
|
-
talk:
|
|
2758
|
+
talk: z9.boolean().optional(),
|
|
2659
2759
|
/** CALL DIAGNOSTICS (owner, 2026-10-01): the call report carries each listen and the bot's own
|
|
2660
2760
|
* load timings. SERVER-SET, no UI — on for every account that existed on 2026-10-01, off for
|
|
2661
2761
|
* newer ones (migration 20261001132859). Read-only here: the settings PATCH never writes it. */
|
|
2662
|
-
callDiagnostics:
|
|
2762
|
+
callDiagnostics: z9.boolean().optional(),
|
|
2663
2763
|
/** Per-user ring budget (#603): calls per rolling day before further calls
|
|
2664
2764
|
* degrade to banner. Absent = the global default (25). A number, never a
|
|
2665
2765
|
* bypass — every account keeps a ceiling. No UI; set per user for testing. */
|
|
@@ -2667,7 +2767,7 @@ var UserSettingsSchema = z7.object({
|
|
|
2667
2767
|
* payload['tuning'] (e.g. { silence_s: 3.5 } — a longer pause window for a
|
|
2668
2768
|
* slower speaker). No API-side semantics; the bot resolves each key with its
|
|
2669
2769
|
* own defaults. Set per user (no UI yet); absent = bot defaults. */
|
|
2670
|
-
voiceTuning:
|
|
2770
|
+
voiceTuning: z9.record(z9.string(), z9.union([z9.number(), z9.string()])).optional(),
|
|
2671
2771
|
/** The user's IANA timezone (e.g. "America/Bogota"), recorded by the app — it is the
|
|
2672
2772
|
* only party that knows it. REMINDERS are why it exists: "remind me at ten" becomes
|
|
2673
2773
|
* an absolute `due_at` only if we know whose ten. Optional and never defaulted, for
|
|
@@ -2676,53 +2776,53 @@ var UserSettingsSchema = z7.object({
|
|
|
2676
2776
|
* that failure reads as the reminder rail being unreliable rather than as a missing
|
|
2677
2777
|
* setting. Absent = a spoken time can't be landed, so the reminder rides the next
|
|
2678
2778
|
* call — honest about what we know. */
|
|
2679
|
-
timezone:
|
|
2779
|
+
timezone: z9.string().min(1).max(64).optional(),
|
|
2680
2780
|
/** Rung-2 broker tuning (#381). Optional and NOT defaulted, same stale-client
|
|
2681
2781
|
* clobber guard as voiceMode: absent = leave unchanged on write. */
|
|
2682
2782
|
broker: BrokerTuningSchema.optional()
|
|
2683
2783
|
});
|
|
2684
|
-
var HistoryWorkSchema =
|
|
2685
|
-
id:
|
|
2686
|
-
title:
|
|
2687
|
-
state:
|
|
2784
|
+
var HistoryWorkSchema = z9.object({
|
|
2785
|
+
id: z9.string(),
|
|
2786
|
+
title: z9.string(),
|
|
2787
|
+
state: z9.enum(["done", "cancelled"]),
|
|
2688
2788
|
/** Who held it (`agent:<tokenId>` or `human:<userId>`). */
|
|
2689
|
-
assignee:
|
|
2789
|
+
assignee: z9.string()
|
|
2690
2790
|
});
|
|
2691
|
-
var HistoryEntrySchema =
|
|
2692
|
-
|
|
2693
|
-
|
|
2791
|
+
var HistoryEntrySchema = z9.union([
|
|
2792
|
+
z9.object({ at: z9.string(), card: InboxItemSchema }),
|
|
2793
|
+
z9.object({ at: z9.string(), work: HistoryWorkSchema })
|
|
2694
2794
|
]);
|
|
2695
|
-
var HistoryPageSchema =
|
|
2696
|
-
entries:
|
|
2697
|
-
next:
|
|
2795
|
+
var HistoryPageSchema = z9.object({
|
|
2796
|
+
entries: z9.array(HistoryEntrySchema),
|
|
2797
|
+
next: z9.string().nullable()
|
|
2698
2798
|
});
|
|
2699
2799
|
var ACTIVITY_LINES = 2;
|
|
2700
2800
|
var ACTIVITY_LINE_MAX = 80;
|
|
2701
|
-
var AgentActivitySchema =
|
|
2801
|
+
var AgentActivitySchema = z9.object({
|
|
2702
2802
|
/** Oldest first, so the newest line is last — the one that replaces in place. */
|
|
2703
|
-
lines:
|
|
2803
|
+
lines: z9.array(z9.string().max(ACTIVITY_LINE_MAX)).max(ACTIVITY_LINES),
|
|
2704
2804
|
/** When the harness observed this tail. Its own timestamp, not the heartbeat's: a beat
|
|
2705
2805
|
* that carries an UNCHANGED tail must not make a stalled agent look like it just moved. */
|
|
2706
|
-
at:
|
|
2806
|
+
at: z9.string().datetime()
|
|
2707
2807
|
});
|
|
2708
|
-
var ConnectionSummarySchema =
|
|
2808
|
+
var ConnectionSummarySchema = z9.object({
|
|
2709
2809
|
/** The connection = the agent's token id (used to address a request). */
|
|
2710
|
-
id:
|
|
2810
|
+
id: z9.string(),
|
|
2711
2811
|
/** The credential kind: "device" = a paired machine (mint-only — it hosts and mints, it
|
|
2712
2812
|
* never talks); "agent" = an identity that sends. The roster and devices surfaces split
|
|
2713
2813
|
* on this. Optional/absent reads as "agent" (a row predating the kind column). See
|
|
2714
2814
|
* docs/server/tokens/devices-vs-agents-design.md. */
|
|
2715
|
-
kind:
|
|
2815
|
+
kind: z9.enum(["device", "agent"]).optional(),
|
|
2716
2816
|
/** For an agent, the token id of the DEVICE that minted it — so agents group under their
|
|
2717
2817
|
* machine, and revoking a device cascades to them. Null on devices, and on unlinked
|
|
2718
2818
|
* agents (phone-launched, provider-managed, or minted before the link existed). */
|
|
2719
|
-
mintedByDevice:
|
|
2720
|
-
device:
|
|
2819
|
+
mintedByDevice: z9.string().nullable().optional(),
|
|
2820
|
+
device: z9.string().nullable(),
|
|
2721
2821
|
/** The agent's display name (the single pairing name). */
|
|
2722
|
-
name:
|
|
2822
|
+
name: z9.string(),
|
|
2723
2823
|
/** For a managed connection, the provider key (e.g. "cma") that agentOrigin maps to a
|
|
2724
2824
|
* label; null for a local connection. Sourced from the token's provider, not the name. */
|
|
2725
|
-
provider:
|
|
2825
|
+
provider: z9.string().nullable(),
|
|
2726
2826
|
/** The pairing's assigned voice (#462); null = the default voice. */
|
|
2727
2827
|
voice: VoiceKeySchema.nullable(),
|
|
2728
2828
|
/** The LOUDEST this agent may ever reach you — a ceiling on `NOTIFY_LADDER`, set by the
|
|
@@ -2733,34 +2833,34 @@ var ConnectionSummarySchema = z7.object({
|
|
|
2733
2833
|
* every surface at once and outranks even `sessionMode: all_calls` — a mode the user
|
|
2734
2834
|
* set once must not overrule a rule they set about one agent. */
|
|
2735
2835
|
reach: NotifyLevelSchema.nullable().optional(),
|
|
2736
|
-
createdAt:
|
|
2836
|
+
createdAt: z9.string().datetime(),
|
|
2737
2837
|
/** Most recent notification on this connection, either direction. Null = no contact yet.
|
|
2738
2838
|
* Drives the agents-page recency grouping (Today / This week / …). */
|
|
2739
|
-
lastContactAt:
|
|
2839
|
+
lastContactAt: z9.string().datetime().nullable(),
|
|
2740
2840
|
/** Last presence heartbeat from a running agent process (POST /api/presence) — the
|
|
2741
2841
|
* desktop app while open. Null = never seen; stale = offline. */
|
|
2742
|
-
lastSeenAt:
|
|
2842
|
+
lastSeenAt: z9.string().datetime().nullable().optional(),
|
|
2743
2843
|
/** WORKING, NOT JUST CONNECTED (owner, 2026-09-30): the last time the agent itself acted on one of
|
|
2744
2844
|
* its Goals — wrote on one or recorded an operation (`tokens.last_worked_at`). Within
|
|
2745
2845
|
* `WORKING_MS` it is working; otherwise it is connected but idle. Null = not seen working yet. */
|
|
2746
|
-
lastWorkedAt:
|
|
2846
|
+
lastWorkedAt: z9.string().datetime().nullable().optional(),
|
|
2747
2847
|
/** The oldest of its Goals that is `ready` for it — work handed to it that nobody has started.
|
|
2748
2848
|
* With no work of its own for `WORKING_MS`, an agent sitting on this is not taking its work. */
|
|
2749
|
-
oldestReadyAt:
|
|
2849
|
+
oldestReadyAt: z9.string().datetime().nullable().optional(),
|
|
2750
2850
|
/** What a live desktop can run (docs/clients/desktop/companion.md §2.2), advertised on its heartbeat:
|
|
2751
2851
|
* harness availabilities + granted workspaces — the option set the phone's
|
|
2752
2852
|
* "new session" sheet offers. Absent for ordinary MCP agents. */
|
|
2753
|
-
runtime:
|
|
2853
|
+
runtime: z9.object({
|
|
2754
2854
|
/** The @paigy/harness this host is running — a machine the self-update has not reached
|
|
2755
2855
|
* shows its age here (`apps/desktop/src/update.ts`). */
|
|
2756
|
-
version:
|
|
2757
|
-
harnesses:
|
|
2758
|
-
workspaces:
|
|
2856
|
+
version: z9.string().optional(),
|
|
2857
|
+
harnesses: z9.array(z9.object({ name: z9.string(), label: z9.string(), status: z9.string() })).optional(),
|
|
2858
|
+
workspaces: z9.array(z9.string()).optional(),
|
|
2759
2859
|
/** THE GIT REPOS IN THOSE FOLDERS (2026-10-01, Goal 26982211): each granted folder that is a
|
|
2760
2860
|
* repo, and each repo directly inside one, with its `origin` remote. A session started for
|
|
2761
2861
|
* work on `mauurda/paigy` opens in that repo rather than the folder above it, where the repo's
|
|
2762
2862
|
* own AGENTS.md is never read (`workspaceForRepo`). Absent on hosts that predate it. */
|
|
2763
|
-
repos:
|
|
2863
|
+
repos: z9.array(z9.object({ path: z9.string(), remote: z9.string() })).optional()
|
|
2764
2864
|
}).optional(),
|
|
2765
2865
|
/** The tail of this agent's working log, when a harness is driving it — the agent page's
|
|
2766
2866
|
* live strip. Absent for anything the desktop harness isn't running (a hatched identity
|
|
@@ -2769,156 +2869,156 @@ var ConnectionSummarySchema = z7.object({
|
|
|
2769
2869
|
activity: AgentActivitySchema.optional(),
|
|
2770
2870
|
/** True = a provider-managed agent running in the provider's cloud (e.g. Anthropic CMA);
|
|
2771
2871
|
* false = a local MCP connection running on the user's computer (Claude Code/Codex/…). */
|
|
2772
|
-
managed:
|
|
2872
|
+
managed: z9.boolean()
|
|
2773
2873
|
});
|
|
2774
|
-
var LedgerItemSchema =
|
|
2775
|
-
var AgentLedgerSchema =
|
|
2874
|
+
var LedgerItemSchema = z9.object({ id: z9.string(), parentId: z9.string(), title: z9.string(), createdAt: z9.string() });
|
|
2875
|
+
var AgentLedgerSchema = z9.object({
|
|
2776
2876
|
/** Null when the agent has not named itself yet — never a placeholder (owner, 2026-10-01). */
|
|
2777
|
-
agent:
|
|
2877
|
+
agent: z9.object({ id: z9.string(), name: z9.string().nullable(), revokedAt: z9.string().nullable() }),
|
|
2778
2878
|
/** Its own questions you have not answered. */
|
|
2779
|
-
asks:
|
|
2879
|
+
asks: z9.array(LedgerItemSchema),
|
|
2780
2880
|
/** Its questions you answered that nobody acted on — still owed to somebody. */
|
|
2781
|
-
answered:
|
|
2881
|
+
answered: z9.array(LedgerItemSchema),
|
|
2782
2882
|
/** Requests you sent it that it never took. */
|
|
2783
|
-
requests:
|
|
2784
|
-
goals:
|
|
2785
|
-
callbacks:
|
|
2883
|
+
requests: z9.array(LedgerItemSchema),
|
|
2884
|
+
goals: z9.array(z9.object({ id: z9.string(), outcome: z9.string(), state: z9.string() })),
|
|
2885
|
+
callbacks: z9.array(z9.object({ id: z9.string(), parentId: z9.string(), trigger: z9.string(), note: z9.string(), dueAt: z9.string().nullable() }))
|
|
2786
2886
|
});
|
|
2787
|
-
var ReassignResultSchema =
|
|
2788
|
-
moved:
|
|
2789
|
-
parentId:
|
|
2887
|
+
var ReassignResultSchema = z9.object({
|
|
2888
|
+
moved: z9.object({ asks: z9.number(), answered: z9.number(), requests: z9.number(), goals: z9.number(), callbacks: z9.number() }),
|
|
2889
|
+
parentId: z9.string().nullable()
|
|
2790
2890
|
});
|
|
2791
|
-
var LessonStateSchema =
|
|
2792
|
-
var LessonViewSchema =
|
|
2793
|
-
id:
|
|
2794
|
-
text:
|
|
2891
|
+
var LessonStateSchema = z9.enum(["active", "proposed", "retired"]);
|
|
2892
|
+
var LessonViewSchema = z9.object({
|
|
2893
|
+
id: z9.string(),
|
|
2894
|
+
text: z9.string(),
|
|
2795
2895
|
state: LessonStateSchema,
|
|
2796
2896
|
/** The Goal it is scoped to; null = the whole account. */
|
|
2797
|
-
scopeGoalId:
|
|
2798
|
-
goalTitle:
|
|
2799
|
-
version:
|
|
2800
|
-
pinned:
|
|
2897
|
+
scopeGoalId: z9.string().nullable(),
|
|
2898
|
+
goalTitle: z9.string().nullable(),
|
|
2899
|
+
version: z9.number(),
|
|
2900
|
+
pinned: z9.boolean(),
|
|
2801
2901
|
/** When the person last wrote its text themselves. */
|
|
2802
|
-
editedAt:
|
|
2803
|
-
createdAt:
|
|
2804
|
-
updatedAt:
|
|
2902
|
+
editedAt: z9.string().nullable(),
|
|
2903
|
+
createdAt: z9.string(),
|
|
2904
|
+
updatedAt: z9.string(),
|
|
2805
2905
|
/** The Entries it came from, oldest first; `words` is null when an Entry has none to show (sealed). */
|
|
2806
|
-
sources:
|
|
2906
|
+
sources: z9.array(z9.object({ entryId: z9.string(), words: z9.string().nullable(), at: z9.string() }))
|
|
2807
2907
|
});
|
|
2808
|
-
var QueueQuestionSchema =
|
|
2908
|
+
var QueueQuestionSchema = z9.object({
|
|
2809
2909
|
/** The decision need's id — what an answer is accepted against. */
|
|
2810
|
-
id:
|
|
2910
|
+
id: z9.string(),
|
|
2811
2911
|
/** The words that were asked, from the request Entry that asked them. */
|
|
2812
|
-
question:
|
|
2912
|
+
question: z9.string(),
|
|
2813
2913
|
/** Where it was asked — which is where the ruling goes (`POST /api/entries`). Null only
|
|
2814
2914
|
* for a need whose request Entry is carried by no interactive Delivery, which nothing
|
|
2815
2915
|
* can answer. */
|
|
2816
|
-
deliveryId:
|
|
2916
|
+
deliveryId: z9.string().nullable().default(null),
|
|
2817
2917
|
/** The Entry the ruling is about. */
|
|
2818
|
-
aboutId:
|
|
2918
|
+
aboutId: z9.string().nullable().default(null),
|
|
2819
2919
|
/** Empty for a free-text question. */
|
|
2820
|
-
options:
|
|
2821
|
-
select:
|
|
2822
|
-
askedAt:
|
|
2920
|
+
options: z9.array(OptionSchema).default([]),
|
|
2921
|
+
select: z9.enum(["one", "many", "rank", "confirm", "text"]).default("text"),
|
|
2922
|
+
askedAt: z9.string(),
|
|
2823
2923
|
/** Null while the question is open — which is how the page tells the two apart. */
|
|
2824
|
-
answeredAt:
|
|
2924
|
+
answeredAt: z9.string().nullable().default(null),
|
|
2825
2925
|
/** The ruling in the person's own words, from the contribution that replied — not the
|
|
2826
2926
|
* option id, which is not something anyone reads back. Null while it is open, and null
|
|
2827
2927
|
* for a settled question whose reply carried nothing readable. */
|
|
2828
|
-
answer:
|
|
2928
|
+
answer: z9.string().nullable().default(null),
|
|
2829
2929
|
/** The Goal this question belongs to — a step knows its Goal on its own, not only through
|
|
2830
2930
|
* an `InboxItem`'s `communication.goalIds[0]` (docs/clients/app/walk/design.md §12 item 3).
|
|
2831
2931
|
* READ BY `apps/client/src/walk/order.ts`, which stamps it onto every `WalkStep`: the walk's
|
|
2832
2932
|
* order, its route, home's trees and the list of steps all take a step's Goal from here, so
|
|
2833
2933
|
* this is the field they agree through rather than each re-deriving it from the row it
|
|
2834
2934
|
* arrived under. Required because the API projects it on every need it sends. */
|
|
2835
|
-
goalId:
|
|
2935
|
+
goalId: z9.string(),
|
|
2836
2936
|
/** True only while an unmet START gate holds the Goal — a Goal that merely waits to
|
|
2837
2937
|
* *finish* does not stop a person from answering (owner, 2026-09-16: "per need gate from
|
|
2838
2938
|
* the API"; §4's dashed node). Not the same fact as `QueueItem.blocked`, which counts any
|
|
2839
2939
|
* gate at all. */
|
|
2840
|
-
blocked:
|
|
2940
|
+
blocked: z9.boolean().default(false)
|
|
2841
2941
|
});
|
|
2842
|
-
var QueueReplySchema =
|
|
2942
|
+
var QueueReplySchema = z9.object({
|
|
2843
2943
|
/** The card this note was (`deliveryId:requestEntryId`, minted by the server like every card
|
|
2844
2944
|
* id) — so the phone can tell a reply it just sent from one the queue already carries, and the
|
|
2845
2945
|
* walk can name it in its zoom. */
|
|
2846
|
-
id:
|
|
2946
|
+
id: z9.string(),
|
|
2847
2947
|
/** The Goal the note is on. */
|
|
2848
|
-
goalId:
|
|
2948
|
+
goalId: z9.string(),
|
|
2849
2949
|
/** What the note said. */
|
|
2850
|
-
note:
|
|
2950
|
+
note: z9.string(),
|
|
2851
2951
|
/** Where it was carried — where a second reply goes (`POST /api/entries`, #2252). */
|
|
2852
|
-
deliveryId:
|
|
2853
|
-
requestEntryId:
|
|
2854
|
-
askedAt:
|
|
2952
|
+
deliveryId: z9.string(),
|
|
2953
|
+
requestEntryId: z9.string(),
|
|
2954
|
+
askedAt: z9.string(),
|
|
2855
2955
|
/** When the person last replied — the window's start. */
|
|
2856
|
-
repliedAt:
|
|
2956
|
+
repliedAt: z9.string(),
|
|
2857
2957
|
/** The person's latest words about it; null when there is nothing readable in them. */
|
|
2858
|
-
reply:
|
|
2958
|
+
reply: z9.string().nullable()
|
|
2859
2959
|
});
|
|
2860
|
-
var QueueItemSchema =
|
|
2861
|
-
id:
|
|
2960
|
+
var QueueItemSchema = z9.object({
|
|
2961
|
+
id: z9.string(),
|
|
2862
2962
|
/** One-line headline — the first sentence of the outcome. */
|
|
2863
|
-
title:
|
|
2963
|
+
title: z9.string(),
|
|
2864
2964
|
/** The outcome in full, verbatim: the person's own words are what an assignee sees. */
|
|
2865
|
-
intent:
|
|
2965
|
+
intent: z9.string(),
|
|
2866
2966
|
/** `ready` | `active` | `waiting` | `done` | `cancelled`, straight off the Goal. */
|
|
2867
|
-
state:
|
|
2967
|
+
state: z9.string(),
|
|
2868
2968
|
/** Who holds it (a participant ref); null when nobody does yet. */
|
|
2869
|
-
assignee:
|
|
2969
|
+
assignee: z9.string().nullable().default(null),
|
|
2870
2970
|
/** What the agent last said it was doing; null if it has said nothing. */
|
|
2871
|
-
progress:
|
|
2971
|
+
progress: z9.string().nullable().default(null),
|
|
2872
2972
|
/** HOME'S LINE FOR THAT NOTE (owner, 2026-09-23): a few plain words one read wrote from `progress`,
|
|
2873
2973
|
* served only while it was written for the current note. Null means show the Goal's name. */
|
|
2874
|
-
progressLine:
|
|
2875
|
-
reviewPending:
|
|
2876
|
-
dueAt:
|
|
2974
|
+
progressLine: z9.string().nullable().optional(),
|
|
2975
|
+
reviewPending: z9.boolean().default(false),
|
|
2976
|
+
dueAt: z9.string().nullable().default(null),
|
|
2877
2977
|
/** WHEN ITS OWNER SAID DONE WHILE CHILDREN WERE OPEN (#2704): its own work is finished and it closes
|
|
2878
2978
|
* with its last open child. Null otherwise; optional, so hand-built queues need not spell it. */
|
|
2879
|
-
finishedAt:
|
|
2979
|
+
finishedAt: z9.string().nullable().optional(),
|
|
2880
2980
|
/** The Goal this one was opened under; null at the root. */
|
|
2881
|
-
parentGoalId:
|
|
2981
|
+
parentGoalId: z9.string().nullable().default(null),
|
|
2882
2982
|
/** Goals opened under this one — only those the same list holds. */
|
|
2883
|
-
childGoalIds:
|
|
2983
|
+
childGoalIds: z9.array(z9.string()).default([]),
|
|
2884
2984
|
/** Goals this one waits on (start or finish gates). */
|
|
2885
|
-
dependencyGoalIds:
|
|
2985
|
+
dependencyGoalIds: z9.array(z9.string()).default([]),
|
|
2886
2986
|
/** True while any gate is on a Goal that is not done — the walk draws it dashed. */
|
|
2887
|
-
blocked:
|
|
2987
|
+
blocked: z9.boolean().default(false),
|
|
2888
2988
|
/** Its questions: every OPEN one, and at most ten settled, newest settled first
|
|
2889
2989
|
* (20260929133308) — the page decides which of them to show. NOT the whole set: `asked` and
|
|
2890
2990
|
* `answered` are, and a settled one's words are a line (280 characters), its body read when the
|
|
2891
2991
|
* question is opened. */
|
|
2892
|
-
questions:
|
|
2992
|
+
questions: z9.array(QueueQuestionSchema).default([]),
|
|
2893
2993
|
/** HOW MANY QUESTIONS THIS WORK HAS ASKED, and how many are answered — the Goal's own totals,
|
|
2894
2994
|
* bounded at 100 server-side. A tally counted off `questions` is a wrong number that looks
|
|
2895
2995
|
* right once the cap bites (`walk/trees.ts` `tallyOf`). Optional, and defaulted from the array
|
|
2896
2996
|
* by the projection, so hand-built queues (fixtures, the demo) need not spell them. */
|
|
2897
|
-
asked:
|
|
2898
|
-
answered:
|
|
2997
|
+
asked: z9.number().optional(),
|
|
2998
|
+
answered: z9.number().optional(),
|
|
2899
2999
|
/** Every note on it the person replied to (`QueueReplySchema`) — the page decides which to show.
|
|
2900
3000
|
* Optional, not defaulted: absent is none, and every hand-built queue (fixtures, the demo) need
|
|
2901
3001
|
* not spell an empty list. */
|
|
2902
|
-
replies:
|
|
3002
|
+
replies: z9.array(QueueReplySchema).optional(),
|
|
2903
3003
|
/** The repository or project identifier this Goal belongs to (#2280), null if untracked. */
|
|
2904
|
-
repo:
|
|
2905
|
-
createdAt:
|
|
2906
|
-
updatedAt:
|
|
3004
|
+
repo: z9.string().nullable().optional(),
|
|
3005
|
+
createdAt: z9.string(),
|
|
3006
|
+
updatedAt: z9.string().nullable().default(null),
|
|
2907
3007
|
/** When its owner last SAID something about it (the newest `progress` Entry: a contact update kept
|
|
2908
3008
|
* as progress). `updatedAt` moves for reasons nobody chose — a
|
|
2909
3009
|
* state recomputed, a review flag — so it cannot tell work in hand from work gone quiet. */
|
|
2910
|
-
lastProgressAt:
|
|
3010
|
+
lastProgressAt: z9.string().nullable().optional(),
|
|
2911
3011
|
/** THE GOAL'S NEWEST WORD, FROM EITHER SIDE (owner, 2026-09-27): the newest Entry on it, of any
|
|
2912
3012
|
* kind — what the person added ("Add to this"), their reply, the agent's ask or its progress
|
|
2913
3013
|
* note. A progress note is an Entry, so this is already the newer of the two: the person's note
|
|
2914
3014
|
* shows the moment it is written, and the agent's reply or next note replaces it by being newer.
|
|
2915
3015
|
* `said` is bounded to 280 characters server-side (a line, not the conversation). Null when the
|
|
2916
3016
|
* Goal carries no readable Entry; optional, so hand-built queues need not spell it. */
|
|
2917
|
-
latest:
|
|
2918
|
-
from:
|
|
2919
|
-
said:
|
|
2920
|
-
at:
|
|
2921
|
-
entryId:
|
|
3017
|
+
latest: z9.object({
|
|
3018
|
+
from: z9.enum(["person", "agent"]),
|
|
3019
|
+
said: z9.string(),
|
|
3020
|
+
at: z9.string(),
|
|
3021
|
+
entryId: z9.string()
|
|
2922
3022
|
}).nullable().optional(),
|
|
2923
3023
|
/** WHEN THIS PERSON LAST PUT A HAND ON IT THEMSELVES (owner, Paigy Goal 16d18f51, 2026-09-30):
|
|
2924
3024
|
* the newest Entry on the Goal they wrote, of any kind — a line they added, a reply to a note, an
|
|
@@ -2931,7 +3031,7 @@ var QueueItemSchema = z7.object({
|
|
|
2931
3031
|
* minute after the person speaks erases their instant from it, and the durable traces the client
|
|
2932
3032
|
* can see (`replies`, `questions[].answeredAt`) miss a spontaneous note entirely — a `request`
|
|
2933
3033
|
* Entry with no `about_id` is in neither. */
|
|
2934
|
-
lastPersonAt:
|
|
3034
|
+
lastPersonAt: z9.string().nullable().optional(),
|
|
2935
3035
|
/** WHAT THIS ROW IS, IN TWELVE CHARACTERS (#2928) — the hash of every other field on it, stamped
|
|
2936
3036
|
* by the one projection that builds the row (`apps/api/src/goal/queue.ts`). It is how the
|
|
2937
3037
|
* incremental read knows a row has not moved: the phone echoes back the revs it holds
|
|
@@ -2942,40 +3042,40 @@ var QueueItemSchema = z7.object({
|
|
|
2942
3042
|
* the row shows that no `updated_at` moves for (`active` lapsing, a dependency's state, a
|
|
2943
3043
|
* sibling appearing in `childGoalIds`) cannot go unnoticed. Optional because a hand-built
|
|
2944
3044
|
* queue (a fixture, the demo) spells none, and a row with no rev is simply always re-sent. */
|
|
2945
|
-
rev:
|
|
3045
|
+
rev: z9.string().optional()
|
|
2946
3046
|
});
|
|
2947
|
-
var QueueDeltaSchema =
|
|
2948
|
-
ids:
|
|
2949
|
-
items:
|
|
3047
|
+
var QueueDeltaSchema = z9.object({
|
|
3048
|
+
ids: z9.array(z9.string()),
|
|
3049
|
+
items: z9.array(QueueItemSchema)
|
|
2950
3050
|
});
|
|
2951
3051
|
var COLD_AFTER_MS = 3 * 24 * 60 * 60 * 1e3;
|
|
2952
|
-
var NoteSourceSchema =
|
|
2953
|
-
var NoteStatusSchema =
|
|
2954
|
-
var NoteRepeatSchema =
|
|
2955
|
-
var DecisionSchema =
|
|
2956
|
-
id:
|
|
3052
|
+
var NoteSourceSchema = z9.enum(["app", "call"]);
|
|
3053
|
+
var NoteStatusSchema = z9.enum(["open", "assigned", "in_progress", "done"]);
|
|
3054
|
+
var NoteRepeatSchema = z9.enum(["once", "until_done"]);
|
|
3055
|
+
var DecisionSchema = z9.object({
|
|
3056
|
+
id: z9.string(),
|
|
2957
3057
|
/** The note this decision refines; null = recorded on a bare thread (the
|
|
2958
3058
|
* extensibility seam — any conversation can accrue decisions). */
|
|
2959
|
-
noteId:
|
|
3059
|
+
noteId: z9.string().nullable(),
|
|
2960
3060
|
/** What was ambiguous — the broker's (or the user's own) question. */
|
|
2961
|
-
question:
|
|
3061
|
+
question: z9.string(),
|
|
2962
3062
|
/** The user's ruling; null while the question is open. */
|
|
2963
|
-
answer:
|
|
2964
|
-
decidedAt:
|
|
2965
|
-
createdAt:
|
|
3063
|
+
answer: z9.string().nullable(),
|
|
3064
|
+
decidedAt: z9.string().nullable(),
|
|
3065
|
+
createdAt: z9.string()
|
|
2966
3066
|
});
|
|
2967
|
-
var NoteSchema =
|
|
2968
|
-
id:
|
|
3067
|
+
var NoteSchema = z9.object({
|
|
3068
|
+
id: z9.string(),
|
|
2969
3069
|
/** One-line headline (broker-titled; deterministic floor). */
|
|
2970
|
-
title:
|
|
3070
|
+
title: z9.string(),
|
|
2971
3071
|
/** The original intent, verbatim — assignees always see the user's own words. */
|
|
2972
|
-
intent:
|
|
3072
|
+
intent: z9.string(),
|
|
2973
3073
|
source: NoteSourceSchema,
|
|
2974
3074
|
status: NoteStatusSchema,
|
|
2975
3075
|
/** Who it was assigned to (a participant ref, 'agent:<tokenId>'); null = unassigned. */
|
|
2976
|
-
assignee:
|
|
3076
|
+
assignee: z9.string().nullable(),
|
|
2977
3077
|
/** The request thread minted at assignment; null until assigned. */
|
|
2978
|
-
parentId:
|
|
3078
|
+
parentId: z9.string().nullable(),
|
|
2979
3079
|
/** REMINDERS (docs/model/notes/reminders-design.md): the NOT-BEFORE this becomes eligible to ride a
|
|
2980
3080
|
* call — never a deadline. It only ever comes from the user's own words, so when it
|
|
2981
3081
|
* passes Paigy rings ONCE (#1293, owner 2026-08-26: a time said out loud is consent to
|
|
@@ -2984,154 +3084,154 @@ var NoteSchema = z7.object({
|
|
|
2984
3084
|
// Defaulted, not required: a Note from an API deploy older than the reminders
|
|
2985
3085
|
// migration has none of these, and the defaults ARE what it means — no not-before,
|
|
2986
3086
|
// one ride, never ridden. Parsing must not fail across a rolling deploy.
|
|
2987
|
-
dueAt:
|
|
3087
|
+
dueAt: z9.string().nullable().default(null),
|
|
2988
3088
|
repeat: NoteRepeatSchema.default("once"),
|
|
2989
3089
|
/** How many calls have already carried it — the fatigue cap counts rides, not days. */
|
|
2990
|
-
rides:
|
|
2991
|
-
lastRideAt:
|
|
2992
|
-
createdAt:
|
|
3090
|
+
rides: z9.number().int().default(0),
|
|
3091
|
+
lastRideAt: z9.string().nullable().default(null),
|
|
3092
|
+
createdAt: z9.string()
|
|
2993
3093
|
});
|
|
2994
|
-
var TriageItemSchema =
|
|
2995
|
-
noteId:
|
|
3094
|
+
var TriageItemSchema = z9.object({
|
|
3095
|
+
noteId: z9.string(),
|
|
2996
3096
|
/** The note's headline at run time. */
|
|
2997
|
-
title:
|
|
3097
|
+
title: z9.string(),
|
|
2998
3098
|
/** WHY, in one short human line, evidence first — this is read on a phone underneath
|
|
2999
3099
|
* the note's title: "no movement in 34 days", "worked 3 notes in this repo this week".
|
|
3000
3100
|
* Never a model's reasoning transcript, never an id. */
|
|
3001
|
-
why:
|
|
3101
|
+
why: z9.string()
|
|
3002
3102
|
});
|
|
3003
|
-
var TriageAssignmentSchema =
|
|
3103
|
+
var TriageAssignmentSchema = z9.object({
|
|
3004
3104
|
/** The agent's token id — what `dispatchNote` resolves and what a request is addressed to. */
|
|
3005
|
-
agent:
|
|
3105
|
+
agent: z9.string(),
|
|
3006
3106
|
/** Its display name at run time (the name on the hatchling's card). Denormalized for the
|
|
3007
3107
|
* same reason as `title`: the card must render from the proposal alone. */
|
|
3008
|
-
agentName:
|
|
3009
|
-
notes:
|
|
3108
|
+
agentName: z9.string(),
|
|
3109
|
+
notes: z9.array(TriageItemSchema)
|
|
3010
3110
|
});
|
|
3011
|
-
var TriageStatusSchema =
|
|
3012
|
-
var SubmitTriageSchema =
|
|
3111
|
+
var TriageStatusSchema = z9.enum(["open", "superseded", "dismissed"]);
|
|
3112
|
+
var SubmitTriageSchema = z9.object({
|
|
3013
3113
|
/** Which runtime judged: "ollama" (inference never left the machine) or a harness the
|
|
3014
3114
|
* user already runs under their own credentials ("claude" / "codex" / "agy"). Recorded
|
|
3015
3115
|
* so the phone can say where the content went — an unattributed privacy claim is worth
|
|
3016
3116
|
* nothing, and #1106's promise is precisely "Paigy's servers never see this". */
|
|
3017
|
-
provider:
|
|
3117
|
+
provider: z9.string().min(1).max(60),
|
|
3018
3118
|
/** The concrete model when the provider names one (an ollama tag); null otherwise. */
|
|
3019
|
-
model:
|
|
3119
|
+
model: z9.string().max(200).nullable().optional(),
|
|
3020
3120
|
/** How many open notes the run actually looked at — the denominator on the phone
|
|
3021
3121
|
* ("6 of 50"), and the honest answer to "did it read the whole queue?". */
|
|
3022
|
-
reviewed:
|
|
3023
|
-
close:
|
|
3024
|
-
stale:
|
|
3025
|
-
assign:
|
|
3122
|
+
reviewed: z9.number().int().min(0).max(1e4).default(0),
|
|
3123
|
+
close: z9.array(TriageItemSchema).max(200).default([]),
|
|
3124
|
+
stale: z9.array(TriageItemSchema).max(200).default([]),
|
|
3125
|
+
assign: z9.array(TriageAssignmentSchema).max(50).default([])
|
|
3026
3126
|
});
|
|
3027
3127
|
var TriageProposalSchema = SubmitTriageSchema.extend({
|
|
3028
|
-
id:
|
|
3029
|
-
runAt:
|
|
3128
|
+
id: z9.string(),
|
|
3129
|
+
runAt: z9.string(),
|
|
3030
3130
|
status: TriageStatusSchema,
|
|
3031
|
-
model:
|
|
3131
|
+
model: z9.string().nullable().default(null)
|
|
3032
3132
|
});
|
|
3033
|
-
var AcceptTriageSchema =
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
group:
|
|
3038
|
-
agent:
|
|
3039
|
-
noteIds:
|
|
3133
|
+
var AcceptTriageSchema = z9.discriminatedUnion("group", [
|
|
3134
|
+
z9.object({ group: z9.literal("close"), noteIds: z9.array(z9.string()).max(200).optional() }),
|
|
3135
|
+
z9.object({ group: z9.literal("stale"), noteIds: z9.array(z9.string()).max(200).optional() }),
|
|
3136
|
+
z9.object({
|
|
3137
|
+
group: z9.literal("assign"),
|
|
3138
|
+
agent: z9.string().min(1),
|
|
3139
|
+
noteIds: z9.array(z9.string()).max(200).optional()
|
|
3040
3140
|
})
|
|
3041
3141
|
]);
|
|
3042
|
-
var AcceptTriageResultSchema =
|
|
3043
|
-
accepted:
|
|
3044
|
-
failed:
|
|
3142
|
+
var AcceptTriageResultSchema = z9.object({
|
|
3143
|
+
accepted: z9.array(z9.string()),
|
|
3144
|
+
failed: z9.array(z9.object({ noteId: z9.string(), reason: z9.string() }))
|
|
3045
3145
|
});
|
|
3046
|
-
var DeliveryModeSchema =
|
|
3146
|
+
var DeliveryModeSchema = z9.enum(["poll", "self_hosted"]);
|
|
3047
3147
|
var WAKE_EVENT = "wake";
|
|
3048
3148
|
var wakeChannel = (tokenId) => `wake:${tokenId}`;
|
|
3049
|
-
var RegisterDeliverySchema =
|
|
3050
|
-
var OAuthStartSchema =
|
|
3051
|
-
provider:
|
|
3052
|
-
returnTo:
|
|
3149
|
+
var RegisterDeliverySchema = z9.object({ mode: DeliveryModeSchema });
|
|
3150
|
+
var OAuthStartSchema = z9.object({
|
|
3151
|
+
provider: z9.enum(["cma"]),
|
|
3152
|
+
returnTo: z9.string().min(1)
|
|
3053
3153
|
});
|
|
3054
|
-
var DeliveryConfigSchema =
|
|
3055
|
-
tokenId:
|
|
3154
|
+
var DeliveryConfigSchema = z9.object({
|
|
3155
|
+
tokenId: z9.string(),
|
|
3056
3156
|
mode: DeliveryModeSchema,
|
|
3057
3157
|
/** null when the deployment has no anon key configured. `self_hosted` is then REFUSED
|
|
3058
3158
|
* (503 `self_hosted_unavailable`) rather than registered, so a self_hosted config always
|
|
3059
3159
|
* carries credentials; only a `poll` registration can come back with null here. */
|
|
3060
|
-
realtime:
|
|
3160
|
+
realtime: z9.object({ url: z9.string(), anonKey: z9.string() }).nullable()
|
|
3061
3161
|
});
|
|
3062
|
-
var HostDecisionSchema =
|
|
3162
|
+
var HostDecisionSchema = z9.object({
|
|
3063
3163
|
/** The agent's token id: the row's `recipient`. */
|
|
3064
|
-
agent:
|
|
3065
|
-
decision:
|
|
3164
|
+
agent: z9.string().uuid(),
|
|
3165
|
+
decision: z9.enum(["stood_back", "took_over"]),
|
|
3066
3166
|
/** The work it was about: the Goal waiting on that agent next (`claimable` on its `contact({})` read). */
|
|
3067
|
-
goalId:
|
|
3167
|
+
goalId: z9.string().uuid().nullable().optional(),
|
|
3068
3168
|
/** When the server last heard from the agent, as the host read it: the presence it stood back for. */
|
|
3069
|
-
seenAt:
|
|
3169
|
+
seenAt: z9.string().datetime().nullable().optional(),
|
|
3070
3170
|
/** When that work last moved (`claimable.since` on an agent's `contact({})` read), the fact the bound is judged on. */
|
|
3071
|
-
since:
|
|
3171
|
+
since: z9.string().datetime().nullable().optional(),
|
|
3072
3172
|
/** What the host said, in its log's own words: why it stood back, or what the take-over did. */
|
|
3073
|
-
said:
|
|
3173
|
+
said: z9.string().max(300).optional()
|
|
3074
3174
|
});
|
|
3075
|
-
var WakeNudgeSchema =
|
|
3076
|
-
kind:
|
|
3077
|
-
notificationId:
|
|
3078
|
-
parentId:
|
|
3175
|
+
var WakeNudgeSchema = z9.object({
|
|
3176
|
+
kind: z9.enum(["reply", "request", "callback"]),
|
|
3177
|
+
notificationId: z9.string().optional(),
|
|
3178
|
+
parentId: z9.string()
|
|
3079
3179
|
});
|
|
3080
|
-
var PairingStatusSchema =
|
|
3081
|
-
var DeviceCodeSchema =
|
|
3082
|
-
device_code:
|
|
3083
|
-
user_code:
|
|
3084
|
-
verification_uri:
|
|
3085
|
-
verification_uri_complete:
|
|
3086
|
-
interval:
|
|
3087
|
-
expires_in:
|
|
3180
|
+
var PairingStatusSchema = z9.enum(["pending", "approved", "denied", "expired"]);
|
|
3181
|
+
var DeviceCodeSchema = z9.object({
|
|
3182
|
+
device_code: z9.string(),
|
|
3183
|
+
user_code: z9.string(),
|
|
3184
|
+
verification_uri: z9.string().url(),
|
|
3185
|
+
verification_uri_complete: z9.string().url(),
|
|
3186
|
+
interval: z9.number(),
|
|
3187
|
+
expires_in: z9.number()
|
|
3088
3188
|
});
|
|
3089
|
-
var DeviceInfoSchema =
|
|
3090
|
-
code:
|
|
3189
|
+
var DeviceInfoSchema = z9.object({
|
|
3190
|
+
code: z9.string(),
|
|
3091
3191
|
/** The agent's suggested name (from /device/code) — shown on the approval screen,
|
|
3092
3192
|
* pre-filling the name field the human can edit. */
|
|
3093
|
-
name:
|
|
3193
|
+
name: z9.string(),
|
|
3094
3194
|
/** @deprecated Legacy alias of `name` for the pre-#531 embedded bundle in App Store
|
|
3095
3195
|
* build 35, whose DeviceFlow renders `info.agent.slice(0, 2)` — without this a FRESH
|
|
3096
3196
|
* install crashes on the pairing screen on first launch, before the OTA lands
|
|
3097
3197
|
* (seen live: PAIGY-5T, 2026-07-21). Remove once a newer binary is the floor. */
|
|
3098
|
-
agent:
|
|
3099
|
-
device:
|
|
3198
|
+
agent: z9.string().optional(),
|
|
3199
|
+
device: z9.string().nullable(),
|
|
3100
3200
|
status: PairingStatusSchema
|
|
3101
3201
|
});
|
|
3102
|
-
var DeviceTokenSchema =
|
|
3103
|
-
access_token:
|
|
3202
|
+
var DeviceTokenSchema = z9.object({
|
|
3203
|
+
access_token: z9.string(),
|
|
3104
3204
|
/** The pairing's single name (user-typed at approval, the agent's suggestion, or
|
|
3105
3205
|
* a default silly name). */
|
|
3106
|
-
name:
|
|
3107
|
-
device:
|
|
3206
|
+
name: z9.string(),
|
|
3207
|
+
device: z9.string().nullable(),
|
|
3108
3208
|
/** The pairing's assigned voice, cached so the desktop can seed the SAME face the phone
|
|
3109
3209
|
* draws — voice is the third ingredient of a hatchling's build (party/traits.ts). */
|
|
3110
|
-
voice:
|
|
3210
|
+
voice: z9.string().nullable().optional(),
|
|
3111
3211
|
/** The token's server-side id — the face's COLOUR anchor, and the only seed ingredient
|
|
3112
3212
|
* that survives a rename. Cached by the host's identity beat. */
|
|
3113
|
-
token_id:
|
|
3213
|
+
token_id: z9.string().nullable().optional(),
|
|
3114
3214
|
/** WHERE this identity works — the folder a wake should land it in. Written by the host
|
|
3115
3215
|
* at spawn and by `paigy-harness handoff` from a live terminal. Without it every wake
|
|
3116
3216
|
* landed in the FIRST granted workspace and the agent rediscovered its own repo from
|
|
3117
3217
|
* the thread each time (host.ts, live catch 2026-08-06 — prompt-papered until now). */
|
|
3118
|
-
workspace:
|
|
3218
|
+
workspace: z9.string().nullable().optional(),
|
|
3119
3219
|
/** Local host recovery must preserve the launch's runtime and Paigy identity. */
|
|
3120
|
-
harness:
|
|
3121
|
-
session_id:
|
|
3220
|
+
harness: z9.enum(["claude", "codex", "agy"]).optional(),
|
|
3221
|
+
session_id: z9.string().uuid().optional(),
|
|
3122
3222
|
/** A conversation the host must not resume: its context is full, so every turn fails
|
|
3123
3223
|
* ("Prompt is too long"). Written when a run hits it (`run.ts` `onFull`); the host skips a slot
|
|
3124
3224
|
* whose resumable session is this one, so its Goals reach the dead-agent handoff instead of a
|
|
3125
3225
|
* copy that types the person's words into a turn that cannot run (Calls, 2026-10-06). */
|
|
3126
|
-
full_session:
|
|
3127
|
-
uik_pub:
|
|
3226
|
+
full_session: z9.string().optional(),
|
|
3227
|
+
uik_pub: z9.string().nullable().optional()
|
|
3128
3228
|
});
|
|
3129
|
-
var SupportRequestSchema =
|
|
3130
|
-
email:
|
|
3131
|
-
message:
|
|
3132
|
-
name:
|
|
3229
|
+
var SupportRequestSchema = z9.object({
|
|
3230
|
+
email: z9.string().email().max(320),
|
|
3231
|
+
message: z9.string().trim().min(1).max(5e3),
|
|
3232
|
+
name: z9.string().trim().max(120).optional()
|
|
3133
3233
|
});
|
|
3134
|
-
var NotificationFeedbackKindSchema =
|
|
3234
|
+
var NotificationFeedbackKindSchema = z9.enum([
|
|
3135
3235
|
"break_down",
|
|
3136
3236
|
// "This should be more than one ask — break it down."
|
|
3137
3237
|
"regenerate_options",
|
|
@@ -3146,126 +3246,137 @@ var NotificationFeedbackKindSchema = z7.enum([
|
|
|
3146
3246
|
// anything else — the note carries it.
|
|
3147
3247
|
]);
|
|
3148
3248
|
var SlimOptionSchema = OptionSchema.omit({ html: true });
|
|
3149
|
-
var QuestionRowSchema =
|
|
3249
|
+
var QuestionRowSchema = z9.object({
|
|
3150
3250
|
/** The card's id (`deliveryId:needId`, or `deliveryId:entryId` for an update), as the inbox mints it. */
|
|
3151
|
-
id:
|
|
3152
|
-
deliveryId:
|
|
3153
|
-
entryId:
|
|
3251
|
+
id: z9.string(),
|
|
3252
|
+
deliveryId: z9.string(),
|
|
3253
|
+
entryId: z9.string(),
|
|
3154
3254
|
/** The decision it waits on; null for an update, which asks nothing. */
|
|
3155
|
-
needId:
|
|
3156
|
-
goalIds:
|
|
3255
|
+
needId: z9.string().nullable(),
|
|
3256
|
+
goalIds: z9.array(z9.string()),
|
|
3157
3257
|
/** The name of the work it is about, when the read could word it. */
|
|
3158
|
-
goalTitle:
|
|
3159
|
-
tokenId:
|
|
3160
|
-
name:
|
|
3161
|
-
title:
|
|
3162
|
-
body:
|
|
3163
|
-
select:
|
|
3164
|
-
options:
|
|
3165
|
-
hasPreview:
|
|
3166
|
-
blocking:
|
|
3167
|
-
askedAt:
|
|
3258
|
+
goalTitle: z9.string().optional(),
|
|
3259
|
+
tokenId: z9.string().optional(),
|
|
3260
|
+
name: z9.string(),
|
|
3261
|
+
title: z9.string(),
|
|
3262
|
+
body: z9.string(),
|
|
3263
|
+
select: z9.enum(["one", "many", "rank", "confirm", "text"]),
|
|
3264
|
+
options: z9.array(SlimOptionSchema),
|
|
3265
|
+
hasPreview: z9.boolean(),
|
|
3266
|
+
blocking: z9.boolean(),
|
|
3267
|
+
askedAt: z9.string().datetime(),
|
|
3168
3268
|
ring: InboxItemSchema.shape.ring,
|
|
3169
|
-
onCall:
|
|
3170
|
-
sealed:
|
|
3269
|
+
onCall: z9.literal(true).optional(),
|
|
3270
|
+
sealed: z9.boolean()
|
|
3171
3271
|
});
|
|
3172
|
-
var WorkStateSchema =
|
|
3173
|
-
var WorkRowSchema =
|
|
3174
|
-
id:
|
|
3175
|
-
parentId:
|
|
3176
|
-
title:
|
|
3272
|
+
var WorkStateSchema = z9.enum(["ready", "active", "waiting", "done", "cancelled"]);
|
|
3273
|
+
var WorkRowSchema = z9.object({
|
|
3274
|
+
id: z9.string(),
|
|
3275
|
+
parentId: z9.string().nullable(),
|
|
3276
|
+
title: z9.string(),
|
|
3177
3277
|
/** Straight off the Goal. */
|
|
3178
3278
|
state: WorkStateSchema,
|
|
3179
|
-
owner:
|
|
3180
|
-
revision:
|
|
3279
|
+
owner: z9.string().nullable(),
|
|
3280
|
+
revision: z9.number().int(),
|
|
3181
3281
|
/** Open questions on it, counted to 100. */
|
|
3182
|
-
waiting:
|
|
3282
|
+
waiting: z9.number().int(),
|
|
3183
3283
|
/** Held by a gate on work that is not done. */
|
|
3184
|
-
blocked:
|
|
3185
|
-
lastProgressAt:
|
|
3284
|
+
blocked: z9.boolean(),
|
|
3285
|
+
lastProgressAt: z9.string().datetime().nullable(),
|
|
3186
3286
|
/** The line written for its newest progress note, else that note's first words. */
|
|
3187
|
-
line:
|
|
3287
|
+
line: z9.string().nullable(),
|
|
3188
3288
|
/** Work directly under it, counted to 100; the list carries up to 12 of them. */
|
|
3189
|
-
children:
|
|
3190
|
-
createdAt:
|
|
3191
|
-
updatedAt:
|
|
3289
|
+
children: z9.number().int(),
|
|
3290
|
+
createdAt: z9.string().datetime(),
|
|
3291
|
+
updatedAt: z9.string().datetime(),
|
|
3192
3292
|
/** When anything at or under it last moved — the order the list is in. */
|
|
3193
|
-
activeAt:
|
|
3293
|
+
activeAt: z9.string().datetime(),
|
|
3194
3294
|
/** A sealed outcome has no title here; the work's page opens it. */
|
|
3195
|
-
sealed:
|
|
3295
|
+
sealed: z9.boolean()
|
|
3196
3296
|
});
|
|
3197
3297
|
var ComputerRowSchema = ConnectionSummarySchema.omit({ activity: true });
|
|
3198
3298
|
var AgentRowSchema = ComputerRowSchema.extend({
|
|
3199
3299
|
/** Open questions it is asking the person, over every open card; null when that read failed. */
|
|
3200
|
-
asking:
|
|
3201
|
-
oldestAskAt:
|
|
3300
|
+
asking: z9.number().int().nullable(),
|
|
3301
|
+
oldestAskAt: z9.string().datetime().nullable(),
|
|
3202
3302
|
/** Up to three of the live Goals it holds, oldest first (the order it picks them up), and how
|
|
3203
3303
|
* many in all among the account's 200 most recently active agent-held live Goals
|
|
3204
3304
|
* (`agent_holds`); null when that read failed. */
|
|
3205
|
-
holds:
|
|
3206
|
-
held:
|
|
3305
|
+
holds: z9.array(z9.object({ id: z9.string(), title: z9.string() })).nullable(),
|
|
3306
|
+
held: z9.number().int().nullable(),
|
|
3207
3307
|
/** The earliest instant any Goal it holds went quiet, by the one rule (`coldSince`); null
|
|
3208
3308
|
* while none has, or when that read failed. */
|
|
3209
|
-
cold:
|
|
3309
|
+
cold: z9.string().datetime().nullable(),
|
|
3210
3310
|
/** The newest line of its working log, and when the harness saw it. */
|
|
3211
|
-
line:
|
|
3212
|
-
lineAt:
|
|
3311
|
+
line: z9.string().nullable(),
|
|
3312
|
+
lineAt: z9.string().datetime().nullable()
|
|
3213
3313
|
});
|
|
3214
|
-
var SnapshotSchema =
|
|
3314
|
+
var SnapshotSchema = z9.object({
|
|
3215
3315
|
/** The API's clock, taken before the first read: what a later delta will start from. */
|
|
3216
|
-
at:
|
|
3217
|
-
questions:
|
|
3316
|
+
at: z9.string().datetime(),
|
|
3317
|
+
questions: z9.object({
|
|
3218
3318
|
/** The newest 30 open cards, questions before updates. */
|
|
3219
|
-
items:
|
|
3319
|
+
items: z9.array(QuestionRowSchema),
|
|
3220
3320
|
/** Every open question, and apart from them every update, and what was put off. */
|
|
3221
|
-
total:
|
|
3222
|
-
updates:
|
|
3223
|
-
putOff:
|
|
3321
|
+
total: z9.number().int(),
|
|
3322
|
+
updates: z9.number().int(),
|
|
3323
|
+
putOff: z9.number().int()
|
|
3224
3324
|
}).nullable(),
|
|
3225
|
-
agents:
|
|
3325
|
+
agents: z9.object({
|
|
3226
3326
|
/** Up to 60, most recently seen first. */
|
|
3227
|
-
items:
|
|
3228
|
-
more:
|
|
3327
|
+
items: z9.array(AgentRowSchema),
|
|
3328
|
+
more: z9.boolean()
|
|
3229
3329
|
}).nullable(),
|
|
3230
|
-
work:
|
|
3330
|
+
work: z9.object({
|
|
3231
3331
|
/** The 60 most recently active roots, each followed by up to 12 children; 240 rows at most. */
|
|
3232
|
-
items:
|
|
3332
|
+
items: z9.array(WorkRowSchema),
|
|
3233
3333
|
/** How much work is behind each of the Work tab's four filters, each counted to 100, read with
|
|
3234
3334
|
* the rows. `work_list` (20260928023533) owns the predicates: Live is `ready`, `active` or
|
|
3235
3335
|
* `waiting`; Waiting on you is live work with an open question or an unmet gate; Not started
|
|
3236
3336
|
* is `ready`; Done is `done` or `cancelled`. */
|
|
3237
|
-
counts:
|
|
3337
|
+
counts: z9.object({ live: z9.number().int(), waiting: z9.number().int(), notStarted: z9.number().int(), done: z9.number().int() })
|
|
3238
3338
|
}).nullable(),
|
|
3239
|
-
you:
|
|
3339
|
+
you: z9.object({
|
|
3240
3340
|
settings: UserSettingsSchema,
|
|
3241
|
-
callable:
|
|
3341
|
+
callable: z9.boolean(),
|
|
3242
3342
|
/** Up to 20 paired computers; null when the roster read failed. */
|
|
3243
|
-
computers:
|
|
3343
|
+
computers: z9.array(ComputerRowSchema).nullable()
|
|
3244
3344
|
}).nullable()
|
|
3245
3345
|
});
|
|
3246
|
-
var CallRecapSchema =
|
|
3247
|
-
call:
|
|
3248
|
-
status:
|
|
3249
|
-
startedAt:
|
|
3250
|
-
durationMs:
|
|
3251
|
-
agents:
|
|
3346
|
+
var CallRecapSchema = z9.object({
|
|
3347
|
+
call: z9.object({
|
|
3348
|
+
status: z9.string(),
|
|
3349
|
+
startedAt: z9.string(),
|
|
3350
|
+
durationMs: z9.number().nullable(),
|
|
3351
|
+
agents: z9.array(z9.object({ id: z9.string(), name: z9.string().nullable() }))
|
|
3252
3352
|
}),
|
|
3253
|
-
topics:
|
|
3254
|
-
goalId:
|
|
3255
|
-
title:
|
|
3256
|
-
owner:
|
|
3257
|
-
state:
|
|
3258
|
-
questions:
|
|
3353
|
+
topics: z9.array(z9.object({
|
|
3354
|
+
goalId: z9.string().uuid(),
|
|
3355
|
+
title: z9.string(),
|
|
3356
|
+
owner: z9.string(),
|
|
3357
|
+
state: z9.string(),
|
|
3358
|
+
questions: z9.array(z9.object({ id: z9.string().uuid(), state: z9.string(), title: z9.string() })),
|
|
3259
3359
|
/** `words` is always what they SAID, verbatim — the record, never replaced. `summary` is what
|
|
3260
3360
|
* the line says in ten words (owner, 2026-10-07): the filer's, or the talker's for the answer it
|
|
3261
3361
|
* gave, so the row scans like a chosen option and their own words stay under it. Absent when
|
|
3262
3362
|
* neither wrote one. */
|
|
3263
3363
|
/** `about` is the request the line answered (its question), null for words that answered none —
|
|
3264
3364
|
* the key the screen groups on, so one question is one row however many times it was answered. */
|
|
3265
|
-
|
|
3365
|
+
/** `reply` is the reply the line makes up (an answer, an ok, a deferral), so one reply is one row
|
|
3366
|
+
* however many lines it cites; `at` is the call lines it came from, so a filed line an answer already
|
|
3367
|
+
* said is not drawn again (owner, 2026-10-07: "fix them all"); `replyKind` says which replies are answers. */
|
|
3368
|
+
lines: z9.array(z9.object({
|
|
3369
|
+
entryId: z9.string().uuid(),
|
|
3370
|
+
words: z9.string(),
|
|
3371
|
+
summary: z9.string().optional(),
|
|
3372
|
+
about: z9.string().nullable().optional(),
|
|
3373
|
+
reply: z9.string().nullable().optional(),
|
|
3374
|
+
replyKind: z9.string().nullable().optional(),
|
|
3375
|
+
at: z9.array(z9.number()).optional()
|
|
3376
|
+
}))
|
|
3266
3377
|
})),
|
|
3267
|
-
unfiled:
|
|
3268
|
-
more:
|
|
3378
|
+
unfiled: z9.array(z9.object({ lineId: z9.string().uuid(), words: z9.string(), atMs: z9.number() })),
|
|
3379
|
+
more: z9.object({ lines: z9.number(), entries: z9.number(), topics: z9.number() })
|
|
3269
3380
|
});
|
|
3270
3381
|
function sessionSlot(sessionId2) {
|
|
3271
3382
|
const id2 = sessionId2 ?? sessionId();
|
|
@@ -3798,8 +3909,13 @@ var handle = (entryId) => entryId.slice(0, 8);
|
|
|
3798
3909
|
function conversation(e) {
|
|
3799
3910
|
const answers = new Map((e.answers ?? []).map((a) => [a.decisionNeedId, a]));
|
|
3800
3911
|
const shown = new Set((e.entries ?? []).map((entry) => entry.entryId));
|
|
3912
|
+
const settles = new Map((e.answers ?? []).flatMap((a) => a.spans.map((s) => [s.entryId, a.requestEntryId])));
|
|
3913
|
+
const thread = (entry) => {
|
|
3914
|
+
const to = entry.aboutId ?? settles.get(entry.entryId);
|
|
3915
|
+
return to && to !== entry.entryId && shown.has(to) ? to : void 0;
|
|
3916
|
+
};
|
|
3801
3917
|
const entries = (e.entries ?? []).filter((entry) => !entryUnit(entry));
|
|
3802
|
-
const repliedTo = new Set(entries.flatMap((entry) =>
|
|
3918
|
+
const repliedTo = new Set(entries.flatMap((entry) => thread(entry) ?? []));
|
|
3803
3919
|
return entries.map((entry) => {
|
|
3804
3920
|
const sealed = !!entry.content && "sealed" in entry.content;
|
|
3805
3921
|
const plain = entry.content && "plain" in entry.content ? entry.content.plain : null;
|
|
@@ -3808,13 +3924,14 @@ function conversation(e) {
|
|
|
3808
3924
|
const answer = need ? answers.get(need.decisionNeedId) : void 0;
|
|
3809
3925
|
const decision = answer ? decided(answer.result) : void 0;
|
|
3810
3926
|
const owed = need?.state === "open" && entry.authorParticipant.startsWith("human:");
|
|
3927
|
+
const re = thread(entry);
|
|
3811
3928
|
return compact({
|
|
3812
3929
|
id: repliedTo.has(entry.entryId) || owed ? handle(entry.entryId) : void 0,
|
|
3813
3930
|
from: who(entry.authorParticipant),
|
|
3814
3931
|
at: at(entry.createdAt),
|
|
3815
3932
|
said: sealed ? "[encrypted]" : entryWords(entry).trim(),
|
|
3816
3933
|
units: askUnits(entry, e.entries ?? []).map((u) => `${u.title}: ${u.body}`),
|
|
3817
|
-
re:
|
|
3934
|
+
re: re ? handle(re) : void 0,
|
|
3818
3935
|
options,
|
|
3819
3936
|
decision: need ? compact({ state: stateOf(need.state, answer, decision), answer: decision }) : void 0
|
|
3820
3937
|
});
|
|
@@ -3902,11 +4019,15 @@ function deliveryView(d) {
|
|
|
3902
4019
|
notSent: d.notSent,
|
|
3903
4020
|
joinedCard: d.joinedCard,
|
|
3904
4021
|
joinedCall: d.joinedCall,
|
|
4022
|
+
// WHERE THE CALL STANDS, as one word beside the advice (owner, 2026-10-08): starting, ringing,
|
|
4023
|
+
// live (the person is on it now) or ended. A contact that joined a call already happening reads
|
|
4024
|
+
// that call, so it says `live`.
|
|
4025
|
+
call: d.callState,
|
|
3905
4026
|
waitOutcome: d.waitOutcome,
|
|
3906
4027
|
acknowledged: d.acknowledged?.filter((a) => a.acknowledged).map((a) => a.eventId),
|
|
3907
4028
|
next: [
|
|
3908
4029
|
failures(d.results),
|
|
3909
|
-
d.joinedCall ? `${JOINED_CALL}${d.message ? ` ${d.message}` : ""}` : d.kind === "notification" ? `${d.demoted ? `${d.demoted} ` : ""}${d.joinedCard ? `Added to the open report card on its Goal; no new push was sent. ${answers}` : answers}` : pending ? `${d.demoted ? `${d.demoted} ` : ""}Decision pending on this call. ${d.waitOutcome === "expired" ? "Nothing was said in the window. " : ""}Wait for the answer with contact({wait:true}) \u2014 one bounded window each time, and never resend the question.
|
|
4030
|
+
d.joinedCall ? `${JOINED_CALL}${d.message ? ` ${d.message}` : ""}` : d.kind === "notification" ? `${d.demoted ? `${d.demoted} ` : ""}${d.joinedCard ? `Added to the open report card on its Goal; no new push was sent. ${answers}` : answers}` : pending ? `${d.demoted ? `${d.demoted} ` : ""}Decision pending on this call. ${d.waitOutcome === "expired" ? "Nothing was said in the window. " : ""}Wait for the answer with contact({wait:true}) \u2014 one bounded window each time, and never resend the question. While the Call is open, keep waiting window after window: a quiet window is the call still going, and the person may give you follow-ups or instructions on it. Once the Call has ended, stop waiting, leave any question open, and collect the answer with contact({wait:false}) or get_goal on your next wake. ${d.message ?? ""}`.trim() : d.message
|
|
3910
4031
|
].filter(Boolean).join(" ")
|
|
3911
4032
|
});
|
|
3912
4033
|
}
|
|
@@ -3933,6 +4054,7 @@ function receivedView(r, now = Date.now()) {
|
|
|
3933
4054
|
const assigned = w.assigned ?? [];
|
|
3934
4055
|
const stalled = w.stalled ?? [];
|
|
3935
4056
|
const others = w.stalledOthers ?? [];
|
|
4057
|
+
const rings = w.rings ?? [];
|
|
3936
4058
|
const owed = r.events.filter((e) => e.kind === "question");
|
|
3937
4059
|
const refused = (r.acknowledged ?? []).filter((a) => a.refused);
|
|
3938
4060
|
return compact({
|
|
@@ -3949,11 +4071,18 @@ function receivedView(r, now = Date.now()) {
|
|
|
3949
4071
|
// YOUR STALLED WORK (#2257), and OTHER AGENTS' (owner, 2026-09-23): any agent may take it over.
|
|
3950
4072
|
stalled,
|
|
3951
4073
|
stalledOthers: others,
|
|
4074
|
+
// WHEN THE PHONE RINGS AGAIN FOR YOUR ASKS (owner, 2026-10-08): your Call went unheard and closed.
|
|
4075
|
+
rings: rings.length ? rings : void 0,
|
|
4076
|
+
// The person's standing rules for how their agents work (owner, 2026-10-08). On the read an agent makes
|
|
4077
|
+
// on startup and after a wake (contact({wait:false}), and every hosted receive), never on a window of a
|
|
4078
|
+
// held wait, which would repeat them window after window.
|
|
4079
|
+
houseRules: r.waitOutcome === "not_waited" ? w.houseRules : void 0,
|
|
3952
4080
|
next: [
|
|
3953
|
-
r.events.length ? `Handle each event, then acknowledge the ones you handled: contact({ ackEventIds: [${r.events.filter((e) => e.kind !== "question").map((e) => `"${e.eventId}"`).join(", ")}] }).` : w.claimable || assigned.length ? "No messages." : "Nothing is waiting.",
|
|
4081
|
+
r.events.length ? `Handle each event, then acknowledge the ones you handled: contact({ ackEventIds: [${r.events.filter((e) => e.kind !== "question").map((e) => `"${e.eventId}"`).join(", ")}] }).` : w.claimable || assigned.length || rings.length ? "No messages." : "Nothing is waiting.",
|
|
3954
4082
|
...owed.length ? [`You owe ${owed.length === 1 ? "an answer" : `${owed.length} answers`}: contact({ answers: [{ questionId: "<questionId>", answer: { text: <your answer> } }] }) for each question; a question is answered, never acknowledged.`] : [],
|
|
3955
4083
|
...r.hasMore ? ["More are waiting: acknowledge these, then receive again."] : [],
|
|
3956
4084
|
...r.waitOutcome === "expired" ? ["Nothing arrived in the window; receive again to keep waiting, without sending again."] : [],
|
|
4085
|
+
...rings.map((r2) => rerings(r2.ringAt, now)),
|
|
3957
4086
|
...assigned.length ? [`${assigned.length} of your Goals are assigned to you and not started (assigned): read one with get_goal({goalId}); your first write to it starts it.`] : [],
|
|
3958
4087
|
...w.claimable && !assigned.length ? [`Next waiting on you: ${w.claimable.title ?? w.claimable.goalId} (get_goal({ goalId: "${w.claimable.goalId}" })).`] : [],
|
|
3959
4088
|
...stalled.length ? [`${stalled.length} of your Goals have had no progress${stalled.length === 1 ? " " : ""}${quietFor(stalled, now)}: report on each with a contact update, or finish or cancel it with manage_goals.`] : [],
|
|
@@ -3963,6 +4092,11 @@ function receivedView(r, now = Date.now()) {
|
|
|
3963
4092
|
].join(" ")
|
|
3964
4093
|
});
|
|
3965
4094
|
}
|
|
4095
|
+
function rerings(ringAt, now) {
|
|
4096
|
+
if (!ringAt) return "A Call of yours went unanswered and will not ring again: its questions wait on the person's card. Collect the answers on your next wake; nothing needs resending.";
|
|
4097
|
+
const minutes = Math.max(0, Math.round((Date.parse(ringAt) - now) / 6e4));
|
|
4098
|
+
return `A Call of yours went unanswered; the phone rings again by itself at ${ringAt.slice(11, 16)} UTC (in ${minutes} min), carrying the same asks. Nothing needs resending: schedule a wake-up for then and receive again.`;
|
|
4099
|
+
}
|
|
3966
4100
|
function managedView(m, changes) {
|
|
3967
4101
|
const results = m.results ?? [];
|
|
3968
4102
|
const failed = results.filter((r) => r.status !== "applied");
|