@hearsay-tools/squawk 0.19.0-pr4428.8677 → 0.19.0-pr4429.8683

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.
@@ -7,10 +7,6 @@ export declare function invokeScheduleTaskTool(input: unknown): Promise<{
7
7
  }[];
8
8
  isError: boolean;
9
9
  details: {
10
- ok: false;
11
- code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
12
- message: string;
13
- } | {
14
10
  ok: true;
15
11
  task: {
16
12
  id: string;
@@ -22,6 +18,10 @@ export declare function invokeScheduleTaskTool(input: unknown): Promise<{
22
18
  url?: string | undefined;
23
19
  };
24
20
  note: string;
21
+ } | {
22
+ ok: false;
23
+ code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
24
+ message: string;
25
25
  };
26
26
  }>;
27
27
  export declare function formatScheduleTaskTool(answer: Awaited<ReturnType<typeof callScheduleTask>>): {
@@ -31,10 +31,6 @@ export declare function formatScheduleTaskTool(answer: Awaited<ReturnType<typeof
31
31
  }[];
32
32
  isError: boolean;
33
33
  details: {
34
- ok: false;
35
- code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
36
- message: string;
37
- } | {
38
34
  ok: true;
39
35
  task: {
40
36
  id: string;
@@ -46,6 +42,10 @@ export declare function formatScheduleTaskTool(answer: Awaited<ReturnType<typeof
46
42
  url?: string | undefined;
47
43
  };
48
44
  note: string;
45
+ } | {
46
+ ok: false;
47
+ code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
48
+ message: string;
49
49
  };
50
50
  };
51
51
  export declare function invokeScheduledTasksTool(input: unknown): Promise<{
@@ -72,16 +72,6 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
72
72
  "/discover": {
73
73
  $post: {
74
74
  output: {
75
- scope: "host-default-account";
76
- runners: {
77
- requiresAccountHome?: boolean | undefined;
78
- status: "connected" | "disconnected" | "not-installed" | "unknown";
79
- enabled?: boolean | undefined;
80
- hint?: string | undefined;
81
- authFailureId?: string | undefined;
82
- runner: string;
83
- }[];
84
- } | {
85
75
  runner: string;
86
76
  models: {
87
77
  id: string;
@@ -92,6 +82,16 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
92
82
  source: "cache" | "live" | "unavailable";
93
83
  stale: boolean;
94
84
  reason?: string | undefined;
85
+ } | {
86
+ scope: "host-default-account";
87
+ runners: {
88
+ requiresAccountHome?: boolean | undefined;
89
+ status: "connected" | "disconnected" | "not-installed" | "unknown";
90
+ enabled?: boolean | undefined;
91
+ hint?: string | undefined;
92
+ authFailureId?: string | undefined;
93
+ runner: string;
94
+ }[];
95
95
  } | {
96
96
  tasks: {
97
97
  id: string;
@@ -222,13 +222,13 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
222
222
  status: 200;
223
223
  input: {
224
224
  json: {
225
- workerIds: string[];
226
- timeoutSeconds?: number | undefined;
227
- mode?: "all" | "any" | "one" | undefined;
228
- } | {
229
225
  requestIds: string[];
230
226
  mode?: "all" | "any" | "one" | undefined;
231
227
  timeoutSeconds?: number | undefined;
228
+ } | {
229
+ workerIds: string[];
230
+ timeoutSeconds?: number | undefined;
231
+ mode?: "all" | "any" | "one" | undefined;
232
232
  } | {
233
233
  peerIds: string[];
234
234
  timeoutSeconds?: number | undefined;
@@ -1,10 +1,13 @@
1
1
  import { type FactsLoadResult } from './transcript-facts-load.ts';
2
+ import { type SidecarCommit } from './transcript-facts-sidecar.ts';
2
3
  export declare const REFRESH_FACTS: unique symbol;
3
4
  /** One owner per run, one active worker load. Both receive paths settle the same job. */
4
5
  export declare class TranscriptFactsQueue<T> {
5
6
  private readonly dataDir;
6
7
  private readonly accept;
7
8
  private readonly cached?;
9
+ /** Where the worker commits the sidecar of a load that needs one; absent: it commits none. */
10
+ private readonly sidecarPath?;
8
11
  private readonly jobs;
9
12
  private pendingHead?;
10
13
  private pendingTail?;
@@ -13,11 +16,15 @@ export declare class TranscriptFactsQueue<T> {
13
16
  private workerLifecycle?;
14
17
  private dispatch?;
15
18
  private stopped;
16
- constructor(dataDir: string, accept: (runId: string, loaded: FactsLoadResult | undefined, serialized?: string) => T | typeof REFRESH_FACTS, cached?: ((runId: string) => T | undefined) | undefined);
19
+ constructor(dataDir: string, accept: (runId: string, loaded: FactsLoadResult | undefined, sidecar?: SidecarCommit) => T | typeof REFRESH_FACTS, cached?: ((runId: string) => T | undefined) | undefined,
20
+ /** Where the worker commits the sidecar of a load that needs one; absent: it commits none. */
21
+ sidecarPath?: ((runId: string) => string) | undefined);
17
22
  has(runId: string): boolean;
18
23
  request(runId: string, demand?: boolean): Promise<T>;
19
24
  /** Exceptional compatibility path: take a queued job, but NEVER refold an active one. */
20
25
  join(runId: string): T;
26
+ /** The caller writes this run's sidecar itself: the active worker job must not overwrite it. */
27
+ revoke(runId: string): void;
21
28
  forget(runId: string): void;
22
29
  stop(): void;
23
30
  private enqueueBack;
@@ -29,6 +36,7 @@ export declare class TranscriptFactsQueue<T> {
29
36
  private complete;
30
37
  private release;
31
38
  private settle;
39
+ /** `exited`: the worker already stopped on its own ('error' or 'exit'). */
32
40
  private disposeWorker;
33
41
  private fail;
34
42
  }
@@ -1,5 +1,6 @@
1
1
  import { MessageChannel, receiveMessageOnPort, Worker } from 'node:worker_threads';
2
2
  import { loadTranscriptFacts } from './transcript-facts-load.js';
3
+ import { RESULT_SLOT, revokeSidecar, SIGNAL_BYTES } from './transcript-facts-sidecar.js';
3
4
  export const REFRESH_FACTS = Symbol('transcript changed');
4
5
  const JOB_TIMEOUT_MS = 30_000;
5
6
  const MAX_ATTEMPTS = 3;
@@ -8,6 +9,7 @@ export class TranscriptFactsQueue {
8
9
  dataDir;
9
10
  accept;
10
11
  cached;
12
+ sidecarPath;
11
13
  jobs = new Map();
12
14
  pendingHead;
13
15
  pendingTail;
@@ -16,10 +18,13 @@ export class TranscriptFactsQueue {
16
18
  workerLifecycle;
17
19
  dispatch;
18
20
  stopped = false;
19
- constructor(dataDir, accept, cached) {
21
+ constructor(dataDir, accept, cached,
22
+ /** Where the worker commits the sidecar of a load that needs one; absent: it commits none. */
23
+ sidecarPath) {
20
24
  this.dataDir = dataDir;
21
25
  this.accept = accept;
22
26
  this.cached = cached;
27
+ this.sidecarPath = sidecarPath;
23
28
  }
24
29
  has(runId) { return this.jobs.has(runId); }
25
30
  request(runId, demand = true) {
@@ -60,7 +65,7 @@ export class TranscriptFactsQueue {
60
65
  break;
61
66
  const active = this.active;
62
67
  const remaining = deadline - Date.now();
63
- if (remaining <= 0 || Atomics.wait(active.signal, 0, 0, remaining) === 'timed-out') {
68
+ if (remaining <= 0 || Atomics.wait(active.signal, RESULT_SLOT, 0, remaining) === 'timed-out') {
64
69
  this.fail(new Error(`Transcript facts worker timed out for ${runId}`));
65
70
  break;
66
71
  }
@@ -75,6 +80,11 @@ export class TranscriptFactsQueue {
75
80
  throw job.error;
76
81
  return job.value;
77
82
  }
83
+ /** The caller writes this run's sidecar itself: the active worker job must not overwrite it. */
84
+ revoke(runId) {
85
+ if (this.active?.runId === runId && this.active.signal)
86
+ revokeSidecar(this.active.signal);
87
+ }
78
88
  forget(runId) {
79
89
  const job = this.jobs.get(runId);
80
90
  if (!job)
@@ -150,10 +160,10 @@ export class TranscriptFactsQueue {
150
160
  const worker = new Worker(url, { execArgv: [], workerData: { lifecycle: lifecycle.buffer } });
151
161
  this.workerLifecycle = lifecycle;
152
162
  worker.on('error', (error) => { if (this.worker === worker)
153
- this.fail(error); });
163
+ this.fail(error, true); });
154
164
  worker.on('exit', (code) => {
155
165
  if (this.worker === worker)
156
- this.fail(new Error(`Transcript facts worker exited (${code})`));
166
+ this.fail(new Error(`Transcript facts worker exited (${code})`), true);
157
167
  });
158
168
  return worker;
159
169
  }
@@ -170,10 +180,11 @@ export class TranscriptFactsQueue {
170
180
  this.worker ??= this.createWorker();
171
181
  const { port1, port2 } = new MessageChannel();
172
182
  job.port = port1;
173
- job.signal = new Int32Array(new SharedArrayBuffer(4));
183
+ job.signal = new Int32Array(new SharedArrayBuffer(SIGNAL_BYTES));
174
184
  port1.once('message', (reply) => this.complete(job, reply));
175
185
  job.timer = setTimeout(() => this.fail(new Error(`Transcript facts worker timed out for ${job.runId}`)), JOB_TIMEOUT_MS);
176
- const message = { dataDir: this.dataDir, runId: job.runId, port: port2, signal: job.signal.buffer };
186
+ const message = { dataDir: this.dataDir, runId: job.runId, port: port2,
187
+ signal: job.signal.buffer, sidecar: this.sidecarPath?.(job.runId) };
177
188
  try {
178
189
  this.worker.postMessage(message, [port2]);
179
190
  }
@@ -194,7 +205,7 @@ export class TranscriptFactsQueue {
194
205
  return;
195
206
  }
196
207
  try {
197
- const value = this.accept(job.runId, reply.result, reply.serialized);
208
+ const value = this.accept(job.runId, reply.result, reply.sidecar);
198
209
  if (value === REFRESH_FACTS) {
199
210
  this.release(job);
200
211
  if (job.attempts >= MAX_ATTEMPTS) {
@@ -232,7 +243,11 @@ export class TranscriptFactsQueue {
232
243
  job.resolve(value);
233
244
  this.schedule();
234
245
  }
235
- disposeWorker() {
246
+ /** `exited`: the worker already stopped on its own ('error' or 'exit'). */
247
+ disposeWorker(exited = false) {
248
+ // Revoke before terminating: a terminated worker could leave a rename half-signalled.
249
+ if (this.active?.signal)
250
+ revokeSidecar(this.active.signal, !exited);
236
251
  const worker = this.worker;
237
252
  const lifecycle = this.workerLifecycle;
238
253
  this.worker = undefined;
@@ -254,8 +269,8 @@ export class TranscriptFactsQueue {
254
269
  }
255
270
  void worker.terminate().catch(() => undefined);
256
271
  }
257
- fail(error) {
258
- this.disposeWorker();
272
+ fail(error, exited = false) {
273
+ this.disposeWorker(exited);
259
274
  if (this.dispatch)
260
275
  clearImmediate(this.dispatch);
261
276
  this.dispatch = undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"transcript-facts-queue.js","sourceRoot":"","sources":["../../src/runs/transcript-facts-queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,EAAoB,MAAM,qBAAqB,C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AAC,CAAC,CAAC;gBACjD,OAAO;YACT,CAAC;QACH,CAAC;QACD,KAAK,MAAM,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IACjD,CAAC;IAEO,IAAI,CAAC,KAAY,EAAE,MAAM,GAAG,KAAK;QACvC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC3B,IAAI,IAAI,CAAC,QAAQ;YAAE,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjD,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC1B,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAAE,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAChE,CAAC;CACF"}
@@ -0,0 +1,22 @@
1
+ /** Int32 slots of a job's shared signal buffer. */
2
+ export declare const RESULT_SLOT = 0;
3
+ export declare const COMMIT_SLOT = 1;
4
+ export declare const SIGNAL_BYTES = 8;
5
+ export declare const RENAMING = 1;
6
+ export declare const SETTLED = 2;
7
+ /** What the worker did with the sidecar it was asked to commit. */
8
+ export type SidecarCommit = {
9
+ written: boolean;
10
+ } | {
11
+ error: string;
12
+ cleaned: boolean;
13
+ };
14
+ export declare function tempSidecarPath(path: string): string;
15
+ /** Worker side: write a temp file, then rename it over `path` unless the job was revoked. */
16
+ export declare function commitSidecar(path: string, serialized: string, signal: Int32Array): SidecarCommit;
17
+ /** Index side: after this returns, the worker renames no sidecar for this job. A rename already
18
+ * under way finishes first, so a caller that removes or rewrites the sidecar next wins. The wait
19
+ * has no deadline: a live worker leaves RENAMING right after its rename, and a timed-out wait
20
+ * could let it rename later. Pass `workerAlive` false once the worker has exited; it renames
21
+ * nothing more, and its slot may never leave RENAMING. */
22
+ export declare function revokeSidecar(signal: Int32Array, workerAlive?: boolean): void;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Sidecar commits shared by the index and the facts worker. The worker commits the sidecar its
3
+ * load rebuilt, off the main thread. The index can revoke that commit first: after a revoke, the
4
+ * worker renames nothing for the job, so a forgotten run never gets a late sidecar.
5
+ */
6
+ import { randomBytes } from 'node:crypto';
7
+ import { renameSync, rmSync, writeFileSync } from 'node:fs';
8
+ /** Int32 slots of a job's shared signal buffer. */
9
+ export const RESULT_SLOT = 0;
10
+ export const COMMIT_SLOT = 1;
11
+ export const SIGNAL_BYTES = 8;
12
+ const OPEN = 0;
13
+ export const RENAMING = 1;
14
+ export const SETTLED = 2;
15
+ const REVOKED = 3;
16
+ export function tempSidecarPath(path) {
17
+ return `${path}.${process.pid}.${randomBytes(6).toString('hex')}.tmp`;
18
+ }
19
+ /** Worker side: write a temp file, then rename it over `path` unless the job was revoked. */
20
+ export function commitSidecar(path, serialized, signal) {
21
+ const tmp = tempSidecarPath(path);
22
+ try {
23
+ writeFileSync(tmp, serialized, { mode: 0o600 });
24
+ if (Atomics.compareExchange(signal, COMMIT_SLOT, OPEN, RENAMING) !== OPEN) {
25
+ rmSync(tmp, { force: true });
26
+ return { written: false };
27
+ }
28
+ try {
29
+ renameSync(tmp, path);
30
+ }
31
+ finally {
32
+ Atomics.store(signal, COMMIT_SLOT, SETTLED);
33
+ Atomics.notify(signal, COMMIT_SLOT);
34
+ }
35
+ return { written: true };
36
+ }
37
+ catch (error) {
38
+ let cleaned = true;
39
+ try {
40
+ rmSync(tmp, { force: true });
41
+ }
42
+ catch {
43
+ cleaned = false;
44
+ }
45
+ return { error: error.message, cleaned };
46
+ }
47
+ }
48
+ /** Index side: after this returns, the worker renames no sidecar for this job. A rename already
49
+ * under way finishes first, so a caller that removes or rewrites the sidecar next wins. The wait
50
+ * has no deadline: a live worker leaves RENAMING right after its rename, and a timed-out wait
51
+ * could let it rename later. Pass `workerAlive` false once the worker has exited; it renames
52
+ * nothing more, and its slot may never leave RENAMING. */
53
+ export function revokeSidecar(signal, workerAlive = true) {
54
+ if (Atomics.compareExchange(signal, COMMIT_SLOT, OPEN, REVOKED) !== RENAMING || !workerAlive)
55
+ return;
56
+ while (Atomics.load(signal, COMMIT_SLOT) === RENAMING)
57
+ Atomics.wait(signal, COMMIT_SLOT, RENAMING);
58
+ }
59
+ //# sourceMappingURL=transcript-facts-sidecar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcript-facts-sidecar.js","sourceRoot":"","sources":["../../src/runs/transcript-facts-sidecar.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE5D,mDAAmD;AACnD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAC7B,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAC7B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC;AAC9B,MAAM,IAAI,GAAG,CAAC,CAAC;AACf,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC;AAC1B,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC;AACzB,MAAM,OAAO,GAAG,CAAC,CAAC;AAKlB,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;AACxE,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,UAAkB,EAAE,MAAkB;IAChF,MAAM,GAAG,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,CAAC;QACH,aAAa,CAAC,GAAG,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAChD,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,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ode/fold, and commits the sidecar a load rebuilt unless the index revoked it. */
2
2
  import { type MessagePort } from 'node:worker_threads';
3
3
  import { type FactsLoadResult } from './transcript-facts-load.ts';
4
+ import { type SidecarCommit } from './transcript-facts-sidecar.ts';
4
5
  export interface FactsJobMessage {
5
6
  dataDir: string;
6
7
  runId: string;
7
8
  port: MessagePort;
8
9
  signal: SharedArrayBuffer;
10
+ /** Where to commit the sidecar of a load that needs one. Absent for read-only indexes. */
11
+ sidecar?: string | undefined;
9
12
  }
10
13
  export type FactsJobReply = {
11
14
  result: FactsLoadResult | undefined;
12
- serialized?: string;
15
+ sidecar?: SidecarCommit;
13
16
  } | {
14
17
  error: string;
15
18
  };
@@ -1,6 +1,7 @@
1
- /** Worker owns reads/decode/fold only. The index alone may commit a sidecar. */
1
+ /** Worker owns reads/decode/fold, and commits the sidecar a load rebuilt unless the index revoked it. */
2
2
  import { parentPort, workerData } from 'node:worker_threads';
3
3
  import { loadTranscriptFacts } from './transcript-facts-load.js';
4
+ import { commitSidecar, RESULT_SLOT } from './transcript-facts-sidecar.js';
4
5
  // Static dependencies have finished importing before this module body runs.
5
6
  // Publish readiness before checking cancellation so either side owns shutdown.
6
7
  const lifecycle = new Int32Array(workerData.lifecycle);
@@ -8,19 +9,21 @@ Atomics.store(lifecycle, 0, 1);
8
9
  if (Atomics.load(lifecycle, 1) === 1)
9
10
  parentPort.close();
10
11
  else
11
- parentPort.on('message', ({ dataDir, runId, port, signal }) => {
12
+ parentPort.on('message', ({ dataDir, runId, port, signal, sidecar }) => {
13
+ const slots = new Int32Array(signal);
12
14
  let reply;
13
15
  try {
14
16
  const result = loadTranscriptFacts(dataDir, runId);
15
- reply = { result, ...(result?.needsWrite ? { serialized: JSON.stringify(result.facts) } : {}) };
17
+ reply = { result, ...(sidecar && result?.needsWrite
18
+ ? { sidecar: commitSidecar(sidecar, JSON.stringify(result.facts), slots) } : {}) };
16
19
  }
17
20
  catch (error) {
18
21
  reply = { error: String(error) };
19
22
  }
20
23
  // Publication precedes notification: a blocking parent can consume this exact result.
21
24
  port.postMessage(reply);
22
- Atomics.store(new Int32Array(signal), 0, 1);
23
- Atomics.notify(new Int32Array(signal), 0);
25
+ Atomics.store(slots, RESULT_SLOT, 1);
26
+ Atomics.notify(slots, RESULT_SLOT);
24
27
  port.close();
25
28
  });
26
29
  //# sourceMappingURL=transcript-facts-worker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transcript-facts-worker.js","sourceRoot":"","sources":["../../src/runs/transcript-facts-worker.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,OAAO,EAAE,UAAU,EAAE,UAAU,EAAoB,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAwB,MAAM,4BAA4B,CAAC;AAUvF,4EAA4E;AAC5E,+EAA+E;AAC/E,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACvD,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/B,IAAI,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC;IAAE,UAAW,CAAC,KAAK,EAAE,CAAC;;IACrD,UAAW,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAmB,EAAE,EAAE;QACnF,IAAI,KAAoB,CAAC;QACzB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YACnD,KAAK,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QAClG,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,KAAK,GA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,CAAC,CAAC;YACnD,KAAK,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,IAAI,MAAM,EAAE,UAAU;oBACjD,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QACvF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,KAAK,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QACnC,CAAC;QACD,sFAAsF;QACtF,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACxB,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;QACrC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QACnC,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC,CAAC,CAAC"}
@@ -32,9 +32,13 @@ export declare class TranscriptFactsIndex {
32
32
  /** Stop warming (store close). */
33
33
  stop(): void;
34
34
  private entry;
35
+ /** `sidecar` is the worker's commit; without one, a load that needs a sidecar writes it here. */
35
36
  private accept;
37
+ /** False when a failed write left a temp file behind: do not cache that entry. */
38
+ private recordWrite;
36
39
  /** A cache hit costs one stat (two once archived): the run may have changed hands (a second
37
40
  * process on the project, an adopted family) since these facts were cached. */
38
41
  private current;
39
42
  private persist;
43
+ private warnWrite;
40
44
  }
@@ -2,12 +2,12 @@
2
2
  * Incremental transcript facts for delivery and delegation reconciliation. Keep history
3
3
  * authoritative and sidecars rebuildable; avoid whole-transcript reads on hot paths.
4
4
  */
5
- import { randomBytes } from 'node:crypto';
6
5
  import { renameSync, rmSync, writeFileSync } from 'node:fs';
7
6
  import { historyPaths, historyStat } from './history-file.js';
8
7
  export { emptyFacts, foldEvent, foldText, stampOf, PROSE_HUMAN_GATE, workerOutcomeKey } from './transcript-facts-fold.js';
9
8
  import { emptyFacts, foldEvent, sameStamp, stampOf } from './transcript-facts-fold.js';
10
9
  import { readFactsSidecar } from './transcript-facts-load.js';
10
+ import { tempSidecarPath } from './transcript-facts-sidecar.js';
11
11
  import { REFRESH_FACTS, TranscriptFactsQueue } from './transcript-facts-queue.js';
12
12
  /**
13
13
  * Per-run facts sidecar, updated on append and validated by plain byte length or archive
@@ -23,7 +23,7 @@ export class TranscriptFactsIndex {
23
23
  constructor(dataDir, readOnly = false) {
24
24
  this.dataDir = dataDir;
25
25
  this.readOnly = readOnly;
26
- this.queue = new TranscriptFactsQueue(dataDir, (id, loaded, serialized) => this.accept(id, loaded, serialized), (id) => this.peek(id) ? this.entries.get(id) : undefined);
26
+ this.queue = new TranscriptFactsQueue(dataDir, (id, loaded, sidecar) => this.accept(id, loaded, sidecar), (id) => this.peek(id) ? this.entries.get(id) : undefined, readOnly ? undefined : (id) => historyPaths(dataDir, id).facts);
27
27
  }
28
28
  /** Read only an already-current entry or exact sidecar; never decode/fold history. */
29
29
  peek(runId) {
@@ -134,7 +134,8 @@ export class TranscriptFactsIndex {
134
134
  return undefined;
135
135
  return this.queue.join(runId);
136
136
  }
137
- accept(runId, loaded, serialized) {
137
+ /** `sidecar` is the worker's commit; without one, a load that needs a sidecar writes it here. */
138
+ accept(runId, loaded, sidecar) {
138
139
  const newer = this.entries.get(runId);
139
140
  if (newer && this.current(runId, newer.facts))
140
141
  return newer;
@@ -143,16 +144,30 @@ export class TranscriptFactsIndex {
143
144
  if (!this.current(runId, loaded.facts))
144
145
  return REFRESH_FACTS;
145
146
  const entry = { facts: loaded.facts, written: loaded.written };
146
- try {
147
- if (loaded.needsWrite)
148
- this.persist(runId, entry, serialized);
149
- }
150
- catch {
147
+ if (loaded.needsWrite && !this.recordWrite(runId, entry, sidecar))
151
148
  return undefined;
152
- }
153
149
  this.entries.set(runId, entry);
154
150
  return entry;
155
151
  }
152
+ /** False when a failed write left a temp file behind: do not cache that entry. */
153
+ recordWrite(runId, entry, sidecar) {
154
+ if (!sidecar) {
155
+ try {
156
+ this.persist(runId, entry);
157
+ }
158
+ catch {
159
+ return false;
160
+ }
161
+ return true;
162
+ }
163
+ if ('error' in sidecar) {
164
+ this.warnWrite(runId, sidecar.error);
165
+ return sidecar.cleaned;
166
+ }
167
+ if (sidecar.written)
168
+ entry.written = entry.facts.bytes;
169
+ return true;
170
+ }
156
171
  /** A cache hit costs one stat (two once archived): the run may have changed hands (a second
157
172
  * process on the project, an adopted family) since these facts were cached. */
158
173
  current(runId, facts) {
@@ -168,25 +183,30 @@ export class TranscriptFactsIndex {
168
183
  return false;
169
184
  }
170
185
  }
171
- persist(runId, entry, serialized) {
186
+ persist(runId, entry) {
172
187
  if (this.readOnly) {
173
188
  entry.written = entry.facts.bytes;
174
189
  return;
175
190
  }
191
+ // A worker load of this run must not rename its older snapshot over this write.
192
+ this.queue.revoke(runId);
176
193
  const path = historyPaths(this.dataDir, runId).facts;
177
- const tmp = `${path}.${process.pid}.${randomBytes(6).toString('hex')}.tmp`;
194
+ const tmp = tempSidecarPath(path);
178
195
  try {
179
- writeFileSync(tmp, serialized ?? JSON.stringify(entry.facts), { mode: 0o600 });
196
+ writeFileSync(tmp, JSON.stringify(entry.facts), { mode: 0o600 });
180
197
  renameSync(tmp, path);
181
198
  entry.written = entry.facts.bytes;
182
199
  }
183
200
  catch (error) {
184
201
  rmSync(tmp, { force: true });
185
- if (!this.warnedWrite.has(runId)) {
186
- this.warnedWrite.add(runId);
187
- console.warn(`[hsq] could not save transcript facts for ${runId}: ${error.message}`);
188
- }
202
+ this.warnWrite(runId, error.message);
189
203
  }
190
204
  }
205
+ warnWrite(runId, message) {
206
+ if (this.warnedWrite.has(runId))
207
+ return;
208
+ this.warnedWrite.add(runId);
209
+ console.warn(`[hsq] could not save transcript facts for ${runId}: ${message}`);
210
+ }
191
211
  }
192
212
  //# sourceMappingURL=transcript-facts.js.map
@@ -1 +1 @@
1
- {"version":3,"file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e,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,CAAC;YACH,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;YACjE,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YACtB,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;QACpC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YAC7B,IAAI,CAAC,SAAS,CAAC,KAAK,EAAG,KAAe,CAAC,OAAO,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;IAEO,SAAS,CAAC,KAAa,EAAE,OAAe;QAC9C,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,OAAO;QACxC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC5B,OAAO,CAAC,IAAI,CAAC,6CAA6C,KAAK,KAAK,OAAO,EAAE,CAAC,CAAC;IACjF,CAAC;CACF"}
@@ -16,6 +16,12 @@ export declare function createLiveRoutes({ resolveProject, serverGeneration, res
16
16
  output: {
17
17
  generation: string;
18
18
  results: ({
19
+ projectId: string;
20
+ runId: string;
21
+ type: "error" | "reset";
22
+ status: 400 | 404 | 409 | 413 | 503;
23
+ error: string;
24
+ } | {
19
25
  projectId: string;
20
26
  runId: string;
21
27
  type: "batch";
@@ -36,12 +42,6 @@ export declare function createLiveRoutes({ resolveProject, serverGeneration, res
36
42
  cursor: string;
37
43
  afterSeq: number;
38
44
  hasMore: boolean;
39
- } | {
40
- projectId: string;
41
- runId: string;
42
- type: "error" | "reset";
43
- status: 400 | 404 | 409 | 413 | 503;
44
- error: string;
45
45
  })[];
46
46
  };
47
47
  outputFormat: "json";
@@ -315,19 +315,6 @@ export declare function createRepoRoutes(deps: RepoRouteDeps): import("hono/hono
315
315
  } & {
316
316
  "/repo/commit/:sha": {
317
317
  $get: {
318
- output: string;
319
- outputFormat: "text";
320
- status: import("hono/utils/http-status").ContentfulStatusCode;
321
- input: {
322
- query: {
323
- structured?: string | undefined;
324
- };
325
- } & {
326
- param: {
327
- sha: string;
328
- };
329
- };
330
- } | {
331
318
  output: {
332
319
  error: string;
333
320
  code?: "invalid_input" | undefined;
@@ -391,6 +378,19 @@ export declare function createRepoRoutes(deps: RepoRouteDeps): import("hono/hono
391
378
  sha: string;
392
379
  };
393
380
  };
381
+ } | {
382
+ output: string;
383
+ outputFormat: "text";
384
+ status: import("hono/utils/http-status").ContentfulStatusCode;
385
+ input: {
386
+ query: {
387
+ structured?: string | undefined;
388
+ };
389
+ } & {
390
+ param: {
391
+ sha: string;
392
+ };
393
+ };
394
394
  };
395
395
  };
396
396
  } & {
@@ -3065,12 +3065,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
3065
3065
  output: {
3066
3066
  generation: string;
3067
3067
  results: ({
3068
- projectId: string;
3069
- runId: string;
3070
- type: "error" | "reset";
3071
- status: 400 | 404 | 409 | 413 | 503;
3072
- error: string;
3073
- } | {
3074
3068
  projectId: string;
3075
3069
  runId: string;
3076
3070
  type: "batch";
@@ -3091,6 +3085,12 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
3091
3085
  cursor: string;
3092
3086
  afterSeq: number;
3093
3087
  hasMore: boolean;
3088
+ } | {
3089
+ projectId: string;
3090
+ runId: string;
3091
+ type: "error" | "reset";
3092
+ status: 400 | 404 | 409 | 413 | 503;
3093
+ error: string;
3094
3094
  })[];
3095
3095
  };
3096
3096
  outputFormat: "json";
@@ -4720,19 +4720,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4720
4720
  } & {
4721
4721
  "/repo/commit/:sha": {
4722
4722
  $get: {
4723
- output: string;
4724
- outputFormat: "text";
4725
- status: import("hono/utils/http-status").ContentfulStatusCode;
4726
- input: {
4727
- query: {
4728
- structured?: string | undefined;
4729
- };
4730
- } & {
4731
- param: {
4732
- sha: string;
4733
- };
4734
- };
4735
- } | {
4736
4723
  output: {
4737
4724
  error: string;
4738
4725
  code?: "invalid_input" | undefined;
@@ -4796,6 +4783,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4796
4783
  sha: string;
4797
4784
  };
4798
4785
  };
4786
+ } | {
4787
+ output: string;
4788
+ outputFormat: "text";
4789
+ status: import("hono/utils/http-status").ContentfulStatusCode;
4790
+ input: {
4791
+ query: {
4792
+ structured?: string | undefined;
4793
+ };
4794
+ } & {
4795
+ param: {
4796
+ sha: string;
4797
+ };
4798
+ };
4799
4799
  };
4800
4800
  };
4801
4801
  } & {
@@ -19290,20 +19290,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
19290
19290
  } & {
19291
19291
  "/runs/:id/handoff": {
19292
19292
  $get: {
19293
- output: string;
19294
- outputFormat: "text";
19295
- status: 200;
19293
+ output: {
19294
+ error: string;
19295
+ };
19296
+ outputFormat: "json";
19297
+ status: 404;
19296
19298
  input: {
19297
19299
  param: {
19298
19300
  id: string;
19299
19301
  };
19300
19302
  };
19301
19303
  } | {
19302
- output: {
19303
- error: string;
19304
- };
19305
- outputFormat: "json";
19306
- status: 404;
19304
+ output: string;
19305
+ outputFormat: "text";
19306
+ status: 200;
19307
19307
  input: {
19308
19308
  param: {
19309
19309
  id: string;
@@ -19341,20 +19341,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
19341
19341
  } & {
19342
19342
  "/runs/:id/diff": {
19343
19343
  $get: {
19344
- output: string;
19345
- outputFormat: "text";
19346
- status: import("hono/utils/http-status").ContentfulStatusCode;
19344
+ output: {
19345
+ error: string;
19346
+ };
19347
+ outputFormat: "json";
19348
+ status: 404 | 409;
19347
19349
  input: {
19348
19350
  param: {
19349
19351
  id: string;
19350
19352
  };
19351
19353
  };
19352
19354
  } | {
19353
- output: {
19354
- error: string;
19355
- };
19356
- outputFormat: "json";
19357
- status: 404 | 409;
19355
+ output: string;
19356
+ outputFormat: "text";
19357
+ status: import("hono/utils/http-status").ContentfulStatusCode;
19358
19358
  input: {
19359
19359
  param: {
19360
19360
  id: string;
@@ -21489,19 +21489,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
21489
21489
  } & {
21490
21490
  "/repo/commit/:sha": {
21491
21491
  $get: {
21492
- output: string;
21493
- outputFormat: "text";
21494
- status: import("hono/utils/http-status").ContentfulStatusCode;
21495
- input: {
21496
- query: {
21497
- structured?: string | undefined;
21498
- };
21499
- } & {
21500
- param: {
21501
- sha: string;
21502
- };
21503
- };
21504
- } | {
21505
21492
  output: {
21506
21493
  error: string;
21507
21494
  code?: "invalid_input" | undefined;
@@ -21565,6 +21552,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
21565
21552
  sha: string;
21566
21553
  };
21567
21554
  };
21555
+ } | {
21556
+ output: string;
21557
+ outputFormat: "text";
21558
+ status: import("hono/utils/http-status").ContentfulStatusCode;
21559
+ input: {
21560
+ query: {
21561
+ structured?: string | undefined;
21562
+ };
21563
+ } & {
21564
+ param: {
21565
+ sha: string;
21566
+ };
21567
+ };
21568
21568
  };
21569
21569
  };
21570
21570
  } & {
@@ -36059,20 +36059,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
36059
36059
  } & {
36060
36060
  "/runs/:id/handoff": {
36061
36061
  $get: {
36062
- output: string;
36063
- outputFormat: "text";
36064
- status: 200;
36062
+ output: {
36063
+ error: string;
36064
+ };
36065
+ outputFormat: "json";
36066
+ status: 404;
36065
36067
  input: {
36066
36068
  param: {
36067
36069
  id: string;
36068
36070
  };
36069
36071
  };
36070
36072
  } | {
36071
- output: {
36072
- error: string;
36073
- };
36074
- outputFormat: "json";
36075
- status: 404;
36073
+ output: string;
36074
+ outputFormat: "text";
36075
+ status: 200;
36076
36076
  input: {
36077
36077
  param: {
36078
36078
  id: string;
@@ -36110,20 +36110,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
36110
36110
  } & {
36111
36111
  "/runs/:id/diff": {
36112
36112
  $get: {
36113
- output: string;
36114
- outputFormat: "text";
36115
- status: import("hono/utils/http-status").ContentfulStatusCode;
36113
+ output: {
36114
+ error: string;
36115
+ };
36116
+ outputFormat: "json";
36117
+ status: 404 | 409;
36116
36118
  input: {
36117
36119
  param: {
36118
36120
  id: string;
36119
36121
  };
36120
36122
  };
36121
36123
  } | {
36122
- output: {
36123
- error: string;
36124
- };
36125
- outputFormat: "json";
36126
- status: 404 | 409;
36124
+ output: string;
36125
+ outputFormat: "text";
36126
+ status: import("hono/utils/http-status").ContentfulStatusCode;
36127
36127
  input: {
36128
36128
  param: {
36129
36129
  id: string;
@@ -7,12 +7,6 @@ export declare function createWorkspaceLiveRoutes(live: Parameters<typeof create
7
7
  output: {
8
8
  generation: string;
9
9
  results: ({
10
- projectId: string;
11
- runId: string;
12
- type: "error" | "reset";
13
- status: 400 | 404 | 409 | 413 | 503;
14
- error: string;
15
- } | {
16
10
  projectId: string;
17
11
  runId: string;
18
12
  type: "batch";
@@ -33,6 +27,12 @@ export declare function createWorkspaceLiveRoutes(live: Parameters<typeof create
33
27
  cursor: string;
34
28
  afterSeq: number;
35
29
  hasMore: boolean;
30
+ } | {
31
+ projectId: string;
32
+ runId: string;
33
+ type: "error" | "reset";
34
+ status: 400 | 404 | 409 | 413 | 503;
35
+ error: string;
36
36
  })[];
37
37
  };
38
38
  outputFormat: "json";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hearsay-tools/squawk",
3
- "version": "0.19.0-pr4428.8677",
3
+ "version": "0.19.0-pr4429.8683",
4
4
  "description": "Local cockpit for running and tracking AI agent tasks in your repo. Uses your logged-in `claude` CLI and `gh` — zero config, zero database.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -69,8 +69,8 @@
69
69
  "devDependencies": {
70
70
  "@babel/parser": "^8.0.8",
71
71
  "@babel/types": "^8.0.8",
72
- "@open-mercato/cezar-api-client": "0.19.0-pr4428.8677",
73
- "@open-mercato/cezar-contract": "0.19.0-pr4428.8677",
72
+ "@open-mercato/cezar-api-client": "0.19.0-pr4429.8683",
73
+ "@open-mercato/cezar-contract": "0.19.0-pr4429.8683",
74
74
  "@types/node": "^24.19.1",
75
75
  "@types/ws": "^8.18.1",
76
76
  "esbuild": "^0.28.1",
@@ -87,5 +87,5 @@
87
87
  "publishConfig": {
88
88
  "access": "public"
89
89
  },
90
- "gitHead": "bfd9007bb48d999520befc9e9392bae9a2c05b6e"
90
+ "gitHead": "2a643f3c151b7ac6a5c22a5a067b7637dc1f3d71"
91
91
  }
@@ -9,9 +9,10 @@ import { tmpdir } from 'node:os';
9
9
  import { join } from 'node:path';
10
10
  import { setTimeout as delay } from 'node:timers/promises';
11
11
  import { PerformanceObserver } from 'node:perf_hooks';
12
- import { timingSnapshot, timingDelta, blockingBudget, prepareOpenTiming, hookCalls, callsWithin, startThreadWatch, summarizeWaits } from './transcript-facts-timing.mjs';
12
+ import { timingSnapshot, timingDelta, blockingBudget, prepareOpenTiming, hookCalls, callsWithin, startThreadWatch, summarizeWaits, attachWaitsOverBudget } from './transcript-facts-timing.mjs';
13
13
  import { seedColdHistories, verifyFacts } from './transcript-facts-fixture.mjs';
14
14
 
15
+ const BUDGET_MS = 50;
15
16
  const root = mkdtempSync(join(process.platform === 'win32' ? tmpdir() : '/tmp', 'cez-facts-health-'));
16
17
  // The experiment has no external peers, credentials, background updater, or real home.
17
18
  for (const key of Object.keys(process.env)) if (/^(CEZ|HSQ)_/.test(key)) delete process.env[key];
@@ -96,6 +97,8 @@ try {
96
97
  gcObserver = new PerformanceObserver(list => { for (const entry of list.getEntries()) gcPauses.push(entry); });
97
98
  gcObserver.observe({ entryTypes: ['gc'] });
98
99
  threadWatch = await startThreadWatch();
100
+ // Watch every sample: any one over the budget names what the main thread waited in.
101
+ threadWatch?.watch(true);
99
102
  const start = performance.now();
100
103
  let end;
101
104
  let warming;
@@ -108,7 +111,6 @@ try {
108
111
  const measurementStart = pauseStart ?? timingSnapshot();
109
112
  const plannedMs = pauseStart ? pauseMs : 0;
110
113
  const requestStart = performance.now();
111
- if (!store) threadWatch?.watch(true);
112
114
  const pendingResponse = fetch(endpoint, { signal: AbortSignal.timeout(2_000) });
113
115
  // The first request includes synchronous project-open work too.
114
116
  if (!store) {
@@ -121,19 +123,22 @@ try {
121
123
  const requestEnd = performance.now();
122
124
  // Include EVERY request begun while cold warm-up was active, even one ending after it.
123
125
  const measurement = timingDelta(measurementStart, timingSnapshot());
124
- threadWatch?.watch(false);
125
126
  samples.push({ fromMs: measurementStart.at - start, startMs: requestStart - start, endMs: requestEnd - start,
126
127
  latencyMs: requestEnd - requestStart, plannedMs, ...measurement, ...blockingBudget(measurement) });
127
128
  if (end !== undefined) break;
128
129
  pauseStart = timingSnapshot();
129
130
  await delay(pauseMs);
130
131
  }
132
+ threadWatch?.watch(false);
131
133
  await warming;
132
134
  unhookCalls();
133
- const firstSampleWaits = (await threadWatch?.stop()) ?? [];
135
+ const waits = (await threadWatch?.stop()) ?? [];
134
136
  threadWatch = undefined;
137
+ const firstFrom = start + samples[0].fromMs;
138
+ const firstSampleWaits = waits.filter(entry => entry.at >= firstFrom && entry.at < firstFrom + samples[0].elapsedMs);
135
139
  for (const entry of gcObserver.takeRecords()) gcPauses.push(entry);
136
140
  gcObserver.disconnect();
141
+ attachWaitsOverBudget(samples, waits, BUDGET_MS, sample => [start + sample.fromMs, start + sample.fromMs + sample.elapsedMs]);
137
142
  for (const sample of samples) {
138
143
  const from = start + sample.fromMs;
139
144
  const to = from + sample.elapsedMs;
@@ -161,7 +166,7 @@ try {
161
166
  console.log(JSON.stringify(result));
162
167
  // Exclude run-queue delay and loop idle time: a response that waits on the thread pool, a worker
163
168
  // or the kernel is latency (kept in maxLatencyMs), not main-thread blocking. Synchronous work counts.
164
- assert.ok(result.maxBlockingMs < 50, `max health blocking ${result.maxBlockingMs.toFixed(3)}ms must be <50ms`);
169
+ assert.ok(result.maxBlockingMs < BUDGET_MS, `max health blocking ${result.maxBlockingMs.toFixed(3)}ms must be <${BUDGET_MS}ms`);
165
170
  } finally {
166
171
  clearTimeout(watchdog);
167
172
  unhookCalls?.();
@@ -165,6 +165,16 @@ export function summarizeWaits(seen) {
165
165
  return counts;
166
166
  }
167
167
 
168
+ /** Name the waits of every sample whose blocking reached the budget, not only the first one.
169
+ * `window(sample)` gives the sample's [from, to) on the performance.now() clock. */
170
+ export function attachWaitsOverBudget(samples, seen, budgetMs, window) {
171
+ for (const sample of samples) {
172
+ if (sample.blockingMs < budgetMs) continue;
173
+ const [from, to] = window(sample);
174
+ sample.waits = summarizeWaits(seen.filter(entry => entry.at >= from && entry.at < to));
175
+ }
176
+ }
177
+
168
178
  /** Instrument only the synchronous open call. Imports and hook setup are outside its budget.
169
179
  * These diagnostic wrappers restore every method even when open throws. */
170
180
  export async function prepareOpenTiming(runtime) {