toolroll 0.9.52 → 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 (146) hide show
  1. package/CHANGELOG.md +8 -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/board.d.ts +3 -19
  8. package/dist/board.js +4 -42
  9. package/dist/browser/workspace.js +18 -18
  10. package/dist/browser-workspace.d.ts +2 -1
  11. package/dist/builder.d.ts +9 -40
  12. package/dist/builder.js +50 -257
  13. package/dist/chat-actions.js +3 -14
  14. package/dist/chat-controls.d.ts +0 -4
  15. package/dist/chat-controls.js +0 -1
  16. package/dist/chat-decide.js +1 -3
  17. package/dist/chat-delivery.d.ts +0 -2
  18. package/dist/chat-delivery.js +0 -1
  19. package/dist/chat-quiet.js +2 -2
  20. package/dist/chat-task-actions.d.ts +1 -1
  21. package/dist/chat-task-actions.js +0 -2
  22. package/dist/claim.d.ts +79 -244
  23. package/dist/claim.js +688 -1023
  24. package/dist/cli.d.ts +2 -0
  25. package/dist/cli.js +10 -2
  26. package/dist/contracts/cli.d.ts +0 -13
  27. package/dist/contracts/cli.js +0 -2
  28. package/dist/contracts/console-api.d.ts +5 -10
  29. package/dist/contracts/console-api.js +4 -10
  30. package/dist/contracts/flow.d.ts +50 -0
  31. package/dist/contracts/flow.js +26 -1
  32. package/dist/contracts/lead-tools.d.ts +0 -13
  33. package/dist/contracts/lead-tools.js +3 -3
  34. package/dist/contracts/store-json.d.ts +1 -25
  35. package/dist/contracts/store-json.js +3 -13
  36. package/dist/converse.d.ts +1 -11
  37. package/dist/converse.js +6 -38
  38. package/dist/coordinator.d.ts +0 -1
  39. package/dist/coordinator.js +3 -5
  40. package/dist/demo.js +16 -26
  41. package/dist/desktop-update-gate.js +0 -1
  42. package/dist/desktop-update.js +1 -3
  43. package/dist/dispatch.d.ts +1 -1
  44. package/dist/dispatch.js +1 -1
  45. package/dist/dispose.d.ts +2 -3
  46. package/dist/dispose.js +17 -92
  47. package/dist/envelope.js +0 -3
  48. package/dist/exec.d.ts +0 -64
  49. package/dist/exec.js +3 -356
  50. package/dist/exhaustion.d.ts +22 -76
  51. package/dist/exhaustion.js +14 -140
  52. package/dist/export.js +4 -4
  53. package/dist/flow-engine.js +1 -1
  54. package/dist/flow-schedule.d.ts +154 -0
  55. package/dist/flow-schedule.js +321 -0
  56. package/dist/flow-share.js +1 -1
  57. package/dist/flow-triggers.d.ts +6 -1
  58. package/dist/flow-triggers.js +65 -10
  59. package/dist/flows-cli.js +8 -4
  60. package/dist/flows-ui.js +2 -0
  61. package/dist/flows.js +1 -1
  62. package/dist/guides.js +9 -29
  63. package/dist/invoke.d.ts +1 -24
  64. package/dist/invoke.js +17 -259
  65. package/dist/lead-status.js +2 -4
  66. package/dist/lead-voice.js +1 -1
  67. package/dist/mate-doors.d.ts +1 -2
  68. package/dist/mate-doors.js +12 -25
  69. package/dist/mate-tools.d.ts +2 -2
  70. package/dist/mate-tools.js +10 -22
  71. package/dist/modes.d.ts +6 -7
  72. package/dist/modes.js +7 -13
  73. package/dist/operate-remote-arguments.js +2 -6
  74. package/dist/operate-remote.js +6 -7
  75. package/dist/operate.d.ts +0 -6
  76. package/dist/operate.js +222 -2247
  77. package/dist/phase-routing.d.ts +13 -23
  78. package/dist/phase-routing.js +13 -35
  79. package/dist/plan-auto.js +2 -2
  80. package/dist/planner-source.js +2 -1
  81. package/dist/policy.d.ts +1 -4
  82. package/dist/policy.js +0 -8
  83. package/dist/process-recovery-eligibility.js +2 -3
  84. package/dist/project-delete.js +3 -15
  85. package/dist/proposal.d.ts +4 -24
  86. package/dist/proposal.js +3 -88
  87. package/dist/provider-auth.d.ts +3 -3
  88. package/dist/provider-auth.js +4 -6
  89. package/dist/provider.d.ts +11 -25
  90. package/dist/provider.js +4 -36
  91. package/dist/push.js +1 -1
  92. package/dist/recipe-ui.js +6 -6
  93. package/dist/recipes.d.ts +3 -3
  94. package/dist/recipes.js +27 -23
  95. package/dist/run-closeout.d.ts +1 -1
  96. package/dist/run-closeout.js +1 -4
  97. package/dist/scope.d.ts +11 -65
  98. package/dist/scope.js +17 -82
  99. package/dist/serve.js +15 -24
  100. package/dist/server/chat.js +7 -30
  101. package/dist/server/flows.js +11 -10
  102. package/dist/server/guards.js +0 -1
  103. package/dist/server/pages-assets.js +1 -1
  104. package/dist/server/pages.js +0 -2
  105. package/dist/server/people-tokens.js +0 -4
  106. package/dist/server/route-table.d.ts +1 -1
  107. package/dist/server/route-table.js +2 -17
  108. package/dist/server/settings.js +1 -8
  109. package/dist/server/shared.d.ts +28 -212
  110. package/dist/server/shared.js +71 -780
  111. package/dist/server/task-views.js +9 -76
  112. package/dist/server/tasks.d.ts +1 -50
  113. package/dist/server/tasks.js +36 -946
  114. package/dist/setup-guide.d.ts +2 -2
  115. package/dist/slack-chat.d.ts +0 -2
  116. package/dist/slack-chat.js +0 -1
  117. package/dist/store.d.ts +105 -1340
  118. package/dist/store.js +706 -4010
  119. package/dist/surface.js +10 -24
  120. package/dist/task-composer.d.ts +1 -1
  121. package/dist/task-composer.js +1 -1
  122. package/dist/task-control.d.ts +3 -10
  123. package/dist/task-control.js +2 -7
  124. package/dist/teammate-desk.js +1 -1
  125. package/dist/teammates-ui.js +1 -1
  126. package/dist/telegram-mate.d.ts +0 -3
  127. package/dist/telegram-mate.js +0 -1
  128. package/dist/templates.d.ts +11 -7
  129. package/dist/templates.js +12 -9
  130. package/dist/toolroll-update.d.ts +10 -0
  131. package/dist/toolroll-update.js +56 -4
  132. package/dist/work-index.js +2 -6
  133. package/dist/workspace-ui.js +1 -1
  134. package/package.json +1 -1
  135. package/scripts/recovery-canary.mjs +3 -3
  136. package/dist/contest.d.ts +0 -318
  137. package/dist/contest.js +0 -753
  138. package/dist/held.d.ts +0 -150
  139. package/dist/held.js +0 -799
  140. package/dist/liveness.d.ts +0 -30
  141. package/dist/liveness.js +0 -42
  142. package/dist/pricing.d.ts +0 -45
  143. package/dist/pricing.js +0 -77
  144. package/dist/routine.d.ts +0 -228
  145. package/dist/routine.js +0 -764
  146. package/dist/supervisor.mjs +0 -297
package/dist/store.d.ts CHANGED
@@ -6,9 +6,9 @@ import { type Actor } from "./actor.js";
6
6
  import { type LiveActivityKind } from "./live.js";
7
7
  import { type TokenPurpose } from "./api-tokens.js";
8
8
  import { type CriterionMatrixRow, type CriterionJudgementWord } from "./proof.js";
9
- import { type ExecutionProfile, type ChainEntry, type UnattendedPermissionMode, type AcceptanceCriterion } from "./scope.js";
10
- import { type ProviderRoom, type CandidateTier, type TaskSize, type TaskSizing, type PhaseRoute, type PublicationAuthority, type RouteStamp, type ReadinessLookup, type ReadinessObservation, type RiskLevel, type RouteOverride } from "./phase-routing.js";
11
- import { type TerminalClass } from "./exhaustion.js";
9
+ import { type ExecutionProfile, type UnattendedPermissionMode, type AcceptanceCriterion } from "./scope.js";
10
+ import { type ProviderRoom, type CandidateTier, type TaskSize, type TaskSizing, type PhaseRoute, type PublicationAuthority, type RouteStamp, type ReadinessLookup, type ReadinessObservation, type RouteOverride } from "./phase-routing.js";
11
+ import type { TerminalClass } from "./exhaustion.js";
12
12
  import { type ProviderId } from "./provider.js";
13
13
  import type { BoardFacts } from "./board.js";
14
14
  import type { BackendGrant, TaskOrigin } from "./grant.js";
@@ -152,7 +152,9 @@ export type SealedLedgerEntry = LedgerEntry & {
152
152
  hash: string;
153
153
  } | null;
154
154
  };
155
- export declare const SCHEMA_VERSION = 114;
155
+ export declare const SCHEMA_VERSION = 115;
156
+ /** v115: the tables migrateToV115 drops. */
157
+ export declare const V115_DROPPED_TABLES: readonly string[];
156
158
  /**
157
159
  * The migrations `toolroll update` may carry a database through in place: each
158
160
  * one only adds (a table, a column, an accepted value) and leaves every saved row
@@ -171,6 +173,14 @@ export declare const SCHEMA_VERSION = 114;
171
173
  * (rows removed equal the witnesses summarized), and notification drops its
172
174
  * delivery columns only after every value moves into one legacy receipt per row
173
175
  * (rows and ids carried whole; legacy receipts added equal the rows carried).
176
+ * v115 removes contests, held sessions, fallback chains and routines, and is
177
+ * checked under rules named for exactly that: the eleven removed tables may go
178
+ * whole, every kept flow and trigger row stays as it was, and the only rows
179
+ * added are one flow and one schedule trigger per saved routine (paused unless
180
+ * the routine was approved and running). Its other changes add a column or
181
+ * settle rows in place; a database whose removed features still held a hold
182
+ * to lift or place changes that table's rows and is refused, so it takes the
183
+ * separate procedure.
174
184
  */
175
185
  export declare const UPDATE_SAFE_MIGRATIONS: readonly number[];
176
186
  /** Whether a database settled at `version` reaches this build's schema through update-safe migrations alone. */
