@hearsay-tools/squawk 0.19.0-dev.8679 → 0.19.0-dev.8689
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/preview/chromium.d.ts +3 -2
- package/dist/preview/chromium.js +5 -1
- package/dist/preview/chromium.js.map +1 -1
- 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/repo-routes.d.ts +13 -13
- package/dist/server/runs-routes.d.ts +16 -16
- package/dist/server/server.d.ts +72 -72
- 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
|
@@ -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,E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({
|
|
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
|
} & {
|
|
@@ -12300,20 +12300,20 @@ export declare function createRunsRoutes(deps: RunsRouteDeps): import("hono/hono
|
|
|
12300
12300
|
} & {
|
|
12301
12301
|
"/runs/:id/handoff": {
|
|
12302
12302
|
$get: {
|
|
12303
|
-
output:
|
|
12304
|
-
|
|
12305
|
-
|
|
12303
|
+
output: {
|
|
12304
|
+
error: string;
|
|
12305
|
+
};
|
|
12306
|
+
outputFormat: "json";
|
|
12307
|
+
status: 404;
|
|
12306
12308
|
input: {
|
|
12307
12309
|
param: {
|
|
12308
12310
|
id: string;
|
|
12309
12311
|
};
|
|
12310
12312
|
};
|
|
12311
12313
|
} | {
|
|
12312
|
-
output:
|
|
12313
|
-
|
|
12314
|
-
|
|
12315
|
-
outputFormat: "json";
|
|
12316
|
-
status: 404;
|
|
12314
|
+
output: string;
|
|
12315
|
+
outputFormat: "text";
|
|
12316
|
+
status: 200;
|
|
12317
12317
|
input: {
|
|
12318
12318
|
param: {
|
|
12319
12319
|
id: string;
|
|
@@ -12351,20 +12351,20 @@ export declare function createRunsRoutes(deps: RunsRouteDeps): import("hono/hono
|
|
|
12351
12351
|
} & {
|
|
12352
12352
|
"/runs/:id/diff": {
|
|
12353
12353
|
$get: {
|
|
12354
|
-
output:
|
|
12355
|
-
|
|
12356
|
-
|
|
12354
|
+
output: {
|
|
12355
|
+
error: string;
|
|
12356
|
+
};
|
|
12357
|
+
outputFormat: "json";
|
|
12358
|
+
status: 404 | 409;
|
|
12357
12359
|
input: {
|
|
12358
12360
|
param: {
|
|
12359
12361
|
id: string;
|
|
12360
12362
|
};
|
|
12361
12363
|
};
|
|
12362
12364
|
} | {
|
|
12363
|
-
output:
|
|
12364
|
-
|
|
12365
|
-
|
|
12366
|
-
outputFormat: "json";
|
|
12367
|
-
status: 404 | 409;
|
|
12365
|
+
output: string;
|
|
12366
|
+
outputFormat: "text";
|
|
12367
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
12368
12368
|
input: {
|
|
12369
12369
|
param: {
|
|
12370
12370
|
id: string;
|
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";
|
|
@@ -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:
|
|
19294
|
-
|
|
19295
|
-
|
|
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
|
-
|
|
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:
|
|
19345
|
-
|
|
19346
|
-
|
|
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
|
-
|
|
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;
|
|
@@ -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
|
-
sha: string;
|
|
19451
|
-
} & {
|
|
19452
19450
|
id: string;
|
|
19451
|
+
} & {
|
|
19452
|
+
sha: 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
|
-
sha: string;
|
|
19482
|
-
} & {
|
|
19483
19481
|
id: string;
|
|
19482
|
+
} & {
|
|
19483
|
+
sha: string;
|
|
19484
19484
|
};
|
|
19485
19485
|
};
|
|
19486
19486
|
};
|
|
@@ -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:
|
|
36063
|
-
|
|
36064
|
-
|
|
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
|
-
|
|
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:
|
|
36114
|
-
|
|
36115
|
-
|
|
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
|
-
|
|
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;
|
|
@@ -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
|
-
sha: string;
|
|
36220
|
-
} & {
|
|
36221
36219
|
id: string;
|
|
36220
|
+
} & {
|
|
36221
|
+
sha: 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
|
-
sha: string;
|
|
36251
|
-
} & {
|
|
36252
36250
|
id: string;
|
|
36251
|
+
} & {
|
|
36252
|
+
sha: 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-dev.
|
|
3
|
+
"version": "0.19.0-dev.8689",
|
|
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-dev.
|
|
73
|
-
"@open-mercato/cezar-contract": "0.19.0-dev.
|
|
72
|
+
"@open-mercato/cezar-api-client": "0.19.0-dev.8689",
|
|
73
|
+
"@open-mercato/cezar-contract": "0.19.0-dev.8689",
|
|
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": "140068d8ba8ac09c3767b6fd6ba43bce0781393c"
|
|
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?.();
|