toolroll 0.9.51 → 0.9.53

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.
Files changed (164) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +55 -80
  3. package/dist/agentconfig.d.ts +11 -36
  4. package/dist/agentconfig.js +3 -62
  5. package/dist/approval-policy.d.ts +1 -1
  6. package/dist/approval-policy.js +1 -1
  7. package/dist/backup.d.ts +8 -0
  8. package/dist/backup.js +10 -1
  9. package/dist/board.d.ts +3 -19
  10. package/dist/board.js +4 -42
  11. package/dist/browser/workspace.css +1 -1
  12. package/dist/browser/workspace.js +18 -18
  13. package/dist/browser-workspace.d.ts +3 -1
  14. package/dist/builder.d.ts +9 -40
  15. package/dist/builder.js +50 -257
  16. package/dist/chat-actions.js +3 -14
  17. package/dist/chat-controls.d.ts +0 -4
  18. package/dist/chat-controls.js +0 -1
  19. package/dist/chat-decide.js +1 -3
  20. package/dist/chat-delivery.d.ts +0 -2
  21. package/dist/chat-delivery.js +0 -1
  22. package/dist/chat-quiet.js +2 -2
  23. package/dist/chat-task-actions.d.ts +1 -1
  24. package/dist/chat-task-actions.js +0 -2
  25. package/dist/claim.d.ts +79 -244
  26. package/dist/claim.js +688 -1023
  27. package/dist/cli.d.ts +2 -0
  28. package/dist/cli.js +10 -2
  29. package/dist/contracts/cli.d.ts +0 -13
  30. package/dist/contracts/cli.js +0 -2
  31. package/dist/contracts/console-api.d.ts +5 -10
  32. package/dist/contracts/console-api.js +4 -10
  33. package/dist/contracts/flow.d.ts +50 -0
  34. package/dist/contracts/flow.js +26 -1
  35. package/dist/contracts/lead-tools.d.ts +0 -13
  36. package/dist/contracts/lead-tools.js +3 -3
  37. package/dist/contracts/store-json.d.ts +1 -25
  38. package/dist/contracts/store-json.js +3 -13
  39. package/dist/converse.d.ts +1 -11
  40. package/dist/converse.js +6 -38
  41. package/dist/coordinator.d.ts +0 -1
  42. package/dist/coordinator.js +3 -5
  43. package/dist/database-reclaim.d.ts +4 -0
  44. package/dist/database-reclaim.js +13 -0
  45. package/dist/demo.d.ts +1 -1
  46. package/dist/demo.js +17 -27
  47. package/dist/desktop-update-gate.js +0 -1
  48. package/dist/desktop-update.d.ts +1 -1
  49. package/dist/desktop-update.js +1 -3
  50. package/dist/dispatch.d.ts +1 -1
  51. package/dist/dispatch.js +1 -1
  52. package/dist/dispose.d.ts +2 -3
  53. package/dist/dispose.js +17 -92
  54. package/dist/envelope.js +0 -3
  55. package/dist/exec.d.ts +0 -64
  56. package/dist/exec.js +3 -356
  57. package/dist/exhaustion.d.ts +22 -76
  58. package/dist/exhaustion.js +14 -140
  59. package/dist/export.js +4 -4
  60. package/dist/flow-engine.js +1 -1
  61. package/dist/flow-schedule.d.ts +154 -0
  62. package/dist/flow-schedule.js +321 -0
  63. package/dist/flow-share.js +1 -1
  64. package/dist/flow-triggers.d.ts +6 -1
  65. package/dist/flow-triggers.js +65 -10
  66. package/dist/flows-cli.js +8 -4
  67. package/dist/flows-ui.js +2 -0
  68. package/dist/flows.js +1 -1
  69. package/dist/guides.js +9 -29
  70. package/dist/invoke.d.ts +1 -24
  71. package/dist/invoke.js +17 -259
  72. package/dist/lead-status.js +2 -4
  73. package/dist/lead-voice.js +1 -1
  74. package/dist/live-bus.d.ts +3 -3
  75. package/dist/live-bus.js +3 -3
  76. package/dist/mate-doors.d.ts +1 -2
  77. package/dist/mate-doors.js +12 -25
  78. package/dist/mate-tools.d.ts +2 -2
  79. package/dist/mate-tools.js +10 -22
  80. package/dist/modes.d.ts +6 -7
  81. package/dist/modes.js +7 -13
  82. package/dist/monitoring.js +32 -8
  83. package/dist/notification-delivery.d.ts +19 -0
  84. package/dist/notification-delivery.js +37 -0
  85. package/dist/operate-remote-arguments.js +2 -6
  86. package/dist/operate-remote.js +6 -7
  87. package/dist/operate.d.ts +0 -6
  88. package/dist/operate.js +283 -2378
  89. package/dist/phase-routing.d.ts +13 -23
  90. package/dist/phase-routing.js +13 -35
  91. package/dist/plan-auto.js +2 -2
  92. package/dist/planner-source.js +2 -1
  93. package/dist/policy.d.ts +1 -4
  94. package/dist/policy.js +0 -8
  95. package/dist/process-recovery-eligibility.js +2 -3
  96. package/dist/process-recovery-settlement.js +1 -0
  97. package/dist/project-delete.js +3 -15
  98. package/dist/proposal.d.ts +4 -24
  99. package/dist/proposal.js +3 -88
  100. package/dist/provider-auth.d.ts +3 -3
  101. package/dist/provider-auth.js +4 -6
  102. package/dist/provider.d.ts +11 -25
  103. package/dist/provider.js +4 -36
  104. package/dist/push.js +1 -1
  105. package/dist/recipe-ui.js +6 -6
  106. package/dist/recipes.d.ts +3 -3
  107. package/dist/recipes.js +27 -23
  108. package/dist/retention.js +6 -5
  109. package/dist/run-closeout.d.ts +1 -1
  110. package/dist/run-closeout.js +1 -4
  111. package/dist/scope.d.ts +11 -65
  112. package/dist/scope.js +17 -82
  113. package/dist/serve.js +16 -25
  114. package/dist/server/chat.js +7 -30
  115. package/dist/server/flows.js +11 -10
  116. package/dist/server/guards.js +0 -1
  117. package/dist/server/pages-assets.js +1 -1
  118. package/dist/server/pages.js +0 -2
  119. package/dist/server/people-tokens.js +0 -4
  120. package/dist/server/route-table.d.ts +1 -1
  121. package/dist/server/route-table.js +2 -17
  122. package/dist/server/settings.js +4 -9
  123. package/dist/server/shared.d.ts +29 -212
  124. package/dist/server/shared.js +73 -780
  125. package/dist/server/task-views.js +9 -76
  126. package/dist/server/tasks.d.ts +1 -50
  127. package/dist/server/tasks.js +36 -946
  128. package/dist/setup-guide.d.ts +2 -2
  129. package/dist/slack-chat.d.ts +0 -2
  130. package/dist/slack-chat.js +0 -1
  131. package/dist/store.d.ts +142 -1382
  132. package/dist/store.js +900 -4083
  133. package/dist/surface.js +10 -25
  134. package/dist/task-composer.d.ts +1 -1
  135. package/dist/task-composer.js +1 -1
  136. package/dist/task-control.d.ts +3 -10
  137. package/dist/task-control.js +2 -7
  138. package/dist/teammate-desk.js +1 -1
  139. package/dist/teammates-ui.js +1 -1
  140. package/dist/telegram-mate.d.ts +0 -3
  141. package/dist/telegram-mate.js +0 -1
  142. package/dist/templates.d.ts +11 -7
  143. package/dist/templates.js +12 -9
  144. package/dist/toolroll-update.d.ts +24 -3
  145. package/dist/toolroll-update.js +159 -16
  146. package/dist/webhooks.d.ts +10 -22
  147. package/dist/webhooks.js +43 -81
  148. package/dist/work-index.js +3 -7
  149. package/dist/workspace-revision.d.ts +28 -1
  150. package/dist/workspace-revision.js +276 -49
  151. package/dist/workspace-ui.js +1 -1
  152. package/package.json +1 -3
  153. package/scripts/recovery-canary.mjs +3 -3
  154. package/dist/contest.d.ts +0 -318
  155. package/dist/contest.js +0 -753
  156. package/dist/held.d.ts +0 -150
  157. package/dist/held.js +0 -799
  158. package/dist/liveness.d.ts +0 -30
  159. package/dist/liveness.js +0 -42
  160. package/dist/pricing.d.ts +0 -45
  161. package/dist/pricing.js +0 -77
  162. package/dist/routine.d.ts +0 -228
  163. package/dist/routine.js +0 -764
  164. package/dist/supervisor.mjs +0 -297
