@vibe-commit/capture 0.1.0 → 0.2.0

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.
Files changed (54) hide show
  1. package/dist/agent_hooks.d.ts +133 -0
  2. package/dist/agent_hooks.js +228 -0
  3. package/dist/agent_hooks.js.map +1 -0
  4. package/dist/agent_install.d.ts +79 -0
  5. package/dist/agent_install.js +108 -0
  6. package/dist/agent_install.js.map +1 -0
  7. package/dist/agents/claude_code.js +12 -1
  8. package/dist/agents/claude_code.js.map +1 -1
  9. package/dist/agents/codex_cli.js +21 -1
  10. package/dist/agents/codex_cli.js.map +1 -1
  11. package/dist/agents/cursor.js +32 -6
  12. package/dist/agents/cursor.js.map +1 -1
  13. package/dist/agents/registry.d.ts +39 -1
  14. package/dist/agents/registry.js +47 -1
  15. package/dist/agents/registry.js.map +1 -1
  16. package/dist/agents/types.d.ts +76 -0
  17. package/dist/agents/types.js.map +1 -1
  18. package/dist/commands/auth.d.ts +66 -0
  19. package/dist/commands/auth.js +119 -0
  20. package/dist/commands/auth.js.map +1 -0
  21. package/dist/commands/connect.js +83 -1
  22. package/dist/commands/connect.js.map +1 -1
  23. package/dist/commands/status.js +18 -12
  24. package/dist/commands/status.js.map +1 -1
  25. package/dist/copy/index.d.ts +1 -1
  26. package/dist/copy/index.js +1 -1
  27. package/dist/copy/index.js.map +1 -1
  28. package/dist/copy/strings.d.ts +102 -4
  29. package/dist/copy/strings.js +114 -4
  30. package/dist/copy/strings.js.map +1 -1
  31. package/dist/credential.d.ts +46 -0
  32. package/dist/credential.js +59 -1
  33. package/dist/credential.js.map +1 -1
  34. package/dist/hooks/entry.d.ts +12 -1
  35. package/dist/hooks/entry.js +145 -11
  36. package/dist/hooks/entry.js.map +1 -1
  37. package/dist/hooks/fire_lock.d.ts +90 -0
  38. package/dist/hooks/fire_lock.js +192 -0
  39. package/dist/hooks/fire_lock.js.map +1 -0
  40. package/dist/index.d.ts +1 -1
  41. package/dist/index.js +53 -1
  42. package/dist/index.js.map +1 -1
  43. package/dist/install.d.ts +8 -9
  44. package/dist/install.js +61 -6
  45. package/dist/install.js.map +1 -1
  46. package/dist/paths.d.ts +24 -0
  47. package/dist/paths.js +38 -0
  48. package/dist/paths.js.map +1 -1
  49. package/dist/term.d.ts +9 -0
  50. package/dist/term.js +14 -0
  51. package/dist/term.js.map +1 -1
  52. package/dist/version.d.ts +1 -1
  53. package/dist/version.js +1 -1
  54. package/package.json +2 -2
@@ -129,6 +129,52 @@ export declare function readSecretFile(home: string, path: string): SecretFileRe
129
129
  * distinguish the four not-ok outcomes to print four different fixes.
130
130
  */
131
131
  export declare function loadCredential(ctx: CredentialEnvironment): CredentialLoad;
