@hearsay-tools/squawk 0.18.0-dev.7816 → 0.18.0-dev.7825

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 (128) hide show
  1. package/dist/activity/publisher.js +2 -2
  2. package/dist/activity/publisher.js.map +1 -1
  3. package/dist/activity/read-model.js +1 -1
  4. package/dist/activity/read-model.js.map +1 -1
  5. package/dist/activity/requests.d.ts +4 -2
  6. package/dist/activity/requests.js +1 -1
  7. package/dist/activity/requests.js.map +1 -1
  8. package/dist/artifacts/reports-index.d.ts +4 -7
  9. package/dist/artifacts/reports-index.js +7 -7
  10. package/dist/artifacts/reports-index.js.map +1 -1
  11. package/dist/ci-wait/controller.d.ts +42 -42
  12. package/dist/delegation/conversations.d.ts +6 -2
  13. package/dist/delegation/conversations.js +3 -2
  14. package/dist/delegation/conversations.js.map +1 -1
  15. package/dist/delegation/family-end.d.ts +4 -2
  16. package/dist/delegation/results.js +2 -2
  17. package/dist/delegation/results.js.map +1 -1
  18. package/dist/delegation/routes.d.ts +65 -65
  19. package/dist/delegation/routes.js +1 -1
  20. package/dist/delegation/routes.js.map +1 -1
  21. package/dist/delegation/scratch-cleanup.js +2 -2
  22. package/dist/delegation/scratch-cleanup.js.map +1 -1
  23. package/dist/delegation/service.js +2 -2
  24. package/dist/delegation/service.js.map +1 -1
  25. package/dist/delegation/transport.d.ts +65 -65
  26. package/dist/delegation/worker-cleanup.js +1 -1
  27. package/dist/delegation/worker-cleanup.js.map +1 -1
  28. package/dist/preview/host.d.ts +2 -1
  29. package/dist/preview/host.js +1 -1
  30. package/dist/preview/host.js.map +1 -1
  31. package/dist/project-migration/live.js +3 -3
  32. package/dist/project-migration/live.js.map +1 -1
  33. package/dist/runs/claim-families.d.ts +1 -1
  34. package/dist/runs/claim-families.js +1 -1
  35. package/dist/runs/lifecycle.d.ts +2 -1
  36. package/dist/runs/lifecycle.js.map +1 -1
  37. package/dist/runs/live-tasks.js +1 -1
  38. package/dist/runs/live-tasks.js.map +1 -1
  39. package/dist/runs/loaded-run-exits.d.ts +23 -0
  40. package/dist/runs/loaded-run-exits.js +46 -1
  41. package/dist/runs/loaded-run-exits.js.map +1 -1
  42. package/dist/runs/ports.d.ts +38 -14
  43. package/dist/runs/retention.d.ts +3 -1
  44. package/dist/runs/retention.js +5 -5
  45. package/dist/runs/retention.js.map +1 -1
  46. package/dist/runs/run-claims-topic.d.ts +130 -0
  47. package/dist/runs/run-claims-topic.js +258 -0
  48. package/dist/runs/run-claims-topic.js.map +1 -0
  49. package/dist/runs/run-claims.d.ts +1 -1
  50. package/dist/runs/run-claims.js +1 -1
  51. package/dist/runs/run-claims.js.map +1 -1
  52. package/dist/runs/run-database.d.ts +1 -1
  53. package/dist/runs/run-index.js +3 -1
  54. package/dist/runs/run-index.js.map +1 -1
  55. package/dist/runs/run-persistence.d.ts +150 -0
  56. package/dist/runs/run-persistence.js +396 -0
  57. package/dist/runs/run-persistence.js.map +1 -0
  58. package/dist/runs/run-pins.d.ts +38 -0
  59. package/dist/runs/run-pins.js +45 -0
  60. package/dist/runs/run-pins.js.map +1 -0
  61. package/dist/runs/run-references.d.ts +1 -1
  62. package/dist/runs/run-references.js +1 -1
  63. package/dist/runs/run-references.js.map +1 -1
  64. package/dist/runs/run-retention.d.ts +6 -2
  65. package/dist/runs/run-retention.js +11 -2
  66. package/dist/runs/run-retention.js.map +1 -1
  67. package/dist/runs/store-open.d.ts +45 -0
  68. package/dist/runs/store-open.js +89 -0
  69. package/dist/runs/store-open.js.map +1 -0
  70. package/dist/runs/store.d.ts +9 -209
  71. package/dist/runs/store.js +88 -802
  72. package/dist/runs/store.js.map +1 -1
  73. package/dist/runs/webhook.d.ts +3 -1
  74. package/dist/runs/webhook.js +2 -2
  75. package/dist/runs/webhook.js.map +1 -1
  76. package/dist/serve-boot.d.ts +2 -2
  77. package/dist/server/completion-actions.js +2 -2
  78. package/dist/server/completion-actions.js.map +1 -1
  79. package/dist/server/models-routes.d.ts +13 -13
  80. package/dist/server/project-run-files.d.ts +3 -1
  81. package/dist/server/project-run-files.js +3 -3
  82. package/dist/server/project-run-files.js.map +1 -1
  83. package/dist/server/provider-sign-in-routes.d.ts +2 -2
  84. package/dist/server/reports-api.d.ts +2 -2
  85. package/dist/server/run-checkout.d.ts +3 -1
  86. package/dist/server/run-checkout.js +3 -3
  87. package/dist/server/run-checkout.js.map +1 -1
  88. package/dist/server/run-event-feed.js +2 -2
  89. package/dist/server/run-event-feed.js.map +1 -1
  90. package/dist/server/runner-install-routes.d.ts +10 -10
  91. package/dist/server/server.d.ts +1593 -1593
  92. package/dist/server/server.js +9 -9
  93. package/dist/server/server.js.map +1 -1
  94. package/dist/server/start-server.js +1 -1
  95. package/dist/server/start-server.js.map +1 -1
  96. package/dist/workflows/run/continuation-acceptance.js +2 -2
  97. package/dist/workflows/run/continuation-acceptance.js.map +1 -1
  98. package/dist/workflows/run/family-reconciler.d.ts +2 -1
  99. package/dist/workflows/run/family-reconciler.js +2 -2
  100. package/dist/workflows/run/family-reconciler.js.map +1 -1
  101. package/dist/workflows/run/maintenance-claims.js +6 -6
  102. package/dist/workflows/run/maintenance-claims.js.map +1 -1
  103. package/dist/workflows/run/native-skill-input-queue.js +1 -1
  104. package/dist/workflows/run/native-skill-input-queue.js.map +1 -1
  105. package/dist/workflows/run/queued-revival.js +3 -3
  106. package/dist/workflows/run/queued-revival.js.map +1 -1
  107. package/dist/workflows/run/run-cancel.js +5 -5
  108. package/dist/workflows/run/run-cancel.js.map +1 -1
  109. package/dist/workflows/run/run-finish.js +1 -1
  110. package/dist/workflows/run/run-finish.js.map +1 -1
  111. package/dist/workflows/run/run-recovery.js +3 -3
  112. package/dist/workflows/run/run-recovery.js.map +1 -1
  113. package/dist/workflows/run/run-settlement.js +5 -5
  114. package/dist/workflows/run/run-settlement.js.map +1 -1
  115. package/dist/workflows/run/step-loop.js +4 -4
  116. package/dist/workflows/run/step-loop.js.map +1 -1
  117. package/dist/workflows/run/turn-nudges.js +1 -1
  118. package/dist/workflows/run/turn-nudges.js.map +1 -1
  119. package/dist/workflows/run/turn-settler.js +1 -1
  120. package/dist/workflows/run/turn-settler.js.map +1 -1
  121. package/dist/workflows/run/usage-accounting.js +1 -1
  122. package/dist/workflows/run/usage-accounting.js.map +1 -1
  123. package/dist/workflows/run.js +7 -7
  124. package/dist/workflows/run.js.map +1 -1
  125. package/package.json +4 -4
  126. package/scripts/benchmark-family-reconcile.ts +1 -1
  127. package/scripts/benchmark-run-store.ts +5 -5
  128. package/scripts/benchmark-workspace-events.ts +2 -2