package/dist/surface.js CHANGED
@@ -13,7 +13,7 @@ import { FLOWS_DESCRIPTORS } from "./flows-cli.js";
13
13
  * What the tests DO hold to the code: every root here is a routed verb
14
14
  * and every routed verb appears here; every declared flag lives in the
15
15
  * parser's global vocabulary with the declared arity; the subcommand
16
- * inventories for task/publish/config/approver/routine/contest match the
16
+ * inventories for task/publish/config/approver match the
17
17
  * exported action lists their dispatchers consult; keyed mutations
18
18
  * declare --key; notableReasons come from DOCUMENTED_REASONS. What they
19
19
  * CANNOT prove — that a given flag is read by a given handler — is why
@@ -243,7 +243,7 @@ const GUIDE_ROWS = [
243
243
  { invocation: "task block", synopsis: "make one task wait for another", audience: "agent", agentMayInvoke: true, mutation: "keyed",
244
244
  positionals: [{ name: "id", required: true, meaning: "the waiting task" }],
245
245
  flags: [jsonFlag, dbFlag, keyFlag, { name: "on", takesValue: true, meaning: "the blocker's id" }],
246
- notableReasons: ["unknown-task", "contest-open"] },
246
+ notableReasons: ["unknown-task"] },
247
247
  { invocation: "task unblock", synopsis: "stop waiting", audience: "agent", agentMayInvoke: true, mutation: "keyed",
248
248
  positionals: [{ name: "id", required: true, meaning: "the waiting task" }],
249
249
  flags: [jsonFlag, dbFlag, keyFlag, { name: "on", takesValue: true, meaning: "the blocker's id" }],
@@ -251,7 +251,7 @@ const GUIDE_ROWS = [
251
251
  { invocation: "task next", synopsis: "move a task to the front of ITS queue (scheduling only; approval still required)", audience: "agent", agentMayInvoke: true, mutation: "keyed",
252
252
  positionals: [{ name: "id", required: true, meaning: "the task" }],
253
253
  flags: [jsonFlag, dbFlag, keyFlag, { name: "undo", takesValue: false, meaning: "back to filing order" }],
254
- notableReasons: ["unknown-task", "claimed", "contest-open"] },
254
+ notableReasons: ["unknown-task", "claimed"] },
255
255
  operator("task steer", "one credentialed note read before the task's next attempt — steering speaks with the operator's voice"),
256
256
  { invocation: "task assign", synopsis: "reserve a task for one worker, or return it to the shared queue", audience: "agent", agentMayInvoke: true, mutation: "keyed",
257
257
  positionals: [{ name: "id", required: true, meaning: "the task" }],
@@ -265,9 +265,8 @@ const GUIDE_ROWS = [
265
265
  { name: "goal", takesValue: true, meaning: "what success is" },
266
266
  { name: "not", takesValue: true, meaning: "explicitly out of scope" },
267
267
  { name: "touches", takesValue: true, meaning: "comma-separated paths this may change" },
268
- { name: "budget-usd", takesValue: true, meaning: "spend ceiling for the build" },
269
- { name: "risk", takesValue: true, meaning: "declared risk: routine, elevated, or high — the route reads it" }],
270
- notableReasons: ["unknown-task", "contest-open"] },
268
+ { name: "budget-usd", takesValue: true, meaning: "spend ceiling for the build" }],
269
+ notableReasons: ["unknown-task"] },
271
270
  { invocation: "task plan", synopsis: "ask for a plan document (a planning session drafts; a person approves)", audience: "agent", agentMayInvoke: true, mutation: "keyed",
272
271
  positionals: [{ name: "id", required: true, meaning: "the task" }],
273
272
  flags: [jsonFlag, dbFlag, keyFlag,
@@ -300,7 +299,7 @@ const GUIDE_ROWS = [
300
299
  notableReasons: ["usage", "unauthenticated", "not-found"] },
301
300
  operator("task accept", "record an explicit acceptance with limitations; does not change checks or prove deployment"),
302
301
  operator("task repair", "inspect or approve an existing historical repair draft; use task revise for new feedback"),
303
- operator("task route", "which configured agents plan, build and repair this task; phase and risk changes require renewed approval"),
302
+ operator("task route", "which configured agents plan, build and repair this task; phase and size changes require renewed approval"),
304
303
  operator("task reopen", "resume external work its tracker closed and has been SEEN open again"),
305
304
  operator("task stop", "stop ONE exact live attempt (--run <id>): durable before any process is signalled, answers 'stopping' until its own processes are established gone; work, branch, and evidence preserved; no strike, no retry"),
306
305
  operator("run settle", "last resort for a finished run whose process witness can't be proven either way: records your --why in the ledger; refuses while any of the run's processes is alive"),
@@ -312,7 +311,7 @@ const GUIDE_ROWS = [
312
311
  { name: "runner", takesValue: true, meaning: "your registered worker name" },
313
312
  { name: "token", takesValue: true, meaning: "the worker's token" },
314
313
  { name: "ttl", takesValue: true, meaning: "lease seconds" }],
315
- notableReasons: ["held", "fenced", "unapproved", "reserved", "external", "contest-open", "claimed", "not-ready"] },
314
+ notableReasons: ["held", "fenced", "unapproved", "reserved", "external", "claimed", "not-ready"] },
316
315
  { invocation: "heartbeat", synopsis: "still working; extends the lease", audience: "agent", agentMayInvoke: true, mutation: "identity-idempotent",
317
316
  positionals: [{ name: "lease", required: true, meaning: "the lease id" }],
318
317
  flags: [jsonFlag, dbFlag], notableReasons: ["not-leased", "fenced"] },
