@joshuafolkken/kit 1.1050.0 → 1.1094.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 (581) hide show
  1. package/.claude/settings.json +9 -8
  2. package/.claude/skills/epic-commands/SKILL.md +5 -7
  3. package/.claude/skills/workflow-commands/SKILL.md +19 -11
  4. package/.claude/skills/workflow-commands/background-commands.md +4 -3
  5. package/.claude/skills/workflow-commands/backlogrun-child.md +1 -1
  6. package/.claude/skills/workflow-commands/backlogrun-lanes.md +8 -6
  7. package/.claude/skills/workflow-commands/backlogrun-progress.md +1 -1
  8. package/.claude/skills/workflow-commands/backlogrun-steps.md +10 -10
  9. package/.claude/skills/workflow-commands/backlogrun.md +2 -2
  10. package/.claude/skills/workflow-commands/chain-rule.md +4 -2
  11. package/.claude/skills/workflow-commands/delegation.md +3 -3
  12. package/.claude/skills/workflow-commands/followup-reference.md +1 -1
  13. package/.claude/skills/workflow-commands/followup.md +7 -3
  14. package/.claude/skills/workflow-commands/fullrun-steps.md +3 -2
  15. package/.claude/skills/workflow-commands/fullrun.md +3 -2
  16. package/.claude/skills/workflow-commands/halfrun.md +16 -19
  17. package/.claude/skills/workflow-commands/issue-comments.md +1 -1
  18. package/.claude/skills/workflow-commands/issue-fold-existing.md +10 -10
  19. package/.claude/skills/workflow-commands/issue-scout.md +1 -1
  20. package/.claude/skills/workflow-commands/kickoff.md +9 -4
  21. package/.claude/skills/workflow-commands/latest-gate.md +1 -1
  22. package/.claude/skills/workflow-commands/needs-human-review.md +1 -1
  23. package/.claude/skills/workflow-commands/observation-filing.md +3 -3
  24. package/.claude/skills/workflow-commands/prerequisite.md +1 -1
  25. package/.claude/skills/workflow-commands/prrun.md +36 -0
  26. package/.claude/skills/workflow-commands/retrospective.md +1 -1
  27. package/.claude/skills/workflow-commands/working-tree-hold.md +22 -2
  28. package/.codex/hooks.json +16 -20
  29. package/.github/actions/setup-pnpm/action.yml +93 -0
  30. package/.github/dependabot.yml +5 -1
  31. package/.github/workflows/ci.yml +26 -128
  32. package/.github/workflows/pr-classification.yml +5 -41
  33. package/.github/workflows/publish.yml +33 -38
  34. package/.github/workflows/sonar-qube.yml +37 -4
  35. package/AGENTS.md +12 -2
  36. package/CLAUDE.md +15 -16
  37. package/GEMINI.md +14 -2
  38. package/README.md +59 -18
  39. package/SECURITY.md +36 -6
  40. package/cspell/index.yaml +2 -1
  41. package/dist/CLAUDE.md +15 -16
  42. package/dist/config-merge/index.js +15 -3
  43. package/dist/hooks/batch-guard.js +4 -4
  44. package/dist/hooks/{chunk-HJIISEAC.js → chunk-3C4YCCEF.js} +5 -13
  45. package/dist/hooks/{chunk-EJDX2TOB.js → chunk-7ZPFAVR7.js} +7 -88
  46. package/dist/hooks/{chunk-WQ4OSBSS.js → chunk-E54KGFEQ.js} +2 -2
  47. package/dist/hooks/{chunk-GQ7KP45M.js → chunk-IL27YTPH.js} +2 -2
  48. package/dist/hooks/{chunk-DMQN45FN.js → chunk-KHWHKJOM.js} +3 -3
  49. package/dist/hooks/{chunk-5BK3K7V4.js → chunk-M2XDCUKD.js} +997 -478
  50. package/dist/hooks/{chunk-7VPDUBRN.js → chunk-NKOG3XAV.js} +150 -153
  51. package/dist/hooks/{chunk-NJQOBE6L.js → chunk-O4LL4HTI.js} +2 -7
  52. package/dist/hooks/{chunk-NAS4C7GP.js → chunk-OIZUHPJI.js} +2 -2
  53. package/dist/hooks/{chunk-RLDX5SOC.js → chunk-UD24EAIL.js} +2084 -1412
  54. package/dist/hooks/codex-hook-adapter.js +10 -11
  55. package/dist/hooks/duplicate-read-guard.js +5 -5
  56. package/dist/hooks/format-edited.js +2 -2
  57. package/dist/hooks/inputs.json +279 -0
  58. package/dist/hooks/investigation-guard.js +5 -5
  59. package/dist/hooks/pretool-guard.js +9 -9
  60. package/dist/hooks/session-lang.js +0 -1
  61. package/dist/hooks/stop-guard.js +178 -324
  62. package/dist/josh.js +162 -119
  63. package/dist/managed-marker/index.js +2 -1
  64. package/dist/version/index.js +34 -58
  65. package/eslint/rules/promise.js +5 -0
  66. package/package.json +9 -4
  67. package/prompts/collaboration-workflow/issue-citation.md +5 -5
  68. package/prompts/collaboration-workflow/operating-rules.md +4 -4
  69. package/prompts/collaboration-workflow/overview.md +13 -1
  70. package/prompts/collaboration-workflow/report-format.md +1 -1
  71. package/prompts/collaboration-workflow/residency.md +3 -3
  72. package/prompts/collaboration-workflow/rule-delivery.md +1 -1
  73. package/prompts/collaboration-workflow/turn-batching.md +3 -3
  74. package/prompts/collaboration-workflow/upstream-interrupt.md +1 -1
  75. package/prompts/collaboration-workflow/wip-cap.md +25 -22
  76. package/prompts/collaboration-workflow.md +5 -8
  77. package/prompts/review-rubric.md +1 -1
  78. package/prompts/review.md +3 -3
  79. package/prompts/sonar-hotspot-handling.md +11 -3
  80. package/prompts/testing-guide.md +3 -3
  81. package/scripts/adopt/adopt-toolkits.ts +0 -2
  82. package/scripts/adopt/adopt.ts +0 -2
  83. package/scripts/agent/agent-argv.ts +0 -2
  84. package/scripts/agent/agent-diagnostics.ts +1 -1
  85. package/scripts/agent/agent-role-profile.ts +0 -7
  86. package/scripts/agent/claude-agent-argv.ts +0 -2
  87. package/scripts/agent/codex-agent-argv.ts +1 -1
  88. package/scripts/agent/codex-hooks.ts +92 -0
  89. package/scripts/agent/interactive-ask.ts +1 -1
  90. package/scripts/auto-ok/auto-ok-cli.ts +6 -16
  91. package/scripts/backlog/backlog-budget.ts +0 -2
  92. package/scripts/backlog/backlog-defect-priority.ts +2 -2
  93. package/scripts/backlog/backlog-drive-cli.ts +10 -8
  94. package/scripts/backlog/backlog-drive-named-offer.ts +16 -3
  95. package/scripts/backlog/backlog-drive-named.ts +2 -1
  96. package/scripts/backlog/backlog-drive.ts +76 -16
  97. package/scripts/backlog/backlog-named.ts +0 -3
  98. package/scripts/backlog/backlog-next.ts +9 -15
  99. package/scripts/backlog/backlog-offer-cli.ts +0 -5
  100. package/scripts/backlog/backlog-plan-cli.ts +1 -7
  101. package/scripts/backlog/backlog-plan.ts +1 -1
  102. package/scripts/backlog/backlog-pool.ts +3 -6
  103. package/scripts/backlog/backlog-rank.ts +2 -2
  104. package/scripts/backlog/backlog-ready.ts +19 -3
  105. package/scripts/backlog/backlog-scope.ts +1 -3
  106. package/scripts/backlog/backlog-stalled-detect.ts +2 -2
  107. package/scripts/backlog/backlog-stalled.ts +0 -1
  108. package/scripts/backlog/backlog-waves.ts +5 -2
  109. package/scripts/behavior/behavior-cli.ts +1 -1
  110. package/scripts/build/build-codex-hooks.ts +26 -0
  111. package/scripts/build/build-hooks.ts +85 -9
  112. package/scripts/build/hook-bundle-stamp.ts +111 -0
  113. package/scripts/cases/cases-cli.ts +1 -1
  114. package/scripts/cases/cases-logic.ts +1 -1
  115. package/scripts/ci/composite-actions.ts +30 -0
  116. package/scripts/ci/pr-classification.ts +3 -3
  117. package/scripts/claude/workflow-destination.ts +10 -1
  118. package/scripts/clone/clone-fingerprint.ts +0 -1
  119. package/scripts/clone/clone-scan-cli.ts +1 -1
  120. package/scripts/clone/clone-scan.ts +1 -1
  121. package/scripts/config-merge/json-format.ts +0 -1
  122. package/scripts/config-merge/patch-yaml-list.ts +1 -1
  123. package/scripts/cost-runtime/codex-usage.ts +2 -9
  124. package/scripts/cost-runtime/cost-attribute.ts +0 -1
  125. package/scripts/cost-runtime/cost-cli.ts +0 -3
  126. package/scripts/cost-runtime/cost-corpus.ts +0 -2
  127. package/scripts/cost-runtime/cost-format.ts +0 -3
  128. package/scripts/cost-runtime/cost-pricing.ts +0 -1
  129. package/scripts/cost-runtime/cost-tokens.ts +0 -1
  130. package/scripts/delegation/delegation-cli.ts +1 -1
  131. package/scripts/delegation/delegation-policy.ts +0 -1
  132. package/scripts/delegation/duplicate-read-guard.ts +0 -8
  133. package/scripts/delegation/fanout-cli.ts +1 -1
  134. package/scripts/delegation/fanout.ts +0 -2
  135. package/scripts/delegation/investigation-reads.ts +1 -164
  136. package/scripts/discovery/repo-map-logic.ts +0 -1
  137. package/scripts/discovery/repo-party-cli.ts +1 -1
  138. package/scripts/doctor/doctor-consumer.ts +4 -6
  139. package/scripts/doctor/doctor-logic.ts +0 -4
  140. package/scripts/doctor/doctor.ts +14 -9
  141. package/scripts/document/document-byte-budget.ts +4 -5
  142. package/scripts/document/document-byte-check.ts +0 -1
  143. package/scripts/document/document-read-cli.ts +0 -2
  144. package/scripts/document/document-section-cli.ts +1 -1
  145. package/scripts/document/document-section.ts +0 -3
  146. package/scripts/document/edit-files-cli.ts +0 -1
  147. package/scripts/document/entry-read-budget.ts +10 -2
  148. package/scripts/document/lane-child-read-set.ts +1 -6
  149. package/scripts/document/read-files-cli.ts +0 -4
  150. package/scripts/document/read-set-cli.ts +0 -2
  151. package/scripts/document/read-set-point-of-use.ts +1 -0
  152. package/scripts/document/read-set-pricing.ts +0 -1
  153. package/scripts/document/read-set-trim.ts +1 -1
  154. package/scripts/epic/epic-add.ts +1 -1
  155. package/scripts/epic/epic-audit-cli.ts +1 -4
  156. package/scripts/epic/epic-audit-orphans.ts +1 -3
  157. package/scripts/epic/epic-audit-rationale.ts +0 -1
  158. package/scripts/epic/epic-audit-report.ts +0 -2
  159. package/scripts/epic/epic-audit.ts +5 -4
  160. package/scripts/epic/epic-bundle-cli.ts +1 -1
  161. package/scripts/epic/epic-bundle-evidence.ts +0 -1
  162. package/scripts/epic/epic-bundle-referenced.ts +1 -5
  163. package/scripts/epic/epic-bundle.ts +0 -4
  164. package/scripts/epic/epic-busy.ts +4 -5
  165. package/scripts/epic/epic-candidate-confirm.ts +0 -5
  166. package/scripts/epic/epic-classify.ts +2 -2
  167. package/scripts/epic/epic-cli-argv.ts +0 -1
  168. package/scripts/epic/epic-close-comment.ts +1 -1
  169. package/scripts/epic/epic-close.ts +5 -2
  170. package/scripts/epic/epic-cross-repo.ts +2 -4
  171. package/scripts/epic/epic-decision.ts +0 -1
  172. package/scripts/epic/epic-fetch.ts +2 -2
  173. package/scripts/epic/epic-index.ts +2 -3
  174. package/scripts/epic/epic-issue.ts +1 -15
  175. package/scripts/epic/epic-lane-offer.ts +9 -8
  176. package/scripts/epic/epic-nested.ts +1 -1
  177. package/scripts/epic/epic-next-read.ts +1 -3
  178. package/scripts/epic/epic-next-views.ts +0 -1
  179. package/scripts/epic/epic-next.ts +1 -10
  180. package/scripts/epic/epic-parse.ts +0 -1
  181. package/scripts/epic/epic-promote.ts +0 -9
  182. package/scripts/epic/epic-rank.ts +2 -2
  183. package/scripts/epic/epic-read.ts +1 -2
  184. package/scripts/epic/epic-reconcile.ts +1 -1
  185. package/scripts/epic/epic-reference.ts +1 -13
  186. package/scripts/epic/epic-relation-recheck.ts +1 -1
  187. package/scripts/epic/epic-relations.ts +1 -1
  188. package/scripts/epic/epic-remove.ts +1 -1
  189. package/scripts/epic/epic-report.ts +0 -1
  190. package/scripts/epic/epic-run.ts +2 -3
  191. package/scripts/epic/epic-shape.ts +1 -1
  192. package/scripts/epic/epic-solo-stale.ts +107 -0
  193. package/scripts/epic/epic-solo.ts +3 -2
  194. package/scripts/epic/epic-triage.ts +1 -1
  195. package/scripts/epic/epic-validate.ts +1 -1
  196. package/scripts/epic/epic.ts +1 -1
  197. package/scripts/exports/unused-members-cli.ts +53 -0
  198. package/scripts/{git → followup}/followup-issue-number.ts +1 -6
  199. package/scripts/{git → followup}/git-followup-cleanup.ts +2 -1
  200. package/scripts/{git → followup}/git-followup-finish.ts +1 -3
  201. package/scripts/{git → followup}/git-followup-flush.ts +2 -2
  202. package/scripts/{git → followup}/git-followup-issue-close.ts +2 -2
  203. package/scripts/{git → followup}/git-followup-label.ts +4 -4
  204. package/scripts/followup/git-followup-merged.ts +112 -0
  205. package/scripts/{git → followup}/git-followup-pending.ts +1 -1
  206. package/scripts/{git → followup}/git-followup-workflow.ts +19 -11
  207. package/scripts/{git → followup}/git-pr-followup-wrapup.ts +9 -3
  208. package/scripts/{git → followup}/git-pr-followup.ts +53 -16
  209. package/scripts/gate/core-budget.ts +3 -9
  210. package/scripts/gate/gate-plan.ts +7 -4
  211. package/scripts/gate/gate-report.ts +0 -6
  212. package/scripts/gate/gate-tree.ts +1 -1
  213. package/scripts/gate/pre-commit-type-check.ts +0 -6
  214. package/scripts/gate/project-checks.ts +7 -8
  215. package/scripts/gate/scoped-green.ts +0 -1
  216. package/scripts/gate/type-check-step.ts +1 -1
  217. package/scripts/gate/verification-gate.ts +0 -2
  218. package/scripts/gh/fix-gh-packages.ts +15 -12
  219. package/scripts/gh/gh-spawn.ts +2 -2
  220. package/scripts/{git → gh}/git-ai-review-scan.ts +1 -5
  221. package/scripts/{git → gh}/git-gh-check.ts +2 -1
  222. package/scripts/{git → gh}/git-gh-exec.ts +1 -1
  223. package/scripts/{git → gh}/git-gh-failure.ts +1 -1
  224. package/scripts/{git → gh}/git-gh-helpers.ts +0 -1
  225. package/scripts/{git → gh}/git-gh-issue-list.ts +2 -0
  226. package/scripts/{git → gh}/git-gh-issue-read.ts +1 -1
  227. package/scripts/{git → gh}/git-gh-issue-rest.ts +6 -3
  228. package/scripts/{git → gh}/git-gh-pr-read.ts +24 -0
  229. package/scripts/{git → gh}/git-gh-pr-rest.ts +5 -2
  230. package/scripts/{git → gh}/git-gh-pr-review.ts +2 -2
  231. package/scripts/{git → gh}/git-gh-pr-rollup.ts +1 -3
  232. package/scripts/{git → gh}/git-gh-pr.ts +3 -1
  233. package/scripts/{git → gh}/git-pr-ai-review.ts +2 -5
  234. package/scripts/{git → gh}/git-pr-checks-eval.ts +0 -10
  235. package/scripts/{git → gh}/git-pr-checks-parse.ts +4 -20
  236. package/scripts/{git → gh}/git-pr-checks.ts +2 -1
  237. package/scripts/{git → gh}/git-pr-coderabbit.ts +2 -5
  238. package/scripts/{git → gh}/git-pr-confirmation.ts +1 -3
  239. package/scripts/{git → gh}/git-pr-managed-config.ts +2 -3
  240. package/scripts/{git → gh}/git-pr.ts +3 -3
  241. package/scripts/git/changed-file-scope.ts +0 -1
  242. package/scripts/git/git-branch.ts +3 -6
  243. package/scripts/git/git-commit.ts +1 -1
  244. package/scripts/git/git-common-directory.ts +80 -24
  245. package/scripts/git/git-error.ts +66 -9
  246. package/scripts/git/git-issue.ts +1 -1
  247. package/scripts/git/git-preflight.ts +2 -2
  248. package/scripts/git/git-prompt.ts +6 -31
  249. package/scripts/git/git-push.ts +1 -1
  250. package/scripts/git/git-staging.ts +1 -0
  251. package/scripts/git/git-status.ts +1 -1
  252. package/scripts/git/git-workflow.ts +1 -1
  253. package/scripts/git/gone-branch.ts +1 -0
  254. package/scripts/git/listing-cutoff.ts +1 -1
  255. package/scripts/git/main-merge.ts +1 -1
  256. package/scripts/git/main-sync.ts +19 -1
  257. package/scripts/git/parse-json-array.ts +0 -3
  258. package/scripts/git/repository-lock.ts +16 -16
  259. package/scripts/git/{git-stash.ts → stash/git-stash.ts} +1 -1
  260. package/scripts/git/{stash-pop-args.ts → stash/stash-pop-args.ts} +1 -1
  261. package/scripts/git/{stash-pop-cli.ts → stash/stash-pop-cli.ts} +0 -1
  262. package/scripts/git/{stash-sweep-lock.ts → stash/stash-sweep-lock.ts} +3 -3
  263. package/scripts/hooks/codex-hook-adapter.ts +0 -1
  264. package/scripts/hooks/edited-cspell.ts +1 -1
  265. package/scripts/hooks/format-edited-file.ts +2 -0
  266. package/scripts/hooks/pre-push-unit.ts +0 -4
  267. package/scripts/hooks/pretool-guard.ts +22 -4
  268. package/scripts/hooks/reserved-run.ts +1 -1
  269. package/scripts/hooks/step-zero-notice.ts +76 -0
  270. package/scripts/hooks/stop-guard.ts +47 -21
  271. package/scripts/init/claude-plugin-config.ts +4 -5
  272. package/scripts/init/hook-command-rewrite.ts +16 -8
  273. package/scripts/init/hook-launch.ts +41 -15
  274. package/scripts/init/init-basic.ts +2 -5
  275. package/scripts/init/init-logic.ts +7 -0
  276. package/scripts/init/init.ts +0 -3
  277. package/scripts/init/project-profile.ts +6 -11
  278. package/scripts/init/start-exec.ts +1 -1
  279. package/scripts/init/start-setup-pr.ts +6 -6
  280. package/scripts/init/start-steps.ts +1 -0
  281. package/scripts/issue/behavior-change-lint.ts +0 -1
  282. package/scripts/issue/defect-rate-cli.ts +3 -3
  283. package/scripts/issue/defect-rate.ts +1 -2
  284. package/scripts/{git → issue}/git-next-issues.ts +3 -3
  285. package/scripts/issue/issue-backlinks-cli.ts +1 -5
  286. package/scripts/issue/issue-cite-cli.ts +2 -6
  287. package/scripts/issue/issue-cite.ts +0 -2
  288. package/scripts/issue/issue-classification.ts +1 -9
  289. package/scripts/issue/issue-closing-pr.ts +4 -4
  290. package/scripts/issue/issue-comment-cli.ts +2 -2
  291. package/scripts/issue/issue-file-cli.ts +5 -5
  292. package/scripts/issue/issue-file.ts +2 -2
  293. package/scripts/issue/issue-fold-cli.ts +1 -1
  294. package/scripts/issue/issue-fold-existing-cli.ts +1 -1
  295. package/scripts/{git → issue}/issue-labels.ts +8 -0
  296. package/scripts/issue/issue-lint-cli.ts +1 -1
  297. package/scripts/issue/issue-merged.ts +2 -2
  298. package/scripts/{git → issue}/issue-rank.ts +1 -1
  299. package/scripts/issue/issue-read-cli.ts +8 -47
  300. package/scripts/issue/issue-read.ts +0 -2
  301. package/scripts/issue/issue-report-failures.ts +80 -0
  302. package/scripts/issue/issue-scout-cli.ts +1 -7
  303. package/scripts/issue/issue-scout-closed.ts +2 -2
  304. package/scripts/issue/issue-scout.ts +0 -2
  305. package/scripts/issue/issue-state-cli.ts +5 -46
  306. package/scripts/issue/issue-state.ts +1 -5
  307. package/scripts/issue/markdown-section.ts +1 -1
  308. package/scripts/issue/measure-rerun-cli.ts +1 -1
  309. package/scripts/issue/reproduction-measure.ts +1 -1
  310. package/scripts/josh/cli-body.ts +1 -1
  311. package/scripts/josh/file-map-stamp.ts +0 -3
  312. package/scripts/josh/josh-command-map.ts +2 -0
  313. package/scripts/josh/josh-commands-ai.ts +9 -102
  314. package/scripts/josh/josh-commands-backlog.ts +5 -1
  315. package/scripts/josh/josh-commands-development.ts +8 -1
  316. package/scripts/josh/josh-commands-issue.ts +2 -2
  317. package/scripts/josh/josh-commands-maintenance.ts +7 -0
  318. package/scripts/josh/josh-commands-project.ts +6 -0
  319. package/scripts/josh/josh-commands-run.ts +114 -0
  320. package/scripts/josh/josh-commands-versioning.ts +8 -0
  321. package/scripts/josh/josh-commands-workflow.ts +2 -2
  322. package/scripts/josh/path-decision.ts +0 -3
  323. package/scripts/josh/process-owner.ts +16 -0
  324. package/scripts/josh/session-language-cli.ts +0 -1
  325. package/scripts/lane/lane-await.ts +3 -6
  326. package/scripts/lane/lane-capacity.ts +6 -3
  327. package/scripts/lane/lane-child-invocation.ts +20 -7
  328. package/scripts/lane/lane-cli.ts +1 -4
  329. package/scripts/lane/lane-close.ts +1 -3
  330. package/scripts/lane/lane-dispatch.ts +3 -4
  331. package/scripts/lane/lane-environment.ts +0 -9
  332. package/scripts/lane/lane-handoff.ts +38 -0
  333. package/scripts/lane/lane-launch-cli.ts +21 -11
  334. package/scripts/lane/lane-open.ts +0 -3
  335. package/scripts/lane/lane-output.ts +0 -1
  336. package/scripts/lane/lane-registry.ts +9 -0
  337. package/scripts/lane/openai-lane-ship.ts +2 -0
  338. package/scripts/lane/openai-lane-supervisor-decision.ts +2 -1
  339. package/scripts/lane/openai-lane-supervisor.ts +6 -4
  340. package/scripts/lane/openai-review-broker.ts +3 -0
  341. package/scripts/lib/bounded-pool.ts +1 -0
  342. package/scripts/lib/json-value.ts +5 -4
  343. package/scripts/lib/poll.ts +3 -1
  344. package/scripts/lib/timed-fetch.ts +15 -0
  345. package/scripts/lib/timeouts.ts +13 -0
  346. package/scripts/{yaml → lib}/yaml-document.ts +3 -1
  347. package/scripts/{bytes → lines}/bytes-command.ts +0 -2
  348. package/scripts/lines/lines-command.ts +0 -1
  349. package/scripts/lint/lint-related-scope.ts +0 -1
  350. package/scripts/lint/lint-related.ts +1 -1
  351. package/scripts/{git → notify}/telegram-notify.ts +2 -2
  352. package/scripts/{git → notify}/telegram-test.ts +4 -4
  353. package/scripts/observations/observation-ledger-home.ts +0 -1
  354. package/scripts/observations/observation-ledger-line.ts +0 -1
  355. package/scripts/observations/observation-ledger-migrate.ts +1 -1
  356. package/scripts/observations/observations-flush-landing.ts +3 -3
  357. package/scripts/observations/observations-flush.ts +2 -2
  358. package/scripts/overrides/lockfile-overrides.ts +1 -1
  359. package/scripts/overrides/overrides-logic.ts +1 -1
  360. package/scripts/package/package-scout-cli.ts +2 -7
  361. package/scripts/package/package-scout.ts +0 -2
  362. package/scripts/propagate/propagate-git-failure.ts +0 -1
  363. package/scripts/propagate/propagate-git.ts +0 -2
  364. package/scripts/propagate/propagate-publish.ts +2 -3
  365. package/scripts/propagate/propagate-run.ts +0 -2
  366. package/scripts/propagate/propagate-steps.ts +3 -5
  367. package/scripts/propagate/propagate-targets.ts +0 -4
  368. package/scripts/propagate/propagate.ts +0 -4
  369. package/scripts/refactor/import-graph.ts +0 -1
  370. package/scripts/refactor/refactor-lint.ts +0 -2
  371. package/scripts/refactor/refactor-scan.ts +0 -1
  372. package/scripts/refactor/refactor-targets.ts +0 -1
  373. package/scripts/registry-migration/migrate-logic.ts +0 -2
  374. package/scripts/registry-migration/migrate.ts +19 -9
  375. package/scripts/release/github-release-cli.ts +8 -6
  376. package/scripts/release/github-release-environment.ts +46 -0
  377. package/scripts/release/github-release.ts +151 -94
  378. package/scripts/release/release-history.ts +0 -1
  379. package/scripts/release/release-plan.ts +0 -1
  380. package/scripts/release/release-publish.ts +2 -3
  381. package/scripts/release/release-scope-cli.ts +1 -2
  382. package/scripts/release/release-tag.ts +2 -4
  383. package/scripts/repo/auto-merge-setting-logic.ts +1 -4
  384. package/scripts/repo/repo-setting.ts +1 -1
  385. package/scripts/repo/repository-labels.ts +3 -3
  386. package/scripts/repo/required-checks-logic.ts +206 -0
  387. package/scripts/repo/required-checks-report.ts +71 -0
  388. package/scripts/repo/ruleset-check-cli.ts +53 -0
  389. package/scripts/repo/ruleset-check.ts +147 -0
  390. package/scripts/report/report-lint-cli.ts +0 -4
  391. package/scripts/review/disposition-cli.ts +1 -1
  392. package/scripts/review/live-evidence.ts +1 -1
  393. package/scripts/review/review-attest-cli.ts +0 -6
  394. package/scripts/review/review-attest.ts +4 -16
  395. package/scripts/review/review-brief-cli.ts +23 -6
  396. package/scripts/review/review-brief.ts +21 -8
  397. package/scripts/review/review-diff-parts.ts +89 -0
  398. package/scripts/review/review-diff-write.ts +97 -0
  399. package/scripts/review/review-finding-ledger.ts +0 -1
  400. package/scripts/review/review-record-cli.ts +1 -1
  401. package/scripts/review/review-record.ts +0 -1
  402. package/scripts/review/review-round2-cli.ts +1 -1
  403. package/scripts/review/review-stamps.ts +0 -3
  404. package/scripts/review/review-tree.ts +14 -2
  405. package/scripts/rules/decision-oracle-stage.ts +18 -0
  406. package/scripts/rules/decision-oracle.ts +10 -7
  407. package/scripts/rules/delivered-rules.ts +9 -1
  408. package/scripts/rules/destructive-command.ts +119 -0
  409. package/scripts/rules/direct-filing.ts +1 -1
  410. package/scripts/rules/file-body.ts +0 -3
  411. package/scripts/rules/filing-cap.ts +0 -2
  412. package/scripts/rules/gh-api.ts +7 -2
  413. package/scripts/rules/git-argv.ts +18 -7
  414. package/scripts/rules/git-force.ts +0 -2
  415. package/scripts/rules/implementation-cut.ts +0 -1
  416. package/scripts/rules/index-guard.ts +71 -0
  417. package/scripts/rules/issue-citation.ts +50 -25
  418. package/scripts/rules/lane-background.ts +15 -7
  419. package/scripts/rules/lane-park.ts +13 -6
  420. package/scripts/rules/last-prompt.ts +1 -0
  421. package/scripts/rules/oracle-consulted.ts +1 -1
  422. package/scripts/rules/oracle-firing.ts +1 -0
  423. package/scripts/rules/oracle-list-cli.ts +0 -3
  424. package/scripts/rules/permission-guards.ts +14 -0
  425. package/scripts/rules/protected-files.ts +74 -0
  426. package/scripts/rules/reply-language.ts +1 -1
  427. package/scripts/rules/rule-body-guard.ts +0 -3
  428. package/scripts/rules/rule-value-cli.ts +0 -1
  429. package/scripts/rules/shell-body-trigger.ts +0 -1
  430. package/scripts/rules/shell-segments.ts +0 -1
  431. package/scripts/rules/stop-rules.ts +13 -5
  432. package/scripts/rules/tail-commands.ts +1 -1
  433. package/scripts/rules/test-declared-commit.ts +1 -1
  434. package/scripts/rules/third-party-write.ts +0 -1
  435. package/scripts/rules/worktree-guard.ts +26 -9
  436. package/scripts/run/run-carry-cli.ts +0 -2
  437. package/scripts/run/run-carry-stash.ts +2 -2
  438. package/scripts/run/run-carry-streak.ts +1 -1
  439. package/scripts/run/run-cut-cli.ts +0 -7
  440. package/scripts/run/run-cut.ts +8 -54
  441. package/scripts/run/run-ending-cli.ts +1 -1
  442. package/scripts/run/run-ending.ts +1 -4
  443. package/scripts/run/run-entry-cli.ts +101 -24
  444. package/scripts/run/run-entry.ts +0 -1
  445. package/scripts/run/run-event-cli.ts +0 -2
  446. package/scripts/run/run-event-follow.ts +1 -0
  447. package/scripts/run/run-event-render.ts +1 -1
  448. package/scripts/run/run-event-scope.ts +53 -4
  449. package/scripts/run/run-event-stream.ts +0 -3
  450. package/scripts/run/run-event-watch.ts +1 -0
  451. package/scripts/run/run-halfrun-resume.ts +20 -7
  452. package/scripts/run/run-headless.ts +2 -2
  453. package/scripts/run/run-hold-cli.ts +33 -10
  454. package/scripts/run/run-hold.ts +25 -5
  455. package/scripts/run/run-issue-number.ts +1 -1
  456. package/scripts/run/run-liveness-cli.ts +1 -1
  457. package/scripts/run/run-liveness.ts +2 -3
  458. package/scripts/run/run-merge-cli.ts +5 -13
  459. package/scripts/run/run-merge-steps.ts +5 -5
  460. package/scripts/run/run-merge.ts +1 -1
  461. package/scripts/run/run-next-cli.ts +1 -1
  462. package/scripts/run/run-parent-cut-hook.ts +0 -1
  463. package/scripts/run/run-preflight.ts +2 -9
  464. package/scripts/run/run-prep-cli.ts +2 -2
  465. package/scripts/run/run-prep-locate.ts +1 -1
  466. package/scripts/run/run-progress-cli.ts +4 -7
  467. package/scripts/run/run-progress-clock.ts +6 -34
  468. package/scripts/run/run-progress-config.ts +0 -4
  469. package/scripts/run/run-progress-read.ts +1 -2
  470. package/scripts/run/run-progress.ts +1 -2
  471. package/scripts/run/run-prrun-resume.ts +117 -0
  472. package/scripts/run/run-report-cli.ts +1 -2
  473. package/scripts/run/run-report.ts +0 -1
  474. package/scripts/run/run-retrospective.ts +1 -1
  475. package/scripts/run/run-review-cli.ts +0 -3
  476. package/scripts/run/run-review-steps.ts +2 -0
  477. package/scripts/run/run-review.ts +0 -2
  478. package/scripts/run/run-ship-cli.ts +21 -3
  479. package/scripts/run/run-ship-detach.ts +1 -0
  480. package/scripts/run/run-ship-next.ts +106 -0
  481. package/scripts/run/run-ship-preflight.ts +1 -1
  482. package/scripts/run/run-ship-return.ts +8 -3
  483. package/scripts/run/run-ship-review-steps.ts +18 -4
  484. package/scripts/run/run-ship-review.ts +11 -0
  485. package/scripts/run/run-ship-scoped.ts +1 -0
  486. package/scripts/run/run-ship-steps.ts +1 -1
  487. package/scripts/run/run-ship.ts +0 -1
  488. package/scripts/run/run-stage-read.ts +62 -0
  489. package/scripts/run/run-stage.ts +160 -0
  490. package/scripts/run/run-status-cli.ts +1 -1
  491. package/scripts/run/run-step-cli.ts +21 -14
  492. package/scripts/run/run-step.ts +1 -1
  493. package/scripts/run/run-stop-notify.ts +1 -3
  494. package/scripts/run/run-stranded-cli.ts +0 -4
  495. package/scripts/run/run-stranded-detect.ts +2 -2
  496. package/scripts/run/run-tail-cli.ts +17 -11
  497. package/scripts/run/run-tail.ts +2 -0
  498. package/scripts/run/run-tidy-lanes.ts +2 -1
  499. package/scripts/run/run-tidy-stashes.ts +12 -12
  500. package/scripts/run/run-wake-cli.ts +2 -3
  501. package/scripts/run/run-wake-loop.ts +2 -2
  502. package/scripts/run/run-wake.ts +2 -4
  503. package/scripts/run/run-watcher-guard-cli.ts +0 -4
  504. package/scripts/run/run-watcher-guard.ts +9 -7
  505. package/scripts/run/run-watcher-hook.ts +1 -1
  506. package/scripts/safe-chain/ci-installer-pin.ts +11 -5
  507. package/scripts/safe-chain/project-config.ts +1 -1
  508. package/scripts/security/security-audit-provision-logic.ts +0 -1
  509. package/scripts/security/security-audit-provision.ts +3 -2
  510. package/scripts/security/security-audit.ts +0 -1
  511. package/scripts/security/security-updates-logic.ts +0 -1
  512. package/scripts/sonar/sonar-hotspots-cli.ts +10 -52
  513. package/scripts/sonar/sonar-hotspots.ts +0 -1
  514. package/scripts/sonar/sonar-new-code-cli.ts +150 -0
  515. package/scripts/sonar/sonar-new-code.ts +79 -0
  516. package/scripts/sonar/sonar-project.ts +97 -0
  517. package/scripts/split/split-assess-cli.ts +1 -1
  518. package/scripts/split/split-assess.ts +2 -5
  519. package/scripts/sync/managed-config-scope-cli.ts +1 -1
  520. package/scripts/sync/skill-migration.ts +0 -1
  521. package/scripts/sync/sync-hook-safety.ts +2 -3
  522. package/scripts/sync/sync.ts +1 -8
  523. package/scripts/sync/template-source-logic.ts +0 -1
  524. package/scripts/sync/workflow-pin-logic.ts +16 -28
  525. package/scripts/test/test-declared-logic.ts +0 -1
  526. package/scripts/test/test-declared.ts +0 -2
  527. package/scripts/test/test-red-commit.ts +2 -2
  528. package/scripts/test/test-red.ts +14 -7
  529. package/scripts/test/test-type-logic.ts +1 -1
  530. package/scripts/test/unit-worker-share.ts +7 -16
  531. package/scripts/time-runtime/time-batch-guard.ts +1 -2
  532. package/scripts/time-runtime/time-bundle-call.ts +0 -1
  533. package/scripts/time-runtime/time-bundles.ts +0 -4
  534. package/scripts/time-runtime/time-density-hook.ts +0 -2
  535. package/scripts/time-runtime/time-followup-stage.ts +1 -1
  536. package/scripts/time-runtime/time-format.ts +0 -73
  537. package/scripts/time-runtime/time-round-trips.ts +0 -4
  538. package/scripts/time-runtime/time-single-check.ts +1 -1
  539. package/scripts/time-runtime/time-spans.ts +1 -1
  540. package/scripts/time-runtime/time-transcript-line.ts +1 -2
  541. package/scripts/ui/ui-routes-cli.ts +0 -5
  542. package/scripts/ui/ui-routes.ts +0 -5
  543. package/scripts/version/effective-upstream.ts +2 -2
  544. package/scripts/version/latest-corepack.ts +7 -9
  545. package/scripts/version/latest-scope-cli.ts +0 -2
  546. package/scripts/version/latest-update.ts +0 -2
  547. package/scripts/version/npm-registry.ts +2 -2
  548. package/scripts/version/publishable-range-check.ts +1 -1
  549. package/scripts/version/release-hold.ts +0 -4
  550. package/scripts/version/running-binary.ts +2 -2
  551. package/scripts/version/version-check-logic.ts +0 -2
  552. package/scripts/version/version-remote.ts +3 -3
  553. package/scripts/version/version-targets.ts +4 -4
  554. package/templates/sonar-project.properties +28 -1
  555. package/templates/workflows/dependabot-auto-merge.yml +5 -3
  556. package/templates/workflows/github-release.yml +81 -0
  557. package/prompts/collaboration-workflow/cross-repo-epic.md +0 -5
  558. package/prompts/collaboration-workflow/epic-audit.md +0 -5
  559. package/prompts/collaboration-workflow/epic-bundle.md +0 -5
  560. package/scripts/init/plugin-install-hint.ts +0 -47
  561. package/scripts/version/parse-json.ts +0 -13
  562. /package/scripts/{git → followup}/git-followup-stages.ts +0 -0
  563. /package/scripts/{git → gh}/git-gh-api-path.ts +0 -0
  564. /package/scripts/{git → gh}/git-gh-command.ts +0 -0
  565. /package/scripts/{git → gh}/git-gh-issue-write.ts +0 -0
  566. /package/scripts/{git → gh}/git-gh-issue.ts +0 -0
  567. /package/scripts/{git → gh}/git-gh-pr-auto-merge.ts +0 -0
  568. /package/scripts/{git → gh}/git-gh-pr-snapshot.ts +0 -0
  569. /package/scripts/{git → gh}/git-gh-reachability.ts +0 -0
  570. /package/scripts/{git → gh}/git-gh-repo.ts +0 -0
  571. /package/scripts/{git → gh}/git-gh-rest-state.ts +0 -0
  572. /package/scripts/{git → gh}/git-pr-checks-watch.ts +0 -0
  573. /package/scripts/{git → gh}/git-pr-error.ts +0 -0
  574. /package/scripts/{git → gh}/git-pr-messages.ts +0 -0
  575. /package/scripts/{git → gh}/github-issue-url.ts +0 -0
  576. /package/scripts/git/{stash-orphans.ts → stash/stash-orphans.ts} +0 -0
  577. /package/scripts/{git → issue}/issue-reference.ts +0 -0
  578. /package/scripts/{git → lib}/animation-helpers.ts +0 -0
  579. /package/scripts/{git → lib}/git-animation.ts +0 -0
  580. /package/scripts/{git → notify}/git-notify.ts +0 -0
  581. /package/scripts/{git → notify}/telegram-test-logic.ts +0 -0
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env tsx
2
2
  import {
3
+ FETCH_TIMEOUT_MS,
3
4
  RUN_LANE_LABEL,
4
5
  RUN_SOLO_LABEL,
5
6
  agent_role_profile,
@@ -10,23 +11,27 @@ import {
10
11
  has_label_name,
11
12
  issue_cite,
12
13
  lane_background,
14
+ lane_handoff,
13
15
  lane_park,
14
16
  lane_registry,
15
17
  process_identity,
18
+ process_owner_schema,
16
19
  repo_party,
17
20
  run_carry,
18
21
  run_cut,
22
+ run_event_stream,
23
+ run_event_stream_emit,
19
24
  run_headless,
20
25
  run_hold,
21
26
  run_invocation
22
- } from "./chunk-RLDX5SOC.js";
27
+ } from "./chunk-UD24EAIL.js";
23
28
  import {
24
29
  session_language
25
30
  } from "./chunk-6V5OPIUU.js";
