carrick 0.3.145 → 0.3.147
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/bin/carrick.mjs +4 -4
- package/dist/cli.d.ts +8 -1
- package/dist/cli.js +14 -2
- package/dist/cli.js.map +1 -1
- package/dist/contract.d.ts +31 -0
- package/dist/contract.js +29 -3
- package/dist/contract.js.map +1 -1
- package/dist/diagnostics.js +1 -9
- package/dist/diagnostics.js.map +1 -1
- package/dist/fs-util.d.ts +6 -0
- package/dist/fs-util.js +29 -0
- package/dist/fs-util.js.map +1 -0
- package/dist/global-install.js +1 -8
- package/dist/global-install.js.map +1 -1
- package/dist/hook/apply-patch.js +3 -4
- package/dist/hook/apply-patch.js.map +1 -1
- package/dist/hook/checked.d.ts +3 -1
- package/dist/hook/checked.js +9 -2
- package/dist/hook/checked.js.map +1 -1
- package/dist/hook/late.js +9 -2
- package/dist/hook/late.js.map +1 -1
- package/dist/hook/post-edit.js +33 -24
- package/dist/hook/post-edit.js.map +1 -1
- package/dist/hook/post-read.js +1 -6
- package/dist/hook/post-read.js.map +1 -1
- package/dist/hook/rechecks.d.ts +45 -1
- package/dist/hook/rechecks.js +116 -10
- package/dist/hook/rechecks.js.map +1 -1
- package/dist/hook/reuse.d.ts +31 -58
- package/dist/hook/reuse.js +48 -112
- package/dist/hook/reuse.js.map +1 -1
- package/dist/hook/session-start.d.ts +9 -0
- package/dist/hook/session-start.js +43 -16
- package/dist/hook/session-start.js.map +1 -1
- package/dist/hook/stdin.d.ts +2 -0
- package/dist/hook/stdin.js +8 -0
- package/dist/hook/stdin.js.map +1 -0
- package/dist/hook/stop-wait.d.ts +24 -1
- package/dist/hook/stop-wait.js +163 -28
- package/dist/hook/stop-wait.js.map +1 -1
- package/dist/hook/stop.js +17 -36
- package/dist/hook/stop.js.map +1 -1
- package/dist/hook/user-prompt.js +13 -30
- package/dist/hook/user-prompt.js.map +1 -1
- package/dist/hosted-snapshot.d.ts +37 -0
- package/dist/hosted-snapshot.js +49 -0
- package/dist/hosted-snapshot.js.map +1 -0
- package/dist/init/agents-section.d.ts +16 -2
- package/dist/init/agents-section.js +43 -7
- package/dist/init/agents-section.js.map +1 -1
- package/dist/init/codex.js +8 -7
- package/dist/init/codex.js.map +1 -1
- package/dist/init/mcp.js +1 -3
- package/dist/init/mcp.js.map +1 -1
- package/dist/init/remove.d.ts +2 -0
- package/dist/init/remove.js +18 -4
- package/dist/init/remove.js.map +1 -1
- package/dist/init/repo-copies.js +2 -10
- package/dist/init/repo-copies.js.map +1 -1
- package/dist/init/repos.d.ts +0 -2
- package/dist/init/repos.js +1 -9
- package/dist/init/repos.js.map +1 -1
- package/dist/init/run.js +14 -4
- package/dist/init/run.js.map +1 -1
- package/dist/init/self-update.d.ts +2 -2
- package/dist/init/self-update.js +89 -3
- package/dist/init/self-update.js.map +1 -1
- package/dist/init/settings.js +5 -7
- package/dist/init/settings.js.map +1 -1
- package/dist/native.js +1 -9
- package/dist/native.js.map +1 -1
- package/dist/render.d.ts +54 -11
- package/dist/render.js +188 -34
- package/dist/render.js.map +1 -1
- package/dist/root.d.ts +1 -2
- package/dist/root.js +1 -9
- package/dist/root.js.map +1 -1
- package/dist/surfaces.js +1 -3
- package/dist/surfaces.js.map +1 -1
- package/package.json +6 -6
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/sidecar/dist/src/bundler.js +30 -28
- package/sidecar/dist/src/capture/service-config.d.ts +6 -0
- package/sidecar/dist/src/capture/service-config.js +11 -1
- package/sidecar/dist/src/library-claims.js +14 -0
- package/sidecar/dist/src/platform-body-read.d.ts +46 -0
- package/sidecar/dist/src/platform-body-read.js +82 -0
- package/sidecar/dist/src/response-modes.d.ts +5 -4
- package/sidecar/dist/src/response-modes.js +21 -25
- package/sidecar/dist/src/retype.js +11 -16
- package/sidecar/dist/src/stated-params.d.ts +6 -0
- package/sidecar/dist/src/stated-params.js +13 -0
- package/sidecar/dist/src/type-inferrer.d.ts +47 -14
- package/sidecar/dist/src/type-inferrer.js +119 -62
- package/sidecar/dist/src/types.d.ts +20 -3
- package/templates/skills/carrick-census.md +24 -3
- package/templates/skills/carrick-drift.md +11 -3
- package/templates/skills/carrick-impact.md +8 -3
- package/dist/hook/edited.d.ts +0 -22
- package/dist/hook/edited.js +0 -84
- package/dist/hook/edited.js.map +0 -1
package/dist/hook/stop-wait.js
CHANGED
|
@@ -4,17 +4,30 @@
|
|
|
4
4
|
//
|
|
5
5
|
// Order, as the Stop hook calls it: restart a dead runner, deliver finished
|
|
6
6
|
// answers, poll every 250 ms until nothing this session has not yet been told
|
|
7
|
-
// about is pending (or the wait is up), deliver again, then
|
|
8
|
-
//
|
|
9
|
-
// answers riding along: a Stop `additionalContext` continues the
|
|
10
|
-
// "no contract problem" would cost a model turn on every reply.
|
|
7
|
+
// about is pending (or the wait is up), deliver again, then state the
|
|
8
|
+
// session's check. Only answers with something to act on are printed, with
|
|
9
|
+
// any clean answers riding along: a Stop `additionalContext` continues the
|
|
10
|
+
// turn, so "no contract problem" would cost a model turn on every reply.
|
|
11
11
|
//
|
|
12
|
-
//
|
|
12
|
+
// The session's check (carrick#3466), once per change and per workspace:
|
|
13
|
+
// when every file the session edited has a finished re-check newer than its
|
|
14
|
+
// last edit, with no service judged at its indexed version, one "Carrick
|
|
15
|
+
// checked the N files" line replaces the per-answer lines, at no extra wait.
|
|
16
|
+
// Otherwise one line names each file not answered and why, and one `carrick
|
|
17
|
+
// check --changed` is queued behind the re-checks. Stop never waits for it;
|
|
18
|
+
// its answer comes with the next carrier (`late.ts`). Either way no line asks
|
|
19
|
+
// the agent to run the check: the clause is printed only for a workspace this
|
|
20
|
+
// session recorded no edited file in.
|
|
21
|
+
//
|
|
22
|
+
// Reference: the B3 scope in the Arber workflow plan (pins S4, S5, S6c), and
|
|
23
|
+
// carrick#3466 for the session's check.
|
|
13
24
|
import { problemItems } from "../contract.js";
|
|
14
25
|
import { createLogger } from "../log.js";
|
|
15
|
-
import { answersTheEdit, movedLines, renderPostToolUse,
|
|
26
|
+
import { answersTheEdit, movedLines, notCoveredLine, renderPostToolUse, sessionCheckedLines, staleClause, } from "../render.js";
|
|
16
27
|
import { checkedSinceLastEdit } from "./checked.js";
|
|
17
|
-
import {
|
|
28
|
+
import { lateContext } from "./late.js";
|
|
29
|
+
import { claimDelivery, enqueueChanged, ensureRunner, finishedFor, isChanged, markToldRunning, newestPerFile, pendingFor, } from "./rechecks.js";
|
|
30
|
+
import { markStated, readSession } from "./reuse.js";
|
|
18
31
|
const log = createLogger("carrick-stop");
|
|
19
32
|
/** How long Stop waits when its entry carries no `--wait-s` (an older install). */
|
|
20
33
|
export const DEFAULT_WAIT_S = 3;
|
|
@@ -34,6 +47,8 @@ export function waitSeconds(argv) {
|
|
|
34
47
|
}
|
|
35
48
|
/** Whether an answer needs the reader to act, or only reports a clean file. */
|
|
36
49
|
function actionable(answer) {
|
|
50
|
+
if (isChanged(answer))
|
|
51
|
+
return true;
|
|
37
52
|
const result = answer.result;
|
|
38
53
|
if (answer.state !== "answered" || result === undefined)
|
|
39
54
|
return true;
|
|
@@ -45,19 +60,28 @@ function actionable(answer) {
|
|
|
45
60
|
return true;
|
|
46
61
|
return (result.recheck?.scope?.stale ?? []).length > 0;
|
|
47
62
|
}
|
|
63
|
+
/** Whether an answer holds a row to act on: a problem, a moved row, a deletion. */
|
|
64
|
+
function hasFindings(answer) {
|
|
65
|
+
const result = answer.result;
|
|
66
|
+
if (answer.state !== "answered" || result === undefined || result.error || !answersTheEdit(result))
|
|
67
|
+
return false;
|
|
68
|
+
return Boolean(result.deleted) || problemItems(result).length > 0 || movedLines(result).length > 0;
|
|
69
|
+
}
|
|
48
70
|
/** One answer's lines, for a reader who was not told this edit was being re-checked. */
|
|
49
71
|
function render(answer, settled) {
|
|
72
|
+
if (isChanged(answer))
|
|
73
|
+
return lateContext(answer, false) ?? "";
|
|
50
74
|
const where = answer.relative;
|
|
51
75
|
const result = answer.result;
|
|
52
76
|
if (answer.state !== "answered" || result === undefined || result.error) {
|
|
53
77
|
const reason = answer.failure ?? "the re-check gave no answer";
|
|
54
|
-
return `Carrick: ${where} was not re-checked: ${reason.replace(/\.+$/, "")}
|
|
78
|
+
return `Carrick: ${where} was not re-checked: ${reason.replace(/\.+$/, "")}.`;
|
|
55
79
|
}
|
|
56
80
|
if (!answersTheEdit(result)) {
|
|
57
81
|
const reason = result.recheck?.reason;
|
|
58
82
|
return reason
|
|
59
|
-
? `Carrick: ${where} was not re-checked: ${reason.replace(/\.+$/, "")}
|
|
60
|
-
: `Carrick: ${where} was not re-checked here
|
|
83
|
+
? `Carrick: ${where} was not re-checked: ${reason.replace(/\.+$/, "")}.`
|
|
84
|
+
: `Carrick: ${where} was not re-checked here.`;
|
|
61
85
|
}
|
|
62
86
|
return renderPostToolUse(result, where, { uses: false, late: true, settled }) ?? "";
|
|
63
87
|
}
|
|
@@ -70,25 +94,82 @@ function collect(session, home, now) {
|
|
|
70
94
|
}
|
|
71
95
|
return mine;
|
|
72
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Whether the per-file re-checks answered every file this session edited in
|
|
99
|
+
* the workspace at `root` (carrick#3466). A file is covered when its newest
|
|
100
|
+
* entry was queued (or answered in hand) at or after its last edit, is
|
|
101
|
+
* answered with no error, answers the edit as it stands on disk, and judged
|
|
102
|
+
* no service that reads it at its indexed version. Everything else is a gap,
|
|
103
|
+
* with the reason a reader can act on.
|
|
104
|
+
*/
|
|
105
|
+
export function sessionCoverage(session, root, home, now = Date.now()) {
|
|
106
|
+
const record = readSession(session, home);
|
|
107
|
+
const edits = Object.entries(record.files).filter(([, edit]) => edit.root === root);
|
|
108
|
+
const newest = newestPerFile(session, home);
|
|
109
|
+
const coverage = { files: edits.length, upTo: record.edited[root] ?? 0, covered: [], gaps: [] };
|
|
110
|
+
for (const [file, edit] of edits) {
|
|
111
|
+
const relative = file.startsWith(`${root}/`) ? file.slice(root.length + 1) : file;
|
|
112
|
+
const gap = (reason) => coverage.gaps.push({ file: relative, reason });
|
|
113
|
+
const held = newest.get(file);
|
|
114
|
+
if (held === undefined) {
|
|
115
|
+
gap("no re-check answered it");
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
const { entry, answer } = held;
|
|
119
|
+
if (Date.parse(entry.enqueued_at) < edit.at) {
|
|
120
|
+
gap("it was edited after its last re-check");
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (answer === null) {
|
|
124
|
+
const seconds = Math.max(0, Math.round((now - Date.parse(entry.enqueued_at)) / 1000));
|
|
125
|
+
gap(`its re-check is still running after ${seconds} s`);
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
const result = answer.result;
|
|
129
|
+
if (answer.state !== "answered" || result === undefined) {
|
|
130
|
+
gap(answer.failure ?? "the re-check gave no answer");
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
if (result.error) {
|
|
134
|
+
gap(result.message ?? result.error);
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (!answersTheEdit(result)) {
|
|
138
|
+
gap(result.recheck?.reason ?? "no re-check of it ran");
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
const stale = result.recheck?.scope?.stale ?? [];
|
|
142
|
+
if (stale.length > 0) {
|
|
143
|
+
gap(staleClause(stale, "it"));
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
coverage.covered.push(answer);
|
|
147
|
+
}
|
|
148
|
+
return coverage;
|
|
149
|
+
}
|
|
73
150
|
export async function stopAnswers(session, options) {
|
|
74
151
|
const clock = options.now ?? Date.now;
|
|
75
152
|
const sleep = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
76
153
|
const ensure = options.ensure ?? ((root) => ensureRunner(root));
|
|
77
154
|
const home = options.home;
|
|
78
|
-
|
|
155
|
+
// A queued `check --changed` is never waited for: it runs after every
|
|
156
|
+
// per-file entry, and its answer comes with the next carrier.
|
|
157
|
+
const toWaitFor = () => pendingFor(session, home).filter((entry) => !entry.toldRunning && !isChanged(entry));
|
|
79
158
|
const delivered = collect(session, home, clock());
|
|
80
159
|
// A runner that died holding the queue would hold the reply for the whole
|
|
81
|
-
// wait: start one before waiting.
|
|
160
|
+
// wait: start one before waiting. A queued `check --changed` needs one too,
|
|
161
|
+
// though Stop does not wait for it.
|
|
162
|
+
for (const root of new Set(pendingFor(session, home).map((entry) => entry.root))) {
|
|
163
|
+
try {
|
|
164
|
+
ensure(root);
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
log("could not restart the re-check runner", String(error));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
delivered.push(...collect(session, home, clock()));
|
|
82
171
|
const waiting = toWaitFor();
|
|
83
172
|
if (waiting.length > 0) {
|
|
84
|
-
for (const root of new Set(waiting.map((entry) => entry.root))) {
|
|
85
|
-
try {
|
|
86
|
-
ensure(root);
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
log("could not restart the re-check runner", String(error));
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
173
|
const deadline = clock() + options.waitS * 1000;
|
|
93
174
|
while (toWaitFor().length > 0 && clock() < deadline) {
|
|
94
175
|
await sleep(Math.min(POLL_MS, Math.max(0, deadline - clock())));
|
|
@@ -96,24 +177,78 @@ export async function stopAnswers(session, options) {
|
|
|
96
177
|
}
|
|
97
178
|
delivered.push(...collect(session, home, clock()));
|
|
98
179
|
}
|
|
99
|
-
|
|
100
|
-
|
|
180
|
+
// The session's check, per workspace with an edit Stop has not yet spoken
|
|
181
|
+
// about. A clean `check --changed` the agent ran since that edit already
|
|
182
|
+
// said it: the per-answer lines below then speak as before.
|
|
183
|
+
const record = readSession(session, home);
|
|
184
|
+
const roots = new Set(Object.values(record.files).map((edit) => edit.root));
|
|
185
|
+
const stated = new Map();
|
|
186
|
+
const folded = new Set();
|
|
187
|
+
const gapped = new Set();
|
|
188
|
+
for (const root of roots) {
|
|
189
|
+
const upTo = record.edited[root] ?? 0;
|
|
190
|
+
if ((record.stated[root] ?? -1) >= upTo)
|
|
191
|
+
continue;
|
|
192
|
+
if (checkedSinceLastEdit(session, root, home))
|
|
193
|
+
continue;
|
|
194
|
+
const coverage = sessionCoverage(session, root, home, clock());
|
|
195
|
+
if (coverage.files === 0)
|
|
196
|
+
continue;
|
|
197
|
+
if (coverage.gaps.length === 0) {
|
|
198
|
+
const fresh = delivered
|
|
199
|
+
.filter((answer) => answer.root === root && !isChanged(answer) && answer.result !== undefined)
|
|
200
|
+
.map((answer) => ({ result: answer.result, where: answer.relative }));
|
|
201
|
+
stated.set(root, sessionCheckedLines(coverage.covered.map((answer) => answer.result), fresh));
|
|
202
|
+
for (const answer of delivered)
|
|
203
|
+
if (answer.root === root && !isChanged(answer))
|
|
204
|
+
folded.add(answer.seq);
|
|
205
|
+
markStated(session, root, coverage.upTo, true, home);
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
const queued = enqueueChanged(root, session, clock(), { home });
|
|
209
|
+
if (queued === null) {
|
|
210
|
+
log("could not queue check --changed for", root);
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
try {
|
|
214
|
+
ensure(root);
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
log("could not start the re-check runner", String(error));
|
|
218
|
+
}
|
|
219
|
+
stated.set(root, notCoveredLine(coverage.gaps));
|
|
220
|
+
gapped.add(root);
|
|
221
|
+
// An answer whose only news is the gap the line just named says nothing more.
|
|
101
222
|
for (const answer of delivered) {
|
|
102
|
-
|
|
223
|
+
if (answer.root === root && !isChanged(answer) && !hasFindings(answer))
|
|
224
|
+
folded.add(answer.seq);
|
|
225
|
+
}
|
|
226
|
+
markStated(session, root, coverage.upTo, false, home);
|
|
227
|
+
}
|
|
228
|
+
// No clause where Stop stated the change, now or at an earlier Stop: it
|
|
229
|
+
// either checked it or queued the check itself.
|
|
230
|
+
const after = readSession(session, home);
|
|
231
|
+
const settledAt = (root) => (after.stated[root] ?? -1) >= (after.edited[root] ?? 0) || checkedSinceLastEdit(session, root, home);
|
|
232
|
+
const lines = [...stated.values()];
|
|
233
|
+
const rest = delivered.filter((answer) => !folded.has(answer.seq));
|
|
234
|
+
if (rest.some(actionable)) {
|
|
235
|
+
for (const answer of rest) {
|
|
236
|
+
const text = render(answer, settledAt(answer.root));
|
|
103
237
|
if (text)
|
|
104
238
|
lines.push(text);
|
|
105
239
|
}
|
|
106
240
|
}
|
|
107
241
|
// Still running after the wait: said once per entry. A second Stop never
|
|
108
242
|
// waits twice for it, and the next Stop after the answer lands delivers it.
|
|
243
|
+
// A workspace whose gap line named it does not name it twice.
|
|
109
244
|
const running = toWaitFor().filter((entry) => markToldRunning(session, entry.seq, home));
|
|
110
|
-
|
|
245
|
+
const unnamed = running.filter((entry) => !gapped.has(entry.root));
|
|
246
|
+
if (unnamed.length > 0) {
|
|
111
247
|
const at = clock();
|
|
112
|
-
const files = [...new Set(
|
|
113
|
-
const oldest = Math.max(...
|
|
248
|
+
const files = [...new Set(unnamed.map((entry) => entry.relative))];
|
|
249
|
+
const oldest = Math.max(...unnamed.map((entry) => at - Date.parse(entry.enqueued_at)));
|
|
114
250
|
const seconds = Math.max(0, Math.round(oldest / 1000));
|
|
115
|
-
|
|
116
|
-
lines.push(`Carrick: the re-check of ${files.join(", ")} is still running after ${seconds} s.${runClause(settled)}`);
|
|
251
|
+
lines.push(`Carrick: the re-check of ${files.join(", ")} is still running after ${seconds} s.`);
|
|
117
252
|
}
|
|
118
253
|
return { lines };
|
|
119
254
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stop-wait.js","sourceRoot":"","sources":["../../src/hook/stop-wait.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,8EAA8E;AAC9E,oEAAoE;AACpE,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,+EAA+E;AAC/E,6EAA6E;AAC7E,0EAA0E;AAC1E,gEAAgE;AAChE,EAAE;AACF,yEAAyE;AAG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ered,
|
|
3
|
+
// and a wait for the ones still running (`stop-wait.ts`, carrick#3198). It
|
|
4
|
+
// reports what the agent's edits came to; it never asks the agent to start
|
|
5
|
+
// something new at the end of a task (carrick#3436).
|
|
3
6
|
//
|
|
4
7
|
// What it prints, and why that shape: Claude Code delivers a Stop hook's
|
|
5
8
|
// `hookSpecificOutput.additionalContext` to the MODEL and lets the turn
|
|
@@ -7,35 +10,25 @@
|
|
|
7
10
|
// both wrong for this: `systemMessage` is shown to the user and never reaches
|
|
8
11
|
// the model (measured, carrick session 2026-09-03 — a Stop hook fired in 21
|
|
9
12
|
// sessions and changed nothing), and `decision: "block"` reaches the model by
|
|
10
|
-
// refusing to let the turn end, which is a block.
|
|
13
|
+
// refusing to let the turn end, which is a block.
|
|
11
14
|
//
|
|
12
|
-
// It
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
15
|
+
// It states the session's contract check once per change (carrick#3466): one
|
|
16
|
+
// line when the per-file re-checks answered every edited file, else the files
|
|
17
|
+
// they did not and a queued `check --changed`. Otherwise it is silent when it
|
|
18
|
+
// has nothing to say: no session id, no re-check answer with something to act
|
|
19
|
+
// on, nothing still running.
|
|
17
20
|
//
|
|
18
|
-
//
|
|
19
|
-
// for the ones still running (`stop-wait.ts`).
|
|
21
|
+
// It exits 0 on every path, like the other hooks.
|
|
20
22
|
//
|
|
21
|
-
//
|
|
22
|
-
|
|
23
|
-
// Reference: `docs/reference/task-skills.md`, "The reuse nudge" — the three
|
|
24
|
-
// parts, the channel measurement behind this shape, and what Codex lacks.
|
|
23
|
+
// Reference: `docs/reference/task-skills.md`, "What the hooks deliver".
|
|
24
|
+
import { readStdin } from "./stdin.js";
|
|
25
25
|
import { createLogger } from "../log.js";
|
|
26
26
|
import { resolveChannel } from "../channel.js";
|
|
27
|
-
import { drain } from "./reuse.js";
|
|
28
27
|
import { initialisedRoot, throttledVersionMismatch } from "../init/outdated.js";
|
|
29
28
|
import { currentVersion } from "../update.js";
|
|
30
29
|
import { markInvoker } from "./invoker.js";
|
|
31
30
|
import { stopAnswers, waitSeconds } from "./stop-wait.js";
|
|
32
31
|
const log = createLogger("carrick-stop");
|
|
33
|
-
async function readStdin() {
|
|
34
|
-
const chunks = [];
|
|
35
|
-
for await (const chunk of process.stdin)
|
|
36
|
-
chunks.push(Buffer.from(chunk));
|
|
37
|
-
return Buffer.concat(chunks).toString("utf8");
|
|
38
|
-
}
|
|
39
32
|
/** The one channel a Stop hook has that the model reads. */
|
|
40
33
|
export function emission(context) {
|
|
41
34
|
return JSON.stringify({
|
|
@@ -49,7 +42,7 @@ async function main() {
|
|
|
49
42
|
markInvoker("stop");
|
|
50
43
|
// `off` silences every surface this package has, and this is one of them.
|
|
51
44
|
// The `lsp` channel is NOT excluded: it decides who delivers a verdict about
|
|
52
|
-
// an edited file, and
|
|
45
|
+
// an edited file as it is edited, and the language server has no Stop.
|
|
53
46
|
if (resolveChannel({ hooksInstalled: true }).channel === "off") {
|
|
54
47
|
log("CARRICK_CHANNEL=off; printing nothing");
|
|
55
48
|
return;
|
|
@@ -67,34 +60,22 @@ async function main() {
|
|
|
67
60
|
log("no session id in the payload; nothing to look up");
|
|
68
61
|
return;
|
|
69
62
|
}
|
|
70
|
-
//
|
|
71
|
-
//
|
|
72
|
-
// Before the nudge, so functions the runner recorded meanwhile are named.
|
|
63
|
+
// What the background re-checks of this session's edits answered, and a
|
|
64
|
+
// wait for the ones still running (`--wait-s`, from the settings entry).
|
|
73
65
|
const parts = [];
|
|
74
66
|
const late = await stopAnswers(session, { waitS: waitSeconds(process.argv.slice(2)) });
|
|
75
67
|
parts.push(...late.lines);
|
|
76
|
-
// `drain` reads the store, builds the line and marks the set as spoken, in
|
|
77
|
-
// that order. Codex's `UserPromptSubmit` hook calls the same function
|
|
78
|
-
// (carrick#1335); the difference between the two hosts is the event name on
|
|
79
|
-
// the wire and nothing else.
|
|
80
|
-
const root = initialisedRoot(process.env["CLAUDE_PROJECT_DIR"] ?? process.cwd());
|
|
81
|
-
const spoken = drain(session, root);
|
|
82
|
-
if (spoken === null)
|
|
83
|
-
log(`nothing new in ${session}: everything recorded has been named`);
|
|
84
|
-
else
|
|
85
|
-
parts.push(spoken.line);
|
|
86
68
|
// The other thing a task's end is a good moment for: the `carrick` these
|
|
87
69
|
// hooks resolve is not the one that set this workspace up (carrick#1372).
|
|
88
70
|
// Once a day, through the same channel, because a mismatch stands until
|
|
89
71
|
// somebody fixes it and a line per turn would be noise.
|
|
72
|
+
const root = initialisedRoot(process.env["CLAUDE_PROJECT_DIR"] ?? process.cwd());
|
|
90
73
|
const mismatch = root === null ? null : throttledVersionMismatch(root, currentVersion());
|
|
91
74
|
if (mismatch)
|
|
92
75
|
parts.push(mismatch);
|
|
93
76
|
if (parts.length === 0)
|
|
94
77
|
return;
|
|
95
78
|
process.stdout.write(emission(parts.join("\n\n")));
|
|
96
|
-
if (spoken)
|
|
97
|
-
log(`named ${spoken.named} new function(s) to the model, of ${spoken.found} recorded`);
|
|
98
79
|
}
|
|
99
80
|
await main();
|
|
100
81
|
process.exit(0);
|
package/dist/hook/stop.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stop.js","sourceRoot":"","sources":["../../src/hook/stop.ts"],"names":[],"mappings":";AACA,
|
|
1
|
+
{"version":3,"file":"stop.js","sourceRoot":"","sources":["../../src/hook/stop.ts"],"names":[],"mappings":";AACA,6EAA6E;AAC7E,2EAA2E;AAC3E,2EAA2E;AAC3E,qDAAqD;AACrD,EAAE;AACF,yEAAyE;AACzE,wEAAwE;AACxE,4EAA4E;AAC5E,8EAA8E;AAC9E,4EAA4E;AAC5E,8EAA8E;AAC9E,kDAAkD;AAClD,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,6BAA6B;AAC7B,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,wEAAwE;AAExE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,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CAAC;QACxD,OAAO;IACT,CAAC;IAED,wEAAwE;IACxE,yEAAyE;IACzE,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACvF,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAE1B,yEAAyE;IACzE,0EAA0E;IAC1E,wEAAwE;IACxE,wDAAwD;IACxD,MAAM,IAAI,GAAG,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACjF,MAAM,QAAQ,GAAG,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,wBAAwB,CAAC,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;IACzF,IAAI,QAAQ;QAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAEnC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAC/B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,IAAI,EAAE,CAAC;AACb,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC"}
|
package/dist/hook/user-prompt.js
CHANGED
|
@@ -1,40 +1,31 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// UserPromptSubmit hook
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
// package installs for Claude Code — `drain` is the shared half and the only
|
|
6
|
-
// difference is which event carries the line.
|
|
2
|
+
// UserPromptSubmit hook, on Codex (carrick#1335): the finished background
|
|
3
|
+
// re-checks that Claude Code's Stop hook would deliver. It names no function a
|
|
4
|
+
// task added (carrick#3436), as the Stop hook does not.
|
|
7
5
|
//
|
|
8
6
|
// Why this event and not `Stop`. Codex accepts `additionalContext` on
|
|
9
7
|
// `PreToolUse`, `PostToolUse`, `SessionStart`, `UserPromptSubmit` and
|
|
10
8
|
// `SubagentStart`, and warns "this event cannot emit additionalContext" for
|
|
11
9
|
// every other one (`codex-rs/hooks/src/engine/discovery.rs`). A Codex `Stop`
|
|
12
|
-
// hook can reach the model only by refusing to let the turn end,
|
|
13
|
-
//
|
|
14
|
-
//
|
|
10
|
+
// hook can reach the model only by refusing to let the turn end, which is a
|
|
11
|
+
// block. `UserPromptSubmit` is the one event that is both model-visible and
|
|
12
|
+
// non-blocking there.
|
|
15
13
|
//
|
|
16
|
-
// What that costs:
|
|
17
|
-
// of the task that earned it, and a run that ends on that task never sees
|
|
18
|
-
//
|
|
19
|
-
// spoken once, whenever the next prompt comes, and never again.
|
|
14
|
+
// What that costs: an answer arrives with the NEXT prompt rather than at the
|
|
15
|
+
// end of the task that earned it, and a run that ends on that task never sees
|
|
16
|
+
// it. Each answer is delivered once (`deliverLate`).
|
|
20
17
|
//
|
|
21
|
-
// It exits 0 on every path, like the other
|
|
18
|
+
// It exits 0 on every path, like the other hooks. A prompt never fails because
|
|
22
19
|
// Carrick had nothing to say.
|
|
23
20
|
//
|
|
24
|
-
// Reference: `docs/reference/task-skills.md`, "
|
|
21
|
+
// Reference: `docs/reference/task-skills.md`, "What the hooks deliver".
|
|
22
|
+
import { readStdin } from "./stdin.js";
|
|
25
23
|
import { createLogger } from "../log.js";
|
|
26
24
|
import { resolveChannel } from "../channel.js";
|
|
27
25
|
import { deliverLate } from "./late.js";
|
|
28
|
-
import { drain } from "./reuse.js";
|
|
29
26
|
import { initialisedRoot, throttledVersionMismatch } from "../init/outdated.js";
|
|
30
27
|
import { currentVersion } from "../update.js";
|
|
31
28
|
const log = createLogger("carrick-user-prompt");
|
|
32
|
-
async function readStdin() {
|
|
33
|
-
const chunks = [];
|
|
34
|
-
for await (const chunk of process.stdin)
|
|
35
|
-
chunks.push(Buffer.from(chunk));
|
|
36
|
-
return Buffer.concat(chunks).toString("utf8");
|
|
37
|
-
}
|
|
38
29
|
/**
|
|
39
30
|
* The one channel a `UserPromptSubmit` hook has that the model reads.
|
|
40
31
|
*
|
|
@@ -69,15 +60,9 @@ async function main() {
|
|
|
69
60
|
log("no session id in the payload; nothing to look up");
|
|
70
61
|
return;
|
|
71
62
|
}
|
|
72
|
-
// Finished background re-checks
|
|
73
|
-
// then the reuse nudge, which is about what the whole task added.
|
|
63
|
+
// Finished background re-checks (Codex has no Stop to carry them).
|
|
74
64
|
const parts = [...deliverLate(session)];
|
|
75
65
|
const root = initialisedRoot(process.env["CLAUDE_PROJECT_DIR"] ?? process.cwd());
|
|
76
|
-
const spoken = drain(session, root);
|
|
77
|
-
if (spoken === null)
|
|
78
|
-
log(`nothing new in ${session}: everything recorded has been named`);
|
|
79
|
-
else
|
|
80
|
-
parts.push(spoken.line);
|
|
81
66
|
// The same backstop the other hooks carry: this `carrick` is not the one
|
|
82
67
|
// that set this workspace up (carrick#1372), once a day per workspace.
|
|
83
68
|
const mismatch = root === null ? null : throttledVersionMismatch(root, currentVersion());
|
|
@@ -86,8 +71,6 @@ async function main() {
|
|
|
86
71
|
if (parts.length === 0)
|
|
87
72
|
return;
|
|
88
73
|
process.stdout.write(emission(parts.join("\n\n")));
|
|
89
|
-
if (spoken)
|
|
90
|
-
log(`named ${spoken.named} new function(s) to the model, of ${spoken.found} recorded`);
|
|
91
74
|
}
|
|
92
75
|
await main();
|
|
93
76
|
process.exit(0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-prompt.js","sourceRoot":"","sources":["../../src/hook/user-prompt.ts"],"names":[],"mappings":";AACA,
|
|
1
|
+
{"version":3,"file":"user-prompt.js","sourceRoot":"","sources":["../../src/hook/user-prompt.ts"],"names":[],"mappings":";AACA,0EAA0E;AAC1E,+EAA+E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MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1C,OAAO;IACT,CAAC;IACD,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;IACnC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,GAAG,CAAC,kDAAkD,CAAC,CAAC;QACxD,OAAO;IACT,CAAC;IAED,mEAAmE;IACnE,MAAM,KAAK,GAAa,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;IAClD,MAAM,IAAI,GAAG,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAEjF,yEAAyE;IACzE,uEAAuE;IACvE,MAAM,QAAQ,GAAG,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,wBAAwB,CAAC,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;IACzF,IAAI,QAAQ;QAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAEnC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAC/B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,IAAI,EAAE,CAAC;AACb,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `resolution.repos` of the workspace's cached hosted snapshot
|
|
3
|
+
* (`.carrick/hosted/snapshot.json`, written by the hosted refresh), or null
|
|
4
|
+
* where the file is missing, unreadable, or holds no such array.
|
|
5
|
+
*/
|
|
6
|
+
export declare function snapshotRepos(root: string): unknown[] | null;
|
|
7
|
+
/**
|
|
8
|
+
* One repo of the record below: the hosted index the cloud held for it at the
|
|
9
|
+
* last check, the copy this machine compares against, and whether HEAD can
|
|
10
|
+
* take the first (`SyncedRepo` in `src/local_mode/hosted.rs`).
|
|
11
|
+
*/
|
|
12
|
+
export type SyncedRepo = {
|
|
13
|
+
repo: string;
|
|
14
|
+
hosted_commit: string;
|
|
15
|
+
hosted_scanned_at: string | null;
|
|
16
|
+
copy_commit: string;
|
|
17
|
+
copy_scanned_at: string | null;
|
|
18
|
+
head_holds_hosted: boolean;
|
|
19
|
+
fetched: boolean;
|
|
20
|
+
behind: number | null;
|
|
21
|
+
head_detached: boolean;
|
|
22
|
+
};
|
|
23
|
+
/** `.carrick/hosted/last-sync.json` (`carrick.hosted-sync/0`). */
|
|
24
|
+
export type SyncRecord = {
|
|
25
|
+
schema: "carrick.hosted-sync/0";
|
|
26
|
+
at: string;
|
|
27
|
+
outcome: string;
|
|
28
|
+
reason: string | null;
|
|
29
|
+
repos: SyncedRepo[];
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The record the last `carrick refresh --hosted-only` the cloud answered
|
|
33
|
+
* wrote (carrick#3432), or null where there is none or it is of another shape.
|
|
34
|
+
* A few hundred bytes, so the session start reads it where it could not read
|
|
35
|
+
* the snapshot beside it.
|
|
36
|
+
*/
|
|
37
|
+
export declare function lastSync(root: string): SyncRecord | null;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
/**
|
|
4
|
+
* `resolution.repos` of the workspace's cached hosted snapshot
|
|
5
|
+
* (`.carrick/hosted/snapshot.json`, written by the hosted refresh), or null
|
|
6
|
+
* where the file is missing, unreadable, or holds no such array.
|
|
7
|
+
*/
|
|
8
|
+
export function snapshotRepos(root) {
|
|
9
|
+
try {
|
|
10
|
+
const parsed = JSON.parse(fs.readFileSync(path.join(root, ".carrick", "hosted", "snapshot.json"), "utf8"));
|
|
11
|
+
const repos = parsed?.resolution?.repos;
|
|
12
|
+
return Array.isArray(repos) ? repos : null;
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The record the last `carrick refresh --hosted-only` the cloud answered
|
|
20
|
+
* wrote (carrick#3432), or null where there is none or it is of another shape.
|
|
21
|
+
* A few hundred bytes, so the session start reads it where it could not read
|
|
22
|
+
* the snapshot beside it.
|
|
23
|
+
*/
|
|
24
|
+
export function lastSync(root) {
|
|
25
|
+
const dir = path.join(root, ".carrick", "hosted");
|
|
26
|
+
const file = path.join(dir, "last-sync.json");
|
|
27
|
+
try {
|
|
28
|
+
// A full `carrick refresh` rewrites the snapshot and not this record, so
|
|
29
|
+
// a snapshot newer than the record means the copy it describes is gone.
|
|
30
|
+
// The move writes the record after the snapshot, so its own run passes.
|
|
31
|
+
const snapshot = fs.statSync(path.join(dir, "snapshot.json"), { throwIfNoEntry: false });
|
|
32
|
+
if (snapshot && snapshot.mtimeMs > fs.statSync(file).mtimeMs)
|
|
33
|
+
return null;
|
|
34
|
+
const parsed = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
35
|
+
if (parsed?.schema !== "carrick.hosted-sync/0" ||
|
|
36
|
+
typeof parsed.at !== "string" ||
|
|
37
|
+
!Array.isArray(parsed.repos)) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const repos = parsed.repos.filter((repo) => typeof repo?.repo === "string" &&
|
|
41
|
+
typeof repo.hosted_commit === "string" &&
|
|
42
|
+
typeof repo.copy_commit === "string");
|
|
43
|
+
return { ...parsed, repos };
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=hosted-snapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-snapshot.js","sourceRoot":"","sources":["../src/hosted-snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7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