132
+ /**
133
+ * Persist the ingest credential. 0700 on the directory, 0600 on the file.
134
+ *
135
+ * `CR-216/U1`. Until this existed the module was a reader with no producer:
136
+ * `loadCredential` parsed an envelope, `readSecretFile` policed its modes and
137
+ * `copy/strings.ts:1412` told the user to `chmod 600` it, but nothing in the
138
+ * package ever wrote it. The only credential that reached a hook came from
139
+ * `VIBECOMMIT_TOKEN`, so a commit from a shell without it exported bound nothing
140
+ * and said nothing — the hook's exit contract makes a missing credential silent
141
+ * on purpose, which is right for the hook and fatal for a first install.
142
+ *
143
+ * ⚠ THE TWO `chmod`s AFTER THE WRITES ARE NOT REDUNDANT, and this is the third
144
+ * time this package has had to say so (`consent.ts`'s `grantProject` first, then
145
+ * `oauth/session.ts:139`). `writeFileSync`'s `mode` is masked by the umask, and
146
+ * it is IGNORED ENTIRELY when the file already exists — so the re-auth after a
147
+ * rotation, which is exactly the write that follows a leak, would silently
148
+ * inherit whatever mode was there before.
149
+ *
150
+ * The refusal below is the write-side half of the class check. The read side
151
+ * already refuses a token of the wrong class in both directions (see
152
+ * `CredentialLoad`'s `wrong-class`); this is the third door into the same slot,
153
+ * and a door that admits what the others refuse is not a door with a check.
154
+ * It refuses BEFORE touching the disk: a half-written envelope would load as
155
+ * `unreadable` rather than `absent`, sending the user to a different fix.
156
+ *
157
+ * The single `expose()` here is unavoidable — persisting a secret means writing
158
+ * its bytes — and greppable, which is the property the wrapper buys.
159
+ *
160
+ * @throws if handed a credential of the wrong class. The message carries the
161
+ * class, never the rejected bytes.
162
+ */
163
+ export declare function saveCredential(home: string, credential: IngestCredential): void;
164
+ /**
165
+ * Is there a saved credential for `VIBECOMMIT_TOKEN` to be shadowing?
166
+ *
167
+ * `CR-216/U3`. PRESENCE, not validity, and the distinction is the point: this
168
+ * answers "is the env var overriding something?", and a file that is present but
169
+ * unreadable or wrongly-moded is still something being overridden — arguably the
170
+ * case most worth saying out loud, since the user who saved it believes it is in
171
+ * use. Validity is `loadCredential`'s question and it answers it separately.
172
+ *
173
+ * Deliberately not `loadCredential({ env: {} , home })`: that would silently
174
+ * return `absent` for an insecure file and suppress the warning exactly where a
175
+ * user is most confused about which credential is live.
176
+ */
177
+ export declare function savedCredentialExists(home: string): boolean;
132
178
  /**
133
179
  * Belt and braces for the `inspect` path specifically.
134
180
  *
@@ -34,7 +34,7 @@
34
34
  *
35
35
  * @provenance vibecommit-mcp src/oauth/ingest_credential.ts — wire contract, retyped
36
36
  */
37
- import { lstatSync, readFileSync, statSync } from "node:fs";
37
+ import { chmodSync, existsSync, lstatSync, mkdirSync, readFileSync, statSync, writeFileSync, } from "node:fs";
38
38
  import { inspect } from "node:util";
39
39
  import { credentialsPath, rootDir } from "./paths.js";
