@joshuafolkken/kit 1.1094.0 → 1.1136.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 (177) hide show
  1. package/.claude/agents/investigator.md +17 -0
  2. package/.claude/settings.json +1 -0
  3. package/.claude/skills/workflow-commands/SKILL.md +1 -1
  4. package/.claude/skills/workflow-commands/background-commands.md +36 -85
  5. package/.claude/skills/workflow-commands/backlogrun-progress.md +31 -34
  6. package/.claude/skills/workflow-commands/backlogrun-steps.md +2 -2
  7. package/.claude/skills/workflow-commands/delegation.md +5 -1
  8. package/.claude/skills/workflow-commands/fullrun.md +5 -4
  9. package/.claude/skills/workflow-commands/halfrun.md +5 -4
  10. package/.claude/skills/workflow-commands/latest-gate.md +7 -15
  11. package/.claude/skills/workflow-commands/pre-gate-cut.md +4 -8
  12. package/.claude/skills/workflow-commands/split-assessment.md +4 -18
  13. package/.github/actions/setup-node/action.yml +33 -0
  14. package/.github/actions/setup-pnpm/action.yml +4 -4
  15. package/.github/workflows/auto-tag.yml +2 -3
  16. package/.github/workflows/ci.yml +7 -8
  17. package/.github/workflows/dependabot-auto-merge.yml +1 -0
  18. package/.github/workflows/pr-classification.yml +1 -3
  19. package/.github/workflows/production.yml +1 -0
  20. package/.github/workflows/publish.yml +10 -9
  21. package/.github/workflows/sonar-qube.yml +17 -13
  22. package/.pnpmfile.mjs +29 -0
  23. package/AGENTS.md +4 -11
  24. package/CLAUDE.md +24 -17
  25. package/GEMINI.md +4 -13
  26. package/README.md +8 -3
  27. package/SECURITY.md +2 -0
  28. package/cspell/index.yaml +4 -0
  29. package/dist/CLAUDE.basic.md +6 -6
  30. package/dist/CLAUDE.md +24 -17
  31. package/dist/CLAUDE.static.md +6 -6
  32. package/dist/config-merge/index.js +33 -9
  33. package/dist/hooks/batch-guard.js +4 -4
  34. package/dist/hooks/{chunk-OIZUHPJI.js → chunk-FO2I7UT7.js} +1 -1
  35. package/dist/hooks/{chunk-NKOG3XAV.js → chunk-GDU26K3J.js} +11 -3
  36. package/dist/hooks/{chunk-O4LL4HTI.js → chunk-HANSKHES.js} +2 -2
  37. package/dist/hooks/{chunk-3C4YCCEF.js → chunk-HBKZLITF.js} +4 -4
  38. package/dist/hooks/{chunk-UD24EAIL.js → chunk-JKKTVDAG.js} +1984 -146
  39. package/dist/hooks/{chunk-M2XDCUKD.js → chunk-KBXZLMRH.js} +89 -1803
  40. package/dist/hooks/{chunk-IL27YTPH.js → chunk-KOKOAV6D.js} +2 -2
  41. package/dist/hooks/{chunk-7ZPFAVR7.js → chunk-LJBLGHEH.js} +59 -19
  42. package/dist/hooks/{chunk-E54KGFEQ.js → chunk-NFZGFGOR.js} +1 -1
  43. package/dist/hooks/{chunk-KHWHKJOM.js → chunk-RFWWUI5F.js} +4 -4
  44. package/dist/hooks/codex-hook-adapter.js +12 -47
  45. package/dist/hooks/duplicate-read-guard.js +5 -5
  46. package/dist/hooks/format-edited.js +2 -2
  47. package/dist/hooks/inputs.json +175 -173
  48. package/dist/hooks/investigation-guard.js +5 -5
  49. package/dist/hooks/pretool-guard.js +9 -9
  50. package/dist/hooks/stop-guard.js +17 -12
  51. package/dist/josh.js +87 -31
  52. package/dist/version/index.js +36 -20
  53. package/eslint/rules/unicorn.js +3 -2
  54. package/package.json +23 -5
  55. package/pnpm-workspace.yaml +5 -7
  56. package/prompts/collaboration-workflow/glossary.md +17 -0
  57. package/prompts/collaboration-workflow/issue-template.md +1 -1
  58. package/prompts/collaboration-workflow/operating-rules.md +1 -1
  59. package/prompts/collaboration-workflow/principles.md +9 -0
  60. package/prompts/collaboration-workflow.md +1 -0
  61. package/scripts/backlog/backlog-arrival.ts +30 -10
  62. package/scripts/backlog/backlog-budget-cli.ts +15 -16
  63. package/scripts/backlog/backlog-offer-cli.ts +6 -14
  64. package/scripts/backlog/backlog-plan.ts +29 -18
  65. package/scripts/backlog/backlog-ready.ts +20 -7
  66. package/scripts/config-merge/parse-jsonc.ts +33 -3
  67. package/scripts/config-merge/patch-json-key.ts +13 -6
  68. package/scripts/cost-runtime/cost-cli.ts +3 -7
  69. package/scripts/delegation/delegation-policy.ts +9 -1
  70. package/scripts/delegation/investigation-guard.ts +1 -1
  71. package/scripts/delegation/investigation-reads.ts +105 -19
  72. package/scripts/doctor/doctor-consumer.ts +3 -5
  73. package/scripts/doctor/doctor-io.ts +9 -13
  74. package/scripts/document/backlogrun-parent-read-set.ts +12 -1
  75. package/scripts/document/capped-print.ts +74 -0
  76. package/scripts/document/document-byte-budget.ts +1 -0
  77. package/scripts/document/document-section-cli.ts +4 -3
  78. package/scripts/document/entry-read-budget.ts +13 -7
  79. package/scripts/document/entry-read-set.ts +32 -8
  80. package/scripts/document/lane-child-read-set.ts +7 -0
  81. package/scripts/document/read-set-point-of-use.ts +8 -3
  82. package/scripts/document/read-set-trim.ts +3 -1
  83. package/scripts/epic/epic-audit.ts +3 -18
  84. package/scripts/gate/scoped-green.ts +25 -14
  85. package/scripts/gh/git-gh-issue-list.ts +12 -11
  86. package/scripts/gh/git-gh-issue-write.ts +4 -1
  87. package/scripts/gh/git-gh-pr-auto-merge.ts +4 -1
  88. package/scripts/git/git-command.ts +6 -1
  89. package/scripts/git/git-spawn-sync.ts +65 -0
  90. package/scripts/git/git-spawn.ts +5 -4
  91. package/scripts/git/stash/stash-pop-args.ts +1 -6
  92. package/scripts/init/claude-kit-only-settings.ts +29 -0
  93. package/scripts/init/init-copy-content.ts +8 -2
  94. package/scripts/init/init-file-action.ts +54 -0
  95. package/scripts/init/init-logic-migrate.ts +35 -17
  96. package/scripts/init/init-logic-secretlint.ts +1 -1
  97. package/scripts/init/init-logic.ts +6 -22
  98. package/scripts/init/init.ts +11 -68
  99. package/scripts/init/initial-commit.ts +24 -0
  100. package/scripts/init/kit-written-paths.ts +2 -0
  101. package/scripts/init/project-profile.ts +3 -6
  102. package/scripts/init/start-exec.ts +16 -3
  103. package/scripts/init/start-steps.ts +10 -13
  104. package/scripts/issue/defect-rate-cli.ts +61 -20
  105. package/scripts/issue/issue-backlinks.ts +7 -14
  106. package/scripts/issue/issue-cite.ts +12 -6
  107. package/scripts/issue/issue-file.ts +5 -12
  108. package/scripts/issue/issue-read-cli.ts +1 -0
  109. package/scripts/issue/issue-report-failures.ts +6 -2
  110. package/scripts/issue/issue-state-cli.ts +1 -1
  111. package/scripts/issue/markdown-section.ts +21 -6
  112. package/scripts/issue/measure-rerun-cli.ts +73 -14
  113. package/scripts/josh/josh-commands-lane.ts +1 -1
  114. package/scripts/josh/josh-commands-project.ts +8 -1
  115. package/scripts/josh/josh-commands-workflow.ts +1 -1
  116. package/scripts/josh/run-github-prerequisite.ts +3 -6
  117. package/scripts/lane/lane-await.ts +89 -15
  118. package/scripts/lane/lane-cli.ts +11 -13
  119. package/scripts/lane/lane-close.ts +4 -1
  120. package/scripts/lane/lane-launch-cli.ts +10 -16
  121. package/scripts/lane/openai-review-broker.ts +4 -1
  122. package/scripts/lib/cli-flags.ts +31 -2
  123. package/scripts/lib/error-message.ts +12 -1
  124. package/scripts/lines/line-targets.ts +0 -11
  125. package/scripts/lines/lines-command.ts +5 -3
  126. package/scripts/propagate/propagate-git.ts +3 -8
  127. package/scripts/refactor/refactor-scan.ts +2 -1
  128. package/scripts/registry-migration/migrate-logic.ts +28 -19
  129. package/scripts/registry-migration/migrate.ts +6 -5
  130. package/scripts/release/github-release-cli.ts +14 -3
  131. package/scripts/release/github-release-environment.ts +1 -0
  132. package/scripts/release/github-release.ts +103 -17
  133. package/scripts/release/release-publish.ts +36 -2
  134. package/scripts/release/release-worktree.ts +97 -2
  135. package/scripts/review/review-checkout.ts +3 -2
  136. package/scripts/review/review-record-cli.ts +9 -16
  137. package/scripts/rules/early-heartbeat.ts +4 -3
  138. package/scripts/rules/lane-park.ts +9 -0
  139. package/scripts/rules/stop-rules.ts +7 -4
  140. package/scripts/run/run-carry-args.ts +8 -12
  141. package/scripts/run/run-carry-cli.ts +3 -1
  142. package/scripts/run/run-carry-conversation.ts +94 -0
  143. package/scripts/run/run-carry-reclaim.ts +37 -0
  144. package/scripts/run/run-carry.ts +21 -5
  145. package/scripts/run/run-cut-args.ts +1 -6
  146. package/scripts/run/run-ending-cli.ts +1 -5
  147. package/scripts/run/run-entry-cli.ts +40 -9
  148. package/scripts/run/run-entry-stop.ts +104 -0
  149. package/scripts/run/run-event-stream-emit.ts +7 -2
  150. package/scripts/run/run-hold.ts +4 -1
  151. package/scripts/run/run-liveness-cli.ts +1 -5
  152. package/scripts/run/run-merge-cli.ts +2 -10
  153. package/scripts/run/run-merge-steps.ts +4 -1
  154. package/scripts/run/run-parent-cut-hook.ts +4 -1
  155. package/scripts/run/run-prep-cli.ts +4 -1
  156. package/scripts/run/run-progress-args.ts +20 -4
  157. package/scripts/run/run-progress-cli.ts +31 -29
  158. package/scripts/run/run-progress-clock.ts +4 -1
  159. package/scripts/run/run-ship-cli.ts +8 -16
  160. package/scripts/run/run-ship-probe.ts +4 -1
  161. package/scripts/run/run-status-cli.ts +2 -15
  162. package/scripts/run/run-tidy-lanes.ts +4 -1
  163. package/scripts/run/run-wake-cli.ts +2 -10
  164. package/scripts/run/run-watcher-guard.ts +9 -5
  165. package/scripts/safe-chain/pack-hook.ts +92 -0
  166. package/scripts/sync/sync-ai-files.ts +4 -0
  167. package/scripts/test/test-declared-changed.ts +13 -16
  168. package/scripts/test/test-declared.ts +3 -7
  169. package/scripts/test/test-related.ts +1 -6
  170. package/scripts/test/test-unit-guard.ts +21 -7
  171. package/scripts/time-runtime/time-spans.ts +4 -0
  172. package/scripts/version/version-commands.ts +11 -1
  173. package/templates/CLAUDE.basic.md +6 -6
  174. package/templates/workflows/ci.yml +16 -82
  175. package/templates/workflows/dependabot-auto-merge.yml +1 -0
  176. package/templates/workflows/github-release.yml +14 -28
  177. package/tsconfig.sonar.json +4 -22
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  lane_guard_policy,
3
3
  time_batch_guard