26
31
  import {
27
32
  hook_decision,
28
33
  lane_child_marker
29
- } from "./chunk-WQ4OSBSS.js";
34
+ } from "./chunk-E54KGFEQ.js";
30
35
  import {
31
36
  PROJECT_ROOT,
32
37
  json_value,
@@ -34,7 +39,7 @@ import {
34
39
  time_density_hook,
35
40
  time_hook_transcript,
36
41
  time_reported_failure
37
- } from "./chunk-7VPDUBRN.js";
42
+ } from "./chunk-NKOG3XAV.js";
38
43
  import "./chunk-WPALEIRX.js";
39
44
  import "./chunk-RKUAD3I6.js";
40
45
 
@@ -62,6 +67,23 @@ async function josh_run(args, should_forward_stderr = false, timeout_ms) {
62
67
  }
63
68
  var josh_command = { josh_run };
64
69
 
70
+ // scripts/lane/lane-seed.ts
71
+ var FIRST_LANE_SEAT = 1;
72
+ var LAST_LANE_SEAT = 9;
73
+ function free_seats(used) {
74
+ const taken = new Set(used);
75
+ const free = [];
76
+ for (let seat = FIRST_LANE_SEAT; seat <= LAST_LANE_SEAT; seat += 1) {
77
+ if (!taken.has(seat)) free.push(seat);
78
+ }
79
+ return free;
80
+ }
81
+ var lane_seed_policy = {
82
+ FIRST_LANE_SEAT,
83
+ LAST_LANE_SEAT,
84
+ free_seats
85
+ };
86
+
65
87
  // scripts/lane/lane-capacity.ts