@@ -338,9 +337,6 @@ const GUIDE_ROWS = [
338
337
  { invocation: "cap list", synopsis: "recorded capabilities", audience: "agent", agentMayInvoke: true, mutation: "none", flags: [jsonFlag, dbFlag, repoFlag] },
339
338
  { invocation: "outbox list", synopsis: "queued notifications", audience: "agent", agentMayInvoke: true, mutation: "none", flags: [jsonFlag, dbFlag] },
340
339
  { invocation: "incident list", synopsis: "open incidents", audience: "agent", agentMayInvoke: true, mutation: "none", flags: [jsonFlag, dbFlag] },
341
- { invocation: "routine list", synopsis: "scheduled routines", audience: "agent", agentMayInvoke: true, mutation: "none", flags: [jsonFlag, dbFlag] },
342
- { invocation: "routine show", synopsis: "one routine in full", audience: "agent", agentMayInvoke: true, mutation: "none",
343
- positionals: [{ name: "id", required: true, meaning: "the routine" }], flags: [jsonFlag, dbFlag] },
344
340
  { invocation: "config show", synopsis: "phase and spend configuration", audience: "agent", agentMayInvoke: true, mutation: "none", flags: [jsonFlag, dbFlag, repoFlag] },
345
341
  { invocation: "setup show", synopsis: "installation setup", audience: "agent", agentMayInvoke: true, mutation: "none", flags: [jsonFlag, dbFlag] },
346
342
  { invocation: "verify show", synopsis: "the repository's check level, its approved full and quick commands, and a suggested quick command", audience: "agent", agentMayInvoke: true, mutation: "none", flags: [jsonFlag, dbFlag, repoFlag] },
@@ -350,11 +346,9 @@ const GUIDE_ROWS = [
350
346
  { name: "report", takesValue: false, meaning: "record readiness observations under --runner" },
351
347
  { name: "runner", takesValue: true, meaning: "the registered worker name reporting" },
352
348
  { name: "token", takesValue: true, meaning: "that worker's token" }] },
