capt-hook 12.77.2__tar.gz → 12.78.1__tar.gz

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 (234) hide show
  1. {capt_hook-12.77.2 → capt_hook-12.78.1}/PKG-INFO +1 -1
  2. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/.claude-plugin/plugin.json +1 -1
  3. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/tooling.py +22 -10
  4. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/cli.py +18 -1
  5. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/context.py +50 -15
  6. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/guard_literal.py +109 -0
  7. capt_hook-12.78.1/captain_hook/pause.py +89 -0
  8. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/primitives/llm.py +5 -1
  9. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/testing/helpers.py +7 -0
  10. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/testing/types.py +14 -6
  11. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/transcripts.py +8 -0
  12. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/update/cli.py +11 -0
  13. capt_hook-12.78.1/captain_hook/update/launchers.py +199 -0
  14. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/update/updater.py +21 -11
  15. {capt_hook-12.77.2 → capt_hook-12.78.1}/hatch_build.py +92 -1
  16. {capt_hook-12.77.2 → capt_hook-12.78.1}/internal/wireproto/guard.json +1 -0
  17. {capt_hook-12.77.2 → capt_hook-12.78.1}/pyproject.toml +1 -1
  18. {capt_hook-12.77.2 → capt_hook-12.78.1}/.gitignore +0 -0
  19. {capt_hook-12.77.2 → capt_hook-12.78.1}/LICENSE +0 -0
  20. {capt_hook-12.77.2 → capt_hook-12.78.1}/README.md +0 -0
  21. {capt_hook-12.77.2 → capt_hook-12.78.1}/capt_hook_client/__init__.py +0 -0
  22. {capt_hook-12.77.2 → capt_hook-12.78.1}/capt_hook_client/__main__.py +0 -0
  23. {capt_hook-12.77.2 → capt_hook-12.78.1}/capt_hook_client/client.py +0 -0
  24. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/.mcp.json +0 -0
  25. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/__init__.py +0 -0
  26. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/__init__.pyi +0 -0
  27. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/__main__.py +0 -0
  28. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/annotations.py +0 -0
  29. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/app.py +0 -0
  30. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/ast_grep.py +0 -0
  31. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/bindings.py +0 -0
  32. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/__init__.py +0 -0
  33. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/fixes/__init__.py +0 -0
  34. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/fixes/hooks/__init__.py +0 -0
  35. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/fixes/hooks/_lib.py +0 -0
  36. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/fixes/hooks/scratch_writes.py +0 -0
  37. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/fixes/hooks/teammate_permissions.py +0 -0
  38. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/__init__.py +0 -0
  39. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/__init__.py +0 -0
  40. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/_lib.py +0 -0
  41. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/_sessions.py +0 -0
  42. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/commands.py +0 -0
  43. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/comments.py +0 -0
  44. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/deletions.py +0 -0
  45. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/detours.py +0 -0
  46. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/docs.py +0 -0
  47. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/hook_files.py +0 -0
  48. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/models.py +0 -0
  49. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/plain_english.py +0 -0
  50. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/plans.py +0 -0
  51. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/prompts/fragments/deliverable_rubric.md +0 -0
  52. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/prompts/fragments/workflow_script_header.md +0 -0
  53. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/prompts/models/browser_delegation_nudge.md +0 -0
  54. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/prompts/models/implementation_spawn_nudge.md +0 -0
  55. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/prompts/models/inline_edit_nudge.md +0 -0
  56. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/prompts/models/prose_spawn_gate.md +0 -0
  57. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/prompts/models/prose_workflow_nudge.md +0 -0
  58. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/prompts/models/review_routing_spawn_nudge.md +0 -0
  59. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/prompts/models/review_routing_workflow_nudge.md +0 -0
  60. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/prompts/models/writing_docs_spawn_nudge.md +0 -0
  61. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/prompts/models/writing_docs_workflow_nudge.md +0 -0
  62. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/prompts/plain_english_rules.md +0 -0
  63. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/prompts/tools/preload_nudge.md +0 -0
  64. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/prompts.py +0 -0
  65. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/questions.py +0 -0
  66. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/review.py +0 -0
  67. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/sessions.py +0 -0
  68. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/tasks.py +0 -0
  69. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/tombstones.py +0 -0
  70. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/hooks/tools.py +0 -0
  71. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/general/pack.toml +0 -0
  72. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/go/__init__.py +0 -0
  73. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/go/hooks/__init__.py +0 -0
  74. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/go/hooks/testing.py +0 -0
  75. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/go/hooks/toolchain.py +0 -0
  76. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/graphite/__init__.py +0 -0
  77. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/graphite/gitdir/.graphite_repo_config +0 -0
  78. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/graphite/hooks/__init__.py +0 -0
  79. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/graphite/hooks/_lib.py +0 -0
  80. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/graphite/hooks/queue.py +0 -0
  81. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/graphite/hooks/vcs.py +0 -0
  82. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/performance/__init__.py +0 -0
  83. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/performance/hooks/__init__.py +0 -0
  84. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/performance/hooks/filesystem.py +0 -0
  85. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/performance/hooks/pipelining.py +0 -0
  86. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/python/__init__.py +0 -0
  87. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/python/hooks/__init__.py +0 -0
  88. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/python/hooks/style.py +0 -0
  89. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/python/hooks/testing.py +0 -0
  90. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/python/hooks/toolchain.py +0 -0
  91. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/steering/__init__.py +0 -0
  92. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/steering/hooks/__init__.py +0 -0
  93. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/steering/hooks/steering.py +0 -0
  94. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/steering/hooks/teammates.py +0 -0
  95. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/steering/hooks/workarounds.py +0 -0
  96. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/builtin_packs/steering/pack.toml +0 -0
  97. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/classifiers/__init__.py +0 -0
  98. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/classifiers/conductor.py +0 -0
  99. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/classifiers/droid.py +0 -0
  100. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/classifiers/lane.py +0 -0
  101. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/classifiers/native.py +0 -0
  102. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/cmd.py +0 -0
  103. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/command_schema.py +0 -0
  104. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/command_schemas.py +0 -0
  105. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/conditions.py +0 -0
  106. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/confirm.py +0 -0
  107. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/contexts.py +0 -0
  108. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/daemon/__init__.py +0 -0
  109. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/daemon/context.py +0 -0
  110. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/daemon/decision_writer.py +0 -0
  111. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/daemon/logsink.py +0 -0
  112. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/daemon/registry.py +0 -0
  113. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/daemon/tree.py +0 -0
  114. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/decisions.py +0 -0
  115. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/desktop/__init__.py +0 -0
  116. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/desktop/cli.py +0 -0
  117. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/desktop/client.py +0 -0
  118. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/dispatch.py +0 -0
  119. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/doc_conventions.py +0 -0
  120. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/durable.py +0 -0
  121. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/events.py +0 -0
  122. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/faults.py +0 -0
  123. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/fields.py +0 -0
  124. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/file.py +0 -0
  125. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/guard_literal.sh +0 -0
  126. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/heartbeat.py +0 -0
  127. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/hook_lint.py +0 -0
  128. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/hooks/hooks.json +0 -0
  129. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/loader.py +0 -0
  130. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/log.py +0 -0
  131. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/mcp_server.py +0 -0
  132. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/packs/__init__.py +0 -0
  133. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/packs/manager.py +0 -0
  134. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/packs/plugins.py +0 -0
  135. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/primitives/__init__.py +0 -0
  136. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/primitives/commands.py +0 -0
  137. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/primitives/lint.py +0 -0
  138. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/primitives/nudge.py +0 -0
  139. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/primitives/permissions.py +0 -0
  140. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/primitives/provision.py +0 -0
  141. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/primitives/rewrite.py +0 -0
  142. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/primitives/workflow.py +0 -0
  143. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/prompt.py +0 -0
  144. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/py.typed +0 -0
  145. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/review/__init__.py +0 -0
  146. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/review/announce.py +0 -0
  147. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/review/cli.py +0 -0
  148. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/review/dashboard.py +0 -0
  149. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/review/fix.py +0 -0
  150. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/review/formats.py +0 -0
  151. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/review/judge.py +0 -0
  152. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/review/notify.py +0 -0
  153. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/review/pipeline.py +0 -0
  154. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/review/prompts.py +0 -0
  155. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/review/repo.py +0 -0
  156. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/review/routing.py +0 -0
  157. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/review/scan.py +0 -0
  158. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/review/settings.py +0 -0
  159. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/review/snapshot.py +0 -0
  160. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/review/status.py +0 -0
  161. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/review/store.py +0 -0
  162. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/review/sync.py +0 -0
  163. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/review/triage.py +0 -0
  164. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/scripts/install-binary.sh +0 -0
  165. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/scripts/install-mcp.sh +0 -0
  166. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/session.py +0 -0
  167. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/settings.py +0 -0
  168. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/signals/__init__.py +0 -0
  169. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/signals/nlp.py +0 -0
  170. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/skills/authoring-hooks/SKILL.md +0 -0
  171. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/skills/authoring-hooks/references/capt-hook-api.md +0 -0
  172. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/skills/authoring-hooks/references/pattern-catalog.md +0 -0
  173. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/skills/authoring-hooks/references/pitfalls.md +0 -0
  174. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/skills/authoring-hooks/references/testing-hooks.md +0 -0
  175. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/skills/bootstrapping-hooks/SKILL.md +0 -0
  176. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/skills/scanning-sessions/SKILL.md +0 -0
  177. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/skills/scanning-sessions/references/pr-workflow.md +0 -0
  178. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/skills/scanning-sessions/references/review-cli.md +0 -0
  179. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/skills/translating-styleguides/SKILL.md +0 -0
  180. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/skills/translating-styleguides/references/llm-rule-patterns.md +0 -0
  181. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/skills/translating-styleguides/references/matcher-reference.md +0 -0
  182. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/skills/translating-styleguides/references/tier-rubric.md +0 -0
  183. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/snapshots/__init__.py +0 -0
  184. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/snapshots/client.py +0 -0
  185. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/snapshots/contracts.py +0 -0
  186. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/snapshots/review.py +0 -0
  187. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/snapshots/schema.py +0 -0
  188. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/snapshots/schemas/config.schema.json +0 -0
  189. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/snapshots/schemas/context.schema.json +0 -0
  190. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/snapshots/schemas/host-request.schema.json +0 -0
  191. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/snapshots/schemas/host-response.schema.json +0 -0
  192. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/snapshots/schemas/request.schema.json +0 -0
  193. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/snapshots/schemas/response.schema.json +0 -0
  194. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/snapshots/schemas/tool_registry.schema.json +0 -0
  195. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/snapshots/validation.py +0 -0
  196. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/snapshots/worker.py +0 -0
  197. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/state.py +0 -0
  198. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/style/__init__.py +0 -0
  199. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/style/ast_grep.py +0 -0
  200. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/style/matchers.py +0 -0
  201. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/style/scope.py +0 -0
  202. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/style/types.py +0 -0
  203. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/tasks.py +0 -0
  204. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/templates/example_hook.py.tmpl +0 -0
  205. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/testing/__init__.py +0 -0
  206. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/testing/fixtures.py +0 -0
  207. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/testing/session_cache.py +0 -0
  208. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/testing/snapshots.py +0 -0
  209. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/turn.py +0 -0
  210. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/types.py +0 -0
  211. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/update/__init__.py +0 -0
  212. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/update/settings.py +0 -0
  213. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/util/__init__.py +0 -0
  214. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/util/automode.py +0 -0
  215. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/util/caching.py +0 -0
  216. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/util/fs.py +0 -0
  217. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/util/globbing.py +0 -0
  218. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/util/http.py +0 -0
  219. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/util/model_cache.py +0 -0
  220. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/util/paths.py +0 -0
  221. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/util/payload.py +0 -0
  222. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/util/proc.py +0 -0
  223. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/util/reqenv.py +0 -0
  224. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/util/scratch.py +0 -0
  225. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/util/shell.py +0 -0
  226. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/util/text.py +0 -0
  227. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/util/userpath.py +0 -0
  228. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/util/vcs.py +0 -0
  229. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/worker/__init__.py +0 -0
  230. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/worker/__main__.py +0 -0
  231. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/worker/fail_open.py +0 -0
  232. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/worker/protocol.py +0 -0
  233. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/worker/runtime.py +0 -0
  234. {capt_hook-12.77.2 → capt_hook-12.78.1}/captain_hook/worker/service.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: capt-hook
