@vibe-commit/capture 0.1.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 (141) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +66 -0
  3. package/dist/agents/claude_code.d.ts +11 -0
  4. package/dist/agents/claude_code.js +162 -0
  5. package/dist/agents/claude_code.js.map +1 -0
  6. package/dist/agents/codex_cli.d.ts +15 -0
  7. package/dist/agents/codex_cli.js +67 -0
  8. package/dist/agents/codex_cli.js.map +1 -0
  9. package/dist/agents/cursor.d.ts +21 -0
  10. package/dist/agents/cursor.js +89 -0
  11. package/dist/agents/cursor.js.map +1 -0
  12. package/dist/agents/registry.d.ts +184 -0
  13. package/dist/agents/registry.js +212 -0
  14. package/dist/agents/registry.js.map +1 -0
  15. package/dist/agents/types.d.ts +279 -0
  16. package/dist/agents/types.js +67 -0
  17. package/dist/agents/types.js.map +1 -0
  18. package/dist/commands/connect.d.ts +36 -0
  19. package/dist/commands/connect.js +499 -0
  20. package/dist/commands/connect.js.map +1 -0
  21. package/dist/commands/context.d.ts +45 -0
  22. package/dist/commands/context.js +14 -0
  23. package/dist/commands/context.js.map +1 -0
  24. package/dist/commands/report.d.ts +105 -0
  25. package/dist/commands/report.js +430 -0
  26. package/dist/commands/report.js.map +1 -0
  27. package/dist/commands/status.d.ts +29 -0
  28. package/dist/commands/status.js +236 -0
  29. package/dist/commands/status.js.map +1 -0
  30. package/dist/commands/why.d.ts +349 -0
  31. package/dist/commands/why.js +937 -0
  32. package/dist/commands/why.js.map +1 -0
  33. package/dist/consent.d.ts +59 -0
  34. package/dist/consent.js +111 -0
  35. package/dist/consent.js.map +1 -0
  36. package/dist/copy/claims.d.ts +79 -0
  37. package/dist/copy/claims.js +343 -0
  38. package/dist/copy/claims.js.map +1 -0
  39. package/dist/copy/grades.d.ts +117 -0
  40. package/dist/copy/grades.js +96 -0
  41. package/dist/copy/grades.js.map +1 -0
  42. package/dist/copy/index.d.ts +12 -0
  43. package/dist/copy/index.js +13 -0
  44. package/dist/copy/index.js.map +1 -0
  45. package/dist/copy/strings.d.ts +1328 -0
  46. package/dist/copy/strings.js +1243 -0
  47. package/dist/copy/strings.js.map +1 -0
  48. package/dist/copy/time.d.ts +27 -0
  49. package/dist/copy/time.js +43 -0
  50. package/dist/copy/time.js.map +1 -0
  51. package/dist/credential.d.ts +211 -0
  52. package/dist/credential.js +298 -0
  53. package/dist/credential.js.map +1 -0
  54. package/dist/exit.d.ts +59 -0
  55. package/dist/exit.js +60 -0
  56. package/dist/exit.js.map +1 -0
  57. package/dist/git.d.ts +299 -0
  58. package/dist/git.js +653 -0
  59. package/dist/git.js.map +1 -0
  60. package/dist/hooks/entry.d.ts +277 -0
  61. package/dist/hooks/entry.js +1092 -0
  62. package/dist/hooks/entry.js.map +1 -0
  63. package/dist/hooks/post_commit.d.ts +59 -0
  64. package/dist/hooks/post_commit.js +160 -0
  65. package/dist/hooks/post_commit.js.map +1 -0
  66. package/dist/hooks/post_rewrite.d.ts +59 -0
  67. package/dist/hooks/post_rewrite.js +161 -0
  68. package/dist/hooks/post_rewrite.js.map +1 -0
  69. package/dist/hooks/session_end.d.ts +101 -0
  70. package/dist/hooks/session_end.js +120 -0
  71. package/dist/hooks/session_end.js.map +1 -0
  72. package/dist/index.d.ts +34 -0
  73. package/dist/index.js +360 -0
  74. package/dist/index.js.map +1 -0
  75. package/dist/install.d.ts +153 -0
  76. package/dist/install.js +284 -0
  77. package/dist/install.js.map +1 -0
  78. package/dist/json.d.ts +100 -0
  79. package/dist/json.js +94 -0
  80. package/dist/json.js.map +1 -0
  81. package/dist/oauth/discovery.d.ts +96 -0
  82. package/dist/oauth/discovery.js +163 -0
  83. package/dist/oauth/discovery.js.map +1 -0
  84. package/dist/oauth/lock.d.ts +100 -0
  85. package/dist/oauth/lock.js +287 -0
  86. package/dist/oauth/lock.js.map +1 -0
  87. package/dist/oauth/loopback.d.ts +85 -0
  88. package/dist/oauth/loopback.js +124 -0
  89. package/dist/oauth/loopback.js.map +1 -0
  90. package/dist/oauth/pkce.d.ts +58 -0
  91. package/dist/oauth/pkce.js +77 -0
  92. package/dist/oauth/pkce.js.map +1 -0
  93. package/dist/oauth/read.d.ts +120 -0
  94. package/dist/oauth/read.js +144 -0
  95. package/dist/oauth/read.js.map +1 -0
  96. package/dist/oauth/session.d.ts +80 -0
  97. package/dist/oauth/session.js +112 -0
  98. package/dist/oauth/session.js.map +1 -0
  99. package/dist/oauth/signin.d.ts +178 -0
  100. package/dist/oauth/signin.js +225 -0
  101. package/dist/oauth/signin.js.map +1 -0
  102. package/dist/oauth/token.d.ts +139 -0
  103. package/dist/oauth/token.js +183 -0
  104. package/dist/oauth/token.js.map +1 -0
  105. package/dist/paths.d.ts +366 -0
  106. package/dist/paths.js +460 -0
  107. package/dist/paths.js.map +1 -0
  108. package/dist/policy.d.ts +195 -0
  109. package/dist/policy.js +244 -0
  110. package/dist/policy.js.map +1 -0
  111. package/dist/post.d.ts +302 -0
  112. package/dist/post.js +384 -0
  113. package/dist/post.js.map +1 -0
  114. package/dist/project.d.ts +99 -0
  115. package/dist/project.js +192 -0
  116. package/dist/project.js.map +1 -0
  117. package/dist/redact.d.ts +175 -0
  118. package/dist/redact.js +700 -0
  119. package/dist/redact.js.map +1 -0
  120. package/dist/runtime.d.ts +30 -0
  121. package/dist/runtime.js +37 -0
  122. package/dist/runtime.js.map +1 -0
  123. package/dist/spawn_budget.d.ts +101 -0
  124. package/dist/spawn_budget.js +124 -0
  125. package/dist/spawn_budget.js.map +1 -0
  126. package/dist/spool.d.ts +390 -0
  127. package/dist/spool.js +556 -0
  128. package/dist/spool.js.map +1 -0
  129. package/dist/state.d.ts +109 -0
  130. package/dist/state.js +217 -0
  131. package/dist/state.js.map +1 -0
  132. package/dist/system_message.d.ts +101 -0
  133. package/dist/system_message.js +141 -0
  134. package/dist/system_message.js.map +1 -0
  135. package/dist/term.d.ts +112 -0
  136. package/dist/term.js +134 -0
  137. package/dist/term.js.map +1 -0
  138. package/dist/version.d.ts +16 -0
  139. package/dist/version.js +17 -0
  140. package/dist/version.js.map +1 -0
  141. package/package.json +50 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redact.js","sourceRoot":"","sources":["../src/redact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEnD;;;;;;;;GAQG;AACH,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC;AAEtF;;;;;;;;;;;;;;GAcG;AACH,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC3B,SAAS;IACT,cAAc;IACd,WAAW;IACX,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,wEAAwE;IACxE,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,WAAW;CACZ,CAAC,CAAC;AAEH,oDAAoD;AACpD,MAAM,SAAS,GAAG,iBAAiB,CAAC;AA4BpC;;;;;GAKG;AACH,MAAM,iBAAiB,GAAmB;IACxC,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,YAAY;IACzB,cAAc,EAAE,IAAI,GAAG,EAAE;IACzB,SAAS,EAAE,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC;CAChC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,eAAe,GAAmB;IACtC,QAAQ,EAAE,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC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AAS;YAAE,OAAO,GAAG,CAAC;QAClC,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAC7C,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACtB,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The Node floor — D57 (plan §DX11).