40
40
  /**
@@ -156,6 +156,64 @@ export function loadCredential(ctx) {
156
156
  }
157
157
  return { kind: "ok", credential: new IngestCredential(secret, "file") };
158
158
  }
159
+ /**
160
+ * Persist the ingest credential. 0700 on the directory, 0600 on the file.
161
+ *
162
+ * `CR-216/U1`. Until this existed the module was a reader with no producer:
163
+ * `loadCredential` parsed an envelope, `readSecretFile` policed its modes and
164
+ * `copy/strings.ts:1412` told the user to `chmod 600` it, but nothing in the
165
+ * package ever wrote it. The only credential that reached a hook came from
166
+ * `VIBECOMMIT_TOKEN`, so a commit from a shell without it exported bound nothing
167
+ * and said nothing — the hook's exit contract makes a missing credential silent
168
+ * on purpose, which is right for the hook and fatal for a first install.
169
+ *
170
+ * ⚠ THE TWO `chmod`s AFTER THE WRITES ARE NOT REDUNDANT, and this is the third
171
+ * time this package has had to say so (`consent.ts`'s `grantProject` first, then
172
+ * `oauth/session.ts:139`). `writeFileSync`'s `mode` is masked by the umask, and
173
+ * it is IGNORED ENTIRELY when the file already exists — so the re-auth after a
174
+ * rotation, which is exactly the write that follows a leak, would silently
175
+ * inherit whatever mode was there before.
176
+ *
177
+ * The refusal below is the write-side half of the class check. The read side
178
+ * already refuses a token of the wrong class in both directions (see
179
+ * `CredentialLoad`'s `wrong-class`); this is the third door into the same slot,
180
+ * and a door that admits what the others refuse is not a door with a check.
181
+ * It refuses BEFORE touching the disk: a half-written envelope would load as
182
+ * `unreadable` rather than `absent`, sending the user to a different fix.
183
+ *
184
+ * The single `expose()` here is unavoidable — persisting a secret means writing
185
+ * its bytes — and greppable, which is the property the wrapper buys.
186
+ *
187
+ * @throws if handed a credential of the wrong class. The message carries the
188
+ * class, never the rejected bytes.
189
+ */
190
+ export function saveCredential(home, credential) {
191
+ const secret = credential.expose();
192
+ if (!secret.startsWith(INGEST_TOKEN_PREFIX)) {
193
+ throw new Error(`refusing to persist a credential that is not an ingest credential: expected a ${INGEST_TOKEN_PREFIX}… token`);
194
+ }
195
+ const path = credentialsPath(home);
196
+ mkdirSync(rootDir(home), { recursive: true, mode: 0o700 });
197
+ chmodSync(rootDir(home), 0o700);
198
+ writeFileSync(path, `${JSON.stringify({ token: secret }, null, 2)}\n`, { mode: 0o600 });
199
+ chmodSync(path, 0o600);
200
+ }
201
+ /**
202
+ * Is there a saved credential for `VIBECOMMIT_TOKEN` to be shadowing?
203
+ *
204
+ * `CR-216/U3`. PRESENCE, not validity, and the distinction is the point: this
205
+ * answers "is the env var overriding something?", and a file that is present but
206
+ * unreadable or wrongly-moded is still something being overridden — arguably the
207
+ * case most worth saying out loud, since the user who saved it believes it is in
208
+ * use. Validity is `loadCredential`'s question and it answers it separately.
209
+ *
210
+ * Deliberately not `loadCredential({ env: {} , home })`: that would silently
211
+ * return `absent` for an insecure file and suppress the warning exactly where a
212
+ * user is most confused about which credential is live.
213
+ */
214
+ export function savedCredentialExists(home) {
215
+ return existsSync(credentialsPath(home));
216
+ }
159
217
  /**
160
218
  * Belt and braces for the `inspect` path specifically.
161
219
  *
@@ -1 +1 @@
1
- {"version":3,"file":"credential.js","sourceRoot":"","sources":["../src/credential.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAE3C,8EAA8E;AAC9E,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,mBAAmB,WAAW,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,OAAO,gBAAgB;IAClB,OAAO,CAAS;IACzB,qEAAqE;IAC5D,MAAM,CAAmB;IAElC,YAAY,MAAc,EAAE,MAAwB;QAClD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,qFAAqF;IACrF,MAAM;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,QAAQ;QACN,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,MAAM;QACJ,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,CAAC,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;QACxC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,WAAW,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xE,OAAO,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC/B,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9E,CAAC"}
@@ -33,6 +33,7 @@
33
33
  * own red-proof in `test/credential.test.ts`. Do not read one as evidence for
34
34
  * the other.
35
35
  */
36
+ import type { HookEventName } from "../agents/types.js";
36
37
  import { type ProjectKeys } from "../project.js";
37
38
  /**
38
39
  * Default wall-clock budget. `CR-028` sets the real per-event `timeout` in
@@ -66,7 +67,17 @@ export declare function sendTimeoutMs(budgetMs: number, consumedMs: number): num
66
67
  * ⛔ `budgetMs` itself still governs the SETTLE and the WATCHDOG. Only the sends
67
68
  * are carved.
68
69
  */