@@ -13,20 +13,20 @@ import { type OutcomeDependencies, type OutcomeReceipt, type RunOutcome } from '
13
13
  import { type ExitCall, type RunExitId, type RunPatch } from './run-exits.ts';
14
14
  import { type ConversationIdentity } from './conversation-identity.ts';
15
15
  export { ConversationIdInUseError } from './conversation-identity.ts';
16
- import { RunDatabase, type RunDatabaseChanges, type RunDatabaseCommit } from './run-database.ts';
17
16
  import { type BranchOwner } from './branch-owners.ts';
18
17
  export { ciWaitEntry, holdsWorkerWait, upgradeLegacyWaits, workerWaitEntry } from './legacy-waits.ts';
19
18
  import { RunRetentionTopic } from './run-retention.ts';
20
19
  import { type RawExtras } from './raw-record.ts';
21
20
  import { RunStoreOpenError } from './store-open-error.ts';
21
+ import { RunClaimsTopic } from './run-claims-topic.ts';
22
+ import { RunPinsTopic } from './run-pins.ts';
22
23
  import { type SpawnCapacityRefusal } from './owned-run-create.ts';
23
24
  import { WorkerResultsTopic } from './worker-results.ts';
24
25
  import { RunEventLogTopic } from './event-log.ts';
