@hearsay-tools/squawk 0.19.0-pr4428.8677 → 0.19.0-pr4429.8684
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.
- package/dist/automations/tools.d.ts +8 -8
- package/dist/delegation/transport.d.ts +14 -14
- package/dist/runs/transcript-facts-queue.d.ts +9 -1
- package/dist/runs/transcript-facts-queue.js +43 -10
- package/dist/runs/transcript-facts-queue.js.map +1 -1
- package/dist/runs/transcript-facts-sidecar.d.ts +22 -0
- package/dist/runs/transcript-facts-sidecar.js +58 -0
- package/dist/runs/transcript-facts-sidecar.js.map +1 -0
- package/dist/runs/transcript-facts-worker.d.ts +7 -2
- package/dist/runs/transcript-facts-worker.js +8 -5
- package/dist/runs/transcript-facts-worker.js.map +1 -1
- package/dist/runs/transcript-facts.d.ts +4 -0
- package/dist/runs/transcript-facts.js +36 -16
- package/dist/runs/transcript-facts.js.map +1 -1
- package/dist/server/live-routes.d.ts +6 -6
- package/dist/server/server.d.ts +14 -14
- package/dist/server/workspace-live-routes.d.ts +6 -6
- package/package.json +4 -4
- package/scripts/measure-transcript-facts-health.mjs +10 -5
- package/scripts/transcript-facts-timing.mjs +10 -0
|
@@ -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,
|
|
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,7 @@
|
|
|
1
|
+
import { rmSync } from 'node:fs';
|
|
1
2
|
import { MessageChannel, receiveMessageOnPort, Worker } from 'node:worker_threads';
|
|
2
3
|
import { loadTranscriptFacts } from './transcript-facts-load.js';
|
|
4
|
+
import { RESULT_SLOT, revokeSidecar, SIGNAL_BYTES, tempSidecarPath } from './transcript-facts-sidecar.js';
|
|
3
5
|
export const REFRESH_FACTS = Symbol('transcript changed');
|
|
4
6
|
const JOB_TIMEOUT_MS = 30_000;
|
|
5
7
|
const MAX_ATTEMPTS = 3;
|
|
@@ -8,6 +10,7 @@ export class TranscriptFactsQueue {
|
|
|
8
10
|
dataDir;
|
|
9
11
|
accept;
|
|
10
12
|
cached;
|
|
13
|
+
sidecarPath;
|
|
11
14
|
jobs = new Map();
|
|
12
15
|
pendingHead;
|
|
13
16
|
pendingTail;
|
|
@@ -16,10 +19,13 @@ export class TranscriptFactsQueue {
|
|
|
16
19
|
workerLifecycle;
|
|
17
20
|
dispatch;
|
|
18
21
|
stopped = false;
|
|
19
|
-
constructor(dataDir, accept, cached
|
|
22
|
+
constructor(dataDir, accept, cached,
|
|
23
|
+
/** Where the worker commits the sidecar of a load that needs one; absent: it commits none. */
|
|
24
|
+
sidecarPath) {
|
|
20
25
|
this.dataDir = dataDir;
|
|
21
26
|
this.accept = accept;
|
|
22
27
|
this.cached = cached;
|
|
28
|
+
this.sidecarPath = sidecarPath;
|
|
23
29
|
}
|
|
24
30
|
has(runId) { return this.jobs.has(runId); }
|
|
25
31
|
request(runId, demand = true) {
|
|
@@ -60,7 +66,7 @@ export class TranscriptFactsQueue {
|
|
|
60
66
|
break;
|
|
61
67
|
const active = this.active;
|
|
62
68
|
const remaining = deadline - Date.now();
|
|
63
|
-
if (remaining <= 0 || Atomics.wait(active.signal,
|
|
69
|
+
if (remaining <= 0 || Atomics.wait(active.signal, RESULT_SLOT, 0, remaining) === 'timed-out') {
|
|
64
70
|
this.fail(new Error(`Transcript facts worker timed out for ${runId}`));
|
|
65
71
|
break;
|
|
66
72
|
}
|
|
@@ -75,6 +81,11 @@ export class TranscriptFactsQueue {
|
|
|
75
81
|
throw job.error;
|
|
76
82
|
return job.value;
|
|
77
83
|
}
|
|
84
|
+
/** The caller writes this run's sidecar itself: the active worker job must not overwrite it. */
|
|
85
|
+
revoke(runId) {
|
|
86
|
+
if (this.active?.runId === runId && this.active.signal)
|
|
87
|
+
revokeSidecar(this.active.signal);
|
|
88
|
+
}
|
|
78
89
|
forget(runId) {
|
|
79
90
|
const job = this.jobs.get(runId);
|
|
80
91
|
if (!job)
|
|
@@ -150,10 +161,10 @@ export class TranscriptFactsQueue {
|
|
|
150
161
|
const worker = new Worker(url, { execArgv: [], workerData: { lifecycle: lifecycle.buffer } });
|
|
151
162
|
this.workerLifecycle = lifecycle;
|
|
152
163
|
worker.on('error', (error) => { if (this.worker === worker)
|
|
153
|
-
this.fail(error); });
|
|
164
|
+
this.fail(error, true); });
|
|
154
165
|
worker.on('exit', (code) => {
|
|
155
166
|
if (this.worker === worker)
|
|
156
|
-
this.fail(new Error(`Transcript facts worker exited (${code})`));
|
|
167
|
+
this.fail(new Error(`Transcript facts worker exited (${code})`), true);
|
|
157
168
|
});
|
|
158
169
|
return worker;
|
|
159
170
|
}
|
|
@@ -170,10 +181,13 @@ export class TranscriptFactsQueue {
|
|
|
170
181
|
this.worker ??= this.createWorker();
|
|
171
182
|
const { port1, port2 } = new MessageChannel();
|
|
172
183
|
job.port = port1;
|
|
173
|
-
job.signal = new Int32Array(new SharedArrayBuffer(
|
|
184
|
+
job.signal = new Int32Array(new SharedArrayBuffer(SIGNAL_BYTES));
|
|
174
185
|
port1.once('message', (reply) => this.complete(job, reply));
|
|
175
186
|
job.timer = setTimeout(() => this.fail(new Error(`Transcript facts worker timed out for ${job.runId}`)), JOB_TIMEOUT_MS);
|
|
176
|
-
const
|
|
187
|
+
const sidecar = this.sidecarPath?.(job.runId);
|
|
188
|
+
job.tmp = sidecar && tempSidecarPath(sidecar);
|
|
189
|
+
const message = { dataDir: this.dataDir, runId: job.runId, port: port2,
|
|
190
|
+
signal: job.signal.buffer, ...(sidecar ? { sidecar, tmp: job.tmp } : {}) };
|
|
177
191
|
try {
|
|
178
192
|
this.worker.postMessage(message, [port2]);
|
|
179
193
|
}
|
|
@@ -194,7 +208,7 @@ export class TranscriptFactsQueue {
|
|
|
194
208
|
return;
|
|
195
209
|
}
|
|
196
210
|
try {
|
|
197
|
-
const value = this.accept(job.runId, reply.result, reply.
|
|
211
|
+
const value = this.accept(job.runId, reply.result, reply.sidecar);
|
|
198
212
|
if (value === REFRESH_FACTS) {
|
|
199
213
|
this.release(job);
|
|
200
214
|
if (job.attempts >= MAX_ATTEMPTS) {
|
|
@@ -217,6 +231,7 @@ export class TranscriptFactsQueue {
|
|
|
217
231
|
job.port?.close();
|
|
218
232
|
job.port = undefined;
|
|
219
233
|
job.signal = undefined;
|
|
234
|
+
job.tmp = undefined;
|
|
220
235
|
if (this.active === job)
|
|
221
236
|
this.active = undefined;
|
|
222
237
|
}
|
|
@@ -232,13 +247,25 @@ export class TranscriptFactsQueue {
|
|
|
232
247
|
job.resolve(value);
|
|
233
248
|
this.schedule();
|
|
234
249
|
}
|
|
235
|
-
|
|
250
|
+
/** `exited`: the worker already stopped on its own ('error' or 'exit'). */
|
|
251
|
+
disposeWorker(exited = false) {
|
|
252
|
+
// Revoke before terminating: a terminated worker could leave a rename half-signalled.
|
|
253
|
+
if (this.active?.signal)
|
|
254
|
+
revokeSidecar(this.active.signal, !exited);
|
|
255
|
+
const tmp = this.active?.tmp;
|
|
236
256
|
const worker = this.worker;
|
|
237
257
|
const lifecycle = this.workerLifecycle;
|
|
238
258
|
this.worker = undefined;
|
|
239
259
|
this.workerLifecycle = undefined;
|
|
240
260
|
if (!worker)
|
|
241
261
|
return;
|
|
262
|
+
// Terminating mid-write leaves the job's temp file: remove it once the worker writes no more.
|
|
263
|
+
if (tmp) {
|
|
264
|
+
if (exited)
|
|
265
|
+
removeTemp(tmp);
|
|
266
|
+
else
|
|
267
|
+
worker.once('exit', () => removeTemp(tmp));
|
|
268
|
+
}
|
|
242
269
|
if (lifecycle) {
|
|
243
270
|
Atomics.store(lifecycle, 1, 1);
|
|
244
271
|
if (Atomics.load(lifecycle, 0) === 0) {
|
|
@@ -254,8 +281,8 @@ export class TranscriptFactsQueue {
|
|
|
254
281
|
}
|
|
255
282
|
void worker.terminate().catch(() => undefined);
|
|
256
283
|
}
|
|
257
|
-
fail(error) {
|
|
258
|
-
this.disposeWorker();
|
|
284
|
+
fail(error, exited = false) {
|
|
285
|
+
this.disposeWorker(exited);
|
|
259
286
|
if (this.dispatch)
|
|
260
287
|
clearImmediate(this.dispatch);
|
|
261
288
|
this.dispatch = undefined;
|
|
@@ -263,4 +290,10 @@ export class TranscriptFactsQueue {
|
|
|
263
290
|
this.settle(job, error);
|
|
264
291
|
}
|
|
265
292
|
}
|
|
293
|
+
function removeTemp(path) {
|
|
294
|
+
try {
|
|
295
|
+
rmSync(path, { force: true });
|
|
296
|
+
}
|
|
297
|
+
catch { /* removeHistory removes it with the run */ }
|
|
298
|
+
}
|
|
266
299
|
//# sourceMappingURL=transcript-facts-queue.js.map
|
|
@@ -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,CAAC;AACrG,OAAO,EAAE,mBAAmB,EAAwB,MAAM,4BAA4B,CAAC;AAGvF,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAC1D,MAAM,cAAc,GAAG,MAAM,CAAC;AAC9B,MAAM,YAAY,GAAG,CAAC,CAAC;AAiBvB,yFAAyF;AACzF,MAAM,OAAO,oBAAoB;IAWZ,OAAO;IACP,MAAM;IACN,MAAM;IAZR,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC1C,WAAW,CAAsB;IACjC,WAAW,CAAsB;IACjC,MAAM,CAAsB;IAC5B,MAAM,CAAsB;IAC5B,eAAe,CAA0B;IACzC,QAAQ,CAAgC;IACxC,OAAO,GAAG,KAAK,CAAC;IAExB,YACmB,OAAe,EACf,MAA6G,EAC7G,MAAyC;uBAFzC,OAAO;sBACP,MAAM;sBACN,MAAM;IACtB,CAAC;IAEJ,GA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AAC,OAAO,CAAC,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;AAED,SAAS,UAAU,CAAC,IAAY;IAC9B,IAAI,CAAC;QAAC,MAAM,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC,CAAC,2CAA2C,CAAC,CAAC;AAC9F,CAAC"}
|
|
@@ -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, tmp?: string): 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,58 @@
|
|
|
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, tmp = tempSidecarPath(path)) {
|
|
21
|
+
try {
|
|
22
|
+
writeFileSync(tmp, serialized, { mode: 0o600 });
|
|
23
|
+
if (Atomics.compareExchange(signal, COMMIT_SLOT, OPEN, RENAMING) !== OPEN) {
|
|
24
|
+
rmSync(tmp, { force: true });
|
|
25
|
+
return { written: false };
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
renameSync(tmp, path);
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
Atomics.store(signal, COMMIT_SLOT, SETTLED);
|
|
32
|
+
Atomics.notify(signal, COMMIT_SLOT);
|
|
33
|
+
}
|
|
34
|
+
return { written: true };
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
let cleaned = true;
|
|
38
|
+
try {
|
|
39
|
+
rmSync(tmp, { force: true });
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
cleaned = false;
|
|
43
|
+
}
|
|
44
|
+
return { error: error.message, cleaned };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** Index side: after this returns, the worker renames no sidecar for this job. A rename already
|
|
48
|
+
* under way finishes first, so a caller that removes or rewrites the sidecar next wins. The wait
|
|
49
|
+
* has no deadline: a live worker leaves RENAMING right after its rename, and a timed-out wait
|
|
50
|
+
* could let it rename later. Pass `workerAlive` false once the worker has exited; it renames
|
|
51
|
+
* nothing more, and its slot may never leave RENAMING. */
|
|
52
|
+
export function revokeSidecar(signal, workerAlive = true) {
|
|
53
|
+
if (Atomics.compareExchange(signal, COMMIT_SLOT, OPEN, REVOKED) !== RENAMING || !workerAlive)
|
|
54
|
+
return;
|
|
55
|
+
while (Atomics.load(signal, COMMIT_SLOT) === RENAMING)
|
|
56
|
+
Atomics.wait(signal, COMMIT_SLOT, RENAMING);
|
|
57
|
+
}
|
|
58
|
+
//# 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;AAE5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IAAI,EAAE,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,OAAO,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC;YAAC,MAAM,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC;YAAC,OAAO,GAAG,KAAK,CAAC;QAAC,CAAC;QAChE,OAAO,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC;IACtD,CAAC;AACH,CAAC;AAED;;;;2DAI2D;AAC3D,MAAM,UAAU,aAAa,CAAC,MAAkB,EAAE,WAAW,GAAG,IAAI;IAClE,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,WAAW;QAAE,OAAO;IACrG,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,KAAK,QAAQ;QAAE,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;AACrG,CAAC"}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
/** Worker owns reads/decode/fold
|
|
1
|
+
/** Worker owns reads/decode/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;
|
|
12
|
+
/** The temp file to write first; the queue removes it if it stops the worker mid-write. */
|
|
13
|
+
tmp?: string | undefined;
|
|
9
14
|
}
|
|
10
15
|
export type FactsJobReply = {
|
|
11
16
|
result: FactsLoadResult | undefined;
|
|
12
|
-
|
|
17
|
+
sidecar?: SidecarCommit;
|
|
13
18
|
} | {
|
|
14
19
|
error: string;
|
|
15
20
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
/** Worker owns reads/decode/fold
|
|
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, tmp }) => {
|
|
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
|
|
17
|
+
reply = { result, ...(sidecar && result?.needsWrite
|
|
18
|
+
? { sidecar: commitSidecar(sidecar, JSON.stringify(result.facts), slots, tmp) } : {}) };
|
|
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(
|
|
23
|
-
Atomics.notify(
|
|
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,
|
|
1
|
+
{"version":3,"file":"transcript-facts-worker.js","sourceRoot":"","sources":["../../src/runs/transcript-facts-worker.ts"],"names":[],"mappings":"AAAA,yGAAyG;AACzG,OAAO,EAAE,UAAU,EAAE,UAAU,EAAoB,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAwB,MAAM,4BAA4B,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,WAAW,EAAsB,MAAM,+BAA+B,CAAC;AAc/F,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,EAAE,OAAO,EAAE,GAAG,EAAmB,EAAE,EAAE;QACjG,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;QACrC,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,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,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QAC5F,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,
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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 =
|
|
194
|
+
const tmp = tempSidecarPath(path);
|
|
178
195
|
try {
|
|
179
|
-
writeFileSync(tmp,
|
|
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
|
-
|
|
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":"transcript-facts.js","sourceRoot":"","sources":["../../src/runs/transcript-facts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"transcript-facts.js","sourceRoot":"","sources":["../../src/runs/transcript-facts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAiE,MAAM,4BAA4B,CAAC;AACzL,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAA2C,MAAM,4BAA4B,CAAC;AAChI,OAAO,EAAE,gBAAgB,EAAwB,MAAM,4BAA4B,CAAC;AACpF,OAAO,EAAE,eAAe,EAAsB,MAAM,+BAA+B,CAAC;AAEpF,OAA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CAAC,CAAC,KAAK,CAAC;QACrD,MAAM,GAAG,GAAG,eAAe,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";
|
package/dist/server/server.d.ts
CHANGED
|
@@ -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";
|
|
@@ -19447,9 +19447,9 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
19447
19447
|
status: 404 | 409;
|
|
19448
19448
|
input: {
|
|
19449
19449
|
param: {
|
|
19450
|
-
id: string;
|
|
19451
|
-
} & {
|
|
19452
19450
|
sha: string;
|
|
19451
|
+
} & {
|
|
19452
|
+
id: string;
|
|
19453
19453
|
};
|
|
19454
19454
|
};
|
|
19455
19455
|
} | {
|
|
@@ -19478,9 +19478,9 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
19478
19478
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
19479
19479
|
input: {
|
|
19480
19480
|
param: {
|
|
19481
|
-
id: string;
|
|
19482
|
-
} & {
|
|
19483
19481
|
sha: string;
|
|
19482
|
+
} & {
|
|
19483
|
+
id: string;
|
|
19484
19484
|
};
|
|
19485
19485
|
};
|
|
19486
19486
|
};
|
|
@@ -36216,9 +36216,9 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
36216
36216
|
status: 404 | 409;
|
|
36217
36217
|
input: {
|
|
36218
36218
|
param: {
|
|
36219
|
-
id: string;
|
|
36220
|
-
} & {
|
|
36221
36219
|
sha: string;
|
|
36220
|
+
} & {
|
|
36221
|
+
id: string;
|
|
36222
36222
|
};
|
|
36223
36223
|
};
|
|
36224
36224
|
} | {
|
|
@@ -36247,9 +36247,9 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
36247
36247
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
36248
36248
|
input: {
|
|
36249
36249
|
param: {
|
|
36250
|
-
id: string;
|
|
36251
|
-
} & {
|
|
36252
36250
|
sha: string;
|
|
36251
|
+
} & {
|
|
36252
|
+
id: string;
|
|
36253
36253
|
};
|
|
36254
36254
|
};
|
|
36255
36255
|
};
|
|
@@ -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-
|
|
3
|
+
"version": "0.19.0-pr4429.8684",
|
|
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-
|
|
73
|
-
"@open-mercato/cezar-contract": "0.19.0-
|
|
72
|
+
"@open-mercato/cezar-api-client": "0.19.0-pr4429.8684",
|
|
73
|
+
"@open-mercato/cezar-contract": "0.19.0-pr4429.8684",
|
|
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": "
|
|
90
|
+
"gitHead": "46a21ce2b0caeb34b947ef9e56370ff9dc3f2b36"
|
|
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
|
|
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 <
|
|
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) {
|