@paigy/harness 0.3.46 → 0.3.48

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/main.js CHANGED
@@ -8744,7 +8744,7 @@ function parseSessionRecord(text) {
8744
8744
  return void 0;
8745
8745
  }
8746
8746
  function sessionId() {
8747
- return envSession("PAIGY_SESSION_ID") ?? claudeConversation() ?? envSession("CLAUDE_CODE_SESSION_ID") ?? envSession("CODEX_THREAD_ID") ?? envSession("CODEX_SESSION_ID") ?? // A Codex thread that was handed no id is its own agent, not the folder's (`underCodex`).
8747
+ return envSession("PAIGY_SESSION_ID") ?? claudeConversation() ?? envSession("CLAUDE_CODE_SESSION_ID") ?? envSession("GROK_SESSION_ID") ?? envSession("CODEX_THREAD_ID") ?? envSession("CODEX_SESSION_ID") ?? // A Codex thread that was handed no id is its own agent, not the folder's (`underCodex`).
8748
8748
  (underCodex() ? INSTANCE_ID : WORKSPACE_ID);
8749
8749
  }
8750
8750
  async function reach(url, init) {
@@ -10055,10 +10055,22 @@ function capRefusals(text, units22, field) {
10055
10055
  function refuseOverCaps(text, units22, field, ctx) {
10056
10056
  for (const { path, message, ...params } of capRefusals(text, units22, field)) ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path, message, params });
10057
10057
  }
10058
+ var SHIPPED = ["phone", "calls", "server", "store", "agents"];
10059
+ var CAUSES_MAX = 10;
10060
+ var shipped = external_exports.enum(SHIPPED, {
10061
+ errorMap: () => ({ message: `shipped_unknown: one of ${SHIPPED.join(", ")}.` })
10062
+ }).optional().describe(
10063
+ "Only when this reports a result that LANDED somewhere the person can see it: phone (an app update reached their phone), calls (the voice bot), server, store (the App Store) or agents (the MCP or SDK). Leave it out for work in progress."
10064
+ );
10065
+ var causedBy = external_exports.array(
10066
+ external_exports.string().trim().regex(/^[0-9a-fA-F-]{8,36}$/, "cause_not_found: an Entry id, or the short id get_goals prints for the person's words.")
10067
+ ).min(1).max(CAUSES_MAX, `too_many_causes: at most ${CAUSES_MAX}.`).optional().describe(
10068
+ `The person's own words this acts on: the ids (or the short ids get_goals prints) of their answers or notes that led to it, at most ${CAUSES_MAX}. Their app shows each result under the words that caused it, so name every one this follows from. An id that is not their words is refused by name (cause_not_found, cause_ambiguous) and nothing is written.`
10069
+ );
10058
10070
  var COMPLETION_MESSAGE_MAX = 50;
