@hearsay-tools/squawk 0.18.0-dev.7792 → 0.18.0-dev.7796

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 (45) hide show
  1. package/dist/ci-wait/controller.d.ts +4 -4
  2. package/dist/delegation/routes.d.ts +10 -10
  3. package/dist/delegation/transport.d.ts +15 -15
  4. package/dist/runs/ports.d.ts +6 -5
  5. package/dist/runs/run-row.d.ts +2 -0
  6. package/dist/runs/run-row.js +8 -0
  7. package/dist/runs/run-row.js.map +1 -1
  8. package/dist/runs/store.d.ts +3 -20
  9. package/dist/runs/store.js +25 -109
  10. package/dist/runs/store.js.map +1 -1
  11. package/dist/runs/transcript-facts-topic.d.ts +45 -0
  12. package/dist/runs/transcript-facts-topic.js +101 -0
  13. package/dist/runs/transcript-facts-topic.js.map +1 -0
  14. package/dist/server/live-routes.d.ts +6 -6
  15. package/dist/server/workspace-live-routes.d.ts +6 -6
  16. package/dist/workflows/run/continuation-acceptance.js +1 -1
  17. package/dist/workflows/run/continuation-acceptance.js.map +1 -1
  18. package/dist/workflows/run/continuation-session.js +2 -2
  19. package/dist/workflows/run/continuation-session.js.map +1 -1
  20. package/dist/workflows/run/family-reconciler.js +2 -2
  21. package/dist/workflows/run/family-reconciler.js.map +1 -1
  22. package/dist/workflows/run/human-waits.js +4 -4
  23. package/dist/workflows/run/human-waits.js.map +1 -1
  24. package/dist/workflows/run/input-delivery.js +3 -3
  25. package/dist/workflows/run/input-delivery.js.map +1 -1
  26. package/dist/workflows/run/run-finish.js +3 -3
  27. package/dist/workflows/run/run-finish.js.map +1 -1
  28. package/dist/workflows/run/run-recovery.js +6 -6
  29. package/dist/workflows/run/run-recovery.js.map +1 -1
  30. package/dist/workflows/run/run-settlement.js +3 -3
  31. package/dist/workflows/run/run-settlement.js.map +1 -1
  32. package/dist/workflows/run/session-events.js +1 -1
  33. package/dist/workflows/run/session-events.js.map +1 -1
  34. package/dist/workflows/run/turn-nudges.js +2 -2
  35. package/dist/workflows/run/turn-nudges.js.map +1 -1
  36. package/dist/workflows/run/turn-settler.js +1 -1
  37. package/dist/workflows/run/turn-settler.js.map +1 -1
  38. package/dist/workflows/run/worker-questions.js +16 -16
  39. package/dist/workflows/run/worker-questions.js.map +1 -1
  40. package/dist/workflows/run.js +1 -1
  41. package/dist/workflows/run.js.map +1 -1
  42. package/package.json +4 -4
  43. package/scripts/measure-transcript-facts-health.mjs +2 -2
  44. package/scripts/measure-transcript-facts-lag.mjs +1 -1
  45. package/scripts/transcript-facts-fixture.mjs +1 -1
@@ -1006,10 +1006,6 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
1006
1006
  };