3
- Version: 12.77.2
3
+ Version: 12.78.1
4
4
  Summary: Stop repeating yourself to Claude.
5
5
  Project-URL: Homepage, https://github.com/yasyf/captain-hook
6
6
  Project-URL: Documentation, https://yasyf.github.io/captain-hook/
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "captain-hook",
3
- "version": "12.77.0",
3
+ "version": "12.77.2",
4
4
  "displayName": "Captain Hook",
5
5
  "description": "Skills for the capt-hook declarative hook framework: bootstrap gates and nudges from a repo's conventions, and translate style guides into enforced StyleRules.",
6
6
  "author": {
@@ -142,10 +142,21 @@ class Signature:
142
142
  verbs: tuple[Verb, ...]
143
143
  lane_name: re.Pattern[str]
144
144
  window: timedelta | None = None
145
+ failures_only: bool = False
145
146
 
146
147
  def sourced(self, evt: BaseHookEvent) -> bool:
147
148
  return any(verb.ran(evt) for verb in self.verbs)
148
149
 
150
+ def refused_text(self, evt: BaseHookEvent) -> str:
151
+ if not self.failures_only:
152
+ return result_text(evt)
153
+ if isinstance(evt, PostToolUseFailureEvent):
154
+ return evt.error
155
+ match getattr(evt, "tool_response", None):
156
+ case {"stderr": str() as stderr}:
157
+ return stderr
158
+ return ""
159
+
149
160
  def expires(self, text: str) -> datetime | None:
150
161
  if found := RESET.search(text):
151
162
  return datetime.fromisoformat(found["at"])
@@ -192,6 +203,7 @@ SIGNATURES = (
192
203
  GITHUB_VERBS,
193
204
  re.compile(r"(?<![\w])(?:gh|github|graphql)-(?:quota|rate-limit)"),
194
205
  timedelta(hours=1),
206
+ failures_only=True,
195
207
  ),
196
208
  )