353
- { invocation: "template list", synopsis: "routine templates", audience: "agent", agentMayInvoke: true, mutation: "none", flags: [jsonFlag, dbFlag] },
349
+ { invocation: "template list", synopsis: "work templates: tasks and scheduled flows", audience: "agent", agentMayInvoke: true, mutation: "none", flags: [jsonFlag, dbFlag] },
354
350
  { invocation: "template show", synopsis: "one template", audience: "agent", agentMayInvoke: true, mutation: "none",
355
351
  positionals: [{ name: "name", required: true, meaning: "the template" }], flags: [jsonFlag, dbFlag] },
356
- { invocation: "contest show", synopsis: "a tournament's state and results", audience: "agent", agentMayInvoke: true, mutation: "none",
357
- positionals: [{ name: "id", required: true, meaning: "the contest" }], flags: [jsonFlag, dbFlag] },
358
352
  { invocation: "webhook status", synopsis: "connected messaging services", audience: "agent", agentMayInvoke: true, mutation: "none", flags: [jsonFlag, dbFlag] },
359
353
  { invocation: "publish status", synopsis: "publication and merge-grant state", audience: "agent", agentMayInvoke: true, mutation: "none", flags: [jsonFlag, dbFlag] },
360
354
  // ---- operator ceremonies and infrastructure (listed, detail-free) ----
