@hearsay-tools/squawk 0.18.0-dev.7982 → 0.18.0-dev.7986
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hearsay-tools/squawk",
|
|
3
|
-
"version": "0.18.0-dev.
|
|
3
|
+
"version": "0.18.0-dev.7986",
|
|
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",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@babel/parser": "^8.0.8",
|
|
65
65
|
"@babel/types": "^8.0.8",
|
|
66
|
-
"@open-mercato/cezar-api-client": "0.18.0-dev.
|
|
67
|
-
"@open-mercato/cezar-contract": "0.18.0-dev.
|
|
66
|
+
"@open-mercato/cezar-api-client": "0.18.0-dev.7986",
|
|
67
|
+
"@open-mercato/cezar-contract": "0.18.0-dev.7986",
|
|
68
68
|
"@types/node": "^24.19.1",
|
|
69
69
|
"@types/ws": "^8.18.1",
|
|
70
70
|
"esbuild": "^0.28.1",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "58f66b73f7887133493ec3b6494f1c1d09d5f7f3"
|
|
85
85
|
}
|
|
@@ -8,7 +8,7 @@ import { mkdtempSync, readdirSync, rmSync } from 'node:fs';
|
|
|
8
8
|
import { tmpdir } from 'node:os';
|
|
9
9
|
import { join } from 'node:path';
|
|
10
10
|
import { setTimeout as delay } from 'node:timers/promises';
|
|
11
|
-
import { timingSnapshot, timingDelta, blockingBudget } from './transcript-facts-timing.mjs';
|
|
11
|
+
import { timingSnapshot, timingDelta, blockingBudget, prepareOpenTiming } from './transcript-facts-timing.mjs';
|
|
12
12
|
import { seedColdHistories, verifyFacts } from './transcript-facts-fixture.mjs';
|
|
13
13
|
|
|
14
14
|
const root = mkdtempSync(join(process.platform === 'win32' ? tmpdir() : '/tmp', 'cez-facts-health-'));
|
|
@@ -17,6 +17,8 @@ for (const key of Object.keys(process.env)) if (/^(CEZ|HSQ)_/.test(key)) delete
|
|
|
17
17
|
process.env.HSQ_HOME = process.env.CEZ_HOME = join(root, 'home');
|
|
18
18
|
process.env.HSQ_DRY_RUN = process.env.CEZ_DRY_RUN = '1';
|
|
19
19
|
const runtime = { url: new URL('../dist/', import.meta.url), ext: 'js' };
|
|
20
|
+
const timedOpen = await prepareOpenTiming(runtime);
|
|
21
|
+
let openTiming;
|
|
20
22
|
let dataDir;
|
|
21
23
|
let store;
|
|
22
24
|
let bootStore;
|
|
@@ -75,7 +77,7 @@ try {
|
|
|
75
77
|
const pendingResponse = fetch(endpoint, { signal: AbortSignal.timeout(2_000) });
|
|
76
78
|
// The first request includes synchronous project-open work too.
|
|
77
79
|
if (!store) {
|
|
78
|
-
store = RunStore
|
|
80
|
+
({ store, timing: openTiming } = timedOpen(RunStore, dataDir));
|
|
79
81
|
warming = store.transcriptFacts.factsWarmIdle().then(() => { end = performance.now(); });
|
|
80
82
|
}
|
|
81
83
|
const response = await pendingResponse;
|
|
@@ -93,7 +95,14 @@ try {
|
|
|
93
95
|
await warming;
|
|
94
96
|
assert.ok(samples.length > 0, 'health requests must overlap cold warming');
|
|
95
97
|
assert.ok(samples.every(sample => sample.fromMs < end - start && sample.endMs > 0));
|
|
96
|
-
|
|
98
|
+
// Keep first-open and repeated-open costs separate. Reopening must not rescan clean history.
|
|
99
|
+
const reopenTimings = Array.from({ length: 3 }, () => {
|
|
100
|
+
const reopened = timedOpen(RunStore, dataDir);
|
|
101
|
+
const closeStart = timingSnapshot();
|
|
102
|
+
reopened.store.close();
|
|
103
|
+
return { ...reopened.timing, closeTiming: timingDelta(closeStart, timingSnapshot()) };
|
|
104
|
+
});
|
|
105
|
+
const result = { kind: 'transcript-facts-http-health', openTiming, reopenTimings, runtime: runtime.url.href,
|
|
97
106
|
endpoint: '/api/v1/health', scenario: 'already-listening server during cold project open', primingLatencyMs,
|
|
98
107
|
...verifyFacts(dataDir, fixtures, store), durationMs: end - start,
|
|
99
108
|
maxBlockingMs: Math.max(...samples.map(sample => sample.blockingMs)),
|
|
@@ -10,12 +10,14 @@ import { tmpdir } from 'node:os';
|
|
|
10
10
|
import { join } from 'node:path';
|
|
11
11
|
import { pathToFileURL } from 'node:url';
|
|
12
12
|
import { setTimeout as delay } from 'node:timers/promises';
|
|
13
|
-
import { timingSnapshot, timingDelta, blockingBudget } from './transcript-facts-timing.mjs';
|
|
13
|
+
import { timingSnapshot, timingDelta, blockingBudget, prepareOpenTiming } from './transcript-facts-timing.mjs';
|
|
14
14
|
import { seedColdHistories, verifyFacts } from './transcript-facts-fixture.mjs';
|
|
15
15
|
|
|
16
16
|
const runtime = { url: process.argv[2] ? pathToFileURL(process.argv[2] + '/') : new URL('../src/', import.meta.url), ext: process.argv[3] ?? (process.argv[2] ? 'js' : 'ts') };
|
|
17
17
|
const { RunStore } = await import(new URL('runs/store.' + runtime.ext, runtime.url));
|
|
18
18
|
const dir = mkdtempSync(join(tmpdir(), 'cez-facts-lag-'));
|
|
19
|
+
const timedOpen = await prepareOpenTiming(runtime);
|
|
20
|
+
let openTiming;
|
|
19
21
|
let store;
|
|
20
22
|
let timer;
|
|
21
23
|
try {
|
|
@@ -34,13 +36,20 @@ try {
|
|
|
34
36
|
// Establish a real interval before starting; retain the first tick after completion too.
|
|
35
37
|
await delay(periodMs * 2);
|
|
36
38
|
const start = performance.now();
|
|
37
|
-
store = RunStore
|
|
39
|
+
({ store, timing: openTiming } = timedOpen(RunStore, dir));
|
|
38
40
|
await store.transcriptFacts.factsWarmIdle();
|
|
39
41
|
const end = performance.now();
|
|
40
42
|
while (!ticks.some(tick => tick.at > end)) await delay(periodMs);
|
|
41
43
|
clearInterval(timer);
|
|
42
44
|
const overlapping = ticks.filter(tick => tick.at >= start && tick.at <= end);
|
|
43
|
-
|
|
45
|
+
// Keep first-open and repeated-open costs separate. Reopening must not rescan clean history.
|
|
46
|
+
const reopenTimings = Array.from({ length: 3 }, () => {
|
|
47
|
+
const reopened = timedOpen(RunStore, dir);
|
|
48
|
+
const closeStart = timingSnapshot();
|
|
49
|
+
reopened.store.close();
|
|
50
|
+
return { ...reopened.timing, closeTiming: timingDelta(closeStart, timingSnapshot()) };
|
|
51
|
+
});
|
|
52
|
+
const result = { kind: 'transcript-facts-lag', openTiming, reopenTimings, runtime: runtime.url.href, periodMs,
|
|
44
53
|
...verifyFacts(dir, fixtures, store), durationMs: end - start, ticks: ticks.length,
|
|
45
54
|
beforeTicks: ticks.filter(tick => tick.at < start).length,
|
|
46
55
|
trailingTicks: ticks.filter(tick => tick.at > end).length,
|
|
@@ -40,3 +40,35 @@ export function blockingBudget(sample, periodMs = 0) {
|
|
|
40
40
|
: Math.max(0, sample.elapsedMs - periodMs - sample.queueWaitMs);
|
|
41
41
|
return { mode, blockingMs: Math.max(0, periodMs > 0 ? Math.max(sample.mainThreadCpuMs, blockingMs) : blockingMs) };
|
|
42
42
|
}
|
|
43
|
+
|
|
44
|
+
/** Instrument only the synchronous open call. Imports and hook setup are outside its budget.
|
|
45
|
+
* These diagnostic wrappers restore every method even when open throws. */
|
|
46
|
+
export async function prepareOpenTiming(runtime) {
|
|
47
|
+
const [{ RunDatabase }, { RunClaimsTopic }, { RunTranscriptFacts }, { ExitEvents }] = await Promise.all([
|
|
48
|
+
import(new URL('runs/run-database.' + runtime.ext, runtime.url)),
|
|
49
|
+
import(new URL('runs/run-claims-topic.' + runtime.ext, runtime.url)),
|
|
50
|
+
import(new URL('runs/transcript-facts-topic.' + runtime.ext, runtime.url)),
|
|
51
|
+
import(new URL('runs/exit-events.' + runtime.ext, runtime.url)),
|
|
52
|
+
]);
|
|
53
|
+
return (RunStore, dataDir) => {
|
|
54
|
+
const phases = [];
|
|
55
|
+
const hooks = [[RunDatabase, 'open'], [RunDatabase.prototype, 'listWhere'],
|
|
56
|
+
[RunClaimsTopic.prototype, 'loadHeldRows'], [RunTranscriptFacts.prototype, 'warmTranscriptFacts'],
|
|
57
|
+
[ExitEvents.prototype, 'writeLoaded']];
|
|
58
|
+
const restore = hooks.map(([target, name]) => {
|
|
59
|
+
const original = target[name];
|
|
60
|
+
target[name] = function (...args) {
|
|
61
|
+
const start = timingSnapshot();
|
|
62
|
+
try { return original.apply(this, args); }
|
|
63
|
+
finally { phases.push({ phase: name, ...(name === 'listWhere' ? { sql: args[0] } : {}),
|
|
64
|
+
...timingDelta(start, timingSnapshot()) }); }
|
|
65
|
+
};
|
|
66
|
+
return () => { target[name] = original; };
|
|
67
|
+
});
|
|
68
|
+
const start = timingSnapshot();
|
|
69
|
+
try {
|
|
70
|
+
const store = RunStore.open(dataDir);
|
|
71
|
+
return { store, timing: { ...timingDelta(start, timingSnapshot()), phases } };
|
|
72
|
+
} finally { for (const undo of restore) undo(); }
|
|
73
|
+
};
|
|
74
|
+
}
|