@hearsay-tools/squawk 0.18.0-pr4358.8529.2 → 0.18.0-pr4358.8568
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/contract/index.js +23 -2
- package/dist/contract/session-context.d.ts +54 -8
- package/dist/data-gitignore.js +1 -0
- package/dist/data-gitignore.js.map +1 -1
- package/dist/delegation/provision.d.ts +2 -1
- package/dist/delegation/provision.js +45 -26
- package/dist/delegation/provision.js.map +1 -1
- package/dist/runners/antigravity/acp/events.d.ts +9 -1
- package/dist/runners/antigravity/acp/events.js +52 -11
- package/dist/runners/antigravity/acp/events.js.map +1 -1
- package/dist/runners/antigravity/acp/protocol.d.ts +12 -1
- package/dist/runners/antigravity/acp/protocol.js.map +1 -1
- package/dist/runners/antigravity/acp/session.d.ts +3 -0
- package/dist/runners/antigravity/acp/session.js +9 -0
- package/dist/runners/antigravity/acp/session.js.map +1 -1
- package/dist/runners/antigravity/antigravity-runner.d.ts +2 -2
- package/dist/runners/antigravity/antigravity-session.d.ts +4 -4
- package/dist/runners/antigravity/antigravity-session.js +48 -20
- package/dist/runners/antigravity/antigravity-session.js.map +1 -1
- package/dist/runners/antigravity/antigravity-ui-mapper.d.ts +2 -0
- package/dist/runners/antigravity/antigravity-ui-mapper.js +11 -3
- package/dist/runners/antigravity/antigravity-ui-mapper.js.map +1 -1
- package/dist/runners/antigravity/facts.d.ts +2 -2
- package/dist/runners/antigravity/facts.js +7 -5
- package/dist/runners/antigravity/facts.js.map +1 -1
- package/dist/runners/antigravity/mock.d.ts +4 -2
- package/dist/runners/antigravity/mock.js +3 -2
- package/dist/runners/antigravity/mock.js.map +1 -1
- package/dist/runners/antigravity/spec-support.js +1 -1
- package/dist/runners/antigravity/spec-support.js.map +1 -1
- package/dist/runners/antigravity/subagent-tracker.d.ts +50 -0
- package/dist/runners/antigravity/subagent-tracker.js +152 -0
- package/dist/runners/antigravity/subagent-tracker.js.map +1 -0
- package/dist/runners/antigravity/subagent-transcript.d.ts +41 -0
- package/dist/runners/antigravity/subagent-transcript.js +185 -0
- package/dist/runners/antigravity/subagent-transcript.js.map +1 -0
- package/dist/runners/antigravity/tool-normalization.d.ts +2 -0
- package/dist/runners/antigravity/tool-normalization.js +44 -2
- package/dist/runners/antigravity/tool-normalization.js.map +1 -1
- package/dist/runners/antigravity/tool-transcript.d.ts +24 -50
- package/dist/runners/antigravity/tool-transcript.js +88 -192
- package/dist/runners/antigravity/tool-transcript.js.map +1 -1
- package/dist/runners/antigravity/transcript-tailer.d.ts +56 -0
- package/dist/runners/antigravity/transcript-tailer.js +175 -0
- package/dist/runners/antigravity/transcript-tailer.js.map +1 -0
- package/dist/runners/antigravity/wire-updates.d.ts +4 -6
- package/dist/runners/antigravity/wire-updates.js +25 -3
- package/dist/runners/antigravity/wire-updates.js.map +1 -1
- package/dist/server/server.d.ts +64 -24
- package/dist/server/session-context-routes.d.ts +35 -15
- package/dist/server/session-context-routes.js +6 -6
- package/dist/server/session-context-routes.js.map +1 -1
- package/dist/session-context-file.d.ts +3 -3
- package/dist/session-context-file.js +45 -16
- package/dist/session-context-file.js.map +1 -1
- package/dist/session-context.d.ts +18 -9
- package/dist/session-context.js +118 -47
- package/dist/session-context.js.map +1 -1
- package/dist/workflows/run/continuation-session.js +1 -1
- package/dist/workflows/run/continuation-session.js.map +1 -1
- package/dist/workflows/run/launch-context.d.ts +1 -1
- package/dist/workflows/run/launch-context.js +2 -2
- package/dist/workflows/run/launch-context.js.map +1 -1
- package/dist/workflows/run/session-events.d.ts +2 -2
- package/dist/workflows/run/session-events.js +2 -2
- package/dist/workflows/run/session-events.js.map +1 -1
- package/dist/workflows/run/step-session.js +1 -1
- package/dist/workflows/run/step-session.js.map +1 -1
- package/package.json +4 -4
- package/scripts/mock-acp.mjs +128 -15
- package/web/dist/assets/{accounts-section-BQBCIvIe.js → accounts-section-VLKEYGPj.js} +1 -1
- package/web/dist/assets/{activity-motion-BoUcFlcy.js → activity-motion-IiyiWtXq.js} +1 -1
- package/web/dist/assets/{activity-route-dsZrLgOz.js → activity-route-QCPCR9kZ.js} +1 -1
- package/web/dist/assets/{agent-config-section-8C_KG8qw.js → agent-config-section-BK0gs0uc.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-Cpg6ytin.js → agent-defaults-section-BoluhHkE.js} +1 -1
- package/web/dist/assets/{appearance-CujGGeIB.js → appearance-CEFPwlnq.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-BKFGWhTW.js → archive-on-merge-field-BEt4jVZt.js} +1 -1
- package/web/dist/assets/{automations-route-CcCP4L7S.js → automations-route-F58YdVbC.js} +1 -1
- package/web/dist/assets/{commit-list-DaVNfLE5.js → commit-list-BZ6wfGPz.js} +1 -1
- package/web/dist/assets/{diff-CCzM8XxZ.js → diff-BbD04q_C.js} +2 -2
- package/web/dist/assets/{diff-controls-C0gH_nhG.js → diff-controls-CW1hOWET.js} +1 -1
- package/web/dist/assets/{diff-view-C8P6QDsN.js → diff-view-C3XewBZ4.js} +1 -1
- package/web/dist/assets/{file-preview-UYewjhvt.js → file-preview-B3r8zavn.js} +1 -1
- package/web/dist/assets/{folder-browser-Dg4CmonF.js → folder-browser-6LK4AIPp.js} +1 -1
- package/web/dist/assets/{git-toolbar-Icz0Cr21.js → git-toolbar-CCZtGd6H.js} +1 -1
- package/web/dist/assets/github-CzZZ-wwm.js +1 -0
- package/web/dist/assets/{global-activity-route-NYRbJrma.js → global-activity-route-BNyhS-a8.js} +1 -1
- package/web/dist/assets/{image-preview-BuZ5gCX-.js → image-preview-CMk53HOX.js} +1 -1
- package/web/dist/assets/index-CGjknHnV.css +1 -0
- package/web/dist/assets/{index-C4gjdVLi.js → index-DaJ5iats.js} +6 -6
- package/web/dist/assets/{label-D1xUdJjL.js → label-YDZzSz0S.js} +1 -1
- package/web/dist/assets/{markdown-RK9z1Cn3.js → markdown-q0pVKAO0.js} +1 -1
- package/web/dist/assets/{notifications-section-CPqz7gvQ.js → notifications-section-n3Xb47pL.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-Cc8MoILP.js → preview-pane-connected-VmfC04wB.js} +1 -1
- package/web/dist/assets/{project-location-CDQm9Gul.js → project-location-GPzDWXuH.js} +1 -1
- package/web/dist/assets/{projects-section-ClAkyY7D.js → projects-section-BotQxpQ6.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-U3HnlNQb.js → prompt-templates-section-B8pr6Ue3.js} +1 -1
- package/web/dist/assets/queries-DDhFFTvR.js +1 -0
- package/web/dist/assets/{reference-chip-Clhghu8I.js → reference-chip-90x9Bq44.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-CJcE3lxR.js → remote-settings-notice-F_onp6Yr.js} +1 -1
- package/web/dist/assets/{repo-git-CTIUcfsM.js → repo-git-B5Bse6ld.js} +1 -1
- package/web/dist/assets/{report-reader-BxaTkr-v.js → report-reader-B_kyYgIY.js} +1 -1
- package/web/dist/assets/reports-CNFNb36Z.css +1 -0
- package/web/dist/assets/{reports-Bz9ZRI-7.js → reports-D0E8DWXQ.js} +1 -1
- package/web/dist/assets/{resources-section-Dj1Bjzmf.js → resources-section-DcfHTNpN.js} +1 -1
- package/web/dist/assets/{run-header-BXQ-HR4O.js → run-header-OhEYfuQX.js} +1 -1
- package/web/dist/assets/{select-BhUI2GEt.js → select-r1KS5cjs.js} +1 -1
- package/web/dist/assets/session-context-section-PCOCiOTV.js +119 -0
- package/web/dist/assets/{settings-agent-picker-BdABOxwW.js → settings-agent-picker-D0UKjmOj.js} +1 -1
- package/web/dist/assets/{settings-shell-BUJWIyf6.js → settings-shell-BiPh5fg6.js} +1 -1
- package/web/dist/assets/{sidebar-section-C-CH38q4.js → sidebar-section-DmOlTUs8.js} +1 -1
- package/web/dist/assets/{skills-Be22BJDw.js → skills-CSLg7E0x.js} +1 -1
- package/web/dist/assets/{task-changes-D7ezDVM5.js → task-changes-DuOb61QV.js} +1 -1
- package/web/dist/assets/{task-commits-DxjVd56-.js → task-commits-CiGYJpqo.js} +1 -1
- package/web/dist/assets/{task-files-CVcyteyQ.js → task-files-fJSQ4Abg.js} +1 -1
- package/web/dist/assets/{task-github-item-Bw46CXoB.js → task-github-item-CRxN82Yw.js} +1 -1
- package/web/dist/assets/{task-groups-fk4Gq4hX.js → task-groups-B3Z2qfE6.js} +1 -1
- package/web/dist/assets/task-thread-CqjKwRuV.js +9 -0
- package/web/dist/assets/task-thread-DzADOhZd.css +1 -0
- package/web/dist/assets/{tasks-table-JFvtNCc1.js → tasks-table-Cm6YZBUB.js} +1 -1
- package/web/dist/assets/{thread-state-DU6osVw_.js → thread-state-DcHyKcQ-.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-C0vpMYLO.js → use-hand-to-agent-state-DuefXU2m.js} +1 -1
- package/web/dist/assets/{workflows-CsB1csR4.js → workflows-CC3TZmBS.js} +1 -1
- package/web/dist/assets/{workspace-tools-BXxPB3zi.js → workspace-tools-kscvD6KC.js} +1 -1
- package/web/dist/assets/{worktrees-section-BNnScarl.js → worktrees-section-CoKimDBt.js} +1 -1
- package/web/dist/index.html +8 -8
- package/dist/runners/antigravity/subagent-guard.d.ts +0 -17
- package/dist/runners/antigravity/subagent-guard.js +0 -38
- package/dist/runners/antigravity/subagent-guard.js.map +0 -1
- package/web/dist/assets/github-nBa7OE-M.js +0 -1
- package/web/dist/assets/index-B_cJa9gM.css +0 -1
- package/web/dist/assets/queries-BvWsZhaH.js +0 -1
- package/web/dist/assets/reports-DjDzVB_M.css +0 -1
- package/web/dist/assets/session-context-section-DcCwhluX.js +0 -119
- package/web/dist/assets/task-thread-cVekDQbH.js +0 -9
- package/web/dist/assets/task-thread-nVvn3n6d.css +0 -1
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { statSync } from 'node:fs';
|
|
2
|
+
import { open } from 'node:fs/promises';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { StringDecoder } from 'node:string_decoder';
|
|
5
|
+
import { hookEventName, isVisibleHookItem } from '@hearsay-tools/squawk/plugin/runtime';
|
|
6
|
+
import { z } from '@hearsay-tools/squawk/plugin';
|
|
7
|
+
import { ANTIGRAVITY_APP_DATA_DIR } from './launch-args.js';
|
|
8
|
+
export const TRANSCRIPT_OUTPUT_CHARS = 64 * 1024;
|
|
9
|
+
export const TRANSCRIPT_READ_BYTES = 4 * 1024 * 1024;
|
|
10
|
+
export const TRANSCRIPT_MAX_FLUSH_CHUNKS = 8;
|
|
11
|
+
const LINE_BYTES = 8 * 1024 * 1024;
|
|
12
|
+
export const NOT_RESULT_ROW_TYPES = new Set(['PLANNER_RESPONSE', 'USER_INPUT', 'SYSTEM_MESSAGE', 'CHECKPOINT']);
|
|
13
|
+
const HEADER = /^(?:Created|Completed) At: .*$/;
|
|
14
|
+
const SYSTEM_BLOCK = /(?:^|\n)<SYSTEM_MESSAGE>\r?\n([\s\S]*)\r?\n<\/SYSTEM_MESSAGE>\s*$/;
|
|
15
|
+
const HOOK_HEADER = /^The following system message was injected by an? ([A-Za-z][A-Za-z0-9_-]*) hook:\r?\n?([\s\S]*)$/;
|
|
16
|
+
export const transcriptRowSchema = z.object({
|
|
17
|
+
step_index: z.number().int().nonnegative(), type: z.string(), source: z.string().optional(),
|
|
18
|
+
status: z.string().optional(), content: z.string().optional(), error: z.string().optional(),
|
|
19
|
+
thinking: z.string().optional(),
|
|
20
|
+
tool_calls: z.array(z.object({ name: z.string(), args: z.unknown().optional() })).optional(),
|
|
21
|
+
});
|
|
22
|
+
export function antigravityTranscriptPath(geminiDir, sessionId) {
|
|
23
|
+
return join(geminiDir, ANTIGRAVITY_APP_DATA_DIR, 'brain', sessionId, '.system_generated', 'logs', 'transcript_full.jsonl');
|
|
24
|
+
}
|
|
25
|
+
/** A JSON value with object keys sorted, so two equal argument objects compare equal as text. */
|
|
26
|
+
export function canonicalJson(value) {
|
|
27
|
+
if (Array.isArray(value))
|
|
28
|
+
return `[${value.map(canonicalJson).join(',')}]`;
|
|
29
|
+
if (value && typeof value === 'object') {
|
|
30
|
+
return `{${Object.keys(value).sort().map(key => `${JSON.stringify(key)}:${canonicalJson(value[key])}`).join(',')}}`;
|
|
31
|
+
}
|
|
32
|
+
return JSON.stringify(value ?? null);
|
|
33
|
+
}
|
|
34
|
+
export function transcriptCallKey(name, args) {
|
|
35
|
+
return `${name}\u0000${canonicalJson(args ?? {})}`;
|
|
36
|
+
}
|
|
37
|
+
export function boundTranscriptOutput(text) {
|
|
38
|
+
return text.length > TRANSCRIPT_OUTPUT_CHARS ? `${text.slice(0, TRANSCRIPT_OUTPUT_CHARS)}\n… (output truncated by Squawk)` : text;
|
|
39
|
+
}
|
|
40
|
+
/** The text the agent received, without the CLI's `Created At:`/`Completed At:` lines, bounded. */
|
|
41
|
+
export function transcriptResultText(row) {
|
|
42
|
+
const lines = (row.content ?? '').split('\n');
|
|
43
|
+
let first = 0;
|
|
44
|
+
while (first < lines.length && HEADER.test(lines[first]))
|
|
45
|
+
first++;
|
|
46
|
+
const text = lines.slice(first).join('\n') || (row.error ?? '');
|
|
47
|
+
return boundTranscriptOutput(text);
|
|
48
|
+
}
|
|
49
|
+
/** A `SYSTEM_SDK` `SYSTEM_MESSAGE` row injected by a native Antigravity hook, mapped to a hook item. */
|
|
50
|
+
export function transcriptHookItem(row, idPrefix = '') {
|
|
51
|
+
if (row.type !== 'SYSTEM_MESSAGE' || row.source !== 'SYSTEM_SDK')
|
|
52
|
+
return undefined;
|
|
53
|
+
const content = row.content ?? '';
|
|
54
|
+
const body = (SYSTEM_BLOCK.exec(content)?.[1] ?? content).trim();
|
|
55
|
+
const header = HOOK_HEADER.exec(body);
|
|
56
|
+
if (!header)
|
|
57
|
+
return undefined;
|
|
58
|
+
const status = row.status === 'ERROR' ? 'failed' : 'completed';
|
|
59
|
+
const text = header[2].trim();
|
|
60
|
+
const entries = text
|
|
61
|
+
? [{ kind: status === 'failed' ? 'error' : 'context', text: boundTranscriptOutput(text) }]
|
|
62
|
+
: row.error?.trim() ? [{ kind: 'error', text: boundTranscriptOutput(row.error.trim()) }] : [];
|
|
63
|
+
const item = { kind: 'hook', id: `${idPrefix}hook_step_${row.step_index}`, event: hookEventName(header[1]), status, entries };
|
|
64
|
+
return isVisibleHookItem(item) ? item : undefined;
|
|
65
|
+
}
|
|
66
|
+
/** Bounded append-only JSONL file tailer shared by parent and child Antigravity transcripts. */
|
|
67
|
+
export class BoundedJsonlTailer {
|
|
68
|
+
path;
|
|
69
|
+
readBytes;
|
|
70
|
+
offset = 0;
|
|
71
|
+
tail = '';
|
|
72
|
+
decoder = new StringDecoder('utf8');
|
|
73
|
+
skippingLine = false;
|
|
74
|
+
hasMore = false;
|
|
75
|
+
constructor(path, fromEnd, readBytes = TRANSCRIPT_READ_BYTES) {
|
|
76
|
+
this.path = path;
|
|
77
|
+
this.readBytes = readBytes;
|
|
78
|
+
if (fromEnd) {
|
|
79
|
+
try {
|
|
80
|
+
this.offset = statSync(path).size;
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
this.offset = 0;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
async readNext(onRow) {
|
|
88
|
+
let file;
|
|
89
|
+
try {
|
|
90
|
+
file = await open(this.path, 'r');
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
this.hasMore = false;
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
try {
|
|
97
|
+
const { size } = await file.stat();
|
|
98
|
+
if (size <= this.offset) {
|
|
99
|
+
this.hasMore = false;
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const length = Math.min(size - this.offset, this.readBytes);
|
|
103
|
+
const buffer = Buffer.alloc(length);
|
|
104
|
+
const { bytesRead } = await file.read(buffer, 0, length, this.offset);
|
|
105
|
+
this.offset += bytesRead;
|
|
106
|
+
this.hasMore = bytesRead > 0 && this.offset < size;
|
|
107
|
+
this.feed(this.decoder.write(buffer.subarray(0, bytesRead)), onRow);
|
|
108
|
+
}
|
|
109
|
+
finally {
|
|
110
|
+
await file.close();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
feed(chunk, onRow) {
|
|
114
|
+
const lines = (this.tail + chunk).split('\n');
|
|
115
|
+
this.tail = lines.pop() ?? '';
|
|
116
|
+
for (const line of lines) {
|
|
117
|
+
if (this.skippingLine) {
|
|
118
|
+
this.skippingLine = false;
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
if (!line.trim())
|
|
122
|
+
continue;
|
|
123
|
+
try {
|
|
124
|
+
onRow(JSON.parse(line));
|
|
125
|
+
}
|
|
126
|
+
catch { /* A row the format no longer matches is skipped. */ }
|
|
127
|
+
}
|
|
128
|
+
if (this.tail.length > LINE_BYTES) {
|
|
129
|
+
this.tail = '';
|
|
130
|
+
this.skippingLine = true;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/** Serialized timer-driven poller shared by parent and child Antigravity transcript readers. */
|
|
135
|
+
export class TranscriptPoller {
|
|
136
|
+
step;
|
|
137
|
+
shouldContinue;
|
|
138
|
+
pollMs;
|
|
139
|
+
onError;
|
|
140
|
+
timer;
|
|
141
|
+
reading;
|
|
142
|
+
closed = false;
|
|
143
|
+
constructor(step, shouldContinue, pollMs, onError) {
|
|
144
|
+
this.step = step;
|
|
145
|
+
this.shouldContinue = shouldContinue;
|
|
146
|
+
this.pollMs = pollMs;
|
|
147
|
+
this.onError = onError;
|
|
148
|
+
}
|
|
149
|
+
schedule(delay) {
|
|
150
|
+
if (this.closed || this.timer)
|
|
151
|
+
return;
|
|
152
|
+
this.timer = setTimeout(() => {
|
|
153
|
+
this.timer = undefined;
|
|
154
|
+
void this.poll().then(() => { if (!this.closed && this.shouldContinue())
|
|
155
|
+
this.schedule(this.pollMs); });
|
|
156
|
+
}, delay);
|
|
157
|
+
this.timer.unref?.();
|
|
158
|
+
}
|
|
159
|
+
poll() {
|
|
160
|
+
this.reading ??= this.step().catch(() => { this.onError?.(); }).finally(() => { this.reading = undefined; });
|
|
161
|
+
return this.reading;
|
|
162
|
+
}
|
|
163
|
+
async waitIdle() {
|
|
164
|
+
clearTimeout(this.timer);
|
|
165
|
+
this.timer = undefined;
|
|
166
|
+
while (this.reading)
|
|
167
|
+
await this.reading;
|
|
168
|
+
}
|
|
169
|
+
close() {
|
|
170
|
+
this.closed = true;
|
|
171
|
+
clearTimeout(this.timer);
|
|
172
|
+
this.timer = undefined;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=transcript-tailer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcript-tailer.js","sourceRoot":"","sources":["../../../src/runners/antigravity/transcript-tailer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACxF,OAAO,EAAE,CAAC,EAAoC,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,GAAG,IAAI,CAAC;AACjD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AACrD,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAC7C,MAAM,UAAU,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AACnC,MAAM,CAAC,MAAM,oBAAoB,GAAwB,IAAI,GAAG,CAAC,CAAC,kBAAkB,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC,CAAC;AACrI,MAAM,MAAM,GAAG,gCAAgC,CAAC;AAChD,MAAM,YAAY,GAAG,mEAAm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,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,OAAO,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,CAAC,OAAO,CAAC;IAC1C,CAAC;IAED,KAAK;QACH,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AcpHooks } from './acp/protocol.ts';
|
|
2
|
+
import { AntigravitySubagentTracker } from './subagent-tracker.ts';
|
|
2
3
|
/** A chunk in the CLI's provider-failure shape. The turn fails only when this chunk is the whole
|
|
3
4
|
* agent message and no other agent work follows it before the turn ends (AcpEvents). */
|
|
4
5
|
export declare function antigravityUpdateError(update: Record<string, unknown>): string | undefined;
|
|
@@ -9,8 +10,5 @@ export declare function antigravityUpdateError(update: Record<string, unknown>):
|
|
|
9
10
|
*/
|
|
10
11
|
export declare function antigravityWorkEnds(update: Record<string, unknown>, previous: string | undefined): boolean;
|
|
11
12
|
/** The ACP hooks that map Antigravity frames, shared by the live session and the fixture mapper. */
|
|
12
|
-
export declare
|
|
13
|
-
|
|
14
|
-
readonly updateError: typeof antigravityUpdateError;
|
|
15
|
-
readonly agentWorkEnds: typeof antigravityWorkEnds;
|
|
16
|
-
};
|
|
13
|
+
export declare function antigravityWireHooks(subagents: AntigravitySubagentTracker): AcpHooks;
|
|
14
|
+
export declare const ANTIGRAVITY_WIRE_HOOKS: AcpHooks;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from '@hearsay-tools/squawk/plugin';
|
|
2
|
+
import { AntigravitySubagentTracker, parseChildToolCallId } from './subagent-tracker.js';
|
|
2
3
|
import { antigravityTool } from './tool-normalization.js';
|
|
3
4
|
const textSchema = z.object({ text: z.string() });
|
|
4
5
|
/** The CLI writes an agent failure as one message chunk, "\n⚠ <error>\n" (CLI 1.5.14 format string
|
|
@@ -22,7 +23,28 @@ export function antigravityWorkEnds(update, previous) {
|
|
|
22
23
|
return update.sessionUpdate === 'usage_update' && previous === 'agent_message_chunk';
|
|
23
24
|
}
|
|
24
25
|
/** The ACP hooks that map Antigravity frames, shared by the live session and the fixture mapper. */
|
|
25
|
-
export
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
export function antigravityWireHooks(subagents) {
|
|
27
|
+
return {
|
|
28
|
+
normalizeTool(update, previous) {
|
|
29
|
+
const normalized = antigravityTool(update, previous);
|
|
30
|
+
const id = typeof update.toolCallId === 'string' ? update.toolCallId : '';
|
|
31
|
+
const child = parseChildToolCallId(id);
|
|
32
|
+
if (child) {
|
|
33
|
+
const parentItemId = subagents.parentForChild(child.childId) ?? previous?.parentItemId;
|
|
34
|
+
if (parentItemId)
|
|
35
|
+
normalized.parentItemId = parentItemId;
|
|
36
|
+
}
|
|
37
|
+
return normalized;
|
|
38
|
+
},
|
|
39
|
+
holdToolCompletion: (update, item) => subagents.shouldHold(update, item),
|
|
40
|
+
afterToolUpdate: (update, item) => {
|
|
41
|
+
subagents.observeStart(update, item);
|
|
42
|
+
return subagents.afterToolUpdate(update, item);
|
|
43
|
+
},
|
|
44
|
+
settleOnTurnEnd: reason => subagents.settleOnTurnEnd(reason),
|
|
45
|
+
updateError: antigravityUpdateError,
|
|
46
|
+
agentWorkEnds: antigravityWorkEnds,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export const ANTIGRAVITY_WIRE_HOOKS = antigravityWireHooks(new AntigravitySubagentTracker());
|
|
28
50
|
//# sourceMappingURL=wire-updates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire-updates.js","sourceRoot":"","sources":["../../../src/runners/antigravity/wire-updates.ts"],"names":[],"mappings":"AAAA,OAAO,EAA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CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC;QACxE,eAAe,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;YAChC,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YACrC,OAAO,SAAS,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACjD,CAAC;QACD,eAAe,EAAE,MAAM,CAAC,EAAE,CAAC,SAAS,CAAC,eAAe,CAAC,MAAM,CAAC;QAC5D,WAAW,EAAE,sBAAsB;QACnC,aAAa,EAAE,mBAAmB;KACnC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC,IAAI,0BAA0B,EAAE,CAAC,CAAC"}
|
package/dist/server/server.d.ts
CHANGED
|
@@ -4188,12 +4188,21 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
4188
4188
|
"/session-context": {
|
|
4189
4189
|
$get: {
|
|
4190
4190
|
output: {
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4191
|
+
local: {
|
|
4192
|
+
path: string;
|
|
4193
|
+
exists: boolean;
|
|
4194
|
+
content: string;
|
|
4195
|
+
version: string | null;
|
|
4196
|
+
writable: boolean;
|
|
4197
|
+
readOnlyReason: string | null;
|
|
4198
|
+
};
|
|
4199
|
+
shared: {
|
|
4200
|
+
path: string;
|
|
4201
|
+
exists: boolean;
|
|
4202
|
+
content: string;
|
|
4203
|
+
tracked: boolean;
|
|
4204
|
+
unreadableReason: string | null;
|
|
4205
|
+
};
|
|
4197
4206
|
};
|
|
4198
4207
|
outputFormat: "json";
|
|
4199
4208
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
@@ -4211,8 +4220,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
4211
4220
|
}[];
|
|
4212
4221
|
blocks: {
|
|
4213
4222
|
id: string;
|
|
4223
|
+
source: 'built-in' | import("../session-context.ts").SessionContextRuleSource;
|
|
4214
4224
|
target: import("../session-context.ts").SessionContextRule['target'] | 'built-in' | null;
|
|
4215
4225
|
status: import("../session-context.ts").SessionContextReportStatus | 'not-for-role';
|
|
4226
|
+
overridesShared: boolean;
|
|
4216
4227
|
bytes: number | null;
|
|
4217
4228
|
reason: string | null;
|
|
4218
4229
|
sources: string[];
|
|
@@ -4236,12 +4247,21 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
4236
4247
|
"/session-context": {
|
|
4237
4248
|
$put: {
|
|
4238
4249
|
output: {
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4250
|
+
local: {
|
|
4251
|
+
path: string;
|
|
4252
|
+
exists: boolean;
|
|
4253
|
+
content: string;
|
|
4254
|
+
version: string | null;
|
|
4255
|
+
writable: boolean;
|
|
4256
|
+
readOnlyReason: string | null;
|
|
4257
|
+
};
|
|
4258
|
+
shared: {
|
|
4259
|
+
path: string;
|
|
4260
|
+
exists: boolean;
|
|
4261
|
+
content: string;
|
|
4262
|
+
tracked: boolean;
|
|
4263
|
+
unreadableReason: string | null;
|
|
4264
|
+
};
|
|
4245
4265
|
};
|
|
4246
4266
|
outputFormat: "json";
|
|
4247
4267
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
@@ -20910,12 +20930,21 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
20910
20930
|
"/session-context": {
|
|
20911
20931
|
$get: {
|
|
20912
20932
|
output: {
|
|
20913
|
-
|
|
20914
|
-
|
|
20915
|
-
|
|
20916
|
-
|
|
20917
|
-
|
|
20918
|
-
|
|
20933
|
+
local: {
|
|
20934
|
+
path: string;
|
|
20935
|
+
exists: boolean;
|
|
20936
|
+
content: string;
|
|
20937
|
+
version: string | null;
|
|
20938
|
+
writable: boolean;
|
|
20939
|
+
readOnlyReason: string | null;
|
|
20940
|
+
};
|
|
20941
|
+
shared: {
|
|
20942
|
+
path: string;
|
|
20943
|
+
exists: boolean;
|
|
20944
|
+
content: string;
|
|
20945
|
+
tracked: boolean;
|
|
20946
|
+
unreadableReason: string | null;
|
|
20947
|
+
};
|
|
20919
20948
|
};
|
|
20920
20949
|
outputFormat: "json";
|
|
20921
20950
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
@@ -20933,8 +20962,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
20933
20962
|
}[];
|
|
20934
20963
|
blocks: {
|
|
20935
20964
|
id: string;
|
|
20965
|
+
source: 'built-in' | import("../session-context.ts").SessionContextRuleSource;
|
|
20936
20966
|
target: import("../session-context.ts").SessionContextRule['target'] | 'built-in' | null;
|
|
20937
20967
|
status: import("../session-context.ts").SessionContextReportStatus | 'not-for-role';
|
|
20968
|
+
overridesShared: boolean;
|
|
20938
20969
|
bytes: number | null;
|
|
20939
20970
|
reason: string | null;
|
|
20940
20971
|
sources: string[];
|
|
@@ -20958,12 +20989,21 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
20958
20989
|
"/session-context": {
|
|
20959
20990
|
$put: {
|
|
20960
20991
|
output: {
|
|
20961
|
-
|
|
20962
|
-
|
|
20963
|
-
|
|
20964
|
-
|
|
20965
|
-
|
|
20966
|
-
|
|
20992
|
+
local: {
|
|
20993
|
+
path: string;
|
|
20994
|
+
exists: boolean;
|
|
20995
|
+
content: string;
|
|
20996
|
+
version: string | null;
|
|
20997
|
+
writable: boolean;
|
|
20998
|
+
readOnlyReason: string | null;
|
|
20999
|
+
};
|
|
21000
|
+
shared: {
|
|
21001
|
+
path: string;
|
|
21002
|
+
exists: boolean;
|
|
21003
|
+
content: string;
|
|
21004
|
+
tracked: boolean;
|
|
21005
|
+
unreadableReason: string | null;
|
|
21006
|
+
};
|
|
20967
21007
|
};
|
|
20968
21008
|
outputFormat: "json";
|
|
20969
21009
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
import type { ProjectApiEnv } from './server-types.ts';
|
|
2
2
|
/**
|
|
3
|
-
* Settings → Session context (hearsay-tools/squawk#4308). Writing `context.yaml`
|
|
4
|
-
* `settingsAdmin`: the file runs no host command, and its file includes
|
|
5
|
-
* (ADR 0055 gates only settings that persist host commands).
|
|
3
|
+
* Settings → Session context (hearsay-tools/squawk#4308, hearsay-tools/squawk#4341). Writing `context.local.yaml`
|
|
4
|
+
* needs no `settingsAdmin`: the file runs no host command, is gitignored, and its file includes
|
|
5
|
+
* stay inside the worktree (ADR 0055 gates only settings that persist host commands).
|
|
6
6
|
*/
|
|
7
7
|
export declare function createSessionContextRoutes(): import("hono/hono-base").HonoBase<ProjectApiEnv, {
|
|
8
8
|
"/session-context": {
|
|
9
9
|
$get: {
|
|
10
10
|
output: {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
local: {
|
|
12
|
+
path: string;
|
|
13
|
+
exists: boolean;
|
|
14
|
+
content: string;
|
|
15
|
+
version: string | null;
|
|
16
|
+
writable: boolean;
|
|
17
|
+
readOnlyReason: string | null;
|
|
18
|
+
};
|
|
19
|
+
shared: {
|
|
20
|
+
path: string;
|
|
21
|
+
exists: boolean;
|
|
22
|
+
content: string;
|
|
23
|
+
tracked: boolean;
|
|
24
|
+
unreadableReason: string | null;
|
|
25
|
+
};
|
|
17
26
|
};
|
|
18
27
|
outputFormat: "json";
|
|
19
28
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
@@ -31,8 +40,10 @@ export declare function createSessionContextRoutes(): import("hono/hono-base").H
|
|
|
31
40
|
}[];
|
|
32
41
|
blocks: {
|
|
33
42
|
id: string;
|
|
43
|
+
source: 'built-in' | import("../session-context.ts").SessionContextRuleSource;
|
|
34
44
|
target: import("../session-context.ts").SessionContextRule['target'] | 'built-in' | null;
|
|
35
45
|
status: import("../session-context.ts").SessionContextReportStatus | 'not-for-role';
|
|
46
|
+
overridesShared: boolean;
|
|
36
47
|
bytes: number | null;
|
|
37
48
|
reason: string | null;
|
|
38
49
|
sources: string[];
|
|
@@ -56,12 +67,21 @@ export declare function createSessionContextRoutes(): import("hono/hono-base").H
|
|
|
56
67
|
"/session-context": {
|
|
57
68
|
$put: {
|
|
58
69
|
output: {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
local: {
|
|
71
|
+
path: string;
|
|
72
|
+
exists: boolean;
|
|
73
|
+
content: string;
|
|
74
|
+
version: string | null;
|
|
75
|
+
writable: boolean;
|
|
76
|
+
readOnlyReason: string | null;
|
|
77
|
+
};
|
|
78
|
+
shared: {
|
|
79
|
+
path: string;
|
|
80
|
+
exists: boolean;
|
|
81
|
+
content: string;
|
|
82
|
+
tracked: boolean;
|
|
83
|
+
unreadableReason: string | null;
|
|
84
|
+
};
|
|
65
85
|
};
|
|
66
86
|
outputFormat: "json";
|
|
67
87
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
2
|
import { sessionContextPreviewRequestSchema, setSessionContextSchema } from '../contract/index.js';
|
|
3
3
|
import { previewSessionContext } from '../session-context.js';
|
|
4
|
-
import {
|
|
4
|
+
import { readSessionContextState, writeSessionContextFile } from '../session-context-file.js';
|
|
5
5
|
import { jsonZodValidator } from './validators.js';
|
|
6
6
|
/**
|
|
7
|
-
* Settings → Session context (hearsay-tools/squawk#4308). Writing `context.yaml`
|
|
8
|
-
* `settingsAdmin`: the file runs no host command, and its file includes
|
|
9
|
-
* (ADR 0055 gates only settings that persist host commands).
|
|
7
|
+
* Settings → Session context (hearsay-tools/squawk#4308, hearsay-tools/squawk#4341). Writing `context.local.yaml`
|
|
8
|
+
* needs no `settingsAdmin`: the file runs no host command, is gitignored, and its file includes
|
|
9
|
+
* stay inside the worktree (ADR 0055 gates only settings that persist host commands).
|
|
10
10
|
*/
|
|
11
11
|
export function createSessionContextRoutes() {
|
|
12
12
|
return new Hono()
|
|
13
|
-
.get('/session-context', async (c) => c.json(await
|
|
13
|
+
.get('/session-context', async (c) => c.json(await readSessionContextState(c.get('project').root)))
|
|
14
14
|
.post('/session-context/preview', jsonZodValidator(sessionContextPreviewRequestSchema), (c) => {
|
|
15
15
|
const body = c.req.valid('json');
|
|
16
16
|
return c.json(previewSessionContext({ projectRoot: c.get('project').root, content: body.content, role: body.role }));
|
|
@@ -20,7 +20,7 @@ export function createSessionContextRoutes() {
|
|
|
20
20
|
const out = await writeSessionContextFile(c.get('project').root, body.content, body.version);
|
|
21
21
|
if (!out.ok)
|
|
22
22
|
return c.json({ error: out.error }, out.status);
|
|
23
|
-
return c.json(out.
|
|
23
|
+
return c.json(out.state);
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
//# sourceMappingURL=session-context-routes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-context-routes.js","sourceRoot":"","sources":["../../src/server/session-context-routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,kCAAkC,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAC3H,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"session-context-routes.js","sourceRoot":"","sources":["../../src/server/session-context-routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,kCAAkC,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAC3H,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAA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AAG,CAAC,MAAM,CAAC,CAAC;QAC7D,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export declare function
|
|
1
|
+
import { type SessionContextState } from './contract/index.js';
|
|
2
|
+
export declare function readSessionContextState(projectRoot: string): Promise<SessionContextState>;
|
|
3
3
|
export type SessionContextWrite = {
|
|
4
4
|
ok: true;
|
|
5
|
-
|
|
5
|
+
state: SessionContextState;
|
|
6
6
|
} | {
|
|
7
7
|
ok: false;
|
|
8
8
|
status: 400 | 409 | 500;
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { createHash, randomUUID } from 'node:crypto';
|
|
2
2
|
import { lstat, mkdir, readFile, realpath, rename, rm, stat, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { dirname, join, relative } from 'node:path';
|
|
4
|
-
import { SESSION_CONTEXT_FILE_MAX_BYTES } from './contract/index.js';
|
|
4
|
+
import { SESSION_CONTEXT_FILE_MAX_BYTES, } from './contract/index.js';
|
|
5
|
+
import { ensureDataGitignore } from './data-gitignore.js';
|
|
6
|
+
import { runGit } from './git-command.js';
|
|
5
7
|
import { fallbackProjectWriteError, readProjectPath } from './project-paths.js';
|
|
6
8
|
import { parseSessionContextText } from './session-context.js';
|
|
7
9
|
/**
|
|
8
|
-
* The cockpit's read
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* file
|
|
10
|
+
* The cockpit's read of both `context.yaml` (shared, read-only) and `context.local.yaml` (local,
|
|
11
|
+
* editable), and atomic write of `context.local.yaml` (hearsay-tools/squawk#4308, hearsay-tools/squawk#4341). Writing
|
|
12
|
+
* ensures `context.local.yaml` is gitignored so host edits never dirty `git status`. Fallback
|
|
13
|
+
* project data and symlinks stay read only so a remote user cannot redirect writes onto another
|
|
14
|
+
* file such as `config.json`.
|
|
13
15
|
*/
|
|
16
|
+
const SHARED_FILE = 'context.yaml';
|
|
17
|
+
const LOCAL_FILE = 'context.local.yaml';
|
|
14
18
|
function hashBytes(content) {
|
|
15
19
|
return createHash('sha256').update(content, 'utf8').digest('hex');
|
|
16
20
|
}
|
|
@@ -73,6 +77,15 @@ async function readCurrent(projectRoot, path) {
|
|
|
73
77
|
return { exists: true, unreadable: `it cannot be read (${error.code ?? 'error'})` };
|
|
74
78
|
}
|
|
75
79
|
}
|
|
80
|
+
async function isGitTracked(projectRoot, relPath) {
|
|
81
|
+
try {
|
|
82
|
+
const { stdout } = await runGit(['ls-files', '--cached', '--', relPath.replace(/\\/g, '/')], { cwd: projectRoot, timeout: 10_000 });
|
|
83
|
+
return stdout.trim().length > 0;
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
76
89
|
function answer(projectRoot, path, current) {
|
|
77
90
|
const shown = relative(projectRoot, path);
|
|
78
91
|
const fallback = fallbackProjectWriteError(path);
|
|
@@ -90,14 +103,29 @@ function answer(projectRoot, path, current) {
|
|
|
90
103
|
writable: fallback === undefined, readOnlyReason: fallback ?? null,
|
|
91
104
|
};
|
|
92
105
|
}
|
|
93
|
-
|
|
94
|
-
const path = readProjectPath(projectRoot,
|
|
95
|
-
|
|
106
|
+
async function readSharedFile(projectRoot) {
|
|
107
|
+
const path = readProjectPath(projectRoot, SHARED_FILE);
|
|
108
|
+
const shown = relative(projectRoot, path);
|
|
109
|
+
const current = await readCurrent(projectRoot, path);
|
|
110
|
+
if (!current.exists) {
|
|
111
|
+
const unreadableReason = current.unwritable ? `Squawk cannot read ${shown}: ${current.unwritable}.` : null;
|
|
112
|
+
return { path: shown, exists: false, content: '', tracked: false, unreadableReason };
|
|
113
|
+
}
|
|
114
|
+
const tracked = await isGitTracked(projectRoot, shown);
|
|
115
|
+
if ('unreadable' in current) {
|
|
116
|
+
return { path: shown, exists: true, content: '', tracked, unreadableReason: `Squawk cannot read ${shown}: ${current.unreadable}.` };
|
|
117
|
+
}
|
|
118
|
+
return { path: shown, exists: true, content: current.content, tracked, unreadableReason: null };
|
|
119
|
+
}
|
|
120
|
+
export async function readSessionContextState(projectRoot) {
|
|
121
|
+
const localPath = readProjectPath(projectRoot, LOCAL_FILE);
|
|
122
|
+
const [localCurrent, shared] = await Promise.all([readCurrent(projectRoot, localPath), readSharedFile(projectRoot)]);
|
|
123
|
+
return { local: answer(projectRoot, localPath, localCurrent), shared };
|
|
96
124
|
}
|
|
97
125
|
/** One save at a time per file, so two saves over one version cannot both pass the check. */
|
|
98
126
|
const writing = new Map();
|
|
99
127
|
export function writeSessionContextFile(projectRoot, content, version) {
|
|
100
|
-
const path = readProjectPath(projectRoot,
|
|
128
|
+
const path = readProjectPath(projectRoot, LOCAL_FILE);
|
|
101
129
|
const previous = writing.get(path) ?? Promise.resolve();
|
|
102
130
|
const next = previous.then(() => writeChecked(projectRoot, path, content, version));
|
|
103
131
|
const settled = next.catch(() => undefined);
|
|
@@ -112,15 +140,16 @@ async function writeChecked(projectRoot, path, content, version) {
|
|
|
112
140
|
return { ok: false, status: 409, error: before.readOnlyReason ?? `${before.path} is read only` };
|
|
113
141
|
if (before.version !== version) {
|
|
114
142
|
const error = before.exists
|
|
115
|
-
? 'context.yaml changed on disk since you opened it. Show the disk version, or overwrite it.'
|
|
116
|
-
: 'context.yaml was deleted on disk since you opened it. Show the disk version, or overwrite it.';
|
|
143
|
+
? 'context.local.yaml changed on disk since you opened it. Show the disk version, or overwrite it.'
|
|
144
|
+
: 'context.local.yaml was deleted on disk since you opened it. Show the disk version, or overwrite it.';
|
|
117
145
|
return { ok: false, status: 409, error };
|
|
118
146
|
}
|
|
119
|
-
const first = parseSessionContextText(content).problems[0];
|
|
147
|
+
const first = parseSessionContextText(content, 'local', before.path).problems[0];
|
|
120
148
|
if (first) {
|
|
121
149
|
const where = first.line === null ? '' : `line ${first.line}: `;
|
|
122
|
-
return { ok: false, status: 400, error: `context.yaml has problems; fix them to save (${where}${first.message})` };
|
|
150
|
+
return { ok: false, status: 400, error: `context.local.yaml has problems; fix them to save (${where}${first.message})` };
|
|
123
151
|
}
|
|
152
|
+
ensureDataGitignore(projectRoot);
|
|
124
153
|
// The rename replaces the path itself, never a file a link points to: the check above refuses links.
|
|
125
154
|
const tmp = `${path}.hsq-tmp-${process.pid}-${randomUUID()}`;
|
|
126
155
|
try {
|
|
@@ -131,7 +160,7 @@ async function writeChecked(projectRoot, path, content, version) {
|
|
|
131
160
|
const staged = answer(projectRoot, path, await readCurrent(projectRoot, path));
|
|
132
161
|
if (staged.version !== version || !staged.writable) {
|
|
133
162
|
await rm(tmp, { force: true });
|
|
134
|
-
return { ok: false, status: 409, error: 'context.yaml changed on disk since you opened it. Show the disk version, or overwrite it.' };
|
|
163
|
+
return { ok: false, status: 409, error: 'context.local.yaml changed on disk since you opened it. Show the disk version, or overwrite it.' };
|
|
135
164
|
}
|
|
136
165
|
await rename(tmp, path);
|
|
137
166
|
}
|
|
@@ -139,6 +168,6 @@ async function writeChecked(projectRoot, path, content, version) {
|
|
|
139
168
|
await rm(tmp, { force: true });
|
|
140
169
|
return { ok: false, status: 500, error: error.message };
|
|
141
170
|
}
|
|
142
|
-
return { ok: true,
|
|
171
|
+
return { ok: true, state: await readSessionContextState(projectRoot) };
|
|
143
172
|
}
|
|
144
173
|
//# sourceMappingURL=session-context-file.js.map
|