4
- } from "./chunk-O4LL4HTI.js";
4
+ } from "./chunk-HANSKHES.js";
5
5
  import {
6
6
  hook_decision
7
- } from "./chunk-E54KGFEQ.js";
7
+ } from "./chunk-NFZGFGOR.js";
8
8
 
9
9
  // scripts/hooks/batch-guard.ts
10
10
  import { text } from "node:stream/consumers";
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  time_batch_guard
3
- } from "./chunk-O4LL4HTI.js";
3
+ } from "./chunk-HANSKHES.js";
4
4
  import {
5
5
  hook_decision
6
- } from "./chunk-E54KGFEQ.js";
6
+ } from "./chunk-NFZGFGOR.js";
7
7
  import {
8
8
  cost_blocks,
9
9
  cost_transcript,
10
10
  time_bundle_call,
11
11
  time_shell,
12
12
  time_spans
13
- } from "./chunk-NKOG3XAV.js";
13
+ } from "./chunk-GDU26K3J.js";
14
14
 
15
15
  // scripts/delegation/investigation-reads.ts
16
16
  import path from "node:path";
@@ -19,6 +19,7 @@ import path from "node:path";
19
19
  var DELEGATE_VERDICT = "delegate";
20
20
  var KEEP_VERDICT = "keep";