3
+ *
4
+ * `>= 22.15.0`. Two enforcement points, deliberately different in loudness:
5
+ * - `connect` refuses loudly, because the user is watching and can act.
6
+ * - the hook self-checks and says it once per session through `systemMessage`,
7
+ * because a hook that fails silently on an old runtime IS the
8
+ * silent-unconfigured default that DX3 exists to kill.
9
+ *
10
+ * `engines` in `package.json` does NOT cover this. npm only warns by default, and
11
+ * the plugin lane (`CR-028`) vendors the binary and invokes it by path, so npm is
12
+ * not in the loop at hook time at all.
13
+ */
14
+ export declare const NODE_FLOOR: {
15
+ readonly major: 22;
16
+ readonly minor: 15;
17
+ readonly patch: 0;
18
+ };
19
+ export declare const NODE_FLOOR_TEXT: string;
20
+ /**
21
+ * Parse a `process.versions.node` string. Returns null on anything unexpected —
22
+ * an unparseable version is treated as unsupported, because guessing in the
23
+ * permissive direction is how a floor stops being a floor.
24
+ */
25
+ export declare function parseNodeVersion(version: string): {
26
+ major: number;
27
+ minor: number;
28
+ patch: number;
29
+ } | null;
30
+ export declare function meetsNodeFloor(version: string): boolean;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * The Node floor — D57 (plan §DX11).
3
+ *
4
+ * `>= 22.15.0`. Two enforcement points, deliberately different in loudness:
5
+ * - `connect` refuses loudly, because the user is watching and can act.
6
+ * - the hook self-checks and says it once per session through `systemMessage`,
7
+ * because a hook that fails silently on an old runtime IS the
8
+ * silent-unconfigured default that DX3 exists to kill.
9
+ *
10
+ * `engines` in `package.json` does NOT cover this. npm only warns by default, and
11
+ * the plugin lane (`CR-028`) vendors the binary and invokes it by path, so npm is
12
+ * not in the loop at hook time at all.
13
+ */
14
+ export const NODE_FLOOR = { major: 22, minor: 15, patch: 0 };
15
+ export const NODE_FLOOR_TEXT = `${NODE_FLOOR.major}.${NODE_FLOOR.minor}`;
16
+ /**
17
+ * Parse a `process.versions.node` string. Returns null on anything unexpected —
18
+ * an unparseable version is treated as unsupported, because guessing in the
19
+ * permissive direction is how a floor stops being a floor.
20
+ */
21
+ export function parseNodeVersion(version) {
22
+ const m = /^(\d+)\.(\d+)\.(\d+)/.exec(version);
23
+ if (!m)
24
+ return null;
25
+ return { major: Number(m[1]), minor: Number(m[2]), patch: Number(m[3]) };
26
+ }
27
+ export function meetsNodeFloor(version) {
28
+ const v = parseNodeVersion(version);
29
+ if (v === null)
30
+ return false;
31
+ if (v.major !== NODE_FLOOR.major)
32
+ return v.major > NODE_FLOOR.major;
33
+ if (v.minor !== NODE_FLOOR.minor)
34
+ return v.minor > NODE_FLOOR.minor;
35
+ return v.patch >= NODE_FLOOR.patch;
36
+ }
37
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAW,CAAC;AAEtE,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,UAAU,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,EAAE,CAAC;AAEzE;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAe;IAEf,MAAM,CAAC,GAAG,sBAAsB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/C,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACpB,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAAe;IAC5C,MAAM,CAAC,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC7B,IAAI,CAAC,CAAC,KAAK,KAAK,UAAU,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;IACpE,IAAI,CAAC,CAAC,KAAK,KAAK,UAAU,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;IACpE,OAAO,CAAC,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC;AACrC,CAAC"}
@@ -0,0 +1,101 @@
1
+ /**
2
+ * A wall-clock budget for SYNCHRONOUS spawns — the half of the hook's timeout
3
+ * contract the watchdog provably cannot cover (`TODOS[87]`).
4
+ *
5
+ * ## Why the watchdog is not enough, and never could be
6
+ *
7
+ * `runHook` arms `setTimeout(() => finish(null), budgetMs).unref()`. ⛔ **A timer
8
+ * cannot fire while the event loop is blocked.** `execFileSync` blocks it by
9
+ * definition, so a git binary that never returns produces an **unbounded hang**
10
+ * rather than a slow hook — no timer, no `--test-timeout` and no watchdog can
11
+ * interrupt it. Demonstrated on Linux 2026-08-10, where an unwritable `/proc`
12
+ * HOME blocked a sync call forever and ran a CI job 25 minutes against a ~50s
13
+ * norm (D89).
14
+ *
15
+ * ⚠ **So widening a timeout cannot help; only BOUNDING can.** And a per-call
16
+ * ceiling is not a bound either — four `timeout: 5_000` literals on one path sum
17
+ * to 20s against a 5s watchdog. The bound has to be on the SUM, which means the
18
+ * spawns have to share one deadline rather than each hold its own ceiling.
19
+ *
20
+ * ## ⛔ `timeout: 0` MEANS "NO TIMEOUT", AND THAT IS THE TRAP THIS MODULE EXISTS
21
+ * ## TO AVOID
22
+ *
23
+ * MEASURED on Node 22: `execFileSync(..., { timeout: 0 })` runs a `sleep 3` to
24
+ * completion — the bound is silently DISABLED — and `timeout: -5` throws
25
+ * `ERR_OUT_OF_RANGE` synchronously. So the obvious implementation, passing a
26
+ * remaining-budget number straight through, turns into "no timeout at all"
27
+ * exactly when the budget has run out, which is precisely when the bound matters
28
+ * most. It would look like a fix and behave like the bug.
29
+ *
30
+ * `spawnTimeoutMs` therefore returns `null` rather than a doomed number, and
31
+ * every caller answers with the value it already uses for "git could not tell
32
+ * us" — a refusal each of them was already built to express.
33
+ *
34
+ * ## The budget is OPT-IN, so the CLI verbs are untouched
35
+ *
36
+ * Only the hook arms it. `report`, `why`, `status` and `connect` are interactive
37
+ * and have no 5s wall clock, so with no budget armed this returns the caller's
38
+ * own ceiling and their behaviour is byte-identical to before.
39
+ */
40
+ /**
41
+ * The share of the hook budget all synchronous spawns may take TOGETHER.
42
+ *
43
+ * At the 5s default this is 3000 ms for every git and ssh spawn combined, which
44
+ * still leaves 2000 ms in which the watchdog can actually fire — and the settle
45
+ * and the sends are `await`ed, so they never block the timer and the watchdog
46
+ * really does cover them. The same idiom as `SEND_BUDGET_FRACTION` (0.6) and
47
+ * `SETTLE_BUDGET_FRACTION` (0.3): a named fraction of one budget, never a
48
+ * second literal.
49
+ *
50
+ * ## ⛔ WHY THIS IS GENEROUS RATHER THAN TIGHT, AND IT IS NOT A TUNING KNOB
51
+ *
52
+ * The two failure directions are NOT symmetric, so the value follows from which
53
+ * one is worse rather than from splitting the budget evenly:
54
+ *
55
+ * - **Window too small** → a spawn is refused on a merely BUSY machine, so
56
+ * `resolveRepoSlug` falls back to `local:<hash of the developer's absolute
57
+ * path>`. ⛔ That is a WRONG REPOSITORY IDENTITY on the wire — the join key
58
+ * every downstream surface uses — and it is silent. It is precisely the
59
+ * defect `CR-167` (D157) has just finished removing, re-introduced
60
+ * intermittently and only ever on loaded machines.
61
+ * - **Window too large** → under a genuine hang the network send is squeezed,
62
+ * so nothing is captured this turn. The offset is not advanced, the next
63
+ * hook picks the bytes up, and the user loses nothing.
64
+ *
65
+ * A retried send costs a turn. A wrong identity fragments a repository's audit
66
+ * record permanently. So the window is sized to be unreachable by anything but
67
+ * a real hang: 3000 ms against a MEASURED ~20 ms warm spawn is a 150x margin.
68
+ *
69
+ * ⚠ **MEASURED, NOT REASONED.** At 0.2 (a 1000 ms window) the full suite failed
70
+ * 7-8 cells per run with a DIFFERENT set each time — all of them slug and
71
+ * delivery cells — because the suite's own concurrency pushed ordinary git
72
+ * spawns past the window. Each file passed alone. That is exactly what this
73
+ * degradation looks like from the outside, and it is why the value is here with
74
+ * its reasoning attached rather than left as a number someone can nudge.
75
+ */
76
+ export declare const SPAWN_BUDGET_FRACTION = 0.6;
77
+ /**
78
+ * Below this much remaining, do not spawn at all.
79
+ *
80
+ * A spawn that can only time out costs a fork and delivers nothing, and the
81
+ * caller's refusal path is already correct — so refusing early is strictly
82
+ * better than starting a process we know cannot finish. It is also what keeps
83
+ * `timeout: 0` unreachable: the returned number is always at least this.
84
+ */
85
+ export declare const MIN_SPAWN_TIMEOUT_MS = 50;
86
+ /**
87
+ * Arm the budget. Called once, beside the watchdog it completes.
88
+ *
89
+ * Takes the same `budgetMs` the watchdog does, so the two cannot drift.
90
+ */
91
+ export declare function startSpawnBudget(budgetMs: number, now?: number): void;
92
+ /** Disarm. Tests call this in a `finally`; the hook process just exits. */
93
+ export declare function clearSpawnBudget(): void;
94
+ /**
95
+ * What this spawn may take: its own ceiling, the remaining budget, or `null`
96
+ * when there is not enough left to be worth starting.
97
+ *
98
+ * ⚠ **Never returns 0 or a negative**, for the `ERR_OUT_OF_RANGE` and
99
+ * silently-unbounded reasons in the module docblock. `null` is the refusal.
100
+ */
101
+ export declare function spawnTimeoutMs(ceilingMs: number, now?: number): number | null;
@@ -0,0 +1,124 @@
1
+ /**
2
+ * A wall-clock budget for SYNCHRONOUS spawns — the half of the hook's timeout
3
+ * contract the watchdog provably cannot cover (`TODOS[87]`).
4
+ *
5
+ * ## Why the watchdog is not enough, and never could be
6
+ *
7
+ * `runHook` arms `setTimeout(() => finish(null), budgetMs).unref()`. ⛔ **A timer
8
+ * cannot fire while the event loop is blocked.** `execFileSync` blocks it by
9
+ * definition, so a git binary that never returns produces an **unbounded hang**
10
+ * rather than a slow hook — no timer, no `--test-timeout` and no watchdog can
11
+ * interrupt it. Demonstrated on Linux 2026-08-10, where an unwritable `/proc`
12
+ * HOME blocked a sync call forever and ran a CI job 25 minutes against a ~50s
13
+ * norm (D89).
14
+ *
15
+ * ⚠ **So widening a timeout cannot help; only BOUNDING can.** And a per-call
16
+ * ceiling is not a bound either — four `timeout: 5_000` literals on one path sum
17
+ * to 20s against a 5s watchdog. The bound has to be on the SUM, which means the
18
+ * spawns have to share one deadline rather than each hold its own ceiling.
19
+ *
20
+ * ## ⛔ `timeout: 0` MEANS "NO TIMEOUT", AND THAT IS THE TRAP THIS MODULE EXISTS
21
+ * ## TO AVOID
22
+ *
23
+ * MEASURED on Node 22: `execFileSync(..., { timeout: 0 })` runs a `sleep 3` to
24
+ * completion — the bound is silently DISABLED — and `timeout: -5` throws
25
+ * `ERR_OUT_OF_RANGE` synchronously. So the obvious implementation, passing a
26
+ * remaining-budget number straight through, turns into "no timeout at all"
27
+ * exactly when the budget has run out, which is precisely when the bound matters
28
+ * most. It would look like a fix and behave like the bug.
29
+ *
30
+ * `spawnTimeoutMs` therefore returns `null` rather than a doomed number, and
31
+ * every caller answers with the value it already uses for "git could not tell
32
+ * us" — a refusal each of them was already built to express.
33
+ *
34
+ * ## The budget is OPT-IN, so the CLI verbs are untouched
35
+ *
36
+ * Only the hook arms it. `report`, `why`, `status` and `connect` are interactive
37
+ * and have no 5s wall clock, so with no budget armed this returns the caller's
38
+ * own ceiling and their behaviour is byte-identical to before.
39
+ */
40
+ /**
41
+ * The absolute deadline for synchronous spawns, or null when none is armed.
42
+ *
43
+ * Module state rather than a threaded parameter, deliberately: a wall-clock
44
+ * budget is a property of the PROCESS, and the alternative is an extra argument
45
+ * on `gitToplevel`, `gitRemoteUrl`, `gitProbe`, `gitPatchId` and
46
+ * `resolveSshAlias` plus every CLI caller that has no budget to pass. The hook
47
+ * process arms it once and exits; tests clear it in a `finally`.
48
+ */
49
+ let deadlineAt = null;
50
+ /**
51
+ * The share of the hook budget all synchronous spawns may take TOGETHER.
52
+ *
53
+ * At the 5s default this is 3000 ms for every git and ssh spawn combined, which
54
+ * still leaves 2000 ms in which the watchdog can actually fire — and the settle
55
+ * and the sends are `await`ed, so they never block the timer and the watchdog
56
+ * really does cover them. The same idiom as `SEND_BUDGET_FRACTION` (0.6) and
57
+ * `SETTLE_BUDGET_FRACTION` (0.3): a named fraction of one budget, never a
58
+ * second literal.
59
+ *
60
+ * ## ⛔ WHY THIS IS GENEROUS RATHER THAN TIGHT, AND IT IS NOT A TUNING KNOB
61
+ *
62
+ * The two failure directions are NOT symmetric, so the value follows from which
63
+ * one is worse rather than from splitting the budget evenly:
64
+ *
65
+ * - **Window too small** → a spawn is refused on a merely BUSY machine, so
66
+ * `resolveRepoSlug` falls back to `local:<hash of the developer's absolute
67
+ * path>`. ⛔ That is a WRONG REPOSITORY IDENTITY on the wire — the join key
68
+ * every downstream surface uses — and it is silent. It is precisely the
69
+ * defect `CR-167` (D157) has just finished removing, re-introduced
70
+ * intermittently and only ever on loaded machines.
71
+ * - **Window too large** → under a genuine hang the network send is squeezed,
72
+ * so nothing is captured this turn. The offset is not advanced, the next
73
+ * hook picks the bytes up, and the user loses nothing.
74
+ *
75
+ * A retried send costs a turn. A wrong identity fragments a repository's audit
76
+ * record permanently. So the window is sized to be unreachable by anything but
77
+ * a real hang: 3000 ms against a MEASURED ~20 ms warm spawn is a 150x margin.
78
+ *
79
+ * ⚠ **MEASURED, NOT REASONED.** At 0.2 (a 1000 ms window) the full suite failed
80
+ * 7-8 cells per run with a DIFFERENT set each time — all of them slug and
81
+ * delivery cells — because the suite's own concurrency pushed ordinary git
82
+ * spawns past the window. Each file passed alone. That is exactly what this
83
+ * degradation looks like from the outside, and it is why the value is here with
84
+ * its reasoning attached rather than left as a number someone can nudge.
85
+ */
86
+ export const SPAWN_BUDGET_FRACTION = 0.6;
87
+ /**
88
+ * Below this much remaining, do not spawn at all.
89
+ *
90
+ * A spawn that can only time out costs a fork and delivers nothing, and the
91
+ * caller's refusal path is already correct — so refusing early is strictly
92
+ * better than starting a process we know cannot finish. It is also what keeps
93
+ * `timeout: 0` unreachable: the returned number is always at least this.
94
+ */
95
+ export const MIN_SPAWN_TIMEOUT_MS = 50;
96
+ /**
97
+ * Arm the budget. Called once, beside the watchdog it completes.
98
+ *
99
+ * Takes the same `budgetMs` the watchdog does, so the two cannot drift.
100
+ */
101
+ export function startSpawnBudget(budgetMs, now = Date.now()) {
102
+ deadlineAt = now + Math.floor(budgetMs * SPAWN_BUDGET_FRACTION);
103
+ }
104
+ /** Disarm. Tests call this in a `finally`; the hook process just exits. */
105
+ export function clearSpawnBudget() {
106
+ deadlineAt = null;
107
+ }
108
+ /**
109
+ * What this spawn may take: its own ceiling, the remaining budget, or `null`
110
+ * when there is not enough left to be worth starting.
111
+ *
112
+ * ⚠ **Never returns 0 or a negative**, for the `ERR_OUT_OF_RANGE` and
113
+ * silently-unbounded reasons in the module docblock. `null` is the refusal.
114
+ */
115
+ export function spawnTimeoutMs(ceilingMs, now = Date.now()) {
116
+ // No budget armed — a CLI verb. Its own ceiling, exactly as before.
117
+ if (deadlineAt === null)
118
+ return ceilingMs;
119
+ const remaining = deadlineAt - now;
120
+ if (remaining < MIN_SPAWN_TIMEOUT_MS)
121
+ return null;
122
+ return Math.min(ceilingMs, remaining);
123
+ }
124
+ //# sourceMappingURL=spawn_budget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spawn_budget.js","sourceRoot":"","sources":["../src/spawn_budget.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH;;;;;;;;GAQG;AACH,IAAI,UAAU,GAAkB,IAAI,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAEzC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEvC;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB,EAAE,MAAc,IAAI,CAAC,GAAG,EAAE;IACzE,UAAU,GAAG,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,qBAAqB,CAAC,CAAC;AAClE,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,gBAAgB;IAC9B,UAAU,GAAG,IAAI,CAAC;AACpB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,SAAiB,EAAE,MAAc,IAAI,CAAC,GAAG,EAAE;IACxE,oEAAoE;IACpE,IAAI,UAAU,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAC1C,MAAM,SAAS,GAAG,UAAU,GAAG,GAAG,CAAC;IACnC,IAAI,SAAS,GAAG,oBAAoB;QAAE,OAAO,IAAI,CAAC;IAClD,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AACxC,CAAC"}