@@ -296,9 +306,7 @@ export type TaskRef = {
296
306
  /** What comes back (v34): a branch to publish, or a report to read.
297
307
  * Set at filing and never rewritten — a scout's strikes are the task's. */
298
308
  deliverable: "branch" | "report";
299
- /** The standing order this task is an instance of; null for one-off work. */
300
- routineId: number | null;
301
- /** The pinned agent, when a fire transaction stamped one. Authoritative. */
309
+ /** The pinned agent, when an approved standing order stamped one. Authoritative. */
302
310
  agentProvider: string | null;
303
311
  agentModel: string | null;
304
312
  /** Durable per-task override. null means the installation default is used
@@ -308,9 +316,6 @@ export type TaskRef = {
308
316
  /** Durable per-task evidence-policy override. null inherits the
309
317
  * installation default when a scope is next written. */
310
318
  qualityMode?: QualityMode | null;
311
- /** v47: the task's declared risk; null reads as routine when the next
312
- * scope is filed. The scope stores the signed level. */
313
- riskLevel?: RiskLevel | null;
314
319
  /** v47: the approver's per-phase route overrides, applied when the next
315
320
  * scope is filed and recorded in the sealed route. null = the stored
316
321
  * list is malformed; the next filing goes unresolved rather than routing
@@ -334,88 +339,11 @@ export type TaskRef = {
334
339
  origin: TaskOrigin;
335
340
  };
336
341
  /** A standing order: a pre-approved template whose instances build unattended. */
337
- export type TournamentTerms = {
338
- id: number;
339
- taskRef: number;
340
- generation: number;
341
- active: boolean;
342
- /** v27: 'race' = dollar-capped tournament; 'comparison' = labeled
343
- * cross-runtime comparison with no dollar terms. */
344
- kind: "race" | "comparison";
345
- raceDigest: string;
346
- /** Ordered agents: exact model ids, resolved at filing. */
347
- agents: {
348
- provider: string;
349
- model: string;
350
- repairModel: string;
351
- permissionMode?: UnattendedPermissionMode;
352
- }[];
353
- n: number;
354
- perAgentBudgetMicrousd: number;
355
- overrunReserveMicrousd: number;
356
- totalBudgetMicrousd: number;
357
- priceVersion: number;
358
- retries: number;
359
- publicationPolicy: string;
360
- createdAt: string;
361
- approvedAt: string | null;
362
- approvedBy: string | null;
363
- approvedDigest: string | null;
364
- };
365
- export type ContestState = "dispatching" | "racing" | "pick-wait" | "decision-wait" | "picked" | "abandoned" | "interrupted" | "exhausted";
366
- export type Contest = {
367
- id: number;
368
- taskRef: number;
369
- terms: number;
370
- generation: number;
371
- state: ContestState;
372
- scopeDigest: string;
373
- raceDigest: string;
374
- baseSha: string | null;
375
- setupDigest: string | null;
376
- currentLeaseId: string | null;
377
- runner: string | null;
378
- incarnation: string | null;
379
- createdAt: string;
380
- pickedAt: string | null;
381
- pickedBy: string | null;
382
- winnerContestant: number | null;
383
- /** One escalation page per tournament, ever — set with the page. */
384
- overduePaged: boolean;
385
- /** v27: denormalized from the terms at admission. */
386
- kind: "race" | "comparison";
387
- };
388
- export type ContestantState = "pending" | "ready" | "building" | "parked" | "built" | "failed" | "stopped";
389
- export type Contestant = {
390
- /** v24: the contestant's own sealed execution profile. */
391
- profile?: ExecutionProfile | null;
392
- id: number;
393
- contest: number;
394
- ordinal: number;
395
- provider: string;
396
- model: string;
397
- repairModel: string;
398
- branch: string;
399
- worktree: string | null;
400
- generation: number;
401
- state: ContestantState;
402
- activeRun: number | null;
403
- budgetMicrousd: number;
404
- reserveMicrousd: number;
405
- /** What the provider reported — monotonic, never guessed. */
406
- measuredMicrousd: number;
407
- /** What the ledger charges — the full reservation when unknowable. */
408
- accountedMicrousd: number;
409
- unknownSpend: boolean;
410
- cleanup: "pending" | "done" | "attention" | null;
411
- custody: string | null;
412
- };
413
342
  export type ExecutionSlot = {
414
343
  id: number;
415
344
  runner: string;
416
345
  state: "reserved" | "running" | "released";
417
346
  run: number | null;
418
- contestant: number | null;
419
347
  incarnation: string | null;
420
348
  processGroup: number | null;
421
349
  reservedAt: string;
@@ -483,14 +411,6 @@ export type ChatSnapshot = {
483
411
  ageHours: number;
484
412
  }[];
485
413
  incidentsSaturated: boolean;
486
- routines: {
487
- repoIndex: number;
488
- name: string;
489
- schedule: string;
490
- status: string;
491
- lastFire: string | null;
492
- }[];
493
- routinesSaturated: boolean;
494
414
  publications: {
495
415
  repoIndex: number;
496
416
  pr: number | null;
@@ -884,76 +804,10 @@ export type MateTurn = {
884
804
  tokensOut: number | null;
885
805
  failureReason: string | null;
886
806
  };
887
- export type Routine = {
888
- id: number;
889
- name: string;
890
- /** v102: who made it (its instances are filed as theirs); null before v102 or when no person is known. */
891
- createdBy: string | null;
892
- repo: string;
893
- goal: string;
894
- outOfScope: string | null;
895
- touches: string[];
896
- /** v39: the signed rubric every instance's scope copies forward. */
897
- acceptance: AcceptanceCriterion[];
898
- requirements: string[];
899
- /** 'every:<minutes>', 'daily:<HH:MM>[@Zone]', or 'weekly:<0-6>:<HH:MM>[@Zone]' (UTC by default). */
900
- schedule: string;
901
- singleFlight: boolean;
902
- /** Rolling 7-day dollar ceiling; null = none. Enforcement fails closed. */
903
- costCeilingUsd: number | null;
904
- /** Per-instance dollar cap (v16); copied into each instance's scope. */
905
- budgetPerRunMicrousd: number | null;
906
- paused: boolean;
907
- /** Of every term above. Approval binds to this exact value. */
908
- digest: string;
909
- approvedAt: string | null;
910
- approvedBy: string | null;
911
- approvedDigest: string | null;
912
- /** The next scheduled occurrence; null until approved. */
913
- nextFireAt: string | null;
914
- /** Immutable filing provenance (v12); null on rows from before it existed. */
915
- filedVia: string | null;
916
- createdAt: string;
917
- updatedAt: string;
918
- /** v24: the working execution profile and the approval's sealed snapshot. */
919
- profile?: ExecutionProfile | null;
920
- approvedProfile?: ExecutionProfile | null;
921
- /** v48: the four-role agent route the digest binds, and the snapshot the
922
- * approval sealed. Null on a routine filed before routing froze — such a
923
- * routine cannot be approved or fired until it is filed again. A row
924
- * carrying unreadable route bytes reads null too, and fails closed. */
925
- route?: PhaseRoute | null;
926
- approvedRoute?: PhaseRoute | null;
927
- /** v48: true when the row CARRIES route or profile bytes that do not
928
- * read back — a corrupt snapshot, as distinct from one never taken. Every
929
- * surface says which, and both fail closed. */
930
- routeUnreadable?: boolean;
931
- approvedRouteUnreadable?: boolean;
932
- approvedProfileUnreadable?: boolean;
933
- /** THE RAW TERMS VERDICT (raw authority repair): null when every stored
934
- * term the digest binds read back EXACTLY — touches and requirements as
935
- * JSON lists of strings, the rubric as whole criteria with no unknown
936
- * key, the flags as 0/1, the ceilings as numbers or null — and the words
937
- * when one did not. The integrity projection reads it FIRST: a row whose
938
- * terms cannot be read exactly is not approved, not live, not approvable,
939
- * and not refreshable, so the lenient fields above can never become a
940
- * firing's authority. Undefined on a hand-built routine. */
941
- termsProblem?: string | null;
942
- };
943
- /** One scheduled slot's outcome, fired or skipped — never silent. */
944
- export type RoutineFire = {
945
- id: number;
946
- routineId: number;
947
- scheduledFor: string;
948
- outcome: "fired" | "skipped";
949
- reason: string | null;
950
- instanceTaskRef: number | null;
951
- createdAt: string;
952
- };
953
807
  /** Who placed a hold — and therefore who alone may lift it. */
954
808
  /** 'stop' (v52) = the pause one exact attempt's operator stop placed — lifted
955
809
  * only by resuming THAT attempt, never by `unhold` or by answering a decision. */
956
- export type HoldOwner = "operator" | "decision" | "incident" | "backoff" | "contest" | "revision" | "stop";
810
+ export type HoldOwner = "operator" | "decision" | "incident" | "backoff" | "revision" | "stop";
957
811
  export type Hold = {
958
812
  id: number;
959
813
  taskRef: number;
@@ -1116,8 +970,9 @@ export type RunnerWorkRecovery = {
1116
970
  requeued: string[];
1117
971
  };
1118
972
  /** How a stop's settlement was established (v52). `interrupted` = the
1119
- * owning worker sealed the attempt after its processes ended; `held` = the
1120
- * held-session supervisor fenced it; `recovered` = dead-incarnation
973
+ * owning worker sealed the attempt after its processes ended; `held`
974
+ * (v52-v114, history only) = the removed held-session supervisor fenced it;
975
+ * `recovered` = dead-incarnation
1121
976
  * recovery settled a run whose worker is proven gone; `finished` = the
1122
977
  * attempt reached another ending first (the stop was recorded, but the
1123
978
  * run's own outcome stands — the words say which). */
@@ -1218,11 +1073,9 @@ export type Run = {
1218
1073
  branch: string | null;
1219
1074
  worktree: string | null;
1220
1075
  model: string | null;
1221
- /** 'interrupted' (v25) = a held attended session cut down mid-flight. */
1076
+ /** 'interrupted' (v25–v114) = a held session cut down mid-flight; kept so old rows read. */
1222
1077
  outcome: "built" | "failed" | "refused" | "parked" | "no-change" | "interrupted" | null;
1223
1078
  reason: string | null;
1224
- /** The attended authorization this run consumed (v25); null = ordinary dispatch. */
1225
- attendedAuthorization?: string | null;
1226
1079
  committed: boolean | null;
1227
1080
  startedAt: string;
1228
1081
  finishedAt: string | null;
@@ -1238,24 +1091,12 @@ export type Run = {
1238
1091
  headRevision: string | null;
1239
1092
  /** The validated terminal handoff's conclusion. */
1240
1093
  handoff: string | null;
1241
- /** When racing: which tournament agent this run belongs to. */
1242
- contestant: number | null;
1243
1094
  /**
1244
1095
  * Where the machine is in ITS OWN state machine — stamped by the control
1245
1096
  * plane at boundaries it owns, never parsed from a provider stream (M5.4).
1246
1097
  * Meaningful while the run is open; the last value simply remains after.
1247
1098
  */
1248
1099
  phase: RunPhase | null;
1249
- /**
1250
- * The fallback-chain metadata (v30), NULL on every run outside a chain.
1251
- * `chainCycle`/`chainIndex`/`entryDigest` are stamped at admission (or at
1252
- * base-cycle open) and bind the run to exactly one entry of an immutable
1253
- * approved chain — the runtime re-derives authority from the snapshot,
1254
- * never from these, but reads them to know which entry ran.
1255
- */
1256
- chainCycle?: number | null;
1257
- chainIndex?: number | null;
1258
- entryDigest?: string | null;
1259
1100
  /**
1260
1101
  * How this attempt authenticated (v30) — 'subscription' or 'api-key' —
1261
1102
  * stamped by the gateway. Decides which exhaustion class a match yields.
@@ -1263,10 +1104,8 @@ export type Run = {
1263
1104
  authMode?: "subscription" | "api-key" | null;
1264
1105
  /**
1265
1106
  * The gateway's honest classification of how this attempt ENDED (v30),
1266
- * computed at disposal from the structural terminal + the authoritative
1267
- * version + auth mode (exhaustion.ts). Fail-closed: 'unknown' until a
1268
- * fixture-backed recognizer exists. NEVER an authority by itself — the
1269
- * dispatch's C8 gate re-checks hasRecognizer before any advance.
1107
+ * computed where the structural terminal still exists (exhaustion.ts).
1108
+ * `auth-expired` pauses its provider; every other class is a record.
1270
1109
  */
1271
1110
  terminalClass?: TerminalClass | null;
1272
1111
  /** v44 (adaptive execution plans): the exact plan revision this attempt's
@@ -1280,88 +1119,6 @@ export type Run = {
1280
1119
  /** The bounded activity vocabulary. Machine-authored — a model's prose never becomes one of these. */
1281
1120
  export declare const RUN_PHASES: readonly ["agent-running", "validating-handoff", "capturing-evidence", "committing", "verifying-proof", "correcting-proof"];
1282
1121
  export type RunPhase = (typeof RUN_PHASES)[number];
1283
- /**
1284
- * One person's signed authority for ONE watched attempt (ruling 12). The id
1285
- * is a pre-minted UUID — it IS the attempt identity the dispatch proof
1286
- * consumes. Consumed (attemptRun set) is NOT closed: the authorization
1287
- * stays active across its held session; closure is explicit and terminal.
1288
- */
1289
- export type AttendedAuthorization = {
1290
- id: string;
1291
- taskRef: number;
1292
- approver: string;
1293
- runner: string;
1294
- runnerGeneration: number;
1295
- compositeDigest: string;
1296
- termsJson: string;
1297
- maxSessionTurns: number;
1298
- /** A STOP THRESHOLD, not a ceiling: the agent halts when its total crosses it. */
1299
- budgetMicrousd: number;
1300
- /** Continuation: the finished parent attempt, also inside the signed terms. */
1301
- parentRun: number | null;
1302
- followup: string | null;
1303
- createdAt: string;
1304
- absoluteExpiry: string;
1305
- lastBeatAt: string | null;
1306
- attemptRun: number | null;
1307
- consumedAt: string | null;
1308
- closedAt: string | null;
1309
- endReason: string | null;
1310
- };
1311
- /**
1312
- * One stdin injection into a held session (ruling 15). Author is a verified
1313
- * operator name for 'operator' turns ONLY — brief and repair turns are
1314
- * machine-authored and say so with null. 'uncertain' is TERMINAL: written
1315
- * (or accepted) but never proven settled; charged at its reservation and
1316
- * NEVER reinjected.
1317
- */
1318
- export type SessionTurn = {
1319
- id: number;
1320
- run: number;
1321
- seq: number;
1322
- sourceKind: "brief" | "answer" | "operator" | "repair";
1323
- /** The decision id for 'answer' turns, the triggering decision for 'repair'. */
1324
- sourceId: number | null;
1325
- author: string | null;
1326
- text: string;
1327
- reservedMicrousd: number;
1328
- accountedMicrousd: number | null;
1329
- accountedAt: string | null;
1330
- recordedAt: string;
1331
- writtenAt: string | null;
1332
- acceptedAt: string | null;
1333
- settledAt: string | null;
1334
- /** Marginal delta from the held session's durable cumulative baseline. */
1335
- measuredMicrousd: number | null;
1336
- outputTokens: number | null;
1337
- state: "recorded" | "written" | "accepted" | "settled" | "uncertain" | "cancelled";
1338
- };
1339
- /**
1340
- * Durable crash custody for one held session (ruling 15). The orphan
1341
- * predicate is lease-based; 'fencing' is a helpable, leased state with
1342
- * deadline takeover. cumulativeMicrousd is the settlement baseline the
1343
- * provider's cumulative totals are diffed against.
1344
- */
1345
- export type HeldSession = {
1346
- run: number;
1347
- authorizationId: string;
1348
- runner: string;
1349
- leaseId: string;
1350
- upIncarnation: string;
1351
- cookie: string;
1352
- socketPath: string;
1353
- supervisorPid: number | null;
1354
- agentPgid: number | null;
1355
- cumulativeMicrousd: number;
1356
- cumulativeTokensOut: number;
1357
- state: "open" | "fencing";
1358
- fencer: string | null;
1359
- fencingDeadline: string | null;
1360
- startedAt: string;
1361
- endedAt: string | null;
1362
- endReason: string | null;
1363
- };
1364
- export type RecordTurnRefusal = "no-held-session" | "fenced" | "turn-cap" | "turn-open" | "budget-exhausted" | "decision-open" | "repair-exhausted" | "answer-delivered";
1365
1122
  /**
1366
1123
  * One operator steering note (arc 1, v22). Attached ≠ delivered: attachment
1367
1124
  * says which build the note rode toward; delivery settles only on the
@@ -1770,12 +1527,6 @@ export declare const DEFAULT_ACTOR = "operator";
1770
1527
  export declare class RunAdmissionRefused extends Error {
1771
1528
  constructor(message: string);
1772
1529
  }
1773
- /** A present fallback-chain row carries this many entries after the base
1774
- * (atomic authority closure) — the same bound `config set fallback`
1775
- * enforces at the CLI, held again at the store's read and write so a row
1776
- * outside it is a stated problem, never an empty chain. */
1777
- export declare const FALLBACK_ENTRIES_MIN = 1;
1778
- export declare const FALLBACK_ENTRIES_MAX = 3;
1779
1530
  /**
1780
1531
  * The subset of `node:sqlite` this module uses, named so the rest of the file
1781
1532
  * is not written against an `any` and so a test can substitute a handle.
@@ -2050,7 +1801,7 @@ export declare class Store {
2050
1801
  * rank any still-dispatchable task holds, computed and written in ONE
2051
1802
  * transaction (two racing "next" calls get distinct ranks; the later
2052
1803
  * ask wins). Scheduling only: it refuses anything not plainly queued —
2053
- * building, finished, failed, cancelled, or racing a tournament — and
1804
+ * building, finished, failed, or cancelled — and
2054
1805
  * never touches updated_at, which the board reads as the stall clock.
2055
1806
  */
2056
1807
  moveTaskNext(taskId: string, now: Date, mutation?: Mutation): {
@@ -2083,7 +1834,7 @@ export declare class Store {
2083
1834
  * One atomic queue move (queue-columns review, findings 3/9/13): the
2084
1835
  * revision CAS, every refusal, the assignment write, and the rerank of
2085
1836
  * BOTH affected columns are one transaction. The rerank member set is
2086
- * the FREE members only — anything live-claimed or racing a tournament
1837
+ * the FREE members only — anything live-claimed
2087
1838
  * keeps its rank untouched, so a drag can never rewrite work being
2088
1839
  * taken (a setup-failure release rejoins with the rank the operator
2089
1840
  * last gave it — intent, not a bug). Scheduling, never authority.
@@ -2228,8 +1979,7 @@ export declare class Store {
2228
1979
  * Establish a mirror: the ONE act that makes a local task stand for a
2229
1980
  * tracker item. Identity and provenance are immutable after this row
2230
1981
  * (trigger-enforced); labels and titles may nominate work, only this
2231
- * establishes whose it is. Refuses tasks carrying race terms or an open
2232
- * tournament (D1 — external work does not race in this release).
1982
+ * establishes whose it is.
2233
1983
  */
2234
1984
  establishMirror(mirror: {
2235
1985
  localTaskId: string;
@@ -2244,7 +1994,7 @@ export declare class Store {
2244
1994
  ok: true;
2245
1995
  } | {
2246
1996
  ok: false;
2247
- reason: "unknown-task" | "duplicate" | "racing";
1997
+ reason: "unknown-task" | "duplicate";
2248
1998
  };
2249
1999
  mirrorByTask(taskId: string): ExternalMirror | null;
2250
2000
  mirrorByRemote(backend: string, remoteRepo: string, remoteId: string): ExternalMirror | null;
@@ -2263,7 +2013,7 @@ export declare class Store {
2263
2013
  /**
2264
2014
  * The reopen act (v3 §7 + findings 18/30): an authenticated CAS that
2265
2015
  * requires the tracker to have been SEEN open again after the close,
2266
- * and the task to be clean — no live claim, no open tournament, no
2016
+ * and the task to be clean — no live claim, no
2267
2017
  * active hold, no open question, no unresolved incident. It reconciles
2268
2018
  * task state from any admitted state back to queued; the approved
2269
2019
  * scope is preserved (its digest never changed) — this act is the
@@ -2273,7 +2023,7 @@ export declare class Store {
2273
2023
  ok: true;
2274
2024
  } | {
2275
2025
  ok: false;
2276
- reason: "unknown-task" | "not-latched" | "not-seen-open" | "claimed" | "contest-open" | "held" | "question-open" | "incident-open" | "bad-state";
2026
+ reason: "unknown-task" | "not-latched" | "not-seen-open" | "claimed" | "held" | "question-open" | "incident-open" | "bad-state";
2277
2027
  };
2278
2028
  /** The last COMPLETE sync pass for a tracker, or null — freshness's anchor. */
2279
2029
  lastCompleteSync(backend: string, remoteRepo: string): {
@@ -2312,7 +2062,7 @@ export declare class Store {
2312
2062
  why: "stale-mirror" | "external-closed" | "dispatch-revoked" | "plane-blocked";
2313
2063
  }[];
2314
2064
  /** Whether a fresh completion may stand as done (v4 §24) — read INSIDE
2315
- * completeFenced's transaction. Non-mirrors always complete. */
2065
+ * finalize's complete-ending transaction. Non-mirrors always complete. */
2316
2066
  mirrorAllowsCompletion(taskId: string): boolean;
2317
2067
  /** Whether a stored acquire mutation exists — the replay marker's fact. */
2318
2068
  hasMutationRecord(mutation: Mutation): boolean;
@@ -2333,14 +2083,13 @@ export declare class Store {
2333
2083
  revokeGrant(repo: string, backend: string, mutation?: Mutation): boolean;
2334
2084
  saveScope(scope: Scope, mutation?: Mutation, options?: {
2335
2085
  profile?: ExecutionProfile;
2336
- /** v48: a FROZEN route — a routine firing's approved snapshot —
2086
+ /** v48: a FROZEN route — an approved standing order's snapshot —
2337
2087
  * filed verbatim instead of being recommended afresh from today's
2338
2088
  * configuration. Requires an explicit profile, and the two must
2339
2089
  * agree exactly (the same belt every other road wears). */
2340
2090
  route?: PhaseRoute;
2341
2091
  permissionMode?: UnattendedPermissionMode;
2342
2092
  qualityMode?: QualityMode;
2343
- riskLevel?: RiskLevel;
2344
2093
  posture?: "escalated";
2345
2094
  proposedVia?: "mate" | "coordinator" | "scout" | null;
2346
2095
  }): void;
@@ -2816,8 +2565,8 @@ export declare class Store {
2816
2565
  /**
2817
2566
  * The revocation that actually severs (D7), one transaction: the stamp
2818
2567
  * plus a generation bump (live console sessions die at their next
2819
- * lookup; bearer credentials die at authenticateAccount), their open
2820
- * attended authorizations close, their unconsumed invites die, every
2568
+ * lookup; bearer credentials die at authenticateAccount), their
2569
+ * unconsumed invites die, every
2821
2570
  * mode THEY signed is revoked with the typed 'signer-revoked' event —
2822
2571
  * demoting its derived merge authority through the one reconciliation
2823
2572
  * road — and the derived-authority sweep clears Telegram and push.
@@ -2830,7 +2579,7 @@ export declare class Store {
2830
2579
  * invites, modes and everything mode-derived (their sealed filings
2831
2580
  * demote through the reconciliation road), Telegram, push. Standing
2832
2581
  * acts they completed WITH full ceremony — publication/backend/intake
2833
- * grants, worktree setups, approved routines, approved scopes sealed by
2582
+ * grants, worktree setups, approved standing orders, approved scopes sealed by
2834
2583
  * password — deliberately survive: those are the instance's promises,
2835
2584
  * approved as themselves, and undoing history is not what revocation
2836
2585
  * means. An operator who distrusts those acts revokes them by their own
@@ -2839,18 +2588,11 @@ export declare class Store {
2839
2588
  revokeAccount(name: string, by: string, now: Date): {
2840
2589
  ok: true;
2841
2590
  modesRevoked: number;
2842
- authorizationsClosed: number;
2843
2591
  invitesRevoked: number;
2844
2592
  } | {
2845
2593
  ok: false;
2846
2594
  reason: "unknown" | "already-revoked" | "last-approver";
2847
2595
  };
2848
- /** One person's open attended sessions, for their People card. */
2849
- openAttendedOf(name: string): {
2850
- taskId: string;
2851
- createdAt: string;
2852
- lastBeatAt: string | null;
2853
- }[];
2854
2596
  /**
2855
2597
  * One person's recent consequential acts (U3), from the rows that were
2856
2598
  * ALREADY author-stamped — no new event kinds, just the ledger asked a
@@ -3166,321 +2908,6 @@ export declare class Store {
3166
2908
  * finds nothing to consume instead of minting a duplicate task.
3167
2909
  */
3168
2910
  consumeDiffComments(runId: number, ids: readonly number[], taskId: string): number;
3169
- /** The open cycle for a task, if one exists (the runtime's read). */
3170
- fallbackCycleFor(taskRef: number): FallbackCycle | null;
3171
- /** Open a fresh cycle at index 0 for a running base attempt. One live
3172
- * cycle per task — the SELECT-then-INSERT under BEGIN IMMEDIATE
3173
- * serializes writers, and the one_live_fallback_cycle_per_task partial
3174
- * unique index is the durable backstop (finding 5). A second refuses. */
3175
- openFallbackCycle(taskRef: number, chainDigest: string, tailRun: number | null, now: Date): {
3176
- ok: true;
3177
- id: number;
3178
- } | {
3179
- ok: false;
3180
- };
3181
- /**
3182
- * The task's IMMUTABLE approved chain — the runtime's single source of
3183
- * truth for chain length and per-entry authority (never mutable config).
3184
- * Returns the rehydrated entries when the approval sealed a chain and the
3185
- * snapshot still rehydrates strictly; null otherwise (a single-profile
3186
- * approval, or a snapshot that fails the strict rehydrator — fail closed,
3187
- * so a corrupt chain dispatches nothing).
3188
- */
3189
- approvedChainOf(taskId: string): ChainEntry[] | null;
3190
- /**
3191
- * The ONE chain-cycle resolver at a run's end (E3c/E3d): every concluded
3192
- * tail resolves its cycle — success closes it, an ordinary end closes it
3193
- * (the retry road runs the BASE entry under a FRESH cycle; a concluded
3194
- * tail can never be re-tagged, so leaving it open would only strand it),
3195
- * a parked tail is a PAUSED lineage and stays open for repair, and a
3196
- * recognized eligible exhaustion advances. Both the disposition hook and
3197
- * the crash reconciler call THIS method, so a crash between disposition
3198
- * and resolution re-derives the same answer from durable state.
3199
- *
3200
- * The advance is FAIL CLOSED at every gate:
3201
- * - an OPEN cycle whose tail is exactly this finished run;
3202
- * - the run genuinely finished (outcome + finished_at +
3203
- * provider_started_at, same task) — never live custody;
3204
- * - a fallback-ELIGIBLE class consistent with the run's auth mode;
3205
- * - the C8 re-check: THIS build recognizes the exact class/auth for the
3206
- * run's (provider, version) — a downgrade severs to incident;
3207
- * - the LIVE signed mode's paid-fallback grant, re-read IN-transaction;
3208
- * - a next entry in the IMMUTABLE approved chain (else exhausted-end).
3209
- * The fenced custody walk — sanitize, advance, release-to-pending — runs
3210
- * atomically inside ONE transaction; a lost inner CAS rolls the whole
3211
- * walk back. It NEVER dispatches: the admission pass creates the run.
3212
- */
3213
- resolveChainOnRunEnd(taskRef: number, taskId: string, repo: string | null, finishedRunId: number, now: Date): {
3214
- kind: "advanced";
3215
- toIndex: number;
3216
- } | {
3217
- kind: "exhausted-end";
3218
- } | {
3219
- kind: "closed";
3220
- reason: "succeeded" | "entry-ended";
3221
- } | {
3222
- kind: "blocked";
3223
- reason: "no-recognizer" | "grant-withheld" | "corrupt-chain" | "cycle-mismatch";
3224
- } | {
3225
- kind: "parked-tail";
3226
- } | {
3227
- kind: "no-cycle";
3228
- };
3229
- /**
3230
- * The crash reconciler's read (E3d, review finding 3): OPEN cycles whose
3231
- * tail run CONCLUDED (non-parked) but whose cycle was never resolved — the
3232
- * window a crash between disposition and resolveChainOnRunEnd leaves. The
3233
- * reconciler feeds each through the SAME resolver, so nothing is decided
3234
- * twice or differently.
3235
- */
3236
- strandedChainCycles(repo: string): {
3237
- cycleId: number;
3238
- taskRef: number;
3239
- taskId: string;
3240
- tailRun: number;
3241
- }[];
3242
- /**
3243
- * The chain reconciler in ONE callable piece (F+G review, finding 5): the
3244
- * EXACT code the tick runs each pass, so the fault tests drive the same
3245
- * road production does — deleting the tick's call would fail them.
3246
- * Resolves every open cycle whose tail concluded (non-parked) through the
3247
- * one resolver; returns how many it fed through.
3248
- */
3249
- reconcileStrandedChains(repo: string, now: Date): number;
3250
- /** Cycles awaiting their next entry's admission, for one repo — what the
3251
- * tick's chain admission pass walks. */
3252
- pendingChainAdmissions(repo: string): {
3253
- cycleId: number;
3254
- taskRef: number;
3255
- taskId: string;
3256
- cursor: number;
3257
- }[];
3258
- /**
3259
- * The PROVING admission (E3d): create the next entry's run from a
3260
- * pending-admission cycle, with EVERY authority re-derived inside one
3261
- * transaction — the approved chain must still stand and match the cycle's
3262
- * digest, the entry at the cursor must exist, the LIVE signed mode must
3263
- * still grant the paid fallback (revocation between advance and admission
3264
- * denies), and the exact unconsumed pending edge is consumed by the run
3265
- * it creates (admitFallback's single-use CAS). The caller carries only
3266
- * claim, worktree, and rail; nothing it asserts becomes authority.
3267
- */
3268
- admitNextChainEntry(cycleId: number, run: {
3269
- leaseId: string;
3270
- runner: string;
3271
- branch: string;
3272
- worktree: string;
3273
- recoveredFrom?: number;
3274
- }, now: Date): {
3275
- ok: true;
3276
- runId: number;
3277
- taskId: string;
3278
- provider: string;
3279
- model: string;
3280
- } | {
3281
- ok: false;
3282
- reason: "not-pending" | "stale-approval" | "grant-withheld" | "no-edge" | "raced" | "provider-unavailable";
3283
- detail?: string;
3284
- };
3285
- /**
3286
- * The PRE-SPAWN custody proof (Codex E3d review, finding 3): the LAST
3287
- * gate before a chain-bound run's provider process starts, coupled to the
3288
- * start stamp in ONE transaction so nothing can lapse between the proof
3289
- * and the money. Re-derives, from durable state only: the approved chain
3290
- * still stands (freshness + digest); the run's cycle is live and OPEN
3291
- * with THIS run as tail at THIS run's index; the entry digest and pinned
3292
- * auth mode still match; and — for any entry past the base — the LIVE
3293
- * signed mode still grants the paid fallback (a base entry is the
3294
- * ordinary approved work and needs no grant). Only when every fact stands
3295
- * is provider_started_at stamped (first-write, with the version when the
3296
- * gateway proved one). Returns false — and stamps NOTHING — otherwise.
3297
- */
3298
- proveChainCustodyForSpawn(runId: number, now: Date, providerVersion?: string): boolean;
3299
- /**
3300
- * open -> sanitizing (C7): a recognized ELIGIBLE exhaustion of the tail
3301
- * run begins the sanitizer. CAS proves exact state, generation, and tail
3302
- * run; a stale caller loses. Marks the cycle sanitizing so ordinary
3303
- * admission is blocked even if the claim later expires.
3304
- */
3305
- beginFallbackSanitize(cycleId: number, expectGeneration: number, tailRun: number, now: Date): boolean;
3306
- /**
3307
- * sanitizing -> awaiting-release (C2/C7): the durable one-step advance.
3308
- * ONE transaction: prove the cycle is sanitizing at this generation and
3309
- * cursor i with this tail run; insert the immutable transition (unique
3310
- * per (cycle, from_index)); advance the cursor to i+1; bump generation.
3311
- * The target index MUST be < chainLength (proven by the caller from the
3312
- * approved snapshot). Returns the new transition id, or null on a lost
3313
- * CAS or an already-recorded step.
3314
- */
3315
- advanceFallbackFenced(args: {
3316
- cycleId: number;
3317
- expectGeneration: number;
3318
- fromIndex: number;
3319
- chainLength: number;
3320
- predecessorRun: number;
3321
- terminalClass: string;
3322
- evidence: {
3323
- provider: string;
3324
- version: string | null;
3325
- authMode: string;
3326
- fp: string;
3327
- };
3328
- }, now: Date): {
3329
- ok: true;
3330
- transitionId: number;
3331
- toIndex: number;
3332
- } | {
3333
- ok: false;
3334
- reason: "raced" | "at-end" | "dup";
3335
- };
3336
- /** awaiting-release -> pending-admission (C7): the epoch-fenced custody
3337
- * release completed; the next entry is now admittable. */
3338
- releaseFallbackToPending(cycleId: number, expectGeneration: number, now: Date): boolean;
3339
- /**
3340
- * pending-admission -> open at the new index (C3): the SINGLE-USE
3341
- * admission. ONE transaction: prove pending at this generation, consume
3342
- * the transition (consumed_by set once — a replay finds it consumed and
3343
- * loses), and open the cycle at the new tail. Returns false on a lost
3344
- * CAS or an already-consumed transition.
3345
- */
3346
- /**
3347
- * THE FALLBACK ADMISSION (E3d; the ONE insert path for `fallback`
3348
- * provenance since the v48 integrity repair). Every run bound to a
3349
- * NON-primary entry of the approved chain — the entry's own admission
3350
- * from a pending edge, a parked tail's successor, a repair turn under
3351
- * the live tail — is created here and nowhere else; the generic
3352
- * admission refuses `fallback` outright.
3353
- *
3354
- * EVERYTHING the caller states is re-proved against durable state
3355
- * before any row exists, and one disagreement creates no run and
3356
- * consumes no edge: the cycle is the task's own and live; the approved
3357
- * chain still stands, is the cycle's, and its base entry is mirrored by
3358
- * the sealed profile exactly as the caller presents it; the cursor,
3359
- * the tail, the entry digest, the auth mode, the provider, the EXACT
3360
- * model (required, never defaulted), and the repair binding all equal
3361
- * the approved entry at the cursor; the presented stamp is `fallback`
3362
- * on exactly that entry for the phase this run spends as; and the
3363
- * kind-specific custody fact holds — an unconsumed pending edge at the
3364
- * cursor, a parked tail the cycle still names, or a live parent tail.
3365
- * The run is opened WITH its chain metadata (cycle, index, entry
3366
- * digest, auth mode) and its route in one body, so nothing downstream
3367
- * can substitute a foreign run.
3368
- */
3369
- admitFallback(args: {
3370
- run: {
3371
- taskRef: number;
3372
- leaseId: string;
3373
- runner: string;
3374
- branch: string;
3375
- worktree: string;
3376
- provider: string;
3377
- model: string;
3378
- sessionId?: string;
3379
- /** The interrupted attempt whose draft this entry or resume
3380
- * recovers (raw authority repair): proved this task's own run and
3381
- * written as the row's parent in this same insert — never stamped
3382
- * later. A repair turn's parent is its live tail; it recovers none. */
3383
- recoveredFrom?: number;
3384
- };
3385
- cycleId: number;
3386
- /** The cursor the caller understands the cycle to stand at — the
3387
- * entry index this run binds to. */
3388
- expectCursor: number;
3389
- /** The cycle's tail as the caller understands it: null for an entry
3390
- * admitted from a pending edge, the parked run for a resume, the
3391
- * live parent for a repair turn. */
3392
- expectTail: number | null;
3393
- entryDigest: string;
3394
- authMode: "subscription" | "api-key";
3395
- /** The entry's effective repair model as the caller understands it —
3396
- * `inherit` resolved to the build model — proved against the approved
3397
- * entry so a repair turn later spends as exactly what was approved. */
3398
- repairModel: string;
3399
- /** The approved authority as the caller holds it: the chain's digest
3400
- * and the FULL sealed-profile mirror (the chain's base entry). */
3401
- approved: {
3402
- chainDigest: string;
3403
- profile: ExecutionProfile;
3404
- };
3405
- /** The run's `fallback` route provenance, proved against the exact
3406
- * entry this admission binds (cursor + entry digest) BEFORE the row
3407
- * exists and written beside it. Required: nothing is dictated here. */
3408
- route: RouteStamp;
3409
- } & ({
3410
- kind: "entry";
3411
- expectGeneration: number;
3412
- transitionId: number;
3413
- } | {
3414
- kind: "resume";
3415
- parkedRun: number;
3416
- } | {
3417
- kind: "repair";
3418
- parentRun: number;
3419
- }), now: Date): {
3420
- ok: true;
3421
- runId: number;
3422
- } | {
3423
- ok: false;
3424
- reason: "refused" | "raced";
3425
- problem: string;
3426
- };
3427
- /**
3428
- * THE UNAVAILABLE-PRIMARY TRANSITION (v47): the approved chain's base
3429
- * entry runs a provider THIS runner has reported unavailable, so the
3430
- * task moves — before any claim, run, or spend — to the EXPLICITLY
3431
- * APPROVED next entry, and only that one: a fresh cycle opens at index 0
3432
- * with no tail and skips, one step, to pending-admission at index 1,
3433
- * citing the readiness observation as its evidence. The admission pass
3434
- * then re-proves everything (approved chain standing, live paid-fallback
3435
- * grant, the next entry's own readiness) before it runs. Every other
3436
- * case fails closed with the words: no approved chain, a live cycle
3437
- * already, a base that is not actually unavailable, no next entry, a
3438
- * next entry that is unavailable too, or no live grant — nothing
3439
- * substitutes outside the approved chain.
3440
- */
3441
- skipUnavailablePrimary(taskRef: number, taskId: string, repo: string | null, runner: string, now: Date): {
3442
- ok: true;
3443
- cycleId: number;
3444
- toIndex: number;
3445
- next: {
3446
- provider: string;
3447
- model: string;
3448
- };
3449
- } | {
3450
- ok: false;
3451
- reason: "no-chain" | "cycle-live" | "primary-available" | "at-end" | "next-unavailable" | "grant-withheld" | "raced";
3452
- detail: string;
3453
- };
3454
- /** open -> open at i+1 via a quota-skip (C7): index 0 (or any) already
3455
- * durably exhausted before dispatch is skipped, one step, recorded. */
3456
- quotaSkipFallback(args: {
3457
- cycleId: number;
3458
- expectGeneration: number;
3459
- fromIndex: number;
3460
- chainLength: number;
3461
- tailRun: number | null;
3462
- evidence?: {
3463
- provider: string;
3464
- fp: string;
3465
- };
3466
- }, now: Date): {
3467
- ok: true;
3468
- toIndex: number;
3469
- transitionId: number;
3470
- } | {
3471
- ok: false;
3472
- reason: "raced" | "at-end" | "dup";
3473
- };
3474
- /** Any nonterminal state -> incident (C8): a sanitizer failure, a
3475
- * severed grant, or a policy downgrade pages a human; never silent. */
3476
- /** Any nonterminal -> incident (C8): CAS on the exact generation so a
3477
- * STALE observer cannot terminate a cycle that has since advanced
3478
- * (Codex E1 review, finding 1). */
3479
- incidentFallback(cycleId: number, expectGeneration: number, reason: string, now: Date): boolean;
3480
- /** A cycle succeeds or exhausts its chain: closed, terminally — CAS on
3481
- * the exact generation (finding 1: a stale success observer cannot close
3482
- * after an advance + admit). */
3483
- closeFallbackCycle(cycleId: number, expectGeneration: number, reason: string, now: Date): boolean;
3484
2911
  /**
3485
2912
  * The bounded review-retry projection (v50): one source run's ROOT
3486
2913
  * reviewer attempts in ordinal order, its open request, and the ONE
@@ -3669,7 +3096,7 @@ export declare class Store {
3669
3096
  * exactly one wins; the loser refuses in words with zero rows.
3670
3097
  *
3671
3098
  * The child is filed UNAPPROVED, always: this method never stamps an
3672
- * approval, never mints an attended authorization, never touches a
3099
+ * approval, never touches a
3673
3100
  * publication or merge grant. Only the normal approval roads — the
3674
3101
  * password ceremony, or a live mode's own filing coverage re-proved by
3675
3102
  * the caller inside its own transaction — can approve the child.
@@ -3995,12 +3422,10 @@ export declare class Store {
3995
3422
  * default when the scope is filed. */
3996
3423
  qualityMode?: QualityMode;
3997
3424
  /** The revision road's inherited declarations (contract handoff task
3998
- * 2): the source's declared risk, the approver's per-phase route
3999
- * overrides, and its build/plan pins — stamped on the ref BEFORE the
3425
+ * 2): the approver's per-phase route overrides, and its build/plan pins — stamped on the ref BEFORE the
4000
3426
  * scope resolves, so the child's route is recommended over them
4001
3427
  * exactly as the source's was, never over the installation's
4002
3428
  * defaults of the day. */
4003
- riskLevel?: RiskLevel;
4004
3429
  /** How big the change is, sized at filing (v2 routing). */
4005
3430
  sizing?: TaskSizing;
4006
3431
  routeOverridesJson?: string | null;
@@ -4134,34 +3559,6 @@ export declare class Store {
4134
3559
  }[];
4135
3560
  /** Write one complete pair. Audited: who changed spend routing, and when. */
4136
3561
  setPhaseConfig(scope: string, phase: string, provider: string, model: string | null, by: string, now: Date): void;
4137
- /** The ordered FALLBACK entries after the base, for a scope's build
4138
- * phase (v30). Each entry: {provider, model, authMode, repairModel?}.
4139
- * Returns [] when none configured — a chain-of-one is the base alone. */
4140
- fallbackConfig(scope: string): {
4141
- provider: string;
4142
- model: string;
4143
- authMode: "subscription" | "api-key";
4144
- repairModel?: string;
4145
- }[];
4146
- /**
4147
- * The configured fallback entries, or the words for why the row on file
4148
- * cannot be read (v48): a row that EXISTS but is not a list of
4149
- * well-shaped entries — corrupt JSON, a non-list, an entry missing its
4150
- * provider, model, or auth mode — is a stated problem, never an empty
4151
- * list. Filing a scope under such a row refuses in these words rather
4152
- * than silently sealing a single-profile approval the operator did not
4153
- * configure; the chain the person believes they set never shrinks to
4154
- * nothing behind their back.
4155
- */
4156
- fallbackConfigProblem(scope: string): string | null;
4157
- private readFallbackConfig;
4158
- setFallbackConfig(scope: string, entries: {
4159
- provider: string;
4160
- model: string;
4161
- authMode: "subscription" | "api-key";
4162
- repairModel?: string;
4163
- }[], by: string, now: Date): void;
4164
- clearFallbackConfig(scope: string): boolean;
4165
3562
  clearPhaseConfig(scope: string, phase: string): boolean;
4166
3563
  /** The operator's named STRONG candidate for a phase at a scope, or null.
4167
3564
  * Read by the routing policy only — a phase_config row stays the routine
@@ -4209,7 +3606,7 @@ export declare class Store {
4209
3606
  * nothing. A signed routing input, read at filing. */
4210
3607
  publicationAuthorityOf(repo: string | null, now: Date): PublicationAuthority;
4211
3608
  /**
4212
- * THE ROUTE EDIT (v47): declare the task's risk, override one phase to an
3609
+ * THE ROUTE EDIT (v47): set the task's size, override one phase to an
4213
3610
  * exact agent, or clear an override — ONE authenticated transaction that
4214
3611
  * re-proves the editor's authority, CAS-checks the scope digest the
4215
3612
  * editor saw (a string to match, null = "I saw no scope", undefined =
@@ -4219,7 +3616,7 @@ export declare class Store {
4219
3616
  * is recomputed and the prior approval goes stale by digest, and — when
4220
3617
  * a drafted plan came from the old planner — asks for a real re-plan.
4221
3618
  * No claimant can observe a half-updated authority: it is all or
4222
- * nothing, and refused under a live claim or tournament terms.
3619
+ * nothing, and refused under a live claim.
4223
3620
  */
4224
3621
  editTaskRoute(taskRef: number, edit: {
4225
3622
  by: string;
@@ -4229,7 +3626,6 @@ export declare class Store {
4229
3626
  ok: false;
4230
3627
  reason: string;
4231
3628
  };
4232
- risk?: RiskLevel;
4233
3629
  /** v2: a person's size for the task — it outranks the classifier's. */
4234
3630
  size?: {
4235
3631
  size: TaskSize;
@@ -4258,7 +3654,7 @@ export declare class Store {
4258
3654
  overrides: RouteOverride[];
4259
3655
  } | {
4260
3656
  ok: false;
4261
- reason: "unauthenticated" | "no-task" | "live-claim" | "contest-open" | "changed" | "nothing" | "not-configured";
3657
+ reason: "unauthenticated" | "no-task" | "live-claim" | "changed" | "nothing" | "not-configured";
4262
3658
  detail: string;
4263
3659
  choices?: {
4264
3660
  provider: string;
@@ -4267,9 +3663,8 @@ export declare class Store {
4267
3663
  };
4268
3664
  /** Store a task's size (v2 routing); the next scope filing routes by it. */
4269
3665
  writeSizing(taskRef: number, sizing: TaskSizing): void;
4270
- /** Planning follows the size and risk while nothing has run: a small
4271
- * change at routine risk drops a plan that is only requested; a large or
4272
- * risky one, or any task at elevated or high risk, asks for a plan. A
3666
+ /** Planning follows the size while nothing has run: a small change drops
3667
+ * a plan that is only requested; a large or risky one asks for a plan. A
4273
3668
  * drafted plan is never discarded. */
4274
3669
  private planToSizing;
4275
3670
  /**
@@ -4314,11 +3709,9 @@ export declare class Store {
4314
3709
  * phase's exact leg. A planner may also run under the working
4315
3710
  * proposed route, or — with no scope yet — the live recommendation,
4316
3711
  * re-derived here from durable state. Nothing else.
4317
- * fallback — the task's approved chain: the digest is the sealed
4318
- * route's (or the chain's, when no route is sealed) and the pair is
4319
- * a NON-primary entry of that chain (its repair model for a repair).
4320
- * legacy — only a row proven to predate routing, a task with no scope,
4321
- * a tournament lane, or an attended session; never a routed row.
3712
+ * fallback — never (fallback chains were removed in v115).
3713
+ * legacy — only a row proven to predate routing or a task with no
3714
+ * scope; never a routed row.
4322
3715
  */
4323
3716
  private routeAdmissionProblem;
4324
3717
  /**
@@ -4357,41 +3750,6 @@ export declare class Store {
4357
3750
  approvedRouteOf(taskId: string): PhaseRoute | null;
4358
3751
  /** Pin a task's agent — the fire transaction's stamp; flags never override it. */
4359
3752
  pinTaskAgent(taskRef: number, provider: string, model: string | null): void;
4360
- /**
4361
- * File a standing order, unapproved. The digest is computed by the caller
4362
- * (routineDigestOf) from exactly the terms stored here; approval later
4363
- * binds to it. Nothing fires until a person agrees to the template.
4364
- */
4365
- createRoutine(spec: {
4366
- name: string;
4367
- repo: string;
4368
- goal: string;
4369
- outOfScope: string | null;
4370
- touches: string[];
4371
- acceptance: AcceptanceCriterion[];
4372
- requirements: string[];
4373
- schedule: string;
4374
- singleFlight: boolean;
4375
- costCeilingUsd: number | null;
4376
- budgetPerRunMicrousd?: number | null;
4377
- digest: string;
4378
- /** Immutable provenance (v12), same contract as createConsoleTask's. */
4379
- filedVia?: string;
4380
- /** v102: who made it; its instances are filed as theirs. */
4381
- createdBy?: string | null;
4382
- /** v24: resolved at filing by the caller who computed the digest —
4383
- * stored verbatim so digest and profile can never disagree. */
4384
- profile?: ExecutionProfile;
4385
- /** v48: the four-role route the digest binds, computed by the same
4386
- * caller from the same configuration — stored verbatim. */
4387
- route?: PhaseRoute;
4388
- }, now: Date): {
4389
- ok: true;
4390
- id: number;
4391
- } | {
4392
- ok: false;
4393
- reason: "duplicate";
4394
- };
4395
3753
  /**
4396
3754
  * Set-once installation markers (v12). INSERT OR IGNORE is the whole
4397
3755
  * contract: the first write wins forever, there is no update and no
@@ -4405,151 +3763,22 @@ export declare class Store {
4405
3763
  isDemo(): boolean;
4406
3764
  setSpendDefaults(defaults: {
4407
3765
  buildPerRunMicrousd: number | null;
4408
- racePerAgentMicrousd: number | null;
4409
- raceTotalMicrousd: number | null;
4410
- raceAgents?: number | null;
4411
3766
  }, by: string, now: Date): void;
4412
3767
  getSpendDefaults(): {
4413
3768
  buildPerRunMicrousd: number | null;
4414
- racePerAgentMicrousd: number | null;
4415
- raceTotalMicrousd: number | null;
4416
- raceAgents: number | null;
4417
3769
  updatedBy: string;
4418
3770
  } | null;
4419
- /**
4420
- * File a new terms row: the previous active row (if any) deactivates in
4421
- * the same transaction — rows are immutable, the ACTIVE pointer moves.
4422
- * Approval lands later, by the same ceremony that approves the scope.
4423
- */
4424
- /** Withdraw the standing race: the row survives deactivated, exactly as
4425
- * a superseding filing would leave it — the task returns to the ordinary
4426
- * one-agent path. */
4427
- retractTournamentTerms(taskRef: number): boolean;
4428
- fileTournamentTerms(spec: {
4429
- taskRef: number;
4430
- /** v27: absent = 'race' (every historical caller). */
4431
- kind?: "race" | "comparison";
4432
- raceDigest: string;
4433
- agents: {
4434
- provider: string;
4435
- model: string;
4436
- repairModel: string;
4437
- permissionMode?: UnattendedPermissionMode;
4438
- }[];
4439
- perAgentBudgetMicrousd: number;
4440
- overrunReserveMicrousd: number;
4441
- totalBudgetMicrousd: number;
4442
- priceVersion: number;
4443
- publicationPolicy: string;
4444
- }, now: Date): number;
4445
- activeTournamentTerms(taskRef: number): TournamentTerms | null;
4446
- /** Approval persistence only — the restating ceremony wires in later. */
4447
- approveTournamentTerms(id: number, by: string, sawDigest: string, now: Date): boolean;
4448
- createContest(spec: {
4449
- taskRef: number;
4450
- terms: number;
4451
- scopeDigest: string;
4452
- raceDigest: string;
4453
- kind?: "race" | "comparison";
4454
- }, now: Date): number;
4455
- getContest(id: number): Contest | null;
4456
- /** The one non-finished tournament for a task, when one exists. */
4457
- /** The newest tournament still owed to an operator — open states plus
4458
- * the two that end with nothing pickable and wait for a human verdict. */
4459
- contestNeedingOperator(taskRef: number): Contest | null;
4460
- openContestFor(taskRef: number): Contest | null;
4461
- /**
4462
- * Every state change is a compare-and-swap on (state, generation): the
4463
- * caller proves what it believes, the write bumps the generation, and
4464
- * whichever of aggregation, reaping, or crash recovery loses the race
4465
- * changes nothing (finding 17/27).
4466
- */
4467
- casContestState(id: number, from: readonly ContestState[], to: ContestState, expectedGeneration: number): boolean;
4468
- stampContestLease(id: number, leaseId: string, runner: string, incarnation: string | null): void;
4469
- stampContestDispatch(id: number, baseSha: string, setupDigest: string | null): void;
4470
- createContestants(contest: number, agents: {
4471
- provider: string;
4472
- model: string;
4473
- repairModel: string;
4474
- permissionMode?: UnattendedPermissionMode;
4475
- branch: string;
4476
- budgetMicrousd: number;
4477
- reserveMicrousd: number;
4478
- unknownSpend?: boolean;
4479
- }[]): number[];
4480
- /** The lane's CUMULATIVE wall clock across its whole lineage — main
4481
- * attempt, resumes, and repair children (Phase 3 slice B, Codex
4482
- * finding 1): three sealed clocks bound a comparison lane. */
4483
- contestantCumulativeMs(contestantId: number): number;
4484
- /** The lane's money and tokens across its WHOLE lineage — main attempt,
4485
- * resumes, and repair children (Codex slice-B finding 6): a lane's cell
4486
- * that reads only the newest run under-reports every park cycle. */
4487
- contestantSpendRollup(contestantId: number): {
4488
- costMicrousd: number;
4489
- tokensIn: number;
4490
- tokensOut: number;
4491
- measuredRuns: number;
4492
- totalRuns: number;
4493
- };
4494
- contestants(contest: number): Contestant[];
4495
- getContestant(id: number): Contestant | null;
4496
- casContestantState(id: number, from: readonly ContestantState[], to: ContestantState, expectedGeneration: number): boolean;
4497
- /**
4498
- * The exact authority a contest lane PRESENTS at admission (raw
4499
- * authority repair): its race-approved profile's digest as a `legacy`
4500
- * stamp, with the pair the lane spends as for the phase — the same
4501
- * facts `startRun` re-proves against the lane before the row exists.
4502
- * Null for no such lane.
4503
- */
4504
- laneAuthorityFor(contestantId: number, phase?: "build" | "repair"): RouteStamp | null;
4505
- releaseContestantRun(id: number, runId: number): void;
4506
- setContestantWorktree(id: number, worktree: string): void;
4507
- /** The lineage meter (finding 25 + round-2 finding on repairs): each
4508
- * finished invocation settles ONCE, and the agent's total is the SUM
4509
- * across its whole lineage — a park's spend and its resume's spend are
4510
- * both real money. Accounted tracks at least the measured total. */
4511
- recordContestantSpend(id: number, invocationMicrousd: number): void;
4512
- /** A started invocation that never reported: the ledger charges the FULL
4513
- * reservation — never the remaining amount — and says the real figure is
4514
- * unknown (finding 25). Idempotent; never lowers a larger accounting. */
4515
- latchContestantUnknownSpend(id: number): void;
4516
- setContestantCustody(id: number, custody: string | null): void;
4517
- /** The cleanup queue (stage 6): agents of DECIDED tournaments whose
4518
- * checkouts still sit outside the pool. Terminal contest states only —
4519
- * an undecided tournament's evidence is never touched. */
4520
- contestantsForCleanup(): Contestant[];
4521
- /** Exactly-once overdue escalation: the mark rides the page (stage 6). */
4522
- markContestOverduePaged(contestId: number): boolean;
4523
- /** The pick, stamped: who chose, when, and which agent won. */
4524
- setContestWinner(contestId: number, contestantId: number, approver: string, now: Date): void;
4525
- setContestantCleanup(id: number, cleanup: "pending" | "done" | "attention"): void;
4526
- contestsInStates(states: readonly ContestState[]): Contest[];
4527
3771
  /** The still-live claim behind a lease id, or null — recovery's question.
4528
3772
  * The clock is INJECTED like everywhere else; SQL wall-clock time would
4529
3773
  * silently disagree with every test's fixed timestamps. */
4530
3774
  liveClaimByLease(leaseId: string, now: Date): {
4531
3775
  leaseId: string;
4532
3776
  } | null;
4533
- /**
4534
- * Close a racing agent's question WITHOUT answering it (the exclude
4535
- * ceremony, round-3 finding 28): typed closure, never a fake option.
4536
- * The caller owns authentication and the contestant's stop.
4537
- */
4538
- excludeDecision(id: number, by: string, now: Date): boolean;
4539
- /** A racing agent's answered-but-undelivered question, for the resume pass. */
4540
- answeredDecisionForContestant(contestantId: number): number | null;
4541
- /** A racing agent's one open (or expired-but-unanswered) question. */
4542
- openDecisionForContestant(contestantId: number): number | null;
4543
- /** Admission binds each reserved slot to its agent, so recovery can
4544
- * find and free every one of them (nothing reserved is ever orphaned). */
4545
- assignSlotContestant(slotId: number, contestantId: number): void;
4546
- releaseSlotsForContest(contestId: number, now: Date): number;
4547
3777
  reserveExecutionSlots(runner: string, count: number, now: Date): number[];
4548
3778
  /** reserved → running happens in the stamp-before-spawn moment, carrying
4549
3779
  * the process group so recovery can ask the OS before freeing capacity. */
4550
3780
  markSlotRunning(id: number, facts: {
4551
3781
  run: number;
4552
- contestant?: number | null;
4553
3782
  incarnation?: string | null;
4554
3783
  processGroup?: number | null;
4555
3784
  }, now: Date): boolean;
@@ -4557,7 +3786,6 @@ export declare class Store {
4557
3786
  * root attempt. It may refresh only that attempt's exact occupied slot. */
4558
3787
  refreshSlotProcess(id: number, facts: {
4559
3788
  run: number;
4560
- contestant?: number | null;
4561
3789
  incarnation?: string | null;
4562
3790
  processGroup: number;
4563
3791
  }): boolean;
@@ -4692,7 +3920,7 @@ export declare class Store {
4692
3920
  title: string;
4693
3921
  repo: string | null;
4694
3922
  }[];
4695
- /** Whether any work was ever filed — task or routine. */
3923
+ /** Whether any work was ever filed. */
4696
3924
  hasAnyWork(): boolean;
4697
3925
  /** Which door filed a task; null for history from before v12. */
4698
3926
  /** The coordinator provenance label for a task — `mcp:<name>#<cid4>` —
@@ -4704,137 +3932,6 @@ export declare class Store {
4704
3932
  filedAt: string | null;
4705
3933
  } | null;
4706
3934
  filedViaOf(taskId: string): string | null;
4707
- getRoutine(id: number): Routine | null;
4708
- routineByName(name: string): Routine | null;
4709
- /** Every routine one view may see. NULL repo filter means "no filter". */
4710
- listRoutines(repo: string | null, admitted?: string[] | null): Routine[];
4711
- /**
4712
- * Rewrite a template's terms. The new digest rides along, and the old
4713
- * approval is kept — invalidated by the mismatch, exactly like a scope
4714
- * edit, so the refusal can say "approved, then edited" rather than
4715
- * "never approved". The firing transaction re-proves the match.
4716
- */
4717
- updateRoutineTerms(id: number, terms: {
4718
- goal: string;
4719
- outOfScope: string | null;
4720
- touches: string[];
4721
- /** v39: absent leaves the stored rubric untouched (a caller editing
4722
- * goal/touches without an opinion on acceptance); present REPLACES
4723
- * it — never merged, so the digest the caller computed from these
4724
- * exact terms is what ends up stored. */
4725
- acceptance?: AcceptanceCriterion[];
4726
- requirements: string[];
4727
- schedule: string;
4728
- costCeilingUsd: number | null;
4729
- digest: string;
4730
- /** v24: restatement carries the profile its digest binds. */
4731
- profile?: ExecutionProfile | null;
4732
- /** v48: restatement carries the route its digest binds; absent or
4733
- * null leaves the stored route untouched. */
4734
- route?: PhaseRoute | null;
4735
- }, now: Date): boolean;
4736
- /**
4737
- * The approval stamp, raw. Callers own the ceremony — credential,
4738
- * digest re-read, and the transaction — in approveRoutine (routine.ts).
4739
- */
4740
- stampRoutineApproval(id: number, by: string, digest: string, nextFireAt: string, now: Date): void;
4741
- /**
4742
- * WITHDRAW an approval that no longer verifies (v48 authority repair): the refresh road
4743
- * clears the approval's authority — its digest, its frozen snapshot, the
4744
- * armed schedule — so a corrupt or never-taken snapshot cannot keep
4745
- * reading as approved while the working agents happen to be unchanged.
4746
- * `approved_at`/`approved_by` stay as history: the page reads "approved,
4747
- * then refreshed — approve again", never "never approved".
4748
- */
4749
- withdrawRoutineApproval(id: number, now: Date): boolean;
4750
- /** Pausing is instant and needs no ceremony; resuming re-arms the schedule. */
4751
- setRoutinePaused(id: number, paused: boolean, now: Date): boolean;
4752
- /**
4753
- * Routines a pass should try to fire: approved (digest intact), unpaused,
4754
- * due, and placed in this pass's repository. Each candidate is re-proved
4755
- * inside fireRoutine's own transaction — this list only nominates.
4756
- */
4757
- dueRoutines(repo: string, now: Date): Routine[];
4758
- /** The last firings, newest first — the board's run-history strip. */
4759
- routineFires(routineId: number, limit?: number): (RoutineFire & {
4760
- instanceTaskId: string | null;
4761
- instanceState: string | null;
4762
- })[];
4763
- /**
4764
- * What one routine's instances actually cost in a window, and whether any
4765
- * paid run in it is unmeasured. NULL costs are counted, not summed over:
4766
- * a sum that silently omits them reads as headroom that may not exist
4767
- * (finding 5 — the arithmetic behind failing closed).
4768
- */
4769
- routineSpend(routineId: number, sinceIso: string): {
4770
- costUsd: number;
4771
- unmeasuredRuns: number;
4772
- totalRuns: number;
4773
- };
4774
- /**
4775
- * The single-flight question: the oldest instance not successfully
4776
- * completed nor explicitly abandoned — queued, running, held, parked,
4777
- * and failed instances all block (finding 9's definition, verbatim).
4778
- * A LIVE CLAIM blocks regardless of task state (Codex Phase C review,
4779
- * H2): a state string written over a running build — `task state <id>
4780
- * done` bypassing the guarded cancel — must not conjure a twin beside
4781
- * a provider that is still spending.
4782
- */
4783
- routineBlocker(routineId: number, now: Date): {
4784
- taskId: string;
4785
- state: string;
4786
- } | null;
4787
- /**
4788
- * Whether a slot is still unrecorded. Only sound inside the fire
4789
- * transaction — the IMMEDIATE lock is what makes read-then-insert atomic.
4790
- */
4791
- routineSlotOpen(routineId: number, scheduledFor: string): boolean;
4792
- /** Record one slot's outcome. False: the slot was already recorded — the caller lost the race. */
4793
- recordRoutineFire(fire: {
4794
- routineId: number;
4795
- scheduledFor: string;
4796
- outcome: "fired" | "skipped";
4797
- reason: string | null;
4798
- instanceTaskRef: number | null;
4799
- }, now: Date): boolean;
4800
- /** Advance the schedule. The fire transaction is the only caller. */
4801
- setRoutineNextFire(id: number, nextFireAt: string, now: Date): void;
4802
- /** Stamp which routine a task is an instance of. Set at spawn, never after. */
4803
- linkRoutineInstance(taskRef: number, routineId: number): void;
4804
- /**
4805
- * Page a blocked track once per EPISODE: an open episode under this
4806
- * prefix already nags, so nothing enqueues; a resolved one is history,
4807
- * and the fresh suffix keys a new row past the dedupe uniqueness — a
4808
- * recurrence after recovery pages again (Codex Phase C review, L1).
4809
- * Prefix matching is exact-bytes (substr), never LIKE — task ids may
4810
- * contain `_`, which LIKE would read as a wildcard.
4811
- */
4812
- enqueueRoutineEpisode(prefix: string, notification: Omit<NotificationInput, "dedupeKey">, suffix: string, now: Date): boolean;
4813
- /**
4814
- * Close every blocked-track episode for a routine — called when a firing
4815
- * succeeds, because success is the proof the blocker is gone (budget
4816
- * cleared, blocking instance finished). Receipts stay; only the "wants a
4817
- * person" bit resolves.
4818
- */
4819
- resolveRoutineEpisodes(routineId: number, now: Date): void;
4820
- /**
4821
- * Everything the board's track rows need, in one snapshot: each routine
4822
- * with its recent firings, its rolling-window spend, and the instance
4823
- * blocking it, if any. The caller applies the ceiling row by row.
4824
- */
4825
- routineTracks(repo: string | null, now: Date, admitted?: string[] | null): {
4826
- routine: Routine;
4827
- fires: ReturnType<Store["routineFires"]>;
4828
- spend: {
4829
- costUsd: number;
4830
- unmeasuredRuns: number;
4831
- totalRuns: number;
4832
- };
4833
- blocker: {
4834
- taskId: string;
4835
- state: string;
4836
- } | null;
4837
- }[];
4838
3935
  /** The latest saved line for one approved check. Corrupt rows stay absent. */
4839
3936
  checkProgress(run: number): CheckProgress | null;
4840
3937
  /**
@@ -4867,8 +3964,8 @@ export declare class Store {
4867
3964
  * not failed. Failures, refusals, parks, plans and reports already page
4868
3965
  * through their own producers (build-failed, stalled, commit-failure,
4869
3966
  * malformed-*, plan-ready, report-ready, fenced, external-closed) and are
4870
- * not repeated here. Contest lanes and repair/correction children are the
4871
- * attempt's own and say nothing on their own.
3967
+ * not repeated here. Repair/correction children are the attempt's own
3968
+ * and say nothing on their own.
4872
3969
  */
4873
3970
  private noteRunEnding;
4874
3971
  /** True if this is a new fact; false if the episode already knows.
@@ -4908,13 +4005,12 @@ export declare class Store {
4908
4005
  * mid-flight, visible the next morning instead of vanished.
4909
4006
  *
4910
4007
  * THE GENERIC ADMISSION (atomic authority closure) opens exactly four
4911
- * shapes: an ordinary builder (no parent, no lane, no open attended
4912
- * authorization on its task), a planner (optionally continuing its own
4008
+ * shapes: an ordinary builder (no parent, no lane), a planner (optionally continuing its own
4913
4009
  * same-task planner run), a scout, and a ROOT reviewer answering an open
4914
4010
  * review request. Every other shape has its own admission that proves
4915
4011
  * and consumes or binds its exact authority in one transaction —
4916
- * `admitRepair`, `admitAttended`, `admitCorrection`, `admitContestLane`,
4917
- * `admitRecoveredBuilder`, `admitFallback` — and this road refuses it in
4012
+ * `admitRepair`, `admitCorrection`,
4013
+ * `admitRecoveredBuilder` — and this road refuses it in
4918
4014
  * words before any row exists. Every run PRESENTS its route authority: a
4919
4015
  * task with no scope presents the bare word `legacy` for the exact pair
4920
4016
  * it spends as; nothing opens unstamped anywhere.
@@ -4935,20 +4031,6 @@ export declare class Store {
4935
4031
  * a caller can spread the authority it resolved; absent at runtime
4936
4032
  * it refuses in words. */
4937
4033
  route?: RouteStamp;
4938
- /** v48 authority repair: how this run takes fallback-chain custody, proved and
4939
- * persisted in this same insert — `base` opens the task's cycle at
4940
- * the approved chain's first entry (inert without a chain approval),
4941
- * `resume` takes a parked BASE tail's custody through the proven
4942
- * transfer. A binding that cannot be proved rolls the insert back.
4943
- * Builder-only: no other role takes custody. Every run bound to a
4944
- * NON-primary entry — the entry's own admission, a parked tail's
4945
- * successor, a repair turn — is admitted by admitFallback alone. */
4946
- custody?: {
4947
- kind: "base";
4948
- } | {
4949
- kind: "resume";
4950
- parkedRun: number;
4951
- };
4952
4034
  now: Date;
4953
4035
  } & ({
4954
4036
  role?: "builder" | "planner" | "scout";
@@ -4976,12 +4058,7 @@ export declare class Store {
4976
4058
  * this task's, is a builder, is still open, and this turn runs under
4977
4059
  * the parent's own runner and lease — which must be the task's CURRENT
4978
4060
  * live claim, on the runner that claim names (repair custody closure:
4979
- * the same tuple invariant every fallback admission proves). An
4980
- * attended parent's authorization
4981
- * must have spent its one attempt on that parent; a racing lane's
4982
- * parent must be the lane's live run; a chain-bound parent must be the
4983
- * live base tail (a fallback entry's repair is admitFallback's). The
4984
- * stamp is the repair leg of the authority the parent spent under.
4061
+ * the exact claim tuple). The stamp is the repair leg of the authority the parent spent under.
4985
4062
  * Value-shaped: a refusal names its reason and leaves zero rows.
4986
4063
  */
4987
4064
  admitRepair(run: {
@@ -5003,41 +4080,6 @@ export declare class Store {
5003
4080
  ok: false;
5004
4081
  problem: string;
5005
4082
  };
5006
- /**
5007
- * THE ATTENDED ADMISSION (atomic authority closure): one watched attempt
5008
- * opens under exactly ONE live authorization the caller names — open on
5009
- * this task, unexpired, unspent, minted for this runner at this
5010
- * generation, pinning a readable profile the stamp restates as its
5011
- * legacy authority; a continuation names the finished parent the
5012
- * authorization continues, nothing else names a parent. The insert
5013
- * binds the row to the authorization and CONSUMES its one attempt in
5014
- * the same transaction: `run.attended_authorization` and
5015
- * `authorization.attempt_run` move together or not at all.
5016
- */
5017
- admitAttended(run: {
5018
- taskRef: number;
5019
- leaseId: string;
5020
- runner: string;
5021
- branch: string;
5022
- worktree: string;
5023
- provider: string;
5024
- model?: string;
5025
- sessionId?: string;
5026
- parentRun?: number;
5027
- authorization: {
5028
- id: string;
5029
- runner: string;
5030
- generation: number;
5031
- };
5032
- route: RouteStamp;
5033
- now: Date;
5034
- }): {
5035
- ok: true;
5036
- runId: number;
5037
- } | {
5038
- ok: false;
5039
- problem: string;
5040
- };
5041
4083
  /**
5042
4084
  * THE CORRECTION ADMISSION (atomic authority closure): a reviewer
5043
4085
  * correction continues a LIVE root review in the SAME session — the
@@ -5064,37 +4106,6 @@ export declare class Store {
5064
4106
  ok: false;
5065
4107
  problem: string;
5066
4108
  };
5067
- /**
5068
- * THE CONTEST LANE ADMISSION (atomic authority closure): a racing agent's
5069
- * run opens on ITS lane, in a contest still dispatching or racing, under
5070
- * the contest's live custody — the caller's lease, runner, and watch
5071
- * incarnation are exactly the ones the contest was stamped with — and it
5072
- * presents the lane's STORED sealed profile as its legacy authority: no
5073
- * synthesized profile, no other digest. The lane's pointer moves to the
5074
- * row inside the insert (from free, or from the parked attempt this run
5075
- * resumes); a lane that moved rolls the row back.
5076
- */
5077
- admitContestLane(run: {
5078
- taskRef: number;
5079
- leaseId: string;
5080
- runner: string;
5081
- incarnation: string | null;
5082
- branch: string;
5083
- worktree: string;
5084
- provider: string;
5085
- model?: string;
5086
- sessionId?: string;
5087
- contestant: number;
5088
- parentRun?: number;
5089
- route: RouteStamp;
5090
- now: Date;
5091
- }): {
5092
- ok: true;
5093
- runId: number;
5094
- } | {
5095
- ok: false;
5096
- problem: string;
5097
- };
5098
4109
  /**
5099
4110
  * THE RECOVERED-DRAFT ADMISSION (atomic authority closure): a fresh
5100
4111
  * builder attempt that inherits an INTERRUPTED attempt's draft names it
@@ -5114,12 +4125,6 @@ export declare class Store {
5114
4125
  model?: string;
5115
4126
  sessionId?: string;
5116
4127
  recoveredFrom: number;
5117
- custody?: {
5118
- kind: "base";
5119
- } | {
5120
- kind: "resume";
5121
- parkedRun: number;
5122
- };
5123
4128
  route: RouteStamp;
5124
4129
  now: Date;
5125
4130
  }): {
@@ -5134,22 +4139,17 @@ export declare class Store {
5134
4139
  private admission;
5135
4140
  private admitRun;
5136
4141
  /**
5137
- * THE CURRENT CLAIM, exactly (final admission closure): every admission
5138
- * that changes fallback state — the base that opens a cycle, an entry
5139
- * admitted from a pending edge, a parked tail's resume, a repair turn
5140
- * under the live tail — proves in its own transaction that the run it
5141
- * opens is the task's, under the lease that holds the task RIGHT NOW,
5142
- * on the runner that claim names. A lease nobody holds, one released,
5143
- * expired, or superseded by a newer generation, or a claim another
5144
- * machine holds admits nothing: the words say which, and no cycle,
5145
- * edge, tail, or claim moves. Shared by the fallback road, the primary
5146
- * repair road, and the generic road's custody so all refuse in the
5147
- * same words.
4142
+ * THE CURRENT CLAIM, exactly (final admission closure): a repair turn
4143
+ * proves in its own transaction that the run it opens is the task's,
4144
+ * under the lease that holds the task RIGHT NOW, on the runner that
4145
+ * claim names. A lease nobody holds, one released, expired, or
4146
+ * superseded by a newer generation, or a claim another machine holds
4147
+ * admits nothing: the words say which.
5148
4148
  */
5149
4149
  private custodyClaimProblem;
5150
4150
  /**
5151
4151
  * THE ONE RECOVERY GRANT (final authority closure), shared by the
5152
- * recovered-draft admission and the fallback admission's `recoveredFrom`:
4152
+ * recovered-draft admission's `recoveredFrom`:
5153
4153
  * the interrupted attempt whose draft a fresh run inherits is THIS
5154
4154
  * task's own builder or repair turn, left in this very worktree on this
5155
4155
  * branch, either ended as `failed` for `interrupted` (or `no-handoff`) or still open under
@@ -5159,25 +4159,15 @@ export declare class Store {
5159
4159
  * say which, and the caller opens nothing.
5160
4160
  */
5161
4161
  private recoveryGrantProblem;
5162
- /**
5163
- * Whether `holder` is the LIVE tail of its task's open fallback cycle
5164
- * under the approved chain — the words when it is not (v48 integrity).
5165
- * Re-derived from durable state only: the task's one live cycle is the
5166
- * holder's cycle, open, its cursor at the holder's index, the holder as
5167
- * its tail, its digest the approved chain's, and the approved entry at
5168
- * that index carrying exactly the holder's digest and auth mode.
5169
- */
5170
- private liveTailProblem;
5171
4162
  /**
5172
4163
  * THE WORKING PLAN AUTHORITY (final authority closure): the route a
5173
4164
  * planner runs under before any approval, believed only as the ONE strict
5174
4165
  * stored-scope projection proves it — exact raw terms (a proposed-via
5175
4166
  * marker this code never writes is a terms problem), a resolved profile,
5176
- * a whole fallback chain (an empty or malformed one is no chain), a
5177
- * readable route whose build and repair legs are the profile's exact
4167
+ * a readable route whose build and repair legs are the profile's exact
5178
4168
  * pairs and whose signed risk and quality are the row's, the digest
5179
4169
  * re-derived from those very values, the operator's live auth mode read
5180
- * strictly and agreeing with a chain's pinned base mode, and no leg
4170
+ * strictly, and no leg
5181
4171
  * stating a problem. The claim, the admission, and the invocation all
5182
4172
  * ask this same question; one disagreement is the words, and nothing
5183
4173
  * opens or spawns on it. A sealed route is not this road's business —
@@ -5208,8 +4198,7 @@ export declare class Store {
5208
4198
  * The exact route authority a task holds for one run, in the caller's
5209
4199
  * hands (v48 authority repair): the sealed route's leg for the run's phase when the
5210
4200
  * approval stands; the working proposed route's plan leg for a planner
5211
- * before any approval; for a run bound to a NON-primary chain entry, that
5212
- * entry's `fallback` provenance for its phase. The store never applies
4201
+ * before any approval. The store never applies
5213
4202
  * this on a caller's behalf — `startRun` requires the caller to PRESENT
5214
4203
  * it and proves the presented stamp against the same durable state, so
5215
4204
  * a caller that holds no authority opens nothing. Null when the task is
@@ -5217,10 +4206,7 @@ export declare class Store {
5217
4206
  * scope — those roads stamp when they spend); the words when the task
5218
4207
  * is routed and nothing could govern the run.
5219
4208
  */
5220
- routeAuthorityFor(taskRef: number, role: Run["role"] | "scout", bound?: {
5221
- index: number;
5222
- entryDigest: string;
5223
- } | null,
4209
+ routeAuthorityFor(taskRef: number, role: Run["role"] | "scout",
5224
4210
  /** What the run would spend as, for the roads no profile governs: the
5225
4211
  * bare word `legacy` on a task with no scope, and the plan/review
5226
4212
  * pair of a pre-routing row (its profile names only build and
@@ -5300,8 +4286,7 @@ export declare class Store {
5300
4286
  committed?: boolean;
5301
4287
  now: Date;
5302
4288
  /** v52: how this ending settles a pending operator stop on the run,
5303
- * when one stands. The fenced interruption seal and the held fence
5304
- * name their own word; every other road settles it as `finished` —
4289
+ * when one stands. The fenced interruption seal names its own word; every other road settles it as `finished` —
5305
4290
  * the attempt reached this ending first, and its outcome stands. */
5306
4291
  stopSettlement?: StopSettlement;
5307
4292
  }): void;
@@ -5322,15 +4307,12 @@ export declare class Store {
5322
4307
  */
5323
4308
  stampProviderStart(id: number, now: Date, providerVersion?: string): void;
5324
4309
  /**
5325
- * The gateway's honest disposal record for the fallback taxonomy (E2):
5326
- * how this attempt authenticated, and the class its terminal fell into.
5327
- * Recorded where the evidence still exists — the gateway holds the
5328
- * structural terminal, the authoritative version, and the auth mode — and
5329
- * NEVER re-derived in disposal, by which time the structural signal is
5330
- * gone. Purely observational: the class is stamped on EVERY finished
5331
- * attempt (usually 'unknown'/'not-exhausted', since the recognizers ship
5332
- * empty), and it authorizes NOTHING on its own — the dispatch's C8 gate
5333
- * re-proves hasRecognizer before any advance ever reads it.
4310
+ * The gateway's honest disposal record (E2): how this attempt
4311
+ * authenticated, and the class its terminal fell into. Recorded where the
4312
+ * evidence still exists — the gateway holds the structural terminal and
4313
+ * the auth mode — and NEVER re-derived in disposal, by which time the
4314
+ * structural signal is gone. `auth-expired` pauses its provider; every
4315
+ * other class is observational.
5334
4316
  */
5335
4317
  stampTerminalClass(id: number, authMode: "subscription" | "api-key", terminalClass: TerminalClass): void;
5336
4318
  /** The race-refusal stamp (Phase 3 C5): the version that was REFUSED,
@@ -5376,14 +4358,12 @@ export declare class Store {
5376
4358
  setOrgPolicy(policy: OrgPolicy, by: string, now: Date): SavedPolicy;
5377
4359
  /** The policy's changes, newest first, from the action ledger. */
5378
4360
  policyHistory(limit?: number): LedgerEntry[];
5379
- /** Why the policy stops a task's approved terms (its profile, every fallback entry, every routed leg), or null. */
4361
+ /** Why the policy stops a task's approved terms (its profile, every routed leg), or null. */
5380
4362
  scopePolicyRefusal(taskId: string): string | null;
5381
4363
  /** Why the policy stops an agent on a provider and model now, or null (chats, teammates, flow steps). */
5382
4364
  agentPolicyRefusal(provider: string, model: string | null): string | null;
5383
4365
  /** Why the policy stops a planner, scout or native coding session (no profile to lower) on a provider and model, or null. */
5384
4366
  sessionPolicyRefusal(provider: string, model: string | null, what: string): string | null;
5385
- /** Why the policy stops an attended session's signed profile, or null (it is never lowered: see policy.attendedRefusal). */
5386
- attendedPolicyRefusal(profile: ExecutionProfile): string | null;
5387
4367
  /** The policy's word on a profile about to run: refused, or what runs (lowered under the ceiling, with words). */
5388
4368
  runPolicy(profile: ExecutionProfile): ReturnType<typeof underCeiling>;
5389
4369
  /** The budgets in force. */
@@ -5539,8 +4519,6 @@ export declare class Store {
5539
4519
  recommendation: string;
5540
4520
  assignee?: string;
5541
4521
  deadline?: string;
5542
- /** Which racing agent asked (v14); absent = ordinary. */
5543
- contestant?: number;
5544
4522
  }, now: Date): number;
5545
4523
  getDecision(id: number): Decision | null;
5546
4524
  decisionForRun(run: number): Decision | null;
@@ -5678,223 +4656,21 @@ export declare class Store {
5678
4656
  attachAnswers(runId: number, taskRef: number): (Decision & {
5679
4657
  taskId: string;
5680
4658
  })[];
5681
- /**
5682
- * Mint one attended authorization. Expired predecessors are closed in the
5683
- * SAME transaction (end reason 'expired'); a live one refuses — revoke
5684
- * first, never silently supersede a signature.
5685
- */
5686
- mintAttendedAuthorization(input: {
5687
- id: string;
5688
- taskRef: number;
5689
- approver: string;
5690
- runner: string;
5691
- runnerGeneration: number;
5692
- compositeDigest: string;
5693
- termsJson: string;
5694
- maxSessionTurns: number;
5695
- budgetMicrousd: number;
5696
- parentRun?: number | null;
5697
- followup?: string | null;
5698
- absoluteExpiry: string;
5699
- /** Quick mint (C2/M4): the mode signature substitutes for the
5700
- * per-mint password — RE-PROVED here, in the mint transaction
5701
- * itself, never a pre-checked flag: the mode must be live, its
5702
- * digest exact, and the minting approver must BE the signer. */
5703
- basis?: {
5704
- kind: "mode";
5705
- digest: string;
5706
- };
5707
- now: Date;
5708
- }, mutation?: Mutation): {
5709
- ok: true;
5710
- authorization: AttendedAuthorization;
5711
- } | {
5712
- ok: false;
5713
- reason: "authorization-open" | "mode-ended" | "approval-rules";
5714
- };
5715
- /** Close every authorization past its absolute expiry (round-6 finding
5716
- * 8): the durable closure the gates and the partial unique rely on —
5717
- * an expired corpse must not keep a task locked to its named runner. */
5718
- sweepExpiredAuthorizations(now: Date): number;
5719
- readAuthorization(id: string): AttendedAuthorization | null;
5720
- /** Open continuation authorizations named to this runner (Phase 2E, A4):
5721
- * unconsumed, carrying a parent attempt — tick's continuation pass reads
5722
- * this; liveness is the caller's check, as everywhere. */
5723
- openContinuationAuthorizations(runner: string): AttendedAuthorization[];
5724
- /**
5725
- * Why a finished run cannot be continued right now, in words — or null.
5726
- * The ENUMERATED non-terminal publication states (round-3 R7 demanded
5727
- * the concrete list, not "open intents"): a publication still moving
5728
- * ('intended','pushed', or 'opened' with the remote not yet settled) and
5729
- * a merge intent still live ('pending','claimed') both block.
5730
- */
5731
- continuationBlockOf(runId: number): string | null;
5732
- /** The one OPEN authorization for a task, or null. */
5733
- openAuthorizationFor(taskRef: number): AttendedAuthorization | null;
5734
- /**
5735
- * One durable liveness beat. The DURABLE COLUMN IS THE AUTHORITATIVE
5736
- * CLOCK; the only suppressed writes are duplicate-tab beats landing
5737
- * within 5 seconds of the stored value, so observed grace never shrinks
5738
- * below 40 of the nominal 45 seconds.
5739
- */
5740
- beatAuthorization(id: string, now: Date): boolean;
5741
- /** Explicit terminal closure — run end, expiry, or revocation. CAS on open. */
5742
- closeAuthorization(id: string, endReason: string, now: Date): boolean;
5743
- /**
5744
- * Money already committed against an authorization: settled and uncertain
5745
- * turns at their accounted charge, plus the live reservation of any
5746
- * unsettled turn. The budget gate reads THIS, never run.cost_usd.
5747
- */
5748
- authorizationSpendMicrousd(id: string): number;
5749
- /**
5750
- * Record one turn — the gate where the cap, the single-flight rule, the
5751
- * budget reservation, the lease re-proof, and the open-decision rule all
5752
- * hold or refuse ATOMICALLY (v6 W6: a fenced coordinator fails inside
5753
- * this transaction, not at its next poll). For 'answer' turns the
5754
- * delivery-CAS on decision.delivered_turn happens here; run_decision
5755
- * attaches only at ACCEPTANCE (v6 W5).
5756
- */
5757
- recordSessionTurn(input: {
5758
- run: number;
5759
- sourceKind: SessionTurn["sourceKind"];
5760
- sourceId?: number | null;
5761
- author?: string | null;
5762
- text: string;
5763
- repairLimit?: number;
5764
- now: Date;
5765
- }): {
5766
- ok: true;
5767
- turn: SessionTurn;
5768
- } | {
5769
- ok: false;
5770
- reason: RecordTurnRefusal;
5771
- };
5772
- /** Answered decisions on a held run whose answer has not yet been
5773
- * injected — the coordinator's per-pulse scan (v3 R3). */
5774
- undeliveredDecisionsOf(run: number): Decision[];
5775
- readSessionTurn(id: number): SessionTurn | null;
5776
- sessionTurnsOf(run: number): SessionTurn[];
5777
- /** Bytes flushed to stdin. Write success is NOT acceptance (spike fact 5). */
5778
- markTurnWritten(id: number, now: Date): boolean;
5779
- /**
5780
- * Bind pending answers to the BRIEF turn (round-6 finding 2): a held
5781
- * build's brief carries every answered-but-undelivered decision, and the
5782
- * builder's ordinary pre-spawn attach would claim delivery the agent
5783
- * never proved. The pre-attached run_decision rows are WITHDRAWN here and
5784
- * each decision's delivery-CAS points at the brief turn — run_decision
5785
- * re-attaches only at that turn's acceptance, exactly like answer turns.
5786
- */
5787
- bindBriefDeliveries(runId: number, briefTurn: number, decisionIds: readonly number[]): void;
5788
- /**
5789
- * Acceptance — THIS turn's system/init (or its result, retroactively).
5790
- * This is also where run_decision attaches, for EVERY decision whose
5791
- * delivery-CAS points at this turn (answer turns claim one at recording;
5792
- * a brief turn claims every pending answer it carried): delivery is
5793
- * claimed only once the agent provably received the words (v6 W5).
5794
- */
5795
- markTurnAccepted(id: number, now: Date): boolean;
5796
- private attachDeliveriesOf;
5797
- /**
5798
- * Settle a turn from its result. The provider's totals are CUMULATIVE per
5799
- * process, so the measured charge is the marginal delta from the held
5800
- * session's durable baseline, advanced here atomically. A missing or
5801
- * regressing total is a TELEMETRY FAILURE: the turn settles uncertain at
5802
- * its reservation, the baseline stays, and the caller must end the hold.
5803
- * Run aggregates gain the same delta so attended spend never disappears
5804
- * from routine reporting (v3 R4).
5805
- */
5806
- settleTurn(id: number, result: {
5807
- cumulativeMicrousd: number | null;
5808
- outputTokens: number | null;
5809
- now: Date;
5810
- }): {
5811
- ok: true;
5812
- measuredMicrousd: number;
5813
- } | {
5814
- ok: false;
5815
- reason: "telemetry" | "not-unsettled";
5816
- };
5817
- /**
5818
- * Terminal conservative settlement on process exit (ruling 15).
5819
- * 'cancelled' = recorded but never written: charged zero. 'uncertain' =
5820
- * written or accepted but never proven settled: charged its reservation.
5821
- * A turn that never reached ACCEPTANCE reverts its delivery claim so the
5822
- * ordinary road can deliver the answer later (v6 W5); an accepted turn
5823
- * keeps its attach — acceptance is the proof.
5824
- */
5825
- settleTurnTerminal(id: number, terminal: "uncertain" | "cancelled", now: Date): boolean;
5826
- private chargeRunAggregates;
5827
- /**
5828
- * Custody intent — INSERTed in the final dispatch-proof transaction,
5829
- * before spawn. The run-held partial unique refuses a
5830
- * second hold typed, not by accident.
5831
- */
5832
- openHeldSession(input: {
5833
- run: number;
5834
- authorizationId: string;
5835
- runner: string;
5836
- leaseId: string;
5837
- upIncarnation: string;
5838
- cookie: string;
5839
- socketPath: string;
5840
- now: Date;
5841
- }): {
5842
- ok: true;
5843
- } | {
5844
- ok: false;
5845
- reason: "run-held";
5846
- };
5847
- /** Stamp pids after spawn. False = the row closed underneath the spawn — kill the child. */
5848
- stampHeldSession(run: number, supervisorPid: number, agentPgid: number): boolean;
5849
- heldSessionOf(run: number): HeldSession | null;
5850
- /** Every un-ended custody row — the fence sweep's and hard-stop's read. */
5851
- /** The durable session gauge (v28): open custody rows for this runner —
5852
- * a restarted `up` with orphans pending must count them, so the
5853
- * in-process map is never the truth. */
5854
- openHeldSessionCount(runner: string): number;
5855
- /** Every open authorization on this runner — the beat-all's worklist. */
5856
- openAuthorizationsOf(runner: string): AttendedAuthorization[];
5857
- openHeldSessions(): HeldSession[];
5858
- /** Ordinary close by the owning coordinator. CAS on un-ended. */
5859
- endHeldSession(run: number, endReason: string, now: Date): boolean;
5860
- /**
5861
- * SEIZE custody for fencing (v6, after v4 Q5): CAS open→fencing AND fence
5862
- * the recorded lease in ONE transaction, so a wedged owner's heartbeat
5863
- * revival and every later coordinator write fail before any kill happens.
5864
- */
5865
- seizeHeldSession(run: number, fencer: string, deadline: Date, now: Date): {
5866
- ok: true;
5867
- session: HeldSession;
5868
- } | {
5869
- ok: false;
5870
- reason: "not-open";
5871
- };
5872
- /**
5873
- * Take over a fencing operation whose owner went quiet (v5 P3): CAS on
5874
- * the EXPIRED deadline. A loser stops only while a live fencer owns it.
5875
- */
5876
- takeoverHeldFencing(run: number, fencer: string, deadline: Date, now: Date): boolean;
5877
- /** Re-arm the fencing deadline while the work continues. Owner-CASed. */
5878
- renewHeldFencing(run: number, fencer: string, deadline: Date): boolean;
5879
- /** Final close of a fenced session — owner-CASed, after kill + settlement. */
5880
- closeHeldFencing(run: number, fencer: string, endReason: string, now: Date): boolean;
5881
4659
  /**
5882
4660
  * File one steering note (arc 1). Validation is validateNote EXACTLY —
5883
- * no bespoke rule — and filing refuses on finished tasks and during open
5884
- * tournaments (contestants share a task; all-racer delivery is a future
5885
- * many-to-many, not a silent single-racer lie).
4661
+ * no bespoke rule — and filing refuses on finished tasks.
5886
4662
  */
5887
4663
  fileSteerNote(taskId: string, author: VerifiedAuthor, note: string, now: Date, mutation?: Mutation): {
5888
4664
  ok: true;
5889
4665
  id: number;
5890
4666
  } | {
5891
4667
  ok: false;
5892
- reason: "unknown-task" | "task-finished" | "contest-open" | "invalid-note";
4668
+ reason: "unknown-task" | "task-finished" | "invalid-note";
5893
4669
  problem?: string;
5894
4670
  };
5895
4671
  /** Every steering note of a task, filing order, delivery state included. */
5896
4672
  listSteerNotes(taskRef: number): SteerNote[];
5897
- /** Undelivered, unsuperseded notes — the admitContest refusal predicate. */
4673
+ /** Undelivered, unsuperseded notes. */
5898
4674
  pendingSteerCount(taskRef: number): number;
5899
4675
  /**
5900
4676
  * The attach transaction (arc 1 finding 9): a DEDICATED pre-invocation
@@ -6879,10 +5655,30 @@ export declare class Store {
6879
5655
  flowTriggerCard(trigger: number, key: string): number | null;
6880
5656
  /** The active chat trigger a channel feeds (v89), if any: one per channel. */
6881
5657
  chatTriggerFor(app: string, installation: string, chat: string): FlowTriggerRow | null;
6882
- /** Record what a trigger did with one outside thing: the card it made, or why it made none. False when it was already recorded. */
6883
- recordFlowTriggerEvent(trigger: number, key: string, card: number | null, note: string | null, now: Date): boolean;
5658
+ /**
5659
+ * Record what a trigger did with one outside thing: the card it made, or why it made none, and (a standing order's
5660
+ * firing) the task it filed. False when it was already recorded.
5661
+ */
5662
+ recordFlowTriggerEvent(trigger: number, key: string, card: number | null, note: string | null, now: Date, task?: string | null): boolean;
6884
5663
  /** The last card a trigger made, if any. */
6885
5664
  lastFlowTriggerCard(trigger: number): number | null;
5665
+ /**
5666
+ * One at a time (v115, from routines): the oldest task a standing order filed that has neither finished nor been
5667
+ * cancelled — queued, running, held, parked and failed ones all count. A live claim counts whatever the task's state
5668
+ * says, so a state written over a running build can't start a twin beside it.
5669
+ */
5670
+ standingOrderBlocker(trigger: number, routine: number | null, now: Date): {
5671
+ taskId: string;
5672
+ state: string;
5673
+ } | null;
5674
+ /**
5675
+ * What a standing order's tasks spent since `sinceIso` (v115, from routines), anchored to when each provider started:
5676
+ * a paid run whose cost never landed is counted as unmeasured, and a ceiling fails closed on it.
5677
+ */
5678
+ standingOrderSpend(trigger: number, routine: number | null, sinceIso: string): {
5679
+ costUsd: number;
5680
+ unmeasuredRuns: number;
5681
+ };
6886
5682
  /** The tools a project's builds get now (active only), oldest first. */
6887
5683
  projectTools(repo: string): {
6888
5684
  id: number;
@@ -7348,9 +6144,8 @@ export declare class Store {
7348
6144
  * built-in task ids it returned to the queue — rather than a bare count.
7349
6145
  * Nothing here decides liveness: the caller proves the runner is gone (or
7350
6146
  * is taking its name over) inside the transaction that calls this. What it
7351
- * never does: touch a run that already has an outcome, a run under a live
7352
- * held session, another runner's rows, or a task some newer live lease
7353
- * owns. A second pass over the same runner settles nothing and says so.
6147
+ * never does: touch a run that already has an outcome, another runner's
6148
+ * rows, or a task some newer live lease owns. A second pass over the same runner settles nothing and says so.
7354
6149
  */
7355
6150
  recoverRunnerWork(runner: string, now: Date): RunnerWorkRecovery;
7356
6151
  /**
@@ -7401,8 +6196,7 @@ export declare class Store {
7401
6196
  * durably with who asked and when BEFORE any process is signalled. The
7402
6197
  * transaction proves the run is this task's, is still open, holds the
7403
6198
  * task's CURRENT live claim (a reviewer's synthetic lease counts through
7404
- * its open outcome alone), is not a racing lane (tournaments keep their
7405
- * own controls), and has admitted no publication — an external request
6199
+ * its open outcome alone), and has admitted no publication — an external request
7406
6200
  * in flight is never recalled by a stop, and the words say so. The
7407
6201
  * stop's hold rides the same write, owned by this run, so nothing
7408
6202
  * automatic retries the task while it is paused; a repeated request
@@ -7419,7 +6213,7 @@ export declare class Store {
7419
6213
  repeated: boolean;
7420
6214
  } | {
7421
6215
  ok: false;
7422
- reason: "no-run" | "wrong-task" | "finished" | "not-live" | "tournament" | "publication";
6216
+ reason: "no-run" | "wrong-task" | "finished" | "not-live" | "publication";
7423
6217
  detail: string;
7424
6218
  };
7425
6219
  /** Settle a stop — compare-and-set on the unsettled row. True when THIS
@@ -7574,10 +6368,7 @@ export declare class Store {
7574
6368
  clearQuota(runner: string, provider: string, scope: string, authMode?: "subscription" | "api-key", credentialFp?: string): boolean;
7575
6369
  /**
7576
6370
  * Live claims this runner holds right now — the occupied slots of §8's
7577
- * capacity gate. A claim whose run is a HELD attended session is EXCLUDED
7578
- * (v6 W2): capacity governs unattended work; the attended bound is the
7579
- * session's own signed envelope (v28: any number of them), so watched
7580
- * conversations never freeze the runner's queue.
6371
+ * capacity gate.
7581
6372
  */
7582
6373
  liveClaimCount(runner: string, now: Date): number;
7583
6374
  /** The same live claims as liveClaimCount, by the project their task is placed in. */
@@ -8033,15 +6824,6 @@ export declare const TELEGRAM_HOLD_REASONS: Readonly<{
8033
6824
  order: "Earlier task notification is still undelivered";
8034
6825
  disabled: "Telegram delivery is disabled";
8035
6826
  }>;
8036
- /**
8037
- * Why a contest lane cannot present or accept authority (final authority
8038
- * closure), or null when it can: the lane must be nonterminal, carry a
8039
- * readable stored profile, and that profile's provider, model, and
8040
- * effective repair model must BE the lane's own columns. A profile_json
8041
- * copied from another agent beside stale provider/model columns is a row
8042
- * two authorities wrote; nothing spends on it.
8043
- */
8044
- export declare function laneAuthorityProblem(lane: Contestant): string | null;
8045
6827
  export type WorktreeRow = {
8046
6828
  path: string;
8047
6829
  repo: string;
@@ -8074,16 +6856,6 @@ export type IntakeGrant = {
8074
6856
  revokedBy: string | null;
8075
6857
  };
8076
6858
  /** A review comment bound to the exact bytes of an immutable terminal diff. */
8077
- export type FallbackCycle = {
8078
- id: number;
8079
- taskRef: number;
8080
- chainDigest: string;
8081
- cursor: number;
8082
- state: "open" | "sanitizing" | "awaiting-release" | "pending-admission" | "incident" | "closed";
8083
- transitionGeneration: number;
8084
- tailRun: number | null;
8085
- closedReason: string | null;
8086
- };
8087
6859
  export type DiffComment = {
8088
6860
  id: number;
8089
6861
  artifact: number;
@@ -8192,21 +6964,19 @@ export type RevisionRefusal = "busy" | "source-task" | "source-run" | "stale-sou
8192
6964
  * INHERITED, verbatim, from the source (declared requirements and
8193
6965
  * constraints — never the installation's defaults of the day):
8194
6966
  * goal (the child appends its explicitly described repair), exclusions,
8195
- * touches, the exact rubric, declared risk (never below the source's
8196
- * signed level or its durable task choice), quality mode (strict stays
6967
+ * touches, the exact rubric, quality mode (strict stays
8197
6968
  * strict), permission posture (the source's durable choice, else the
8198
6969
  * posture its sealed profile ran under — never wider), the per-attempt
8199
6970
  * budget ceiling (never lifted; a mode's filing default may only
8200
6971
  * tighten it), the approver's per-phase route overrides, and the
8201
6972
  * build/plan agent pins.
8202
6973
  * RE-RESOLVED at filing, then approved afresh: the phase route and its
8203
- * execution profile (recommended over the inherited risk, quality,
8204
- * overrides, and pins under today's configuration), the fallback
8205
- * chain (from the repository's configuration, never copied), and the
6974
+ * execution profile (recommended over the inherited quality,
6975
+ * overrides, and pins under today's configuration), and the
8206
6976
  * auth mode. The child's digest binds what it resolved to; a yes on
8207
6977
  * the source never covers it.
8208
- * NEVER INHERITED: the approval stamp and its basis, attended
8209
- * authorizations, publication and merge grants, the plan document and
6978
+ * NEVER INHERITED: the approval stamp and its basis,
6979
+ * publication and merge grants, the plan document and
8210
6980
  * its revision ledger (a revision is planned afresh, if at all; the
8211
6981
  * brief plus the source scope are its contract), strikes, holds.
8212
6982
  * FRESH from a live mode, only when the caller re-proved coverage inside
@@ -8221,7 +6991,6 @@ export type RevisionTerms = {
8221
6991
  outOfScope: string | null;
8222
6992
  touches: string[];
8223
6993
  acceptance: AcceptanceCriterion[];
8224
- riskLevel: RiskLevel;
8225
6994
  qualityMode: QualityMode;
8226
6995
  permissionMode: UnattendedPermissionMode;
8227
6996
  budgetMicrousd: number | null;
@@ -8240,7 +7009,7 @@ export type RevisionTerms = {
8240
7009
  };
8241
7010
  /** The operator-facing posture a sealed profile actually ran under. */
8242
7011
  export declare function permissionModeOfProfile(profile: ExecutionProfile | null): UnattendedPermissionMode | null;
8243
- export declare function revisionTermsOf(sourceRef: Pick<TaskRef, "riskLevel" | "qualityMode" | "permissionMode" | "routeOverrides" | "agentProvider" | "agentModel" | "planProvider" | "planModel">, sourceScope: Scope | null, coverage: {
7012
+ export declare function revisionTermsOf(sourceRef: Pick<TaskRef, "qualityMode" | "permissionMode" | "routeOverrides" | "agentProvider" | "agentModel" | "planProvider" | "planModel">, sourceScope: Scope | null, coverage: {
8244
7013
  defaultBudgetMicrousd: number | null;
8245
7014
  escalated: boolean;
8246
7015
  } | null, permissionDefault: UnattendedPermissionMode, qualityDefault: QualityMode): RevisionTerms;
@@ -8264,7 +7033,6 @@ export type RevisionLineage = {
8264
7033
  ancestors: string[];
8265
7034
  root: string;
8266
7035
  terms: {
8267
- riskLevel: RiskLevel;
8268
7036
  qualityMode: QualityMode;
8269
7037
  permissionMode: UnattendedPermissionMode;
8270
7038
  budgetMicrousd: number | null;
@@ -8305,9 +7073,6 @@ export type ProofAcceptanceRow = {
8305
7073
  note: string | null;
8306
7074
  acceptedAt: string;
8307
7075
  };
8308
- /** A contestant's execution profile (v24): exact ids from the race terms,
8309
- * effective limits from the same constants every dispatch uses. */
8310
- export declare function contestantProfileOf(provider: string, model: string, repairModel: string, permissionMode?: UnattendedPermissionMode): ExecutionProfile;
8311
7076
  /**
8312
7077
  * The raw terms verdict for one stored scope row (raw authority repair):
8313
7078
  * every term the digest binds and every metadata word an authority reads,