carrick 0.3.145 → 0.3.146
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/contract.js +1 -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/post-edit.js +4 -19
- 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.js +1 -5
- package/dist/hook/rechecks.js.map +1 -1
- package/dist/hook/reuse.d.ts +1 -56
- package/dist/hook/reuse.js +12 -110
- 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 +1 -1
- package/dist/hook/stop.js +14 -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 +6 -2
- package/dist/init/agents-section.js +11 -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.js +3 -3
- 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 +3 -2
- package/dist/init/run.js.map +1 -1
- package/dist/init/self-update.d.ts +2 -2
- package/dist/init/self-update.js +61 -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 +21 -1
- package/dist/render.js +83 -2
- 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/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/reuse.d.ts
CHANGED
|
@@ -1,19 +1,6 @@
|
|
|
1
1
|
import type { CheckResult } from "../contract.ts";
|
|
2
|
-
/** One function the working tree declares and the index does not. */
|
|
3
|
-
export type NewFunction = {
|
|
4
|
-
/** As the source spells it. */
|
|
5
|
-
name: string;
|
|
6
|
-
/** Repo-relative path of the file that declares it. */
|
|
7
|
-
file: string;
|
|
8
|
-
/** The commit the index this was compared against was taken at. */
|
|
9
|
-
indexCommit: string;
|
|
10
|
-
};
|
|
11
2
|
/** A session's accumulated record. */
|
|
12
3
|
export type SessionRecord = {
|
|
13
|
-
/** Every new function this session has seen, in the order it saw them. */
|
|
14
|
-
found: NewFunction[];
|
|
15
|
-
/** `file::name` for the ones a nudge has already listed. */
|
|
16
|
-
nudged: string[];
|
|
17
4
|
/**
|
|
18
5
|
* `repo::file` for every file whose uses lines this session has been shown
|
|
19
6
|
* (carrick#2067), so the post-edit hook prints them once per file.
|
|
@@ -66,17 +53,6 @@ export declare function sessionRecords(home?: string): number;
|
|
|
66
53
|
* rule every other half of `carrick uninstall` follows (carrick#1034).
|
|
67
54
|
*/
|
|
68
55
|
export declare function removeSessions(home?: string): number;
|
|
69
|
-
/**
|
|
70
|
-
* Add what one edit found, keeping the first sighting of each function.
|
|
71
|
-
*
|
|
72
|
-
* Deduplicated on file and name: an agent edits one file several times in a
|
|
73
|
-
* task, and every one of those edits re-reports the same new function.
|
|
74
|
-
*/
|
|
75
|
-
export declare function record(sessionId: string, found: NewFunction[], home?: string): SessionRecord;
|
|
76
|
-
/** What a nudge has not yet named, oldest first. */
|
|
77
|
-
export declare function pending(record: SessionRecord): NewFunction[];
|
|
78
|
-
/** Mark entries as named, so the next stop of the same task says nothing. */
|
|
79
|
-
export declare function markNudged(sessionId: string, entries: NewFunction[], home?: string): void;
|
|
80
56
|
/**
|
|
81
57
|
* The key a file's uses lines are remembered under: its repo and its
|
|
82
58
|
* repo-relative path, so one path in two repos is two files.
|
|
@@ -92,40 +68,9 @@ export declare function recordEdit(sessionId: string, root: string, at: number,
|
|
|
92
68
|
export declare function wasRead(sessionId: string, file: string, home?: string): boolean;
|
|
93
69
|
/** Remember that the Read hook has asked about this absolute path. */
|
|
94
70
|
export declare function markRead(sessionId: string, file: string, home?: string): void;
|
|
95
|
-
/** What one delivery of the nudge said, for the hook that delivered it. */
|
|
96
|
-
export type Drained = {
|
|
97
|
-
/** The line to hand the model. */
|
|
98
|
-
line: string;
|
|
99
|
-
/** How many functions it names. */
|
|
100
|
-
named: number;
|
|
101
|
-
/** How many the session has recorded in all, named or not. */
|
|
102
|
-
found: number;
|
|
103
|
-
};
|
|
104
|
-
/**
|
|
105
|
-
* The nudge for one session, marked as spoken, or nothing to say (carrick#1335).
|
|
106
|
-
*
|
|
107
|
-
* The one place the sequence lives, because two hooks deliver it: Claude Code's
|
|
108
|
-
* `Stop`, and Codex's `UserPromptSubmit`, which is the only non-blocking
|
|
109
|
-
* model-visible event Codex gives us. Both read the same store, speak the same
|
|
110
|
-
* line and mark the same set; only the event name on the wire differs.
|
|
111
|
-
*
|
|
112
|
-
* The marking happens here, before the caller writes anything, and that order
|
|
113
|
-
* is the point: a nudge that is written and not recorded fires again on the
|
|
114
|
-
* next stop, and a task is several stops.
|
|
115
|
-
*/
|
|
116
|
-
export declare function drain(sessionId: string, root: string | null, home?: string): Drained | null;
|
|
117
|
-
/**
|
|
118
|
-
* The one line the Stop hook hands the model: how many functions, at most two
|
|
119
|
-
* names, and the ask with the exact call (`functions`, one `{ description }` each: the
|
|
120
|
-
* functions are new, so the index has no name to find). Short on purpose, and it starts with "Carrick:" so the
|
|
121
|
-
* user can tell where it came from. The two limits on the answer (what the
|
|
122
|
-
* index was taken at, and that the match is on what a function is described as
|
|
123
|
-
* doing) live in the `carrick-reuse` skill, where the answer is read.
|
|
124
|
-
*/
|
|
125
|
-
export declare function nudge(entries: NewFunction[], slug?: string): string;
|
|
126
71
|
/**
|
|
127
72
|
* The one project slug the workspace's cached hosted snapshot names, or ""
|
|
128
|
-
* when there is none or more than one (
|
|
73
|
+
* when there is none or more than one (a tool call needs one project).
|
|
129
74
|
* `snapshot.json` is written by the hosted refresh: `resolution.repos[]`
|
|
130
75
|
* carries each connected repo's `project_slug`.
|
|
131
76
|
*/
|
package/dist/hook/reuse.js
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
// What one session
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
// The measured problem: a reuse check that waits to be remembered does not
|
|
5
|
-
// run. Prose alone reached the index in none of five runs; a hook reached it
|
|
6
|
-
// in all five. So the check has to be delivered, not documented — but delivery
|
|
7
|
-
// costs a model turn, and most edits add no function, so it cannot ride the
|
|
8
|
-
// edit. The split is: the post-edit hook RECORDS silently (it already re-checks
|
|
9
|
-
// the edited file, and the list of new functions comes back in that answer),
|
|
10
|
-
// and the Stop hook SPEAKS once, with everything the task accumulated.
|
|
1
|
+
// What one session's hooks remember between calls: which files' uses lines it
|
|
2
|
+
// has been shown, which files the Read hook has asked about, and when it last
|
|
3
|
+
// edited each workspace.
|
|
11
4
|
//
|
|
12
5
|
// The store is a file per session under `~/.carrick/sessions`, outside every
|
|
13
6
|
// repository: a scratch file about one conversation is not a thing to put in a
|
|
@@ -15,7 +8,10 @@
|
|
|
15
8
|
// Nothing here ever throws at its caller — an edit and a stop must not fail
|
|
16
9
|
// because a state file could not be written.
|
|
17
10
|
//
|
|
18
|
-
//
|
|
11
|
+
// It no longer lists the functions a session added: the end-of-task reuse
|
|
12
|
+
// nudge that read that list is gone (carrick#3436). A file an older install
|
|
13
|
+
// wrote still loads; `readSession` keeps only the fields below.
|
|
14
|
+
import { snapshotRepos } from "../hosted-snapshot.js";
|
|
19
15
|
import fs from "node:fs";
|
|
20
16
|
import os from "node:os";
|
|
21
17
|
import path from "node:path";
|
|
@@ -34,15 +30,9 @@ export function sessionFile(sessionId, home = os.homedir()) {
|
|
|
34
30
|
export function sessionsDir(home = os.homedir()) {
|
|
35
31
|
return path.join(home, ".carrick", "sessions");
|
|
36
32
|
}
|
|
37
|
-
/** The key a `nudged` list holds an entry under. */
|
|
38
|
-
function key(entry) {
|
|
39
|
-
return `${entry.file}::${entry.name}`;
|
|
40
|
-
}
|
|
41
33
|
/** A session's record, or an empty one. Never throws. */
|
|
42
34
|
export function readSession(sessionId, home) {
|
|
43
35
|
const empty = {
|
|
44
|
-
found: [],
|
|
45
|
-
nudged: [],
|
|
46
36
|
told: [],
|
|
47
37
|
read: [],
|
|
48
38
|
edited: {},
|
|
@@ -64,12 +54,6 @@ export function readSession(sessionId, home) {
|
|
|
64
54
|
return empty;
|
|
65
55
|
const record = parsed;
|
|
66
56
|
return {
|
|
67
|
-
found: Array.isArray(record.found)
|
|
68
|
-
? record.found.filter((entry) => typeof entry?.name === "string" && typeof entry?.file === "string")
|
|
69
|
-
: [],
|
|
70
|
-
nudged: Array.isArray(record.nudged)
|
|
71
|
-
? record.nudged.filter((entry) => typeof entry === "string")
|
|
72
|
-
: [],
|
|
73
57
|
told: Array.isArray(record.told)
|
|
74
58
|
? record.told.filter((entry) => typeof entry === "string")
|
|
75
59
|
: [],
|
|
@@ -105,8 +89,8 @@ export function writeAtomic(file, body) {
|
|
|
105
89
|
return true;
|
|
106
90
|
}
|
|
107
91
|
catch {
|
|
108
|
-
// Nothing to do and nothing to say:
|
|
109
|
-
// rides behind is not.
|
|
92
|
+
// Nothing to do and nothing to say: this record is a nicety and the edit
|
|
93
|
+
// it rides behind is not.
|
|
110
94
|
try {
|
|
111
95
|
fs.unlinkSync(temp);
|
|
112
96
|
}
|
|
@@ -201,40 +185,6 @@ export function removeSessions(home) {
|
|
|
201
185
|
}
|
|
202
186
|
return removed;
|
|
203
187
|
}
|
|
204
|
-
/**
|
|
205
|
-
* Add what one edit found, keeping the first sighting of each function.
|
|
206
|
-
*
|
|
207
|
-
* Deduplicated on file and name: an agent edits one file several times in a
|
|
208
|
-
* task, and every one of those edits re-reports the same new function.
|
|
209
|
-
*/
|
|
210
|
-
export function record(sessionId, found, home) {
|
|
211
|
-
const current = readSession(sessionId, home);
|
|
212
|
-
const seen = new Set(current.found.map(key));
|
|
213
|
-
for (const entry of found) {
|
|
214
|
-
if (seen.has(key(entry)))
|
|
215
|
-
continue;
|
|
216
|
-
seen.add(key(entry));
|
|
217
|
-
current.found.push(entry);
|
|
218
|
-
}
|
|
219
|
-
current.updated = new Date().toISOString();
|
|
220
|
-
write(sessionId, current, home);
|
|
221
|
-
return current;
|
|
222
|
-
}
|
|
223
|
-
/** What a nudge has not yet named, oldest first. */
|
|
224
|
-
export function pending(record) {
|
|
225
|
-
const nudged = new Set(record.nudged);
|
|
226
|
-
return record.found.filter((entry) => !nudged.has(key(entry)));
|
|
227
|
-
}
|
|
228
|
-
/** Mark entries as named, so the next stop of the same task says nothing. */
|
|
229
|
-
export function markNudged(sessionId, entries, home) {
|
|
230
|
-
const current = readSession(sessionId, home);
|
|
231
|
-
const nudged = new Set(current.nudged);
|
|
232
|
-
for (const entry of entries)
|
|
233
|
-
nudged.add(key(entry));
|
|
234
|
-
current.nudged = [...nudged];
|
|
235
|
-
current.updated = new Date().toISOString();
|
|
236
|
-
write(sessionId, current, home);
|
|
237
|
-
}
|
|
238
188
|
/**
|
|
239
189
|
* The key a file's uses lines are remembered under: its repo and its
|
|
240
190
|
* repo-relative path, so one path in two repos is two files.
|
|
@@ -278,63 +228,15 @@ export function markRead(sessionId, file, home) {
|
|
|
278
228
|
current.updated = new Date().toISOString();
|
|
279
229
|
write(sessionId, current, home);
|
|
280
230
|
}
|
|
281
|
-
/**
|
|
282
|
-
* The nudge for one session, marked as spoken, or nothing to say (carrick#1335).
|
|
283
|
-
*
|
|
284
|
-
* The one place the sequence lives, because two hooks deliver it: Claude Code's
|
|
285
|
-
* `Stop`, and Codex's `UserPromptSubmit`, which is the only non-blocking
|
|
286
|
-
* model-visible event Codex gives us. Both read the same store, speak the same
|
|
287
|
-
* line and mark the same set; only the event name on the wire differs.
|
|
288
|
-
*
|
|
289
|
-
* The marking happens here, before the caller writes anything, and that order
|
|
290
|
-
* is the point: a nudge that is written and not recorded fires again on the
|
|
291
|
-
* next stop, and a task is several stops.
|
|
292
|
-
*/
|
|
293
|
-
export function drain(sessionId, root, home) {
|
|
294
|
-
const current = readSession(sessionId, home);
|
|
295
|
-
const waiting = pending(current);
|
|
296
|
-
if (waiting.length === 0)
|
|
297
|
-
return null;
|
|
298
|
-
const line = nudge(waiting, root === null ? "" : snapshotProjectSlug(root));
|
|
299
|
-
markNudged(sessionId, waiting, home);
|
|
300
|
-
return { line, named: waiting.length, found: current.found.length };
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* The one line the Stop hook hands the model: how many functions, at most two
|
|
304
|
-
* names, and the ask with the exact call (`functions`, one `{ description }` each: the
|
|
305
|
-
* functions are new, so the index has no name to find). Short on purpose, and it starts with "Carrick:" so the
|
|
306
|
-
* user can tell where it came from. The two limits on the answer (what the
|
|
307
|
-
* index was taken at, and that the match is on what a function is described as
|
|
308
|
-
* doing) live in the `carrick-reuse` skill, where the answer is read.
|
|
309
|
-
*/
|
|
310
|
-
export function nudge(entries, slug = "") {
|
|
311
|
-
const total = entries.length;
|
|
312
|
-
const shown = entries.slice(0, 2).map((entry) => entry.name);
|
|
313
|
-
const rest = total - shown.length;
|
|
314
|
-
const list = rest > 0
|
|
315
|
-
? `${shown.join(", ")} and ${rest} more`
|
|
316
|
-
: shown.length === 2
|
|
317
|
-
? `${shown[0]} and ${shown[1]}`
|
|
318
|
-
: shown[0];
|
|
319
|
-
const projectArg = slug === "" ? "" : `\`project: "${slug}"\` and `;
|
|
320
|
-
return `Carrick: this task added ${total} new function${total === 1 ? "" : "s"} (${list}). Check them for existing copies with one find_similar call, passing ${projectArg}\`functions\`, one \`{ description }\` per new function: one plain sentence saying what it does (new functions are not in the index yet, so a name is not found). Where it names an existing function that does the same job, or most of it, call that function instead: delete your copy, or, when the task asked for your function by name, keep the function but make its body call the existing one and add only what it lacks. Then tell the user in one line what Carrick found and what you changed.`;
|
|
321
|
-
}
|
|
322
231
|
/**
|
|
323
232
|
* The one project slug the workspace's cached hosted snapshot names, or ""
|
|
324
|
-
* when there is none or more than one (
|
|
233
|
+
* when there is none or more than one (a tool call needs one project).
|
|
325
234
|
* `snapshot.json` is written by the hosted refresh: `resolution.repos[]`
|
|
326
235
|
* carries each connected repo's `project_slug`.
|
|
327
236
|
*/
|
|
328
237
|
export function snapshotProjectSlug(root) {
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
parsed = JSON.parse(fs.readFileSync(path.join(root, ".carrick", "hosted", "snapshot.json"), "utf8"));
|
|
332
|
-
}
|
|
333
|
-
catch {
|
|
334
|
-
return "";
|
|
335
|
-
}
|
|
336
|
-
const repos = parsed?.resolution?.repos;
|
|
337
|
-
if (!Array.isArray(repos))
|
|
238
|
+
const repos = snapshotRepos(root);
|
|
239
|
+
if (repos === null)
|
|
338
240
|
return "";
|
|
339
241
|
const slugs = new Set();
|
|
340
242
|
for (const repo of repos) {
|
package/dist/hook/reuse.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reuse.js","sourceRoot":"","sources":["../../src/hook/reuse.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,oEAAoE;AACpE,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,+EAA+E;AAC/E,4EAA4E;AAC5E,gFAAgF;AAChF,6EAA6E;AAC7E,uEAAuE;AACvE,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,8EAA8E;AAC9E,4EAA4E;AAC5E,6CAA6C;AAC7C,EAAE;AACF,iEAAiE;AAEjE,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAsC7B,mEAAmE;AACnE,MAAM,SAAS,GAAG,CAAC,CAAC;AAEpB,sDAAsD;AACtD,MAAM,UAAU,MAAM,CAAC,SAAiB;IACtC,OAAO,yBAAyB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;AACtE,CAAC;AAED,wCAAwC;AACxC,MAAM,UAAU,WAAW,CAAC,SAAiB,EAAE,OAAe,EAAE,CAAC,OAAO,EAAE;IACxE,MAAM,EAAE,GAAG,MAAM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,EAAE,CAAC;AAChD,CAAC"}
|
|
@@ -9,3 +9,12 @@
|
|
|
9
9
|
export declare function runByCodex(env: NodeJS.ProcessEnv, stdin: string): boolean;
|
|
10
10
|
/** The shape Codex's `parse_session_start` takes the model context from. */
|
|
11
11
|
export declare function codexEmission(context: string): string;
|
|
12
|
+
/** Default gap between two statements that HEAD keeps the copy back. */
|
|
13
|
+
export declare const HELD_NOTICE_COOLDOWN_MS: number;
|
|
14
|
+
/**
|
|
15
|
+
* The hosted line, and, at most once per cooldown, the line saying HEAD keeps
|
|
16
|
+
* this machine's copy back (carrick#3433). Null where no record exists yet,
|
|
17
|
+
* which keeps the session start as it was. The claim is taken only when there
|
|
18
|
+
* is a held line to print, so a day of current copies does not use it up.
|
|
19
|
+
*/
|
|
20
|
+
export declare function hostedSync(root: string, now: number, env?: NodeJS.ProcessEnv): string[] | null;
|
|
@@ -16,13 +16,15 @@
|
|
|
16
16
|
// SessionStart hook's context from `hookSpecificOutput.additionalContext`
|
|
17
17
|
// (`codex-rs/hooks/src/engine/output_parser.rs`, `parse_session_start`), so
|
|
18
18
|
// there the lines go out as that JSON. Claude Code keeps the plain print.
|
|
19
|
+
import { readStdin } from "./stdin.js";
|
|
19
20
|
import { status } from "../cli.js";
|
|
20
21
|
import { resolveChannel } from "../channel.js";
|
|
21
22
|
import { createLogger } from "../log.js";
|
|
22
|
-
import { CHECK_BEFORE_DONE, renderSessionStart } from "../render.js";
|
|
23
|
+
import { CHECK_BEFORE_DONE, heldLine, hostedLine, renderSessionStart } from "../render.js";
|
|
24
|
+
import { lastSync } from "../hosted-snapshot.js";
|
|
23
25
|
import { resolveRoot, rootNote } from "../root.js";
|
|
24
26
|
import { currentVersion, readUpdateState, suppressed, updateNotice } from "../update.js";
|
|
25
|
-
import { forwardInBackground, refreshInBackground } from "./refresh.js";
|
|
27
|
+
import { claimRefresh, cooldownMs, forwardInBackground, markerPath, refreshInBackground, } from "./refresh.js";
|
|
26
28
|
import { versionMismatch } from "../init/outdated.js";
|
|
27
29
|
import { bringUpToDate } from "../init/self-update.js";
|
|
28
30
|
import { markInvoker } from "./invoker.js";
|
|
@@ -44,13 +46,8 @@ function versionLine() {
|
|
|
44
46
|
const state = readUpdateState(process.env);
|
|
45
47
|
return updateNotice(currentVersion(), state?.latest ?? null, { env: process.env });
|
|
46
48
|
}
|
|
47
|
-
async function
|
|
48
|
-
|
|
49
|
-
return "";
|
|
50
|
-
const chunks = [];
|
|
51
|
-
for await (const chunk of process.stdin)
|
|
52
|
-
chunks.push(Buffer.from(chunk));
|
|
53
|
-
return Buffer.concat(chunks).toString("utf8");
|
|
49
|
+
async function readStdinUnlessTty() {
|
|
50
|
+
return process.stdin.isTTY ? "" : readStdin();
|
|
54
51
|
}
|
|
55
52
|
/**
|
|
56
53
|
* Whether Codex, not Claude Code, is running this hook.
|
|
@@ -83,7 +80,7 @@ async function main() {
|
|
|
83
80
|
return;
|
|
84
81
|
}
|
|
85
82
|
const lines = [];
|
|
86
|
-
const codex = runByCodex(process.env, await
|
|
83
|
+
const codex = runByCodex(process.env, await readStdinUnlessTty());
|
|
87
84
|
const choice = resolveRoot({
|
|
88
85
|
clientRoot: process.cwd(),
|
|
89
86
|
projectDir: process.env["CLAUDE_PROJECT_DIR"] ?? null,
|
|
@@ -103,12 +100,15 @@ async function main() {
|
|
|
103
100
|
// because this runs once per session and the agent about to work here is the
|
|
104
101
|
// reader who can act on it (carrick#1372).
|
|
105
102
|
if (choice.markerFound) {
|
|
106
|
-
//
|
|
107
|
-
//
|
|
108
|
-
|
|
109
|
-
|
|
103
|
+
// Both harnesses: Codex gets the AGENTS.md section and the skills, which it
|
|
104
|
+
// reads with no trust gate (carrick#3435). It has no `CLAUDE_PROJECT_DIR`, so
|
|
105
|
+
// the Claude Code settings files are left to a Claude Code session, and
|
|
106
|
+
// `.codex/hooks.json` is never written (`init/self-update.ts`).
|
|
107
|
+
// A by-hand run (neither harness) writes nothing.
|
|
108
|
+
const projectDir = codex ? null : process.env["CLAUDE_PROJECT_DIR"] || null;
|
|
109
|
+
if (codex || projectDir) {
|
|
110
110
|
try {
|
|
111
|
-
lines.push(...bringUpToDate(choice.root, projectDir, currentVersion()));
|
|
111
|
+
lines.push(...bringUpToDate(choice.root, projectDir, currentVersion(), (message) => log(message)));
|
|
112
112
|
}
|
|
113
113
|
catch (error) {
|
|
114
114
|
log("self-update failed", String(error));
|
|
@@ -124,9 +124,16 @@ async function main() {
|
|
|
124
124
|
flush(lines, codex);
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
|
+
// What the MCP answers from, and the copy the hooks compare against, ahead
|
|
128
|
+
// of this machine's own scan: that scan's date alone was read as the age of
|
|
129
|
+
// every answer (carrick#3432). From the last background move's record; the
|
|
130
|
+
// move itself runs after this read, so the line is at most one run behind.
|
|
131
|
+
const hosted = outcome.result.error ? null : hostedSync(choice.root, Date.now());
|
|
132
|
+
if (hosted)
|
|
133
|
+
lines.push(...hosted);
|
|
127
134
|
// Ends with a newline: this is a line a developer also runs by hand and
|
|
128
135
|
// compares against `carrick status`, and that one ends its output properly.
|
|
129
|
-
lines.push(renderSessionStart(outcome.result));
|
|
136
|
+
lines.push(renderSessionStart(outcome.result, { afterHostedLine: hosted !== null }));
|
|
130
137
|
if (!outcome.result.error)
|
|
131
138
|
lines.push(CHECK_BEFORE_DONE);
|
|
132
139
|
// The hosted index the first CI scan writes is picked up here rather than by
|
|
@@ -154,6 +161,26 @@ async function main() {
|
|
|
154
161
|
}
|
|
155
162
|
flush(lines, codex);
|
|
156
163
|
}
|
|
164
|
+
/** Default gap between two statements that HEAD keeps the copy back. */
|
|
165
|
+
export const HELD_NOTICE_COOLDOWN_MS = 24 * 60 * 60_000;
|
|
166
|
+
/**
|
|
167
|
+
* The hosted line, and, at most once per cooldown, the line saying HEAD keeps
|
|
168
|
+
* this machine's copy back (carrick#3433). Null where no record exists yet,
|
|
169
|
+
* which keeps the session start as it was. The claim is taken only when there
|
|
170
|
+
* is a held line to print, so a day of current copies does not use it up.
|
|
171
|
+
*/
|
|
172
|
+
export function hostedSync(root, now, env = process.env) {
|
|
173
|
+
const sync = lastSync(root);
|
|
174
|
+
const hosted = sync ? hostedLine(sync, now) : null;
|
|
175
|
+
if (!sync || !hosted)
|
|
176
|
+
return null;
|
|
177
|
+
const lines = [hosted];
|
|
178
|
+
const held = heldLine(sync);
|
|
179
|
+
const cooldown = cooldownMs(env, "CARRICK_HELD_NOTICE_COOLDOWN_MS", HELD_NOTICE_COOLDOWN_MS);
|
|
180
|
+
if (held && claimRefresh(markerPath(root, "last-held-notice"), now, cooldown))
|
|
181
|
+
lines.push(held);
|
|
182
|
+
return lines;
|
|
183
|
+
}
|
|
157
184
|
/** One write at the end, so the Codex form is a single JSON document. */
|
|
158
185
|
function flush(lines, codex) {
|
|
159
186
|
if (lines.length === 0)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-start.js","sourceRoot":"","sources":["../../src/hook/session-start.ts"],"names":[],"mappings":";AACA,8EAA8E;AAC9E,EAAE;AACF,gFAAgF;AAChF,8EAA8E;AAC9E,gFAAgF;AAChF,4EAA4E;AAC5E,mDAAmD;AACnD,EAAE;AACF,+EAA+E;AAC/E,6EAA6E;AAC7E,0EAA0E;AAC1E,gEAAgE;AAChE,EAAE;AACF,6EAA6E;AAC7E,0EAA0E;AAC1E,4EAA4E;AAC5E,0EAA0E;AAE1E,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"session-start.js","sourceRoot":"","sources":["../../src/hook/session-start.ts"],"names":[],"mappings":";AACA,8EAA8E;AAC9E,EAAE;AACF,gFAAgF;AAChF,8EAA8E;AAC9E,gFAAgF;AAChF,4EAA4E;AAC5E,mDAAm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AAO;IAC/B,IAAI,KAAK;QAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;QAC5D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,IAAI,EAAE,CAAC;AACb,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** All of stdin as text. Shared by the hook entry points; Node built-ins only. */
|
|
2
|
+
export async function readStdin() {
|
|
3
|
+
const chunks = [];
|
|
4
|
+
for await (const chunk of process.stdin)
|
|
5
|
+
chunks.push(Buffer.from(chunk));
|
|
6
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=stdin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdin.js","sourceRoot":"","sources":["../../src/hook/stdin.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,MAAM,CAAC,KAAK,UAAU,SAAS;IAC7B,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,OAAO,CAAC,KAAK;QAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACzE,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAChD,CAAC"}
|
package/dist/hook/stop-wait.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type StopOptions = {
|
|
|
11
11
|
ensure?: (root: string) => boolean;
|
|
12
12
|
};
|
|
13
13
|
export type StopResult = {
|
|
14
|
-
/** Lines to print
|
|
14
|
+
/** Lines to print; empty when there is nothing to say. */
|
|
15
15
|
lines: string[];
|
|
16
16
|
};
|
|
17
17
|
export declare function stopAnswers(session: string, options: StopOptions): Promise<StopResult>;
|
package/dist/hook/stop.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Stop hook:
|
|
2
|
+
// Stop hook: what the background re-checks of this session's edits answered,
|
|
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,22 @@
|
|
|
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 is silent whenever it has nothing
|
|
13
|
-
//
|
|
14
|
-
// the same session. A stop after a stop is the common case — a task is
|
|
15
|
-
// several turns — so "already nudged" is the state this has to get right or
|
|
16
|
-
// the line repeats on every turn until the session ends.
|
|
15
|
+
// It is silent whenever it has nothing to say: no session id, no re-check
|
|
16
|
+
// answer with something to act on, nothing still running.
|
|
17
17
|
//
|
|
18
|
-
//
|
|
19
|
-
// for the ones still running (`stop-wait.ts`).
|
|
18
|
+
// It exits 0 on every path, like the other hooks.
|
|
20
19
|
//
|
|
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.
|
|
20
|
+
// Reference: `docs/reference/task-skills.md`, "What the hooks deliver".
|
|
21
|
+
import { readStdin } from "./stdin.js";
|
|
25
22
|
import { createLogger } from "../log.js";
|
|
26
23
|
import { resolveChannel } from "../channel.js";
|
|
27
|
-
import { drain } from "./reuse.js";
|
|
28
24
|
import { initialisedRoot, throttledVersionMismatch } from "../init/outdated.js";
|
|
29
25
|
import { currentVersion } from "../update.js";
|
|
30
26
|
import { markInvoker } from "./invoker.js";
|
|
31
27
|
import { stopAnswers, waitSeconds } from "./stop-wait.js";
|
|
32
28
|
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
29
|
/** The one channel a Stop hook has that the model reads. */
|
|
40
30
|
export function emission(context) {
|
|
41
31
|
return JSON.stringify({
|
|
@@ -49,7 +39,7 @@ async function main() {
|
|
|
49
39
|
markInvoker("stop");
|
|
50
40
|
// `off` silences every surface this package has, and this is one of them.
|
|
51
41
|
// The `lsp` channel is NOT excluded: it decides who delivers a verdict about
|
|
52
|
-
// an edited file, and
|
|
42
|
+
// an edited file as it is edited, and the language server has no Stop.
|
|
53
43
|
if (resolveChannel({ hooksInstalled: true }).channel === "off") {
|
|
54
44
|
log("CARRICK_CHANNEL=off; printing nothing");
|
|
55
45
|
return;
|
|
@@ -67,34 +57,22 @@ async function main() {
|
|
|
67
57
|
log("no session id in the payload; nothing to look up");
|
|
68
58
|
return;
|
|
69
59
|
}
|
|
70
|
-
//
|
|
71
|
-
//
|
|
72
|
-
// Before the nudge, so functions the runner recorded meanwhile are named.
|
|
60
|
+
// What the background re-checks of this session's edits answered, and a
|
|
61
|
+
// wait for the ones still running (`--wait-s`, from the settings entry).
|
|
73
62
|
const parts = [];
|
|
74
63
|
const late = await stopAnswers(session, { waitS: waitSeconds(process.argv.slice(2)) });
|
|
75
64
|
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
65
|
// The other thing a task's end is a good moment for: the `carrick` these
|
|
87
66
|
// hooks resolve is not the one that set this workspace up (carrick#1372).
|
|
88
67
|
// Once a day, through the same channel, because a mismatch stands until
|
|
89
68
|
// somebody fixes it and a line per turn would be noise.
|
|
69
|
+
const root = initialisedRoot(process.env["CLAUDE_PROJECT_DIR"] ?? process.cwd());
|
|
90
70
|
const mismatch = root === null ? null : throttledVersionMismatch(root, currentVersion());
|
|
91
71
|
if (mismatch)
|
|
92
72
|
parts.push(mismatch);
|
|
93
73
|
if (parts.length === 0)
|
|
94
74
|
return;
|
|
95
75
|
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
76
|
}
|
|
99
77
|
await main();
|
|
100
78
|
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;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