1007
1007
  } | {
1008
1008
  output: {
1009
- ok: false;
1010
- code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
1011
- message: string;
1012
- } | {
1013
1009
  ok: true;
1014
1010
  task: {
1015
1011
  id: string;
@@ -1021,6 +1017,10 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
1021
1017
  url?: string | undefined;
1022
1018
  };
1023
1019
  note: string;
1020
+ } | {
1021
+ ok: false;
1022
+ code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
1023
+ message: string;
1024
1024
  };
1025
1025
  outputFormat: "json";
1026
1026
  status: import("hono/utils/http-status").ContentfulStatusCode;
@@ -91,16 +91,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
91
91
  "/discover": {
92
92
  $post: {
93
93
  output: {
94
- scope: "host-default-account";
95
- runners: {
96
- requiresAccountHome?: boolean | undefined;
97
- status: "connected" | "disconnected" | "not-installed" | "unknown";
98
- enabled?: boolean | undefined;
99
- hint?: string | undefined;
100
- authFailureId?: string | undefined;
101
- runner: string;
102
- }[];
103
- } | {
104
94
  runner: string;
105
95
  models: {
106
96
  id: string;
@@ -111,6 +101,16 @@ export declare function createDelegationRoutes(service: DelegationService, crede
111
101
  source: "cache" | "live" | "unavailable";
112
102
  stale: boolean;
113
103
  reason?: string | undefined;
104
+ } | {
105
+ scope: "host-default-account";
106
+ runners: {
107
+ requiresAccountHome?: boolean | undefined;
108
+ status: "connected" | "disconnected" | "not-installed" | "unknown";
109
+ enabled?: boolean | undefined;
110
+ hint?: string | undefined;
111
+ authFailureId?: string | undefined;
112
+ runner: string;
113
+ }[];
114
114
  } | {
115
115
  tasks: {
116
116
  id: string;
@@ -66,17 +66,6 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
66
66
  "/discover": {
67
67
  $post: {
68
68
  output: {
69
- runner: string;
70
- models: {
71
- id: string;
72
- label: string;
73
- description: string;
74
- effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
75
- }[];
76
- source: "cache" | "live" | "unavailable";
77
- stale: boolean;
78
- reason?: string | undefined;
79
- } | {
80
69
  scope: "host-default-account";
81
70
  runners: {
82
71
  requiresAccountHome?: boolean | undefined;
@@ -98,6 +87,17 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
98
87
  reason?: string | undefined;
99
88
  }[];
100
89
  nextOffset?: number | undefined;
90
+ } | {
91
+ runner: string;
92
+ models: {
93
+ id: string;
94
+ label: string;
95
+ description: string;
96
+ effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
97
+ }[];
98
+ source: "cache" | "live" | "unavailable";
99
+ stale: boolean;
100
+ reason?: string | undefined;
101
101
  };
102
102
  outputFormat: "json";
103
103
  status: 200;
@@ -207,13 +207,13 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
207
207
  status: 200;
208
208
  input: {
209
209
  json: {
210
- workerIds: string[];
211
- timeoutSeconds?: number | undefined;
212
- mode?: "all" | "any" | "one" | undefined;
213
- } | {
214
210
  requestIds: string[];
215
211
  mode?: "all" | "any" | "one" | undefined;
216
212
  timeoutSeconds?: number | undefined;
213
+ } | {
214
+ workerIds: string[];
215
+ timeoutSeconds?: number | undefined;
216
+ mode?: "all" | "any" | "one" | undefined;
217
217
  } | {
218
218
  peerIds: string[];
219
219
  timeoutSeconds?: number | undefined;
@@ -9,6 +9,7 @@
9
9
  * that implements it. A later slice may move a method between ports when its topic moves. The store stays the only writer of status and exit fields (ADR 0056).
10
10
  */
11
11
  import type { RunStore } from './store.ts';
12
+ import type { TranscriptFacts } from './transcript-facts.ts';
12
13
  export type { RunLifecycleSource } from './lifecycle.ts';
13
14
  /** One run's record, by id. Nearly every caller needs only this. */
14
15
  export interface RunLookup {
@@ -78,11 +79,11 @@ export interface RunEventLog {
78
79
  }
79
80
  /** What the transcript says about a run. The type `TranscriptFacts` is the facts themselves. */
80
81
  export interface TranscriptFactsPort {
81
- transcriptFacts: RunStore['transcriptFacts'];
82
- knownTranscriptFacts: RunStore['knownTranscriptFacts'];
83
- prepareTranscriptFacts: RunStore['prepareTranscriptFacts'];
84
- prepareRecoveryFacts: RunStore['prepareRecoveryFacts'];
85
- factsWarmIdle: RunStore['factsWarmIdle'];
82
+ transcriptFacts(runId: string): Readonly<TranscriptFacts>;
83
+ knownTranscriptFacts(runId: string): Readonly<TranscriptFacts> | undefined;
84
+ prepareTranscriptFacts(runIds: Iterable<string>): Promise<void>;
85
+ prepareRecoveryFacts(familyRootId?: string): Promise<void>;
86
+ factsWarmIdle(): Promise<void>;
86
87
  }
87
88
  /** A worker's collected result. */
88
89
  export interface WorkerResults {
@@ -7,6 +7,8 @@ export { isLiveStatus } from '../contract/index.js';
7
7
  * the live column.
8
8
  */
9
9
  export declare function isLiveRecord(run: RunRecord): boolean;
10
+ /** The family a run belongs to, by its root's id. A worker a worker started is filed under the root too. */
11
+ export declare function familyRootOf(run: Pick<RunRecord, 'id' | 'delegation'>): string | undefined;
10
12
  /** A worker family's root once the family may end (hearsay-tools/squawk#911): archived, settled
11
13
  * (done, failed or cancelled) and not live. A user may archive a running root; that is no end. */
12
14
  export declare function isEndedRoot(run: RunRecord): boolean;
@@ -24,6 +24,14 @@ export function isLiveRecord(run) {
24
24
  return true;
25
25
  return run.stopping !== undefined;
26
26
  }
27
+ /** The family a run belongs to, by its root's id. A worker a worker started is filed under the root too. */
28
+ export function familyRootOf(run) {
29
+ if (run.delegation?.role === 'root')
30
+ return run.id;
31
+ if (run.delegation?.role === 'worker')
32
+ return run.delegation.parentRunId;
33
+ return undefined;
34
+ }
27
35
  /** A worker family's root once the family may end (hearsay-tools/squawk#911): archived, settled
28
36
  * (done, failed or cancelled) and not live. A user may archive a running root; that is no end. */
29
37
  export function isEndedRoot(run) {
@@ -1 +1 @@
1
- {"version":3,"file":"run-row.js","sourceRoot":"","sources":["../../src/runs/run-row.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAMjE,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAE3E;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,GAAc;IACzC,IAAI,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1C,+FAA+F;IAC/F,qDAAqD;IACrD,IAAI,GAAG,CAAC,YAAY,KAAK,SAAS,IAAI,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,KAAK,MAAM,IAAI,IAAI,CAAC,KAAK,KAAK,UAAU,CAAC;QAAE,OAAO,IAAI,CAAC;IACjI,mGAAmG;IACnG,sGAAsG;IACtG,kGAAkG;IAClG,8BAA8B;IAC9B,IAAI,GAAG,CAAC,UAAU,EAAE,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,UAAU,CAAC,OAAO,KAAK,SAAS,IAAI,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC;IAC1I,IAAI,GAAG,CAAC,UAAU,EAAE,IAAI,KAAK,MAAM,IA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AS;QACxB,UAAU,EAAE,GAAG,CAAC,UAAU,IAAI,IAAI;QAClC,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,IAAI,EAAE,YAAY,CAAC,GAAG,CAAC;QACvB,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI;QAC/C,eAAe,EAAE,GAAG,CAAC,eAAe,IAAI,IAAI;QAC5C,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,IAAI;QAC5B,YAAY,EAAE,wBAAwB,CAAC,GAAG,CAAC,IAAI,IAAI;QACnD,MAAM,EAAE,WAAW,CAAC,GAAG,EAAE,MAAM,IAAI,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;QACzG,UAAU,EAAE,GAAG,CAAC,UAAU,IAAI,IAAI;QAClC,IAAI;QACJ,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QAC1C,mBAAmB,EAAE,qBAAqB,CAAC,GAAG,CAAC;QAC/C,cAAc,EAAE,gBAAgB,CAAC,GAAG,CAAC;KACtC,CAAC;AACJ,CAAC;AAED;;4CAE4C;AAC5C,SAAS,WAAW,CAAC,GAAc,EAAE,mBAAuC;IAC1E,OAAO,GAAG,CAAC,MAAM,IAAI,mBAAmB,IAAI,CAAC,GAAG,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACpH,CAAC"}
@@ -9,7 +9,7 @@ import { queuedMessageSchema } from '../contract/index.js';
9
9
  import { type WaitRegistrationReceipt } from '../contract/index.js';
10
10
  import type { ArchiveFinishedScope, ArchivedRunsResponse, ArchivePullRequestIdentity, ConversationState, AgentInput, InboxClaim, DelegationState, MergedPullRequest, RunSummary, Wait, WorkerCollectedResult, WorkerDestroyRetry } from '../contract/index.js';
11
11
  import { type AutomationNames } from '../contract/index.js';
12
- import { type TranscriptFacts } from './transcript-facts.ts';
12
+ import { RunTranscriptFacts } from './transcript-facts-topic.ts';
13
13
  import { type WorkerExecutionIdentity } from '../delegation/execution-identity.ts';
14
14
  import { type WorkerProcessRecord } from '../core/process-stat.ts';
15
15
  import { workflowDefSchema } from '../workflows/types.ts';
@@ -3308,11 +3308,9 @@ export declare class RunStore {
3308
3308
  private readonly unreadable;
3309
3309
  /** Background one-at-a-time compressor for archived transcripts (#818). */
3310
3310
  private readonly compressor;
3311
- /** Transcript facts the delegation paths ask about, so they never re-read a transcript (#880). */
3312
- private readonly facts;
3311
+ /** What the transcript says about a run (hearsay-tools/squawk#4036). */
3312
+ readonly transcriptFacts: RunTranscriptFacts;
3313
3313
  private readonly liveItems;
3314
- private fallbackFacts;
3315
- private factsFor;
3316
3314
  /** Capture both sources on the same synchronous sequence boundary before history IO. */
3317
3315
  liveReadSnapshot(runId: string): {
3318
3316
  events: {
@@ -3935,24 +3933,9 @@ export declare class RunStore {
3935
3933
  * the `CEZ_REDACT_SECRETS=0` opt-out itself so every caller inherits it. */
3936
3934
  redactText(text: string): string;
3937
3935
  private hostSecrets;
3938
- /** The run's indexed transcript facts (#880): a read-only view, never a transcript read once
3939
- * the run's index is loaded. An unreadable transcript answers as empty, as readEvents does. */
3940
- transcriptFacts(runId: string): Readonly<TranscriptFacts>;
3941
- /** The run's transcript facts when they are known: undefined when the transcript exists but its
3942
- * facts are not current or cannot be read, so a caller can tell "no ask" from "no evidence". */
3943
- knownTranscriptFacts(runId: string): Readonly<TranscriptFacts> | undefined;
3944
3936
  hasProjection(runId: string, projectionId: string): boolean;
3945
- private factsWarming;
3946
3937
  /** Indexed family enumeration, including members not yet flushed to SQLite. */
3947
3938
  listFamilyRunIds(rootId: string): string[];
3948
- private recoveryFactIds;
3949
- /** Readiness owns no run snapshot across an await: refresh only the currently held owner. */
3950
- prepareTranscriptFacts(runIds: Iterable<string>): Promise<void>;
3951
- prepareRecoveryFacts(familyRootId?: string): Promise<void>;
3952
- /** Register IDs only here; the index yields between cache reads and off-loop rebuilds. */
3953
- private warmTranscriptFacts;
3954
- /** Resolves when the open-time warm-up is done (tests). */
3955
- factsWarmIdle(): Promise<void>;
3956
3939
  /** `readEvents` off the event loop (async read and async brotli), for collection paths. */
3957
3940
  readEventsAsync(runId: string): Promise<RunEvent[]>;
3958
3941
  readEvents(runId: string): RunEvent[];
@@ -33,7 +33,8 @@ import { matchesRunSearch, sqlPrefilterTokens } from '../contract/index.js';
33
33
  import { storedDelegationStateSchema } from './delegation-state.js';
34
34
  import { HistoryCompressor } from './history-compressor.js';
35
35
  import { LiveItemSnapshots } from './live-item-snapshots.js';
36
- import { emptyFacts, stampOf, TranscriptFactsIndex } from './transcript-facts.js';
36
+ import { stampOf } from './transcript-facts.js';
37
+ import { RunTranscriptFacts } from './transcript-facts-topic.js';
37
38
  import { hasPlainHistory, historyPaths, readHistoryText, readHistoryTextAsync, removeHistory, restoreHistory } from './history-file.js';
38
39
  import { workerExecutionIdentitySchema } from '../delegation/execution-identity.js';
39
40
  import { startToken } from '../core/process-stat.js';
@@ -57,7 +58,7 @@ import { failLoadedInterruptedRun, restoreLoadedUsageLimitHold, settleLoadedStop
57
58
  import { hasLegacyWaitFields, UNREADABLE_WAIT } from './legacy-waits.js';
58
59
  export { ciWaitEntry, holdsWorkerWait, upgradeLegacyWaits, workerWaitEntry } from './legacy-waits.js';
59
60
  import { ExitEvents } from './exit-events.js';
60
- import { encodeRunRow, isLiveRecord, isLiveStatus, materializedWorktreePath } from './run-row.js';
61
+ import { encodeRunRow, familyRootOf, isLiveRecord, isLiveStatus, materializedWorktreePath } from './run-row.js';
61
62
  import { collectRawExtras, encodeRawRecord } from './raw-record.js';
62
63
  import { ColdReadCache, storedRow } from './cold-reads.js';
63
64
  import { assertNoLegacyCockpit, assertNoLegacyWriter, backUpLegacyIndex, LEGACY_INDEX_FILE, LegacyWriterError, readLegacyIndex } from './legacy-index.js';
@@ -198,9 +199,6 @@ const OPEN_RETRY_DELAYS_MS = [50, 100, 200, 400, 800, 1600];
198
199
  function sleepSync(ms) {
199
200
  Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
200
201
  }
201
- /** Runs (and conversation roots, one family query each) the open-time facts warm-up enumerates
202
- * per event-loop turn (hearsay-tools/cezarion#949), so each slice stays a few milliseconds. */
203
- const WARM_IDS_PER_SLICE = 100;
204
202
  const MAX_RUNS_KEPT = 300;
205
203
  /** How many archived root runs the run lists carry per project (#864): `GET /run-summaries?archived=recent`
206
204
  * and `GET /workspace/runs-index`. Unarchived runs are never cut; older archived runs page in
@@ -400,14 +398,6 @@ function decodeArchivedCursor(cursor) {
400
398
  function sortNewestFirst(entries) {
401
399
  return [...entries].sort(([, a], [, b]) => newestFirst(a, b)).map(([item]) => item);
402
400
  }
403
- /** The family a run belongs to, by its root's id. A worker a worker started is filed under the root too. */
404
- function familyRootOf(run) {
405
- if (run.delegation?.role === 'root')
406
- return run.id;
407
- if (run.delegation?.role === 'worker')
408
- return run.delegation.parentRunId;
409
- return undefined;
410
- }
411
401
  /** Tests freeze the copies of cold runs, so an in-place write to one throws instead of vanishing. */
412
402
  function deepFreeze(value) {
413
403
  if (value && typeof value === 'object' && !Object.isFrozen(value)) {
@@ -490,19 +480,25 @@ export class RunStore {
490
480
  unreadable = new Set();
491
481
  /** Background one-at-a-time compressor for archived transcripts (#818). */
492
482
  compressor;
493
- /** Transcript facts the delegation paths ask about, so they never re-read a transcript (#880). */
494
- facts;
483
+ /** What the transcript says about a run (hearsay-tools/squawk#4036). */
484
+ transcriptFacts;
495
485
  liveItems = new LiveItemSnapshots();
496
- fallbackFacts;
497
- factsFor(id) { return this.isFallbackRun(id) ? this.fallbackFacts ??= new TranscriptFactsIndex(this.sourceDataDir(id), true) : this.facts; }
498
486
  /** Capture both sources on the same synchronous sequence boundary before history IO. */
499
487
  liveReadSnapshot(runId) {
500
488
  return { events: this.liveItems.read(runId), throughSeq: this.seqs.get(runId) ?? Infinity };
501
489
  }
502
490
  constructor(dataDir) {
503
491
  this.dataDir = dataDir;
504
- this.facts = new TranscriptFactsIndex(dataDir);
505
- this.compressor = new HistoryCompressor(dataDir, (id) => this.isHistoryCompressEligible(id), (id, plain, archive) => this.facts.adoptArchive(id, plain, stampOf(archive)));
492
+ this.transcriptFacts = new RunTranscriptFacts(dataDir, {
493
+ isFallbackRun: (id) => this.isFallbackRun(id),
494
+ sourceDataDir: (id) => this.sourceDataDir(id),
495
+ isOpen: () => this.db !== null,
496
+ held: this.held,
497
+ listFamilyRunIds: (rootId) => this.listFamilyRunIds(rootId),
498
+ listConversationRootIds: () => this.listConversationRootIds(),
499
+ listRunIds: () => this.listRunIds(),
500
+ });
501
+ this.compressor = new HistoryCompressor(dataDir, (id) => this.isHistoryCompressEligible(id), (id, plain, archive) => this.transcriptFacts.index.adoptArchive(id, plain, stampOf(archive)));
506
502
  }
507
503
  /**
508
504
  * Open the project's run store. See `reconcileLoadedRun` for what `keepLive` (#367) decides
@@ -558,7 +554,7 @@ export class RunStore {
558
554
  store.owner = openClaimSession();
559
555
  if (!maintenance) {
560
556
  store.loadHeldRows();
561
- store.warmTranscriptFacts();
557
+ store.transcriptFacts.warmTranscriptFacts();
562
558
  store.exitEvents.writeLoaded();
563
559
  }
564
560
  }
@@ -1780,7 +1776,7 @@ export class RunStore {
1780
1776
  throw new Error('missing worker continuation target');
1781
1777
  const delegation = delegationStateSchema.parse({ ...run.delegation,
1782
1778
  executionRevision: (run.delegation.executionRevision ?? 0) + 1,
1783
- executionStartSeq: this.transcriptFacts(id).lastSeq,
1779
+ executionStartSeq: this.transcriptFacts.transcriptFacts(id).lastSeq,
1784
1780
  });
1785
1781
  const staged = new Map();
1786
1782
  this.exitEvents.started(id);
@@ -1918,7 +1914,7 @@ export class RunStore {
1918
1914
  completionArchiveBlocker(root) {
1919
1915
  const family = [root, ...this.listWorkersOf(root.id)];
1920
1916
  for (const run of family) {
1921
- const facts = this.factsFor(run.id).peek(run.id);
1917
+ const facts = this.transcriptFacts.factsFor(run.id).peek(run.id);
1922
1918
  if (!facts || !['done', 'review', 'failed', 'cancelled'].includes(run.status) || run.waits?.some(wait => wait.phase === 'open') ||
1923
1919
  run.hasPendingPermission || facts.pendingAsk !== undefined)
1924
1920
  return 'Task or worker work still needs attention. Open the task or archive manually.';
@@ -2125,7 +2121,7 @@ export class RunStore {
2125
2121
  decodeRunRow,
2126
2122
  decodeCold: (row) => this.decodeCold(row),
2127
2123
  writeRefusal: (memberId) => this.writeRefusal(memberId),
2128
- factsPeek: (memberId) => this.factsFor(memberId).peek(memberId),
2124
+ factsPeek: (memberId) => this.transcriptFacts.factsFor(memberId).peek(memberId),
2129
2125
  readWorkerExecution: (memberId) => this.readWorkerExecution(memberId),
2130
2126
  }, id, isActive);
2131
2127
  }
@@ -2154,7 +2150,7 @@ export class RunStore {
2154
2150
  if (ids.length > 1025)
2155
2151
  return;
2156
2152
  for (const memberId of ids)
2157
- await this.factsFor(memberId).ready(memberId);
2153
+ await this.transcriptFacts.factsFor(memberId).ready(memberId);
2158
2154
  }
2159
2155
  archiveOnMergeSnapshot(id, repoBase, isActive = () => false) {
2160
2156
  const family = this.archiveFamily(id, isActive);
@@ -2434,7 +2430,7 @@ export class RunStore {
2434
2430
  restoreHistory(this.dataDir, runId);
2435
2431
  const line = `${JSON.stringify(full)}\n`;
2436
2432
  appendFileSync(this.eventsPath(runId), line, 'utf8');
2437
- this.facts.append(runId, full, Buffer.byteLength(line));
2433
+ this.transcriptFacts.index.append(runId, full, Buffer.byteLength(line));
2438
2434
  this.maybeEnqueueHistoryCompress(run);
2439
2435
  this.liveItems.observe(runId, full, false);
2440
2436
  this.published.publish('run.event', { runId, event: full });
@@ -2554,20 +2550,9 @@ export class RunStore {
2554
2550
  this.secretValues = collectSecretValues();
2555
2551
  return this.secretValues;
2556
2552
  }
2557
- /** The run's indexed transcript facts (#880): a read-only view, never a transcript read once
2558
- * the run's index is loaded. An unreadable transcript answers as empty, as readEvents does. */
2559
- transcriptFacts(runId) {
2560
- return this.factsFor(runId).get(runId) ?? emptyFacts();
2561
- }
2562
- /** The run's transcript facts when they are known: undefined when the transcript exists but its
2563
- * facts are not current or cannot be read, so a caller can tell "no ask" from "no evidence". */
2564
- knownTranscriptFacts(runId) {
2565
- return this.factsFor(runId).peek(runId);
2566
- }
2567
2553
  hasProjection(runId, projectionId) {
2568
- return this.transcriptFacts(runId).projectionIds.includes(projectionId);
2554
+ return this.transcriptFacts.transcriptFacts(runId).projectionIds.includes(projectionId);
2569
2555
  }
2570
- factsWarming = Promise.resolve();
2571
2556
  /** Indexed family enumeration, including members not yet flushed to SQLite. */
2572
2557
  listFamilyRunIds(rootId) {
2573
2558
  const ids = new Set([rootId, ...(this.db?.listIdsByParent(rootId) ?? [])]);
@@ -2581,73 +2566,6 @@ export class RunStore {
2581
2566
  ids.delete(id);
2582
2567
  return [...ids];
2583
2568
  }
2584
- recoveryFactIds(familyRootId) {
2585
- if (familyRootId !== undefined)
2586
- return this.listFamilyRunIds(familyRootId);
2587
- const ids = new Set();
2588
- for (const [id, run] of this.held) {
2589
- if (!isLiveRecord(run))
2590
- continue;
2591
- const root = familyRootOf(run);
2592
- for (const member of root === undefined ? [id] : this.listFamilyRunIds(root))
2593
- ids.add(member);
2594
- }
2595
- return [...ids];
2596
- }
2597
- /** Readiness owns no run snapshot across an await: refresh only the currently held owner. */
2598
- async prepareTranscriptFacts(runIds) {
2599
- for (const id of new Set(runIds)) {
2600
- // Exact sidecars resolve immediately too: recovery must yield to timers/I/O between IDs.
2601
- await new Promise(resolve => setImmediate(resolve));
2602
- await this.factsFor(id).ready(id);
2603
- }
2604
- }
2605
- prepareRecoveryFacts(familyRootId) {
2606
- return this.prepareTranscriptFacts(this.recoveryFactIds(familyRootId));
2607
- }
2608
- /** Register IDs only here; the index yields between cache reads and off-loop rebuilds. */
2609
- warmTranscriptFacts() {
2610
- this.factsWarming = Promise.resolve().then(async () => {
2611
- if (!this.db)
2612
- return;
2613
- const ids = new Set(this.recoveryFactIds());
2614
- // hearsay-tools/cezarion#949: this microtask ends open()'s synchronous slice, and on a
2615
- // large history the JSON scan for conversation roots plus one family query per root cost
2616
- // as much again. Past one slice's worth of runs, yield before the scan and between root
2617
- // batches; a small store (every unit test) still registers in this one microtask.
2618
- const large = this.listRunIds().length > WARM_IDS_PER_SLICE;
2619
- const turn = async () => {
2620
- await new Promise(resolve => setImmediate(resolve));
2621
- return this.db !== null;
2622
- };
2623
- if (large && !await turn())
2624
- return;
2625
- const roots = this.listConversationRootIds();
2626
- for (let i = 0; i < roots.length; i++) {
2627
- if (large && i > 0 && i % WARM_IDS_PER_SLICE === 0 && !await turn())
2628
- return;
2629
- for (const id of this.listFamilyRunIds(roots[i]))
2630
- ids.add(id);
2631
- }
2632
- if (large && !await turn())
2633
- return;
2634
- // Re-list after the yields: a run deleted meanwhile must not be registered again.
2635
- const present = this.listRunIds();
2636
- if (large) {
2637
- const live = new Set(present);
2638
- for (const id of ids)
2639
- if (!live.has(id))
2640
- ids.delete(id);
2641
- }
2642
- for (const id of present)
2643
- ids.add(id);
2644
- await this.facts.warm(ids);
2645
- }).catch(() => undefined);
2646
- }
2647
- /** Resolves when the open-time warm-up is done (tests). */
2648
- factsWarmIdle() {
2649
- return this.factsWarming;
2650
- }
2651
2569
  /** `readEvents` off the event loop (async read and async brotli), for collection paths. */
2652
2570
  async readEventsAsync(runId) {
2653
2571
  try {
@@ -3006,7 +2924,7 @@ export class RunStore {
3006
2924
  }
3007
2925
  /** The run's history, handoff and images, then the removal cleanups (`runs/removal-slots.ts`). */
3008
2926
  removeHistoryFiles(id) {
3009
- this.facts.forget(id);
2927
+ this.transcriptFacts.index.forget(id);
3010
2928
  removeHistory(this.dataDir, id);
3011
2929
  rmSync(this.handoffPath(id), { force: true });
3012
2930
  rmSync(this.imagesDir(id), { recursive: true, force: true });
@@ -3055,7 +2973,7 @@ export class RunStore {
3055
2973
  * resumed event, even across a reload (the frozen-transcript symptom class
3056
2974
  * of #424). One file read on the first post-restart append per run. */
3057
2975
  rehydrateSeq(runId) {
3058
- return this.transcriptFacts(runId).lastSeq;
2976
+ return this.transcriptFacts.transcriptFacts(runId).lastSeq;
3059
2977
  }
3060
2978
  eventsPath(runId) {
3061
2979
  return historyPaths(this.sourceDataDir(runId), runId).plain;
@@ -3382,9 +3300,7 @@ export class RunStore {
3382
3300
  // Demand-bound feeds stop before storage disappears during project removal/shutdown.
3383
3301
  this.published.publish('store.closed', {});
3384
3302
  this.compressor.stop();
3385
- this.fallbackFacts?.stop();
3386
- this.facts.stop();
3387
- this.facts.flush();
3303
+ this.transcriptFacts.stop();
3388
3304
  if (this.saveTimer) {
3389
3305
  clearTimeout(this.saveTimer);
3390
3306
  this.saveTimer = null;