66
88
  var DEFAULT_LANE_LIMIT = 6;
67
89
  var LANE_LIMIT_KEY = "JOSH_LANE_LIMIT";
@@ -82,12 +104,10 @@ function lane_limit(environment = process.env) {
82
104
  return read_limit(environment[LANE_LIMIT_KEY]);
83
105
  }
84
106
  function free_lanes(limit, occupied) {
85
- return Math.max(NO_LANES, limit - occupied);
107
+ return Math.max(NO_LANES, Math.min(limit, lane_seed_policy.LAST_LANE_SEAT) - occupied);
86
108
  }
87
109
  var lane_capacity = {
88
- DEFAULT_LANE_LIMIT,
89
110
  LANE_LIMIT_KEY,
90
- read_limit,
91
111
  lane_limit,
92
112
  free_lanes
93
113
  };
@@ -96,26 +116,31 @@ var lane_capacity = {
96
116
  var ISSUE_NUMBER = /#\d+/gu;
97
117
  var REFERENCE_BOUNDARY = /[\s#()[\]<>|]/u;
98
118
  var OWNER_REPO = /^[^\s/#]+\/[^\s/#]+$/u;
99
- var MARKDOWN_LINK = /\[([^[\]]*)\]\([^()]*\)/gu;
119
+ var MARKDOWN_LINK = /\[[^[\]]*\]\([^()]*\)/gu;
120
+ var NUMBER_CONTINUATION = /^(?:\w|-[a-z])/iu;
121
+ var CONTINUATION_WIDTH = 2;
122
+ var GLUED_LEAD = /[&./]/u;
100
123
  var FENCE_MARKER = /^\s*(?:`{3,}|~{3,})/u;
101
124
  var QUOTE_LINE = /^\s*>/u;
102
125
  var PR_PREFIX = /\b(?:pr|pull request)\s*$/iu;
103
126
  var BACKTICK_PAIR = 2;
104
- function text_span_covers(link, index) {
105
- const start = (link.index ?? 0) + 1;
106
- const end = start + (link[1] ?? "").length;
107
- return index >= start && index < end;
127
+ function link_covers(link, index) {
128
+ const start = link.index ?? 0;
129
+ return index >= start && index < start + link[0].length;
108
130
  }
109
131
  function is_linked_at(line, index) {
110
132
  for (const link of line.matchAll(MARKDOWN_LINK)) {
111
- if (text_span_covers(link, index)) return true;
133
+ if (link_covers(link, index)) return true;
112
134
  }
113
135
  return false;
114
136
  }
115
- function repo_prefix(message2, hash_index) {
137
+ function lead_token(message2, hash_index) {
116
138
  let start = hash_index;
117
139
  while (start > 0 && !REFERENCE_BOUNDARY.test(message2.charAt(start - 1))) start -= 1;
118
- const token = message2.slice(start, hash_index);
140
+ return message2.slice(start, hash_index);
141
+ }
142
+ function repo_prefix(message2, hash_index) {
143
+ const token = lead_token(message2, hash_index);
119
144
  return OWNER_REPO.test(token) ? token : "";
120
145
  }
121
146
  function is_inline_code_at(line, index) {
@@ -126,13 +151,16 @@ function is_bare_at(line, index) {
126
151
  if (is_linked_at(line, index) || is_inline_code_at(line, index)) return false;
127
152
  return !PR_PREFIX.test(line.slice(0, index));
128
153
  }
154
+ function is_glued(line, reference) {
155
+ const end = reference.index + reference.text.length;
156
+ if (NUMBER_CONTINUATION.test(line.slice(end, end + CONTINUATION_WIDTH))) return true;
157
+ return reference.prefix === "" && GLUED_LEAD.test(lead_token(line, reference.index));
158
+ }
129
159
  function line_references(line) {
130
160
  const references = [];
131
161
  for (const match of line.matchAll(ISSUE_NUMBER)) {
132
- const { index } = match;
133
- if (is_bare_at(line, index)) {
134
- references.push({ index, prefix: repo_prefix(line, index), text: match[0] });
135
- }
162
+ const reference = { index: match.index, prefix: repo_prefix(line, match.index), text: match[0] };
163
+ if (!is_glued(line, reference) && is_bare_at(line, match.index)) references.push(reference);
136
164
  }
137
165
  return references;
138
166
  }
@@ -231,144 +259,6 @@ function message(children, repo) {
231
259
  }
232
260
  var epic_triage = { TRIAGE_VERDICT, is_triaged, message, untriaged };
233
261
 
234
- // scripts/run/run-event-stream.ts
235
- import { z } from "zod";
236
- var EVENT_PREFIX = "josh-run-events-";
237
- var EVENT_SUFFIX = ".jsonl";
238
- var EVENT_CAP = 500;
239
- var FIRST_POSITION = 0;
240
- var POSITION_INCREMENT = 1;
241
- var LINE_SEPARATOR = "\n";
242
- var EVENT_KIND = {
243
- PLAN: "plan",
244
- CHILD_LAUNCH: "child-launch",
245
- MERGE: "merge",
246
- PARK: "park",
247
- SPLIT: "split",
248
- OUTAGE: "outage",
249
- CUT: "cut",
250
- // The backlog emptied while nothing of the run's own was in flight — the drain
251
- // (joshuafolkken/kit#2335). It marks the position at which the end-of-run retrospective is owed,
252
- // *before* the idle watch opens, so `run:step` fires the retrospective at the drain rather than after
253
- // the watch runs its course. It is not itself a stop: the run watches on once the retrospective has
254
- // run, and the real `STOP` follows when the watch expires.
255
- DRAIN: "drain",
256
- STOP: "stop",
257
- PR_OPENED: "pr-opened",
258
- REVIEW_ROUND: "review-round",
259
- // The end-of-run retrospective's result, recorded when the run marks the retrospective done
260
- // (joshuafolkken/kit#2342). A retrospective that files zero improvements and one that never ran look
261
- // the same from outside — no new Issue either way — so the result is put on the stream the report is
262
- // generated from: the issues filed (or that none were), and the candidates dropped with why. It is
263
- // emitted from the `run:carry --retrospective` close, so marking the retrospective done and recording
264
- // what it found are one action rather than two the run could do only one of.
265
- RETROSPECTIVE: "retrospective",
266
- // Ready backlog work is sitting undispatched while a lane is free and nothing has dispatched for a
267
- // while (joshuafolkken/kit#2359). Emitted once per stall episode by the stop-time detector, it is
268
- // both the dedup marker — `emit_once_since` refuses a second until a `CHILD_LAUNCH` intervenes
269
- // (joshuafolkken/kit#2464) — and the line a
270
- // terminal reader following the stream sees. `run:step` reads it as `backlog:next`, so a run that
271
- // stalled is pointed straight at dispatching the work rather than left waiting.
272
- STALL: "stall",
273
- // The run's own driver is gone: the cut handed the budget off, the owner has died, and no supervisor
274
- // is watching (joshuafolkken/kit#2375). Emitted once per strand episode by the stop-time detector,
275
- // exactly as `STALL` is — the newest-event dedup keeps a run polled every stop from notifying more
276
- // than once, and a terminal reader following the stream sees the line. The strand is the step before
277
- // the stall: a stalled run still has a driver that could dispatch, a stranded one has none.
278
- STRANDED: "stranded",
279
- // One `josh ship` stage starting, succeeding or failing (joshuafolkken/kit#2426). It is a trace of the
280
- // composite's progress rather than a position the run is at — the positions a ship leaves behind are
281
- // the closed issue its `followup` merges, or a detached supervisor's `SHIP_LAUNCH` / `SHIP_STOP` below
282
- // — so it is one of the `TRACE_KINDS` the last-event read skips.
283
- SHIP_STAGE: "ship-stage",
284
- // One progress watcher line — the `at … / next …` heartbeat `run:progress` prints
285
- // (joshuafolkken/kit#2437). Printed only to the watcher's own output, a headless successor's heartbeat
286
- // was buried in its log after a cut; on the stream it reaches the attached session's relay. It says
287
- // the run is alive rather than where it is, so it is a trace kind like `SHIP_STAGE`.
288
- HEARTBEAT: "heartbeat",
289
- // The post-implementation region handed to a detached `josh ship --detach` supervisor
290
- // (joshuafolkken/kit#2428). Unlike a stage trace it is a position: the agent has ended and the
291
- // supervisor carries the run, so `run:step` answers `wait` until it stops or the issue closes.
292
- SHIP_LAUNCH: "ship-launch",
293
- // The supervisor stopped at a failed stage — a red gate, a High/Medium review, a failed push, red CI
294
- // (joshuafolkken/kit#2428). The position that hands control back: `run:step` prints the command that
295
- // shows the stopped report, so the agent fixes it and relaunches rather than rebuilding the context.
296
- SHIP_STOP: "ship-stop"
297
- };
298
- var EVENT_KINDS = Object.values(EVENT_KIND);
299
- var TRACE_KINDS = /* @__PURE__ */ new Set([EVENT_KIND.SHIP_STAGE, EVENT_KIND.HEARTBEAT]);
300
- var event_schema = z.object({
301
- pos: z.number(),
302
- at: z.string(),
303
- kind: z.string(),
304
- text: z.string()
305
- });
306
- function is_event_kind(value) {
307
- return EVENT_KINDS.includes(value);
308
- }
309
- function target_of(repository) {
310
- return stamp_file.stamp_path(EVENT_PREFIX, repository, EVENT_SUFFIX);
311
- }
312
- function is_present(event) {
313
- return event !== void 0;
314
- }
315
- function parse_line(line) {
316
- return event_schema.safeParse(json_value.parse_or_undefined(line)).data;
317
- }
318
- function read_events(target) {
319
- const raw = stamp_file.read_stamp_text(target);
320
- if (raw === void 0) return [];
321
- return raw.split(LINE_SEPARATOR).map((line) => line.trim()).filter((line) => line.length > 0).map((line) => parse_line(line)).filter(is_present);
322
- }
323
- function last_position(events) {
324
- return events[events.length - POSITION_INCREMENT]?.pos ?? FIRST_POSITION;
325
- }
326
- function serialize(events) {
327
- return `${events.map((event) => JSON.stringify(event)).join(LINE_SEPARATOR)}${LINE_SEPARATOR}`;
328
- }
329
- function append(target, kind, text2, at) {
330
- if (!is_event_kind(kind)) return { appended: false, position: FIRST_POSITION };
331
- const existing = read_events(target);
332
- const position = last_position(existing) + POSITION_INCREMENT;
333
- const bounded = [...existing, { pos: position, at, kind, text: text2 }].slice(-EVENT_CAP);
334
- stamp_file.write_text_stamp(target, serialize(bounded));
335
- return { appended: true, position };
336
- }
337
- function read_from(target, position) {
338
- const events = read_events(target);
339
- return {
340
- events: events.filter((event) => event.pos > position),
341
- next_position: last_position(events)
342
- };
343
- }
344
- function read_last(target) {
345
- return read_events(target).findLast((event) => !TRACE_KINDS.has(event.kind));
346
- }
347
- function has_since(events, kind, reset_kind) {
348
- const reset_at = events.findLastIndex((event) => event.kind === reset_kind);
349
- return events.slice(reset_at + POSITION_INCREMENT).some((event) => event.kind === kind);
350
- }
351
- var FIELD_SEPARATOR = " \xB7 ";
352
- function format_event(event) {
353
- return [event.at, event.kind, event.text].join(FIELD_SEPARATOR);
354
- }
355
- var run_event_stream = {
356
- EVENT_CAP,
357
- EVENT_KIND,
358
- EVENT_KINDS,
359
- EVENT_PREFIX,
360
- EVENT_SUFFIX,
361
- TRACE_KINDS,
362
- append,
363
- format_event,
364
- has_since,
365
- is_event_kind,
366
- read_events,
367
- read_from,
368
- read_last,
369
- target_of
370
- };
371
-
372
262
  // scripts/backlog/backlog-stalled.ts
373
263
  var STALL_THRESHOLD_MINUTES = 10;
374
264
  var MS_PER_MINUTE = 6e4;
@@ -420,7 +310,6 @@ var backlog_stalled = {
420
310
  count_ready_tokens,
421
311
  describe,
422
312
  dispatch_age_ms,
423
- is_stalled,
424
313
  needs_triage,
425
314
  ready_tokens
426
315
  };
@@ -428,12 +317,20 @@ var backlog_stalled = {
428
317
  // scripts/backlog/backlog-ready.ts
429
318
  var NO_FREE = 0;
430
319
  var NONE2 = 0;
320
+ async function free_under(limit) {
321
+ const lanes = await lane_registry.list_lanes();
322
+ const live = lanes.filter((lane) => !lane.is_stranded).length;
323
+ return lane_capacity.free_lanes(limit, live);
324
+ }
431
325
  async function free_lane_count() {
432
326
  const limit = lane_capacity.lane_limit();
433
327
  if (limit.kind !== "limit") return NO_FREE;
434
- const lanes = await lane_registry.list_lanes();
435
- const live = lanes.filter((lane) => !lane.is_stranded).length;
436
- return lane_capacity.free_lanes(limit.limit, live);
328
+ return await free_under(limit.limit);
329
+ }
330
+ async function drive_free_lane_count() {
331
+ const limit = lane_capacity.lane_limit();
332
+ if (limit.kind !== "limit") throw new Error(limit.problem);
333
+ return await free_under(limit.limit);
437
334
  }
438
335
  function drains_pool(carry) {
439
336
  return carry === void 0 || !run_invocation.has_only(carry.invocation);
@@ -481,6 +378,7 @@ var backlog_ready = {
481
378
  read_backlog_next,
482
379
  print_offer_hint,
483
380
  free_lane_count,
381
+ drive_free_lane_count,
484
382
  drains_pool,
485
383
  print_ready_line,
486
384
  read_ready,
@@ -508,12 +406,17 @@ function get_repo_name_with_owner_within(timeout_ms) {
508
406
  }
509
407
  var gh_spawn = { get_repo_name_with_owner, get_repo_name_with_owner_within };
510
408
 
511
- // scripts/git/telegram-notify.ts
512
- import { z as z2 } from "zod";
409
+ // scripts/lib/timed-fetch.ts
410
+ async function timed_fetch(url, init = {}, timeout_ms = FETCH_TIMEOUT_MS) {
411
+ return await fetch(url, { ...init, signal: AbortSignal.timeout(timeout_ms) });
412
+ }
413
+
414
+ // scripts/notify/telegram-notify.ts
415
+ import { z } from "zod";
513
416
  var TELEGRAM_API_BASE = "https://api.telegram.org";
514
- var telegram_environment_schema = z2.object({
515
- telegram_bot_token: z2.string().min(1, { message: "TELEGRAM_BOT_TOKEN is required" }),
516
- telegram_chat_id: z2.string().min(1, { message: "TELEGRAM_CHAT_ID is required" })
417
+ var telegram_environment_schema = z.object({
418
+ telegram_bot_token: z.string().min(1, { message: "TELEGRAM_BOT_TOKEN is required" }),
419
+ telegram_chat_id: z.string().min(1, { message: "TELEGRAM_CHAT_ID is required" })
517
420
  });
518
421
  var TASK_DEFINITIONS = {
519
422
  planning: { icon: "\u{1F4CB}", label: "Planning" },
@@ -599,7 +502,7 @@ function build_text(input) {
599
502
  }
600
503
  async function post_message(config, text2) {
601
504
  const url = `${TELEGRAM_API_BASE}/bot${config.bot_token}/sendMessage`;
602
- const response = await fetch(url, {
505
+ const response = await timed_fetch(url, {
603
506
  method: "POST",
604
507
  headers: { "Content-Type": "application/json" },
605
508
  body: JSON.stringify({ chat_id: config.chat_id, text: text2 })
@@ -698,7 +601,6 @@ async function stranded(input) {
698
601
  );
699
602
  }
700
603
  var telegram_notify = {
701
- REPO_LOOKUP_TIMEOUT_MS,
702
604
  confirm,
703
605
  send,
704
606
  send_or_report,
@@ -707,125 +609,6 @@ var telegram_notify = {
707
609
  warn
708
610
  };
709
611
 
710
- // scripts/run/run-event-scope.ts
711
- var SINCE_SCOPE = "since";
712
- var UNKNOWN_SCOPE = "unknown";
713
- var UNKNOWN_EVENT_SCOPE = { kind: UNKNOWN_SCOPE };
714
- function moment_of(at) {
715
- const parsed = Date.parse(at);
716
- return Number.isNaN(parsed) ? void 0 : parsed;
717
- }
718
- function is_within(event, floor) {
719
- const at = moment_of(event.at);
720
- return at !== void 0 && at >= floor;
721
- }
722
- function scoped_events(events, scope) {
723
- if (scope.kind === UNKNOWN_SCOPE) return void 0;
724
- const floor = moment_of(scope.started_at);
725
- if (floor === void 0) return void 0;
726
- return events.filter((event) => is_within(event, floor));
727
- }
728
- function scope_of(read) {
729
- if (read.kind === "carried" || read.kind === "expired") {
730
- return { kind: SINCE_SCOPE, started_at: read.carry.started_at };
731
- }
732
- return UNKNOWN_EVENT_SCOPE;
733
- }
734
- function last_scoped_event(events, scope) {
735
- return scoped_events(events, scope)?.findLast(
736
- (event) => !run_event_stream.TRACE_KINDS.has(event.kind)
737
- );
738
- }
739
- var SHIP_POSITION_KINDS = /* @__PURE__ */ new Set([
740
- run_event_stream.EVENT_KIND.SHIP_LAUNCH,
741
- run_event_stream.EVENT_KIND.SHIP_STOP
742
- ]);
743
- function is_foreign_ship_event(event, issue) {
744
- return SHIP_POSITION_KINDS.has(event.kind) && !event.text.startsWith(`#${issue} `);
745
- }
746
- function is_own_ship_event(event, issue) {
747
- return SHIP_POSITION_KINDS.has(event.kind) && !is_foreign_ship_event(event, issue);
748
- }
749
- function last_issue_event(events, scope, issue) {
750
- const own = events.filter((event) => !is_foreign_ship_event(event, issue));
751
- if (scope.kind === SINCE_SCOPE) return last_scoped_event(own, scope);
752
- return own.findLast((event) => is_own_ship_event(event, issue));
753
- }
754
- var run_event_scope = {
755
- UNKNOWN_EVENT_SCOPE,
756
- last_issue_event,
757
- last_scoped_event,
758
- scope_of,
759
- scoped_events
760
- };
761
-
762
- // scripts/run/run-event-stream-emit.ts
763
- function now_iso() {
764
- return (/* @__PURE__ */ new Date()).toISOString();
765
- }
766
- async function stream_target() {
767
- const repository = await run_carry.repository_directory();
768
- return repository === void 0 ? void 0 : run_event_stream.target_of(repository);
769
- }
770
- async function emit(kind, text2) {
771
- try {
772
- const target = await stream_target();
773
- if (target === void 0) return;
774
- run_event_stream.append(target, kind, text2, now_iso());
775
- } catch {
776
- }
777
- }
778
- async function emit_once(kind, text2) {
779
- try {
780
- const target = await stream_target();
781
- if (target === void 0 || run_event_stream.read_last(target)?.kind === kind) return false;
782
- return run_event_stream.append(target, kind, text2, now_iso()).appended;
783
- } catch {
784
- return false;
785
- }
786
- }
787
- function invocation_events(repository, target) {
788
- const events = run_event_stream.read_events(target);
789
- const scope = run_event_scope.scope_of(run_carry.read_carry(run_carry.carry_path(repository)));
790
- return run_event_scope.scoped_events(events, scope) ?? events;
791
- }
792
- async function emit_once_since(kind, text2, reset_kind) {
793
- try {
794
- const repository = await run_carry.repository_directory();
795
- if (repository === void 0) return false;
796
- const target = run_event_stream.target_of(repository);
797
- if (run_event_stream.has_since(invocation_events(repository, target), kind, reset_kind)) {
798
- return false;
799
- }
800
- return run_event_stream.append(target, kind, text2, now_iso()).appended;
801
- } catch {
802
- return false;
803
- }
804
- }
805
- async function emit_heartbeat(line) {
806
- await emit(run_event_stream.EVENT_KIND.HEARTBEAT, line);
807
- }
808
- async function current_events() {
809
- try {
810
- const repository = await run_carry.repository_directory();
811
- if (repository === void 0) return [];
812
- const read = run_carry.read_carry(run_carry.carry_path(repository));
813
- const scope = run_event_scope.scope_of(read);
814
- const events = run_event_stream.read_events(run_event_stream.target_of(repository));
815
- return run_event_scope.scoped_events(events, scope) ?? [];
816
- } catch {
817
- return [];
818
- }
819
- }
820
- var run_event_stream_emit = {
821
- current_events,
822
- emit,
823
- emit_heartbeat,
824
- emit_once,
825
- emit_once_since,
826
- stream_target
827
- };
828
-
829
612
  // scripts/backlog/backlog-stalled-detect.ts
830
613
  var NO_FREE2 = 0;
831
614
  var NO_READY = 0;
@@ -888,23 +671,24 @@ async function run_stall_check(ready = backlog_ready.DEFAULT_PORTS) {
888
671
  } catch {
889
672
  }
890
673
  }
891
- var backlog_stalled_detect = { DEFAULT_PORTS: DEFAULT_PORTS2, detect_and_report, gather, report, run_stall_check };
674
+ var backlog_stalled_detect = { detect_and_report, run_stall_check };
892
675
 
893
676
  // scripts/rules/last-prompt.ts
894
- import { z as z3 } from "zod";
677
+ import { z as z2 } from "zod";
895
678
  var WORKFLOW_KEYWORDS = /* @__PURE__ */ new Set([
896
679
  "kickoff",
897
680
  "fullrun",
898
681
  "halfrun",
682
+ "prrun",
899
683
  "backlogrun"
900
684
  ]);
901
685
  var NO_PROMPT = "";
902
686
  var HUMAN_ORIGIN = "human";
903
687
  var KEYWORD_BEFORE_ARGUMENT = -2;
904
- var PROMPT_LINE_SCHEMA = z3.object({
905
- isMeta: z3.boolean().nullish(),
906
- origin: z3.object({ kind: z3.string().nullish() }).nullish(),
907
- message: z3.object({ content: z3.unknown() })
688
+ var PROMPT_LINE_SCHEMA = z2.object({
689
+ isMeta: z2.boolean().nullish(),
690
+ origin: z2.object({ kind: z2.string().nullish() }).nullish(),
691
+ message: z2.object({ content: z2.unknown() })
908
692
  });
909
693
  function is_person(line) {
910
694
  if (line.isMeta === true) return false;
@@ -931,7 +715,7 @@ function prompt_text(tail) {
931
715
  var last_prompt = { prompt_text };
932
716
 
933
717
  // scripts/rules/stop-rules.ts
934
- import { z as z4 } from "zod";
718
+ import { z as z3 } from "zod";
935
719
 
936
720
  // scripts/rules/filing-offer.ts
937
721
  var OFFER_PATTERNS = [
@@ -1034,19 +818,19 @@ function is_mismatch(message2, lang) {
1034
818
  if (letter_count(prose) < MIN_PROSE_LETTERS) return false;
1035
819
  return matches_share(prose, script, pattern) < MATCH_SHARE_FLOOR;
1036
820
  }
1037
- var reply_language = { MIN_PROSE_LETTERS, is_mismatch, script_of };
821
+ var reply_language = { is_mismatch, script_of };
1038
822
 
1039
823
  // scripts/rules/stop-rules.ts
1040
824
  var SWITCH_ENV_KEY = "JOSH_STOP_GUARD";
1041
825
  var BLOCK_DECISION = "block";
1042
- var stop_payload_schema = z4.object({
1043
- transcript_path: z4.string().min(1),
1044
- stop_hook_active: z4.boolean().nullish(),
1045
- last_assistant_message: z4.string().nullish()
826
+ var stop_payload_schema = z3.object({
827
+ transcript_path: z3.string().min(1),
828
+ stop_hook_active: z3.boolean().nullish(),
829
+ last_assistant_message: z3.string().nullish()
1046
830
  });
1047
831
  var NO_OUTCOME = { reason: void 0 };
1048
832
  var STOP_NOTIFY_REASON = '\u26D4 mid-workflow stop notification: this working tree is still held by a run and no `confirmation` Telegram was sent this turn, so a person is being left to wait off-screen without knowing the run paused. `CLAUDE.md` \u2192 "Mid-workflow stop notification" requires `pnpm josh notify --task-type confirmation --issue-url "<url>" --body=$\'<reason>\'` before any mid-workflow pause. Send it, then end with a one-line confirmation that it was sent \u2014 do not repeat your previous reply. This fires only while the hold is held and no notify is on the transcript, and `stop_hook_active` lets a second stop through so a run is never wedged.';
1049
- var HOLD_RELEASE_REASON = "\u26D4 working-tree hold not released: this working tree is clean but its `run:hold` record is still in place, so the next run here runs `git switch main && git pull` believing the tree is free while you hold it. `.claude/skills/workflow-commands/SKILL.md` \u2192 \xA72f: a stop that leaves the tree clean releases the hold with `pnpm josh run:release <N>` (bare for a `new` entry). A `halfrun` pre-commit stop and a `needs-human-review` stop keep the hold because their tree is dirty \u2014 this row is silent there. Release it, then end with a one-line confirmation that it was released \u2014 do not repeat your previous reply.";
833
+ var HOLD_RELEASE_REASON = "\u26D4 working-tree hold not released: this working tree is clean but its `run:hold` record is still in place, so the next run here runs `git switch main && git pull` believing the tree is free while you hold it. `.claude/skills/workflow-commands/SKILL.md` \u2192 \xA72f: a stop that leaves the tree clean releases the hold with `pnpm josh run:release <N>` (bare for a `new` entry). A `halfrun` pre-commit stop and a `needs-human-review` stop keep the hold because their tree is dirty, and a `prrun` stop keeps it by its stop mark \u2014 this row is silent there. Release it, then end with a one-line confirmation that it was released \u2014 do not repeat your previous reply.";
1050
834
  var ISSUE_CITATION_REASON = "Session-facing output cites an Issue as a number-link so the reader can click through and see which repository it is (`CLAUDE.md`, `prompts/collaboration-workflow/issue-citation.md`).";
1051
835
  function build_citation_reason(references) {
1052
836
  const numbers = references.join(", ");
@@ -1083,13 +867,13 @@ function needs_filing(context) {
1083
867
  return filing_offer.is_first_party_target(context.message, context.session_owner);
1084
868
  }
1085
869
  function is_held_idle(context) {
1086
- return context.hold_present && !context.agent_pending;
870
+ return context.hold_present && !context.agent_pending && !context.handed_off;
1087
871
  }
1088
872
  function needs_notify(context) {
1089
873
  return is_held_idle(context) && !context.notified;
1090
874
  }
1091
875
  function needs_release(context) {
1092
- return is_held_idle(context) && context.tree_clean;
876
+ return is_held_idle(context) && context.tree_clean && !context.prrun_stopped;
1093
877
  }
1094
878
  function citation_reason(context) {
1095
879
  const references = issue_citation.unquoted_references(context.message, context.prompt);
@@ -1147,7 +931,6 @@ var stop_rules = {
1147
931
  STOP_NOTIFY_REASON,
1148
932
  SWITCH_ENV_KEY,
1149
933
  block_envelope,
1150
- block_reason,
1151
934
  build_language_reason,
1152
935
  count_headless_refusals,
1153
936
  is_enabled,
@@ -1155,6 +938,67 @@ var stop_rules = {
1155
938
  stop_outcome
1156
939
  };
1157
940
 
941
+ // scripts/run/run-halfrun-resume.ts
942
+ var MARKED = "marked";
943
+ var FOREIGN = "foreign";
944
+ var UNREADABLE2 = "unreadable";
945
+ function hold_of(read) {
946
+ return read.kind === "held" || read.kind === "stale" ? read.hold : void 0;
947
+ }
948
+ function is_halfrun_stop(read, issue, is_dirty) {
949
+ const hold = hold_of(read);
950
+ return is_dirty && hold?.issue === issue && hold.is_halfrun_stop === true;
951
+ }
952
+ function is_own_record(read, issue) {
953
+ const hold = hold_of(read);
954
+ return hold === void 0 || hold.issue === issue || hold.issue === run_hold.UNNUMBERED_ISSUE;
955
+ }
956
+ function mark_stop_at(target, issue, mark = run_hold.HALFRUN_STOP_FIELDS) {
957
+ const read = run_hold.read_hold(target);
958
+ if (read.kind === "unreadable") return UNREADABLE2;
959
+ if (!is_own_record(read, issue)) return FOREIGN;
960
+ run_hold.release_hold(target);
961
+ return run_hold.create_stop_hold(target, issue, mark) ? MARKED : FOREIGN;
962
+ }
963
+ function take_over(target, issue) {
964
+ run_hold.release_hold(target);
965
+ return run_hold.create_hold(target, issue, /* @__PURE__ */ new Date(), true);
966
+ }
967
+ function adopt_at(target, issue, is_dirty) {
968
+ if (!is_halfrun_stop(run_hold.read_hold(target), issue, is_dirty)) return false;
969
+ return take_over(target, issue);
970
+ }
971
+ async function hold_target() {
972
+ try {
973
+ const directory = await run_hold.worktree_directory();
974
+ return directory === void 0 ? void 0 : run_hold.hold_path(directory);
975
+ } catch {
976
+ return void 0;
977
+ }
978
+ }
979
+ async function is_pending(issue) {
980
+ const target = await hold_target();
981
+ if (target === void 0) return false;
982
+ return is_halfrun_stop(run_hold.read_hold(target), issue, await run_hold.is_tree_dirty());
983
+ }
984
+ async function adopt(issue) {
985
+ const target = await hold_target();
986
+ if (target === void 0) return false;
987
+ return adopt_at(target, issue, await run_hold.is_tree_dirty());
988
+ }
989
+ var run_halfrun_resume = {
990
+ FOREIGN,
991
+ MARKED,
992
+ UNREADABLE: UNREADABLE2,
993
+ adopt,
994
+ adopt_at,
995
+ hold_of,
996
+ hold_target,
997
+ is_pending,
998
+ mark_stop_at,
999
+ take_over
1000
+ };
1001
+
1158
1002
  // scripts/run/run-stranded.ts
1159
1003
  var RECOVERY_COMMAND = "pnpm josh run:wake --start";
1160
1004
  var LIVE = "live";
@@ -1194,7 +1038,7 @@ var run_stranded = {
1194
1038
  };
1195
1039
 
1196
1040
  // scripts/run/run-wake.ts
1197
- import { z as z5 } from "zod";
1041
+ import { z as z4 } from "zod";
1198
1042
  var WAKE_PREFIX = "josh-run-wake-";
1199
1043
  var WAKE_LOG_PREFIX = "josh-run-wake-log-";
1200
1044
  var WAKE_LOG_SUFFIX = ".log";
@@ -1214,21 +1058,19 @@ var STOP_REASONS = {
1214
1058
  expired: "expired",
1215
1059
  unreadable: "unreadable"
1216
1060
  };
1217
- var run_wake_schema = z5.object({
1218
- invocation: z5.string(),
1219
- started_at: z5.string(),
1220
- pid: z5.number(),
1221
- process_start: z5.string().optional(),
1222
- woke: z5.number(),
1223
- woke_at: z5.string().optional(),
1061
+ var run_wake_schema = process_owner_schema.extend({
1062
+ invocation: z4.string(),
1063
+ started_at: z4.string(),
1064
+ woke: z4.number(),
1065
+ woke_at: z4.string().optional(),
1224
1066
  // **Every optional field of `RunWake` has to be listed here.** `z.object` strips what it does not
1225
1067
  // declare, so a field added to the interface alone round-trips through disk as `undefined` — which
1226
1068
  // reads as "no attempt has been made yet" and would restart the retry count on every pass.
1227
- attempts: z5.number().optional(),
1228
- woke_pid: z5.number().optional(),
1229
- held_at: z5.string().optional(),
1230
- spawned: z5.array(z5.string()).optional(),
1231
- idle_since: z5.string().optional(),
1069
+ attempts: z4.number().optional(),
1070
+ woke_pid: z4.number().optional(),
1071
+ held_at: z4.string().optional(),
1072
+ spawned: z4.array(z4.string()).optional(),
1073
+ idle_since: z4.string().optional(),
1232
1074
  profile: agent_role_profile.PROFILE_SCHEMA.optional()
1233
1075
  });
1234
1076
  function is_overdue(marked_at, now, limit_ms = WAKE_GRACE_MS) {
@@ -1380,7 +1222,6 @@ var run_wake = {
1380
1222
  IDLE_CEILING_MS,
1381
1223
  MAX_WAKE_ATTEMPTS,
1382
1224
  WAKE_GRACE_MS,
1383
- WAKE_PREFIX,
1384
1225
  claim,
1385
1226
  count_claim,
1386
1227
  count_wake,
@@ -1451,14 +1292,13 @@ async function run_stranded_check() {
1451
1292
  } catch {
1452
1293
  }
1453
1294
  }
1454
- var run_stranded_detect = { DEFAULT_PORTS: DEFAULT_PORTS3, detect_and_report: detect_and_report2, gather: gather2, report: report2, run_stranded_check };
1295
+ var run_stranded_detect = { detect_and_report: detect_and_report2, run_stranded_check };
1455
1296
 
1456
1297
  // scripts/hooks/stop-guard.ts
1457
- async function is_hold_present() {
1298
+ async function hold_facts() {
1458
1299
  const directory = await run_hold.worktree_directory();
1459
- if (directory === void 0) return false;
1460
- const read = run_hold.read_hold(run_hold.hold_path(directory));
1461
- return read.kind === "held" || read.kind === "stale";
1300
+ const hold = directory === void 0 ? void 0 : run_halfrun_resume.hold_of(run_hold.read_hold(run_hold.hold_path(directory)));
1301
+ return { hold_present: hold !== void 0, prrun_stopped: hold?.prrun_stop_head !== void 0 };
1462
1302
  }
1463
1303
  function transcript_tail(transcript_path) {
1464
1304
  const transcript = time_hook_transcript.transcript_of(transcript_path, void 0);
@@ -1473,7 +1313,7 @@ function session_lang() {
1473
1313
  async function build_context(transcript_path, payload_tail) {
1474
1314
  const tail = transcript_tail(transcript_path);
1475
1315
  return {
1476
- hold_present: await is_hold_present(),
1316
+ ...await hold_facts(),
1477
1317
  tree_clean: !await run_hold.is_tree_dirty(),
1478
1318
  notified: lane_park.mentions_confirmation_notify(tail),
1479
1319
  message: payload_tail.message,
@@ -1487,6 +1327,7 @@ async function build_context(transcript_path, payload_tail) {
1487
1327
  lane_child: lane_child_marker.is_child_of(process.cwd()),
1488
1328
  background_pending: lane_background.pending_background_ids(tail).length > 0,
1489
1329
  agent_pending: lane_background.pending_agent_ids(tail).length > 0,
1330
+ handed_off: lane_handoff.is_handed_off(process.cwd()),
1490
1331
  session_lang: session_lang()
1491
1332
  };
1492
1333
  }
@@ -1506,10 +1347,23 @@ async function outcome_of(raw_payload) {
1506
1347
  return stop_rules.NO_OUTCOME;
1507
1348
  }
1508
1349
  }
1509
- async function write_stop_decision(raw_payload) {
1510
- hook_decision.load_environment_file();
1350
+ async function has_run_record() {
1351
+ try {
1352
+ const directory = await run_carry.repository_directory();
1353
+ if (directory === void 0) return false;
1354
+ return run_carry.read_carry(run_carry.carry_path(directory)).kind === "carried";
1355
+ } catch {
1356
+ return false;
1357
+ }
1358
+ }
1359
+ async function run_report_checks() {
1360
+ if (!await has_run_record()) return;
1511
1361
  await backlog_stalled_detect.run_stall_check(backlog_ready.DEFAULT_PORTS);
1512
1362
  await run_stranded_detect.run_stranded_check();
1363
+ }
1364
+ async function write_stop_decision(raw_payload) {
1365
+ hook_decision.load_environment_file();
1366
+ await run_report_checks();
1513
1367
  const { reason } = await outcome_of(raw_payload);
1514
1368
  if (reason === void 0) return;
1515
1369
  process.stdout.write(`${stop_rules.block_envelope(reason, session_lang())}