@@ -373,12 +367,6 @@ const GUIDE_ROWS = [
373
367
  operator("peek", "watch live agents in the terminal — one pane per open run; --tmux opens a window per run"),
374
368
  operator("incident resolve", "resolve an incident"),
375
369
  operator("decide", "read and ANSWER parked decisions — answering is a person's act"),
376
- operator("routine add", "file a standing order"),
377
- operator("routine approve", "approve a standing order"),
378
- operator("routine refresh", "re-resolve the agents a standing order freezes from today's configuration — approves nothing; approve it again afterwards"),
379
- operator("routine pause", "pause a standing order"),
380
- operator("routine resume", "resume a standing order"),
381
- operator("routine run-now", "run a standing order immediately"),
382
370
  operatorRead("keys status", "which provider API keys are stored — never the values"),
383
371
  operator("keys set", "store a provider's API key as a private file — piped or --key-file, never on the command line"),
384
372
  operator("keys clear", "remove a stored provider key (kept only as a fallback; a subscription-mode provider is unaffected)"),
@@ -414,9 +402,7 @@ const GUIDE_ROWS = [
414
402
  operator("intake preview", "preview what intake would file"),
415
403
  operator("intake pr-comments", "intake review comments from a pull request"),
416
404
  operator("intake clear", "clear intake configuration"),
417
- operator("contest exclude", "exclude a contestant from a tournament"),
418
405
  operator("webhook primary", "choose which service receives alerts"),
419
- operator("webhook test", "send a test message"),
420
406
  operator("bridge", "the Telegram bridge (pairing, tokens, the follower)"),
421
407
  operator("enroll", "grant a repository authority (backends, dispatch) — its own explicit yes"),
422
408
  operator("revoke", "take an authority grant back"),
@@ -465,7 +451,7 @@ const REMOTE_NO = [
465
451
  "memory propose",
466
452
  ];
467
453
  const REMOTE_STEP_UP = [
468
- "proposals", "decide", "task regate", "task approve", "task accept", "task merge", "run settle", "routine approve", "knowledge apply", "memory apply",
454
+ "proposals", "decide", "task regate", "task approve", "task accept", "task merge", "run settle", "knowledge apply", "memory apply",
469
455
  "flows card approve", "flows card send-back", "flows script approve",
470
456
  "approver list", "approver add", "people list", "people invite", "people projects", "people revoke",
471
457
  // A person's own API tokens: a password step-up on the server's machine, or the console. Never with a token.
@@ -479,9 +465,8 @@ const REMOTE_YES = [
479
465
  "task state", "task block", "task unblock", "task next", "task steer", "task assign", "task scope", "task plan", "task hold", "task unhold", "task require",
480
466
  "task requeue", "task review", "task repair", "task route", "task reopen", "task stop", "task resume",
481
467
  "runner list", "coordinator list", "cap list", "cap add", "outbox list", "incident list", "incident resolve",
482
- "routine list", "routine show", "routine add", "routine refresh", "routine pause", "routine resume", "routine run-now",
483
468
  "config show", "verify show", "intake show", "intake run", "intake preview", "intake pr-comments", "template list", "template show",
484
- "contest show", "contest exclude", "webhook status", "webhook test", "review show", "chat-approval show", "chat-approval off",
469
+ "webhook status", "review show", "chat-approval show", "chat-approval off",
485
470
  "knowledge search", "knowledge impact", "knowledge refresh",
486
471
  "memory search", "memory decisions", "memory show", "memory decide", "memory retire", "memory review", "memory status",
487
472
  "flows list", "flows show", "flows export", "flows create", "flows edit", "flows trigger add", "flows trigger pause", "flows trigger resume",
@@ -1,5 +1,5 @@
1
1
  /** UI choices translate into the same digest-bound schedules as the CLI. */
2
- import { type Schedule } from "./routine.js";
2
+ import { type Schedule } from "./flow-schedule.js";
3
3
  export declare function composerSchedule(fields: URLSearchParams): {
4
4
  ok: true;
5
5
  schedule: string | null;
@@ -1,5 +1,5 @@
1
1
  /** UI choices translate into the same digest-bound schedules as the CLI. */
2
- import { parseSchedule, scheduleText, validTimezone } from "./routine.js";
2
+ import { parseSchedule, scheduleText, validTimezone } from "./flow-schedule.js";
3
3
  export function composerSchedule(fields) {
4
4
  const repeat = fields.get("repeat") ?? "once";
5
5
  if (repeat === "once")
@@ -16,7 +16,7 @@
16
16
  * the preserved draft with fresh proof.
17
17
  *
18
18
  * Nothing here is a second engine: the stop rides the existing run, claim,
19
- * hold, recovery, invocation-gateway, and held-session machinery. This
19
+ * hold, recovery, and invocation-gateway machinery. This
20
20
  * module only names the door and the fence.
21
21
  */
22
22
  import { type DispatchDiagnosis } from "./dispatch.js";
@@ -60,13 +60,6 @@ export type StopRequest = {
60
60
  runId: number;
61
61
  by: string;
62
62
  via: "cli" | "web" | "telegram" | "slack" | "discord" | "teams";
63
- /** The held-session supervisor in this process, when there is one: a
64
- * held attempt is fenced through its own handle the moment the request
65
- * is durable (the lapse interval would take the same road within
66
- * seconds for a request filed elsewhere). */
67
- held?: {
68
- stop(runId: number): Promise<void>;
69
- } | undefined;
70
63
  /** A composing confirmation transaction runs this effect only after it commits. */
71
64
  deferSignal?: ((signal: () => void) => void) | undefined;
72
65
  };
@@ -78,13 +71,13 @@ export type StopOutcome = {
78
71
  taskId: string;
79
72
  } | {
80
73
  ok: false;
81
- reason: "no-task" | "no-run" | "wrong-task" | "finished" | "not-live" | "tournament" | "publication";
74
+ reason: "no-task" | "no-run" | "wrong-task" | "finished" | "not-live" | "publication";
82
75
  detail: string;
83
76
  };
84
77
  /**
85
78
  * The shared stop door. Records the durable request first (one fenced
86
79
  * transaction: exact run, still open, this task's current claim, no
87
- * tournament, no admitted publication), THEN signals every child this
80
+ * admitted publication), THEN signals every child this
88
81
  * process holds for the attempt. A worker in another process observes the
89
82
  * same row through its stop watch within STOP_WATCH_MS.
90
83
  */
@@ -16,7 +16,7 @@
16
16
  * the preserved draft with fresh proof.
17
17
  *
18
18
  * Nothing here is a second engine: the stop rides the existing run, claim,
19
- * hold, recovery, invocation-gateway, and held-session machinery. This
19
+ * hold, recovery, and invocation-gateway machinery. This
20
20
  * module only names the door and the fence.
21
21
  */
22
22
  import { ownedProcessCount, runOwnerTag, terminateOwnedProcesses } from "./exec.js";
@@ -108,7 +108,7 @@ export async function underStopWatch(store, runId, body, options = {}) {
108
108
  /**
109
109
  * The shared stop door. Records the durable request first (one fenced
110
110
  * transaction: exact run, still open, this task's current claim, no
111
- * tournament, no admitted publication), THEN signals every child this
111
+ * admitted publication), THEN signals every child this
112
112
  * process holds for the attempt. A worker in another process observes the
113
113
  * same row through its stop watch within STOP_WATCH_MS.
114
114
  */
@@ -123,11 +123,6 @@ export function requestTaskStop(store, request, now) {
123
123
  let terminated = 0;
124
124
  const signal = () => {
125
125
  terminated = terminateStoppedAttempt(store, request.runId);
126
- if (request.held !== undefined && store.heldSessionOf(request.runId) !== null) {
127
- void request.held.stop(request.runId).catch(() => {
128
- // The lapse interval retries the same fence; the durable row stands.
129
- });
130
- }
131
126
  };
132
127
  if (request.deferSignal)
133
128
  request.deferSignal(signal);
@@ -13,7 +13,7 @@
13
13
  import { flowCardHref, flowDefinitionOf } from "./flow-engine.js";
14
14
  import { flowFromSteps } from "./flows.js";
15
15
  import { addFlowTriggerTo, removeFlowTrigger, runScheduleNow, scheduleFromWords, triggerConfigOf } from "./flow-triggers.js";
16
- import { describeSchedule, parseSchedule } from "./routine.js";
16
+ import { describeSchedule, parseSchedule } from "./flow-schedule.js";
17
17
  import { labelOf, nameOf } from "./teammate-admin.js";
18
18
  /** The zone on a desk where the teammate handles what it's asked. */
19
19
  export const DESK_ZONE = "handle";
@@ -5,7 +5,7 @@ import { callWords, defaultRule, numberFields, receiptWords } from "./teammate-t
5
5
  import { MEMORY_CHARS, searchMemories } from "./teammate-memory.js";
6
6
  import { deskOf, localZone, routinesOf } from "./teammate-desk.js";
7
7
  import { weekOf, weekWords } from "./teammate-week.js";
8
- import { describeSchedule, parseSchedule } from "./routine.js";
8
+ import { describeSchedule, parseSchedule } from "./flow-schedule.js";
9
9
  /** v94: the Tools section's rule rows; a limit's fields show only while "Up to a limit" is chosen. */
10
10
  export const TEAMMATE_CSS = `.teammate-tools .tool-grant{border-top:1px solid var(--so-line);padding-top:12px;margin-top:12px}.teammate-tools .tool-grant:first-of-type{border-top:0;margin-top:0;padding-top:0}.teammate-tools h3{font-size:1rem;margin:0 0 4px}.teammate-tools .tool-rule{display:grid;gap:6px;padding:10px 0;border-bottom:1px solid var(--so-line)}.teammate-tools .tool-rule:last-of-type{border-bottom:0}.teammate-tools .tool-rule .meta{display:block}.teammate-tools select,.teammate-tools input{max-width:100%;box-sizing:border-box}.teammate-tools .tool-limit{display:none;flex-wrap:wrap;align-items:center;gap:6px}.teammate-tools .tool-rule:has(option[value="limit"]:checked) .tool-limit{display:flex}.teammate-tools .tool-rule>select{width:auto;min-width:16em}.teammate-tools .tool-limit select{width:auto}.teammate-tools .tool-limit input{width:7em}.teammate-tools .tool-buttons{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}.teammate-tools button{min-height:44px}.teammate-activity li{overflow-wrap:anywhere}.teammate-memory .memory-tell,.teammate-memory .memory-search{display:flex;flex-wrap:wrap;gap:8px;align-items:flex-end;margin:0 0 12px}.teammate-memory .memory-tell textarea{flex:1 1 280px}.teammate-memory .memory-search input{flex:1 1 220px}.teammate-memory button{min-height:44px}.teammate-memories{list-style:none;padding:0;margin:0}.teammate-memories li{padding:10px 0;border-top:1px solid var(--so-line);overflow-wrap:anywhere}.teammate-memories li:first-child{border-top:0}.teammate-memories .meta{display:block;font-size:.85rem}.teammate-memories details.memory-edit{border:0;padding:0;margin:2px 0 0;background:transparent;box-shadow:none}.memory-edit summary{cursor:pointer;min-height:32px;display:inline-flex;align-items:center;font-size:.85rem;font-weight:400;color:var(--so-muted)}.tool-undo{border:0;padding:0;margin:8px 0;background:transparent;box-shadow:none}.tool-undo summary{cursor:pointer;min-height:36px;display:inline-flex;align-items:center;font-size:.9rem}.tool-undo-row{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin:6px 0}.tool-undo-row select{width:auto}.teammate-overrides,.teammate-undo{padding-left:18px}.teammate-undo li{margin:6px 0}.teammate-undo form{display:inline}.teammate-week h3{font-size:1rem;margin:14px 0 4px}.teammate-week button{min-height:44px}.teammate-routines{list-style:none;padding:0;margin:8px 0}.teammate-routines li{display:grid;gap:4px;padding:10px 0;border-top:1px solid var(--so-line)}.teammate-routines li:first-child{border-top:0}.routine-buttons{display:flex;flex-wrap:wrap;gap:8px}.routine-buttons button,.routine-add button{min-height:44px}.routine-add{display:flex;flex-wrap:wrap;gap:8px;align-items:flex-end;margin:8px 0}.routine-add label{display:grid;gap:4px;flex:1 1 200px}.routine-add label:first-of-type{flex:0 1 180px}.teammate-actions,.question-options{display:flex;flex-wrap:wrap;gap:8px;margin:8px 0}.teammate-actions form,.question-options form{margin:0}.memory-edit form{display:grid;gap:8px;margin-top:6px}.memory-buttons{display:flex;flex-wrap:wrap;gap:8px}@media(max-width:600px){.teammate-tools select,.teammate-tools input{font-size:16px}}`;
11
11
  const USES = [["free", "Do it"], ["limit", "Do it, up to a limit"], ["ask", "Ask first"], ["never", "Never"]];
@@ -1,6 +1,5 @@
1
1
  import { type PhoneLink } from "./chat-channel.js";
2
2
  export { channelRepos as telegramConversationRepos, resolveChannelMate as resolveTelegramMate, tooLongText, whichTaskText, replyContextFor, NO_PHONE_LINK, NO_TASK_LINK, proposalLink, confirmedLink, proposalPreview, proposalOutcomeText, handoffCardText, confirmedCardText, CHAT_ACTION_PARITY as TELEGRAM_ACTION_PARITY, parityGaps, type PhoneLink, type ResolvedMate, type ParitySupport } from "./chat-channel.js";
3
- import { type DoorOptions } from "./mate-doors.js";
4
3
  import { type MateAsk, type Store, type TelegramBinding } from "./store.js";
5
4
  import type { SubscriptionMateRunner } from "./subscription-chat.js";
6
5
  import type { TelegramTransport } from "./telegram.js";
@@ -20,8 +19,6 @@ export type TelegramConversationOptions = {
20
19
  evidenceRoot: string;
21
20
  /** Injected by tests; production invokes the isolated local harness. */
22
21
  subscriptionRunner?: SubscriptionMateRunner;
23
- /** The held-session supervisor in this process, when there is one (a stop fences through it). */
24
- held?: DoorOptions["held"];
25
22
  /**
26
23
  * The https origin a phone link may open, read again on EVERY call (a
27
24
  * card is linked immediately before it is sent or edited, never from a
@@ -277,7 +277,6 @@ export function applyProposalTap(store, binding, token, message, repos, options,
277
277
  via: "telegram",
278
278
  evidenceRoot: options.evidenceRoot,
279
279
  confirm: action.phase === "yes",
280
- ...(options.held === undefined ? {} : { held: options.held }),
281
280
  deferSignal: signal => effects.push({ kind: "signal", run: signal }),
282
281
  });
283
282
  if (!outcome.ok && outcome.reason === "needs-confirm") {
@@ -1,6 +1,6 @@
1
1
  /**
2
- * The template library (adoption track, step 2) — common standing orders
3
- * shipped as STATIC DATA that renders into editable, UNAPPROVED drafts.
2
+ * The template library (adoption track, step 2) — common work shipped as
3
+ * STATIC DATA that renders into editable, UNAPPROVED drafts.
4
4
  *
5
5
  * What a template is: a pre-filled form. What it is not: automation with
6
6
  * authority. Applying one produces exactly the rows a manual filing
@@ -9,7 +9,10 @@
9
9
  * capitals, because `--file` must never read as a yes.
10
10
  *
11
11
  * The Codex adoption review (finding 10) drew the v1 line: templates may
12
- * express ONLY what a task or routine proposal can carry today. The two
12
+ * express ONLY what a task proposal or a scheduled flow can carry today. A
13
+ * repeating template (v115: what a routine template was) makes a scheduled
14
+ * flow whose schedule starts paused, and whose every firing waits for
15
+ * approval under the project's rules. The two
13
16
  * use cases that imply separate authenticated authority — GitHub issue
14
17
  * intake (a grant) and CI babysitting (publish + the repair button) —
15
18
  * ship as RECIPES: they display the existing ceremonies, and cannot be
@@ -35,11 +38,12 @@ export type TaskTemplate = {
35
38
  /** The fields most installations change — shown in `show` and preview. */
36
39
  edit: string[];
37
40
  };
38
- export type RoutineTemplate = {
39
- kind: "routine";
41
+ export type ScheduledTemplate = {
42
+ kind: "scheduled";
40
43
  name: string;
41
44
  purpose: string;
42
- routineName: string;
45
+ /** The flow's name. */
46
+ title: string;
43
47
  goal: string;
44
48
  outOfScope: string | null;
45
49
  touches: string[];
@@ -60,6 +64,6 @@ export type RecipeTemplate = {
60
64
  run: string;
61
65
  }[];
62
66
  };
63
- export type Template = TaskTemplate | RoutineTemplate | RecipeTemplate;
67
+ export type Template = TaskTemplate | ScheduledTemplate | RecipeTemplate;
64
68
  export declare const TEMPLATES: readonly Template[];
65
69
  export declare function templateByName(name: string): Template | null;
package/dist/templates.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * The template library (adoption track, step 2) — common standing orders
3
- * shipped as STATIC DATA that renders into editable, UNAPPROVED drafts.
2
+ * The template library (adoption track, step 2) — common work shipped as
3
+ * STATIC DATA that renders into editable, UNAPPROVED drafts.
4
4
  *
5
5
  * What a template is: a pre-filled form. What it is not: automation with
6
6
  * authority. Applying one produces exactly the rows a manual filing
@@ -9,7 +9,10 @@
9
9
  * capitals, because `--file` must never read as a yes.
10
10
  *
11
11
  * The Codex adoption review (finding 10) drew the v1 line: templates may
12
- * express ONLY what a task or routine proposal can carry today. The two
12
+ * express ONLY what a task proposal or a scheduled flow can carry today. A
13
+ * repeating template (v115: what a routine template was) makes a scheduled
14
+ * flow whose schedule starts paused, and whose every firing waits for
15
+ * approval under the project's rules. The two
13
16
  * use cases that imply separate authenticated authority — GitHub issue
14
17
  * intake (a grant) and CI babysitting (publish + the repair button) —
15
18
  * ship as RECIPES: they display the existing ceremonies, and cannot be
@@ -21,10 +24,10 @@
21
24
  */
22
25
  export const TEMPLATES = [
23
26
  {
24
- kind: "routine",
27
+ kind: "scheduled",
25
28
  name: "nightly-deps",
26
29
  purpose: "keep dependencies fresh without surprise majors",
27
- routineName: "nightly-deps",
30
+ title: "Keep dependencies current",
28
31
  goal: "Update dependencies conservatively: refresh the lockfile within existing semver ranges, run the full test suite, and summarize what moved in the handoff — plus anything notable you saw (majors now available, security advisories, packages that look abandoned). If the suite fails after the refresh, park with the failure rather than pinning things until it passes.",
29
32
  outOfScope: "No major version bumps. No edits to application code beyond what the lockfile refresh itself forces. No changes to CI configuration.",
30
33
  touches: [],
@@ -37,10 +40,10 @@ export const TEMPLATES = [
37
40
  edit: ["schedule", "goal (name your package manager if it is unusual)", "ceiling (a weekly dollar cap)"],
38
41
  },
39
42
  {
40
- kind: "routine",
43
+ kind: "scheduled",
41
44
  name: "test-coverage",
42
45
  purpose: "grow the test suite one module at a time",
43
- routineName: "test-coverage",
46
+ title: "Test one overlooked module",
44
47
  goal: "Pick ONE module that is under-tested — no tests at all beats thin tests — and write focused tests for its observable behavior: inputs, outputs, and failure paths, not implementation details. One module per firing, then stop. If the module cannot be tested without refactoring it, do not refactor: park with a note naming the obstacle so a human can decide.",
45
48
  outOfScope: "No refactoring of the code under test. No snapshot tests. No changes outside the chosen module's test file(s).",
46
49
  touches: [],
@@ -53,10 +56,10 @@ export const TEMPLATES = [
53
56
  edit: ["schedule", "touches (pin the test directory layout if yours is unusual)"],
54
57
  },
55
58
  {
56
- kind: "routine",
59
+ kind: "scheduled",
57
60
  name: "docs-drift",
58
61
  purpose: "keep the README and docs telling the truth weekly",
59
- routineName: "docs-drift",
62
+ title: "Keep documentation accurate",
60
63
  goal: "Read the README and any docs/ pages against the code as it is today. Fix what has drifted: commands that moved, flags that changed, features that shipped undocumented, claims that stopped being true. Prefer deleting a stale claim over guessing a new one. Summarize every correction in the handoff.",
61
64
  outOfScope: "No restructuring or rewriting for style. No new documentation pages. No changes to code.",
62
65
  touches: ["README.md", "docs/"],
@@ -103,14 +103,35 @@ export declare function releaseNotes(changelog: string, version: string): string
103
103
  * by its directory), and the directory after, so a crash never leaves a torn
104
104
  * database, catalog or command. */
105
105
  export declare function durableRename(temp: string, target: string): void;
106
- type TableDigest = {
106
+ /** The tables a migration may remove whole (v115's removed features). */
107
+ export declare const RETIRED_TABLES: readonly string[];
108
+ /** A saved routine, as its move into a scheduled flow must account for it. */
109
+ type RoutineDigest = {
110
+ id: number;
111
+ repo: string;
112
+ name: string;
113
+ live: boolean;
114
+ };
115
+ export type TableDigest = {
107
116
  name: string;
108
117
  columns: string[];
118
+ rowid: boolean;
109
119
  count: number;
110
- hash: string;
120
+ last: number;
121
+ hash?: string;
122
+ summed?: number;
123
+ nonNull?: Record<string, number>;
124
+ carry?: number;
125
+ received?: {
126
+ count: number;
127
+ nonNull: Record<string, number>;
128
+ };
129
+ routines?: RoutineDigest[];
111
130
  };
112
- /** Every historical row, table by table (deploy-browser's rehearsal check). */
131
+ /** Each saved table's columns, row count and last rowid; the append-only ones hashed (deploy-browser's rehearsal check).
132
+ * Bounded: only the ledger and small tables are read row by row. */
113
133
  export declare function historySnapshot(db: DatabaseSync): TableDigest[];
134
+ /** The tables whose saved history the migration changed beyond what HISTORY_RULES declares. */
114
135
  export declare function changedHistory(db: DatabaseSync, before: TableDigest[]): string[];
115
136
  export type StartOptions = {
116
137
  stateDir: string;