197
209
 
@@ -260,9 +272,8 @@ def excerpt(text: str, match: re.Match[str]) -> str:
260
272
 
261
273
 
262
274
  def refusal(evt: BaseHookEvent) -> tuple[str, Refusal] | None:
263
- text = result_text(evt)
264
275
  for signature in SIGNATURES:
265
- if signature.sourced(evt) and (found := signature.text.search(text)):
276
+ if signature.sourced(evt) and (found := signature.text.search(text := signature.refused_text(evt))):
266
277
  return signature.key, Refusal(
267
278
  tool=signature.tool,
268
279
  verbs=tuple(verb.text for verb in signature.verbs),
@@ -485,6 +496,12 @@ SLACK_REFUSED = ToolingRefusals(
485
496
  )
486
497
  }
487
498
  )
499
+ PR_236_BODY = (
500
+ "Context: The deterministic tooling-refusal path added in #234 blocked an unrelated cc-slack CLI\n"
501
+ "rebuild dispatch because its prompt included `ccx vcs worktree add`. The quota record came from\n"
502
+ '`ccx code read` printing an inline test containing "GitHub GraphQL quota exhausted"; a documentation\n'
503
+ "excerpt about `rate-limited until` produced another false record and blocked a PR watcher.\n"
504
+ )
488
505
  CC_SLACK_CLI_SYNC = (
489
506
  "You are cc-slack-cli-sync. Defect: every cc-slack CLI call from lanes now fails: the daemon runs a newer "
490
507
  "release than this CLI. Use a fresh worktree `ccx vcs worktree add cc-slack-cli-sync` if you need to build, "
@@ -514,15 +531,10 @@ CC_SLACK_CLI_SYNC = (
514
531
  Input(
515
532
  command="ccx vcs pr status 12",
516
533
  output="ccx: GitHub GraphQL quota exhausted; rate-limited until 2026-10-01T22:05:00Z",
517
- ): Warn(pattern="^`ccx` refused this action"),
518
- Input(
519
- command="gh pr view 12 --json state",
520
- output="GraphQL: API rate limit exceeded for user ID 1",
521
- ): Warn(pattern="`ccx: tooling-lane=github-quota`"),
534
+ ): Allow(),
522
535
  Input(
523
- command="ccx vcs pr status 12",
524
- output="ccx: GitHub GraphQL quota exhausted",
525
- state=[ToolingRefusals(lanes={"github-quota"})],
536
+ command="gh pr view 236 --repo yasyf/captain-hook --json body -q .body",
537
+ output=PR_236_BODY,
526
538
  ): Allow(),
527
539
  Input(
528
540
  command="ccx code read captain_hook/builtin_packs/general/hooks/tooling.py --section 400-415",
@@ -33,11 +33,13 @@ from captain_hook.loader import (
33
33
  )
34
34
  from captain_hook.log import setup_logging
35
35
  from captain_hook.packs import manager, plugins
36
+ from captain_hook.pause import pause, resume
36
37
  from captain_hook.review.cli import review
37
38
  from captain_hook.review.pipeline import DISPATCH_EVENTS, dispatch_review
38
39
  from captain_hook.session import SessionStore, cleanup_stale, ensure_session
39
40
  from captain_hook.types import TOOL_EVENTS, Event
40
41
  from captain_hook.update.cli import update
42
+ from captain_hook.update.launchers import dispatch_launcher_check
41
43
  from captain_hook.update.updater import dispatch_update
42
44
 
43
45
  if TYPE_CHECKING:
@@ -278,7 +280,13 @@ def dispatch_event(
278
280
  """
279
281
  from captain_hook.context import HookContext
280
282
  from captain_hook.heartbeat import record_heartbeat
281
- from captain_hook.transcripts import lane_transcript_path, lazy_transcript, registered_sources
283
+ from captain_hook.transcripts import (
284
+ ROOT_TAIL_EVENTS,
285
+ lane_transcript_path,
286
+ lazy_transcript,
287
+ registered_sources,
288
+ root_transcript,
289
+ )
282
290
  from captain_hook.util import reqenv
283
291
 
284
292
  record_heartbeat(event, raw)
@@ -293,11 +301,13 @@ def dispatch_event(
293
301
  attach=lambda: registered_sources(session_dir),
294
302
  )
295
303
  background_transcript = transcript.fork()
304
+ parent = raw.get("transcript_path")
296
305
  ctx = HookContext(
297
306
  session=SessionStore(session_dir),
298
307
  transcript=transcript,
299
308
  settings=_state.settings,
300
309
  project_root=root,
310
+ root_transcript=root_transcript(parent, ROOT_TAIL_EVENTS) if parent and resolved_path != parent else None,
301
311
  )
302
312
  evt = event.event_class(_raw=raw, ctx=ctx)
303
313
  within_margin = reqenv.deadline_within(SYNC_DEADLINE_MARGIN_SECONDS)
@@ -331,6 +341,11 @@ def after_reply(event: Event, evt: BaseHookEvent, raw: dict[str, Any], session_d
331
341
  except Exception as exc:
332
342
  logger.exception("native update dispatch failed")
333
343
  faults.record("update dispatch", exc, raw.get("cwd"))
344
+ try:
345
+ dispatch_launcher_check()
346
+ except Exception as exc:
347
+ logger.exception("native launcher check dispatch failed")
348
+ faults.record("launcher check dispatch", exc, raw.get("cwd"))
334
349
  try:
335
350
  cleanup_stale(exclude=SessionId(sid) if (sid := raw.get("session_id")) else None)
336
351
  except Exception:
@@ -1043,6 +1058,8 @@ def mcp() -> None:
1043
1058
  cli.add_command(review)
1044
1059
  cli.add_command(helper)
1045
1060
  cli.add_command(update)
1061
+ cli.add_command(pause)
1062
+ cli.add_command(resume)
1046
1063
 
1047
1064
 
1048
1065
  main = cli
@@ -94,6 +94,21 @@ def transcript_window(transcript: bool | int | Literal["recent", "full"]) -> int
94
94
  return events
95
95
 
96
96
 
97
+ def render_window(
98
+ transcript: Session | RemoteSession, *, window: int | None, tool_results: bool, budget: Budget | None
99
+ ) -> str:
100
+ from cc_transcript.render import Budget, render_turn
101
+
102
+ src = transcript if window is None else transcript.recent_messages(window)
103
+ if isinstance(src, RemoteSession):
104
+ return src.render(budget=budget or Budget(), tool_results=tool_results)
105
+ return "\n\n".join(
106
+ rendered
107
+ for turn in src.turns
108
+ if (rendered := render_turn(turn, budget=budget or Budget(), tool_results=tool_results))
109
+ )
110
+
111
+
97
112
  @dataclass(frozen=True)
98
113
  class HookEvidence:
99
114
  source_ref: str | None
@@ -109,13 +124,16 @@ class HookEvidence:
109
124
  class HookContext:
110
125
  """Runtime context injected into every hook event.
111
126
 
112
- Holds session state, the transcript ``Session``, settings, and LLM/CLI helpers.
127
+ Holds session state, the transcript ``Session``, settings, and LLM/CLI helpers. Inside a
128
+ subagent or teammate lane, ``transcript`` is the lane's own and ``root_transcript`` tails the
129
+ session that spawned it, where the user's own words live; it is ``None`` everywhere else.
113
130
  """
114
131
 
115
132
  session: SessionStore
116
133
  transcript: Session | RemoteSession | LazyTranscript
117
134
  settings: HooksSettings | None
118
135
  project_root: Path | None = None
136
+ root_transcript: Session | RemoteSession | LazyTranscript | None = None
119
137
  signal_evidence: dict[tuple[int | Literal["turn"], str, bool], tuple[str, ...]] = field(
120
138
  default_factory=dict, init=False
121
139
  )
@@ -238,16 +256,7 @@ class HookContext:
238
256
  tool_results: Render each tool result after its call, as ``result:`` or ``failed:``.
239
257
  budget: Character budgets for prose, tool calls and answer previews; ``None`` is cc-transcript's default.
240
258
  """
241
- from cc_transcript.render import Budget, render_turn
242
-
243
- src = self.t if window is None else self.t.recent_messages(window)
244
- if isinstance(src, RemoteSession):
245
- return src.render(budget=budget or Budget(), tool_results=tool_results)
246
- return "\n\n".join(
247
- rendered
248
- for turn in src.turns
249
- if (rendered := render_turn(turn, budget=budget or Budget(), tool_results=tool_results))
250
- )
259
+ return render_window(self.t, window=window, tool_results=tool_results, budget=budget)
251
260
 
252
261
  def transcript_block(
253
262
  self, *, window: int | None = RECENT_WINDOW, tool_results: bool = False, budget: Budget | None = None
@@ -257,6 +266,19 @@ class HookContext:
257
266
  return f'<transcript evidence="{self.t.evidence_ref}">\n{rendered}\n</transcript>'
258
267
  return f"<transcript>\n{rendered}\n</transcript>"
259
268
 
269
+ def root_transcript_block(
270
+ self, *, window: int | None = RECENT_WINDOW, tool_results: bool = False, budget: Budget | None = None
271
+ ) -> str:
272
+ """The lane's root session rendered like ``transcript_block`` as ``<root_transcript>``; empty outside a lane."""
273
+ from captain_hook.transcripts import LazyTranscript
274
+
275
+ if self.root_transcript is None:
276
+ return ""
277
+ root = self.root_transcript
278
+ src = root.resolve() if isinstance(root, LazyTranscript) else root
279
+ rendered = render_window(src, window=window, tool_results=tool_results, budget=budget)
280
+ return f"<root_transcript>\n{rendered}\n</root_transcript>"
281
+
260
282
  def call_cli(
261
283
  self,
262
284
  args: list[str],
@@ -453,16 +475,29 @@ class HookContext:
453
475
  tool_results: bool,
454
476
  budget: Budget | None = None,
455
477
  diff_text: str | None,
478
+ root_transcript: bool | int | Literal["recent", "full"] = False,
456
479
  ) -> str:
457
- window = transcript_window(transcript) if transcript else None
458
- block = self.transcript_block(window=window, tool_results=tool_results, budget=budget) if transcript else ""
480
+ block = "\n\n".join(
481
+ rendered
482
+ for rendered in (
483
+ self.root_transcript_block(
484
+ window=transcript_window(root_transcript), tool_results=tool_results, budget=budget
485
+ )
486
+ if root_transcript
487
+ else "",
488
+ self.transcript_block(window=transcript_window(transcript), tool_results=tool_results, budget=budget)
489
+ if transcript
490
+ else "",
491
+ )
492
+ if rendered
493
+ )
459
494
  match template:
460
495
  case Prompt():
461
496
  prompt = str(template.context("diff", diff_text))
462
- if not transcript:
497
+ if not block:
463
498
  return prompt
464
499
  return f"{block}\n\n<task>\n{prompt}\n</task>"
465
500
  case str():
466
- wrapped = f"{{transcript}}\n\n<task>\n{template}\n</task>" if transcript else template
501
+ wrapped = f"{{transcript}}\n\n<task>\n{template}\n</task>" if block else template
467
502
  body = wrapped.format(*args, **kwargs, transcript=block)
468
503
  return f"<diff>\n{diff_text}\n</diff>\n\n{body}" if diff_text is not None else body
@@ -15,6 +15,20 @@ GUARDED: str = (
15
15
  "|halt|poweroff|renice|tmux|softwareupdate|pmset|caffeinate|setsid|builtin|noglob|stdbuf|unbuffer|scr"
16
16
  "ipt|watch|parallel|chrt|ionice|taskset|arch|su|chroot|find)\\b"
17
17
  )
18
+ EXEMPT_HEADS: tuple[str, ...] = (
19
+ "cc-slack",
20
+ "ccn",
21
+ "cc-notes",
22
+ "cc-present",
23
+ "cc-transcript",
24
+ "cat",
25
+ "echo",
26
+ "grep",
27
+ "head",
28
+ "jq",
29
+ "tail",
30
+ "wc",
31
+ )
18
32
  FOLDS: dict[str, str] = {"\u0130": "i", "\u0131": "i", "\u017f": "s", "\u212a": "k"}
19
33
  KINDS: tuple[str, ...] = (
20
34
  "host-unavailable",
@@ -36,6 +50,11 @@ PASS_EXIT: int = 3
36
50
  GUARDED_WORD: re.Pattern[str] = re.compile(GUARDED, re.IGNORECASE | re.ASCII)
37
51
  QUOTING_CHARS: re.Pattern[str] = re.compile(QUOTING)
38
52
  FOLD_TABLE: dict[int, str] = str.maketrans(FOLDS)
53
+ ASSIGNMENT: re.Pattern[str] = re.compile("^[A-Za-z_][A-Za-z0-9_]*=")
54
+ LITERAL_HEAD: re.Pattern[str] = re.compile("[A-Za-z0-9_./~+-]+")
55
+ OPAQUE_SHELL: tuple[str, ...] = ("$(", "`", "<(", ">(")
56
+ SEGMENT_BREAKS: frozenset[str] = frozenset(";\n|()")
57
+ QUOTED_ESCAPES: frozenset[str] = frozenset('$`"\\\n')
39
58
 
40
59
 
41
60
  def names_guarded(text: str) -> bool:
@@ -57,6 +76,94 @@ def names_guarded_value(value: object) -> bool:
57
76
  return False
58
77
 
59
78
 
79
+ def first_party_command(tool_input: object) -> bool:
80
+ if not isinstance(tool_input, dict):
81
+ return False
82
+ command = cast(dict[object, object], tool_input).get("command")
83
+ if not isinstance(command, str):
84
+ return False
85
+ joined = command.replace("\\\n", "")
86
+ if any(opaque in joined for opaque in OPAQUE_SHELL):
87
+ return False
88
+ segments = shell_segments(command)
89
+ return segments is not None and all(exempt_segment(words) for words in segments)
90
+
91
+
92
+ def exempt_segment(words: list[tuple[str, str, bool]]) -> bool:
93
+ for raw, cooked, redirect in words:
94
+ if redirect:
95
+ return False
96
+ if ASSIGNMENT.match(raw) is None:
97
+ return LITERAL_HEAD.fullmatch(cooked) is not None and cooked.rpartition("/")[2] in EXEMPT_HEADS
98
+ return True
99
+
100
+
101
+ def shell_segments(command: str) -> list[list[tuple[str, str, bool]]] | None:
102
+ segments: list[list[tuple[str, str, bool]]] = [[]]
103
+ raw: list[str] = []
104
+ cooked: list[str] = []
105
+ started = redirect = after_redirect = False
106
+
107
+ def end_word() -> None:
108
+ nonlocal started, redirect
109
+ if started:
110
+ segments[-1].append(("".join(raw), "".join(cooked), redirect))
111
+ raw.clear()
112
+ cooked.clear()
113
+ started = redirect = False
114
+
115
+ index = 0
116
+ while index < len(command):
117
+ char = command[index]
118
+ redirecting = False
119
+ if char == "\\" and index + 1 == len(command):
120
+ raw.append(char)
121
+ cooked.append(char)
122
+ started = True
123
+ elif char == "\\":
124
+ index += 1
125
+ if command[index] != "\n":
126
+ raw.append(command[index - 1 : index + 1])
127
+ cooked.append(command[index])
128
+ started = True
129
+ elif char == "'":
130
+ end = command.find("'", index + 1)
131
+ if end < 0:
132
+ return None
133
+ raw.append(command[index : end + 1])
134
+ cooked.append(command[index + 1 : end])
135
+ started = True
136
+ index = end
137
+ elif char == '"':
138
+ end = index + 1
139
+ while end < len(command) and command[end] != '"':
140
+ escaped = command[end] == "\\" and end + 1 < len(command) and command[end + 1] in QUOTED_ESCAPES
141
+ end += escaped
142
+ if not (escaped and command[end] == "\n"):
143
+ cooked.append(command[end])
144
+ end += 1
145
+ if end == len(command):
146
+ return None
147
+ raw.append(command[index : end + 1])
148
+ started = True
149
+ index = end
150
+ elif char in " \t":
151
+ end_word()
152
+ elif char in SEGMENT_BREAKS or (char == "&" and not after_redirect and command[index + 1 : index + 2] != ">"):
153
+ end_word()
154
+ segments.append([])
155
+ else:
156
+ raw.append(char)
157
+ cooked.append(char)
158
+ started = True
159
+ redirecting = char in "<>"
160
+ redirect = redirect or redirecting
161
+ after_redirect = redirecting
162
+ index += 1
163
+ end_word()
164
+ return segments
165
+
166
+
60
167
  def mandatory(event: str, payload: bytes) -> bool:
61
168
  if event not in EVENTS:
62
169
  return False
@@ -67,6 +174,8 @@ def mandatory(event: str, payload: bytes) -> bool:
67
174
  if not isinstance(fields, dict):
68
175
  return False
69
176
  payload_fields = cast(dict[object, object], fields)
177
+ if payload_fields.get("tool_name") == "Bash" and first_party_command(payload_fields.get("tool_input")):
178
+ return False
70
179
  return names_guarded_value(payload_fields.get("tool_name")) or names_guarded_value(payload_fields.get("tool_input"))
71
180
 
72
181
 
@@ -0,0 +1,89 @@
1
+ """``capt-hook pause`` and ``capt-hook resume``: the sanctioned, self-expiring way to quiet every hook.
2
+
3
+ ``pause`` writes ``pause.json`` into the state dir with the expiry as epoch seconds. The signed host's
4
+ ``run`` client reads it before it opens a session to the daemon, so while it holds, every event of every
5
+ session — whichever plugin version it is pinned to — returns at once without dispatch, and a
6
+ ``SessionStart`` prints a banner naming the expiry. Nothing has to lift it: past ``until`` the host
7
+ ignores the file. The host also ignores a pause longer than :data:`MAX_PAUSE`.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ import json
13
+ import re
14
+ from datetime import datetime, timedelta
15
+ from pathlib import Path
16
+
17
+ import click
18
+
19
+ from captain_hook.util.fs import atomic_write, read_json
20
+ from captain_hook.util.paths import resolve_state_dir
21
+
22
+ PAUSE_FILE = "pause.json"
23
+ MAX_PAUSE = timedelta(hours=1)
24
+ DURATION = re.compile(r"(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?")
25
+
26
+
27
+ def pause_path() -> Path:
28
+ return resolve_state_dir() / PAUSE_FILE
29
+
30
+
31
+ def parse_duration(text: str) -> timedelta:
32
+ if not (match := DURATION.fullmatch(text.strip())) or not any(match.groups()):
33
+ raise click.BadParameter(f"{text!r} is not a duration like 30m, 1h, or 1h30m")
34
+ hours, minutes, seconds = (int(group or 0) for group in match.groups())
35
+ if not timedelta() < (span := timedelta(hours=hours, minutes=minutes, seconds=seconds)) <= MAX_PAUSE:
36
+ raise click.BadParameter(f"a pause lasts more than 0s and at most {format_span(MAX_PAUSE)}")
37
+ return span
38
+
39
+
40
+ def format_span(span: timedelta) -> str:
41
+ minutes, seconds = divmod(int(span.total_seconds()), 60)
42
+ hours, minutes = divmod(minutes, 60)
43
+ return "".join(f"{value}{unit}" for value, unit in ((hours, "h"), (minutes, "m"), (seconds, "s")) if value) or "0s"
44
+
45
+
46
+ def active_pause(now: datetime) -> tuple[datetime, str | None] | None:
47
+ match read_json(pause_path()):
48
+ case {"until": int(until), "reason": str() | None as reason} if (
49
+ timedelta() < (expiry := datetime.fromtimestamp(until).astimezone()) - now <= MAX_PAUSE
50
+ ):
51
+ return expiry, reason
52
+ case _:
53
+ return None
54
+
55
+
56
+ def describe(expiry: datetime, reason: str | None, now: datetime) -> str:
57
+ because = f" ({reason})" if reason else ""
58
+ return f"hooks paused until {expiry:%H:%M %Z}, {format_span(expiry - now)} from now{because}"
59
+
60
+
61
+ @click.command(name="pause")
62
+ @click.option(
63
+ "--for", "duration", default=None, help=f"How long to pause, like 30m or 1h30m (at most {format_span(MAX_PAUSE)})"
64
+ )
65
+ @click.option("--reason", default=None, help="Why, shown in the banner every new session prints")
66
+ @click.option("--status", is_flag=True, default=False, help="Show the pause in effect instead of setting one")
67
+ def pause(duration: str | None, reason: str | None, status: bool) -> None:
68
+ """Pause every capt-hook hook, guards included, for a while; it lifts by itself at expiry.
69
+
70
+ The one sanctioned way to quiet hooks: never edit the plugin cache. `capt-hook resume` lifts it early.
71
+ """
72
+ now = datetime.now().astimezone()
73
+ match status, duration:
74
+ case True, None:
75
+ click.echo(describe(*held, now) if (held := active_pause(now)) else "hooks are not paused")
76
+ case False, str():
77
+ expiry = now + parse_duration(duration)
78
+ atomic_write(pause_path(), json.dumps({"until": int(expiry.timestamp()), "reason": reason}))
79
+ click.echo(f"{describe(expiry, reason, now)}; `capt-hook resume` lifts it now")
80
+ case _:
81
+ raise click.UsageError("pass --for DURATION to pause, or --status alone to show the pause")
82
+
83
+
84
+ @click.command(name="resume")
85
+ def resume() -> None:
86
+ """Lift a ``capt-hook pause`` before it expires."""
87
+ held = active_pause(datetime.now().astimezone())
88
+ pause_path().unlink(missing_ok=True)
89
+ click.echo("hooks resumed" if held else "hooks were not paused")
@@ -87,6 +87,7 @@ def llm_evaluate[M: BaseModel](
87
87
  model: TModel = "small",
88
88
  agent: bool = False,
89
89
  transcript: bool | int | Literal["recent", "full"] = False,
90
+ root_transcript: bool | int | Literal["recent", "full"] = False,
90
91
  tool_results: bool = False,
91
92
  budget: Budget | None = None,
92
93
  diff: bool | str = False,
@@ -100,7 +101,9 @@ def llm_evaluate[M: BaseModel](
100
101
  attaches the transcript window and optional diff, then calls the backend — retrying up
101
102
  to ``retries`` times, feeding a schema validation failure back to the model on re-ask. Returns
102
103
  ``None`` on a skip; raises when the call still fails after the final retry, and at once when the
103
- backend rejects the model itself.
104
+ backend rejects the model itself. ``root_transcript`` takes a window like ``transcript`` and, when
105
+ the event fires inside a subagent or teammate lane, adds that window of the root session that
106
+ spawned the lane as ``<root_transcript>``, so a judge can read the user's words a lane never saw.
104
107
  """
105
108
  from cc_transcript.render import clip
106
109
 
@@ -144,6 +147,7 @@ def llm_evaluate[M: BaseModel](
144
147
  tool_results=tool_results,
145
148
  budget=budget,
146
149
  diff_text=None,
150
+ root_transcript=root_transcript,
147
151
  )
148
152
  asked = dispatched
149
153
  for attempt in count():
@@ -94,6 +94,7 @@ class StubbedContext(HookContext):
94
94
  transcript=ctx.transcript,
95
95
  settings=ctx.settings,
96
96
  project_root=ctx.project_root,
97
+ root_transcript=ctx.root_transcript,
97
98
  llm=llm or {},
98
99
  )
99
100
 
@@ -574,6 +575,12 @@ def input_to_event(
574
575
 
575
576
  evt.__dict__["disallowed_tools"] = frozenset(inp.disallowed_tools or ())
576
577
 
578
+ match inp.root_transcript:
579
+ case TranscriptFixture() as tf:
580
+ evt.ctx.root_transcript = fixture_session(tf.messages)
581
+ case Path() as p:
582
+ evt.ctx.root_transcript = fixture_transcript(p)
583
+
577
584
  evt.ctx = StubbedContext.wrapping(evt.ctx, inp.llm)
578
585
 
579
586
  return evt
@@ -180,6 +180,8 @@ class Input:
180
180
  transcript: Session history for transcript conditions — a path, a
181
181
  ``TranscriptFixture``, or a raw list of transcript-line dicts. A path
182
182
  also lands in the payload as ``evt.transcript_path``, on every event.
183
+ root_transcript: The root session a lane's event reads as ``evt.ctx.root_transcript``,
184
+ in any form ``transcript`` takes; pair it with ``agent_id``.
183
185
  tasks: The native task list read via ``evt.tasks``.
184
186
  background_tasks: Background-task mappings for the ``Stop``/``SubagentStop``
185
187
  payload, surfaced as ``evt.background_tasks`` — the shape that makes a
@@ -227,6 +229,7 @@ class Input:
227
229
  offset: int | None = None
228
230
  limit: int | None = None
229
231
  transcript: Path | TranscriptFixture | list[dict[str, Any]] | None = None
232
+ root_transcript: Path | TranscriptFixture | list[dict[str, Any]] | None = None
230
233
  tasks: list[dict[str, Any]] | None = None
231
234
  background_tasks: list[dict[str, Any]] | None = None
232
235
  llm: dict[str, Any] | None = None
@@ -236,12 +239,17 @@ class Input:
236
239
  env: dict[str, str] | None = None
237
240
 
238
241
  def __post_init__(self) -> None:
239
- match self.transcript:
240
- case list():
241
- object.__setattr__(self, "transcript", TranscriptFixture(self.transcript))
242
- case str():
243
- object.__setattr__(self, "transcript", Path(self.transcript))
244
- checks = FIELD_TYPES | {"file": (str, FileFixture), "transcript": (Path, TranscriptFixture)}
242
+ for name in ("transcript", "root_transcript"):
243
+ match getattr(self, name):
244
+ case list() as messages:
245
+ object.__setattr__(self, name, TranscriptFixture(messages))
246
+ case str() as path:
247
+ object.__setattr__(self, name, Path(path))
248
+ checks = FIELD_TYPES | {
249
+ "file": (str, FileFixture),
250
+ "transcript": (Path, TranscriptFixture),
251
+ "root_transcript": (Path, TranscriptFixture),
252
+ }
245
253
  for name, types in checks.items():
246
254
  if (value := getattr(self, name)) is not None and not isinstance(value, types):
247
255
  raise TypeError(
@@ -28,6 +28,7 @@ if TYPE_CHECKING:
28
28
  # A session id becomes a filesystem path component via ``ensure_session``; external callers (CLI, MCP)
29
29
  # must not smuggle path separators or traversal past that trust boundary.
30
30
  INVALID_SESSION_ID = re.compile(r"[/\\]|\x00|^\.\.?$")
31
+ ROOT_TAIL_EVENTS = 256
31
32
 
32
33
 
33
34
  def user_classifier(events: Sequence[TranscriptEvent], *, path: Path | None = None) -> UserClassifier:
@@ -316,6 +317,13 @@ def lazy_transcript(
316
317
  return LazyTranscript(TranscriptPins(load, partial(tail, path) if path else None), seed=True)
317
318
 
318
319
 
320
+ def root_transcript(path: str | Path, events: int) -> LazyTranscript:
321
+ """The newest ``events`` events of a lane's root session transcript, tailed on first touch."""
322
+ return LazyTranscript(
323
+ TranscriptPins(partial(guarded_load, path, lambda source: tail_transcript(source, events))), seed=True
324
+ )
325
+
326
+
319
327
  def guarded_load[S: Session | RemoteSession](path: str | Path | None, read: Callable[[str | Path | None], S]) -> S:
320
328
  from captain_hook.snapshots.client import EvidenceIncomplete
321
329
 
@@ -17,3 +17,14 @@ def run_hook(check_only: bool) -> None:
17
17
  from captain_hook.update.updater import run_update
18
18
 
19
19
  run_update(apply=not check_only)
20
+
21
+
22
+ @update.command(name="launchers")
23
+ def launchers() -> None:
24
+ """Restore any captain-hook plugin launcher (bin/hook) that differs from what its version shipped."""
25
+ from captain_hook.update.launchers import check_launchers
26
+
27
+ restored = check_launchers()
28
+ click.echo(
29
+ f"restored bin/hook in {', '.join(restored)}" if restored else "every checked launcher matches what shipped"
30
+ )