10059
10071
  var CompletionSchema = external_exports.object({
10060
10072
  goalId: external_exports.string().uuid().describe("The existing Goal to complete."),
10061
- message: external_exports.string().trim().min(1).max(COMPLETION_MESSAGE_MAX, "completion_message_too_long: at most 50 characters; put detail in units.").describe("Completion headline, at most 50 characters."),
10073
+ message: external_exports.string().trim().min(1).max(COMPLETION_MESSAGE_MAX, "completion_message_too_long: at most 50 characters; put detail in units.").describe("Completion headline, at most 50 characters: the one thing that would go wrong or stay unclear later if they missed it."),
10062
10074
  units: external_exports.array(UnitInputSchema.extend({
10063
10075
  title: external_exports.string().trim().min(1).max(UNIT_TITLE_MAX),
10064
10076
  body: external_exports.string().trim().min(1).max(UNIT_BODY_MAX)
@@ -10067,17 +10079,19 @@ var CompletionSchema = external_exports.object({
10067
10079
  options: external_exports.array(external_exports.object({
10068
10080
  label: external_exports.string().trim().min(1).max(OPTION_LABEL_MAX),
10069
10081
  hint: external_exports.string().trim().min(1).max(OPTION_HINT_MAX)
10070
- }).strict()).max(5).optional().describe("Optional next steps the person may initiate: label (50 characters) and consequence in hint (200). Selecting one acknowledges the report and requests that step from its author; it never reopens this Goal.")
10082
+ }).strict()).max(5).optional().describe("Optional next steps the person may initiate: label (50 characters) and consequence in hint (200). Selecting one acknowledges the report and requests that step from its author; it never reopens this Goal."),
10083
+ causedBy,
10084
+ shipped
10071
10085
  }).strict();
10072
- var CompleteChangeSchema = CompletionSchema.extend({ kind: external_exports.literal("complete") });
10086
+ var CompleteChangeSchema = CompletionSchema.omit({ causedBy: true, shipped: true }).extend({ kind: external_exports.literal("complete") });
10073
10087
  var ASKING_RULES = `HOW TO ASK:
10074
10088
  1. One question per object in \`questions\`, so each is answered on its own.
10075
10089
  2. \`goalId\` names the existing Goal it is about (create one with manage_goals first); the answer comes back there.
10076
- 3. \`workItBlocks\` only when you are truly blocked: it asks for a call.
10090
+ 3. They asked you to call? \`userExplicitlyRequested:"call"\`; \`workItBlocks\` rings when blocked.
10077
10091
  4. No while-loops. While any Call is open, even one your question joined from their items, keep receiving through empty windows; otherwise stop at one: the answer reaches you on the Goal. Yield only with a listener or wakeup.
10078
10092
  5. One question, one row: never re-send one still waiting; take back one that no longer matters with \`withdrawQuestionIds\`.
10079
10093
  6. Read the Goal before asking; never re-ask what was answered or shipped. \`replied\` means they chose no option: it is still yours to settle.
10080
- 7. Give options when you have them. Each label names its choice in full (never "Option 2"); never add "Other". \`pickMode\`: one (default), many, rank.
10094
+ 7. Give options when you have them. Each label names its choice in full (never "Option 2"); never add "Other".
10081
10095
  8. A diagnosis says when, why and how it happens, then proposes one fix.
10082
10096
  9. Give a report its \`reply\`: one line in THEIR voice for THAT report, so you learn whether they verified it or only received it. Required when it is delivered or its Goal is done.`;
10083
10097
  function draft2020(node) {
@@ -10119,15 +10133,58 @@ var reason = external_exports.string().trim().min(1).max(500).describe("Why, as
10119
10133
  var actionFits = (b) => b.blocked.type === "goal" === (b.action !== "answer");
10120
10134
  var ACTION_FITS = "a goal is blocked from start or complete; a question from answer";
10121
10135
  var userExplicitlyRequested = external_exports.enum(["any", "call"]).optional().describe(
10122
- `Only what the person said about THIS message, in so many words: "any" when they asked you to send it to them ("send it to my phone", "message me the result"), "call" when they asked to be called about it. It is then delivered (a call rings for the whole contact, and carries everything waiting on them); omitted, an update is only recorded as the Goal's progress unless the person needs it. Never set it to make a message louder.`
10136
+ 'What the person asked for about THIS message, in so many words: "any" when they asked you to send it to them ("send it to my phone", "message me the result"), "call" when they asked to be called about it. It is then delivered (a call rings for the whole contact, and carries everything waiting on them); omitted, an update is only recorded as the Goal\'s progress unless the person needs it. ALSO "any" whenever this message directly answers a question they asked you, wherever they asked it -- on a call, in a reply, in passing: their question is the request, so it is delivered every time, even with no pending question of theirs on file and even if they never said to send it. A correction of something you or another agent told them is such an answer. Never set it to make a message louder. This is the field that rings a phone: "call" here is how you call them when they asked you to, and `help` has the whole mechanism.'
10123
10137
  );
10124
10138
  var units = external_exports.array(UnitInputSchema).optional().describe(
10125
- `The context this message needs, as up to ${UNITS_MAX} units in reading order, each {title, body}: a title of at most ${UNIT_TITLE_MAX} characters and a body of at most ${UNIT_BODY_MAX}. One idea per unit. Leave it out when the main text says it all. Over a cap is refused by name (ask_too_long, too_many_units, unit_title_too_long, unit_body_too_long) and nothing is sent.`
10139
+ `The context this message needs, as up to ${UNITS_MAX} units in reading order, each {title, body}: a title of at most ${UNIT_TITLE_MAX} characters and a body of at most ${UNIT_BODY_MAX}. One idea per unit: context they may open, never something they must hear. Leave it out when the main text says it all. Over a cap is refused by name (ask_too_long, too_many_units, unit_title_too_long, unit_body_too_long) and nothing is sent.`
10126
10140
  );
10141
+ var KIND_IDS = { "handing": "none", "replaced-by": "goal", "blocked-by": "node", "asking": "none", "found": "none" };
10142
+ var KIND_GRAMMAR = "handing, replaced-by <goalId>, blocked-by <goalId|questionId>, asking, found";
10143
+ var uuid = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
10144
+ var handle = /^[0-9a-fA-F-]{8,36}$/;
10145
+ function refuseKind(u, ctx) {
10146
+ if (!u.kind) return;
10147
+ const refuse = (refusal, kind, message) => ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: ["kind"], params: { refusal, kind }, message });
10148
+ const [name, ...rest] = u.kind.trim().split(/\s+/);
10149
+ const shape = KIND_IDS[name];
10150
+ if (!shape) {
10151
+ refuse("kind_unknown", name, `kind_unknown: "${name}" is not a kind. One of: ${KIND_GRAMMAR}.`);
10152
+ return;
10153
+ }
10154
+ const id22 = rest.join(" ");
10155
+ if (shape === "none" && id22) {
10156
+ refuse("kind_takes_no_id", name, `kind_takes_no_id: "${name}" is the whole kind, so drop the "${id22}" after it.`);
10157
+ }
10158
+ if (shape !== "none" && !(shape === "goal" ? uuid.test(id22) : handle.test(id22))) {
10159
+ refuse("kind_needs_id", name, shape === "goal" ? `kind_needs_id: "${name}" names the Goal it is about, as "${name} <goalId>".` : `kind_needs_id: "${name}" names the Goal or Question it is about, as "${name} <goalId|questionId>".`);
10160
+ }
10161
+ if (name === "asking") {
10162
+ refuse("kind_is_a_question", name, 'kind_is_a_question: "asking" owes them an answer, so send it in `questions`, where it opens one.');
10163
+ }
10164
+ if (u.userExplicitlyRequested) {
10165
+ refuse("kind_not_for_the_person", name, `kind_not_for_the_person: "${name}" is written for the other agents on the Goal, and userExplicitlyRequested delivers these words to the person. Split it: one message for them, one for the agent.`);
10166
+ }
10167
+ }
10127
10168
  var UpdateInputSchema = external_exports.object({
10128
- message: external_exports.string().trim().min(1).describe(`The one point, at most ${ASK_MAX} characters; the context goes in units.`),
10169
+ // ONE LOAD-BEARING POINT PER REPORT (owner, 2026-10-27 14:10 on call, Goal 1b1750e9, settling
10170
+ // #3633's pacing: "one point at a time is better, but make sure that it's [load-]bearing ... if
10171
+ // there is a lot of key points that I need to be aware of ... meaning something bad would happen
10172
+ // if I didn't know them or I wouldn't be able to understand something in the future ... They
10173
+ // should go separately. Basically, it should be like one load-bearing thing per report").
10174
+ //
10175
+ // The call's half of that ruling shipped in #3771: the talker settles an item only once the
10176
+ // transcript shows he heard its load-bearing point. This is the author's half, and without it the
10177
+ // talker has to guess which of a report's parts was load-bearing. Measured 2026-11-01 on prod:
10178
+ // 458 of 866 reports in 21 days carried two or more units, and since the pacing shipped on 10-23
10179
+ // only 18 of 72 units that reached a call were ever said -- so a point written as a unit has about
10180
+ // a one-in-four chance of being heard, and one ok after the headline settles the whole report.
10181
+ // Hence the wording, not a `mustHear` flag (the-heard-record.md P3): he asked for less mechanism
10182
+ // and more judgment from the agent, so a point he must not miss is simply its own report.
10183
+ message: external_exports.string().trim().min(1).describe(`The one point, at most ${ASK_MAX} characters: the one thing that would go wrong or stay unclear later if they missed it, said as what changed for them, in their words ("The screen reader speaks Spanish too", not "Merged #3896"). A second point like that is its own update; the rest goes in units.`),
10129
10184
  goalIds: external_exports.array(external_exports.string().uuid()).min(1).max(10).describe("The Goals it is about, each one that exists: the one it is mainly about first."),
10130
10185
  units,
10186
+ causedBy,
10187
+ shipped,
10131
10188
  // A REPORT KEEPS ITS TAP (#2799, #3260; owner, 2026-10-08, settling #2776: "keep the reports open
10132
10189
  // until the user acknowledges them"). A report asks nothing, so it opens no Question -- but it
10133
10190
  // still waits to be acknowledged, and it carries the ONE tap that closes it. Never a decision: the
@@ -10151,6 +10208,12 @@ var UpdateInputSchema = external_exports.object({
10151
10208
  reply: external_exports.string().trim().min(1).describe(
10152
10209
  `What this report's button says instead of "Got it", at most ${OPTION_LABEL_MAX} characters, written in THEIR voice for THIS report ("Sounds good, I'll test later") -- the care you give a question's options, so what they tap tells you whether they verified your work or only received it. One tap sends exactly these words back to you. Words that would CHANGE what happens next are a question, not a reply to a report: it still asks nothing and still owes you no answer. The reply is required for requested delivery and completed Goals; ordinary progress may omit it.`
10153
10210
  ).optional(),
10211
+ // THE KIND, WHICH WAS THE FIRST LINE OF THE MESSAGE UNTIL NOW (`KIND_IDS` above). Optional on
10212
+ // purpose: every agent writing updates today sends none, and a door that refused them would turn a
10213
+ // convention nobody was obliged to follow into a 400 on live traffic.
10214
+ kind: external_exports.string().trim().min(1).optional().describe(
10215
+ `What an agent writing on ANOTHER agent's Goal expects of its reader, as one token: ${KIND_GRAMMAR}. \`handing\` the work is yours now, nothing is asked; \`replaced-by <goalId>\` this Goal is dead and that one carries its work; \`blocked-by <goalId|questionId>\` I cannot go on until that moves, no action unless you own it; \`found\` evidence on your Goal, nothing is asked and nothing has changed. \`asking\` is a question, so it belongs in \`questions\`, not here. It is written for the other agents on the Goal, never the person, so it does not go with userExplicitlyRequested; leave it out for your own progress. Refused by name (kind_unknown, kind_needs_id, kind_takes_no_id, kind_is_a_question, kind_not_for_the_person).`
10216
+ ),
10154
10217
  userExplicitlyRequested
10155
10218
  }).strict().superRefine((u, ctx) => {
10156
10219
  if (u.userExplicitlyRequested && !u.reply) {
@@ -10162,6 +10225,7 @@ var UpdateInputSchema = external_exports.object({
10162
10225
  });
10163
10226
  }
10164
10227
  refuseOverCaps(u.message, u.units, "message", ctx);
10228
+ refuseKind(u, ctx);
10165
10229
  if (u.reply && u.reply.length > OPTION_LABEL_MAX) {
10166
10230
  ctx.addIssue({
10167
10231
  code: external_exports.ZodIssueCode.custom,
@@ -10251,7 +10315,7 @@ var sendFields = {
10251
10315
  "COMPLETIONS close and report in one operation, the same contract as manage_goals kind:complete: closure and the report commit together or neither does. Required children and dependencies must already be finished. options suggest next steps: a tap acknowledges the report and requests that step, and never reopens the Goal (follow-up work needs a new one). No reviewer rejudges it: say only what your evidence supports. Ordinary updates never close a Goal."
10252
10316
  ),
10253
10317
  updates: external_exports.array(UpdateInputSchema).min(1).max(20).optional().describe(
10254
- "News: progress, findings, a result. An update asks nothing. It reaches the person only when they asked for it (userExplicitlyRequested), when it answers something they said, or once its Goal is done; otherwise it is recorded as the Goal's progress, which the person is not told. Every update reaches the other agents that wrote on its Goal in the last hour: to tell another agent something, write it as an update on that agent's Goal."
10318
+ "News: progress, findings, a result. An update asks nothing. It reaches the person only when they asked for it (userExplicitlyRequested), when it answers something they said, or once its Goal is done; otherwise it is recorded as the Goal's progress, which the person is not told. Every update reaches the other agents that wrote on its Goal in the last hour: to tell another agent something, write it as an update on that agent's Goal, with its `kind`.\n\nONE LOAD-BEARING POINT PER REPORT: the message is the point they must not miss; a second point that would go wrong or stay unclear later if they missed it is its own update, never a unit."
10255
10319
  ),
10256
10320
  answers: external_exports.array(AnswerInputSchema).min(1).max(20).optional().describe("Answers to Questions addressed to you."),
10257
10321
  withdrawQuestionIds: external_exports.array(questionHandle).min(1).max(10).optional().describe(
@@ -10289,19 +10353,20 @@ LENGTH: the question, message or answer is the one point, at most ${ASK_MAX} cha
10289
10353
  UPDATES ask nothing. One reaches the person only when they asked for it, it answers something they said, or its Goal is done; else it is kept as progress. One that reaches them joins an open report card or a live call.
10290
10354
 
10291
10355
  RECEIVING: contact({}) waits ~45 s; contact({wait:false}) returns \`events\` at once. Confirm the ones you handled with contact({ackEventIds}).`;
10292
- var HELP_TOPICS = ["pairing", "listening", "receiving", "asking", "updates", "goals", "calls"];
10356
+ var HELP_TOPICS = ["pairing", "listening", "receiving", "asking", "updates", "goals", "organize", "calls"];
10293
10357
  var unknownTopic = (topic) => `unknown_topic: ${JSON.stringify(topic)} is not a section of the guide. Topics: ${HELP_TOPICS.join(", ")}; or omit topic for the whole guide.`;
10294
10358
  var HelpSchema = external_exports.object({
10295
10359
  topic: external_exports.enum(HELP_TOPICS, { errorMap: (_issue, ctx) => ({ message: unknownTopic(ctx.data) }) }).optional().describe("One section of the guide. Omit it for the whole guide.")
10296
10360
  }).strict();
10297
- var HELP_DESCRIPTION = "Start here: how to use Paigy, in full \u2014 pairing, listening, receiving, asking, updates and completions, Goals and calls. Pass a topic for one section. Read-only; needs no setup.";
10361
+ var HELP_DESCRIPTION = "Start here: how to use Paigy, in full \u2014 pairing, listening, receiving, asking, updates and completions, Goals, organizing work, and calls. Pass a topic for one section. Read-only; needs no setup.";
10298
10362
  var AGENT_PROMPTS = [
10299
10363
  {
10300
10364
  name: "help",
10301
10365
  description: "How to use Paigy: the whole guide, or one topic of it.",
10302
10366
  arguments: [{ name: "topic", description: `One section: ${HELP_TOPICS.join(", ")}. Omit it for the whole guide.`, required: false }]
10303
10367
  },
10304
- { name: "welcome", description: "Start here: who you are on Paigy, then listen and collect your open work." }
10368
+ { name: "welcome", description: "Start here: who you are on Paigy, then listen and collect your open work." },
10369
+ { name: "organize", description: "Set up the person's work as a board: areas, projects and steps, proposed on a card before anything is built." }
10305
10370
  ];
10306
10371
  var CreateGoalSchema = external_exports.object({
10307
10372
  outcome: external_exports.string().trim().min(1).max(1e4),
@@ -10350,7 +10415,7 @@ var CreateChange = external_exports.object({
10350
10415
  title: goalTitle,
10351
10416
  outcome: goalOutcome,
10352
10417
  ownerId: external_exports.string().trim().min(1).optional().describe("Who owns the work: an agent's participant (as check_activity shows it) or the person's. Omitted: you."),
10353
- parentGoalId: external_exports.string().uuid().optional().describe("The Goal it belongs under. Omitted: a root."),
10418
+ parentGoalId: external_exports.string().uuid().optional().describe("The Goal it belongs under. Omitted: a root. A project with several parts: create it, then one child per step under it; the person's Work tab counts a project's progress in those steps."),
10354
10419
  sourceEntryIds: external_exports.array(external_exports.string().uuid()).max(20).optional().describe("The whole Entries the work came from, ones you can read.")
10355
10420
  }).strict();
10356
10421
  var EditChange = external_exports.object({ kind: external_exports.literal("edit"), goalId: changedGoal, title: goalTitle.optional(), outcome: goalOutcome.optional() }).strict();
@@ -10395,7 +10460,7 @@ var ManageGoalsSchema = external_exports.object({
10395
10460
  var ManageGoalsToolSchema = external_exports.object({
10396
10461
  changes: external_exports.array(external_exports.discriminatedUnion("kind", [CreateChange, CompleteChangeSchema, EditChange, StateChange, AssignChange, DeferChange, MoveChange, DependencyChange])).min(1).max(50).describe("The changes, applied in order, each on its own.")
10397
10462
  }).strict().superRefine((v, ctx) => editNames(v.changes, ctx));
10398
- var MANAGE_GOALS_DESCRIPTION = "Create, edit, assign, organize or close work. Every change here changes Goals; answering, withdrawing or asking Questions stays in contact. Each change applies independently: a refused one names why (`results[i].error`, e.g. goal_revision_conflict, goal_children_open, goal_not_found) and the rest still apply, so read every result: a partial result is never a complete success. Kinds: complete (goalId, message capped at 50 characters, units, reply, optional next-step options {label, hint}) closes and reports atomically, exactly as contact.completions; create (title, outcome, ownerId, parentGoalId, sourceEntryIds) returns the new Goal's id in `results[i].goalId`, in the order requested, to use in later calls (an outcome is one paragraph, at most 500 characters: split more into child Goals with parentGoalId); edit (title and/or outcome); state (open, completed, canceled); assign (ownerId); defer (until: the Goal waits until then and its owner is woken when it passes; null takes it back); move (parentGoalId, or null for a root: only this Goal moves); dependency (add or remove: goalId waits on dependsOnGoalId to start or to complete). A Goal cannot be completed while its required children or dependencies remain open: finish or move them first. Finishing the children does not prove the parent's own work is done. An edit applies at the version you last read: if someone changed the Goal since, it is refused as goal_revision_conflict, so read it again (get_goals) and reconsider. You may change any Goal of your person; a change puts you on it. Returns `ok` (every change applied), `results` per change (applied or failed), and `goals`, each changed Goal's id, state, title, outcome and revision.";
10463
+ var MANAGE_GOALS_DESCRIPTION = "Create, edit, assign, organize or close work. SHAPE IT AS PROJECTS WITH STEPS: create a project under its area (parentGoalId; a top-level Goal with children is an area), then each part as its child Goal, so the person sees N of M steps. Move a flat or orphaned Goal of yours into that shape when you touch it; a flat Goal is valid. Every change here changes Goals; answering, withdrawing or asking Questions stays in contact. Each change applies independently: a refused one names why (`results[i].error`, e.g. goal_revision_conflict, goal_children_open, goal_not_found) and the rest still apply, so read every result: a partial result is never a complete success. Kinds: complete (goalId, message capped at 50 characters, units, reply, optional next-step options {label, hint}) closes and reports atomically, exactly as contact.completions; create (title, outcome, ownerId, parentGoalId, sourceEntryIds) returns the new Goal's id in `results[i].goalId`, in the order requested, to use in later calls (an outcome is one paragraph, at most 500 characters: split more into child Goals with parentGoalId); edit (title and/or outcome); state (open, completed, canceled); assign (ownerId); defer (until: the Goal waits until then and its owner is woken when it passes; null takes it back); move (parentGoalId, or null for a root: only this Goal moves); dependency (add or remove: goalId waits on dependsOnGoalId to start or to complete). A Goal cannot be completed while its required children or dependencies remain open: finish or move them first. Finishing the children does not prove the parent's own work is done. An edit applies at the version you last read: if someone changed the Goal since, it is refused as goal_revision_conflict, so read it again (get_goals) and reconsider. You may change any Goal of your person; a change puts you on it. Returns `ok` (every change applied), `results` per change (applied or failed), and `goals`, each changed Goal's id, state, title, outcome and revision.";
10399
10464
  var GetGoalsSchema = external_exports.object({
10400
10465
  goalIds: external_exports.array(external_exports.string().uuid()).min(1).max(10).describe("The Goals to read, in order; one to ten IDs."),
10401
10466
  /** Every entry in full. Without it the read carries the person's words, open questions and your
@@ -10417,6 +10482,8 @@ var SearchToolSchema = external_exports.object({
10417
10482
  limit: external_exports.number().int().min(1).max(20).optional()
10418
10483
  }).strict();
10419
10484
  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.";
10485
+ var READS = { readOnlyHint: true, destructiveHint: false, openWorldHint: false };
10486
+ var SENDS = { readOnlyHint: false, destructiveHint: true, openWorldHint: false };
10420
10487
  var ConfigureIdentitySchema = external_exports.object({}).strict();
10421
10488
  var CONFIGURE_IDENTITY_DESCRIPTION = "Read this authenticated agent\u2019s current name, voice and token ID. Read-only; no arguments. Pairing, renaming and logout are available only through the local configure driver.";
10422
10489
  var CheckActivitySchema = external_exports.object({}).strict();
@@ -10428,16 +10495,16 @@ var SendFeedbackSchema = external_exports.object({
10428
10495
  }).strict();
10429
10496
  var SEND_FEEDBACK_DESCRIPTION = "Send feedback about Paigy itself (a bug report, an idea) straight to the Paigy team. Send it only when the person asked you to, or agreed when you offered: it goes to Paigy, never to the person, and nobody answers it here. Not for your work or a question for the person: use contact for those. Returns whether it was stored.";
10430
10497
  var AGENT_TOOLS = [
10431
- { name: "configure", description: CONFIGURE_IDENTITY_DESCRIPTION, inputSchema: mcpInputSchema(ConfigureIdentitySchema) },
10432
- { name: "contact", description: CONTACT_DESCRIPTION, inputSchema: CONTACT_SCHEMA },
10433
- { name: "manage_goals", description: MANAGE_GOALS_DESCRIPTION, inputSchema: mcpInputSchema(ManageGoalsToolSchema) },
10434
- { name: "get_delivery", description: GET_DELIVERY_DESCRIPTION, inputSchema: mcpInputSchema(GetDeliverySchema) },
10435
- { name: "get_goals", description: GET_GOALS_DESCRIPTION, inputSchema: mcpInputSchema(GetGoalsSchema) },
10436
- { name: "search", description: SEARCH_DESCRIPTION, inputSchema: mcpInputSchema(SearchToolSchema) },
10437
- { name: "check_activity", description: "Read your person's agents that contributed in the last 24 hours, newest first: at most 30 agents and their five most recently touched Goals, with their latest entry headline and time. Use get_goals to read a Goal and its other contributors before starting overlapping work. Read-only; no arguments.", inputSchema: mcpInputSchema(CheckActivitySchema) },
10438
- { name: "send_feedback", description: SEND_FEEDBACK_DESCRIPTION, inputSchema: mcpInputSchema(SendFeedbackSchema) },
10498
+ { name: "configure", title: "Who am I", annotations: READS, description: CONFIGURE_IDENTITY_DESCRIPTION, inputSchema: mcpInputSchema(ConfigureIdentitySchema) },
10499
+ { name: "contact", title: "Contact the person", annotations: SENDS, description: CONTACT_DESCRIPTION, inputSchema: CONTACT_SCHEMA },
10500
+ { name: "manage_goals", title: "Manage Goals", annotations: SENDS, description: MANAGE_GOALS_DESCRIPTION, inputSchema: mcpInputSchema(ManageGoalsToolSchema) },
10501
+ { name: "get_delivery", title: "Read a delivery", annotations: READS, description: GET_DELIVERY_DESCRIPTION, inputSchema: mcpInputSchema(GetDeliverySchema) },
10502
+ { name: "get_goals", title: "Read Goals", annotations: READS, description: GET_GOALS_DESCRIPTION, inputSchema: mcpInputSchema(GetGoalsSchema) },
10503
+ { name: "search", title: "Search history", annotations: READS, description: SEARCH_DESCRIPTION, inputSchema: mcpInputSchema(SearchToolSchema) },
10504
+ { name: "check_activity", title: "Recent agent activity", annotations: READS, description: "Read your person's agents that contributed in the last 24 hours, newest first: at most 30 agents and their five most recently touched Goals, with their latest entry headline and time. Use get_goals to read a Goal and its other contributors before starting overlapping work. Read-only; no arguments.", inputSchema: mcpInputSchema(CheckActivitySchema) },
10505
+ { name: "send_feedback", title: "Send feedback to Paigy", annotations: SENDS, description: SEND_FEEDBACK_DESCRIPTION, inputSchema: mcpInputSchema(SendFeedbackSchema) },
10439
10506
  // THE GUIDE FROM INSIDE THE MCP (owner, 2026-10-27): the skill's text, needing no identity (`help.ts`).
10440
- { name: "help", description: HELP_DESCRIPTION, inputSchema: mcpInputSchema(HelpSchema) }
10507
+ { name: "help", title: "Paigy guide", annotations: READS, description: HELP_DESCRIPTION, inputSchema: mcpInputSchema(HelpSchema) }
10441
10508
  ];
10442
10509
  var AGENT_TOOL_NAMES = AGENT_TOOLS.map((t) => t.name);
10443
10510
  var id = external_exports.string().uuid();
@@ -10541,6 +10608,10 @@ var BrainMessageSchema = external_exports.union([
10541
10608
  // WHAT IT ASKS THE AGENT, IN UNDER TEN WORDS (owner, 2026-10-15: "Yes, add the summary"): the talker's own, stored
10542
10609
  // as the sent Entry's summary, which the recap's "Sent to <agent>: …" row shows. Absent on results written before it.
10543
10610
  summary: external_exports.string().optional(),
10611
+ // THE PERSON'S LINES IT CARRIES, IN THEIR WORDS (owner, 2026-11-05: "just deliver my exact words to the agent"): the
10612
+ // `entries` keys of those lines, each relayed whole on the agent's Delivery (`context = false`), where the rest of
10613
+ // `entryKeys` ride as context. Absent on results written before it, and on a message that carries none.
10614
+ carries: external_exports.array(key).optional(),
10544
10615
  // THE PERSON ASKED TO BE CALLED BACK ONCE THIS AGENT'S WORK IS DONE (turns.md, step 0): the agent owes
10545
10616
  // the call, and its next contact about it rings them (`public.callbacks`).
10546
10617
  callback: external_exports.literal(true).optional()
@@ -10604,8 +10675,11 @@ var TalkerReplySchema = external_exports.object({
10604
10675
  * "Yes, add the summary"), which the recap's "Sent to <agent>: …" row shows; `about` names
10605
10676
  * handles; `blocks` is the item a question to an agent must be answered before ("" for none);
10606
10677
  * `callback` is true on a message to the agent doing work the person asked to be called back about
10607
- * once it is done (false otherwise): that agent then owes the call (turns.md, step 0). */
10608
- messages: external_exports.array(external_exports.object({ key: str3, to: str3, sentences: strs2, text: str3, summary: str3, about: strs2, blocks: str3, callback: external_exports.boolean() }).strict()),
10678
+ * once it is done (false otherwise): that agent then owes the call (turns.md, step 0). `lines` are the
10679
+ * person's line handles a message to an agent carries ([] for none): the agent receives those lines, in their
10680
+ * words, and `text` is then only what the talker adds beyond them (owner, 2026-11-05: "just deliver my exact
10681
+ * words to the agent, keeping the summary as a way for me to navigate them more easily"). */
10682
+ messages: external_exports.array(external_exports.object({ key: str3, to: str3, sentences: strs2, text: str3, summary: str3, about: strs2, blocks: str3, callback: external_exports.boolean(), lines: strs2.optional() }).strict()),
10609
10683
  /** What the call does next: listen, hold (the person asked for a moment) or end (they asked to). */
10610
10684
  then: external_exports.enum(["listen", "hold", "end"]),
10611
10685
  /** The person's replies to items (replies, owner 2026-10-07): the item's handle, the chosen option
@@ -10623,9 +10697,14 @@ var TalkerReplySchema = external_exports.object({
10623
10697
  /** The handle of the item to explain ("" for none). */
10624
10698
  explain: str3
10625
10699
  }).strict();
10626
- var TALKER_REPLY_JSON_SCHEMA = (({ $schema: _, ...rest }) => rest)(
10700
+ var TALKER_REPLY_JSON_SCHEMA = withEveryMessageField((({ $schema: _, ...rest }) => rest)(
10627
10701
  zodToJsonSchema(TalkerReplySchema, { $refStrategy: "none" })
10628
- );
10702
+ ));
10703
+ function withEveryMessageField(schema) {
10704
+ const item = schema.properties?.messages?.items;
10705
+ if (item?.properties) item.required = Object.keys(item.properties);
10706
+ return schema;
10707
+ }
10629
10708
  var str4 = external_exports.string();
10630
10709
  var strs3 = external_exports.array(external_exports.string());
10631
10710
  var FilerReplySchema = external_exports.object({
@@ -11217,6 +11296,10 @@ var InboxItemSchema = external_exports.object({
11217
11296
  branch: external_exports.string().optional(),
11218
11297
  createdAt: external_exports.string().datetime(),
11219
11298
  snoozedUntil: external_exports.string().datetime().optional(),
11299
+ /** A past card the person dismissed that Restore can take back (#2699): its newest close is their
11300
+ * dismissal, with what it withdrew recorded (`private.restore_delivery`). Absent on everything else —
11301
+ * a put-off, a card an ended Goal or a settled question closed, and every open card. */
11302
+ restorable: external_exports.boolean().optional(),
11220
11303
  agentState: AgentStateSchema.default("idle"),
11221
11304
  /** Whose action the item is waiting on: "you" = an agent asked you (the default,
11222
11305
  * every agent→user notification); "agent" = you sent a request and it's awaiting the
@@ -11324,11 +11407,41 @@ var InboxItemSchema = external_exports.object({
11324
11407
  rev: external_exports.string().optional()
11325
11408
  });
11326
11409
  var APNS_TOKEN_RE = /^[0-9a-fA-F]{64}$/;
11410
+ var PushDeviceIdSchema = external_exports.string().regex(/^[A-Za-z0-9._:-]{1,200}$/, "not an install id");
11411
+ var PushDeviceSchema = external_exports.object({
11412
+ deviceId: external_exports.string(),
11413
+ platform: external_exports.enum(["ios", "android"]),
11414
+ label: external_exports.string().nullable(),
11415
+ model: external_exports.string().nullable(),
11416
+ /** Calls and banners go here. */
11417
+ rings: external_exports.boolean(),
11418
+ /** It has a token a call can ring. */
11419
+ ringable: external_exports.boolean(),
11420
+ chosenAt: external_exports.string().nullable(),
11421
+ updatedAt: external_exports.string()
11422
+ });
11423
+ var PushTokenDeviceSchema = external_exports.object({
11424
+ deviceId: external_exports.string(),
11425
+ rings: external_exports.boolean(),
11426
+ ask: external_exports.boolean(),
11427
+ ringsOn: external_exports.object({ deviceId: external_exports.string().nullable(), label: external_exports.string().nullable() }).nullable()
11428
+ });
11429
+ var PushRingsSchema = external_exports.object({ rings: external_exports.boolean() });
11327
11430
  var PushTokenSchema = external_exports.object({
11328
11431
  voipToken: external_exports.string().min(1).optional(),
11329
11432
  alertToken: external_exports.string().min(1).optional(),
11330
11433
  fcmToken: external_exports.string().min(1).optional(),
11331
- platform: external_exports.enum(["ios", "android"])
11434
+ platform: external_exports.enum(["ios", "android"]),
11435
+ /** WHICH INSTALL POSTED IT (owner, 2026-11-05: "Ask on each new device"). Absent from every
11436
+ * build before it, and then the post is exactly what it always was: the one row per account.
11437
+ * With it, the install has its own row and calls ring only where the person chose. */
11438
+ deviceId: PushDeviceIdSchema.optional(),
11439
+ /** The install's name as the person knows it ("iPhone", "iPad"), and its model. */
11440
+ label: external_exports.string().trim().min(1).max(80).optional(),
11441
+ model: external_exports.string().trim().min(1).max(80).optional(),
11442
+ /** The person's choice, when the post carries it; absent, the install keeps what it has (and
11443
+ * its first ring token decides once: it rings unless another install already does). */
11444
+ rings: external_exports.boolean().optional()
11332
11445
  }).superRefine((v, ctx) => {
11333
11446
  if (v.platform !== "ios") return;
11334
11447
  for (const field of ["voipToken", "alertToken"]) {
@@ -11397,8 +11510,8 @@ var UserSettingsSchema = external_exports.object({
11397
11510
  * write, 'hosted' on read (see store.ts). */
11398
11511
  voiceMode: external_exports.enum(["hosted", "on_device"]).optional(),
11399
11512
  /** `talk` lived here until #2373: it gated auto-play, which went in #2374. An older bundle's
11400
- * `talk` is stripped like `silentPush` was; the `user_settings.talk` column outlives it until
11401
- * its own drop migration (#2373, step two). */
11513
+ * `talk` is stripped like `silentPush` was, and the `user_settings.talk` column went in
11514
+ * 20261028142255. */
11402
11515
  /** CALL DIAGNOSTICS (owner, 2026-10-01): the call report carries each listen and the bot's own
11403
11516
  * load timings. SERVER-SET, no UI — on for every account that existed on 2026-10-01, off for
11404
11517
  * newer ones (migration 20261001132859). Read-only here: the settings PATCH never writes it. */
@@ -11438,7 +11551,11 @@ var GoalLatestSchema = external_exports.object({
11438
11551
  titles: external_exports.array(external_exports.string()).optional(),
11439
11552
  /** A PROGRESS NOTE'S ONE POINT ("An agent's progress note -> maybe let's cap it at 200 chars"): the
11440
11553
  * update's own line, before its units; the row caps it at 200. Absent on anything else. */
11441
- line: external_exports.string().optional()
11554
+ line: external_exports.string().optional(),
11555
+ /** THE PERSON'S ENTRIES IT CARRIED TO AN AGENT, IN THEIR WORDS (owner, 2026-11-05: "paraphrasing shouldn't change
11556
+ * attribution in the UI"): on a message Paigy sent an agent, the person's Entries its Delivery relays whole. A row
11557
+ * draws it as theirs. Absent on anything else, and from a door older than it. */
11558
+ carries: external_exports.array(external_exports.string()).optional()
11442
11559
  });
11443
11560
  var HistoryWorkSchema = external_exports.object({
11444
11561
  id: external_exports.string(),
@@ -11505,6 +11622,12 @@ var ConnectionSummarySchema = external_exports.object({
11505
11622
  * its Goals — wrote on one or recorded an operation (`tokens.last_worked_at`). Within
11506
11623
  * `WORKING_MS` it is working; otherwise it is connected but idle. Null = not seen working yet. */
11507
11624
  lastWorkedAt: external_exports.string().datetime().nullable().optional(),
11625
+ /** A TERMINAL SESSION'S ONLY PULSE (`tokens.listened_at`): `paigy-listen` stamps it on every sweep
11626
+ * (90 s). It is deliberately NOT presence — `last_seen_at` is the desktop host's beat, and a
11627
+ * listener orphaned from a dead conversation must not light the live dot — but it is the one fact
11628
+ * that says a terminal session's process is UP, which is why the wake already reads it
11629
+ * (`wake.ts`, `listener`). Null = no listener sweeping. */
11630
+ listenedAt: external_exports.string().datetime().nullable().optional(),
11508
11631
  /** The oldest of its Goals that is `ready` for it — work handed to it that nobody has started.
11509
11632
  * With no work of its own for `WORKING_MS`, an agent sitting on this is not taking its work. */
11510
11633
  oldestReadyAt: external_exports.string().datetime().nullable().optional(),
@@ -11701,6 +11824,11 @@ var QueueItemSchema = external_exports.object({
11701
11824
  * and a door older than 20261013045542 need not spell them. */
11702
11825
  yours: GoalLatestSchema.nullable().optional(),
11703
11826
  theirs: GoalLatestSchema.nullable().optional(),
11827
+ /** ITS STEPS, COUNTED IN THE DATABASE (owner, 2026-11-04: "Count on the server, and agents make steps"): its
11828
+ * direct children that were not cancelled, and how many of them are done. The queue holds only a recent
11829
+ * slice of finished work, so counting `childGoalIds` read "0 of 1" for a project with five done. Absent
11830
+ * from a door older than this field, or when the count failed: the app then counts what it holds. */
11831
+ steps: external_exports.object({ total: external_exports.number().int().nonnegative(), done: external_exports.number().int().nonnegative() }).nullable().optional(),
11704
11832
  /** WHAT THIS ROW IS, IN TWELVE CHARACTERS (#2928) — the hash of every other field on it, stamped
11705
11833
  * by the one projection that builds the row (`apps/api/src/goal/queue.ts`). It is how the
11706
11834
  * incremental read knows a row has not moved: the phone echoes back the revs it holds
@@ -11834,7 +11962,7 @@ var DeviceTokenSchema = external_exports.object({
11834
11962
  * the thread each time (host.ts, live catch 2026-08-06 — prompt-papered until now). */
11835
11963
  workspace: external_exports.string().nullable().optional(),
11836
11964
  /** Local host recovery must preserve the launch's runtime and Paigy identity. */
11837
- harness: external_exports.enum(["claude", "codex", "agy"]).optional(),
11965
+ harness: external_exports.enum(["claude", "codex", "agy", "grok"]).optional(),
11838
11966
  session_id: external_exports.string().uuid().optional(),
11839
11967
  /** A conversation the host must not resume: its context is full, so every turn fails
11840
11968
  * ("Prompt is too long"). Written when a run hits it (`run.ts` `onFull`); the host skips a slot
@@ -12056,6 +12184,12 @@ var CallRecapSchema = external_exports.object({
12056
12184
  * summary (Brain, 2026-10-14). Optional: absent from an API before it. */
12057
12185
  filedOn: external_exports.array(external_exports.object({ goalId: external_exports.string().uuid(), title: external_exports.string() })).optional(),
12058
12186
  recorded: external_exports.boolean().optional(),
12187
+ /** On a `said` row: the agents the call SENT those words to, from the sending action's own
12188
+ * `about.agents` (20261106220220). The review's receipt is drawn from this and from the row's
12189
+ * own `requestId`, never from the asker of a question the words happened to sit under: on call
12190
+ * f9670f67 that asker was Interface while the send named Comms. `[]` or absent means nothing
12191
+ * was sent for that row, which is why the receipt is positive-only. */
12192
+ sentTo: external_exports.array(external_exports.object({ id: external_exports.string().nullable(), name: external_exports.string() })).optional(),
12059
12193
  settled: external_exports.object({ requestId: external_exports.string(), answer: external_exports.string() }).nullable().optional(),
12060
12194
  acknowledged: external_exports.boolean().optional(),
12061
12195
  /** On a `put` row: still waiting for the person's answer (not settled, not answered, not put off).
@@ -12334,6 +12468,10 @@ async function listConnections(opts = {}) {
12334
12468
  var NOT_SENT = `Recorded as the Goal's progress, not sent to the person; the other agents that wrote on the Goal in the last hour are told. The person is told only a question, an answer to one they asked you, and what you say once the Goal is done. To close the work, send contact.completions or manage_goals kind:complete with the shared completion report, closing and reporting together. If the person asked you, in so many words, to send them this, send it again with userExplicitlyRequested: "any" on that update.`;
12335
12469
  var APPLIED = "Applied; nothing was sent to the person.";
12336
12470
  var DEMOTED = "Delivered as a card, not a call: the person's settings do not allow a call right now (silent, quiet hours, or a mode). It has reached them; do not send it again.";
12471
+ function citeOf(receipt) {
12472
+ if (!receipt.uncited?.length) return {};
12473
+ return { uncited: receipt.uncited, ...receipt.cite ? { cite: receipt.cite } : {} };
12474
+ }
12337
12475
  async function readDelivery(deliveryId, opts = {}) {
12338
12476
  const query = opts.transcript ? `?transcript=1${opts.after ? `&after=${encodeURIComponent(opts.after)}` : ""}` : "";
12339
12477
  const res = await ensureAuthed(await (opts.reach ?? reach)(`${BACKEND_URL}/api/deliveries/${encodeURIComponent(deliveryId)}${query}`, {
@@ -12375,7 +12513,7 @@ async function contact(input, opts = {}) {
12375
12513
  const demoted = askedCall && receipt.channel && receipt.channel !== "call" ? DEMOTED : void 0;
12376
12514
  const acked = acknowledged ? { acknowledged } : {};
12377
12515
  if (!deliveries.length) {
12378
- return { sent: false, ok, results, ...recorded.length ? { recorded } : {}, message: recorded.length ? NOT_SENT : APPLIED, waitOutcome: "not_waited", ...acked };
12516
+ return { sent: false, ok, results, ...recorded.length ? { recorded } : {}, message: recorded.length ? NOT_SENT : APPLIED, waitOutcome: "not_waited", ...acked, ...citeOf(receipt) };
12379
12517
  }
12380
12518
  const lead = deliveries.find((d) => d.kind === "question") ?? deliveries[0];
12381
12519
  const read3 = async (signal2) => {
@@ -12392,7 +12530,8 @@ async function contact(input, opts = {}) {
12392
12530
  ...demoted ? { demoted } : {},
12393
12531
  ...acked,
12394
12532
  ...receipt.ringPolicy ? { ringPolicy: receipt.ringPolicy, ...receipt.message ? { ringHeld: receipt.message } : {} } : {},
12395
- ...receipt.recheckAt ? { recheckAt: receipt.recheckAt } : {}
12533
+ ...receipt.recheckAt ? { recheckAt: receipt.recheckAt } : {},
12534
+ ...citeOf(receipt)
12396
12535
  };
12397
12536
  };
12398
12537
  const settled = (d) => d.state === "closed" || d.answers.length > 0 || d.entries.some((e) => e.kind === "contribution" && !entryUnit(e));
@@ -12637,12 +12776,23 @@ var CATALOG = [
12637
12776
  loginHint: "Install and set up Antigravity (`agy`).",
12638
12777
  installCli: "curl -fsSL https://antigravity.dev/install.sh | bash",
12639
12778
  models: ["gemini-1.5-pro", "gemini-1.5-flash", "gemini-2.0-pro-exp"]
12779
+ },
12780
+ {
12781
+ name: "grok",
12782
+ label: "Grok",
12783
+ cli: "grok",
12784
+ // `grok agent stdio` speaks ACP itself. A separate adapter would be a second binary
12785
+ // to miss, and detection would report adapter-missing on a machine that can already launch.
12786
+ authProbe: ["sh", "-c", 'test -s "$HOME/.grok/auth.json"'],
12787
+ loginHint: "Run `grok` once in a terminal and sign in.",
12788
+ installCli: "curl -fsSL https://x.ai/cli/install.sh | bash"
12640
12789
  }
12641
12790
  ];
12642
12791
  function probeDirs(home = homedir3()) {
12643
12792
  return [
12644
12793
  dirname(process.execPath),
12645
12794
  join4(home, ".local", "bin"),
12795
+ join4(home, ".grok", "bin"),
12646
12796
  "/usr/local/bin",
12647
12797
  "/opt/homebrew/bin",
12648
12798
  join4(home, ".npm-global", "bin")
@@ -14055,10 +14205,22 @@ function capRefusals2(text, units22, field) {
14055
14205
  function refuseOverCaps2(text, units22, field, ctx) {
14056
14206
  for (const { path, message, ...params } of capRefusals2(text, units22, field)) ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path, message, params });
14057
14207
  }
14208
+ var SHIPPED2 = ["phone", "calls", "server", "store", "agents"];
14209
+ var CAUSES_MAX2 = 10;
14210
+ var shipped2 = external_exports.enum(SHIPPED2, {
14211
+ errorMap: () => ({ message: `shipped_unknown: one of ${SHIPPED2.join(", ")}.` })
14212
+ }).optional().describe(
14213
+ "Only when this reports a result that LANDED somewhere the person can see it: phone (an app update reached their phone), calls (the voice bot), server, store (the App Store) or agents (the MCP or SDK). Leave it out for work in progress."
14214
+ );
14215
+ var causedBy2 = external_exports.array(
14216
+ external_exports.string().trim().regex(/^[0-9a-fA-F-]{8,36}$/, "cause_not_found: an Entry id, or the short id get_goals prints for the person's words.")
14217
+ ).min(1).max(CAUSES_MAX2, `too_many_causes: at most ${CAUSES_MAX2}.`).optional().describe(
14218
+ `The person's own words this acts on: the ids (or the short ids get_goals prints) of their answers or notes that led to it, at most ${CAUSES_MAX2}. Their app shows each result under the words that caused it, so name every one this follows from. An id that is not their words is refused by name (cause_not_found, cause_ambiguous) and nothing is written.`
14219
+ );
14058
14220
  var COMPLETION_MESSAGE_MAX2 = 50;
14059
14221
  var CompletionSchema2 = external_exports.object({
14060
14222
  goalId: external_exports.string().uuid().describe("The existing Goal to complete."),
14061
- message: external_exports.string().trim().min(1).max(COMPLETION_MESSAGE_MAX2, "completion_message_too_long: at most 50 characters; put detail in units.").describe("Completion headline, at most 50 characters."),
14223
+ message: external_exports.string().trim().min(1).max(COMPLETION_MESSAGE_MAX2, "completion_message_too_long: at most 50 characters; put detail in units.").describe("Completion headline, at most 50 characters: the one thing that would go wrong or stay unclear later if they missed it."),
14062
14224
  units: external_exports.array(UnitInputSchema2.extend({
14063
14225
  title: external_exports.string().trim().min(1).max(UNIT_TITLE_MAX2),
14064
14226
  body: external_exports.string().trim().min(1).max(UNIT_BODY_MAX2)
@@ -14067,17 +14229,19 @@ var CompletionSchema2 = external_exports.object({
14067
14229
  options: external_exports.array(external_exports.object({
14068
14230
  label: external_exports.string().trim().min(1).max(OPTION_LABEL_MAX2),
14069
14231
  hint: external_exports.string().trim().min(1).max(OPTION_HINT_MAX2)
14070
- }).strict()).max(5).optional().describe("Optional next steps the person may initiate: label (50 characters) and consequence in hint (200). Selecting one acknowledges the report and requests that step from its author; it never reopens this Goal.")
14232
+ }).strict()).max(5).optional().describe("Optional next steps the person may initiate: label (50 characters) and consequence in hint (200). Selecting one acknowledges the report and requests that step from its author; it never reopens this Goal."),
14233
+ causedBy: causedBy2,
14234
+ shipped: shipped2
14071
14235
  }).strict();
14072
- var CompleteChangeSchema2 = CompletionSchema2.extend({ kind: external_exports.literal("complete") });
14236
+ var CompleteChangeSchema2 = CompletionSchema2.omit({ causedBy: true, shipped: true }).extend({ kind: external_exports.literal("complete") });
14073
14237
  var ASKING_RULES2 = `HOW TO ASK:
14074
14238
  1. One question per object in \`questions\`, so each is answered on its own.
14075
14239
  2. \`goalId\` names the existing Goal it is about (create one with manage_goals first); the answer comes back there.
14076
- 3. \`workItBlocks\` only when you are truly blocked: it asks for a call.
14240
+ 3. They asked you to call? \`userExplicitlyRequested:"call"\`; \`workItBlocks\` rings when blocked.
14077
14241
  4. No while-loops. While any Call is open, even one your question joined from their items, keep receiving through empty windows; otherwise stop at one: the answer reaches you on the Goal. Yield only with a listener or wakeup.
14078
14242
  5. One question, one row: never re-send one still waiting; take back one that no longer matters with \`withdrawQuestionIds\`.
14079
14243
  6. Read the Goal before asking; never re-ask what was answered or shipped. \`replied\` means they chose no option: it is still yours to settle.
14080
- 7. Give options when you have them. Each label names its choice in full (never "Option 2"); never add "Other". \`pickMode\`: one (default), many, rank.
14244
+ 7. Give options when you have them. Each label names its choice in full (never "Option 2"); never add "Other".
14081
14245
  8. A diagnosis says when, why and how it happens, then proposes one fix.
14082
14246
  9. Give a report its \`reply\`: one line in THEIR voice for THAT report, so you learn whether they verified it or only received it. Required when it is delivered or its Goal is done.`;
14083
14247
  function draft20202(node) {
@@ -14119,15 +14283,58 @@ var reason2 = external_exports.string().trim().min(1).max(500).describe("Why, as
14119
14283
  var actionFits2 = (b) => b.blocked.type === "goal" === (b.action !== "answer");
14120
14284
  var ACTION_FITS2 = "a goal is blocked from start or complete; a question from answer";
14121
14285
  var userExplicitlyRequested2 = external_exports.enum(["any", "call"]).optional().describe(
14122
- `Only what the person said about THIS message, in so many words: "any" when they asked you to send it to them ("send it to my phone", "message me the result"), "call" when they asked to be called about it. It is then delivered (a call rings for the whole contact, and carries everything waiting on them); omitted, an update is only recorded as the Goal's progress unless the person needs it. Never set it to make a message louder.`
14286
+ 'What the person asked for about THIS message, in so many words: "any" when they asked you to send it to them ("send it to my phone", "message me the result"), "call" when they asked to be called about it. It is then delivered (a call rings for the whole contact, and carries everything waiting on them); omitted, an update is only recorded as the Goal\'s progress unless the person needs it. ALSO "any" whenever this message directly answers a question they asked you, wherever they asked it -- on a call, in a reply, in passing: their question is the request, so it is delivered every time, even with no pending question of theirs on file and even if they never said to send it. A correction of something you or another agent told them is such an answer. Never set it to make a message louder. This is the field that rings a phone: "call" here is how you call them when they asked you to, and `help` has the whole mechanism.'
14123
14287
  );
14124
14288
  var units2 = external_exports.array(UnitInputSchema2).optional().describe(
14125
- `The context this message needs, as up to ${UNITS_MAX2} units in reading order, each {title, body}: a title of at most ${UNIT_TITLE_MAX2} characters and a body of at most ${UNIT_BODY_MAX2}. One idea per unit. Leave it out when the main text says it all. Over a cap is refused by name (ask_too_long, too_many_units, unit_title_too_long, unit_body_too_long) and nothing is sent.`
14289
+ `The context this message needs, as up to ${UNITS_MAX2} units in reading order, each {title, body}: a title of at most ${UNIT_TITLE_MAX2} characters and a body of at most ${UNIT_BODY_MAX2}. One idea per unit: context they may open, never something they must hear. Leave it out when the main text says it all. Over a cap is refused by name (ask_too_long, too_many_units, unit_title_too_long, unit_body_too_long) and nothing is sent.`
14126
14290
  );
14291
+ var KIND_IDS2 = { "handing": "none", "replaced-by": "goal", "blocked-by": "node", "asking": "none", "found": "none" };
14292
+ var KIND_GRAMMAR2 = "handing, replaced-by <goalId>, blocked-by <goalId|questionId>, asking, found";
14293
+ var uuid2 = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
14294
+ var handle2 = /^[0-9a-fA-F-]{8,36}$/;
14295
+ function refuseKind2(u, ctx) {
14296
+ if (!u.kind) return;
14297
+ const refuse = (refusal, kind, message) => ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: ["kind"], params: { refusal, kind }, message });
14298
+ const [name, ...rest] = u.kind.trim().split(/\s+/);
14299
+ const shape = KIND_IDS2[name];
14300
+ if (!shape) {
14301
+ refuse("kind_unknown", name, `kind_unknown: "${name}" is not a kind. One of: ${KIND_GRAMMAR2}.`);
14302
+ return;
14303
+ }
14304
+ const id22 = rest.join(" ");
14305
+ if (shape === "none" && id22) {
14306
+ refuse("kind_takes_no_id", name, `kind_takes_no_id: "${name}" is the whole kind, so drop the "${id22}" after it.`);
14307
+ }
14308
+ if (shape !== "none" && !(shape === "goal" ? uuid2.test(id22) : handle2.test(id22))) {
14309
+ refuse("kind_needs_id", name, shape === "goal" ? `kind_needs_id: "${name}" names the Goal it is about, as "${name} <goalId>".` : `kind_needs_id: "${name}" names the Goal or Question it is about, as "${name} <goalId|questionId>".`);
14310
+ }
14311
+ if (name === "asking") {
14312
+ refuse("kind_is_a_question", name, 'kind_is_a_question: "asking" owes them an answer, so send it in `questions`, where it opens one.');
14313
+ }
14314
+ if (u.userExplicitlyRequested) {
14315
+ refuse("kind_not_for_the_person", name, `kind_not_for_the_person: "${name}" is written for the other agents on the Goal, and userExplicitlyRequested delivers these words to the person. Split it: one message for them, one for the agent.`);
14316
+ }
14317
+ }
14127
14318
  var UpdateInputSchema2 = external_exports.object({
14128
- message: external_exports.string().trim().min(1).describe(`The one point, at most ${ASK_MAX2} characters; the context goes in units.`),
14319
+ // ONE LOAD-BEARING POINT PER REPORT (owner, 2026-10-27 14:10 on call, Goal 1b1750e9, settling
14320
+ // #3633's pacing: "one point at a time is better, but make sure that it's [load-]bearing ... if
14321
+ // there is a lot of key points that I need to be aware of ... meaning something bad would happen
14322
+ // if I didn't know them or I wouldn't be able to understand something in the future ... They
14323
+ // should go separately. Basically, it should be like one load-bearing thing per report").
14324
+ //
14325
+ // The call's half of that ruling shipped in #3771: the talker settles an item only once the
14326
+ // transcript shows he heard its load-bearing point. This is the author's half, and without it the
14327
+ // talker has to guess which of a report's parts was load-bearing. Measured 2026-11-01 on prod:
14328
+ // 458 of 866 reports in 21 days carried two or more units, and since the pacing shipped on 10-23
14329
+ // only 18 of 72 units that reached a call were ever said -- so a point written as a unit has about
14330
+ // a one-in-four chance of being heard, and one ok after the headline settles the whole report.
14331
+ // Hence the wording, not a `mustHear` flag (the-heard-record.md P3): he asked for less mechanism
14332
+ // and more judgment from the agent, so a point he must not miss is simply its own report.
14333
+ message: external_exports.string().trim().min(1).describe(`The one point, at most ${ASK_MAX2} characters: the one thing that would go wrong or stay unclear later if they missed it, said as what changed for them, in their words ("The screen reader speaks Spanish too", not "Merged #3896"). A second point like that is its own update; the rest goes in units.`),
14129
14334
  goalIds: external_exports.array(external_exports.string().uuid()).min(1).max(10).describe("The Goals it is about, each one that exists: the one it is mainly about first."),
14130
14335
  units: units2,
14336
+ causedBy: causedBy2,
14337
+ shipped: shipped2,
14131
14338
  // A REPORT KEEPS ITS TAP (#2799, #3260; owner, 2026-10-08, settling #2776: "keep the reports open
14132
14339
  // until the user acknowledges them"). A report asks nothing, so it opens no Question -- but it
14133
14340
  // still waits to be acknowledged, and it carries the ONE tap that closes it. Never a decision: the
@@ -14151,6 +14358,12 @@ var UpdateInputSchema2 = external_exports.object({
14151
14358
  reply: external_exports.string().trim().min(1).describe(
14152
14359
  `What this report's button says instead of "Got it", at most ${OPTION_LABEL_MAX2} characters, written in THEIR voice for THIS report ("Sounds good, I'll test later") -- the care you give a question's options, so what they tap tells you whether they verified your work or only received it. One tap sends exactly these words back to you. Words that would CHANGE what happens next are a question, not a reply to a report: it still asks nothing and still owes you no answer. The reply is required for requested delivery and completed Goals; ordinary progress may omit it.`
14153
14360
  ).optional(),
14361
+ // THE KIND, WHICH WAS THE FIRST LINE OF THE MESSAGE UNTIL NOW (`KIND_IDS` above). Optional on
14362
+ // purpose: every agent writing updates today sends none, and a door that refused them would turn a
14363
+ // convention nobody was obliged to follow into a 400 on live traffic.
14364
+ kind: external_exports.string().trim().min(1).optional().describe(
14365
+ `What an agent writing on ANOTHER agent's Goal expects of its reader, as one token: ${KIND_GRAMMAR2}. \`handing\` the work is yours now, nothing is asked; \`replaced-by <goalId>\` this Goal is dead and that one carries its work; \`blocked-by <goalId|questionId>\` I cannot go on until that moves, no action unless you own it; \`found\` evidence on your Goal, nothing is asked and nothing has changed. \`asking\` is a question, so it belongs in \`questions\`, not here. It is written for the other agents on the Goal, never the person, so it does not go with userExplicitlyRequested; leave it out for your own progress. Refused by name (kind_unknown, kind_needs_id, kind_takes_no_id, kind_is_a_question, kind_not_for_the_person).`
14366
+ ),
14154
14367
  userExplicitlyRequested: userExplicitlyRequested2
14155
14368
  }).strict().superRefine((u, ctx) => {
14156
14369
  if (u.userExplicitlyRequested && !u.reply) {
@@ -14162,6 +14375,7 @@ var UpdateInputSchema2 = external_exports.object({
14162
14375
  });
14163
14376
  }
14164
14377
  refuseOverCaps2(u.message, u.units, "message", ctx);
14378
+ refuseKind2(u, ctx);
14165
14379
  if (u.reply && u.reply.length > OPTION_LABEL_MAX2) {
14166
14380
  ctx.addIssue({
14167
14381
  code: external_exports.ZodIssueCode.custom,
@@ -14251,7 +14465,7 @@ var sendFields2 = {
14251
14465
  "COMPLETIONS close and report in one operation, the same contract as manage_goals kind:complete: closure and the report commit together or neither does. Required children and dependencies must already be finished. options suggest next steps: a tap acknowledges the report and requests that step, and never reopens the Goal (follow-up work needs a new one). No reviewer rejudges it: say only what your evidence supports. Ordinary updates never close a Goal."
14252
14466
  ),
14253
14467
  updates: external_exports.array(UpdateInputSchema2).min(1).max(20).optional().describe(
14254
- "News: progress, findings, a result. An update asks nothing. It reaches the person only when they asked for it (userExplicitlyRequested), when it answers something they said, or once its Goal is done; otherwise it is recorded as the Goal's progress, which the person is not told. Every update reaches the other agents that wrote on its Goal in the last hour: to tell another agent something, write it as an update on that agent's Goal."
14468
+ "News: progress, findings, a result. An update asks nothing. It reaches the person only when they asked for it (userExplicitlyRequested), when it answers something they said, or once its Goal is done; otherwise it is recorded as the Goal's progress, which the person is not told. Every update reaches the other agents that wrote on its Goal in the last hour: to tell another agent something, write it as an update on that agent's Goal, with its `kind`.\n\nONE LOAD-BEARING POINT PER REPORT: the message is the point they must not miss; a second point that would go wrong or stay unclear later if they missed it is its own update, never a unit."
14255
14469
  ),
14256
14470
  answers: external_exports.array(AnswerInputSchema2).min(1).max(20).optional().describe("Answers to Questions addressed to you."),
14257
14471
  withdrawQuestionIds: external_exports.array(questionHandle2).min(1).max(10).optional().describe(
@@ -14289,19 +14503,20 @@ LENGTH: the question, message or answer is the one point, at most ${ASK_MAX2} ch
14289
14503
  UPDATES ask nothing. One reaches the person only when they asked for it, it answers something they said, or its Goal is done; else it is kept as progress. One that reaches them joins an open report card or a live call.
14290
14504
 
14291
14505
  RECEIVING: contact({}) waits ~45 s; contact({wait:false}) returns \`events\` at once. Confirm the ones you handled with contact({ackEventIds}).`;
14292
- var HELP_TOPICS2 = ["pairing", "listening", "receiving", "asking", "updates", "goals", "calls"];
14506
+ var HELP_TOPICS2 = ["pairing", "listening", "receiving", "asking", "updates", "goals", "organize", "calls"];
14293
14507
  var unknownTopic2 = (topic) => `unknown_topic: ${JSON.stringify(topic)} is not a section of the guide. Topics: ${HELP_TOPICS2.join(", ")}; or omit topic for the whole guide.`;
14294
14508
  var HelpSchema2 = external_exports.object({
14295
14509
  topic: external_exports.enum(HELP_TOPICS2, { errorMap: (_issue, ctx) => ({ message: unknownTopic2(ctx.data) }) }).optional().describe("One section of the guide. Omit it for the whole guide.")
14296
14510
  }).strict();
14297
- var HELP_DESCRIPTION2 = "Start here: how to use Paigy, in full \u2014 pairing, listening, receiving, asking, updates and completions, Goals and calls. Pass a topic for one section. Read-only; needs no setup.";
14511
+ var HELP_DESCRIPTION2 = "Start here: how to use Paigy, in full \u2014 pairing, listening, receiving, asking, updates and completions, Goals, organizing work, and calls. Pass a topic for one section. Read-only; needs no setup.";
14298
14512
  var AGENT_PROMPTS2 = [
14299
14513
  {
14300
14514
  name: "help",
14301
14515
  description: "How to use Paigy: the whole guide, or one topic of it.",
14302
14516
  arguments: [{ name: "topic", description: `One section: ${HELP_TOPICS2.join(", ")}. Omit it for the whole guide.`, required: false }]
14303
14517
  },
14304
- { name: "welcome", description: "Start here: who you are on Paigy, then listen and collect your open work." }
14518
+ { name: "welcome", description: "Start here: who you are on Paigy, then listen and collect your open work." },
14519
+ { name: "organize", description: "Set up the person's work as a board: areas, projects and steps, proposed on a card before anything is built." }
14305
14520
  ];
14306
14521
  var CreateGoalSchema2 = external_exports.object({
14307
14522
  outcome: external_exports.string().trim().min(1).max(1e4),
@@ -14350,7 +14565,7 @@ var CreateChange2 = external_exports.object({
14350
14565
  title: goalTitle2,
14351
14566
  outcome: goalOutcome2,
14352
14567
  ownerId: external_exports.string().trim().min(1).optional().describe("Who owns the work: an agent's participant (as check_activity shows it) or the person's. Omitted: you."),
14353
- parentGoalId: external_exports.string().uuid().optional().describe("The Goal it belongs under. Omitted: a root."),
14568
+ parentGoalId: external_exports.string().uuid().optional().describe("The Goal it belongs under. Omitted: a root. A project with several parts: create it, then one child per step under it; the person's Work tab counts a project's progress in those steps."),
14354
14569
  sourceEntryIds: external_exports.array(external_exports.string().uuid()).max(20).optional().describe("The whole Entries the work came from, ones you can read.")
14355
14570
  }).strict();
14356
14571
  var EditChange2 = external_exports.object({ kind: external_exports.literal("edit"), goalId: changedGoal2, title: goalTitle2.optional(), outcome: goalOutcome2.optional() }).strict();
@@ -14395,7 +14610,7 @@ var ManageGoalsSchema2 = external_exports.object({
14395
14610
  var ManageGoalsToolSchema2 = external_exports.object({
14396
14611
  changes: external_exports.array(external_exports.discriminatedUnion("kind", [CreateChange2, CompleteChangeSchema2, EditChange2, StateChange2, AssignChange2, DeferChange2, MoveChange2, DependencyChange2])).min(1).max(50).describe("The changes, applied in order, each on its own.")
14397
14612
  }).strict().superRefine((v, ctx) => editNames2(v.changes, ctx));
14398
- var MANAGE_GOALS_DESCRIPTION2 = "Create, edit, assign, organize or close work. Every change here changes Goals; answering, withdrawing or asking Questions stays in contact. Each change applies independently: a refused one names why (`results[i].error`, e.g. goal_revision_conflict, goal_children_open, goal_not_found) and the rest still apply, so read every result: a partial result is never a complete success. Kinds: complete (goalId, message capped at 50 characters, units, reply, optional next-step options {label, hint}) closes and reports atomically, exactly as contact.completions; create (title, outcome, ownerId, parentGoalId, sourceEntryIds) returns the new Goal's id in `results[i].goalId`, in the order requested, to use in later calls (an outcome is one paragraph, at most 500 characters: split more into child Goals with parentGoalId); edit (title and/or outcome); state (open, completed, canceled); assign (ownerId); defer (until: the Goal waits until then and its owner is woken when it passes; null takes it back); move (parentGoalId, or null for a root: only this Goal moves); dependency (add or remove: goalId waits on dependsOnGoalId to start or to complete). A Goal cannot be completed while its required children or dependencies remain open: finish or move them first. Finishing the children does not prove the parent's own work is done. An edit applies at the version you last read: if someone changed the Goal since, it is refused as goal_revision_conflict, so read it again (get_goals) and reconsider. You may change any Goal of your person; a change puts you on it. Returns `ok` (every change applied), `results` per change (applied or failed), and `goals`, each changed Goal's id, state, title, outcome and revision.";
14613
+ var MANAGE_GOALS_DESCRIPTION2 = "Create, edit, assign, organize or close work. SHAPE IT AS PROJECTS WITH STEPS: create a project under its area (parentGoalId; a top-level Goal with children is an area), then each part as its child Goal, so the person sees N of M steps. Move a flat or orphaned Goal of yours into that shape when you touch it; a flat Goal is valid. Every change here changes Goals; answering, withdrawing or asking Questions stays in contact. Each change applies independently: a refused one names why (`results[i].error`, e.g. goal_revision_conflict, goal_children_open, goal_not_found) and the rest still apply, so read every result: a partial result is never a complete success. Kinds: complete (goalId, message capped at 50 characters, units, reply, optional next-step options {label, hint}) closes and reports atomically, exactly as contact.completions; create (title, outcome, ownerId, parentGoalId, sourceEntryIds) returns the new Goal's id in `results[i].goalId`, in the order requested, to use in later calls (an outcome is one paragraph, at most 500 characters: split more into child Goals with parentGoalId); edit (title and/or outcome); state (open, completed, canceled); assign (ownerId); defer (until: the Goal waits until then and its owner is woken when it passes; null takes it back); move (parentGoalId, or null for a root: only this Goal moves); dependency (add or remove: goalId waits on dependsOnGoalId to start or to complete). A Goal cannot be completed while its required children or dependencies remain open: finish or move them first. Finishing the children does not prove the parent's own work is done. An edit applies at the version you last read: if someone changed the Goal since, it is refused as goal_revision_conflict, so read it again (get_goals) and reconsider. You may change any Goal of your person; a change puts you on it. Returns `ok` (every change applied), `results` per change (applied or failed), and `goals`, each changed Goal's id, state, title, outcome and revision.";
14399
14614
  var GetGoalsSchema2 = external_exports.object({
14400
14615
  goalIds: external_exports.array(external_exports.string().uuid()).min(1).max(10).describe("The Goals to read, in order; one to ten IDs."),
14401
14616
  /** Every entry in full. Without it the read carries the person's words, open questions and your
@@ -14417,6 +14632,8 @@ var SearchToolSchema2 = external_exports.object({
14417
14632
  limit: external_exports.number().int().min(1).max(20).optional()
14418
14633
  }).strict();
14419
14634
  var SEARCH_DESCRIPTION2 = "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.";
14635
+ var READS2 = { readOnlyHint: true, destructiveHint: false, openWorldHint: false };
14636
+ var SENDS2 = { readOnlyHint: false, destructiveHint: true, openWorldHint: false };
14420
14637
  var ConfigureIdentitySchema2 = external_exports.object({}).strict();
14421
14638
  var CONFIGURE_IDENTITY_DESCRIPTION2 = "Read this authenticated agent\u2019s current name, voice and token ID. Read-only; no arguments. Pairing, renaming and logout are available only through the local configure driver.";
14422
14639
  var CheckActivitySchema2 = external_exports.object({}).strict();
@@ -14428,16 +14645,16 @@ var SendFeedbackSchema2 = external_exports.object({
14428
14645
  }).strict();
14429
14646
  var SEND_FEEDBACK_DESCRIPTION2 = "Send feedback about Paigy itself (a bug report, an idea) straight to the Paigy team. Send it only when the person asked you to, or agreed when you offered: it goes to Paigy, never to the person, and nobody answers it here. Not for your work or a question for the person: use contact for those. Returns whether it was stored.";
14430
14647
  var AGENT_TOOLS2 = [
14431
- { name: "configure", description: CONFIGURE_IDENTITY_DESCRIPTION2, inputSchema: mcpInputSchema2(ConfigureIdentitySchema2) },
14432
- { name: "contact", description: CONTACT_DESCRIPTION2, inputSchema: CONTACT_SCHEMA2 },
14433
- { name: "manage_goals", description: MANAGE_GOALS_DESCRIPTION2, inputSchema: mcpInputSchema2(ManageGoalsToolSchema2) },
14434
- { name: "get_delivery", description: GET_DELIVERY_DESCRIPTION2, inputSchema: mcpInputSchema2(GetDeliverySchema2) },
14435
- { name: "get_goals", description: GET_GOALS_DESCRIPTION2, inputSchema: mcpInputSchema2(GetGoalsSchema2) },
14436
- { name: "search", description: SEARCH_DESCRIPTION2, inputSchema: mcpInputSchema2(SearchToolSchema2) },
14437
- { name: "check_activity", description: "Read your person's agents that contributed in the last 24 hours, newest first: at most 30 agents and their five most recently touched Goals, with their latest entry headline and time. Use get_goals to read a Goal and its other contributors before starting overlapping work. Read-only; no arguments.", inputSchema: mcpInputSchema2(CheckActivitySchema2) },
14438
- { name: "send_feedback", description: SEND_FEEDBACK_DESCRIPTION2, inputSchema: mcpInputSchema2(SendFeedbackSchema2) },
14648
+ { name: "configure", title: "Who am I", annotations: READS2, description: CONFIGURE_IDENTITY_DESCRIPTION2, inputSchema: mcpInputSchema2(ConfigureIdentitySchema2) },
14649
+ { name: "contact", title: "Contact the person", annotations: SENDS2, description: CONTACT_DESCRIPTION2, inputSchema: CONTACT_SCHEMA2 },
14650
+ { name: "manage_goals", title: "Manage Goals", annotations: SENDS2, description: MANAGE_GOALS_DESCRIPTION2, inputSchema: mcpInputSchema2(ManageGoalsToolSchema2) },
14651
+ { name: "get_delivery", title: "Read a delivery", annotations: READS2, description: GET_DELIVERY_DESCRIPTION2, inputSchema: mcpInputSchema2(GetDeliverySchema2) },
14652
+ { name: "get_goals", title: "Read Goals", annotations: READS2, description: GET_GOALS_DESCRIPTION2, inputSchema: mcpInputSchema2(GetGoalsSchema2) },
14653
+ { name: "search", title: "Search history", annotations: READS2, description: SEARCH_DESCRIPTION2, inputSchema: mcpInputSchema2(SearchToolSchema2) },
14654
+ { name: "check_activity", title: "Recent agent activity", annotations: READS2, description: "Read your person's agents that contributed in the last 24 hours, newest first: at most 30 agents and their five most recently touched Goals, with their latest entry headline and time. Use get_goals to read a Goal and its other contributors before starting overlapping work. Read-only; no arguments.", inputSchema: mcpInputSchema2(CheckActivitySchema2) },
14655
+ { name: "send_feedback", title: "Send feedback to Paigy", annotations: SENDS2, description: SEND_FEEDBACK_DESCRIPTION2, inputSchema: mcpInputSchema2(SendFeedbackSchema2) },
14439
14656
  // THE GUIDE FROM INSIDE THE MCP (owner, 2026-10-27): the skill's text, needing no identity (`help.ts`).
14440
- { name: "help", description: HELP_DESCRIPTION2, inputSchema: mcpInputSchema2(HelpSchema2) }
14657
+ { name: "help", title: "Paigy guide", annotations: READS2, description: HELP_DESCRIPTION2, inputSchema: mcpInputSchema2(HelpSchema2) }
14441
14658
  ];
14442
14659
  var AGENT_TOOL_NAMES2 = AGENT_TOOLS2.map((t) => t.name);
14443
14660
  var id2 = external_exports.string().uuid();
@@ -14541,6 +14758,10 @@ var BrainMessageSchema2 = external_exports.union([
14541
14758
  // WHAT IT ASKS THE AGENT, IN UNDER TEN WORDS (owner, 2026-10-15: "Yes, add the summary"): the talker's own, stored
14542
14759
  // as the sent Entry's summary, which the recap's "Sent to <agent>: …" row shows. Absent on results written before it.
14543
14760
  summary: external_exports.string().optional(),
14761
+ // THE PERSON'S LINES IT CARRIES, IN THEIR WORDS (owner, 2026-11-05: "just deliver my exact words to the agent"): the
14762
+ // `entries` keys of those lines, each relayed whole on the agent's Delivery (`context = false`), where the rest of
14763
+ // `entryKeys` ride as context. Absent on results written before it, and on a message that carries none.
14764
+ carries: external_exports.array(key2).optional(),
14544
14765
  // THE PERSON ASKED TO BE CALLED BACK ONCE THIS AGENT'S WORK IS DONE (turns.md, step 0): the agent owes
14545
14766
  // the call, and its next contact about it rings them (`public.callbacks`).
14546
14767
  callback: external_exports.literal(true).optional()
@@ -14604,8 +14825,11 @@ var TalkerReplySchema2 = external_exports.object({
14604
14825
  * "Yes, add the summary"), which the recap's "Sent to <agent>: …" row shows; `about` names
14605
14826
  * handles; `blocks` is the item a question to an agent must be answered before ("" for none);
14606
14827
  * `callback` is true on a message to the agent doing work the person asked to be called back about
14607
- * once it is done (false otherwise): that agent then owes the call (turns.md, step 0). */
14608
- messages: external_exports.array(external_exports.object({ key: str32, to: str32, sentences: strs22, text: str32, summary: str32, about: strs22, blocks: str32, callback: external_exports.boolean() }).strict()),
14828
+ * once it is done (false otherwise): that agent then owes the call (turns.md, step 0). `lines` are the
14829
+ * person's line handles a message to an agent carries ([] for none): the agent receives those lines, in their
14830
+ * words, and `text` is then only what the talker adds beyond them (owner, 2026-11-05: "just deliver my exact
14831
+ * words to the agent, keeping the summary as a way for me to navigate them more easily"). */
14832
+ messages: external_exports.array(external_exports.object({ key: str32, to: str32, sentences: strs22, text: str32, summary: str32, about: strs22, blocks: str32, callback: external_exports.boolean(), lines: strs22.optional() }).strict()),
14609
14833
  /** What the call does next: listen, hold (the person asked for a moment) or end (they asked to). */
14610
14834
  then: external_exports.enum(["listen", "hold", "end"]),
14611
14835
  /** The person's replies to items (replies, owner 2026-10-07): the item's handle, the chosen option
@@ -14623,9 +14847,14 @@ var TalkerReplySchema2 = external_exports.object({
14623
14847
  /** The handle of the item to explain ("" for none). */
14624
14848
  explain: str32
14625
14849
  }).strict();
14626
- var TALKER_REPLY_JSON_SCHEMA2 = (({ $schema: _, ...rest }) => rest)(
14850
+ var TALKER_REPLY_JSON_SCHEMA2 = withEveryMessageField2((({ $schema: _, ...rest }) => rest)(
14627
14851
  zodToJsonSchema2(TalkerReplySchema2, { $refStrategy: "none" })
14628
- );
14852
+ ));
14853
+ function withEveryMessageField2(schema) {
14854
+ const item = schema.properties?.messages?.items;
14855
+ if (item?.properties) item.required = Object.keys(item.properties);
14856
+ return schema;
14857
+ }
14629
14858
  var str42 = external_exports.string();
14630
14859
  var strs32 = external_exports.array(external_exports.string());
14631
14860
  var FilerReplySchema2 = external_exports.object({
@@ -15228,6 +15457,10 @@ var InboxItemSchema2 = external_exports.object({
15228
15457
  branch: external_exports.string().optional(),
15229
15458
  createdAt: external_exports.string().datetime(),
15230
15459
  snoozedUntil: external_exports.string().datetime().optional(),
15460
+ /** A past card the person dismissed that Restore can take back (#2699): its newest close is their
15461
+ * dismissal, with what it withdrew recorded (`private.restore_delivery`). Absent on everything else —
15462
+ * a put-off, a card an ended Goal or a settled question closed, and every open card. */
15463
+ restorable: external_exports.boolean().optional(),
15231
15464
  agentState: AgentStateSchema2.default("idle"),
15232
15465
  /** Whose action the item is waiting on: "you" = an agent asked you (the default,
15233
15466
  * every agent→user notification); "agent" = you sent a request and it's awaiting the
@@ -15335,11 +15568,41 @@ var InboxItemSchema2 = external_exports.object({
15335
15568
  rev: external_exports.string().optional()
15336
15569
  });
15337
15570
  var APNS_TOKEN_RE2 = /^[0-9a-fA-F]{64}$/;
15571
+ var PushDeviceIdSchema2 = external_exports.string().regex(/^[A-Za-z0-9._:-]{1,200}$/, "not an install id");
15572
+ var PushDeviceSchema2 = external_exports.object({
15573
+ deviceId: external_exports.string(),
15574
+ platform: external_exports.enum(["ios", "android"]),
15575
+ label: external_exports.string().nullable(),
15576
+ model: external_exports.string().nullable(),
15577
+ /** Calls and banners go here. */
15578
+ rings: external_exports.boolean(),
15579
+ /** It has a token a call can ring. */
15580
+ ringable: external_exports.boolean(),
15581
+ chosenAt: external_exports.string().nullable(),
15582
+ updatedAt: external_exports.string()
15583
+ });
15584
+ var PushTokenDeviceSchema2 = external_exports.object({
15585
+ deviceId: external_exports.string(),
15586
+ rings: external_exports.boolean(),
15587
+ ask: external_exports.boolean(),
15588
+ ringsOn: external_exports.object({ deviceId: external_exports.string().nullable(), label: external_exports.string().nullable() }).nullable()
15589
+ });
15590
+ var PushRingsSchema2 = external_exports.object({ rings: external_exports.boolean() });
15338
15591
  var PushTokenSchema2 = external_exports.object({
15339
15592
  voipToken: external_exports.string().min(1).optional(),
15340
15593
  alertToken: external_exports.string().min(1).optional(),
15341
15594
  fcmToken: external_exports.string().min(1).optional(),
15342
- platform: external_exports.enum(["ios", "android"])
15595
+ platform: external_exports.enum(["ios", "android"]),
15596
+ /** WHICH INSTALL POSTED IT (owner, 2026-11-05: "Ask on each new device"). Absent from every
15597
+ * build before it, and then the post is exactly what it always was: the one row per account.
15598
+ * With it, the install has its own row and calls ring only where the person chose. */
15599
+ deviceId: PushDeviceIdSchema2.optional(),
15600
+ /** The install's name as the person knows it ("iPhone", "iPad"), and its model. */
15601
+ label: external_exports.string().trim().min(1).max(80).optional(),
15602
+ model: external_exports.string().trim().min(1).max(80).optional(),
15603
+ /** The person's choice, when the post carries it; absent, the install keeps what it has (and
15604
+ * its first ring token decides once: it rings unless another install already does). */
15605
+ rings: external_exports.boolean().optional()
15343
15606
  }).superRefine((v, ctx) => {
15344
15607
  if (v.platform !== "ios") return;
15345
15608
  for (const field of ["voipToken", "alertToken"]) {
@@ -15408,8 +15671,8 @@ var UserSettingsSchema2 = external_exports.object({
15408
15671
  * write, 'hosted' on read (see store.ts). */
15409
15672
  voiceMode: external_exports.enum(["hosted", "on_device"]).optional(),
15410
15673
  /** `talk` lived here until #2373: it gated auto-play, which went in #2374. An older bundle's
15411
- * `talk` is stripped like `silentPush` was; the `user_settings.talk` column outlives it until
15412
- * its own drop migration (#2373, step two). */
15674
+ * `talk` is stripped like `silentPush` was, and the `user_settings.talk` column went in
15675
+ * 20261028142255. */
15413
15676
  /** CALL DIAGNOSTICS (owner, 2026-10-01): the call report carries each listen and the bot's own
15414
15677
  * load timings. SERVER-SET, no UI — on for every account that existed on 2026-10-01, off for
15415
15678
  * newer ones (migration 20261001132859). Read-only here: the settings PATCH never writes it. */
@@ -15449,7 +15712,11 @@ var GoalLatestSchema2 = external_exports.object({
15449
15712
  titles: external_exports.array(external_exports.string()).optional(),
15450
15713
  /** A PROGRESS NOTE'S ONE POINT ("An agent's progress note -> maybe let's cap it at 200 chars"): the
15451
15714
  * update's own line, before its units; the row caps it at 200. Absent on anything else. */
15452
- line: external_exports.string().optional()
15715
+ line: external_exports.string().optional(),
15716
+ /** THE PERSON'S ENTRIES IT CARRIED TO AN AGENT, IN THEIR WORDS (owner, 2026-11-05: "paraphrasing shouldn't change
15717
+ * attribution in the UI"): on a message Paigy sent an agent, the person's Entries its Delivery relays whole. A row
15718
+ * draws it as theirs. Absent on anything else, and from a door older than it. */
15719
+ carries: external_exports.array(external_exports.string()).optional()
15453
15720
  });
15454
15721
  var HistoryWorkSchema2 = external_exports.object({
15455
15722
  id: external_exports.string(),
@@ -15516,6 +15783,12 @@ var ConnectionSummarySchema2 = external_exports.object({
15516
15783
  * its Goals — wrote on one or recorded an operation (`tokens.last_worked_at`). Within
15517
15784
  * `WORKING_MS` it is working; otherwise it is connected but idle. Null = not seen working yet. */
15518
15785
  lastWorkedAt: external_exports.string().datetime().nullable().optional(),
15786
+ /** A TERMINAL SESSION'S ONLY PULSE (`tokens.listened_at`): `paigy-listen` stamps it on every sweep
15787
+ * (90 s). It is deliberately NOT presence — `last_seen_at` is the desktop host's beat, and a
15788
+ * listener orphaned from a dead conversation must not light the live dot — but it is the one fact
15789
+ * that says a terminal session's process is UP, which is why the wake already reads it
15790
+ * (`wake.ts`, `listener`). Null = no listener sweeping. */
15791
+ listenedAt: external_exports.string().datetime().nullable().optional(),
15519
15792
  /** The oldest of its Goals that is `ready` for it — work handed to it that nobody has started.
15520
15793
  * With no work of its own for `WORKING_MS`, an agent sitting on this is not taking its work. */
15521
15794
  oldestReadyAt: external_exports.string().datetime().nullable().optional(),
@@ -15712,6 +15985,11 @@ var QueueItemSchema2 = external_exports.object({
15712
15985
  * and a door older than 20261013045542 need not spell them. */
15713
15986
  yours: GoalLatestSchema2.nullable().optional(),
15714
15987
  theirs: GoalLatestSchema2.nullable().optional(),
15988
+ /** ITS STEPS, COUNTED IN THE DATABASE (owner, 2026-11-04: "Count on the server, and agents make steps"): its
15989
+ * direct children that were not cancelled, and how many of them are done. The queue holds only a recent
15990
+ * slice of finished work, so counting `childGoalIds` read "0 of 1" for a project with five done. Absent
15991
+ * from a door older than this field, or when the count failed: the app then counts what it holds. */
15992
+ steps: external_exports.object({ total: external_exports.number().int().nonnegative(), done: external_exports.number().int().nonnegative() }).nullable().optional(),
15715
15993
  /** WHAT THIS ROW IS, IN TWELVE CHARACTERS (#2928) — the hash of every other field on it, stamped
15716
15994
  * by the one projection that builds the row (`apps/api/src/goal/queue.ts`). It is how the
15717
15995
  * incremental read knows a row has not moved: the phone echoes back the revs it holds
@@ -15843,7 +16121,7 @@ var DeviceTokenSchema2 = external_exports.object({
15843
16121
  * the thread each time (host.ts, live catch 2026-08-06 — prompt-papered until now). */
15844
16122
  workspace: external_exports.string().nullable().optional(),
15845
16123
  /** Local host recovery must preserve the launch's runtime and Paigy identity. */
15846
- harness: external_exports.enum(["claude", "codex", "agy"]).optional(),
16124
+ harness: external_exports.enum(["claude", "codex", "agy", "grok"]).optional(),
15847
16125
  session_id: external_exports.string().uuid().optional(),
15848
16126
  /** A conversation the host must not resume: its context is full, so every turn fails
15849
16127
  * ("Prompt is too long"). Written when a run hits it (`run.ts` `onFull`); the host skips a slot
@@ -16065,6 +16343,12 @@ var CallRecapSchema2 = external_exports.object({
16065
16343
  * summary (Brain, 2026-10-14). Optional: absent from an API before it. */
16066
16344
  filedOn: external_exports.array(external_exports.object({ goalId: external_exports.string().uuid(), title: external_exports.string() })).optional(),
16067
16345
  recorded: external_exports.boolean().optional(),
16346
+ /** On a `said` row: the agents the call SENT those words to, from the sending action's own
16347
+ * `about.agents` (20261106220220). The review's receipt is drawn from this and from the row's
16348
+ * own `requestId`, never from the asker of a question the words happened to sit under: on call
16349
+ * f9670f67 that asker was Interface while the send named Comms. `[]` or absent means nothing
16350
+ * was sent for that row, which is why the receipt is positive-only. */
16351
+ sentTo: external_exports.array(external_exports.object({ id: external_exports.string().nullable(), name: external_exports.string() })).optional(),
16068
16352
  settled: external_exports.object({ requestId: external_exports.string(), answer: external_exports.string() }).nullable().optional(),
16069
16353
  acknowledged: external_exports.boolean().optional(),
16070
16354
  /** On a `put` row: still waiting for the person's answer (not settled, not answered, not put off).
@@ -16456,6 +16740,11 @@ import { resolve as resolve2, delimiter as delimiter2, join as join9 } from "pat
16456
16740
  // src/harness/acp.ts
16457
16741
  var none = { events: [], writes: [] };
16458
16742
  var NOTHING_TO_RESUME = /* @__PURE__ */ new Set([-32002, -32601]);
16743
+ function nothingToResume(error) {
16744
+ if (!error || error.code === void 0) return false;
16745
+ if (NOTHING_TO_RESUME.has(error.code)) return true;
16746
+ return error.code === -32603 && (error.data?.code === "FS_NOT_FOUND" || /^Path not found\b/.test(error.message ?? ""));
16747
+ }
16459
16748
  function optionFor(options, decision) {
16460
16749
  const want = decision.allow ? "allow_once" : "reject_once";
16461
16750
  return options.find((o) => o.kind === want)?.optionId ?? null;
@@ -16592,11 +16881,11 @@ var AcpDriver = class {
16592
16881
  if (msg.id === this.sessionNewId) {
16593
16882
  this.sessionNewId = void 0;
16594
16883
  const resuming = this.resume !== void 0;
16595
- if (resuming && msg.error?.code !== void 0 && NOTHING_TO_RESUME.has(msg.error.code)) {
16884
+ if (resuming && nothingToResume(msg.error)) {
16596
16885
  this.resume = void 0;
16597
16886
  this.sessionNewId = this.nextId++;
16598
16887
  return {
16599
- events: [{ kind: "error", message: `session/resume found nothing to resume (${msg.error.message}) \u2014 opening a new conversation` }],
16888
+ events: [{ kind: "error", message: `session/resume found nothing to resume (${msg.error.message ?? "no message"}) \u2014 opening a new conversation` }],
16600
16889
  writes: [frame2(this.opening(this.sessionNewId))]
16601
16890
  };
16602
16891
  }
@@ -16796,8 +17085,16 @@ function inboxFor(root = INBOX_ROOT) {
16796
17085
  var ADAPTER_BIN = {
16797
17086
  claude: "claude-agent-acp",
16798
17087
  codex: "codex-acp",
16799
- agy: "paigy-agy-acp"
17088
+ agy: "paigy-agy-acp",
17089
+ grok: "grok"
16800
17090
  };
17091
+ function grokArgs(opts) {
17092
+ const args = ["agent"];
17093
+ if (opts.mode === "bypass") args.push("--always-approve");
17094
+ if (opts.model) args.push("--model", opts.model);
17095
+ args.push("stdio");
17096
+ return args;
17097
+ }
16801
17098
  var CLAUDE_ONE_WAY_IN = {
16802
17099
  env: { CLAUDE_CODE_DISABLE_BACKGROUND_TASKS: "1" },
16803
17100
  disallowedTools: ["Monitor", "ScheduleWakeup", "CronCreate", "Workflow"]
@@ -16838,7 +17135,7 @@ function startSession(opts) {
16838
17135
  const inherited = [...savedVars.matchAll(/["']([A-Za-z_][A-Za-z0-9_]*)["']/g)].map((match) => match[1]);
16839
17136
  codexConfig[key3] = [.../* @__PURE__ */ new Set([...inherited, ...codexConfig[key3] ?? codexConfig.mcp_servers?.paigy?.env_vars ?? [], ...CODEX_ENV])];
16840
17137
  }
16841
- const child = (opts.spawnFn ?? spawn)(opts.bin ?? ADAPTER_BIN[opts.harness], [], {
17138
+ const child = (opts.spawnFn ?? spawn)(opts.bin ?? ADAPTER_BIN[opts.harness], opts.harness === "grok" ? grokArgs(opts) : [], {
16842
17139
  cwd,
16843
17140
  // The adapter shells out to its vendor CLI (`claude`, `codex`), and a GUI- or
16844
17141
  // launchd-launched process's PATH won't have it — probe dirs plus the RUNNING
@@ -17736,7 +18033,7 @@ function runHarness(opts) {
17736
18033
  opts.log("\u25B6 running again after the limit");
17737
18034
  LIMITS.running(name, (text) => callForResume(text, state, rail), opts.log);
17738
18035
  }
17739
- async function handle(event) {
18036
+ async function handle3(event) {
17740
18037
  if (event.kind === "error") {
17741
18038
  opts.log(`\u26A0 ${event.message}`);
17742
18039
  if (event.fatal && running) {
@@ -17795,7 +18092,7 @@ ${event.message}`, state, rail, { log: opts.log });
17795
18092
  inbox?.close();
17796
18093
  opts.onExit?.();
17797
18094
  },
17798
- onEvent: (event) => void handle(event).catch((err) => opts.log(`\u26A0 ${err.message}`))
18095
+ onEvent: (event) => void handle3(event).catch((err) => opts.log(`\u26A0 ${err.message}`))
17799
18096
  });
17800
18097
  void pump(session, state, rail, { onIdle: () => running, beat: clock4, initialPrompt: opts.prompt, log: opts.log, ...inbox ? { inbox } : {} }).catch(
17801
18098
  (e) => opts.log(`\u26A0 conversation loop stopped: ${e.message}`)
@@ -17904,7 +18201,7 @@ function selfUpdater(deps) {
17904
18201
  var HOST_FILE = join11(homedir9(), ".paigy", "host.json");
17905
18202
  function wakeHarness(slot, saved, claudeTranscript) {
17906
18203
  if (slot === "Desktop") return void 0;
17907
- if (saved !== null) return saved === "agy" || saved === "codex" || saved === "claude" ? saved : void 0;
18204
+ if (saved !== null) return saved === "agy" || saved === "codex" || saved === "claude" || saved === "grok" ? saved : void 0;
17908
18205
  if (claudeTranscript) return "claude";
17909
18206
  if (slot === "mcp-agent" || slot === "Claude Code") return "claude";
17910
18207
  if (slot === "codex") return "codex";