21
21
  var INVESTIGATION_FILE_THRESHOLD = 3;
22
+ var INVESTIGATION_SEARCH_TURN_THRESHOLD = 3;
22
23
  var DELEGATABLE_STEPS = [
23
24
  {
24
25
  name: "gate-fix",
@@ -68,7 +69,7 @@ var DELEGATABLE_STEPS = [
68
69
  // verifiers differ, so widening `survey` would put both in one field and lose the boundary below.
69
70
  // **No ordinal.** `${N}rd` would print `1rd` for any other threshold, past a test that only looks
70
71
  // for the numeral, so the count is phrased as a plain "N or more".
71
- does: `read the Issue's subject to find out how it currently works \u2014 once ${String(INVESTIGATION_FILE_THRESHOLD)} or more files the run will not edit have to be read \u2014 and return the conclusion plus the \`file:line\` citations that support it, never the file text, which would put the cost back where it was. A throwaway probe script is written, run and deleted inside the unit, which returns its output alone`,
72
+ does: `read the Issue's subject to find out how it currently works \u2014 once ${String(INVESTIGATION_FILE_THRESHOLD)} or more files the run will not edit have to be read, or ${String(INVESTIGATION_SEARCH_TURN_THRESHOLD)} or more search turns run without an edit \u2014 and return the conclusion plus the \`file:line\` citations that support it, never the file text, which would put the cost back where it was. A throwaway probe script is written, run and deleted inside the unit, which returns its output alone`,
72
73
  verifier: "the parent opens the cited lines; a conclusion those lines do not support fails there, and reading a handful of cited regions costs far less than redoing the reading. The unit reports what the code does and never what to change \u2014 deciding that is `diagnosis`, which stays kept, so a unit returning a root cause would be delegating the rejected row under this name"
73
74
  },
74
75
  {
@@ -131,6 +132,7 @@ function reason_for(name) {
131
132
  var delegation_policy = {
132
133
  DELEGATE_VERDICT,
133
134
  INVESTIGATION_FILE_THRESHOLD,
135
+ INVESTIGATION_SEARCH_TURN_THRESHOLD,
134
136
  KEEP_VERDICT,
135
137
  DELEGATABLE_STEPS,
136
138
  REJECTED_STEPS,
@@ -155,7 +157,12 @@ var CONTENT_READ_COMMANDS = [
155
157
  var CONTENT_READ_LABELS = new Set(
156
158
  CONTENT_READ_COMMANDS.map((command) => time_shell.bash_label(command))
157
159
  );
158
- var REASON = `\u26D4 investigation: ${String(delegation_policy.INVESTIGATION_FILE_THRESHOLD)} files read and not edited since the last delegated unit, so the reading from here goes to a unit of its own. Ask \`pnpm josh delegate investigation\`, then brief a unit with what the main line has already concluded and what is left to find out; it returns the conclusion plus its \`file:line\` citations, never the file text. Keep a read in the main line only where this run will edit that file \u2014 an \`Edit\` cannot be issued against text you do not hold. This run's own instructions and the harness's own session files \u2014 a backgrounded call's output, a persisted tool result, this session's scratchpad \u2014 are never counted, so they are not what took the count here. The rule is \`.claude/skills/workflow-commands/SKILL.md\` \u2192 \xA72b, "The pre-implementation reading".`;
160
+ var SEARCH_COMMANDS = ["fd", "find", "grep", "rg"];
161
+ var SEARCH_LABELS = new Set(
162
+ SEARCH_COMMANDS.map((command) => time_shell.bash_label(command))
163
+ );
164
+ var INVESTIGATOR_AGENT = "investigator";
165
+ var REASON = `\u26D4 investigation: ${String(delegation_policy.INVESTIGATION_FILE_THRESHOLD)} files read and not edited, or ${String(delegation_policy.INVESTIGATION_SEARCH_TURN_THRESHOLD)} search turns, since the last delegated unit, so the reading from here goes to a unit of its own (a successful write also starts the search count over). Ask \`pnpm josh delegate investigation\`, then dispatch the \`${INVESTIGATOR_AGENT}\` agent (\`kit:${INVESTIGATOR_AGENT}\` in a consumer) with a brief of what the main line has already concluded and what is left to find out; it returns the conclusion plus its \`file:line\` citations, never the file text. Keep a read in the main line only where this run will edit that file \u2014 an \`Edit\` cannot be issued against text you do not hold. This run's own instructions and the harness's own session files \u2014 a backgrounded call's output, a persisted tool result, this session's scratchpad \u2014 never count toward the files, so they are not what took the file count here; every read-only search turn counts, whatever it names. The rule is \`.claude/skills/workflow-commands/SKILL.md\` \u2192 \xA72b, "The pre-implementation reading".`;
159
166
  var INSTRUCTION_PATHS = ["prompts", ".claude/skills"];
160
167
  var INSTRUCTION_FILES = /* @__PURE__ */ new Set(["CLAUDE.md", "AGENTS.md", "GEMINI.md"]);
161
168
  var REPOSITORY_ROOT = process.cwd();
@@ -219,14 +226,32 @@ function edited_files(spans) {
219
226
  function add_all(pending, targets, at_ms) {
220
227
  for (const target of targets) if (!pending.has(target)) pending.set(target, at_ms);
221
228
  }
222
- function apply_span(pending, span, edited) {
229
+ function is_read_only_search(span) {
230
+ return SEARCH_LABELS.has(span.label) && span.is_bundleable && !span.may_write;
231
+ }
232
+ function search_turn_key(searches, span) {
233
+ if (span.message_id !== time_spans.NO_MESSAGE_ID) return span.message_id;
234
+ return `${time_spans.NO_MESSAGE_ID}#${String(searches.size)}`;
235
+ }
236
+ function apply_search(searches, span) {
237
+ if (span.is_writing) {
238
+ searches.clear();
239
+ return;
240
+ }
241
+ const turn = search_turn_key(searches, span);
242
+ if (is_read_only_search(span) && !searches.has(turn)) searches.set(turn, span.ended_ms);
243
+ }
244
+ function apply_span(accumulation, span, edited) {
223
245
  if (DELEGATION_TOOLS.has(span.label)) {
224
- pending.clear();
246
+ accumulation.pending.clear();
247
+ accumulation.searches.clear();
225
248
  return;
226
249
  }
227
- if (!is_content_read(span.label) || is_failed_outcome(span)) return;
250
+ if (is_failed_outcome(span)) return;
251
+ apply_search(accumulation.searches, span);
252
+ if (!is_content_read(span.label)) return;
228
253
  const fresh = subject_targets(span.targets).filter((target) => !edited.has(target));
229
- add_all(pending, fresh, span.ended_ms);
254
+ add_all(accumulation.pending, fresh, span.ended_ms);
230
255
  }
231
256
  function last_delegation_ms(spans) {
232
257
  return delegation_instant(spans.findLast((span) => DELEGATION_TOOLS.has(span.label)));
@@ -237,13 +262,15 @@ function pending_after(pending, since_ms) {
237
262
  function tally_of(text, since_ms = hook_decision.NEVER_MS) {
238
263
  const { spans, started_ms } = time_spans.parse_timeline(text);
239
264
  const edited = edited_files(spans);
240
- const pending = /* @__PURE__ */ new Map();
241
- for (const span of spans) apply_span(pending, span, edited);
265
+ const accumulation = { pending: /* @__PURE__ */ new Map(), searches: /* @__PURE__ */ new Map() };
266
+ for (const span of spans) apply_span(accumulation, span, edited);
242
267
  return {
243
- pending: [...pending.keys()],
244
- pending_since: pending_after(pending, since_ms),
268
+ pending: [...accumulation.pending.keys()],
269
+ pending_since: pending_after(accumulation.pending, since_ms),
245
270
  reset_ms: last_delegation_ms(spans),
246
271
  window_start_ms: started_ms,
272
+ searches: accumulation.searches.size,
273
+ searches_since: pending_after(accumulation.searches, since_ms),
247
274
  edited
248
275
  };
249
276
  }
@@ -253,6 +280,9 @@ function projected_count(pending, call, edited = /* @__PURE__ */ new Set()) {
253
280
  function is_at_threshold(pending_count) {
254
281
  return pending_count + 1 >= delegation_policy.INVESTIGATION_FILE_THRESHOLD;
255
282
  }
283
+ function is_at_search_threshold(search_count) {
284
+ return search_count + 1 >= delegation_policy.INVESTIGATION_SEARCH_TURN_THRESHOLD;
285
+ }
256
286
  function has_cleared_the_disarm(tally, refused_at_ms) {
257
287
  return tally.reset_ms > refused_at_ms || refused_at_ms < tally.window_start_ms;
258
288
  }
@@ -260,7 +290,7 @@ function is_rearmed(tally, refused_at_ms) {
260
290
  if (refused_at_ms === hook_decision.NEVER_MS || has_cleared_the_disarm(tally, refused_at_ms)) {
261
291
  return true;
262
292
  }
263
- return is_at_threshold(tally.pending_since);
293
+ return is_at_threshold(tally.pending_since) || is_at_search_threshold(tally.searches_since);
264
294
  }
265
295
  function is_unit_transcript(transcript) {
266
296
  return transcript.split(path.sep).includes(cost_transcript.UNIT_DIRECTORY);
@@ -268,22 +298,32 @@ function is_unit_transcript(transcript) {
268
298
  function is_unit_run(run) {
269
299
  return run !== void 0 && is_unit_transcript(run.transcript);
270
300
  }
271
- function is_refusable_command(call) {
301
+ function is_read_only_command(call, labels) {
302
+ if (call.name !== cost_blocks.BASH_TOOL) return false;
272
303
  const label = time_shell.bash_label(time_shell.bash_command(call.input));
273
- return CONTENT_READ_LABELS.has(label) && time_batch_guard.is_read_only_call(call);
304
+ return labels.has(label) && time_batch_guard.is_read_only_call(call);
305
+ }
306
+ function is_search_call(call) {
307
+ return is_read_only_command(call, SEARCH_LABELS);
274
308
  }
275
309
  function is_refusable_call(call) {
310
+ if (is_search_call(call)) return true;
276
311
  if (call_targets(call).length === 0) return false;
277
312
  if (READ_TOOLS.has(call.name)) return true;
278
- return call.name === cost_blocks.BASH_TOOL && is_refusable_command(call);
313
+ return is_read_only_command(call, CONTENT_READ_LABELS);
314
+ }
315
+ function is_growing_past_threshold(tally, call) {
316
+ if (is_search_call(call)) return is_at_search_threshold(tally.searches);
317
+ if (!is_at_threshold(tally.pending.length)) return false;
318
+ return projected_count(tally.pending, call, tally.edited) > tally.pending.length;
279
319
  }
280
320
  function should_block(text, call, refused_at_ms, run) {
281
321
  if (!is_refusable_call(call) || is_unit_run(run)) return false;
282
322
  const tally = tally_of(text, refused_at_ms);
283
- if (!is_at_threshold(tally.pending.length)) return false;
284
- return projected_count(tally.pending, call, tally.edited) > tally.pending.length && is_rearmed(tally, refused_at_ms);
323
+ return is_growing_past_threshold(tally, call) && is_rearmed(tally, refused_at_ms);
285
324
  }
286
325
  var investigation_reads = {
326
+ INVESTIGATOR_AGENT,
287
327
  READ_TOOLS,
288
328
  REASON,
289
329
  is_at_threshold,
@@ -3,7 +3,7 @@ import {
3
3
  stamp_file,
4
4
  time_density_hook,
5
5
  time_hook_transcript
6
- } from "./chunk-NKOG3XAV.js";
6
+ } from "./chunk-GDU26K3J.js";
7
7
  import {
8
8
  josh_environment_file
9
9
  } from "./chunk-WPALEIRX.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  investigation_reads
3
- } from "./chunk-7ZPFAVR7.js";
3
+ } from "./chunk-LJBLGHEH.js";
4
4
  import {
5
5
  lane_guard_policy
6
- } from "./chunk-O4LL4HTI.js";
6
+ } from "./chunk-HANSKHES.js";
7
7
  import {
8
8
  hook_decision
9
- } from "./chunk-E54KGFEQ.js";
9
+ } from "./chunk-NFZGFGOR.js";
10
10
 
11
11
  // scripts/delegation/investigation-guard.ts
12
12
  import { text } from "node:stream/consumers";
@@ -25,7 +25,7 @@ function should_notify(tail, call, notified_at_ms, run) {
25
25
  if (investigation_mode() !== "notice") return false;
26
26
  return investigation_reads.should_block(tail, call, notified_at_ms, run);
27
27
  }
28
- var NOTICE = `\u{1F4A1} investigation: files read and not edited since the last delegated unit reached the threshold, so the reading from here should go to a unit of its own. This is a notice, not a refusal \u2014 the read proceeds, because a dispatched lane child ends its turn on a denial. Ask \`pnpm josh delegate investigation\`, then brief a unit with what the main line has already concluded and what is left to find out; it returns the conclusion plus its \`file:line\` citations, never the file text. Keep a read in the main line only where this run will edit that file. This recurs on the next accumulation.`;
28
+ var NOTICE = `\u{1F4A1} investigation: files read and not edited, or search turns, since the last delegated unit reached the threshold, so the reading from here should go to a unit of its own. This is a notice, not a refusal \u2014 the read proceeds, because a dispatched lane child ends its turn on a denial. Ask \`pnpm josh delegate investigation\`, then dispatch the \`${investigation_reads.INVESTIGATOR_AGENT}\` agent (\`kit:${investigation_reads.INVESTIGATOR_AGENT}\` in a consumer) with a brief of what the main line has already concluded and what is left to find out; it returns the conclusion plus its \`file:line\` citations, never the file text. Keep a read in the main line only where this run will edit that file. This recurs on the next accumulation.`;
29
29
  function notice_text(_call, tail) {
30
30
  const pending = investigation_reads.tally_of(tail).pending.map((absolute) => investigation_reads.repository_relative(absolute));
31
31
  return pending.length === 0 ? NOTICE : `${NOTICE} Read and not edited so far: ${pending.join(" ")}.`;
@@ -1,68 +1,33 @@
1
1
  #!/usr/bin/env tsx
2
2
  import {
3
3
  pretool_guard
4
- } from "./chunk-M2XDCUKD.js";
5
- import "./chunk-UD24EAIL.js";
4
+ } from "./chunk-KBXZLMRH.js";
5
+ import {
6
+ bounded_pool
7
+ } from "./chunk-JKKTVDAG.js";
6
8
  import {
7
9
  build_envelope,
8
10
  compose_context,
9
11
  format_edited_payload
10
- } from "./chunk-OIZUHPJI.js";
12
+ } from "./chunk-FO2I7UT7.js";
11
13
  import "./chunk-3V37IID6.js";
12
- import "./chunk-IL27YTPH.js";
13
- import "./chunk-KHWHKJOM.js";
14
- import "./chunk-3C4YCCEF.js";
15
- import "./chunk-7ZPFAVR7.js";
16
- import "./chunk-O4LL4HTI.js";
14
+ import "./chunk-KOKOAV6D.js";
15
+ import "./chunk-RFWWUI5F.js";
16
+ import "./chunk-HBKZLITF.js";
17
+ import "./chunk-LJBLGHEH.js";
18
+ import "./chunk-HANSKHES.js";
17
19
  import {
18
20
  hook_decision
19
- } from "./chunk-E54KGFEQ.js";
21
+ } from "./chunk-NFZGFGOR.js";
20
22
  import {
21
23
  time_density_hook
22
- } from "./chunk-NKOG3XAV.js";
24
+ } from "./chunk-GDU26K3J.js";
23
25
  import "./chunk-WPALEIRX.js";
24
26
  import "./chunk-RKUAD3I6.js";
25
27
 
26
28
  // scripts/hooks/codex-hook-adapter.ts
27
29
  import { text } from "node:stream/consumers";
28
30
  import { fileURLToPath } from "node:url";
29
-
30
- // scripts/lib/bounded-pool.ts
31
- function pool_width(limit, total) {
32
- if (!Number.isFinite(limit)) return 1;
33
- return Math.max(1, Math.min(Math.floor(limit), total));
34
- }
35
- function throw_first_failure(failures) {
36
- if (failures.length === 0) return;
37
- const [first] = failures;
38
- throw first;
39
- }
40
- async function drain(pool, worker) {
41
- for (let entry = pool.queue.shift(); entry !== void 0 && pool.failures.length === 0; entry = pool.queue.shift()) {
42
- const [index, item] = entry;
43
- try {
44
- pool.results.push({ index, value: await worker(item, index) });
45
- } catch (error) {
46
- pool.failures.push(error);
47
- }
48
- }
49
- }
50
- async function bounded_map(items, limit, worker) {
51
- const pool = {
52
- failures: [],
53
- queue: items.map((item, index) => [index, item]),
54
- results: []
55
- };
56
- const consumers = Array.from({ length: pool_width(limit, items.length) }, async () => {
57
- await drain(pool, worker);
58
- });
59
- await Promise.all(consumers);
60
- throw_first_failure(pool.failures);
61
- return pool.results.toSorted((left, right) => left.index - right.index).map((result) => result.value);
62
- }
63
- var bounded_pool = { bounded_map, pool_width };
64
-
65
- // scripts/hooks/codex-hook-adapter.ts
66
31
  import { z } from "zod";
67
32
  var APPLY_PATCH_TOOL = "apply_patch";
68
33
  var EDIT_TOOL = "Edit";
@@ -9,11 +9,11 @@ import {
9
9
  is_enabled,
10
10
  notice_refusal_path,
11
11
  refusal_path
12
- } from "./chunk-3C4YCCEF.js";
13
- import "./chunk-7ZPFAVR7.js";
14
- import "./chunk-O4LL4HTI.js";
15
- import "./chunk-E54KGFEQ.js";
16
- import "./chunk-NKOG3XAV.js";
12
+ } from "./chunk-HBKZLITF.js";
13
+ import "./chunk-LJBLGHEH.js";
14
+ import "./chunk-HANSKHES.js";
15
+ import "./chunk-NFZGFGOR.js";
16
+ import "./chunk-GDU26K3J.js";
17
17
  import "./chunk-WPALEIRX.js";
18
18
  import "./chunk-RKUAD3I6.js";
19
19
  export {
@@ -2,9 +2,9 @@
2
2
  import {
3
3
  report_no_payload,
4
4
  run_hook
5
- } from "./chunk-OIZUHPJI.js";
5
+ } from "./chunk-FO2I7UT7.js";
6
6
  import "./chunk-3V37IID6.js";
7
- import "./chunk-NKOG3XAV.js";
7
+ import "./chunk-GDU26K3J.js";
8
8
  import "./chunk-RKUAD3I6.js";
9
9
 
10
10
  // scripts/hooks/format-edited-cli.ts