25
26
  import { RunRedaction } from './run-redaction.ts';
26
27
  import { RunArchiveTopic } from './run-archive.ts';
27
28
  import { RunReadFlagsTopic } from './run-read-flags.ts';
28
- /** Per-store persistence adapter; the second argument is the normal fenced transaction. */
29
- export type RunStorePersistence = (changes: RunDatabaseChanges, transaction: RunDatabase['transaction']) => RunDatabaseCommit;
29
+ import { RunPersistenceTopic, type RunStorePersistence } from './run-persistence.ts';
30
30
  export type RunStatus = 'queued' | 'running' | 'waiting' | 'review' | 'done' | 'failed' | 'cancelled';
31
31
  export type StepStatus = 'pending' | 'running' | 'waiting' | 'review' | 'done' | 'failed' | 'cancelled' | 'skipped';
32
32
  declare const stepStateSchema: z.ZodObject<{
@@ -3168,74 +3168,7 @@ export type RepoHandle = {
3168
3168
  owner: string;
3169
3169
  name: string;
3170
3170
  };
3171
- /**
3172
- * Reconcile one record just read off disk with the fact that whichever process wrote it is gone.
3173
- *
3174
- * Mutates and returns `run`. Extracted from `RunStore.open` so the read-only index reader
3175
- * (`./run-index.ts`) answers the SAME question about a `running` row on disk. Two parsers that
3176
- * disagree here is a visible bug, not an internal one: the cockpit would show a task as running
3177
- * in the ⌘K index and failed the moment you opened it.
3178
- *
3179
- * `keepLive` (#367): leave `queued`/`running`/`waiting` untouched so the caller can recover them
3180
- * (RunManager.recover re-queues queued runs, resumes interrupted ones). Without it — one-shot CLI
3181
- * paths that never recover, and the index reader, which has no manager at all — live-looking runs
3182
- * are marked failed so no ghost stays behind.
3183
- */
3184
- export declare function reconcileLoadedRun(run: RunRecord, opts?: {
3185
- keepLive?: boolean;
3186
- }): RunRecord;
3187
- /**
3188
- * Settle an adopted dead owner’s live run without starting work. Untouched runs cancel; started
3189
- * runs become interrupted. Stop explicitly cancels its target. Mutates run.
3190
- */
3191
- export declare function settleOrphanedRun(run: RunRecord, opts?: {
3192
- stop?: boolean | undefined;
3193
- }): RunRecord;
3194
- export declare function __setLegacyImportHookForTests(hook?: {
3195
- beforeTransaction?: () => void;
3196
- beforeCommit?: () => void;
3197
- }): void;
3198
- /**
3199
- * The rows whose stored summary reading their record can change, as SQL over `runs`: the rows
3200
- * `open` decodes to normalize (the `live` column it loads by, then `LEGACY_REFERENCE_HEAL_SQL`).
3201
- * With a repository handle, a row whose summary `namesForeignReference` is one too, as
3202
- * `setRepoHandle` reads it. The cold reader (run-index.ts) decodes exactly these rows and serves
3203
- * every other stored summary, so the two read paths cannot disagree about which rows to read.
3204
- * `AUTOMATION_ORIGIN_HEAL_SQL` is left out on purpose: no cross-project view reads
3205
- * `automationId`, and asking it scans `data`.
3206
- */
3207
- export declare const LOAD_REPAIR_SQL: string;
3208
3171
  export { branchOwnerOf, type BranchOwner } from './branch-owners.ts';
3209
- /** Who may hold a run in memory besides its own record (see `RunStore.pin`). `maintenance` is the
3210
- * RunManager's publish, worktree-reclaim and branch-cleanup claims, held across their async work. */
3211
- export type RunPinHolder = 'active' | 'continue' | 'cleanup' | 'maintenance';
3212
- /**
3213
- * Who may change a run, as this store sees it (#779, plan step 3; `RunStore.runOwnership`):
3214
- * - `held`: this store claims its delegation family;
3215
- * - `free`: no live process claims it and nothing in its family is live; a write takes it. A
3216
- * proven-dead owner's claim on such a family counts for nothing: there is nothing to recover;
3217
- * - `orphaned`: nobody alive owns a family that still has a live run (its owner died, or nobody
3218
- * claimed it): taking it means adopting it first (`RunStore.adoptFamily` settles it, then the
3219
- * manager recovers the family);
3220
- * - `foreign`: another process that is alive (or cannot be proven dead) holds it: read-only here;
3221
- * - `quarantined`: a write found it changed under this store; refused until Squawk restarts;
3222
- * - `fallback`: a family member is read from the fallback directory: refused as `foreign` until a control adopts it.
3223
- */
3224
- export type RunOwnership = 'held' | 'free' | 'orphaned' | 'foreign' | 'quarantined' | 'fallback';
3225
- /** The one answer every control gives for a run another Squawk process owns (`409 { error }`). */
3226
- export declare const RUN_IN_USE_ELSEWHERE = "run is in use by another Squawk process";
3227
- /** The answer for a run this process stopped writing after a conflicting write. */
3228
- export declare const RUN_QUARANTINED = "run changed under this Squawk process \u2014 restart Squawk to reload it";
3229
- /** A write this store must not make: another process owns the run, its owner died with work
3230
- * still live (adopt it first), or a conflict quarantined it. Nothing was changed. */
3231
- export declare class RunWriteRefusedError extends Error {
3232
- readonly runId: string;
3233
- readonly ownership: Exclude<RunOwnership, 'held' | 'free'>;
3234
- constructor(runId: string, ownership: Exclude<RunOwnership, 'held' | 'free'>, fallbackError?: string);
3235
- }
3236
- /** Why a `run` event fired, when a delegation checkpoint caused it or nothing durable changed
3237
- * (`republish`) (in-process only). */
3238
- export type CommitSource = 'delegation-checkpoint' | 'delegation-destroy-progress' | 'live-release';
3239
3172
  /**
3240
3173
  * Run rows in runs.db plus append-only NDJSON events and an in-process event bus. Hold live,
3241
3174
  * pinned, related and unsettled records only. Optimistic writes debounce; durable commits
@@ -3249,19 +3182,11 @@ export declare class RunStore {
3249
3182
  private readonly pins;
3250
3183
  /** Staged ids while a durable commit installs and announces them: never evicted mid-commit. */
3251
3184
  private readonly committing;
3252
- private saveTimer;
3253
3185
  /** `null` once the store is closed, and in a `RunStore.unavailable` store (nothing is written,
3254
3186
  * nothing is evicted). */
3255
3187
  private db;
3256
- /** Persistence source for consumers that build the reports index. No index is created here. */
3257
- reportSource(): {
3258
- db: RunDatabase | null;
3259
- dataDir: string;
3260
- openFailure: RunStoreOpenError | undefined;
3261
- };
3262
3188
  /** Why `open` failed, in a `RunStore.unavailable` store. */
3263
3189
  private openFailure;
3264
- private persistence;
3265
3190
  /** Runs whose held record is ahead of its row; the next save or commit writes them. */
3266
3191
  private readonly dirty;
3267
3192
  /** The typed lifecycle events the store publishes after each write (lifecycle.ts). */
@@ -3297,8 +3222,6 @@ export declare class RunStore {
3297
3222
  * Cleared at the next microtask: no commit spans a turn. */
3298
3223
  private readonly coldBase;
3299
3224
  private readonly coldReads;
3300
- /** The family of each pending deletion, whose claim the deleting write is fenced against. */
3301
- private readonly deletedFamilies;
3302
3225
  /** Rows a conflicting write excluded: this store refuses to write them until it is reopened. */
3303
3226
  private readonly quarantined;
3304
3227
  /** Rows whose `data` this store tried to decode and could not: left in the database untouched,
@@ -3318,6 +3241,12 @@ export declare class RunStore {
3318
3241
  readonly eventLog: RunEventLogTopic;
3319
3242
  /** The scrub of events and free text (hearsay-tools/squawk#4040). */
3320
3243
  readonly redaction: RunRedaction;
3244
+ /** Claims, ownership, sources and fallback (hearsay-tools/squawk#4042). */
3245
+ readonly claims: RunClaimsTopic;
3246
+ /** The holds that keep a run loaded (hearsay-tools/squawk#4042). */
3247
+ readonly runPins: RunPinsTopic;
3248
+ /** Flush, persist, the fence, conflicts and the save debounce (hearsay-tools/squawk#4043). */
3249
+ readonly persistence: RunPersistenceTopic;
3321
3250
  private executions;
3322
3251
  /** A worker's execution, process, identity and scope records (hearsay-tools/squawk#4039), built on
3323
3252
  * first use by the factory this process registered; throws when none is registered. */
@@ -3370,69 +3299,6 @@ export declare class RunStore {
3370
3299
  /** Why this store has no database, when it is `RunStore.unavailable`'s: its runs are unknown,
3371
3300
  * not absent. */
3372
3301
  get unavailable(): RunStoreOpenError | undefined;
3373
- /** Every sidecar for a run follows the winning record, never file-by-file fallback. */
3374
- sourceDataDir(id: string): string;
3375
- isFallbackRun(id: string): boolean;
3376
- hasFallbackRun(id: string): boolean;
3377
- /**
3378
- * Open-time load: the live rows, the finished rows a load normalization repairs, then the
3379
- * delegation families of the live ones. A row that does not parse is skipped and left in the
3380
- * database untouched; one warning says how many.
3381
- *
3382
- * Only rows this store can claim are loaded (#779, plan step 3). A live row whose family another
3383
- * live process claims — `serve`'s parked run, seen by a headless `cez run` — is that process's:
3384
- * it is not loaded, normalized or recovered here, and stays readable through `getRun` and the
3385
- * list rows. A live row nobody alive claims is taken over, as before: this open recovers it
3386
- * (`keepLive`) or settles it as interrupted.
3387
- */
3388
- private loadHeldRows;
3389
- /** Normalize a record just read from `row` (see `reconcileLoadedRun`) and hold it. Marks the row
3390
- * dirty only when normalization changed it, so the next save persists exactly the runs open()
3391
- * rewrote. A row read up from schema-3 wait fields counts as changed: its rewrite drops them
3392
- * and recomputes its summary and live column (`upgradeLegacyWaits`), as does a summary that does
3393
- * not parse (hearsay-tools/squawk#3530). The caller has claimed the row's family. */
3394
- private adoptLoadedRun;
3395
- /**
3396
- * Hold one delegation family: its root and every worker filed under it, read through the
3397
- * `parent_run_id` index. No recursion: a worker's own id never names a family. The caller has claimed it. `settle` settles its live rows instead of keeping
3398
- * them for recovery (`settleOrphanedRun`); `stopId` is the run a Stop settles as cancelled.
3399
- */
3400
- private holdFamily;
3401
- /** Make sure this store claims each of `families`; `claimStoreFamilies` takes the free ones. */
3402
- private claimFamilies;
3403
- /** Release the claim of every family with nothing left in memory, once nothing is pending: a
3404
- * failed save keeps its families claimed until it succeeds. A failed release retries at the
3405
- * next sweep; `close()` releases the rest. */
3406
- private releaseUnheldClaims;
3407
- /**
3408
- * Who may change this run right now (see `RunOwnership`), or undefined when there is no such
3409
- * run. Read-only: nothing is claimed. Controls ask this first, so a run another process owns is
3410
- * refused with `RUN_IN_USE_ELSEWHERE` and a dead process's run is adopted before it is changed.
3411
- */
3412
- runOwnership(id: string): RunOwnership | undefined;
3413
- /** Why a control on this run must be refused here, or undefined when this store may change it. */
3414
- writeRefusal(id: string): string | undefined;
3415
- /**
3416
- * Claim an orphaned family before a control, then settle its live rows.
3417
- * Stop cancels its target. Return the root id, or undefined for a live owner or missing run.
3418
- */
3419
- adoptFamily(id: string, opts?: {
3420
- stop?: boolean;
3421
- }): string | undefined;
3422
- /** Explicit controls only (`requireRunControl`): copy a fallback family in so it can be written. */
3423
- adoptFallbackFamily(id: string): boolean;
3424
- private fallbackRefusal;
3425
- /** Run files are written only for a family this store may write, never a fallback family. */
3426
- /** The error `appendEvent` throws for a run this store cannot write or does not know. */
3427
- private missingRunError;
3428
- private writeDir;
3429
- /** Every run whose family another process owns (`foreignClaimedRunIds`). */
3430
- listForeignClaimedRunIds(): string[];
3431
- /** Non-terminal rows in the database (both directories) and the runs of families another live store claims. */
3432
- persistedLiveRunIds(): {
3433
- live: string[];
3434
- foreign: string[];
3435
- };
3436
3302
  /**
3437
3303
  * Whether a held run anchors itself (and its family) in memory. Anything else held is a family
3438
3304
  * member or a settled write, and leaves at the next sweep (`evictSettled`).
@@ -3484,18 +3350,6 @@ export declare class RunStore {
3484
3350
  withReadCache<T>(fn: () => T): T;
3485
3351
  /** Whether the run exists, held or not, without decoding it. */
3486
3352
  private hasRun;
3487
- /**
3488
- * Keep a run in memory for `holder` until `unpin(id, holder)`: a RunManager pins the runs it is
3489
- * executing (`active`) and the run a Continue is admitting (`continue`). A finished run is
3490
- * loaded. Pins are per holder, so releasing one never releases another. Returns the held record.
3491
- */
3492
- pin(id: string, holder: RunPinHolder): RunRecord | undefined;
3493
- /** Publish a run's current record again without a write: something read beside the record
3494
- * changed, such as the run leaving the manager's live registries, which a detail's finish
3495
- * verdict reads (hearsay-tools/cezarion#1301). */
3496
- republish(id: string): void;
3497
- /** Release `holder`'s pin. The run leaves memory at the next sweep once nothing else holds it. */
3498
- unpin(id: string, holder: RunPinHolder): void;
3499
3353
  /**
3500
3354
  * Set discovered repository identity without blocking boot. Recompute conclusions from retained
3501
3355
  * evidence, including cold records; null retains unknown-handle behavior.
@@ -3760,22 +3614,6 @@ export declare class RunStore {
3760
3614
  }): void;
3761
3615
  /** Create an owned worker run and its parent receipt; `createStoreOwnedRun` holds the checks. */
3762
3616
  createOwnedRun(input: Parameters<RunStore['createRun']>[0], parentId: string, requestId: string, worker: DelegationState, requestHash: string, spawnCapacityRefusal: SpawnCapacityRefusal, executionIdentity?: unknown): RunRecord;
3763
- /**
3764
- * Durably replace or delete staged rows together with pending dirty rows. Persist before
3765
- * changing held objects or notifying subscribers. On failure retain all pending state; flush()
3766
- * remains best-effort.
3767
- */
3768
- private commitIndex;
3769
- /**
3770
- * Refuse (throwing, with nothing changed) a commit that stages a quarantined run, or a run whose
3771
- * family this store does not claim and cannot take: another process owns it, or a dead process
3772
- * left it live and it has not been adopted.
3773
- */
3774
- private assertWritable;
3775
- /** The family of a run this store knows: held, else its row; a run nowhere is its own. */
3776
- private familyOf;
3777
- /** Schedule the sweep that lets any of `ids` leave memory, when one of them now can. */
3778
- private sweepIfSettled;
3779
3617
  /** Move run `id` by `exit` (ADR 0056): its status and `extras` in one write, checked against the
3780
3618
  * record that write changes. A run this store cannot write is neither checked nor written. The
3781
3619
  * exit decides how the write persists (`exitDurability`), never the extras. A guarded exit (one
@@ -3798,45 +3636,7 @@ export declare class RunStore {
3798
3636
  private change;
3799
3637
  /** Indexed family enumeration, including members not yet flushed to SQLite. */
3800
3638
  listFamilyRunIds(rootId: string): string[];
3801
- /** Write the pending rows out now (used on shutdown). */
3802
- flush(): void;
3803
3639
  private seqs;
3804
- /** Same location `handoffPath()` in handoff.ts produces — inlined to keep
3805
- * the store free of upward imports. */
3806
- private handoffPath;
3807
- /** Agent screenshots persisted by the run manager (see persistImage). */
3808
- private imagesDir;
3809
- /** Save `run` debounced and publish it; `before` is the record at the write's entry (none: created). */
3810
- private touch;
3811
- /** The held record is gone; the next save or commit deletes its row, fenced by `family`'s claim
3812
- * and by the revision this store last saw (kept in `base` until the delete is written). */
3813
- private markDeleted;
3814
- /** Debounced so token-usage updates don't rewrite a row per event. Nothing to schedule without
3815
- * a database: a `RunStore.unavailable` store, or a closed one, writes nothing. */
3816
- private scheduleSave;
3817
- /** The single database write, so a test can fail it the way a full disk would. */
3818
- private writeIndex;
3819
- /**
3820
- * Write `staged` plus everything still pending — dirty rows from memory, deletions — in one
3821
- * transaction, then clear the pending marks. Throws with nothing cleared when it fails.
3822
- * Never copies or sorts the whole store: the cost is the rows that changed.
3823
- *
3824
- * Fenced (#779, plan step 3): the transaction commits only if every family it writes still
3825
- * carries this store's claim and every row is at the revision this store last saw. Otherwise
3826
- * nothing is written and `handleConflicts` deals with the rows that changed under it.
3827
- */
3828
- private persist;
3829
- /** What a write of these rows (id → family) must still find: this store's claims, at the
3830
- * generations it took them, and each row at the revision it last saw (none for a new row). */
3831
- private fence;
3832
- /**
3833
- * Handle a fenced-write conflict. Save unexpected conflict evidence before clearing pending
3834
- * state or quarantining the row. If evidence persistence fails, retain pending writes. Other
3835
- * rows remain writable; stale unclaimed reads only fail their write.
3836
- */
3837
- private handleConflicts;
3838
- /** Write what is pending, then (unless closing) let every run whose write settled leave memory. */
3839
- private saveNow;
3840
3640
  /**
3841
3641
  * Write what is pending and release the database (store disposal, process shutdown).
3842
3642
  * Idempotent. A closed store keeps answering reads for what it holds — the final save evicts