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
@@ -1,30 +0,0 @@
1
- /**
2
- * Attended-liveness semantics (Parity II Phase 1, S3) — the ONE definition
3
- * every attended feature consumes. A browser proves presence only by
4
- * RENEWING a heartbeat; absence is inferred only from renewal ceasing,
5
- * never from observing a tab close (which is not reliably observable).
6
- * Renewal can extend nothing past an absolute expiry and can never mint
7
- * or broaden authority — it only keeps an already-signed authorization
8
- * usable (strategy rulings 1c/12).
9
- *
10
- * The state contract, exact (spec finding 11/18):
11
- * - "expired" iff now >= absoluteExpiryAt — checked FIRST; renewal is
12
- * irrelevant past the absolute wall.
13
- * - a null beat (never renewed) is "lapsed".
14
- * - a FUTURE beat is "lapsed": strict means strict — a clock that claims
15
- * tomorrow proves nothing about presence now.
16
- * - "live" iff now - lastBeatAt <= 20s (one 15s beat + 5s jitter).
17
- * - "grace" iff now - lastBeatAt <= 45s (one missed beat, forgiven —
18
- * background-tab throttling survives grace, not live).
19
- * - otherwise "lapsed".
20
- *
21
- * Session COOKIE lifetimes (12h idle / 7d absolute in serve.ts) are a
22
- * different thing and are untouched by all of this.
23
- */
24
- export declare const BEAT_MS = 15000;
25
- /** live = one beat plus jitter. */
26
- export declare const LIVE_MS = 20000;
27
- /** grace = one whole missed beat beyond live, forgiven. */
28
- export declare const GRACE_MS = 45000;
29
- export type AttendedLiveness = "live" | "grace" | "lapsed" | "expired";
30
- export declare function attendedLivenessState(lastBeatAt: number | null, now: number, absoluteExpiryAt: number): AttendedLiveness;
package/dist/liveness.js DELETED
@@ -1,42 +0,0 @@
1
- /**
2
- * Attended-liveness semantics (Parity II Phase 1, S3) — the ONE definition
3
- * every attended feature consumes. A browser proves presence only by
4
- * RENEWING a heartbeat; absence is inferred only from renewal ceasing,
5
- * never from observing a tab close (which is not reliably observable).
6
- * Renewal can extend nothing past an absolute expiry and can never mint
7
- * or broaden authority — it only keeps an already-signed authorization
8
- * usable (strategy rulings 1c/12).
9
- *
10
- * The state contract, exact (spec finding 11/18):
11
- * - "expired" iff now >= absoluteExpiryAt — checked FIRST; renewal is
12
- * irrelevant past the absolute wall.
13
- * - a null beat (never renewed) is "lapsed".
14
- * - a FUTURE beat is "lapsed": strict means strict — a clock that claims
15
- * tomorrow proves nothing about presence now.
16
- * - "live" iff now - lastBeatAt <= 20s (one 15s beat + 5s jitter).
17
- * - "grace" iff now - lastBeatAt <= 45s (one missed beat, forgiven —
18
- * background-tab throttling survives grace, not live).
19
- * - otherwise "lapsed".
20
- *
21
- * Session COOKIE lifetimes (12h idle / 7d absolute in serve.ts) are a
22
- * different thing and are untouched by all of this.
23
- */
24
- export const BEAT_MS = 15_000;
25
- /** live = one beat plus jitter. */
26
- export const LIVE_MS = 20_000;
27
- /** grace = one whole missed beat beyond live, forgiven. */
28
- export const GRACE_MS = 45_000;
29
- export function attendedLivenessState(lastBeatAt, now, absoluteExpiryAt) {
30
- if (now >= absoluteExpiryAt)
31
- return "expired";
32
- if (lastBeatAt === null)
33
- return "lapsed";
34
- if (lastBeatAt > now)
35
- return "lapsed";
36
- const age = now - lastBeatAt;
37
- if (age <= LIVE_MS)
38
- return "live";
39
- if (age <= GRACE_MS)
40
- return "grace";
41
- return "lapsed";
42
- }
package/dist/pricing.d.ts DELETED
@@ -1,45 +0,0 @@
1
- /**
2
- * Pinned build-model prices (tournament design v3, stage 1; the round-3
3
- * findings are the spec). Integer micro-dollars per SINGLE token, rounded
4
- * UP from list prices, with the cache token classes priced separately —
5
- * finding 24: a "one call" tail computed from rates alone bounds nothing;
6
- * quantity must be pinned too, so every model row carries its context
7
- * window and maximum output, and the tail is the worst legal call:
8
- * every context token at the DEAREST input class plus every output token.
9
- *
10
- * Conservative by construction: reservations overcharge, never under.
11
- * PRICE_VERSION is stamped into approved tournament terms — a price table
12
- * edit never silently reprices an existing approval.
13
- */
14
- export declare const BUILD_PRICE_VERSION = 1;
15
- export type BuildModelPrice = {
16
- /** Micro-dollars per token, ceil'd from list. */
17
- inMicrousd: number;
18
- outMicrousd: number;
19
- cacheWriteMicrousd: number;
20
- cacheReadMicrousd: number;
21
- /** The pinned request envelope's quantity bounds (finding 24). */
22
- contextTokens: number;
23
- maxOutputTokens: number;
24
- };
25
- export declare function buildPriceOf(model: string): BuildModelPrice | null;
26
- export declare const PRICED_BUILD_MODELS: readonly string[];
27
- /**
28
- * The non-spendable overrun reserve: the worst one API call the pinned
29
- * envelope permits. Claude's native cap checks the budget AFTER each
30
- * call, so the true maximum is budget + one full call — this is that
31
- * call, priced at the dearest input class (finding 24's arithmetic).
32
- * Held apart from the spendable budget and NEVER granted to a later
33
- * invocation: each lineage invocation's native cap derives from
34
- * max(spendable − accounted, 0) alone.
35
- */
36
- export declare function oneCallTailMicrousd(model: string): number | null;
37
- /** Settlement at pinned rates from a usage report that itemizes cache
38
- * classes; absent classes count as zero, absent totals fail closed by
39
- * returning null (the caller latches unknown spend, never guesses). */
40
- export declare function settleBuildMicrousd(model: string, usage: {
41
- inputTokens?: number;
42
- outputTokens?: number;
43
- cacheWriteTokens?: number;
44
- cacheReadTokens?: number;
45
- }): number | null;
package/dist/pricing.js DELETED
@@ -1,77 +0,0 @@
1
- /**
2
- * Pinned build-model prices (tournament design v3, stage 1; the round-3
3
- * findings are the spec). Integer micro-dollars per SINGLE token, rounded
4
- * UP from list prices, with the cache token classes priced separately —
5
- * finding 24: a "one call" tail computed from rates alone bounds nothing;
6
- * quantity must be pinned too, so every model row carries its context
7
- * window and maximum output, and the tail is the worst legal call:
8
- * every context token at the DEAREST input class plus every output token.
9
- *
10
- * Conservative by construction: reservations overcharge, never under.
11
- * PRICE_VERSION is stamped into approved tournament terms — a price table
12
- * edit never silently reprices an existing approval.
13
- */
14
- export const BUILD_PRICE_VERSION = 1;
15
- const PRICES = {
16
- "claude-sonnet-5": {
17
- inMicrousd: 3,
18
- outMicrousd: 15,
19
- cacheWriteMicrousd: 4, // 1.25x input, ceil'd
20
- cacheReadMicrousd: 1, // 0.1x input, ceil'd up
21
- contextTokens: 200_000,
22
- maxOutputTokens: 64_000,
23
- },
24
- "claude-opus-5": {
25
- inMicrousd: 15,
26
- outMicrousd: 75,
27
- cacheWriteMicrousd: 19,
28
- cacheReadMicrousd: 2,
29
- contextTokens: 200_000,
30
- maxOutputTokens: 32_000,
31
- },
32
- "claude-haiku-4-5": {
33
- inMicrousd: 1,
34
- outMicrousd: 5,
35
- cacheWriteMicrousd: 2,
36
- cacheReadMicrousd: 1,
37
- contextTokens: 200_000,
38
- maxOutputTokens: 64_000,
39
- },
40
- };
41
- export function buildPriceOf(model) {
42
- return PRICES[model] ?? null;
43
- }
44
- export const PRICED_BUILD_MODELS = Object.keys(PRICES);
45
- /**
46
- * The non-spendable overrun reserve: the worst one API call the pinned
47
- * envelope permits. Claude's native cap checks the budget AFTER each
48
- * call, so the true maximum is budget + one full call — this is that
49
- * call, priced at the dearest input class (finding 24's arithmetic).
50
- * Held apart from the spendable budget and NEVER granted to a later
51
- * invocation: each lineage invocation's native cap derives from
52
- * max(spendable − accounted, 0) alone.
53
- */
54
- export function oneCallTailMicrousd(model) {
55
- const price = buildPriceOf(model);
56
- if (price === null)
57
- return null;
58
- const dearestInput = Math.max(price.inMicrousd, price.cacheWriteMicrousd, price.cacheReadMicrousd);
59
- return price.contextTokens * dearestInput + price.maxOutputTokens * price.outMicrousd;
60
- }
61
- /** Settlement at pinned rates from a usage report that itemizes cache
62
- * classes; absent classes count as zero, absent totals fail closed by
63
- * returning null (the caller latches unknown spend, never guesses). */
64
- export function settleBuildMicrousd(model, usage) {
65
- const price = buildPriceOf(model);
66
- if (price === null)
67
- return null;
68
- const { inputTokens, outputTokens } = usage;
69
- if (inputTokens === undefined || outputTokens === undefined)
70
- return null;
71
- if (!Number.isFinite(inputTokens) || !Number.isFinite(outputTokens) || inputTokens < 0 || outputTokens < 0)
72
- return null;
73
- return (inputTokens * price.inMicrousd +
74
- outputTokens * price.outMicrousd +
75
- (usage.cacheWriteTokens ?? 0) * price.cacheWriteMicrousd +
76
- (usage.cacheReadTokens ?? 0) * price.cacheReadMicrousd);
77
- }
package/dist/routine.d.ts DELETED
@@ -1,228 +0,0 @@
1
- /**
2
- * Routines: standing orders that fire on a schedule (Phase C).
3
- *
4
- * A routine is a pre-approved template — goal, exclusions, touches,
5
- * requirements, schedule, budget — whose approval is what makes every
6
- * instance legitimately automatic. The template's digest covers EVERY term
7
- * that constrains the standing order, not just the scope trio: a schedule
8
- * moved from weekly to hourly, or a budget quietly removed, changes what the
9
- * operator agreed to exactly as much as a rewritten goal would.
10
- *
11
- * The schedule algebra lives here, pure, because its two failure modes are
12
- * subtle enough to deserve names (Codex planning/routines review, finding
13
- * 10): advancing one interval after downtime leaves the next firing in the
14
- * past — a catch-up burst; advancing to `now + interval` drifts the cadence
15
- * forever. The rule is ALIGNED advancement: the next occurrence strictly
16
- * after now, anchored to the occurrence that just fired (for `every`) or to
17
- * the clock itself (for `daily`). Missed slots while nothing was running
18
- * fire ONCE — the overdue occurrence — and are never backfilled.
19
- */
20
- import { type Routine, type Store } from "./store.js";
21
- import { type ExecutionProfile, type AcceptanceCriterion } from "./scope.js";
22
- import { type PhaseRoute } from "./phase-routing.js";
23
- export type Schedule = {
24
- kind: "every";
25
- minutes: number;
26
- } | {
27
- kind: "daily";
28
- hhmm: string;
29
- timezone?: string;
30
- }
31
- /** v96: Monday to Friday. */
32
- | {
33
- kind: "weekdays";
34
- hhmm: string;
35
- timezone?: string;
36
- } | {
37
- kind: "weekly";
38
- day: number;
39
- hhmm: string;
40
- timezone?: string;
41
- };
42
- export declare const WEEKDAYS: readonly ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
43
- export declare function validTimezone(value: string): boolean;
44
- /** Bounds a person would pick on purpose: 5 minutes to 7 days. */
45
- export declare const MIN_EVERY_MINUTES = 5;
46
- export declare const MAX_EVERY_MINUTES: number;
47
- /**
48
- * Existing daily schedules remain UTC. Calendar schedules may name an IANA
49
- * timezone, whose wall-clock time stays fixed across daylight saving changes.
50
- * No cron expressions in v1 — a schedule the operator cannot read at a
51
- * glance is a schedule they cannot honestly approve.
52
- */
53
- export declare function parseSchedule(text: string): Schedule | null;
54
- export declare function scheduleText(schedule: Schedule): string;
55
- /** The schedule, in words an operator agrees to. */
56
- export declare function describeSchedule(schedule: Schedule): string;
57
- /**
58
- * The first occurrence after approval: the schedule starts counting from the
59
- * yes, because "approved at 14:07, every 60 minutes" firing instantly would
60
- * spend before the approver's hand left the keyboard.
61
- */
62
- export declare function firstFireAt(schedule: Schedule, now: Date): string;
63
- /**
64
- * Aligned advancement: the smallest cadence occurrence STRICTLY after now.
65
- * `anchor` is the occurrence that just fired (or was just skipped) — the
66
- * cadence grid grows from it, so a pass that ran late does not tilt every
67
- * later firing by its lateness.
68
- */
69
- export declare function nextFireAt(schedule: Schedule, anchorIso: string, now: Date): string;
70
- /** Every term the digest must bind — a change to any is a different order. */
71
- export type RoutineTerms = {
72
- repo: string;
73
- goal: string;
74
- outOfScope: string | null;
75
- touches: string[];
76
- /** v39: the signed rubric every instance's scope copies forward, byte
77
- * for byte, at fire time — never re-authored per firing. */
78
- acceptance: AcceptanceCriterion[];
79
- requirements: string[];
80
- schedule: string;
81
- singleFlight: boolean;
82
- costCeilingUsd: number | null;
83
- /** Per-instance dollar cap in micro-USD (v16); null = only the backstop. */
84
- budgetPerRunMicrousd?: number | null;
85
- };
86
- /**
87
- * The exact standing order an operator agreed to, as 128 bits. Same shape
88
- * and length as a scope digest, and for the same reason: approval binds to
89
- * this value, and editing any term strands the old yes.
90
- */
91
- export declare function routineDigestOf(terms: RoutineTerms, profile?: ExecutionProfile | null, route?: PhaseRoute | null): string;
92
- export type RoutineProblem = {
93
- field: string;
94
- problem: string;
95
- };
96
- /** Instance ids are `<name>-YYYYMMDD-HHMM`, so the name must be an id stem. */
97
- export declare const ROUTINE_NAME: RegExp;
98
- /**
99
- * Fail closed on every field at once, like plan parsing: an operator fixing
100
- * a routine definition should learn everything wrong in one round.
101
- */
102
- export declare function validateRoutineTerms(terms: RoutineTerms, options?: {
103
- /** The STORED row's name (final authority closure): validated with the
104
- * terms wherever a stored routine is read back, so a raw name this
105
- * code never files — one no instance id could be stamped from — is
106
- * as invalid as an empty rubric, and no door moves on it. */
107
- name?: string;
108
- }): RoutineProblem[];
109
- /** The stored row's terms, for re-proving the digest against what is actually there. */
110
- export declare function termsOf(routine: Routine): RoutineTerms;
111
- /** The instance task id: the routine's name stamped with its scheduled slot. */
112
- export declare function instanceId(name: string, scheduledForIso: string): string;
113
- /** The rolling budget window: seven days, and every surface says so. */
114
- export declare const BUDGET_WINDOW_MS: number;
115
- export type ApproveRoutineResult = {
116
- ok: true;
117
- routine: Routine;
118
- } | {
119
- ok: false;
120
- reason: "no-such-routine" | "profile-unresolved" | "changed" | "no-approvers" | "not-an-approver" | "requester";
121
- };
122
- /**
123
- * A person agrees to the standing order — schedule, budget, and "each
124
- * firing builds without asking" included, because the digest binds them.
125
- * Same ceremony as a scope approval: credential re-proved inside the same
126
- * transaction as the write, digest named rather than assumed.
127
- */
128
- export declare function approveRoutine(store: Store, routineId: number, by: string, now: Date, sawDigest: string, token: string): ApproveRoutineResult;
129
- export type FireOutcome = {
130
- ok: true;
131
- taskId: string;
132
- scheduledFor: string;
133
- } | {
134
- ok: false;
135
- reason: "no-such-routine" | "not-approved" | "paused" | "not-due" | "bad-schedule" | "slot-taken" | "single-flight" | "budget" | "unmeasured" | "route-unfrozen";
136
- detail?: string;
137
- };
138
- export declare function fireRoutine(store: Store, routineId: number, now: Date, options?: {
139
- manual?: boolean;
140
- }): FireOutcome;
141
- /**
142
- * THE AGENTS A STANDING ORDER HOLDS (v48), as one honest word per state,
143
- * read by every surface — the routine page, the CLI, the firing:
144
- *
145
- * frozen — approved, and the approval's snapshot reads back exact;
146
- * pending — filed with an exact route, awaiting the yes (or the yes
147
- * went stale on an edit);
148
- * unfrozen — approved BEFORE agents were frozen: the approval stands
149
- * on its terms but no firing can run until the agents are
150
- * refreshed and the order approved again;
151
- * unreadable — the row carries route or profile bytes that do not read
152
- * back (corrupt): nothing approves or fires;
153
- * unresolved — filed under a configuration that could not name an
154
- * exact agent for every role (or whose route carries a
155
- * stated problem): refresh once the agents are configured.
156
- *
157
- * `refresh` says whether the one recovery road — re-resolve the agents
158
- * from today's configuration and approve again — applies.
159
- */
160
- export type RoutineAgentsState = {
161
- state: "frozen" | "pending" | "unfrozen" | "unreadable" | "unverified" | "unresolved";
162
- approvable: boolean;
163
- refresh: boolean;
164
- problem: string | null;
165
- };
166
- /**
167
- * THE ONE INTEGRITY PROJECTION (v48 authority repair): every question about a standing
168
- * order's agents — what the page says, whether a yes may be minted,
169
- * whether an approval may land, whether a firing may proceed — is answered
170
- * from this one reading of the row, computed BEFORE any mutation and never
171
- * from a column alone.
172
- *
173
- * approved the stamp exists, the digest column matches the stored terms'
174
- * digest, and that digest re-derives from the stored terms,
175
- * working profile, and working route (a column rewritten under
176
- * a reused digest is not an approval).
177
- * live the approval stands AND its frozen snapshot is whole: both
178
- * snapshot columns read back, they hash with the stored terms to
179
- * the very digest the approver signed, no leg states a problem,
180
- * and the build and repair legs are the sealed profile's exact
181
- * pairs. Only a live approval fires; nothing else does.
182
- * agents the word every surface uses, with whether a yes could bind
183
- * (`approvable`) and whether the one recovery road applies
184
- * (`refresh`).
185
- */
186
- export type RoutineIntegrity = {
187
- approved: boolean;
188
- live: boolean;
189
- /** Why the approval is not live, when it is not — in words a page can show. */
190
- liveProblem: string | null;
191
- agents: RoutineAgentsState;
192
- };
193
- /** The FULL row (v48 integrity): every term the digest binds, both
194
- * snapshot pairs, and the unreadable flags. There is no partial
195
- * projection — a reading that skipped the re-derivation could call a
196
- * rewritten row approved. */
197
- type IntegrityRow = Routine;
198
- export declare function routineIntegrity(routine: IntegrityRow): RoutineIntegrity;
199
- /** The agents word every surface uses — one reading of the projection. */
200
- export declare function routineAgentsState(routine: IntegrityRow): RoutineAgentsState;
201
- export type RefreshRoutineResult = {
202
- ok: true;
203
- routine: Routine;
204
- changed: boolean;
205
- } | {
206
- ok: false;
207
- reason: "no-such-routine" | "unresolved";
208
- problem: string;
209
- };
210
- /**
211
- * THE RECOVERY ROAD (v48): re-resolve a standing order's agents — the
212
- * four-role route and the profile that restates its build and repair legs
213
- * — from today's configuration, and file them as the order's WORKING
214
- * agents under a digest that binds them. Nothing is approved here: a
215
- * refreshed order reads "edited — approve again", the approver reads the
216
- * exact agents it now names and agrees to them with the password, and
217
- * only that yes freezes the snapshot a firing copies. A routine whose
218
- * terms already bind these exact agents is left byte-for-byte alone.
219
- * A configuration that still cannot name an exact, runnable agent for
220
- * every role answers with the words and changes nothing.
221
- */
222
- export declare function refreshRoutineAgents(store: Store, routineId: number, now: Date): RefreshRoutineResult;
223
- /** The standing order, in the words an operator has to agree to. */
224
- export declare function describeRoutine(routine: Routine): string[];
225
- /** The agents a standing order's approval freezes, in the same words the
226
- * task page and chat use — or why it cannot say. */
227
- export declare function routineAgentsWords(routine: Routine): string[];
228
- export {};