69
- export declare function sendBudgetMs(budgetMs: number, eventName: string): number;
70
+ /**
71
+ * ⛔ **TAKES THE RESOLVED EVENT, NEVER THE RAW `hook_event_name` (`CR-195`).**
72
+ *
73
+ * It used to take a `string`, and that is precisely how Cursor's `sessionEnd`
74
+ * bought a full-budget send with no reserve: the comparison was against
75
+ * `"SessionEnd"`, so an unrecognised spelling was `false` rather than an error.
76
+ * `HookEventName | null` makes the resolution a thing the CALLER must already
77
+ * have done — `null` is the honest "none of the three", and an unresolved wire
78
+ * string is no longer expressible here at all.
79
+ */
80
+ export declare function sendBudgetMs(budgetMs: number, event: HookEventName | null, sinceHookStartMs?: number): number;
70
81
  export interface HookInput {
71
82
  readonly sessionId: string;
72
83
  readonly transcriptPath: string;
@@ -45,7 +45,8 @@ import { deliver, ingestUrl } from "../post.js";
45
45
  import { markSkipped } from "../policy.js";
46
46
  import { fileState, loadSessionState, saveSessionState, withFileState } from "../state.js";
47
47
  import { SESSION_END_EVENT, settleDelayMs, settledSize, } from "./session_end.js";
48
- import { admitsTranscript, agentForTranscript, dialectFor, transcriptRoots, } from "../agents/registry.js";
48
+ import { admitsTranscript, agentForTranscript, canonicalHookEvent, dialectFor, transcriptRoots, } from "../agents/registry.js";
49
+ import { claimFiring, fireLockPath } from "./fire_lock.js";
49
50
  import { announcedSubagentFileKey, isInsideAny, subagentFileKey, subagentsDir, } from "../paths.js";
50
51
  import { resolveProjectKeys } from "../project.js";
51
52
  import { startSpawnBudget } from "../spawn_budget.js";
@@ -154,10 +155,31 @@ const MAX_SUBAGENT_FILES = 8;
154
155
  * is set at, and small enough that it costs the send 90 ms of 2850 on the
155
156
  * default budget.
156
157
  *
157
- * ⚠ **A mitigation, not a guarantee.** Enough scheduler pressure defeats any
158
- * fixed reserve, exactly as it defeats the watchdog itself. What this buys is
159
- * that the ordinary slow-server case — the one Codex's 3 s cap makes routine —
160
- * stops eating the gap record.
158
+ * ## ⛔ THE RESERVE WAS NOT ACTUALLY RESERVED UNTIL `CR-195/U2` — the two clocks
159
+ * started at different instants
160
+ *
161
+ * Everything above this paragraph diagnosed the defect correctly and then
162
+ * subtracted the reserve from the WRONG ORIGIN. `budgetMs - 150` is a bound on
163
+ * the loop's own clock, which starts at `settleStart`; the watchdog's clock
164
+ * starts in `runHook`, before stdin is read. So the loop was permitted to spend
165
+ * until `budgetMs` *measured from the settle* — already past the watchdog's
166
+ * deadline by exactly the pre-entry interval this docblock names — and the
167
+ * watchdog then fired MID-SEND. `stampGaps` runs after the loop, so it did not
168
+ * run at all, and the held spans stayed held.
169
+ *
170
+ * ⛔ **That is the G6 flake, and it was a real product defect rather than a
171
+ * timing-sensitive assertion.** `test/session-end-gaps.test.ts` caught it as
172
+ * `held: [[0, 39]]` where a stamped gap belonged: on `SessionEnd` — which has no
173
+ * next invocation — a hole that is held rather than stamped is the final turn
174
+ * recorded as delivered-so-far instead of as short. `sendBudgetMs` now takes the
175
+ * elapsed time since `runHook` armed the watchdog and charges it, so the reserve
176
+ * is measured against the deadline that can actually end the process.
177
+ *
178
+ * ⚠ **Still a mitigation, not a guarantee.** Enough scheduler pressure defeats
179
+ * any fixed reserve, exactly as it defeats the watchdog itself — a timer cannot
180
+ * fire while the event loop is blocked. What changed is that the reserve now
181
+ * survives the ordinary case it was written for; before, the ordinary case is
182
+ * precisely what consumed it.
161
183
  *
162
184
  * ⛔ Zero on every other event: `stampGaps` runs on `SessionEnd` alone, so
163
185
  * reserving elsewhere would shrink `Stop`'s send for a stamp that never happens.
@@ -176,8 +198,22 @@ const GAP_STAMP_RESERVE_MS = 150;
176
198
  * ⛔ `budgetMs` itself still governs the SETTLE and the WATCHDOG. Only the sends
177
199
  * are carved.
178
200
  */
179
- export function sendBudgetMs(budgetMs, eventName) {
180
- return budgetMs - (eventName === SESSION_END_EVENT ? GAP_STAMP_RESERVE_MS : 0);
201
+ /**
202
+ * ⛔ **TAKES THE RESOLVED EVENT, NEVER THE RAW `hook_event_name` (`CR-195`).**
203
+ *
204
+ * It used to take a `string`, and that is precisely how Cursor's `sessionEnd`
205
+ * bought a full-budget send with no reserve: the comparison was against
206
+ * `"SessionEnd"`, so an unrecognised spelling was `false` rather than an error.
207
+ * `HookEventName | null` makes the resolution a thing the CALLER must already
208
+ * have done — `null` is the honest "none of the three", and an unresolved wire
209
+ * string is no longer expressible here at all.
210
+ */
211
+ export function sendBudgetMs(budgetMs, event, sinceHookStartMs = 0) {
212
+ const reserve = event === SESSION_END_EVENT ? GAP_STAMP_RESERVE_MS : 0;
213
+ // ⛔ FLOORED AT ZERO. A negative would reach `sendTimeoutMs`, whose own
214
+ // `Math.max(0, budgetMs - consumedMs)` turns a negative budget into a POSITIVE
215
+ // remaining — a blown clock reading as fresh time.
216
+ return Math.max(0, budgetMs - sinceHookStartMs - reserve);
181
217
  }
182
218
  /**
183
219
  * Parse hook stdin. Claude Code supplies `{ session_id, transcript_path, cwd,
@@ -252,6 +288,14 @@ export function silenceStderr() {
252
288
  * truncated write is the silent-unconfigured failure DX3 exists to kill.
253
289
  */
254
290
  function finish(payload) {
291
+ // ⛔ RELEASED HERE, AND HERE IS THE ONLY PLACE THAT COVERS EVERY EXIT
292
+ // (`CR-195`/U4a). A `try/finally` around `hookBody` would look tidier and
293
+ // would leak the lock on the one path that matters most: the WATCHDOG calls
294
+ // this function directly, and the signal handlers do too, so neither unwinds
295
+ // `hookBody` at all. A lock leaked there survives until it goes stale, and
296
+ // until then it suppresses the next firing of that event — turning a guard
297
+ // against duplicates into a guard against captures.
298
+ releaseFiring();
255
299
  if (payload !== null) {
256
300
  try {
257
301
  writeSync(1, `${payload}\n`);
@@ -262,6 +306,28 @@ function finish(payload) {
262
306
  }
263
307
  process.exit(EXIT.ok);
264
308
  }
309
+ /**
310
+ * The firing this process claimed, if it claimed one.
311
+ *
312
+ * ⚠ **Module state, deliberately, and it is the narrow case that justifies it.**
313
+ * This process handles exactly ONE hook invocation and then exits; `finish` is
314
+ * its single exit point and is reached from paths that never return through
315
+ * `hookBody`. Threading a claim out to those paths is not possible — the
316
+ * watchdog holds no reference to the body's locals.
317
+ */
318
+ let firingClaim = null;
319
+ /** Idempotent, and never throws: the hook contract forbids saying anything. */
320
+ function releaseFiring() {
321
+ const claim = firingClaim;
322
+ firingClaim = null;
323
+ try {
324
+ claim?.release();
325
+ }
326
+ catch {
327
+ // A lock we could not release goes stale on its own; the bound is derived
328
+ // from the budget precisely so a lost release costs one invocation, once.
329
+ }
330
+ }
265
331
  /**
266
332
  * Install every contract guard, then run the body.
267
333
  *
@@ -271,6 +337,13 @@ function finish(payload) {
271
337
  export async function runHook(ctx) {
272
338
  silenceStderr();
273
339
  const budgetMs = hookBudgetMs(ctx.env, ctx.agentId);
340
+ // ⛔ THE WATCHDOG'S OWN ORIGIN, read on the line that arms it (`CR-195/U2`).
341
+ // Every other deadline in this process is derived from this instant, because
342
+ // this is the one that can actually end it. Taken here rather than passed in
343
+ // so the two cannot drift: a caller-supplied start could be older than the
344
+ // timer, which would UNDER-charge the send loop and reopen the G6 defect from
345
+ // the other side.
346
+ const hookStartedAt = Date.now();
274
347
  // The watchdog covers the wall-clock clause on paths no `await` can reach: a
275
348
  // socket that never settles, a promise that never resolves. `unref` so it
276
349
  // never itself keeps the process alive.
@@ -289,7 +362,7 @@ export async function runHook(ctx) {
289
362
  }
290
363
  let payload = null;
291
364
  try {
292
- payload = await hookBody(ctx, budgetMs);
365
+ payload = await hookBody(ctx, budgetMs, hookStartedAt);
293
366
  }
294
367
  catch {
295
368
  payload = null;
@@ -335,7 +408,7 @@ function dialectBudgetMs(agentId) {
335
408
  * 2. the CONSENT GATE runs BEFORE `transcript_path` is opened (D56 §D19). A
336
409
  * gate that runs after the read has already read the thing it was gating.
337
410
  */
338
- async function hookBody(ctx, budgetMs) {
411
+ async function hookBody(ctx, budgetMs, hookStartedAt) {
339
412
  const raw = await ctx.readStdin();
340
413
  const input = parseHookInput(raw);
341
414
  if (input === null)
@@ -463,12 +536,73 @@ async function hookBody(ctx, budgetMs) {
463
536
  // `SessionEnd` SETTLES FIRST (D57 §DX7). Every other event has a next
464
537
  // invocation to pick up a lagging write; this one does not, so bytes missed
465
538
  // here are the final turn, lost permanently.
466
- const isSessionEnd = input.eventName === SESSION_END_EVENT;
539
+ // ⛔ RESOLVED THROUGH THE DIALECT BEFORE EITHER BRANCH READS IT (`CR-195`,
540
+ // D205). `input.eventName` is the agent's own spelling — Cursor sends
541
+ // `sessionEnd`, not `SessionEnd` — and both lines below used to compare the
542
+ // raw string against this client's vocabulary. That comparison did not fail
543
+ // loudly for Cursor; it returned `false`, which cost the final turn every
544
+ // session and carved no reserve.
545
+ //
546
+ // ⚠ Keyed on `ctx.agentId`, deliberately, and this is NOT the `CR-204`
547
+ // root-derived selection used for redaction and delegated transcripts. The
548
+ // event vocabulary is a property of the process that INVOKED us, and
549
+ // `--agent=` is the value WE write into that agent's own hook config — so it
550
+ // is the one selector that is not attacker-influenced input. `dialectBudgetMs`
551
+ // already keys the budget off it for the same reason.
552
+ const event = canonicalHookEvent(dialectFor(ctx.agentId), input.eventName);
553
+ const isSessionEnd = event === SESSION_END_EVENT;
554
+ // ⛔ ONE FIRING, ONE PROCESS — `CR-195`/U4a. Claimed BEFORE the settle, so a
555
+ // duplicate costs nothing rather than spending the budget to discover it is
556
+ // redundant.
557
+ //
558
+ // ⛔ KEYED ON THE CANONICAL EVENT, NOT `input.eventName`. The two racers do
559
+ // not necessarily agree on the wire spelling — that is the whole shape of this
560
+ // defect: one invocation comes from Cursor's own config and one from Claude's,
561
+ // mapped, and they carry different `--agent=` flags. Resolving first is what
562
+ // makes both compute the SAME key; keying on the raw string would give them
563
+ // two keys and let both run, which is the failure this guards.
564
+ //
565
+ // ⚠ The raw name is the fallback for an event we could not resolve. Such an
566
+ // invocation does almost nothing, but two of them are still two writers.
567
+ const fireKey = {
568
+ repoKey: projectKey,
569
+ sessionId: input.sessionId,
570
+ event: event ?? input.eventName,
571
+ };
572
+ // ⛔ `claimFiring` RETURNS `null` FOR TWO DIFFERENT REASONS, and conflating
573
+ // them would turn this guard into a silent capture outage. One means *another
574
+ // process holds this firing* — bow out. The other means *no lock path could be
575
+ // built at all*, and treating that as a duplicate would refuse EVERY
576
+ // invocation, permanently and silently.
577
+ //
578
+ // ⚠ It is currently unreachable — `resolveProjectKeys` returns `null` rather
579
+ // than an empty toplevel, and the consent gate above has already returned on
580
+ // that. It is distinguished anyway because the two errors are not the same
581
+ // size: an unlockable firing that runs is one possible duplicate, and an
582
+ // unlockable firing that bows out is total silence. So the lock FAILS OPEN.
583
+ const lockable = fireLockPath(ctx.home, fireKey) !== null;
584
+ firingClaim = claimFiring(ctx.home, fireKey, budgetMs);
585
+ if (firingClaim === null && lockable) {
586
+ // Another process holds this exact firing. ⛔ Silent and exit 0: there is
587
+ // nothing to report, and a `systemMessage` here would put a line in the
588
+ // user's turn for a duplicate they did not cause. `finish` releases nothing
589
+ // because we hold nothing.
590
+ return null;
591
+ }
467
592
  const settleFor = isSessionEnd ? settleDelayMs(ctx.env, budgetMs) : 0;
468
593
  // `CR-182`. Carved OUT of the budget, never added on top — the same shape the
469
594
  // settle takes, and for the same reason: the watchdog does not move.
470
- const sendBudget = sendBudgetMs(budgetMs, input.eventName);
595
+ //
596
+ // ⛔ AND THE PRE-ENTRY COST IS CHARGED HERE (`CR-195/U2`, the G6 defect). The
597
+ // send loop measures its own consumption from `settleStart`, one line below;
598
+ // the watchdog has been running since `runHook`. The stdin read, the consent
599
+ // gate's `git rev-parse` spawn and the credential load all happened in
600
+ // between, and `CR-126` measured that interval at p99 392 ms — more than the
601
+ // whole 150 ms reserve. Passing it in is what makes the reserve a reserve
602
+ // against the deadline that can actually end the process, rather than against
603
+ // a clock that starts later than the one holding the gun.
471
604
  const settleStart = Date.now();
605
+ const sendBudget = sendBudgetMs(budgetMs, event, settleStart - hookStartedAt);
472
606
  const eof = settleFor > 0
473
607
  ? await settledSize(() => fileSize(input.transcriptPath), wait, settleFor)
474
608
  : fileSize(input.transcriptPath);
@@ -1 +1 @@
1
- {"version":3,"file":"entry.js","sourceRoot":"","sources":["../../src/hooks/entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EACL,SAAS,EACT,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,SAAS,GACV,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,cAAc,EAAyB,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,W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;YAAC,MAAM,CAAC;gBACP,iDAAiD;YACnD,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * One firing, one process — `CR-195`/U4, D205.
3
+ *
4
+ * ## ⛔ THE DEFECT THIS EXISTS FOR, MEASURED IN CURSOR'S OWN BUNDLE
5
+ *
6
+ * `connect` registers our hook in each agent's config. Cursor then reads **more
7
+ * than its own**: `isClaudeCodeHooksEnabled()` returns
8
+ * `thirdPartyExtensibilityObservable.get() ?? true` — ⛔ **defaulting to ON** —
9
+ * and under it Cursor loads the USER-level `~/.claude/settings.json` and runs
10
+ * every entry through a Claude→Cursor mapper whose table maps all three events
11
+ * we register:
12
+ *
13
+ * W2i = { …, Stop: stop, SessionEnd: sessionEnd, PreCompact: preCompact, … }
14
+ *
15
+ * So on a machine with both agents configured, ONE Cursor event fires our binary
16
+ * TWICE — once from `~/.cursor/hooks.json` and once from Claude's settings,
17
+ * mapped. Cursor does dedupe Claude-sourced entries against its own
18
+ * (`_getDeduplicatedClaudeHooks`), but the key is derived from the entry, and
19
+ * ours deliberately differ: the Cursor registration carries `--agent=cursor` so
20
+ * the budget and event vocabulary are right. **Different key, no dedupe.**
21
+ *
22
+ * ⛔ **Two processes then race on one session state file.** Both read the same
23
+ * `sentOffset`, both send the same span, both write it back — a duplicate
24
+ * upload — and both reach `dropSpooled`, which truncates the spool by LINES
25
+ * CONSUMED. Dropping the same lines twice discards commits that were never
26
+ * sent, and `capture_commits` rows cannot be retracted (D105/D108). That is
27
+ * unrecoverable, which puts it in the same class as the `SessionEnd` hole.
28
+ *
29
+ * ## ⚠ WHY THE LOSER BOWS OUT INSTEAD OF WAITING — the opposite of `oauth/lock.ts`
30
+ *
31
+ * The refresh lock makes its loser WAIT and re-read, because both callers need
32
+ * the result. Here the loser needs nothing: the holder is running the same work
33
+ * with the same inputs, so a second pass would send nothing anyway.
34
+ *
35
+ * ⛔ And waiting would be actively harmful on the one event that cannot afford
36
+ * it. A waiter spends the budget the watchdog is counting down, and `stampGaps`
37
+ * runs AFTER the send loop — which is precisely the arithmetic that produced the
38
+ * G6 defect, where the reserve was measured against the wrong clock and the
39
+ * final turn was lost. Adding a wait in front of `SessionEnd` would re-open it
40
+ * from the other side.
41
+ *
42
+ * ## ⚠ WHY SKIPPING CANNOT SUPPRESS A LEGITIMATE CAPTURE
43
+ *
44
+ * The key is `(repo, session, event)`, so the only thing a skip can lose is a
45
+ * SECOND firing of the SAME event in the SAME session while the first is still
46
+ * running. Taken one event at a time:
47
+ *
48
+ * - `Stop` and `PreCompact` fire repeatedly, and an overlapping one is
49
+ * harmless to drop: `hookBody`'s own comment is that *"every other event has
50
+ * a next invocation to pick up a lagging write"*. The bytes are not lost,
51
+ * they are sent by the next turn.
52
+ * - ⛔ `SessionEnd` has no next invocation — which is exactly why it is safe
53
+ * here. It fires **once per session**, so a concurrent second one is not a
54
+ * later capture at all; it is the duplicate this file exists to stop.
55
+ *
56
+ * So the arm that would be dangerous does not exist, and the arm that exists is
57
+ * not dangerous. Stated rather than assumed, because "a lock that silently drops
58
+ * work" is the right thing to be suspicious of.
59
+ */
60
+ export interface FireKey {
61
+ readonly repoKey: string;
62
+ readonly sessionId: string;
63
+ /** The agent's own event spelling is fine here — this key never travels. */
64
+ readonly event: string;
65
+ }
66
+ /**
67
+ * Where one firing's lock lives — beside the session state it protects.
68
+ *
69
+ * `null` when the repo key is empty, matching `sessionStatePath`: a hook with no
70
+ * project resolved has nothing to serialise against and must not invent a path.
71
+ */
72
+ export declare function fireLockPath(home: string, key: FireKey): string | null;
73
+ export interface FireClaim {
74
+ /** Release ours. Safe to call twice; never removes a lock that is not ours. */
75
+ readonly release: () => void;
76
+ }
77
+ /**
78
+ * Claim this firing, or report that another process already has it.
79
+ *
80
+ * `null` means **a live invocation is already doing this exact work** — the
81
+ * caller's whole remaining job is to exit 0 quietly.
82
+ *
83
+ * ⚠ `budgetMs` is what makes the staleness bound DERIVED rather than guessed.
84
+ * The watchdog ends a healthy holder at `budgetMs`, so nothing can legitimately
85
+ * hold this longer than that plus the I/O either side; a lock older than
86
+ * `budgetMs + STALE_MARGIN_MS` therefore belongs to a process that is gone.
87
+ * Reclaiming too EARLY re-admits the double-send this prevents, and reclaiming
88
+ * too LATE only skips one redundant invocation — so the margin leans late.
89
+ */
90
+ export declare function claimFiring(home: string, key: FireKey, budgetMs: number): FireClaim | null;