@hearsay-tools/squawk 0.18.0-pr4136.7972.2 → 0.18.0-pr4137.7989
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/core/runner-facts.d.ts +2 -3
- package/dist/core/runner-facts.js.map +1 -1
- package/dist/preview/browser-launch.js +5 -1
- package/dist/preview/browser-launch.js.map +1 -1
- package/dist/preview/cdp-proxy.js +1 -1
- package/dist/preview/cdp-proxy.js.map +1 -1
- package/dist/preview/cdp.d.ts +4 -2
- package/dist/preview/cdp.js +43 -4
- package/dist/preview/cdp.js.map +1 -1
- package/dist/preview/chromium.js +4 -0
- package/dist/preview/chromium.js.map +1 -1
- package/dist/preview/host.js +13 -7
- package/dist/preview/host.js.map +1 -1
- package/dist/preview/session.js +13 -7
- package/dist/preview/session.js.map +1 -1
- package/dist/runners/antigravity/antigravity-runner.d.ts +1 -1
- package/dist/runners/antigravity/antigravity-session.d.ts +1 -1
- package/dist/runners/antigravity/antigravity-session.js +2 -5
- package/dist/runners/antigravity/antigravity-session.js.map +1 -1
- package/dist/runners/antigravity/facts.d.ts +1 -1
- package/dist/runners/antigravity/facts.js +1 -3
- package/dist/runners/antigravity/facts.js.map +1 -1
- package/dist/runners/antigravity/mock.d.ts +0 -1
- package/dist/runners/antigravity/mock.js +1 -1
- package/dist/runners/antigravity/mock.js.map +1 -1
- package/dist/runners/antigravity/tool-transcript.d.ts +11 -25
- package/dist/runners/antigravity/tool-transcript.js +16 -81
- package/dist/runners/antigravity/tool-transcript.js.map +1 -1
- package/dist/runners/omp/mock.d.ts +0 -8
- package/dist/runners/omp/mock.js +0 -9
- package/dist/runners/omp/mock.js.map +1 -1
- package/dist/runners/opencode/mock.d.ts +0 -8
- package/dist/runners/opencode/mock.js +0 -9
- package/dist/runners/opencode/mock.js.map +1 -1
- package/dist/runners/pi/mock.d.ts +0 -8
- package/dist/runners/pi/mock.js +0 -9
- package/dist/runners/pi/mock.js.map +1 -1
- package/dist/workflows/run/session-events.d.ts +0 -2
- package/dist/workflows/run/turn-nudges.d.ts +1 -2
- package/dist/workflows/run/turn-nudges.js +4 -4
- package/dist/workflows/run/turn-nudges.js.map +1 -1
- package/package.json +4 -4
- package/scripts/measure-transcript-facts-health.mjs +12 -3
- package/scripts/measure-transcript-facts-lag.mjs +12 -3
- package/scripts/mock-acp.mjs +5 -39
- package/scripts/transcript-facts-timing.mjs +32 -0
|
@@ -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,
|
package/scripts/mock-acp.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { spawn } from 'node:child_process';
|
|
|
7
7
|
import { once } from 'node:events';
|
|
8
8
|
import { join } from 'node:path';
|
|
9
9
|
import { lifecycleCall, ciPrompt, toolPrompt, probeCiTool } from './mock-ci-tool.mjs';
|
|
10
|
-
import {
|
|
10
|
+
import { scenarioFor, play } from './mock-scenario.mjs';
|
|
11
11
|
import { withoutSessionContextParts } from './mock-session-context.mjs';
|
|
12
12
|
import { loadControls } from './mock-controls.mjs';
|
|
13
13
|
import { waitForRelease } from './mock-lifecycle.mjs';
|
|
@@ -78,7 +78,6 @@ async function prompt(frame) {
|
|
|
78
78
|
const text = promptText(frame);
|
|
79
79
|
if (text === 'mock:account-homes') { accountHomes(frame); return; }
|
|
80
80
|
if (text === 'mock:transcript-read') { transcriptRead(frame); return; }
|
|
81
|
-
if (text === 'mock:transcript-hooks') { transcriptHooks(frame); return; }
|
|
82
81
|
if (delivery?.rejects(text)) { write({ id: frame.id, error: { code: -32000, message: 'owned turn rejected' } }); return; }
|
|
83
82
|
if (active) { steer(frame, text); return; }
|
|
84
83
|
let cancel;
|
|
@@ -118,44 +117,23 @@ function accountHomes(frame) {
|
|
|
118
117
|
update({ sessionUpdate: 'usage_update', used: 7, size: 1048576 });
|
|
119
118
|
reply(frame.id, { stopReason: 'end_turn' });
|
|
120
119
|
}
|
|
121
|
-
/** Appends rows to the session's Antigravity transcript file, matching the CLI 1.5.14 layout. */
|
|
122
|
-
function appendTranscriptRows(targetSessionId, rows) {
|
|
123
|
-
const logs = join(flag('--gemini-dir') ?? '.', 'antigravity-cli', 'brain', targetSessionId, '.system_generated', 'logs');
|
|
124
|
-
mkdirSync(logs, { recursive: true });
|
|
125
|
-
appendFileSync(join(logs, 'transcript_full.jsonl'), `${rows.map(row => JSON.stringify(row)).join('\n')}\n`);
|
|
126
|
-
}
|
|
127
|
-
function hookTranscriptRow(stepIndex, eventName, text) {
|
|
128
|
-
return {
|
|
129
|
-
step_index: stepIndex, source: 'SYSTEM_SDK', type: 'SYSTEM_MESSAGE', status: 'DONE',
|
|
130
|
-
content: `The following is a <SYSTEM_MESSAGE> not actually sent by the user. It is provided by the system as important information to pay attention to.\n\n<SYSTEM_MESSAGE>\nThe following system message was injected by a ${eventName} hook:\n${text}\n</SYSTEM_MESSAGE>`,
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
120
|
/** A read whose completed update carries no result, as on the CLI 1.5.14 wire; its transcript row
|
|
134
121
|
* lands after that update (cli-tool-output fixture). */
|
|
135
122
|
function transcriptRead(frame) {
|
|
123
|
+
const logs = join(flag('--gemini-dir') ?? '.', 'antigravity-cli', 'brain', frame.params.sessionId, '.system_generated', 'logs');
|
|
136
124
|
const args = { Path: 'notes.txt' };
|
|
137
125
|
const call = { toolCallId: 'call_transcript', name: 'read_file', args, kind: 'read', title: 'File notes.txt', rawInput: args };
|
|
138
126
|
update({ sessionUpdate: 'tool_call', ...call, status: 'in_progress' });
|
|
139
127
|
update({ sessionUpdate: 'tool_call_update', ...call, status: 'completed' });
|
|
140
|
-
|
|
128
|
+
mkdirSync(logs, { recursive: true });
|
|
129
|
+
appendFileSync(join(logs, 'transcript_full.jsonl'), `${[
|
|
141
130
|
{ step_index: 0, type: 'PLANNER_RESPONSE', status: 'DONE', tool_calls: [{ name: 'read_file', args }] },
|
|
142
131
|
{ step_index: 1, type: 'GENERIC', status: 'DONE', content: 'Created At: 2026-11-22T21:27:12+01:00\nCompleted At: 2026-11-22T21:27:12+01:00\n1: mock transcript line' },
|
|
143
|
-
]);
|
|
132
|
+
].map(row => JSON.stringify(row)).join('\n')}\n`);
|
|
144
133
|
content('agent_message_chunk', 'Read notes.txt.');
|
|
145
134
|
update({ sessionUpdate: 'usage_update', used: 7, size: 1048576 });
|
|
146
135
|
reply(frame.id, { stopReason: 'end_turn' });
|
|
147
136
|
}
|
|
148
|
-
/** SessionStart and internal SYSTEM reminders written to transcript_full.jsonl, with no tool call. */
|
|
149
|
-
function transcriptHooks(frame) {
|
|
150
|
-
appendTranscriptRows(frame.params.sessionId, [
|
|
151
|
-
hookTranscriptRow(1, 'SessionStart', 'SQUEAL · registered at revision 0'),
|
|
152
|
-
{ step_index: 2, source: 'SYSTEM', type: 'SYSTEM_MESSAGE', status: 'DONE', content: '<SYSTEM_MESSAGE>\nReminder: work efficiently.\n</SYSTEM_MESSAGE>' },
|
|
153
|
-
]);
|
|
154
|
-
content('agent_message_chunk', 'Checked hooks.');
|
|
155
|
-
appendTranscriptRows(frame.params.sessionId, [hookTranscriptRow(3, 'Stop', 'Stop hook finished.')]);
|
|
156
|
-
update({ sessionUpdate: 'usage_update', used: 7, size: 1048576 });
|
|
157
|
-
reply(frame.id, { stopReason: 'end_turn' });
|
|
158
|
-
}
|
|
159
137
|
function authenticate(frame) {
|
|
160
138
|
if (frame.params.methodId !== 'oauth-personal' || existsSync(join(flag('--gemini-dir') ?? '.', 'antigravity-cli', 'mock-login.json'))) { reply(frame.id, {}); return; }
|
|
161
139
|
write({ id: frame.id, error: { code: -32603, message: 'No browser is available here (this is a remote (SSH) session, so the browser\'s sign-in redirect can\'t reach this machine). Run `agy acp --login` in a terminal on this machine, then retry; or use a Gemini API key.' } });
|
|
@@ -201,7 +179,6 @@ async function runtimeProbe(text, turn) {
|
|
|
201
179
|
}
|
|
202
180
|
async function runPrompt(text, turn) {
|
|
203
181
|
if (await runtimeProbe(text, turn)) return;
|
|
204
|
-
if (text.includes('mock:hook-after-park')) return hookAfterPark(text, turn);
|
|
205
182
|
if (text.includes('mock:permission-late')) return latePermission(turn, text.includes('mock:permission-late-error'));
|
|
206
183
|
// The CLI's quota refusal, verbatim from a live CLI 1.5.14 turn (hearsay-tools/squawk#4098).
|
|
207
184
|
if (text.includes('mock:quota')) { content('agent_message_chunk', '\n⚠ Individual quota reached. Please upgrade your subscription to increase your limits. Resets in 3h54m9s.\n'); return; }
|
|
@@ -282,17 +259,6 @@ async function answerAsk(text) {
|
|
|
282
259
|
update({ sessionUpdate: 'tool_call_update', toolCallId: ask.id, status: 'completed', rawOutput: { output: text } });
|
|
283
260
|
content('agent_message_chunk', `Answer received: ${text}${ask.done || context.session.resumeAfterAsk ? await context.lifecycle(['cezar_done', {}]) : ''}`);
|
|
284
261
|
}
|
|
285
|
-
/** R77: a mid-turn hook in transcript_full.jsonl, a cezar_wait park, then a late hook after the park. */
|
|
286
|
-
async function hookAfterPark(text, turn) {
|
|
287
|
-
const targetSession = sessionId;
|
|
288
|
-
appendTranscriptRows(targetSession, [hookTranscriptRow(1, 'PreInvocation', 'Mid-turn hook context.')]);
|
|
289
|
-
const wait = await context.lifecycle(['cezar_wait', { kind: 'timer', seconds: 600, note: 'Check hook status.' }]);
|
|
290
|
-
content('agent_message_chunk', `Watching.${wait}`);
|
|
291
|
-
turn.afterTurn = async () => {
|
|
292
|
-
await afterParityPark(text);
|
|
293
|
-
appendTranscriptRows(targetSession, [hookTranscriptRow(5, 'Stop', 'Late hook processed.')]);
|
|
294
|
-
};
|
|
295
|
-
}
|
|
296
262
|
/** P8: the turn ends after cezar_done; a background command then wakes the idle session, which asks. */
|
|
297
263
|
async function latePermission(turn, fail) {
|
|
298
264
|
content('agent_message_chunk', `The turn finished before the late request.${await context.lifecycle(['cezar_done', {}])}`);
|
|
@@ -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
|
+
}
|