@event4u/agent-config 9.14.0 → 9.16.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 (287) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +118 -99
  3. package/README.md +8 -0
  4. package/dist/agent-src/commands/agents/audit.md +7 -7
  5. package/dist/agent-src/commands/agents/optimize.md +1 -1
  6. package/dist/agent-src/commands/analyze/reference-repo.md +1 -1
  7. package/dist/agent-src/commands/chat-history.md +1 -0
  8. package/dist/agent-src/commands/context.md +1 -0
  9. package/dist/agent-src/commands/council.md +1 -1
  10. package/dist/agent-src/commands/ghostwriter.md +1 -1
  11. package/dist/agent-src/commands/memory.md +2 -1
  12. package/dist/agent-src/commands/module.md +1 -0
  13. package/dist/agent-src/commands/optimize/agents-dir.md +1 -1
  14. package/dist/agent-src/commands/optimize/deep.md +5 -2
  15. package/dist/agent-src/commands/optimize/skills.md +5 -5
  16. package/dist/agent-src/commands/override.md +1 -0
  17. package/dist/agent-src/commands/prediction-pool.md +4 -4
  18. package/dist/agent-src/commands/research/deep.md +1 -1
  19. package/dist/agent-src/commands/roadmap.md +2 -1
  20. package/dist/agent-src/commands/rule-compliance-audit.md +1 -1
  21. package/dist/agent-src/commands/tdd.md +1 -0
  22. package/dist/agent-src/commands/tests.md +1 -0
  23. package/dist/agent-src/commands/upstream-contribute.md +5 -5
  24. package/dist/agent-src/commands/video/from-script.md +1 -1
  25. package/dist/agent-src/commands/video/from-song.md +1 -1
  26. package/dist/agent-src/commands/video/scene.md +1 -1
  27. package/dist/agent-src/commands/video/stitch.md +1 -1
  28. package/dist/agent-src/commands/video/storyboard.md +1 -1
  29. package/dist/agent-src/commands/worktree/create.md +2 -1
  30. package/dist/agent-src/contexts/augment-infrastructure.md +1 -1
  31. package/dist/agent-src/contexts/contracts/artifact-engagement-flow.md +5 -5
  32. package/dist/agent-src/contexts/contracts/command-suggestion-flow.md +3 -3
  33. package/dist/agent-src/contexts/contracts/emergency-triage-block.md +2 -2
  34. package/dist/agent-src/contexts/execution/roadmap-process-loop.md +4 -3
  35. package/dist/agent-src/contexts/execution/subagent-routing.md +19 -0
  36. package/dist/agent-src/contexts/override-system.md +1 -1
  37. package/dist/agent-src/ghostwriter/fictional-fixture-v1.md +1 -1
  38. package/dist/agent-src/rules/augment-edit-discipline.md +1 -1
  39. package/dist/agent-src/rules/autonomous-execution.md +2 -1
  40. package/dist/agent-src/rules/brand-consistency.md +1 -0
  41. package/dist/agent-src/rules/brand-source-of-truth.md +1 -0
  42. package/dist/agent-src/rules/code-comment-discipline.md +2 -0
  43. package/dist/agent-src/rules/communication-through-line.md +1 -0
  44. package/dist/agent-src/rules/content-quoting-floor.md +1 -0
  45. package/dist/agent-src/rules/cross-source-consistency.md +0 -1
  46. package/dist/agent-src/rules/downstream-changes.md +1 -0
  47. package/dist/agent-src/rules/external-code-graph-interop.md +1 -0
  48. package/dist/agent-src/rules/external-reference-deep-dive.md +1 -0
  49. package/dist/agent-src/rules/fast-path-marker-visibility.md +1 -0
  50. package/dist/agent-src/rules/finance-safety-floor.md +0 -1
  51. package/dist/agent-src/rules/icon-consistency.md +1 -0
  52. package/dist/agent-src/rules/image-likeness-and-rights.md +1 -0
  53. package/dist/agent-src/rules/improve-before-implement.md +1 -1
  54. package/dist/agent-src/rules/invite-challenge.md +1 -0
  55. package/dist/agent-src/rules/lethal-trifecta-guard.md +1 -0
  56. package/dist/agent-src/rules/low-impact-corpus-privacy-floor.md +1 -0
  57. package/dist/agent-src/rules/markdown-safe-codeblocks.md +1 -0
  58. package/dist/agent-src/rules/media-governance-routing.md +4 -3
  59. package/dist/agent-src/rules/media-sync-ground-truth.md +1 -0
  60. package/dist/agent-src/rules/no-attribution-footers.md +1 -0
  61. package/dist/agent-src/rules/no-decorative-emojis-in-git-surfaces.md +1 -0
  62. package/dist/agent-src/rules/no-pr-progress-comments.md +1 -0
  63. package/dist/agent-src/rules/onboarding-gate.md +1 -0
  64. package/dist/agent-src/rules/output-discipline.md +1 -0
  65. package/dist/agent-src/rules/prefer-enums-over-literals.md +1 -0
  66. package/dist/agent-src/rules/preservation-guard.md +1 -0
  67. package/dist/agent-src/rules/question-not-instruction.md +1 -0
  68. package/dist/agent-src/rules/roadmap-ci-steps-policy.md +1 -0
  69. package/dist/agent-src/rules/role-mode-adherence.md +1 -0
  70. package/dist/agent-src/rules/runtime-safety.md +1 -0
  71. package/dist/agent-src/rules/security-sensitive-stop.md +1 -0
  72. package/dist/agent-src/rules/session-canary.md +9 -2
  73. package/dist/agent-src/rules/source-confidentiality.md +1 -0
  74. package/dist/agent-src/rules/source-of-truth.md +1 -0
  75. package/dist/agent-src/rules/spreadsheet-source-quality.md +1 -0
  76. package/dist/agent-src/rules/think-before-action.md +1 -0
  77. package/dist/agent-src/rules/token-budget-discipline.md +1 -0
  78. package/dist/agent-src/rules/token-efficiency.md +1 -0
  79. package/dist/agent-src/rules/token-optimizer-maintenance.md +5 -5
  80. package/dist/agent-src/rules/tool-safety.md +1 -0
  81. package/dist/agent-src/rules/untrusted-input-defense.md +2 -0
  82. package/dist/agent-src/rules/user-interaction.md +1 -0
  83. package/dist/agent-src/rules/user-interrupt-priority.md +1 -0
  84. package/dist/agent-src/skills/adr-create/SKILL.md +1 -1
  85. package/dist/agent-src/skills/check-refs/SKILL.md +1 -1
  86. package/dist/agent-src/skills/competitive-positioning/SKILL.md +1 -1
  87. package/dist/agent-src/skills/condense-memory/SKILL.md +1 -1
  88. package/dist/agent-src/skills/context-authoring/SKILL.md +1 -1
  89. package/dist/agent-src/skills/copilot-agents-optimization/SKILL.md +1 -1
  90. package/dist/agent-src/skills/description-assist/SKILL.md +1 -1
  91. package/dist/agent-src/skills/github-ci/SKILL.md +1 -0
  92. package/dist/agent-src/skills/guideline-writing/SKILL.md +1 -1
  93. package/dist/agent-src/skills/lint-skills/SKILL.md +1 -1
  94. package/dist/agent-src/skills/readme-reviewer/SKILL.md +1 -1
  95. package/dist/agent-src/skills/roadmap-management/SKILL.md +8 -1
  96. package/dist/agent-src/skills/roadmap-writing/SKILL.md +1 -1
  97. package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +1 -1
  98. package/dist/agent-src/skills/skill-writing/SKILL.md +4 -4
  99. package/dist/agent-src/skills/token-optimizer/SKILL.md +4 -4
  100. package/dist/agent-src/skills/upstream-contribute/SKILL.md +6 -6
  101. package/dist/agent-src/skills/using-git-worktrees/SKILL.md +25 -0
  102. package/dist/agent-src/templates/AGENTS.md +1 -1
  103. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  104. package/dist/agent-src/templates/command.md +1 -1
  105. package/dist/agent-src/templates/copilot-instructions.md +3 -3
  106. package/dist/agent-src/templates/rule.md +2 -2
  107. package/dist/agent-src/templates/scripts/work_engine/orchestration.ts +1 -1
  108. package/dist/agent-src/templates/skill-archive-note.md +5 -5
  109. package/dist/agent-src/templates/skill.md +1 -1
  110. package/dist/cli/agent-config.js +66 -19
  111. package/dist/cli/agent-config.js.map +1 -1
  112. package/dist/cli/main.js +9 -4
  113. package/dist/cli/main.js.map +1 -1
  114. package/dist/cli/mcp/content.js +1 -1
  115. package/dist/cli/mcp/content.js.map +1 -1
  116. package/dist/cli/python/workspace_drive.js +2 -0
  117. package/dist/cli/python/workspace_drive.js.map +1 -1
  118. package/dist/cli/python/workspace_drive_health.js +2 -0
  119. package/dist/cli/python/workspace_drive_health.js.map +1 -1
  120. package/dist/cli/python/workspace_hosts.js +2 -0
  121. package/dist/cli/python/workspace_hosts.js.map +1 -1
  122. package/dist/cli/python/workspace_sessions.js +2 -0
  123. package/dist/cli/python/workspace_sessions.js.map +1 -1
  124. package/dist/cli/registry.js +1 -0
  125. package/dist/cli/registry.js.map +1 -1
  126. package/dist/cli-delegate/{chunk-A3HJ6NTI.js → chunk-63WSP6YZ.js} +2 -1
  127. package/dist/cli-delegate/{chunk-EJYIGZ3T.js → chunk-BKO2AZ7Z.js} +1 -1
  128. package/dist/cli-delegate/{chunk-GCVFLBP2.js → chunk-H574KOUH.js} +338 -494
  129. package/dist/cli-delegate/chunk-NXFWFAYV.js +339 -0
  130. package/dist/cli-delegate/{chunk-TEGJU2JX.js → chunk-ZXXJLL5K.js} +2 -2
  131. package/dist/cli-delegate/cmd_conformance.js +29 -23
  132. package/dist/cli-delegate/cmd_doctor.js +3 -3
  133. package/dist/cli-delegate/cmd_export.js +4 -4
  134. package/dist/cli-delegate/cmd_preflight.js +2 -2
  135. package/dist/cli-delegate/cmd_prune.js +4 -4
  136. package/dist/cli-delegate/cmd_settings_migrate.js +4 -4
  137. package/dist/cli-delegate/cmd_sync.js +4 -4
  138. package/dist/cli-delegate/cmd_uninstall.js +4 -4
  139. package/dist/cli-delegate/cmd_validate.js +4 -4
  140. package/dist/discovery/deprecation-report.md +1 -1
  141. package/dist/discovery/discovery-manifest.json +127 -95
  142. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  143. package/dist/discovery/discovery-manifest.summary.md +1 -1
  144. package/dist/discovery/orphan-report.md +1 -1
  145. package/dist/discovery/packs.json +2 -2
  146. package/dist/discovery/trust-report.md +1 -1
  147. package/dist/discovery/workspaces.json +2 -2
  148. package/dist/hooks/dispatch.js +729 -430
  149. package/dist/install/install.mjs +52 -11
  150. package/dist/install/rule_scope.js +18 -2
  151. package/dist/install/rule_scope.js.map +1 -1
  152. package/dist/mcp/registry-manifest.json +2 -2
  153. package/dist/mcp/server.json +2 -2
  154. package/dist/mcp/server.mjs +518 -411
  155. package/dist/router.json +1 -1
  156. package/dist/scripts/_lib/claude_settings_hooks.js +30 -5
  157. package/dist/scripts/_lib/claude_settings_hooks.js.map +1 -1
  158. package/dist/scripts/_lib/scoped_projection.js +223 -0
  159. package/dist/scripts/_lib/scoped_projection.js.map +1 -0
  160. package/dist/scripts/_lib/surface_tiers.js +125 -0
  161. package/dist/scripts/_lib/surface_tiers.js.map +1 -0
  162. package/dist/scripts/_lib/token_count.js +166 -0
  163. package/dist/scripts/_lib/token_count.js.map +1 -0
  164. package/dist/scripts/_lib/trigger_eval_floors.js +8 -0
  165. package/dist/scripts/_lib/trigger_eval_floors.js.map +1 -1
  166. package/dist/scripts/condense.js +139 -9
  167. package/dist/scripts/condense.js.map +1 -1
  168. package/dist/scripts/project_thin_rules.js +450 -0
  169. package/dist/scripts/project_thin_rules.js.map +1 -0
  170. package/dist/server/routes/workspace.js +3 -1
  171. package/dist/server/routes/workspace.js.map +1 -1
  172. package/dist/server/schemas/settings.js +9 -3
  173. package/dist/server/schemas/settings.js.map +1 -1
  174. package/dist/shared/userMd/utils.js +1 -1
  175. package/dist/shared/userMd/utils.js.map +1 -1
  176. package/dist/ui/assets/index-DmR0mbk4.js +26 -0
  177. package/dist/ui/assets/index-DmR0mbk4.js.map +1 -0
  178. package/dist/ui/index.html +1 -1
  179. package/docs/guidelines/agent-infra/roadmap-progress-mechanics.md +1 -1
  180. package/package.json +14 -14
  181. package/src/agent-src/templates/AGENTS.md +1 -1
  182. package/src/agent-src/templates/scripts/work_engine/orchestration.ts +1 -1
  183. package/src/config/agent-settings.template.yml +61 -11
  184. package/src/config/budget-routing.json +7 -0
  185. package/src/config/ci-local-parity.yml +8 -0
  186. package/src/config/discovery/unassigned-artefacts.yml +23 -25
  187. package/src/config/evaluator-budgets.json +35 -5
  188. package/src/config/gate-coverage.yml +147 -0
  189. package/src/config/gate-violation-baselines.json +25 -0
  190. package/src/install/rule_scope.ts +27 -2
  191. package/src/scripts/_cli/cmd_conformance.ts +13 -24
  192. package/src/scripts/_dispatch.bash +10 -0
  193. package/src/scripts/_lib/claude_settings_hooks.ts +30 -4
  194. package/src/scripts/_lib/gate_baseline.ts +213 -0
  195. package/src/scripts/_lib/scoped_projection.ts +50 -0
  196. package/src/scripts/_lib/tier_budget_routing.ts +360 -0
  197. package/src/scripts/_lib/tool_adapter_registry.ts +8 -1
  198. package/src/scripts/_lib/trigger_eval_floors.ts +9 -0
  199. package/src/scripts/_lib/trigger_routers.ts +17 -5
  200. package/src/scripts/adr/regenerate_index.ts +4 -3
  201. package/src/scripts/ai-video/lib/parse-blueprint.sh +1 -1
  202. package/src/scripts/ai_council/compile_corpus.ts +1 -1
  203. package/src/scripts/anchor_scoring_run.ts +1 -1
  204. package/src/scripts/audit_cloud_compatibility.ts +37 -2
  205. package/src/scripts/audit_initial_context.ts +53 -19
  206. package/src/scripts/audit_likelihood.ts +31 -2
  207. package/src/scripts/audit_user_type_axis.ts +58 -11
  208. package/src/scripts/bench_hook_latency.ts +172 -41
  209. package/src/scripts/bench_persona_placebo.ts +1 -1
  210. package/src/scripts/bench_quality_run.ts +1 -1
  211. package/src/scripts/build_mcp_catalog.ts +12 -1
  212. package/src/scripts/check_always_budget.ts +122 -11
  213. package/src/scripts/check_augment_description_cap.ts +24 -3
  214. package/src/scripts/check_ci_strict_superset.ts +150 -0
  215. package/src/scripts/check_cli_registry_budget_sync.ts +168 -0
  216. package/src/scripts/check_cluster_patterns.ts +100 -0
  217. package/src/scripts/check_consumer_scope_flip.ts +26 -4
  218. package/src/scripts/check_evaluator_budgets.ts +198 -19
  219. package/src/scripts/check_gate_coverage.ts +338 -2
  220. package/src/scripts/check_generator_output_coverage.ts +2 -1
  221. package/src/scripts/check_iron_law_prominence.ts +1 -1
  222. package/src/scripts/check_kernel_rule_bundle.ts +1 -1
  223. package/src/scripts/check_no_new_legacy_path.ts +167 -3
  224. package/src/scripts/check_pack_size.ts +18 -4
  225. package/src/scripts/check_portability.ts +37 -7
  226. package/src/scripts/check_references.ts +19 -3
  227. package/src/scripts/check_release_pr_shape.ts +13 -0
  228. package/src/scripts/check_token_quality_golden.ts +1 -1
  229. package/src/scripts/check_token_regression.ts +9 -2
  230. package/src/scripts/condense.ts +155 -12
  231. package/src/scripts/cost/budget.mjs +77 -2
  232. package/src/scripts/evaluator_umbrella.sh +34 -1
  233. package/src/scripts/generate_capability_matrix.ts +8 -0
  234. package/src/scripts/generate_router_coverage_from_matrix.ts +155 -0
  235. package/src/scripts/hook_manifest.yaml +17 -3
  236. package/src/scripts/hooks/block_config_weakening.ts +337 -0
  237. package/src/scripts/hooks/concern_registry.ts +2 -0
  238. package/src/scripts/hooks/probe_throttle.ts +75 -0
  239. package/src/scripts/install-hooks.sh +24 -2
  240. package/src/scripts/install.ts +2 -2
  241. package/src/scripts/lint_agents_md.ts +9 -3
  242. package/src/scripts/lint_archived_skills.ts +1 -1
  243. package/src/scripts/lint_artefact_frontmatter.ts +185 -37
  244. package/src/scripts/lint_command_routing.ts +21 -52
  245. package/src/scripts/lint_command_verbs.ts +47 -28
  246. package/src/scripts/lint_context_spine_usage.ts +38 -12
  247. package/src/scripts/lint_framework_leakage.ts +25 -6
  248. package/src/scripts/lint_handoffs.ts +49 -2
  249. package/src/scripts/lint_media_policy_linkage.ts +62 -30
  250. package/src/scripts/lint_namespace.ts +92 -7
  251. package/src/scripts/lint_new_skill_gate.ts +39 -31
  252. package/src/scripts/lint_originality_shingles.ts +7 -1
  253. package/src/scripts/lint_override_kernel_guard.ts +21 -3
  254. package/src/scripts/lint_pack_boundaries.ts +461 -91
  255. package/src/scripts/lint_pack_dependencies.ts +24 -57
  256. package/src/scripts/lint_persona_governance.ts +1 -1
  257. package/src/scripts/lint_role_experiences.ts +34 -5
  258. package/src/scripts/lint_trigger_precision.ts +142 -0
  259. package/src/scripts/mcp_server/consumer_tool_catalog.json +12 -201
  260. package/src/scripts/mcp_server/tools.ts +1 -1
  261. package/src/scripts/prepack-check.mjs +40 -1
  262. package/src/scripts/prepack_router_targets.d.mts +7 -0
  263. package/src/scripts/prepack_router_targets.mjs +93 -0
  264. package/src/scripts/print_required_checks.ts +72 -18
  265. package/src/scripts/profile_staleness_hook.ts +12 -0
  266. package/src/scripts/record_evaluator_measurements.mjs +105 -0
  267. package/src/scripts/recruit_preflight.sh +1 -1
  268. package/src/scripts/release.ts +214 -7
  269. package/src/scripts/router_target_paths.d.mts +4 -0
  270. package/src/scripts/router_target_paths.mjs +69 -0
  271. package/src/scripts/router_telemetry.ts +52 -1
  272. package/src/scripts/routing_doctor.ts +560 -0
  273. package/src/scripts/rule_trigger_eval.ts +403 -0
  274. package/src/scripts/schemas/rule.schema.json +5 -1
  275. package/src/scripts/session_canary_hook.ts +96 -5
  276. package/src/scripts/skill_linter.ts +9 -28
  277. package/src/scripts/smoke/skills.sh +1 -1
  278. package/src/scripts/sweep_dead_scan_roots.ts +356 -10
  279. package/src/scripts/trigger_coverage.ts +13 -2
  280. package/src/scripts/update_counts.ts +1 -1
  281. package/src/scripts/validate_telegraph_carveouts.ts +1 -1
  282. package/src/scripts/wrapper_freshness_hook.ts +14 -0
  283. package/src/server/schemas/settings.ts +19 -5
  284. package/src/shared/userMd/utils.ts +1 -1
  285. package/dist/cli-delegate/chunk-TJIAM5FW.js +0 -133
  286. package/dist/ui/assets/index-BpSQt5vm.js +0 -40
  287. package/dist/ui/assets/index-BpSQt5vm.js.map +0 -1
@@ -112,17 +112,17 @@ var require_visit = __commonJS({
112
112
  visit.BREAK = BREAK;
113
113
  visit.SKIP = SKIP;
114
114
  visit.REMOVE = REMOVE;
115
- function visit_(key, node, visitor, path40) {
116
- const ctrl = callVisitor(key, node, visitor, path40);
115
+ function visit_(key, node, visitor, path42) {
116
+ const ctrl = callVisitor(key, node, visitor, path42);
117
117
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
118
- replaceNode(key, path40, ctrl);
119
- return visit_(key, ctrl, visitor, path40);
118
+ replaceNode(key, path42, ctrl);
119
+ return visit_(key, ctrl, visitor, path42);
120
120
  }
121
121
  if (typeof ctrl !== "symbol") {
122
122
  if (identity.isCollection(node)) {
123
- path40 = Object.freeze(path40.concat(node));
123
+ path42 = Object.freeze(path42.concat(node));
124
124
  for (let i = 0; i < node.items.length; ++i) {
125
- const ci = visit_(i, node.items[i], visitor, path40);
125
+ const ci = visit_(i, node.items[i], visitor, path42);
126
126
  if (typeof ci === "number")
127
127
  i = ci - 1;
128
128
  else if (ci === BREAK)
@@ -133,13 +133,13 @@ var require_visit = __commonJS({
133
133
  }
134
134
  }
135
135
  } else if (identity.isPair(node)) {
136
- path40 = Object.freeze(path40.concat(node));
137
- const ck = visit_("key", node.key, visitor, path40);
136
+ path42 = Object.freeze(path42.concat(node));
137
+ const ck = visit_("key", node.key, visitor, path42);
138
138
  if (ck === BREAK)
139
139
  return BREAK;
140
140
  else if (ck === REMOVE)
141
141
  node.key = null;
142
- const cv = visit_("value", node.value, visitor, path40);
142
+ const cv = visit_("value", node.value, visitor, path42);
143
143
  if (cv === BREAK)
144
144
  return BREAK;
145
145
  else if (cv === REMOVE)
@@ -160,17 +160,17 @@ var require_visit = __commonJS({
160
160
  visitAsync.BREAK = BREAK;
161
161
  visitAsync.SKIP = SKIP;
162
162
  visitAsync.REMOVE = REMOVE;
163
- async function visitAsync_(key, node, visitor, path40) {
164
- const ctrl = await callVisitor(key, node, visitor, path40);
163
+ async function visitAsync_(key, node, visitor, path42) {
164
+ const ctrl = await callVisitor(key, node, visitor, path42);
165
165
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
166
- replaceNode(key, path40, ctrl);
167
- return visitAsync_(key, ctrl, visitor, path40);
166
+ replaceNode(key, path42, ctrl);
167
+ return visitAsync_(key, ctrl, visitor, path42);
168
168
  }
169
169
  if (typeof ctrl !== "symbol") {
170
170
  if (identity.isCollection(node)) {
171
- path40 = Object.freeze(path40.concat(node));
171
+ path42 = Object.freeze(path42.concat(node));
172
172
  for (let i = 0; i < node.items.length; ++i) {
173
- const ci = await visitAsync_(i, node.items[i], visitor, path40);
173
+ const ci = await visitAsync_(i, node.items[i], visitor, path42);
174
174
  if (typeof ci === "number")
175
175
  i = ci - 1;
176
176
  else if (ci === BREAK)
@@ -181,13 +181,13 @@ var require_visit = __commonJS({
181
181
  }
182
182
  }
183
183
  } else if (identity.isPair(node)) {
184
- path40 = Object.freeze(path40.concat(node));
185
- const ck = await visitAsync_("key", node.key, visitor, path40);
184
+ path42 = Object.freeze(path42.concat(node));
185
+ const ck = await visitAsync_("key", node.key, visitor, path42);
186
186
  if (ck === BREAK)
187
187
  return BREAK;
188
188
  else if (ck === REMOVE)
189
189
  node.key = null;
190
- const cv = await visitAsync_("value", node.value, visitor, path40);
190
+ const cv = await visitAsync_("value", node.value, visitor, path42);
191
191
  if (cv === BREAK)
192
192
  return BREAK;
193
193
  else if (cv === REMOVE)
@@ -214,23 +214,23 @@ var require_visit = __commonJS({
214
214
  }
215
215
  return visitor;
216
216
  }
217
- function callVisitor(key, node, visitor, path40) {
217
+ function callVisitor(key, node, visitor, path42) {
218
218
  if (typeof visitor === "function")
219
- return visitor(key, node, path40);
219
+ return visitor(key, node, path42);
220
220
  if (identity.isMap(node))
221
- return visitor.Map?.(key, node, path40);
221
+ return visitor.Map?.(key, node, path42);
222
222
  if (identity.isSeq(node))
223
- return visitor.Seq?.(key, node, path40);
223
+ return visitor.Seq?.(key, node, path42);
224
224
  if (identity.isPair(node))
225
- return visitor.Pair?.(key, node, path40);
225
+ return visitor.Pair?.(key, node, path42);
226
226
  if (identity.isScalar(node))
227
- return visitor.Scalar?.(key, node, path40);
227
+ return visitor.Scalar?.(key, node, path42);
228
228
  if (identity.isAlias(node))
229
- return visitor.Alias?.(key, node, path40);
229
+ return visitor.Alias?.(key, node, path42);
230
230
  return void 0;
231
231
  }
232
- function replaceNode(key, path40, node) {
233
- const parent = path40[path40.length - 1];
232
+ function replaceNode(key, path42, node) {
233
+ const parent = path42[path42.length - 1];
234
234
  if (identity.isCollection(parent)) {
235
235
  parent.items[key] = node;
236
236
  } else if (identity.isPair(parent)) {
@@ -840,10 +840,10 @@ var require_Collection = __commonJS({
840
840
  var createNode = require_createNode();
841
841
  var identity = require_identity();
842
842
  var Node = require_Node();
843
- function collectionFromPath(schema, path40, value) {
843
+ function collectionFromPath(schema, path42, value) {
844
844
  let v = value;
845
- for (let i = path40.length - 1; i >= 0; --i) {
846
- const k = path40[i];
845
+ for (let i = path42.length - 1; i >= 0; --i) {
846
+ const k = path42[i];
847
847
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
848
848
  const a = [];
849
849
  a[k] = v;
@@ -862,7 +862,7 @@ var require_Collection = __commonJS({
862
862
  sourceObjects: /* @__PURE__ */ new Map()
863
863
  });
864
864
  }
865
- var isEmptyPath = (path40) => path40 == null || typeof path40 === "object" && !!path40[Symbol.iterator]().next().done;
865
+ var isEmptyPath = (path42) => path42 == null || typeof path42 === "object" && !!path42[Symbol.iterator]().next().done;
866
866
  var Collection = class extends Node.NodeBase {
867
867
  constructor(type, schema) {
868
868
  super(type);
@@ -892,11 +892,11 @@ var require_Collection = __commonJS({
892
892
  * be a Pair instance or a `{ key, value }` object, which may not have a key
893
893
  * that already exists in the map.
894
894
  */
895
- addIn(path40, value) {
896
- if (isEmptyPath(path40))
895
+ addIn(path42, value) {
896
+ if (isEmptyPath(path42))
897
897
  this.add(value);
898
898
  else {
899
- const [key, ...rest] = path40;
899
+ const [key, ...rest] = path42;
900
900
  const node = this.get(key, true);
901
901
  if (identity.isCollection(node))
902
902
  node.addIn(rest, value);
@@ -910,8 +910,8 @@ var require_Collection = __commonJS({
910
910
  * Removes a value from the collection.
911
911
  * @returns `true` if the item was found and removed.
912
912
  */
913
- deleteIn(path40) {
914
- const [key, ...rest] = path40;
913
+ deleteIn(path42) {
914
+ const [key, ...rest] = path42;
915
915
  if (rest.length === 0)
916
916
  return this.delete(key);
917
917
  const node = this.get(key, true);
@@ -925,8 +925,8 @@ var require_Collection = __commonJS({
925
925
  * scalar values from their surrounding node; to disable set `keepScalar` to
926
926
  * `true` (collections are always returned intact).
927
927
  */
928
- getIn(path40, keepScalar) {
929
- const [key, ...rest] = path40;
928
+ getIn(path42, keepScalar) {
929
+ const [key, ...rest] = path42;
930
930
  const node = this.get(key, true);
931
931
  if (rest.length === 0)
932
932
  return !keepScalar && identity.isScalar(node) ? node.value : node;
@@ -944,8 +944,8 @@ var require_Collection = __commonJS({
944
944
  /**
945
945
  * Checks if the collection includes a value with the key `key`.
946
946
  */
947
- hasIn(path40) {
948
- const [key, ...rest] = path40;
947
+ hasIn(path42) {
948
+ const [key, ...rest] = path42;
949
949
  if (rest.length === 0)
950
950
  return this.has(key);
951
951
  const node = this.get(key, true);
@@ -955,8 +955,8 @@ var require_Collection = __commonJS({
955
955
  * Sets a value in this collection. For `!!set`, `value` needs to be a
956
956
  * boolean to add/remove the item from the set.
957
957
  */
958
- setIn(path40, value) {
959
- const [key, ...rest] = path40;
958
+ setIn(path42, value) {
959
+ const [key, ...rest] = path42;
960
960
  if (rest.length === 0) {
961
961
  this.set(key, value);
962
962
  } else {
@@ -3471,9 +3471,9 @@ var require_Document = __commonJS({
3471
3471
  this.contents.add(value);
3472
3472
  }
3473
3473
  /** Adds a value to the document. */
3474
- addIn(path40, value) {
3474
+ addIn(path42, value) {
3475
3475
  if (assertCollection(this.contents))
3476
- this.contents.addIn(path40, value);
3476
+ this.contents.addIn(path42, value);
3477
3477
  }
3478
3478
  /**
3479
3479
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -3548,14 +3548,14 @@ var require_Document = __commonJS({
3548
3548
  * Removes a value from the document.
3549
3549
  * @returns `true` if the item was found and removed.
3550
3550
  */
3551
- deleteIn(path40) {
3552
- if (Collection.isEmptyPath(path40)) {
3551
+ deleteIn(path42) {
3552
+ if (Collection.isEmptyPath(path42)) {
3553
3553
  if (this.contents == null)
3554
3554
  return false;
3555
3555
  this.contents = null;
3556
3556
  return true;
3557
3557
  }
3558
- return assertCollection(this.contents) ? this.contents.deleteIn(path40) : false;
3558
+ return assertCollection(this.contents) ? this.contents.deleteIn(path42) : false;
3559
3559
  }
3560
3560
  /**
3561
3561
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -3570,10 +3570,10 @@ var require_Document = __commonJS({
3570
3570
  * scalar values from their surrounding node; to disable set `keepScalar` to
3571
3571
  * `true` (collections are always returned intact).
3572
3572
  */
3573
- getIn(path40, keepScalar) {
3574
- if (Collection.isEmptyPath(path40))
3573
+ getIn(path42, keepScalar) {
3574
+ if (Collection.isEmptyPath(path42))
3575
3575
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
3576
- return identity.isCollection(this.contents) ? this.contents.getIn(path40, keepScalar) : void 0;
3576
+ return identity.isCollection(this.contents) ? this.contents.getIn(path42, keepScalar) : void 0;
3577
3577
  }
3578
3578
  /**
3579
3579
  * Checks if the document includes a value with the key `key`.
@@ -3584,10 +3584,10 @@ var require_Document = __commonJS({
3584
3584
  /**
3585
3585
  * Checks if the document includes a value at `path`.
3586
3586
  */
3587
- hasIn(path40) {
3588
- if (Collection.isEmptyPath(path40))
3587
+ hasIn(path42) {
3588
+ if (Collection.isEmptyPath(path42))
3589
3589
  return this.contents !== void 0;
3590
- return identity.isCollection(this.contents) ? this.contents.hasIn(path40) : false;
3590
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path42) : false;
3591
3591
  }
3592
3592
  /**
3593
3593
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -3604,13 +3604,13 @@ var require_Document = __commonJS({
3604
3604
  * Sets a value in this document. For `!!set`, `value` needs to be a
3605
3605
  * boolean to add/remove the item from the set.
3606
3606
  */
3607
- setIn(path40, value) {
3608
- if (Collection.isEmptyPath(path40)) {
3607
+ setIn(path42, value) {
3608
+ if (Collection.isEmptyPath(path42)) {
3609
3609
  this.contents = value;
3610
3610
  } else if (this.contents == null) {
3611
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path40), value);
3611
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path42), value);
3612
3612
  } else if (assertCollection(this.contents)) {
3613
- this.contents.setIn(path40, value);
3613
+ this.contents.setIn(path42, value);
3614
3614
  }
3615
3615
  }
3616
3616
  /**
@@ -3996,10 +3996,10 @@ var require_resolve_block_map = __commonJS({
3996
3996
  let offset = bm.offset;
3997
3997
  let commentEnd = null;
3998
3998
  for (const collItem of bm.items) {
3999
- const { start, key, sep: sep5, value } = collItem;
3999
+ const { start, key, sep: sep6, value } = collItem;
4000
4000
  const keyProps = resolveProps.resolveProps(start, {
4001
4001
  indicator: "explicit-key-ind",
4002
- next: key ?? sep5?.[0],
4002
+ next: key ?? sep6?.[0],
4003
4003
  offset,
4004
4004
  onError,
4005
4005
  parentIndent: bm.indent,
@@ -4013,7 +4013,7 @@ var require_resolve_block_map = __commonJS({
4013
4013
  else if ("indent" in key && key.indent !== bm.indent)
4014
4014
  onError(offset, "BAD_INDENT", startColMsg);
4015
4015
  }
4016
- if (!keyProps.anchor && !keyProps.tag && !sep5) {
4016
+ if (!keyProps.anchor && !keyProps.tag && !sep6) {
4017
4017
  commentEnd = keyProps.end;
4018
4018
  if (keyProps.comment) {
4019
4019
  if (map.comment)
@@ -4037,7 +4037,7 @@ var require_resolve_block_map = __commonJS({
4037
4037
  ctx.atKey = false;
4038
4038
  if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
4039
4039
  onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
4040
- const valueProps = resolveProps.resolveProps(sep5 ?? [], {
4040
+ const valueProps = resolveProps.resolveProps(sep6 ?? [], {
4041
4041
  indicator: "map-value-ind",
4042
4042
  next: value,
4043
4043
  offset: keyNode.range[2],
@@ -4053,7 +4053,7 @@ var require_resolve_block_map = __commonJS({
4053
4053
  if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
4054
4054
  onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
4055
4055
  }
4056
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep5, null, valueProps, onError);
4056
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep6, null, valueProps, onError);
4057
4057
  if (ctx.schema.compat)
4058
4058
  utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
4059
4059
  offset = valueNode.range[2];
@@ -4144,7 +4144,7 @@ var require_resolve_end = __commonJS({
4144
4144
  let comment = "";
4145
4145
  if (end) {
4146
4146
  let hasSpace = false;
4147
- let sep5 = "";
4147
+ let sep6 = "";
4148
4148
  for (const token of end) {
4149
4149
  const { source, type } = token;
4150
4150
  switch (type) {
@@ -4158,13 +4158,13 @@ var require_resolve_end = __commonJS({
4158
4158
  if (!comment)
4159
4159
  comment = cb;
4160
4160
  else
4161
- comment += sep5 + cb;
4162
- sep5 = "";
4161
+ comment += sep6 + cb;
4162
+ sep6 = "";
4163
4163
  break;
4164
4164
  }
4165
4165
  case "newline":
4166
4166
  if (comment)
4167
- sep5 += source;
4167
+ sep6 += source;
4168
4168
  hasSpace = true;
4169
4169
  break;
4170
4170
  default:
@@ -4207,18 +4207,18 @@ var require_resolve_flow_collection = __commonJS({
4207
4207
  let offset = fc.offset + fc.start.source.length;
4208
4208
  for (let i = 0; i < fc.items.length; ++i) {
4209
4209
  const collItem = fc.items[i];
4210
- const { start, key, sep: sep5, value } = collItem;
4210
+ const { start, key, sep: sep6, value } = collItem;
4211
4211
  const props = resolveProps.resolveProps(start, {
4212
4212
  flow: fcName,
4213
4213
  indicator: "explicit-key-ind",
4214
- next: key ?? sep5?.[0],
4214
+ next: key ?? sep6?.[0],
4215
4215
  offset,
4216
4216
  onError,
4217
4217
  parentIndent: fc.indent,
4218
4218
  startOnNewline: false
4219
4219
  });
4220
4220
  if (!props.found) {
4221
- if (!props.anchor && !props.tag && !sep5 && !value) {
4221
+ if (!props.anchor && !props.tag && !sep6 && !value) {
4222
4222
  if (i === 0 && props.comma)
4223
4223
  onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
4224
4224
  else if (i < fc.items.length - 1)
@@ -4272,8 +4272,8 @@ var require_resolve_flow_collection = __commonJS({
4272
4272
  }
4273
4273
  }
4274
4274
  }
4275
- if (!isMap && !sep5 && !props.found) {
4276
- const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep5, null, props, onError);
4275
+ if (!isMap && !sep6 && !props.found) {
4276
+ const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep6, null, props, onError);
4277
4277
  coll.items.push(valueNode);
4278
4278
  offset = valueNode.range[2];
4279
4279
  if (isBlock(value))
@@ -4285,7 +4285,7 @@ var require_resolve_flow_collection = __commonJS({
4285
4285
  if (isBlock(key))
4286
4286
  onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
4287
4287
  ctx.atKey = false;
4288
- const valueProps = resolveProps.resolveProps(sep5 ?? [], {
4288
+ const valueProps = resolveProps.resolveProps(sep6 ?? [], {
4289
4289
  flow: fcName,
4290
4290
  indicator: "map-value-ind",
4291
4291
  next: value,
@@ -4296,8 +4296,8 @@ var require_resolve_flow_collection = __commonJS({
4296
4296
  });
4297
4297
  if (valueProps.found) {
4298
4298
  if (!isMap && !props.found && ctx.options.strict) {
4299
- if (sep5)
4300
- for (const st of sep5) {
4299
+ if (sep6)
4300
+ for (const st of sep6) {
4301
4301
  if (st === valueProps.found)
4302
4302
  break;
4303
4303
  if (st.type === "newline") {
@@ -4314,7 +4314,7 @@ var require_resolve_flow_collection = __commonJS({
4314
4314
  else
4315
4315
  onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
4316
4316
  }
4317
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep5, null, valueProps, onError) : null;
4317
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep6, null, valueProps, onError) : null;
4318
4318
  if (valueNode) {
4319
4319
  if (isBlock(value))
4320
4320
  onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
@@ -4494,7 +4494,7 @@ var require_resolve_block_scalar = __commonJS({
4494
4494
  chompStart = i + 1;
4495
4495
  }
4496
4496
  let value = "";
4497
- let sep5 = "";
4497
+ let sep6 = "";
4498
4498
  let prevMoreIndented = false;
4499
4499
  for (let i = 0; i < contentStart; ++i)
4500
4500
  value += lines[i][0].slice(trimIndent) + "\n";
@@ -4511,24 +4511,24 @@ var require_resolve_block_scalar = __commonJS({
4511
4511
  indent = "";
4512
4512
  }
4513
4513
  if (type === Scalar.Scalar.BLOCK_LITERAL) {
4514
- value += sep5 + indent.slice(trimIndent) + content;
4515
- sep5 = "\n";
4514
+ value += sep6 + indent.slice(trimIndent) + content;
4515
+ sep6 = "\n";
4516
4516
  } else if (indent.length > trimIndent || content[0] === " ") {
4517
- if (sep5 === " ")
4518
- sep5 = "\n";
4519
- else if (!prevMoreIndented && sep5 === "\n")
4520
- sep5 = "\n\n";
4521
- value += sep5 + indent.slice(trimIndent) + content;
4522
- sep5 = "\n";
4517
+ if (sep6 === " ")
4518
+ sep6 = "\n";
4519
+ else if (!prevMoreIndented && sep6 === "\n")
4520
+ sep6 = "\n\n";
4521
+ value += sep6 + indent.slice(trimIndent) + content;
4522
+ sep6 = "\n";
4523
4523
  prevMoreIndented = true;
4524
4524
  } else if (content === "") {
4525
- if (sep5 === "\n")
4525
+ if (sep6 === "\n")
4526
4526
  value += "\n";
4527
4527
  else
4528
- sep5 = "\n";
4528
+ sep6 = "\n";
4529
4529
  } else {
4530
- value += sep5 + content;
4531
- sep5 = " ";
4530
+ value += sep6 + content;
4531
+ sep6 = " ";
4532
4532
  prevMoreIndented = false;
4533
4533
  }
4534
4534
  }
@@ -4710,25 +4710,25 @@ var require_resolve_flow_scalar = __commonJS({
4710
4710
  if (!match)
4711
4711
  return source;
4712
4712
  let res = match[1];
4713
- let sep5 = " ";
4713
+ let sep6 = " ";
4714
4714
  let pos = first.lastIndex;
4715
4715
  line.lastIndex = pos;
4716
4716
  while (match = line.exec(source)) {
4717
4717
  if (match[1] === "") {
4718
- if (sep5 === "\n")
4719
- res += sep5;
4718
+ if (sep6 === "\n")
4719
+ res += sep6;
4720
4720
  else
4721
- sep5 = "\n";
4721
+ sep6 = "\n";
4722
4722
  } else {
4723
- res += sep5 + match[1];
4724
- sep5 = " ";
4723
+ res += sep6 + match[1];
4724
+ sep6 = " ";
4725
4725
  }
4726
4726
  pos = line.lastIndex;
4727
4727
  }
4728
4728
  const last = /[ \t]*(.*)/sy;
4729
4729
  last.lastIndex = pos;
4730
4730
  match = last.exec(source);
4731
- return res + sep5 + (match?.[1] ?? "");
4731
+ return res + sep6 + (match?.[1] ?? "");
4732
4732
  }
4733
4733
  function doubleQuotedValue(source, onError) {
4734
4734
  let res = "";
@@ -5538,14 +5538,14 @@ var require_cst_stringify = __commonJS({
5538
5538
  }
5539
5539
  }
5540
5540
  }
5541
- function stringifyItem({ start, key, sep: sep5, value }) {
5541
+ function stringifyItem({ start, key, sep: sep6, value }) {
5542
5542
  let res = "";
5543
5543
  for (const st of start)
5544
5544
  res += st.source;
5545
5545
  if (key)
5546
5546
  res += stringifyToken(key);
5547
- if (sep5)
5548
- for (const st of sep5)
5547
+ if (sep6)
5548
+ for (const st of sep6)
5549
5549
  res += st.source;
5550
5550
  if (value)
5551
5551
  res += stringifyToken(value);
@@ -5570,9 +5570,9 @@ var require_cst_visit = __commonJS({
5570
5570
  visit.BREAK = BREAK;
5571
5571
  visit.SKIP = SKIP;
5572
5572
  visit.REMOVE = REMOVE;
5573
- visit.itemAtPath = (cst, path40) => {
5573
+ visit.itemAtPath = (cst, path42) => {
5574
5574
  let item = cst;
5575
- for (const [field, index] of path40) {
5575
+ for (const [field, index] of path42) {
5576
5576
  const tok = item?.[field];
5577
5577
  if (tok && "items" in tok) {
5578
5578
  item = tok.items[index];
@@ -5581,23 +5581,23 @@ var require_cst_visit = __commonJS({
5581
5581
  }
5582
5582
  return item;
5583
5583
  };
5584
- visit.parentCollection = (cst, path40) => {
5585
- const parent = visit.itemAtPath(cst, path40.slice(0, -1));
5586
- const field = path40[path40.length - 1][0];
5584
+ visit.parentCollection = (cst, path42) => {
5585
+ const parent = visit.itemAtPath(cst, path42.slice(0, -1));
5586
+ const field = path42[path42.length - 1][0];
5587
5587
  const coll = parent?.[field];
5588
5588
  if (coll && "items" in coll)
5589
5589
  return coll;
5590
5590
  throw new Error("Parent collection not found");
5591
5591
  };
5592
- function _visit(path40, item, visitor) {
5593
- let ctrl = visitor(item, path40);
5592
+ function _visit(path42, item, visitor) {
5593
+ let ctrl = visitor(item, path42);
5594
5594
  if (typeof ctrl === "symbol")
5595
5595
  return ctrl;
5596
5596
  for (const field of ["key", "value"]) {
5597
5597
  const token = item[field];
5598
5598
  if (token && "items" in token) {
5599
5599
  for (let i = 0; i < token.items.length; ++i) {
5600
- const ci = _visit(Object.freeze(path40.concat([[field, i]])), token.items[i], visitor);
5600
+ const ci = _visit(Object.freeze(path42.concat([[field, i]])), token.items[i], visitor);
5601
5601
  if (typeof ci === "number")
5602
5602
  i = ci - 1;
5603
5603
  else if (ci === BREAK)
@@ -5608,10 +5608,10 @@ var require_cst_visit = __commonJS({
5608
5608
  }
5609
5609
  }
5610
5610
  if (typeof ctrl === "function" && field === "key")
5611
- ctrl = ctrl(item, path40);
5611
+ ctrl = ctrl(item, path42);
5612
5612
  }
5613
5613
  }
5614
- return typeof ctrl === "function" ? ctrl(item, path40) : ctrl;
5614
+ return typeof ctrl === "function" ? ctrl(item, path42) : ctrl;
5615
5615
  }
5616
5616
  exports.visit = visit;
5617
5617
  }
@@ -6712,18 +6712,18 @@ var require_parser = __commonJS({
6712
6712
  if (this.type === "map-value-ind") {
6713
6713
  const prev = getPrevProps(this.peek(2));
6714
6714
  const start = getFirstKeyStartProps(prev);
6715
- let sep5;
6715
+ let sep6;
6716
6716
  if (scalar.end) {
6717
- sep5 = scalar.end;
6718
- sep5.push(this.sourceToken);
6717
+ sep6 = scalar.end;
6718
+ sep6.push(this.sourceToken);
6719
6719
  delete scalar.end;
6720
6720
  } else
6721
- sep5 = [this.sourceToken];
6721
+ sep6 = [this.sourceToken];
6722
6722
  const map = {
6723
6723
  type: "block-map",
6724
6724
  offset: scalar.offset,
6725
6725
  indent: scalar.indent,
6726
- items: [{ start, key: scalar, sep: sep5 }]
6726
+ items: [{ start, key: scalar, sep: sep6 }]
6727
6727
  };
6728
6728
  this.onKeyLine = true;
6729
6729
  this.stack[this.stack.length - 1] = map;
@@ -6876,15 +6876,15 @@ var require_parser = __commonJS({
6876
6876
  } else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
6877
6877
  const start2 = getFirstKeyStartProps(it.start);
6878
6878
  const key = it.key;
6879
- const sep5 = it.sep;
6880
- sep5.push(this.sourceToken);
6879
+ const sep6 = it.sep;
6880
+ sep6.push(this.sourceToken);
6881
6881
  delete it.key;
6882
6882
  delete it.sep;
6883
6883
  this.stack.push({
6884
6884
  type: "block-map",
6885
6885
  offset: this.offset,
6886
6886
  indent: this.indent,
6887
- items: [{ start: start2, key, sep: sep5 }]
6887
+ items: [{ start: start2, key, sep: sep6 }]
6888
6888
  });
6889
6889
  } else if (start.length > 0) {
6890
6890
  it.sep = it.sep.concat(start, this.sourceToken);
@@ -6913,14 +6913,14 @@ var require_parser = __commonJS({
6913
6913
  case "scalar":
6914
6914
  case "single-quoted-scalar":
6915
6915
  case "double-quoted-scalar": {
6916
- const fs39 = this.flowScalar(this.type);
6916
+ const fs41 = this.flowScalar(this.type);
6917
6917
  if (atNextItem || it.value) {
6918
- map.items.push({ start, key: fs39, sep: [] });
6918
+ map.items.push({ start, key: fs41, sep: [] });
6919
6919
  this.onKeyLine = true;
6920
6920
  } else if (it.sep) {
6921
- this.stack.push(fs39);
6921
+ this.stack.push(fs41);
6922
6922
  } else {
6923
- Object.assign(it, { key: fs39, sep: [] });
6923
+ Object.assign(it, { key: fs41, sep: [] });
6924
6924
  this.onKeyLine = true;
6925
6925
  }
6926
6926
  return;
@@ -7048,13 +7048,13 @@ var require_parser = __commonJS({
7048
7048
  case "scalar":
7049
7049
  case "single-quoted-scalar":
7050
7050
  case "double-quoted-scalar": {
7051
- const fs39 = this.flowScalar(this.type);
7051
+ const fs41 = this.flowScalar(this.type);
7052
7052
  if (!it || it.value)
7053
- fc.items.push({ start: [], key: fs39, sep: [] });
7053
+ fc.items.push({ start: [], key: fs41, sep: [] });
7054
7054
  else if (it.sep)
7055
- this.stack.push(fs39);
7055
+ this.stack.push(fs41);
7056
7056
  else
7057
- Object.assign(it, { key: fs39, sep: [] });
7057
+ Object.assign(it, { key: fs41, sep: [] });
7058
7058
  return;
7059
7059
  }
7060
7060
  case "flow-map-end":
@@ -7078,13 +7078,13 @@ var require_parser = __commonJS({
7078
7078
  const prev = getPrevProps(parent);
7079
7079
  const start = getFirstKeyStartProps(prev);
7080
7080
  fixFlowSeqItems(fc);
7081
- const sep5 = fc.end.splice(1, fc.end.length);
7082
- sep5.push(this.sourceToken);
7081
+ const sep6 = fc.end.splice(1, fc.end.length);
7082
+ sep6.push(this.sourceToken);
7083
7083
  const map = {
7084
7084
  type: "block-map",
7085
7085
  offset: fc.offset,
7086
7086
  indent: fc.indent,
7087
- items: [{ start, key: fc, sep: sep5 }]
7087
+ items: [{ start, key: fc, sep: sep6 }]
7088
7088
  };
7089
7089
  this.onKeyLine = true;
7090
7090
  this.stack[this.stack.length - 1] = map;
@@ -7363,15 +7363,15 @@ var require_dist = __commonJS({
7363
7363
  });
7364
7364
 
7365
7365
  // src/scripts/hooks/dispatch_entry.ts
7366
- import * as path39 from "node:path";
7367
- import { fileURLToPath as fileURLToPath30 } from "node:url";
7366
+ import * as path41 from "node:path";
7367
+ import { fileURLToPath as fileURLToPath31 } from "node:url";
7368
7368
 
7369
7369
  // src/scripts/hooks/dispatch_hook.ts
7370
7370
  var import_yaml6 = __toESM(require_dist(), 1);
7371
7371
  import { spawnSync as spawnSync5 } from "node:child_process";
7372
- import fs38 from "node:fs";
7373
- import path38 from "node:path";
7374
- import { fileURLToPath as fileURLToPath29, pathToFileURL as pathToFileURL25 } from "node:url";
7372
+ import fs40 from "node:fs";
7373
+ import path40 from "node:path";
7374
+ import { fileURLToPath as fileURLToPath30, pathToFileURL as pathToFileURL26 } from "node:url";
7375
7375
 
7376
7376
  // src/scripts/_lib/spawn_env.ts
7377
7377
  var DENY_EXACT = /* @__PURE__ */ new Set([
@@ -15882,9 +15882,45 @@ if (isCliEntry6) {
15882
15882
 
15883
15883
  // src/scripts/profile_staleness_hook.ts
15884
15884
  var import_yaml4 = __toESM(require_dist(), 1);
15885
+ import fs24 from "node:fs";
15886
+ import path23 from "node:path";
15887
+ import { fileURLToPath as fileURLToPath17, pathToFileURL as pathToFileURL14 } from "node:url";
15888
+
15889
+ // src/scripts/hooks/probe_throttle.ts
15885
15890
  import fs23 from "node:fs";
15886
15891
  import path22 from "node:path";
15887
- import { fileURLToPath as fileURLToPath17, pathToFileURL as pathToFileURL14 } from "node:url";
15892
+ var STATE_SUBDIR = ["agents", "runtime", "state", "probe-throttle"];
15893
+ function _stampPath(projectRoot, concern) {
15894
+ return path22.join(projectRoot, ...STATE_SUBDIR, `${concern}.stamp`);
15895
+ }
15896
+ function _localDay(d) {
15897
+ const y = d.getFullYear();
15898
+ const m = String(d.getMonth() + 1).padStart(2, "0");
15899
+ const day = String(d.getDate()).padStart(2, "0");
15900
+ return `${y}-${m}-${day}`;
15901
+ }
15902
+ function probeRanToday(projectRoot, concern) {
15903
+ if (is_replay_mode()) return false;
15904
+ try {
15905
+ const st = fs23.statSync(_stampPath(projectRoot, concern));
15906
+ return _localDay(st.mtime) === _localDay(/* @__PURE__ */ new Date());
15907
+ } catch {
15908
+ return false;
15909
+ }
15910
+ }
15911
+ function stampProbeRun(projectRoot, concern) {
15912
+ if (is_replay_mode()) return;
15913
+ try {
15914
+ const p = _stampPath(projectRoot, concern);
15915
+ fs23.mkdirSync(path22.dirname(p), { recursive: true });
15916
+ fs23.writeFileSync(p, `${(/* @__PURE__ */ new Date()).toISOString()}
15917
+ `);
15918
+ } catch {
15919
+ }
15920
+ }
15921
+
15922
+ // src/scripts/profile_staleness_hook.ts
15923
+ var THROTTLE_CONCERN = "profile-staleness";
15888
15924
  var OVERLAY_SECTION = "runtime";
15889
15925
  var OVERLAY_KEY = "active_packs";
15890
15926
  function _isObject2(v) {
@@ -15892,16 +15928,16 @@ function _isObject2(v) {
15892
15928
  }
15893
15929
  function _read_yaml2(p) {
15894
15930
  try {
15895
- if (!fs23.existsSync(p)) {
15931
+ if (!fs24.existsSync(p)) {
15896
15932
  return null;
15897
15933
  }
15898
- return (0, import_yaml4.parse)(fs23.readFileSync(p, "utf-8"), { version: "1.1" });
15934
+ return (0, import_yaml4.parse)(fs24.readFileSync(p, "utf-8"), { version: "1.1" });
15899
15935
  } catch {
15900
15936
  return null;
15901
15937
  }
15902
15938
  }
15903
15939
  function _overlay_path(repo_root) {
15904
- return path22.join(repo_root, ...LOCAL_PROJECT_SUBDIR, LOCAL_PROJECT_FILE);
15940
+ return path23.join(repo_root, ...LOCAL_PROJECT_SUBDIR, LOCAL_PROJECT_FILE);
15905
15941
  }
15906
15942
  function _read_overlay(repo_root) {
15907
15943
  const data = _read_yaml2(_overlay_path(repo_root));
@@ -15952,6 +15988,10 @@ function main16(argv) {
15952
15988
  const rootArg = _parseRoot(args);
15953
15989
  _readStdinIfNotTty();
15954
15990
  const root = rootArg !== null ? rootArg : _project_root();
15991
+ if (probeRanToday(root, THROTTLE_CONCERN)) {
15992
+ return 0;
15993
+ }
15994
+ stampProbeRun(root, THROTTLE_CONCERN);
15955
15995
  let notice;
15956
15996
  try {
15957
15997
  notice = _stale_notice(root);
@@ -15971,13 +16011,13 @@ function _isCliEntry13() {
15971
16011
  if (process.argv[1] === void 0) {
15972
16012
  return false;
15973
16013
  }
15974
- const argvUrl = pathToFileURL14(path22.resolve(process.argv[1])).href;
16014
+ const argvUrl = pathToFileURL14(path23.resolve(process.argv[1])).href;
15975
16015
  if (import.meta.url === argvUrl) {
15976
16016
  return true;
15977
16017
  }
15978
16018
  try {
15979
- const here = fs23.realpathSync(fileURLToPath17(import.meta.url));
15980
- const argv = fs23.realpathSync(path22.resolve(process.argv[1]));
16019
+ const here = fs24.realpathSync(fileURLToPath17(import.meta.url));
16020
+ const argv = fs24.realpathSync(path23.resolve(process.argv[1]));
15981
16021
  return here === argv;
15982
16022
  } catch {
15983
16023
  return false;
@@ -15989,21 +16029,21 @@ if (isCliEntry7) {
15989
16029
  }
15990
16030
 
15991
16031
  // src/scripts/wrapper_freshness_hook.ts
15992
- import fs25 from "node:fs";
15993
- import path24 from "node:path";
16032
+ import fs26 from "node:fs";
16033
+ import path25 from "node:path";
15994
16034
  import { fileURLToPath as fileURLToPath19, pathToFileURL as pathToFileURL15 } from "node:url";
15995
16035
 
15996
16036
  // src/scripts/_lib/cli_wrapper.ts
15997
- import fs24 from "node:fs";
15998
- import path23 from "node:path";
16037
+ import fs25 from "node:fs";
16038
+ import path24 from "node:path";
15999
16039
  import { fileURLToPath as fileURLToPath18 } from "node:url";
16000
- var _PACKAGE_ROOT = path23.resolve(
16001
- path23.dirname(fileURLToPath18(import.meta.url)),
16040
+ var _PACKAGE_ROOT = path24.resolve(
16041
+ path24.dirname(fileURLToPath18(import.meta.url)),
16002
16042
  "..",
16003
16043
  "..",
16004
16044
  ".."
16005
16045
  );
16006
- var _TEMPLATE = path23.join(
16046
+ var _TEMPLATE = path24.join(
16007
16047
  _PACKAGE_ROOT,
16008
16048
  "src",
16009
16049
  "templates",
@@ -16011,20 +16051,20 @@ var _TEMPLATE = path23.join(
16011
16051
  );
16012
16052
  function _is_file2(p) {
16013
16053
  try {
16014
- return fs24.statSync(p).isFile();
16054
+ return fs25.statSync(p).isFile();
16015
16055
  } catch {
16016
16056
  return false;
16017
16057
  }
16018
16058
  }
16019
16059
  function _target(project_root) {
16020
- return path23.join(project_root, "agent-config");
16060
+ return path24.join(project_root, "agent-config");
16021
16061
  }
16022
16062
  function needs_refresh(project_root) {
16023
16063
  if (!_is_file2(_TEMPLATE)) return false;
16024
16064
  const target = _target(project_root);
16025
16065
  if (!_is_file2(target)) return true;
16026
16066
  try {
16027
- return fs24.readFileSync(target, "utf-8") !== fs24.readFileSync(_TEMPLATE, "utf-8");
16067
+ return fs25.readFileSync(target, "utf-8") !== fs25.readFileSync(_TEMPLATE, "utf-8");
16028
16068
  } catch {
16029
16069
  return true;
16030
16070
  }
@@ -16032,12 +16072,13 @@ function needs_refresh(project_root) {
16032
16072
  function install_cli_wrapper(project_root) {
16033
16073
  if (!_is_file2(_TEMPLATE)) return null;
16034
16074
  const target = _target(project_root);
16035
- fs24.copyFileSync(_TEMPLATE, target);
16036
- fs24.chmodSync(target, 493);
16075
+ fs25.copyFileSync(_TEMPLATE, target);
16076
+ fs25.chmodSync(target, 493);
16037
16077
  return target;
16038
16078
  }
16039
16079
 
16040
16080
  // src/scripts/wrapper_freshness_hook.ts
16081
+ var THROTTLE_CONCERN2 = "wrapper-freshness";
16041
16082
  var EXIT_ALLOW2 = 0;
16042
16083
  function _project_root2() {
16043
16084
  const env = process.env["CLAUDE_PROJECT_DIR"] || process.env["AGENT_CONFIG_PROJECT_DIR"];
@@ -16048,37 +16089,37 @@ function _project_root2() {
16048
16089
  }
16049
16090
  function _isDir3(p) {
16050
16091
  try {
16051
- return fs25.statSync(p).isDirectory();
16092
+ return fs26.statSync(p).isDirectory();
16052
16093
  } catch {
16053
16094
  return false;
16054
16095
  }
16055
16096
  }
16056
16097
  function _isFile6(p) {
16057
16098
  try {
16058
- return fs25.statSync(p).isFile();
16099
+ return fs26.statSync(p).isFile();
16059
16100
  } catch {
16060
16101
  return false;
16061
16102
  }
16062
16103
  }
16063
16104
  function _is_source_repo(project_root) {
16064
- if (_isDir3(path24.join(project_root, "dist/agent-src"))) {
16105
+ if (_isDir3(path25.join(project_root, "dist/agent-src"))) {
16065
16106
  return true;
16066
16107
  }
16067
16108
  try {
16068
- const packagesDir = path24.join(project_root, "packages");
16109
+ const packagesDir = path25.join(project_root, "packages");
16069
16110
  if (_isDir3(packagesDir)) {
16070
- for (const entry of fs25.readdirSync(packagesDir)) {
16071
- if (_isDir3(path24.join(packagesDir, entry, ".agent-src.uncondensed"))) {
16111
+ for (const entry of fs26.readdirSync(packagesDir)) {
16112
+ if (_isDir3(path25.join(packagesDir, entry, ".agent-src.uncondensed"))) {
16072
16113
  return true;
16073
16114
  }
16074
16115
  }
16075
16116
  }
16076
16117
  } catch {
16077
16118
  }
16078
- const pkg = path24.join(project_root, "package.json");
16119
+ const pkg = path25.join(project_root, "package.json");
16079
16120
  if (_isFile6(pkg)) {
16080
16121
  try {
16081
- const data = JSON.parse(fs25.readFileSync(pkg, "utf-8"));
16122
+ const data = JSON.parse(fs26.readFileSync(pkg, "utf-8"));
16082
16123
  if (typeof data === "object" && data !== null && data["name"] === "@event4u/agent-config") {
16083
16124
  return true;
16084
16125
  }
@@ -16104,16 +16145,16 @@ function _parseRoot2(argv) {
16104
16145
  }
16105
16146
  var _PRECOMMIT_MARKER = "pre-commit-roadmap-progress";
16106
16147
  function _git_hooks_dir(root) {
16107
- const dotGit = path24.join(root, ".git");
16148
+ const dotGit = path25.join(root, ".git");
16108
16149
  if (_isDir3(dotGit)) {
16109
- return path24.join(dotGit, "hooks");
16150
+ return path25.join(dotGit, "hooks");
16110
16151
  }
16111
16152
  if (_isFile6(dotGit)) {
16112
16153
  try {
16113
- const m = /^gitdir:\s*(.+)\s*$/m.exec(fs25.readFileSync(dotGit, "utf-8"));
16154
+ const m = /^gitdir:\s*(.+)\s*$/m.exec(fs26.readFileSync(dotGit, "utf-8"));
16114
16155
  if (m && m[1] !== void 0) {
16115
- const gitDir = path24.isAbsolute(m[1]) ? m[1] : path24.join(root, m[1]);
16116
- return path24.join(gitDir, "hooks");
16156
+ const gitDir = path25.isAbsolute(m[1]) ? m[1] : path25.join(root, m[1]);
16157
+ return path25.join(gitDir, "hooks");
16117
16158
  }
16118
16159
  } catch {
16119
16160
  }
@@ -16122,8 +16163,8 @@ function _git_hooks_dir(root) {
16122
16163
  }
16123
16164
  function refresh_precommit_hook(root) {
16124
16165
  try {
16125
- const template = path24.join(
16126
- path24.resolve(path24.dirname(fileURLToPath19(import.meta.url)), "..", ".."),
16166
+ const template = path25.join(
16167
+ path25.resolve(path25.dirname(fileURLToPath19(import.meta.url)), "..", ".."),
16127
16168
  "dist",
16128
16169
  "agent-src",
16129
16170
  "templates",
@@ -16137,20 +16178,20 @@ function refresh_precommit_hook(root) {
16137
16178
  if (hooksDir === null) {
16138
16179
  return null;
16139
16180
  }
16140
- const target = path24.join(hooksDir, "pre-commit");
16181
+ const target = path25.join(hooksDir, "pre-commit");
16141
16182
  if (!_isFile6(target)) {
16142
16183
  return null;
16143
16184
  }
16144
- const current = fs25.readFileSync(target, "utf-8");
16185
+ const current = fs26.readFileSync(target, "utf-8");
16145
16186
  if (!current.includes(_PRECOMMIT_MARKER)) {
16146
16187
  return null;
16147
16188
  }
16148
- const canonical = fs25.readFileSync(template, "utf-8");
16189
+ const canonical = fs26.readFileSync(template, "utf-8");
16149
16190
  if (current === canonical) {
16150
16191
  return null;
16151
16192
  }
16152
- fs25.writeFileSync(target, canonical);
16153
- fs25.chmodSync(target, 493);
16193
+ fs26.writeFileSync(target, canonical);
16194
+ fs26.chmodSync(target, 493);
16154
16195
  return target;
16155
16196
  } catch {
16156
16197
  return null;
@@ -16161,6 +16202,10 @@ function main17(argv) {
16161
16202
  const rootArg = _parseRoot2(args);
16162
16203
  _readStdinIfNotTty2();
16163
16204
  const root = rootArg !== null ? rootArg : _project_root2();
16205
+ if (probeRanToday(root, THROTTLE_CONCERN2)) {
16206
+ return EXIT_ALLOW2;
16207
+ }
16208
+ stampProbeRun(root, THROTTLE_CONCERN2);
16164
16209
  let wrapper;
16165
16210
  try {
16166
16211
  if (_is_source_repo(root)) {
@@ -16173,7 +16218,7 @@ function main17(argv) {
16173
16218
  `
16174
16219
  );
16175
16220
  }
16176
- if (!_isFile6(path24.join(root, "agent-config"))) {
16221
+ if (!_isFile6(path25.join(root, "agent-config"))) {
16177
16222
  return EXIT_ALLOW2;
16178
16223
  }
16179
16224
  if (!needs_refresh(root)) {
@@ -16207,13 +16252,13 @@ function _isCliEntry14() {
16207
16252
  if (process.argv[1] === void 0) {
16208
16253
  return false;
16209
16254
  }
16210
- const argvUrl = pathToFileURL15(path24.resolve(process.argv[1])).href;
16255
+ const argvUrl = pathToFileURL15(path25.resolve(process.argv[1])).href;
16211
16256
  if (import.meta.url === argvUrl) {
16212
16257
  return true;
16213
16258
  }
16214
16259
  try {
16215
- const here = fs25.realpathSync(fileURLToPath19(import.meta.url));
16216
- const argv = fs25.realpathSync(path24.resolve(process.argv[1]));
16260
+ const here = fs26.realpathSync(fileURLToPath19(import.meta.url));
16261
+ const argv = fs26.realpathSync(path25.resolve(process.argv[1]));
16217
16262
  return here === argv;
16218
16263
  } catch {
16219
16264
  return false;
@@ -16226,9 +16271,9 @@ if (isCliEntry8) {
16226
16271
 
16227
16272
  // src/scripts/surface_probe_hook.ts
16228
16273
  var import_yaml5 = __toESM(require_dist(), 1);
16229
- import fs26 from "node:fs";
16274
+ import fs27 from "node:fs";
16230
16275
  import os2 from "node:os";
16231
- import path25 from "node:path";
16276
+ import path26 from "node:path";
16232
16277
  import { fileURLToPath as fileURLToPath20, pathToFileURL as pathToFileURL16 } from "node:url";
16233
16278
  var CHECK_WINDOW_MS = 24 * 60 * 60 * 1e3;
16234
16279
  var STATE_REL = ["agents", "runtime", "state", "surface-probe.json"];
@@ -16244,14 +16289,14 @@ function _package_root() {
16244
16289
  if (env) {
16245
16290
  return env;
16246
16291
  }
16247
- return path25.resolve(path25.dirname(fileURLToPath20(import.meta.url)), "..", "..");
16292
+ return path26.resolve(path26.dirname(fileURLToPath20(import.meta.url)), "..", "..");
16248
16293
  }
16249
16294
  function _readStdinIfNotTty3() {
16250
16295
  readHookStdin();
16251
16296
  }
16252
16297
  function _exists4(p) {
16253
16298
  try {
16254
- fs26.statSync(p);
16299
+ fs27.statSync(p);
16255
16300
  return true;
16256
16301
  } catch {
16257
16302
  return false;
@@ -16259,7 +16304,7 @@ function _exists4(p) {
16259
16304
  }
16260
16305
  function _auto_converge(global_settings_path) {
16261
16306
  try {
16262
- const raw = (0, import_yaml5.parse)(fs26.readFileSync(global_settings_path, "utf-8"), { version: "1.1" });
16307
+ const raw = (0, import_yaml5.parse)(fs27.readFileSync(global_settings_path, "utf-8"), { version: "1.1" });
16263
16308
  const install = raw?.["install"];
16264
16309
  if (install && typeof install === "object" && !Array.isArray(install)) {
16265
16310
  return install["auto_converge"] === true;
@@ -16269,11 +16314,11 @@ function _auto_converge(global_settings_path) {
16269
16314
  return false;
16270
16315
  }
16271
16316
  function _default_global_settings(home) {
16272
- return path25.join(home, ".event4u", "agent-config", "agent-settings.yml");
16317
+ return path26.join(home, ".event4u", "agent-config", "agent-settings.yml");
16273
16318
  }
16274
16319
  function _rate_limited(state_path, now_ms) {
16275
16320
  try {
16276
- const raw = JSON.parse(fs26.readFileSync(state_path, "utf-8"));
16321
+ const raw = JSON.parse(fs27.readFileSync(state_path, "utf-8"));
16277
16322
  const last = raw["last_check_utc"];
16278
16323
  if (typeof last === "number" && now_ms - last < CHECK_WINDOW_MS && last <= now_ms) {
16279
16324
  return true;
@@ -16284,17 +16329,17 @@ function _rate_limited(state_path, now_ms) {
16284
16329
  }
16285
16330
  function _stamp(state_path, now_ms) {
16286
16331
  try {
16287
- fs26.mkdirSync(path25.dirname(state_path), { recursive: true });
16288
- fs26.writeFileSync(state_path, `${JSON.stringify({ last_check_utc: now_ms })}
16332
+ fs27.mkdirSync(path26.dirname(state_path), { recursive: true });
16333
+ fs27.writeFileSync(state_path, `${JSON.stringify({ last_check_utc: now_ms })}
16289
16334
  `, "utf-8");
16290
16335
  } catch {
16291
16336
  }
16292
16337
  }
16293
16338
  function _detect(pkg_root, home) {
16294
- const matrix_path = path25.join(pkg_root, "src", "config", "surface-matrix.yml");
16339
+ const matrix_path = path26.join(pkg_root, "src", "config", "surface-matrix.yml");
16295
16340
  let tools = {};
16296
16341
  try {
16297
- const raw = (0, import_yaml5.parse)(fs26.readFileSync(matrix_path, "utf-8"), { version: "1.1" });
16342
+ const raw = (0, import_yaml5.parse)(fs27.readFileSync(matrix_path, "utf-8"), { version: "1.1" });
16298
16343
  const t = raw?.["tools"];
16299
16344
  if (t && typeof t === "object" && !Array.isArray(t)) {
16300
16345
  tools = t;
@@ -16302,7 +16347,7 @@ function _detect(pkg_root, home) {
16302
16347
  } catch {
16303
16348
  return [];
16304
16349
  }
16305
- const expand = (p) => p.startsWith("~/") ? path25.join(home, p.slice(2)) : path25.join(pkg_root, p);
16350
+ const expand = (p) => p.startsWith("~/") ? path26.join(home, p.slice(2)) : path26.join(pkg_root, p);
16306
16351
  const findings = [];
16307
16352
  for (const [tool_id, entry] of Object.entries(tools)) {
16308
16353
  if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
@@ -16336,7 +16381,7 @@ function main18(argv, opts = {}) {
16336
16381
  const home = opts.home ?? os2.homedir();
16337
16382
  const global_settings = opts.global_settings_path ?? _default_global_settings(home);
16338
16383
  const now_ms = opts.now_ms ?? Date.now();
16339
- const state_path = path25.join(project_root, ...STATE_REL);
16384
+ const state_path = path26.join(project_root, ...STATE_REL);
16340
16385
  if (_rate_limited(state_path, now_ms)) {
16341
16386
  return 0;
16342
16387
  }
@@ -16366,13 +16411,13 @@ function _isCliEntry15() {
16366
16411
  if (process.argv[1] === void 0) {
16367
16412
  return false;
16368
16413
  }
16369
- const argvUrl = pathToFileURL16(path25.resolve(process.argv[1])).href;
16414
+ const argvUrl = pathToFileURL16(path26.resolve(process.argv[1])).href;
16370
16415
  if (import.meta.url === argvUrl) {
16371
16416
  return true;
16372
16417
  }
16373
16418
  try {
16374
- const here = fs26.realpathSync(fileURLToPath20(import.meta.url));
16375
- const argv = fs26.realpathSync(path25.resolve(process.argv[1]));
16419
+ const here = fs27.realpathSync(fileURLToPath20(import.meta.url));
16420
+ const argv = fs27.realpathSync(path26.resolve(process.argv[1]));
16376
16421
  return here === argv;
16377
16422
  } catch {
16378
16423
  return false;
@@ -16383,19 +16428,19 @@ if (_isCliEntry15()) {
16383
16428
  }
16384
16429
 
16385
16430
  // src/scripts/team_review_gate_hook.ts
16386
- import fs28 from "node:fs";
16387
- import path28 from "node:path";
16431
+ import fs29 from "node:fs";
16432
+ import path29 from "node:path";
16388
16433
  import { fileURLToPath as fileURLToPath21, pathToFileURL as pathToFileURL17 } from "node:url";
16389
16434
 
16390
16435
  // src/scripts/ai_team/review_gate.ts
16391
16436
  import * as crypto from "node:crypto";
16392
- import * as fs27 from "node:fs";
16437
+ import * as fs28 from "node:fs";
16393
16438
  import * as os4 from "node:os";
16394
- import * as path27 from "node:path";
16439
+ import * as path28 from "node:path";
16395
16440
 
16396
16441
  // src/scripts/_lib/claude_plugin.ts
16397
16442
  import * as os3 from "node:os";
16398
- import * as path26 from "node:path";
16443
+ import * as path27 from "node:path";
16399
16444
  import process7 from "node:process";
16400
16445
  var CLAUDE_PLUGIN_ID = "agent-config";
16401
16446
  var CLAUDE_MARKETPLACE_NAME = "event4u-agent-config";
@@ -16413,7 +16458,7 @@ var CODEX_PLUGIN_INSTALL_HINT = [
16413
16458
  ];
16414
16459
  function claude_config_dir() {
16415
16460
  const env = (process7.env["CLAUDE_CONFIG_DIR"] ?? "").trim();
16416
- return env !== "" ? env : path26.join(os3.homedir(), ".claude");
16461
+ return env !== "" ? env : path27.join(os3.homedir(), ".claude");
16417
16462
  }
16418
16463
 
16419
16464
  // src/scripts/ai_team/config.ts
@@ -16552,7 +16597,7 @@ function load_ai_team_config(opts = {}) {
16552
16597
 
16553
16598
  // src/scripts/ai_team/review_gate.ts
16554
16599
  var GATE_STATE_BASENAME = "team-review-gate.json";
16555
- var GATE_LEDGER_RELPATH = path27.join("agents", "runtime", "team", "events.log");
16600
+ var GATE_LEDGER_RELPATH = path28.join("agents", "runtime", "team", "events.log");
16556
16601
  var GATE_LEDGER_KIND = "team.gate";
16557
16602
  var _KILL_SWITCH_ENV = "AGENT_CONFIG_NO_EVENTS_LOG";
16558
16603
  var _MAX_TRACKED_SESSIONS = 20;
@@ -16571,7 +16616,7 @@ function parse_gate_verdict(transcript_text) {
16571
16616
  return "UNKNOWN";
16572
16617
  }
16573
16618
  function gate_state_path(project_root) {
16574
- return path27.join(project_root, "agents", "runtime", "state", GATE_STATE_BASENAME);
16619
+ return path28.join(project_root, "agents", "runtime", "state", GATE_STATE_BASENAME);
16575
16620
  }
16576
16621
  function _safe_session(session_id) {
16577
16622
  const raw = (session_id ?? "").trim() || "unknown-session";
@@ -16581,7 +16626,7 @@ function _read_state(state_path) {
16581
16626
  const empty = { schema_version: 1, sessions: {} };
16582
16627
  let parsed;
16583
16628
  try {
16584
- parsed = JSON.parse(fs27.readFileSync(state_path, "utf-8"));
16629
+ parsed = JSON.parse(fs28.readFileSync(state_path, "utf-8"));
16585
16630
  } catch {
16586
16631
  return empty;
16587
16632
  }
@@ -16632,14 +16677,14 @@ function _iso_seconds_z(d) {
16632
16677
  return `${pad(d.getUTCFullYear(), 4)}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())}T${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}:${pad(d.getUTCSeconds())}Z`;
16633
16678
  }
16634
16679
  function gate_ledger_path(project_root) {
16635
- return path27.join(project_root, GATE_LEDGER_RELPATH);
16680
+ return path28.join(project_root, GATE_LEDGER_RELPATH);
16636
16681
  }
16637
16682
  function _append_ledger_line(target, entry) {
16638
16683
  if (_kill_switch_active()) {
16639
16684
  return false;
16640
16685
  }
16641
- fs27.mkdirSync(path27.dirname(target), { recursive: true });
16642
- fs27.appendFileSync(target, JSON.stringify(entry) + "\n", { encoding: "utf-8" });
16686
+ fs28.mkdirSync(path28.dirname(target), { recursive: true });
16687
+ fs28.appendFileSync(target, JSON.stringify(entry) + "\n", { encoding: "utf-8" });
16643
16688
  return true;
16644
16689
  }
16645
16690
  function format_gate_ledger_line(entry) {
@@ -16735,11 +16780,11 @@ var UPSTREAM_GATE_JOB_TITLE = "Codex Stop Gate Review";
16735
16780
  function _workspace_state_segment(workspace_root) {
16736
16781
  let canonical = workspace_root;
16737
16782
  try {
16738
- canonical = fs27.realpathSync.native(workspace_root);
16783
+ canonical = fs28.realpathSync.native(workspace_root);
16739
16784
  } catch {
16740
16785
  canonical = workspace_root;
16741
16786
  }
16742
- const slug_source = path27.basename(workspace_root) || "workspace";
16787
+ const slug_source = path28.basename(workspace_root) || "workspace";
16743
16788
  const slug = slug_source.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "workspace";
16744
16789
  const hash = crypto.createHash("sha256").update(canonical).digest("hex").slice(0, 16);
16745
16790
  return `${slug}-${hash}`;
@@ -16749,21 +16794,21 @@ function upstream_state_dir_candidates(workspace_root) {
16749
16794
  const candidates = [];
16750
16795
  const env = (process.env["CLAUDE_PLUGIN_DATA"] ?? "").trim();
16751
16796
  if (env !== "") {
16752
- candidates.push(path27.join(env, "state", segment));
16797
+ candidates.push(path28.join(env, "state", segment));
16753
16798
  }
16754
16799
  candidates.push(
16755
- path27.join(claude_config_dir(), "plugins", "data", _CODEX_PLUGIN_DATA_DIRNAME, "state", segment)
16800
+ path28.join(claude_config_dir(), "plugins", "data", _CODEX_PLUGIN_DATA_DIRNAME, "state", segment)
16756
16801
  );
16757
- candidates.push(path27.join(os4.tmpdir(), "codex-companion", segment));
16802
+ candidates.push(path28.join(os4.tmpdir(), "codex-companion", segment));
16758
16803
  return candidates;
16759
16804
  }
16760
16805
  function find_latest_gate_transcript(workspace_root, session_id) {
16761
16806
  let best = null;
16762
16807
  for (const dir of upstream_state_dir_candidates(workspace_root)) {
16763
- const jobs_dir = path27.join(dir, "jobs");
16808
+ const jobs_dir = path28.join(dir, "jobs");
16764
16809
  let names;
16765
16810
  try {
16766
- names = fs27.readdirSync(jobs_dir);
16811
+ names = fs28.readdirSync(jobs_dir);
16767
16812
  } catch {
16768
16813
  continue;
16769
16814
  }
@@ -16773,7 +16818,7 @@ function find_latest_gate_transcript(workspace_root, session_id) {
16773
16818
  }
16774
16819
  let job;
16775
16820
  try {
16776
- job = JSON.parse(fs27.readFileSync(path27.join(jobs_dir, name), "utf-8"));
16821
+ job = JSON.parse(fs28.readFileSync(path28.join(jobs_dir, name), "utf-8"));
16777
16822
  } catch {
16778
16823
  continue;
16779
16824
  }
@@ -16912,13 +16957,13 @@ function _isCliEntry16() {
16912
16957
  if (process.argv[1] === void 0) {
16913
16958
  return false;
16914
16959
  }
16915
- const argvUrl = pathToFileURL17(path28.resolve(process.argv[1])).href;
16960
+ const argvUrl = pathToFileURL17(path29.resolve(process.argv[1])).href;
16916
16961
  if (import.meta.url === argvUrl) {
16917
16962
  return true;
16918
16963
  }
16919
16964
  try {
16920
- const here = fs28.realpathSync(fileURLToPath21(import.meta.url));
16921
- const argv = fs28.realpathSync(path28.resolve(process.argv[1]));
16965
+ const here = fs29.realpathSync(fileURLToPath21(import.meta.url));
16966
+ const argv = fs29.realpathSync(path29.resolve(process.argv[1]));
16922
16967
  return here === argv;
16923
16968
  } catch {
16924
16969
  return false;
@@ -16929,8 +16974,8 @@ if (_isCliEntry16()) {
16929
16974
  }
16930
16975
 
16931
16976
  // src/scripts/pr_url_reminder_hook.ts
16932
- import fs29 from "node:fs";
16933
- import path29 from "node:path";
16977
+ import fs30 from "node:fs";
16978
+ import path30 from "node:path";
16934
16979
  import { fileURLToPath as fileURLToPath22, pathToFileURL as pathToFileURL18 } from "node:url";
16935
16980
  var EXIT_ALLOW3 = 0;
16936
16981
  var EXIT_WARN2 = 2;
@@ -17032,13 +17077,13 @@ function _isCliEntry17() {
17032
17077
  if (process.argv[1] === void 0) {
17033
17078
  return false;
17034
17079
  }
17035
- const argvUrl = pathToFileURL18(path29.resolve(process.argv[1])).href;
17080
+ const argvUrl = pathToFileURL18(path30.resolve(process.argv[1])).href;
17036
17081
  if (import.meta.url === argvUrl) {
17037
17082
  return true;
17038
17083
  }
17039
17084
  try {
17040
- const here = fs29.realpathSync(fileURLToPath22(import.meta.url));
17041
- const argv = fs29.realpathSync(path29.resolve(process.argv[1]));
17085
+ const here = fs30.realpathSync(fileURLToPath22(import.meta.url));
17086
+ const argv = fs30.realpathSync(path30.resolve(process.argv[1]));
17042
17087
  return here === argv;
17043
17088
  } catch {
17044
17089
  return false;
@@ -17049,8 +17094,8 @@ if (_isCliEntry17()) {
17049
17094
  }
17050
17095
 
17051
17096
  // src/scripts/session_canary_hook.ts
17052
- import fs30 from "node:fs";
17053
- import path30 from "node:path";
17097
+ import fs31 from "node:fs";
17098
+ import path31 from "node:path";
17054
17099
  import { fileURLToPath as fileURLToPath23, pathToFileURL as pathToFileURL19 } from "node:url";
17055
17100
  var EXIT_ALLOW4 = 0;
17056
17101
  var SETTINGS_FILE5 = ".agent-settings.yml";
@@ -17060,10 +17105,10 @@ function _isObject5(v) {
17060
17105
  function read_canary_name(settings_path) {
17061
17106
  let text;
17062
17107
  try {
17063
- if (!fs30.statSync(settings_path).isFile()) {
17108
+ if (!fs31.statSync(settings_path).isFile()) {
17064
17109
  return null;
17065
17110
  }
17066
- text = fs30.readFileSync(settings_path, "utf-8");
17111
+ text = fs31.readFileSync(settings_path, "utf-8");
17067
17112
  } catch {
17068
17113
  return null;
17069
17114
  }
@@ -17085,6 +17130,59 @@ function read_canary_name(settings_path) {
17085
17130
  }
17086
17131
  return null;
17087
17132
  }
17133
+ function read_identity_name(user_yml_path) {
17134
+ let text;
17135
+ try {
17136
+ if (!fs31.statSync(user_yml_path).isFile()) {
17137
+ return null;
17138
+ }
17139
+ text = fs31.readFileSync(user_yml_path, "utf-8");
17140
+ } catch {
17141
+ return null;
17142
+ }
17143
+ let in_identity = false;
17144
+ for (const line of text.split(/\r?\n/)) {
17145
+ if (/^identity\s*:\s*(?:#.*)?$/.test(line)) {
17146
+ in_identity = true;
17147
+ continue;
17148
+ }
17149
+ if (in_identity && /^\S/.test(line)) {
17150
+ in_identity = false;
17151
+ }
17152
+ if (in_identity) {
17153
+ const m = /^\s+name\s*:\s*(.*?)\s*(?:#.*)?$/.exec(line);
17154
+ if (m && m[1] !== void 0) {
17155
+ return m[1].trim();
17156
+ }
17157
+ }
17158
+ }
17159
+ return null;
17160
+ }
17161
+ function resolve_canary_name(workspace_root) {
17162
+ const project = sanitize_name(
17163
+ read_canary_name(path31.join(workspace_root, SETTINGS_FILE5))
17164
+ );
17165
+ if (project) {
17166
+ return { name: project, layer: "project override" };
17167
+ }
17168
+ const global_settings = resolve_with_fallback(
17169
+ path31.join("settings", ".agent-settings.yml")
17170
+ );
17171
+ if (global_settings) {
17172
+ const name = sanitize_name(read_canary_name(global_settings));
17173
+ if (name) {
17174
+ return { name, layer: "user-global settings" };
17175
+ }
17176
+ }
17177
+ const global_user = resolve_with_fallback(path31.join("settings", ".agent-user.yml"));
17178
+ if (global_user) {
17179
+ const name = sanitize_name(read_identity_name(global_user));
17180
+ if (name) {
17181
+ return { name, layer: "user-global identity" };
17182
+ }
17183
+ }
17184
+ return { name: "", layer: "none" };
17185
+ }
17088
17186
  function sanitize_name(raw) {
17089
17187
  if (raw === null) {
17090
17188
  return "";
@@ -17126,14 +17224,14 @@ function main21() {
17126
17224
  return EXIT_ALLOW4;
17127
17225
  }
17128
17226
  const root = _workspaceRoot(env);
17129
- const name = sanitize_name(read_canary_name(path30.join(root, SETTINGS_FILE5)));
17227
+ const { name, layer } = resolve_canary_name(root);
17130
17228
  if (!name) {
17131
17229
  return EXIT_ALLOW4;
17132
17230
  }
17133
17231
  process.stdout.write(
17134
17232
  `${JSON.stringify({
17135
17233
  decision: "allow",
17136
- reason: `session-canary: active for "${name}"`,
17234
+ reason: `session-canary: active for "${name}" (${layer})`,
17137
17235
  context: build_canary_block(name)
17138
17236
  })}
17139
17237
  `
@@ -17150,13 +17248,13 @@ function _isCliEntry18() {
17150
17248
  if (process.argv[1] === void 0) {
17151
17249
  return false;
17152
17250
  }
17153
- const argvUrl = pathToFileURL19(path30.resolve(process.argv[1])).href;
17251
+ const argvUrl = pathToFileURL19(path31.resolve(process.argv[1])).href;
17154
17252
  if (import.meta.url === argvUrl) {
17155
17253
  return true;
17156
17254
  }
17157
17255
  try {
17158
- const here = fs30.realpathSync(fileURLToPath23(import.meta.url));
17159
- const argv = fs30.realpathSync(path30.resolve(process.argv[1]));
17256
+ const here = fs31.realpathSync(fileURLToPath23(import.meta.url));
17257
+ const argv = fs31.realpathSync(path31.resolve(process.argv[1]));
17160
17258
  return here === argv;
17161
17259
  } catch {
17162
17260
  return false;
@@ -17167,9 +17265,9 @@ if (_isCliEntry18()) {
17167
17265
  }
17168
17266
 
17169
17267
  // src/scripts/hooks/block_no_verify.ts
17170
- import * as fs31 from "node:fs";
17268
+ import * as fs32 from "node:fs";
17171
17269
  import { fileURLToPath as fileURLToPath24, pathToFileURL as pathToFileURL20 } from "node:url";
17172
- import * as path31 from "node:path";
17270
+ import * as path32 from "node:path";
17173
17271
  var _HERE3 = fileURLToPath24(import.meta.url);
17174
17272
  var _SHELL_SEPARATORS = /* @__PURE__ */ new Set(["&&", "||", ";", "|"]);
17175
17273
  var _NO_VERIFY_FLAGS = /* @__PURE__ */ new Set(["--no-verify"]);
@@ -17538,13 +17636,13 @@ function _isCliEntry19() {
17538
17636
  if (process.argv[1] === void 0) {
17539
17637
  return false;
17540
17638
  }
17541
- const argvUrl = pathToFileURL20(path31.resolve(process.argv[1])).href;
17639
+ const argvUrl = pathToFileURL20(path32.resolve(process.argv[1])).href;
17542
17640
  if (import.meta.url === argvUrl) {
17543
17641
  return true;
17544
17642
  }
17545
17643
  try {
17546
- const here = fs31.realpathSync(fileURLToPath24(import.meta.url));
17547
- const argv = fs31.realpathSync(path31.resolve(process.argv[1]));
17644
+ const here = fs32.realpathSync(fileURLToPath24(import.meta.url));
17645
+ const argv = fs32.realpathSync(path32.resolve(process.argv[1]));
17548
17646
  return here === argv;
17549
17647
  } catch {
17550
17648
  return false;
@@ -17555,9 +17653,9 @@ if (_isCliEntry19() || false) {
17555
17653
  }
17556
17654
 
17557
17655
  // src/scripts/hooks/block_kernel_rule_writes.ts
17558
- import * as fs32 from "node:fs";
17656
+ import * as fs33 from "node:fs";
17559
17657
  import { fileURLToPath as fileURLToPath25, pathToFileURL as pathToFileURL21 } from "node:url";
17560
- import * as path32 from "node:path";
17658
+ import * as path33 from "node:path";
17561
17659
 
17562
17660
  // src/scripts/_lib/kernel_rules.ts
17563
17661
  var KERNEL_RULE_IDS = [
@@ -17673,7 +17771,7 @@ function _bash_targets_kernel_rule(command) {
17673
17771
  continue;
17674
17772
  }
17675
17773
  if (prevWasSeparator && !tok.startsWith("-")) {
17676
- verbs.add(path32.basename(tok));
17774
+ verbs.add(path33.basename(tok));
17677
17775
  prevWasSeparator = false;
17678
17776
  }
17679
17777
  }
@@ -17779,13 +17877,13 @@ function _isCliEntry20() {
17779
17877
  if (process.argv[1] === void 0) {
17780
17878
  return false;
17781
17879
  }
17782
- const argvUrl = pathToFileURL21(path32.resolve(process.argv[1])).href;
17880
+ const argvUrl = pathToFileURL21(path33.resolve(process.argv[1])).href;
17783
17881
  if (import.meta.url === argvUrl) {
17784
17882
  return true;
17785
17883
  }
17786
17884
  try {
17787
- const here = fs32.realpathSync(fileURLToPath25(import.meta.url));
17788
- const argv = fs32.realpathSync(path32.resolve(process.argv[1]));
17885
+ const here = fs33.realpathSync(fileURLToPath25(import.meta.url));
17886
+ const argv = fs33.realpathSync(path33.resolve(process.argv[1]));
17789
17887
  return here === argv;
17790
17888
  } catch {
17791
17889
  return false;
@@ -17795,16 +17893,216 @@ if (_isCliEntry20() || false) {
17795
17893
  process.exitCode = main23();
17796
17894
  }
17797
17895
 
17798
- // src/scripts/hooks/rtk_wrap_hook.ts
17799
- import fs33 from "node:fs";
17800
- import path33 from "node:path";
17896
+ // src/scripts/hooks/block_config_weakening.ts
17897
+ import * as fs34 from "node:fs";
17898
+ import * as path34 from "node:path";
17801
17899
  import { fileURLToPath as fileURLToPath26, pathToFileURL as pathToFileURL22 } from "node:url";
17900
+ var _HERE5 = fileURLToPath26(import.meta.url);
17901
+ var EXIT_ALLOW5 = 0;
17902
+ var EXIT_BLOCK = 1;
17903
+ var EXIT_WARN3 = 2;
17904
+ var SESSION_ENTRY_CAP = 20;
17905
+ var SESSION_WARN_AT = 5;
17906
+ function _isObject7(v) {
17907
+ return v !== null && v !== void 0 && typeof v === "object" && !Array.isArray(v);
17908
+ }
17909
+ var _PATH_KEYS2 = ["file_path", "path", "target_file", "filePath", "notebook_path"];
17910
+ function classify_target(p) {
17911
+ const posix = p.split(path34.sep).join("/");
17912
+ const base = posix.split("/").pop() ?? "";
17913
+ if (/_allowlist\.(json|txt)$/.test(base) || /^allowlist[-_.]/.test(base)) {
17914
+ return "allowlist";
17915
+ }
17916
+ if (/(^|-)baselines?\.json$/.test(base)) {
17917
+ return "advisory";
17918
+ }
17919
+ if (/-budget(s)?\.(json|ya?ml)$/.test(base) || base === "budgets.yml") {
17920
+ return "advisory";
17921
+ }
17922
+ return null;
17923
+ }
17924
+ function count_entries(text) {
17925
+ const trimmed = text.trim();
17926
+ if (trimmed) {
17927
+ try {
17928
+ let n = 0;
17929
+ const walk = (v) => {
17930
+ if (typeof v === "string") {
17931
+ n += 1;
17932
+ } else if (Array.isArray(v)) {
17933
+ v.forEach(walk);
17934
+ } else if (v !== null && typeof v === "object") {
17935
+ Object.values(v).forEach(walk);
17936
+ }
17937
+ };
17938
+ walk(JSON.parse(trimmed));
17939
+ return n;
17940
+ } catch {
17941
+ }
17942
+ }
17943
+ return text.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0 && !l.startsWith("#") && !l.startsWith("//")).length;
17944
+ }
17945
+ function added_entries(tool_input, on_disk) {
17946
+ const content = tool_input["content"];
17947
+ if (typeof content === "string") {
17948
+ const before = on_disk === null ? 0 : count_entries(on_disk);
17949
+ return Math.max(0, count_entries(content) - before);
17950
+ }
17951
+ const oldS = tool_input["old_string"] ?? tool_input["oldStr"] ?? tool_input["old_str"];
17952
+ const newS = tool_input["new_string"] ?? tool_input["newStr"] ?? tool_input["new_str"];
17953
+ if (typeof newS === "string") {
17954
+ const before = typeof oldS === "string" ? count_entries(oldS) : 0;
17955
+ return Math.max(0, count_entries(newS) - before);
17956
+ }
17957
+ return 0;
17958
+ }
17959
+ function decide(kind, rel_path, session_total, added) {
17960
+ if (kind === null || added <= 0) {
17961
+ return { action: "allow", reason: "" };
17962
+ }
17963
+ if (kind === "advisory") {
17964
+ return {
17965
+ action: "warn",
17966
+ reason: `${rel_path}: this edit loosens a gate threshold. Whether that is a legitimate ratchet reset or the config being bent around a failing check is a review decision \u2014 state which in the diff.`
17967
+ };
17968
+ }
17969
+ if (session_total > SESSION_ENTRY_CAP) {
17970
+ return {
17971
+ action: "block",
17972
+ reason: `${rel_path}: ${session_total} allowlist entries added this session (cap ${SESSION_ENTRY_CAP}). Per autonomous-execution \xA7 Antipattern \u2014 allowlist-growth as silent budget bypass, crossing this cap means the LINTER is wrong, not the content. Fix the code or redesign the check; do not expand the allowlist further.
17973
+ Legitimate override is a human action outside this session: land the linter redesign, or remove the \`block-config-weakening\` entry in src/scripts/hook_manifest.yaml.`
17974
+ };
17975
+ }
17976
+ if (session_total >= SESSION_WARN_AT) {
17977
+ return {
17978
+ action: "warn",
17979
+ reason: `${rel_path}: ${session_total} allowlist entries added this session (cap ${SESSION_ENTRY_CAP}). Fix the code, not the config.`
17980
+ };
17981
+ }
17982
+ return { action: "allow", reason: "" };
17983
+ }
17984
+ function _state_file(root) {
17985
+ return path34.join(root, "agents", "runtime", "state", "config-weakening.json");
17986
+ }
17987
+ function bump_session(root, session, key, added) {
17988
+ const f = _state_file(root);
17989
+ let data = {};
17990
+ try {
17991
+ data = JSON.parse(fs34.readFileSync(f, "utf-8"));
17992
+ } catch {
17993
+ data = {};
17994
+ }
17995
+ const bucket = data[session] ?? {};
17996
+ const total = (bucket[key] ?? 0) + added;
17997
+ bucket[key] = total;
17998
+ data[session] = bucket;
17999
+ try {
18000
+ fs34.mkdirSync(path34.dirname(f), { recursive: true });
18001
+ fs34.writeFileSync(f, `${JSON.stringify(data, null, 2)}
18002
+ `, "utf-8");
18003
+ } catch {
18004
+ }
18005
+ return total;
18006
+ }
18007
+ function _extract2(envelope) {
18008
+ const payload = _isObject7(envelope["payload"]) ? envelope["payload"] : envelope;
18009
+ const nameVal = payload["tool_name"] ?? payload["toolName"] ?? payload["tool"] ?? envelope["tool_name"] ?? envelope["tool"];
18010
+ const tool = typeof nameVal === "string" ? nameVal : "";
18011
+ const ti = _isObject7(payload["tool_input"]) ? payload["tool_input"] : _isObject7(envelope["tool_input"]) ? envelope["tool_input"] : null;
18012
+ const paths = [];
18013
+ if (ti !== null) {
18014
+ for (const key of _PATH_KEYS2) {
18015
+ const v = ti[key];
18016
+ if (typeof v === "string" && v) {
18017
+ paths.push(v);
18018
+ }
18019
+ }
18020
+ }
18021
+ return { tool, paths, ti };
18022
+ }
18023
+ function main24() {
18024
+ let envelope;
18025
+ try {
18026
+ const raw = readHookStdin();
18027
+ envelope = raw.trim() ? JSON.parse(raw) : {};
18028
+ } catch {
18029
+ return EXIT_ALLOW5;
18030
+ }
18031
+ if (!_isObject7(envelope)) {
18032
+ return EXIT_ALLOW5;
18033
+ }
18034
+ const { tool, paths, ti } = _extract2(envelope);
18035
+ if (!tool || !EDIT_TOOLS.has(tool) || ti === null) {
18036
+ return EXIT_ALLOW5;
18037
+ }
18038
+ const cwd = envelope["cwd"];
18039
+ const pr = envelope["workspace_root"] ?? envelope["project_root"];
18040
+ const root = typeof cwd === "string" && cwd ? cwd : typeof pr === "string" && pr ? pr : ".";
18041
+ const sidRaw = envelope["session_id"] ?? envelope["sessionId"];
18042
+ const session = typeof sidRaw === "string" && sidRaw ? sidRaw : "default";
18043
+ for (const p of paths) {
18044
+ const kind = classify_target(p);
18045
+ if (kind === null) {
18046
+ continue;
18047
+ }
18048
+ const abs = path34.isAbsolute(p) ? p : path34.join(root, p);
18049
+ let on_disk = null;
18050
+ try {
18051
+ on_disk = fs34.readFileSync(abs, "utf-8");
18052
+ } catch {
18053
+ on_disk = null;
18054
+ }
18055
+ const added = added_entries(ti, on_disk);
18056
+ if (added <= 0) {
18057
+ continue;
18058
+ }
18059
+ const rel = path34.relative(root, abs) || p;
18060
+ const total = kind === "allowlist" ? bump_session(root, session, rel, added) : added;
18061
+ const d = decide(kind, rel, total, added);
18062
+ if (d.action === "block") {
18063
+ process.stderr.write(`block-config-weakening: BLOCKED \u2014 ${d.reason}
18064
+ `);
18065
+ return EXIT_BLOCK;
18066
+ }
18067
+ if (d.action === "warn") {
18068
+ process.stdout.write(`${JSON.stringify({ decision: "warn", reason: d.reason })}
18069
+ `);
18070
+ return EXIT_WARN3;
18071
+ }
18072
+ }
18073
+ return EXIT_ALLOW5;
18074
+ }
18075
+ function _isCliEntry21() {
18076
+ if (true) {
18077
+ return false;
18078
+ }
18079
+ if (process.argv[1] === void 0) {
18080
+ return false;
18081
+ }
18082
+ const argvUrl = pathToFileURL22(path34.resolve(process.argv[1])).href;
18083
+ if (import.meta.url === argvUrl) {
18084
+ return true;
18085
+ }
18086
+ try {
18087
+ return fs34.realpathSync(fileURLToPath26(import.meta.url)) === fs34.realpathSync(path34.resolve(process.argv[1]));
18088
+ } catch {
18089
+ return false;
18090
+ }
18091
+ }
18092
+ if (_isCliEntry21() || process.argv[1] === _HERE5) {
18093
+ process.exit(main24());
18094
+ }
18095
+
18096
+ // src/scripts/hooks/rtk_wrap_hook.ts
18097
+ import fs35 from "node:fs";
18098
+ import path35 from "node:path";
18099
+ import { fileURLToPath as fileURLToPath27, pathToFileURL as pathToFileURL23 } from "node:url";
17802
18100
 
17803
18101
  // src/install/rtkDetection.ts
17804
18102
  import { spawnSync as spawnSync4 } from "node:child_process";
17805
- import { existsSync as existsSync6, statSync as statSync8, readFileSync as readFileSync12, writeFileSync as writeFileSync6, mkdirSync as mkdirSync7 } from "node:fs";
18103
+ import { existsSync as existsSync6, statSync as statSync8, readFileSync as readFileSync13, writeFileSync as writeFileSync7, mkdirSync as mkdirSync8 } from "node:fs";
17806
18104
  import { homedir as homedir3 } from "node:os";
17807
- import { delimiter, join as join12, dirname as dirname7 } from "node:path";
18105
+ import { delimiter, join as join13, dirname as dirname8 } from "node:path";
17808
18106
  var TOKEN_KILLER_GAIN_SIGNATURE = /RTK Token Savings/;
17809
18107
  var PROBE_TIMEOUT_MS = 3e3;
17810
18108
  function resolveBinaryOnPath(name, pathEnv) {
@@ -17814,7 +18112,7 @@ function resolveBinaryOnPath(name, pathEnv) {
17814
18112
  for (const dir of pathVar.split(delimiter)) {
17815
18113
  if (dir.length === 0) continue;
17816
18114
  for (const suffix of suffixes) {
17817
- const candidate = join12(dir, `${name}${suffix}`);
18115
+ const candidate = join13(dir, `${name}${suffix}`);
17818
18116
  if (existsSync6(candidate)) return candidate;
17819
18117
  }
17820
18118
  }
@@ -17866,7 +18164,7 @@ function detectRtk(options = {}) {
17866
18164
  return version === void 0 ? { present: true, identity, binPath } : { present: true, identity, version, binPath };
17867
18165
  }
17868
18166
  function cacheFile() {
17869
- return join12(homedir3(), ".event4u", "agent-config", "state", "rtk-identity.json");
18167
+ return join13(homedir3(), ".event4u", "agent-config", "state", "rtk-identity.json");
17870
18168
  }
17871
18169
  function detectRtkCached(options = {}) {
17872
18170
  const binPath = resolveBinaryOnPath("rtk", options.pathEnv);
@@ -17881,7 +18179,7 @@ function detectRtkCached(options = {}) {
17881
18179
  const file = cacheFile();
17882
18180
  if (stat !== null) {
17883
18181
  try {
17884
- const cached = JSON.parse(readFileSync12(file, "utf-8"));
18182
+ const cached = JSON.parse(readFileSync13(file, "utf-8"));
17885
18183
  if (cached.binPath === binPath && cached.mtimeMs === stat.mtimeMs && cached.size === stat.size) {
17886
18184
  return cached.version === void 0 ? { present: true, identity: cached.identity, binPath } : { present: true, identity: cached.identity, version: cached.version, binPath };
17887
18185
  }
@@ -17899,8 +18197,8 @@ function detectRtkCached(options = {}) {
17899
18197
  };
17900
18198
  if (detection.version !== void 0) entry.version = detection.version;
17901
18199
  try {
17902
- mkdirSync7(dirname7(file), { recursive: true });
17903
- writeFileSync6(file, `${JSON.stringify(entry, null, 2)}
18200
+ mkdirSync8(dirname8(file), { recursive: true });
18201
+ writeFileSync7(file, `${JSON.stringify(entry, null, 2)}
17904
18202
  `, "utf-8");
17905
18203
  } catch {
17906
18204
  }
@@ -17910,8 +18208,8 @@ function detectRtkCached(options = {}) {
17910
18208
 
17911
18209
  // src/scripts/hooks/rtk_wrap_hook.ts
17912
18210
  var SETTINGS_FILE6 = ".agent-settings.yml";
17913
- var EXIT_ALLOW5 = 0;
17914
- var EXIT_WARN3 = 2;
18211
+ var EXIT_ALLOW6 = 0;
18212
+ var EXIT_WARN4 = 2;
17915
18213
  var _RTK_PROGRAMS = /* @__PURE__ */ new Set([
17916
18214
  "git",
17917
18215
  "phpstan",
@@ -17936,19 +18234,19 @@ var _RTK_PROGRAMS = /* @__PURE__ */ new Set([
17936
18234
  "kubectl",
17937
18235
  "terraform"
17938
18236
  ]);
17939
- function _isObject7(v) {
18237
+ function _isObject8(v) {
17940
18238
  return typeof v === "object" && v !== null && !Array.isArray(v);
17941
18239
  }
17942
18240
  function _enabled2(root) {
17943
- const f = path33.join(root, SETTINGS_FILE6);
18241
+ const f = path35.join(root, SETTINGS_FILE6);
17944
18242
  try {
17945
- if (!fs33.statSync(f).isFile()) return false;
18243
+ if (!fs35.statSync(f).isFile()) return false;
17946
18244
  } catch {
17947
18245
  return false;
17948
18246
  }
17949
18247
  let text;
17950
18248
  try {
17951
- text = fs33.readFileSync(f, "utf-8");
18249
+ text = fs35.readFileSync(f, "utf-8");
17952
18250
  } catch {
17953
18251
  return false;
17954
18252
  }
@@ -17978,13 +18276,13 @@ function _enabled2(root) {
17978
18276
  function rtk_available(env = process.env) {
17979
18277
  const pathVar = env.PATH ?? env.Path ?? "";
17980
18278
  if (!pathVar) return false;
17981
- const dirs = pathVar.split(path33.delimiter).filter(Boolean);
18279
+ const dirs = pathVar.split(path35.delimiter).filter(Boolean);
17982
18280
  const exts = process.platform === "win32" ? ["", ".exe", ".cmd", ".bat"] : [""];
17983
18281
  for (const dir of dirs) {
17984
18282
  for (const ext of exts) {
17985
- const candidate = path33.join(dir, `rtk${ext}`);
18283
+ const candidate = path35.join(dir, `rtk${ext}`);
17986
18284
  try {
17987
- const st = fs33.statSync(candidate);
18285
+ const st = fs35.statSync(candidate);
17988
18286
  if (st.isFile()) {
17989
18287
  if (process.platform === "win32" || (st.mode & 73) !== 0) return true;
17990
18288
  }
@@ -17995,8 +18293,8 @@ function rtk_available(env = process.env) {
17995
18293
  return false;
17996
18294
  }
17997
18295
  function _extract_command4(envelope) {
17998
- const payload = _isObject7(envelope["payload"]) ? envelope["payload"] : {};
17999
- const tool_input = _isObject7(payload["tool_input"]) ? payload["tool_input"] : {};
18296
+ const payload = _isObject8(envelope["payload"]) ? envelope["payload"] : {};
18297
+ const tool_input = _isObject8(payload["tool_input"]) ? payload["tool_input"] : {};
18000
18298
  for (const src of [tool_input["command"], payload["command"], envelope["command"]]) {
18001
18299
  if (typeof src === "string") return src;
18002
18300
  }
@@ -18032,61 +18330,61 @@ function _readStdin13() {
18032
18330
  function _jsonReason(reason) {
18033
18331
  return JSON.stringify({ decision: "warn", reason });
18034
18332
  }
18035
- function main24() {
18333
+ function main25() {
18036
18334
  let envelope;
18037
18335
  try {
18038
18336
  const raw = _readStdin13();
18039
18337
  envelope = raw.trim() ? JSON.parse(raw) : {};
18040
18338
  } catch {
18041
- return EXIT_ALLOW5;
18339
+ return EXIT_ALLOW6;
18042
18340
  }
18043
- if (!_isObject7(envelope)) return EXIT_ALLOW5;
18341
+ if (!_isObject8(envelope)) return EXIT_ALLOW6;
18044
18342
  const cwd = envelope["cwd"];
18045
18343
  const projectRoot = envelope["workspace_root"] ?? envelope["project_root"];
18046
18344
  const root = typeof cwd === "string" && cwd ? cwd : typeof projectRoot === "string" && projectRoot ? projectRoot : ".";
18047
- if (!_enabled2(root)) return EXIT_ALLOW5;
18048
- if (!rtk_available()) return EXIT_ALLOW5;
18049
- if (detectRtkCached().identity !== "token-killer") return EXIT_ALLOW5;
18345
+ if (!_enabled2(root)) return EXIT_ALLOW6;
18346
+ if (!rtk_available()) return EXIT_ALLOW6;
18347
+ if (detectRtkCached().identity !== "token-killer") return EXIT_ALLOW6;
18050
18348
  const command = _extract_command4(envelope);
18051
- if (!command) return EXIT_ALLOW5;
18349
+ if (!command) return EXIT_ALLOW6;
18052
18350
  const verdict = classify(command);
18053
- if (!verdict.eligible) return EXIT_ALLOW5;
18351
+ if (!verdict.eligible) return EXIT_ALLOW6;
18054
18352
  const reason = `rtk is installed and wraps verbose CLI output (upstream reports 60\u201390% fewer output tokens). Re-run wrapped: \`rtk ${command.trim()}\`. (Skip for completeness-critical output like \`git diff\`.)`;
18055
18353
  process.stdout.write(`${_jsonReason(reason)}
18056
18354
  `);
18057
- return EXIT_WARN3;
18355
+ return EXIT_WARN4;
18058
18356
  }
18059
- function _isCliEntry21() {
18357
+ function _isCliEntry22() {
18060
18358
  if (true) {
18061
18359
  return false;
18062
18360
  }
18063
18361
  if (process.argv[1] === void 0) {
18064
18362
  return false;
18065
18363
  }
18066
- const argvUrl = pathToFileURL22(path33.resolve(process.argv[1])).href;
18364
+ const argvUrl = pathToFileURL23(path35.resolve(process.argv[1])).href;
18067
18365
  if (import.meta.url === argvUrl) {
18068
18366
  return true;
18069
18367
  }
18070
18368
  try {
18071
- const here = fs33.realpathSync(fileURLToPath26(import.meta.url));
18072
- const argv = fs33.realpathSync(path33.resolve(process.argv[1]));
18369
+ const here = fs35.realpathSync(fileURLToPath27(import.meta.url));
18370
+ const argv = fs35.realpathSync(path35.resolve(process.argv[1]));
18073
18371
  return here === argv;
18074
18372
  } catch {
18075
18373
  return false;
18076
18374
  }
18077
18375
  }
18078
- if (_isCliEntry21()) {
18079
- process.exit(main24());
18376
+ if (_isCliEntry22()) {
18377
+ process.exit(main25());
18080
18378
  }
18081
18379
 
18082
18380
  // src/scripts/hooks/design_slop_hook.ts
18083
- import fs35 from "node:fs";
18084
- import path35 from "node:path";
18085
- import { fileURLToPath as fileURLToPath27, pathToFileURL as pathToFileURL23 } from "node:url";
18381
+ import fs37 from "node:fs";
18382
+ import path37 from "node:path";
18383
+ import { fileURLToPath as fileURLToPath28, pathToFileURL as pathToFileURL24 } from "node:url";
18086
18384
 
18087
18385
  // src/scripts/lint_design_slop.ts
18088
- import fs34 from "node:fs";
18089
- import path34 from "node:path";
18386
+ import fs36 from "node:fs";
18387
+ import path36 from "node:path";
18090
18388
 
18091
18389
  // src/scripts/design_slop_rules.ts
18092
18390
  function cssBlocks(content) {
@@ -18502,33 +18800,33 @@ function enginesForExt(ext) {
18502
18800
  return /* @__PURE__ */ new Set();
18503
18801
  }
18504
18802
  function* walkDir(dir, ext) {
18505
- if (!fs34.existsSync(dir)) return;
18506
- for (const entry of fs34.readdirSync(dir, { withFileTypes: true })) {
18507
- const full = path34.join(dir, entry.name);
18803
+ if (!fs36.existsSync(dir)) return;
18804
+ for (const entry of fs36.readdirSync(dir, { withFileTypes: true })) {
18805
+ const full = path36.join(dir, entry.name);
18508
18806
  if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
18509
18807
  if (entry.isDirectory()) yield* walkDir(full, ext);
18510
18808
  else if (ext.test(entry.name)) yield full;
18511
18809
  }
18512
18810
  }
18513
18811
  function loadConfig(dir) {
18514
- const p = path34.join(dir, ".design-quality.json");
18515
- if (!fs34.existsSync(p)) return {};
18812
+ const p = path36.join(dir, ".design-quality.json");
18813
+ if (!fs36.existsSync(p)) return {};
18516
18814
  try {
18517
- return JSON.parse(fs34.readFileSync(p, "utf-8"));
18815
+ return JSON.parse(fs36.readFileSync(p, "utf-8"));
18518
18816
  } catch {
18519
18817
  return {};
18520
18818
  }
18521
18819
  }
18522
18820
  function loadDesignContext(scanDir) {
18523
18821
  const candidates = [
18524
- path34.join(scanDir, "DESIGN.md"),
18525
- path34.join(process.cwd(), "DESIGN.md"),
18526
- path34.join(scanDir, "..", "DESIGN.md")
18822
+ path36.join(scanDir, "DESIGN.md"),
18823
+ path36.join(process.cwd(), "DESIGN.md"),
18824
+ path36.join(scanDir, "..", "DESIGN.md")
18527
18825
  ];
18528
18826
  let raw = "";
18529
18827
  for (const c of candidates) {
18530
- if (fs34.existsSync(c)) {
18531
- raw = fs34.readFileSync(c, "utf-8").toLowerCase();
18828
+ if (fs36.existsSync(c)) {
18829
+ raw = fs36.readFileSync(c, "utf-8").toLowerCase();
18532
18830
  break;
18533
18831
  }
18534
18832
  }
@@ -18559,7 +18857,7 @@ function parseIgnores(lines) {
18559
18857
  }
18560
18858
  function scanFile(content, relPath, ctx) {
18561
18859
  const lines = content.split("\n");
18562
- const ext = path34.extname(relPath).toLowerCase();
18860
+ const ext = path36.extname(relPath).toLowerCase();
18563
18861
  const fileEngines = enginesForExt(ext);
18564
18862
  if (fileEngines.size === 0) return [];
18565
18863
  const ignores = parseIgnores(lines);
@@ -18589,15 +18887,15 @@ function scanFile(content, relPath, ctx) {
18589
18887
  }
18590
18888
  return out;
18591
18889
  }
18592
- function main25() {
18890
+ function main26() {
18593
18891
  const args = process.argv.slice(2);
18594
18892
  const jsonMode = args.includes("--json");
18595
18893
  const quiet = args.includes("--quiet");
18596
18894
  const dirIdx = args.indexOf("--dir");
18597
- const scanDir = dirIdx >= 0 && args[dirIdx + 1] ? path34.resolve(args[dirIdx + 1]) : path34.resolve(process.cwd(), "src");
18895
+ const scanDir = dirIdx >= 0 && args[dirIdx + 1] ? path36.resolve(args[dirIdx + 1]) : path36.resolve(process.cwd(), "src");
18598
18896
  const failIdx = args.indexOf("--fail-on");
18599
18897
  const failOn = failIdx >= 0 ? args[failIdx + 1] : void 0;
18600
- if (!fs34.existsSync(scanDir)) {
18898
+ if (!fs36.existsSync(scanDir)) {
18601
18899
  if (!quiet) {
18602
18900
  process.stderr.write(`[lint_design_slop] scan directory not found: ${scanDir}
18603
18901
  `);
@@ -18615,9 +18913,9 @@ function main25() {
18615
18913
  }
18616
18914
  const findings = [];
18617
18915
  for (const fp of files) {
18618
- const rel = path34.relative(process.cwd(), fp);
18916
+ const rel = path36.relative(process.cwd(), fp);
18619
18917
  try {
18620
- const fileFindings = scanFile(fs34.readFileSync(fp, "utf-8"), rel, ctx).filter(
18918
+ const fileFindings = scanFile(fs36.readFileSync(fp, "utf-8"), rel, ctx).filter(
18621
18919
  (f) => !ignoreRules.has(f.rule.toLowerCase())
18622
18920
  );
18623
18921
  findings.push(...fileFindings);
@@ -18650,23 +18948,23 @@ lint_design_slop: ${findings.length} tell(s) flagged (rebuttable \u2014 declare
18650
18948
  process.exit(overThreshold.length > 0 ? 2 : 0);
18651
18949
  }
18652
18950
  var invokedDirectly = process.argv[1] !== void 0 && /lint_design_slop\.ts$/.test(process.argv[1]);
18653
- if (invokedDirectly) main25();
18951
+ if (invokedDirectly) main26();
18654
18952
 
18655
18953
  // src/scripts/hooks/design_slop_hook.ts
18656
18954
  var SETTINGS_FILE7 = ".agent-settings.yml";
18657
- var EXIT_ALLOW6 = 0;
18658
- var EXIT_WARN4 = 2;
18955
+ var EXIT_ALLOW7 = 0;
18956
+ var EXIT_WARN5 = 2;
18659
18957
  var DEGRADE_AFTER = 3;
18660
18958
  var UI_EXT = /\.(html|htm|css|scss|sass|less|vue|svelte|astro|jsx|tsx)$/i;
18661
18959
  function isObject(v) {
18662
18960
  return typeof v === "object" && v !== null && !Array.isArray(v);
18663
18961
  }
18664
18962
  function enabled2(root) {
18665
- const f = path35.join(root, SETTINGS_FILE7);
18963
+ const f = path37.join(root, SETTINGS_FILE7);
18666
18964
  let text;
18667
18965
  try {
18668
- if (!fs35.statSync(f).isFile()) return false;
18669
- text = fs35.readFileSync(f, "utf-8");
18966
+ if (!fs37.statSync(f).isFile()) return false;
18967
+ text = fs37.readFileSync(f, "utf-8");
18670
18968
  } catch {
18671
18969
  return false;
18672
18970
  }
@@ -18703,11 +19001,11 @@ function extract(envelope) {
18703
19001
  return null;
18704
19002
  }
18705
19003
  function stateFile(root) {
18706
- return path35.join(root, "agents", "runtime", "state", "design-slop-hook.json");
19004
+ return path37.join(root, "agents", "runtime", "state", "design-slop-hook.json");
18707
19005
  }
18708
19006
  function readState(root) {
18709
19007
  try {
18710
- const t = fs35.readFileSync(stateFile(root), "utf-8");
19008
+ const t = fs37.readFileSync(stateFile(root), "utf-8");
18711
19009
  const parsed = JSON.parse(t);
18712
19010
  return isObject(parsed) ? parsed : {};
18713
19011
  } catch {
@@ -18717,31 +19015,31 @@ function readState(root) {
18717
19015
  function writeState(root, state) {
18718
19016
  try {
18719
19017
  const sf = stateFile(root);
18720
- fs35.mkdirSync(path35.dirname(sf), { recursive: true });
18721
- fs35.writeFileSync(sf, JSON.stringify(state, null, 2) + "\n");
19018
+ fs37.mkdirSync(path37.dirname(sf), { recursive: true });
19019
+ fs37.writeFileSync(sf, JSON.stringify(state, null, 2) + "\n");
18722
19020
  } catch {
18723
19021
  }
18724
19022
  }
18725
19023
  function readStdin() {
18726
19024
  return readHookStdin();
18727
19025
  }
18728
- function main26() {
19026
+ function main27() {
18729
19027
  let envelope;
18730
19028
  try {
18731
19029
  const raw = readStdin();
18732
19030
  envelope = raw.trim() ? JSON.parse(raw) : {};
18733
19031
  } catch {
18734
- return EXIT_ALLOW6;
19032
+ return EXIT_ALLOW7;
18735
19033
  }
18736
- if (!isObject(envelope)) return EXIT_ALLOW6;
19034
+ if (!isObject(envelope)) return EXIT_ALLOW7;
18737
19035
  const rootVal = envelope["cwd"] ?? envelope["project_root"] ?? ".";
18738
19036
  const root = typeof rootVal === "string" && rootVal ? rootVal : ".";
18739
- if (!enabled2(root)) return EXIT_ALLOW6;
19037
+ if (!enabled2(root)) return EXIT_ALLOW7;
18740
19038
  const ex = extract(envelope);
18741
- if (!ex || !ex.file || !UI_EXT.test(ex.file)) return EXIT_ALLOW6;
19039
+ if (!ex || !ex.file || !UI_EXT.test(ex.file)) return EXIT_ALLOW7;
18742
19040
  let ctx;
18743
19041
  try {
18744
- ctx = loadDesignContext(path35.dirname(path35.resolve(root, ex.file)));
19042
+ ctx = loadDesignContext(path37.dirname(path37.resolve(root, ex.file)));
18745
19043
  } catch {
18746
19044
  ctx = { raw: "", has: () => false };
18747
19045
  }
@@ -18751,9 +19049,9 @@ function main26() {
18751
19049
  (f) => f.severity === "P0" || f.severity === "P1"
18752
19050
  );
18753
19051
  } catch {
18754
- return EXIT_ALLOW6;
19052
+ return EXIT_ALLOW7;
18755
19053
  }
18756
- if (findings.length === 0) return EXIT_ALLOW6;
19054
+ if (findings.length === 0) return EXIT_ALLOW7;
18757
19055
  const state = readState(root);
18758
19056
  const surfaced = findings.filter((f) => {
18759
19057
  const sig = `${ex.file}::${f.rule}`;
@@ -18763,43 +19061,43 @@ function main26() {
18763
19061
  return true;
18764
19062
  });
18765
19063
  writeState(root, state);
18766
- if (surfaced.length === 0) return EXIT_ALLOW6;
19064
+ if (surfaced.length === 0) return EXIT_ALLOW7;
18767
19065
  const lines = surfaced.map((f) => `${f.catalogId} (${f.rule}) ${f.file}:${f.line} \u2014 ${f.message}`).join("; ");
18768
19066
  const reason = "\u26A0\uFE0F Anti-slop: high-severity aesthetic tell(s) in the proposed UI \u2014 " + lines + ". Rebuttable: declare intent in DESIGN.md, add design-slop-disable-next-line, or proceed if deliberate (this is a flag, not a block).";
18769
19067
  process.stdout.write(JSON.stringify({ decision: "warn", reason }) + "\n");
18770
- return EXIT_WARN4;
19068
+ return EXIT_WARN5;
18771
19069
  }
18772
- function _isCliEntry22() {
19070
+ function _isCliEntry23() {
18773
19071
  if (true) {
18774
19072
  return false;
18775
19073
  }
18776
19074
  if (process.argv[1] === void 0) {
18777
19075
  return false;
18778
19076
  }
18779
- const argvUrl = pathToFileURL23(path35.resolve(process.argv[1])).href;
19077
+ const argvUrl = pathToFileURL24(path37.resolve(process.argv[1])).href;
18780
19078
  if (import.meta.url === argvUrl) {
18781
19079
  return true;
18782
19080
  }
18783
19081
  try {
18784
- const here = fs35.realpathSync(fileURLToPath27(import.meta.url));
18785
- const argv = fs35.realpathSync(path35.resolve(process.argv[1]));
19082
+ const here = fs37.realpathSync(fileURLToPath28(import.meta.url));
19083
+ const argv = fs37.realpathSync(path37.resolve(process.argv[1]));
18786
19084
  return here === argv;
18787
19085
  } catch {
18788
19086
  return false;
18789
19087
  }
18790
19088
  }
18791
- var isCliEntry9 = _isCliEntry22();
18792
- if (isCliEntry9) process.exit(main26());
19089
+ var isCliEntry9 = _isCliEntry23();
19090
+ if (isCliEntry9) process.exit(main27());
18793
19091
 
18794
19092
  // src/scripts/hooks/code_graph_nudge_hook.ts
18795
- import fs37 from "node:fs";
18796
- import path37 from "node:path";
18797
- import { fileURLToPath as fileURLToPath28, pathToFileURL as pathToFileURL24 } from "node:url";
19093
+ import fs39 from "node:fs";
19094
+ import path39 from "node:path";
19095
+ import { fileURLToPath as fileURLToPath29, pathToFileURL as pathToFileURL25 } from "node:url";
18798
19096
 
18799
19097
  // src/scripts/code_graph/detect.ts
18800
19098
  import { execFileSync } from "node:child_process";
18801
- import * as fs36 from "node:fs";
18802
- import * as path36 from "node:path";
19099
+ import * as fs38 from "node:fs";
19100
+ import * as path38 from "node:path";
18803
19101
 
18804
19102
  // src/scripts/code_graph/validate.ts
18805
19103
  var RELATIONS = /* @__PURE__ */ new Set(["calls", "imports", "uses", "inherits", "member"]);
@@ -18880,7 +19178,7 @@ function freshness(root, file, embeddedSha) {
18880
19178
  const last = gitLastCommitEpoch(root);
18881
19179
  if (last === null) return {};
18882
19180
  try {
18883
- const mtime = Math.floor(fs36.statSync(file).mtimeMs / 1e3);
19181
+ const mtime = Math.floor(fs38.statSync(file).mtimeMs / 1e3);
18884
19182
  return { stale: mtime < last };
18885
19183
  } catch {
18886
19184
  return {};
@@ -18888,7 +19186,7 @@ function freshness(root, file, embeddedSha) {
18888
19186
  }
18889
19187
  function looksLikeGraph(p) {
18890
19188
  try {
18891
- const raw = JSON.parse(fs36.readFileSync(p, "utf-8"));
19189
+ const raw = JSON.parse(fs38.readFileSync(p, "utf-8"));
18892
19190
  if (validateGraph(raw).ok) return { ok: true, sha: raw["head_at_build"] ?? null };
18893
19191
  const nodes = raw["nodes"];
18894
19192
  const edges = raw["edges"] ?? raw["links"];
@@ -18899,23 +19197,23 @@ function looksLikeGraph(p) {
18899
19197
  }
18900
19198
  }
18901
19199
  function detectSources(root, nativeCache) {
18902
- const abs = path36.resolve(root);
19200
+ const abs = path38.resolve(root);
18903
19201
  const out = [];
18904
19202
  for (const rel of CONSUMER_CANDIDATES) {
18905
- const p = path36.join(abs, rel);
18906
- if (fs36.existsSync(p)) {
19203
+ const p = path38.join(abs, rel);
19204
+ if (fs38.existsSync(p)) {
18907
19205
  const { ok, sha } = looksLikeGraph(p);
18908
19206
  if (ok) out.push({ kind: "consumer", path: p, present: true, ...freshness(abs, p, sha) });
18909
19207
  }
18910
19208
  }
18911
- const scipCandidates = [path36.join(abs, "index.scip")];
19209
+ const scipCandidates = [path38.join(abs, "index.scip")];
18912
19210
  try {
18913
- for (const e of fs36.readdirSync(abs)) if (e.endsWith(".scip")) scipCandidates.push(path36.join(abs, e));
19211
+ for (const e of fs38.readdirSync(abs)) if (e.endsWith(".scip")) scipCandidates.push(path38.join(abs, e));
18914
19212
  } catch {
18915
19213
  }
18916
- const scip = scipCandidates.find((p) => fs36.existsSync(p));
19214
+ const scip = scipCandidates.find((p) => fs38.existsSync(p));
18917
19215
  if (scip) out.push({ kind: "scip", path: scip, present: true, note: "SCIP detected \u2014 peer tooling required (no owned reader)" });
18918
- if (fs36.existsSync(nativeCache)) out.push({ kind: "native", path: nativeCache, present: true, ...freshness(abs, nativeCache, null) });
19216
+ if (fs38.existsSync(nativeCache)) out.push({ kind: "native", path: nativeCache, present: true, ...freshness(abs, nativeCache, null) });
18919
19217
  return out;
18920
19218
  }
18921
19219
  function pickSource(verdicts) {
@@ -18928,18 +19226,18 @@ function pickSource(verdicts) {
18928
19226
 
18929
19227
  // src/scripts/hooks/code_graph_nudge_hook.ts
18930
19228
  var SETTINGS_FILE8 = ".agent-settings.yml";
18931
- var EXIT_ALLOW7 = 0;
18932
- var EXIT_WARN5 = 2;
19229
+ var EXIT_ALLOW8 = 0;
19230
+ var EXIT_WARN6 = 2;
18933
19231
  var CODE_EXT = /\.(php|ts|tsx|mts|cts|js|jsx|mjs|cjs)$/i;
18934
19232
  function isObject2(v) {
18935
19233
  return typeof v === "object" && v !== null && !Array.isArray(v);
18936
19234
  }
18937
19235
  function enabled3(root) {
18938
- const f = path37.join(root, SETTINGS_FILE8);
19236
+ const f = path39.join(root, SETTINGS_FILE8);
18939
19237
  let text;
18940
19238
  try {
18941
- if (!fs37.statSync(f).isFile()) return false;
18942
- text = fs37.readFileSync(f, "utf-8");
19239
+ if (!fs39.statSync(f).isFile()) return false;
19240
+ text = fs39.readFileSync(f, "utf-8");
18943
19241
  } catch {
18944
19242
  return false;
18945
19243
  }
@@ -18982,11 +19280,11 @@ function sessionId(envelope) {
18982
19280
  return typeof s === "string" && s ? s : "default";
18983
19281
  }
18984
19282
  function latchFile(root) {
18985
- return path37.join(root, "agents", "runtime", "state", "code-graph-nudge.json");
19283
+ return path39.join(root, "agents", "runtime", "state", "code-graph-nudge.json");
18986
19284
  }
18987
19285
  function alreadyNudged(root, session) {
18988
19286
  try {
18989
- const state = JSON.parse(fs37.readFileSync(latchFile(root), "utf-8"));
19287
+ const state = JSON.parse(fs39.readFileSync(latchFile(root), "utf-8"));
18990
19288
  return state[session] === true;
18991
19289
  } catch {
18992
19290
  return false;
@@ -18997,18 +19295,18 @@ function latch(root, session) {
18997
19295
  const p = latchFile(root);
18998
19296
  let state = {};
18999
19297
  try {
19000
- state = JSON.parse(fs37.readFileSync(p, "utf-8"));
19298
+ state = JSON.parse(fs39.readFileSync(p, "utf-8"));
19001
19299
  } catch {
19002
19300
  }
19003
19301
  state[session] = true;
19004
- fs37.mkdirSync(path37.dirname(p), { recursive: true });
19005
- fs37.writeFileSync(p, JSON.stringify(state));
19302
+ fs39.mkdirSync(path39.dirname(p), { recursive: true });
19303
+ fs39.writeFileSync(p, JSON.stringify(state));
19006
19304
  } catch {
19007
19305
  }
19008
19306
  }
19009
- var NATIVE_CACHE = path37.join("agents", "runtime", "state", "code-graph-v1.json");
19307
+ var NATIVE_CACHE = path39.join("agents", "runtime", "state", "code-graph-v1.json");
19010
19308
  function nudgeReason(root) {
19011
- const verdicts = detectSources(root, path37.join(root, NATIVE_CACHE));
19309
+ const verdicts = detectSources(root, path39.join(root, NATIVE_CACHE));
19012
19310
  const picked = pickSource(verdicts);
19013
19311
  if (!picked) {
19014
19312
  return 'No code-graph found. For "who calls / where used / impact" run `agent-config code-graph refresh` once, then `agent-config code-graph query <symbol>` instead of grepping blind.';
@@ -19018,48 +19316,48 @@ function nudgeReason(root) {
19018
19316
  }
19019
19317
  return "A fresh code-graph is present \u2014 for structure questions run `agent-config code-graph query|affected <symbol>` first; grep is the fallback (say which answered).";
19020
19318
  }
19021
- function main27() {
19319
+ function main28() {
19022
19320
  let envelope;
19023
19321
  try {
19024
19322
  const raw = readHookStdin();
19025
19323
  envelope = raw.trim() ? JSON.parse(raw) : {};
19026
19324
  } catch {
19027
- return EXIT_ALLOW7;
19325
+ return EXIT_ALLOW8;
19028
19326
  }
19029
- if (!isObject2(envelope)) return EXIT_ALLOW7;
19327
+ if (!isObject2(envelope)) return EXIT_ALLOW8;
19030
19328
  const cwd = envelope["cwd"];
19031
19329
  const pr = envelope["workspace_root"] ?? envelope["project_root"];
19032
19330
  const root = typeof cwd === "string" && cwd ? cwd : typeof pr === "string" && pr ? pr : ".";
19033
- if (!enabled3(root)) return EXIT_ALLOW7;
19331
+ if (!enabled3(root)) return EXIT_ALLOW8;
19034
19332
  const { isSearch, isCodeRead } = classifyTool(envelope);
19035
- if (!isSearch && !isCodeRead) return EXIT_ALLOW7;
19333
+ if (!isSearch && !isCodeRead) return EXIT_ALLOW8;
19036
19334
  const session = sessionId(envelope);
19037
- if (alreadyNudged(root, session)) return EXIT_ALLOW7;
19335
+ if (alreadyNudged(root, session)) return EXIT_ALLOW8;
19038
19336
  let reason;
19039
19337
  try {
19040
19338
  reason = nudgeReason(root);
19041
19339
  } catch {
19042
- return EXIT_ALLOW7;
19340
+ return EXIT_ALLOW8;
19043
19341
  }
19044
19342
  latch(root, session);
19045
19343
  process.stdout.write(`${JSON.stringify({ decision: "warn", reason })}
19046
19344
  `);
19047
- return EXIT_WARN5;
19345
+ return EXIT_WARN6;
19048
19346
  }
19049
19347
  function isCliEntry10() {
19050
19348
  if (true) {
19051
19349
  return false;
19052
19350
  }
19053
19351
  if (process.argv[1] === void 0) return false;
19054
- const argvUrl = pathToFileURL24(path37.resolve(process.argv[1])).href;
19352
+ const argvUrl = pathToFileURL25(path39.resolve(process.argv[1])).href;
19055
19353
  if (import.meta.url === argvUrl) return true;
19056
19354
  try {
19057
- return fs37.realpathSync(fileURLToPath28(import.meta.url)) === fs37.realpathSync(path37.resolve(process.argv[1]));
19355
+ return fs39.realpathSync(fileURLToPath29(import.meta.url)) === fs39.realpathSync(path39.resolve(process.argv[1]));
19058
19356
  } catch {
19059
19357
  return false;
19060
19358
  }
19061
19359
  }
19062
- if (isCliEntry10()) process.exit(main27());
19360
+ if (isCliEntry10()) process.exit(main28());
19063
19361
 
19064
19362
  // src/scripts/hooks/concern_registry.ts
19065
19363
  var CONCERN_REGISTRY = {
@@ -19081,21 +19379,22 @@ var CONCERN_REGISTRY = {
19081
19379
  "src/scripts/session_canary_hook.ts": main21,
19082
19380
  "src/scripts/hooks/block_no_verify.ts": main22,
19083
19381
  "src/scripts/hooks/block_kernel_rule_writes.ts": main23,
19084
- "src/scripts/hooks/rtk_wrap_hook.ts": main24,
19085
- "src/scripts/hooks/design_slop_hook.ts": main26,
19086
- "src/scripts/hooks/code_graph_nudge_hook.ts": main27
19382
+ "src/scripts/hooks/block_config_weakening.ts": main24,
19383
+ "src/scripts/hooks/rtk_wrap_hook.ts": main25,
19384
+ "src/scripts/hooks/design_slop_hook.ts": main27,
19385
+ "src/scripts/hooks/code_graph_nudge_hook.ts": main28
19087
19386
  };
19088
19387
 
19089
19388
  // src/scripts/hooks/dispatch_hook.ts
19090
19389
  var _IN_BUNDLE = true;
19091
- var REPO_ROOT = path38.resolve(
19092
- path38.dirname(fileURLToPath29(import.meta.url)),
19390
+ var REPO_ROOT = path40.resolve(
19391
+ path40.dirname(fileURLToPath30(import.meta.url)),
19093
19392
  ..._IN_BUNDLE ? ["..", ".."] : ["..", "..", ".."]
19094
19393
  );
19095
- var MANIFEST_PATH = path38.join(REPO_ROOT, "src", "scripts", "hook_manifest.yaml");
19096
- var EXIT_ALLOW8 = 0;
19097
- var EXIT_BLOCK = 1;
19098
- var EXIT_WARN6 = 2;
19394
+ var MANIFEST_PATH = path40.join(REPO_ROOT, "src", "scripts", "hook_manifest.yaml");
19395
+ var EXIT_ALLOW9 = 0;
19396
+ var EXIT_BLOCK2 = 1;
19397
+ var EXIT_WARN7 = 2;
19099
19398
  var EVENT_VOCABULARY = /* @__PURE__ */ new Set([
19100
19399
  "session_start",
19101
19400
  "session_end",
@@ -19107,11 +19406,11 @@ var EVENT_VOCABULARY = /* @__PURE__ */ new Set([
19107
19406
  "agent_error"
19108
19407
  ]);
19109
19408
  var _SEVERITY_BY_EXIT = {
19110
- [EXIT_ALLOW8]: "allow",
19111
- [EXIT_BLOCK]: "block",
19112
- [EXIT_WARN6]: "warn"
19409
+ [EXIT_ALLOW9]: "allow",
19410
+ [EXIT_BLOCK2]: "block",
19411
+ [EXIT_WARN7]: "warn"
19113
19412
  };
19114
- function _isObject8(v) {
19413
+ function _isObject9(v) {
19115
19414
  return typeof v === "object" && v !== null && !Array.isArray(v);
19116
19415
  }
19117
19416
  function _severity_for(rc) {
@@ -19138,33 +19437,33 @@ function _parse_concern_stdout(stdout_text) {
19138
19437
  } catch {
19139
19438
  return { _raw_stdout: text.slice(0, 500) };
19140
19439
  }
19141
- return _isObject8(parsed) ? parsed : { _raw: parsed };
19440
+ return _isObject9(parsed) ? parsed : { _raw: parsed };
19142
19441
  }
19143
19442
  function _load_yaml3(p) {
19144
- const text = fs38.readFileSync(p, "utf-8");
19443
+ const text = fs40.readFileSync(p, "utf-8");
19145
19444
  const data = (0, import_yaml6.parse)(text, { version: "1.1" });
19146
- return _isObject8(data) ? data : {};
19445
+ return _isObject9(data) ? data : {};
19147
19446
  }
19148
19447
  function _resolve_concerns(manifest, platform, event) {
19149
19448
  const platformsRaw = manifest["platforms"];
19150
- const platforms = _isObject8(platformsRaw) ? platformsRaw : {};
19449
+ const platforms = _isObject9(platformsRaw) ? platformsRaw : {};
19151
19450
  const block = platforms[platform];
19152
19451
  if (!block) {
19153
19452
  return [];
19154
19453
  }
19155
- if (_isObject8(block) && block["fallback_only"]) {
19454
+ if (_isObject9(block) && block["fallback_only"]) {
19156
19455
  return [];
19157
19456
  }
19158
- const names = _isObject8(block) ? block[event] : null;
19457
+ const names = _isObject9(block) ? block[event] : null;
19159
19458
  if (!Array.isArray(names)) {
19160
19459
  return [];
19161
19460
  }
19162
19461
  const concernsRaw = manifest["concerns"];
19163
- const concerns_def = _isObject8(concernsRaw) ? concernsRaw : {};
19462
+ const concerns_def = _isObject9(concernsRaw) ? concernsRaw : {};
19164
19463
  const out = [];
19165
19464
  for (const name of names) {
19166
19465
  const spec = typeof name === "string" ? concerns_def[name] : void 0;
19167
- if (!spec || !_isObject8(spec)) {
19466
+ if (!spec || !_isObject9(spec)) {
19168
19467
  process.stderr.write(
19169
19468
  `dispatch_hook: unknown concern '${String(name)}' in manifest
19170
19469
  `
@@ -19254,7 +19553,7 @@ function _maybe_capture_payload(args, payload_text) {
19254
19553
  }
19255
19554
  try {
19256
19555
  const target = _expanduser2(capture_dir);
19257
- fs38.mkdirSync(target, { recursive: true });
19556
+ fs40.mkdirSync(target, { recursive: true });
19258
19557
  let payload;
19259
19558
  try {
19260
19559
  payload = payload_text.trim() ? JSON.parse(payload_text) : {};
@@ -19271,8 +19570,8 @@ function _maybe_capture_payload(args, payload_text) {
19271
19570
  const ts = Date.now();
19272
19571
  const native = (args.native_event || args.event).replace(/\//g, "_");
19273
19572
  const fname = `${args.platform}__${native}__${ts}__${process.pid}.json`;
19274
- fs38.writeFileSync(
19275
- path38.join(target, fname),
19573
+ fs40.writeFileSync(
19574
+ path40.join(target, fname),
19276
19575
  _py_json_dumps2(record, 2) + "\n",
19277
19576
  { encoding: "utf-8" }
19278
19577
  );
@@ -19283,7 +19582,7 @@ function _maybe_capture_payload(args, payload_text) {
19283
19582
  function _expanduser2(p) {
19284
19583
  if (p === "~" || p.startsWith("~/")) {
19285
19584
  const home = process.env["HOME"] || process.env["USERPROFILE"] || "";
19286
- return path38.join(home, p.slice(1));
19585
+ return path40.join(home, p.slice(1));
19287
19586
  }
19288
19587
  return p;
19289
19588
  }
@@ -19291,7 +19590,7 @@ function _build_envelope(args, payload_text) {
19291
19590
  let payload;
19292
19591
  try {
19293
19592
  payload = payload_text.trim() ? JSON.parse(payload_text) : {};
19294
- if (!_isObject8(payload)) {
19593
+ if (!_isObject9(payload)) {
19295
19594
  payload = { _raw: payload };
19296
19595
  }
19297
19596
  } catch {
@@ -19315,25 +19614,25 @@ function _resolve_tsx_invocation2(scriptPath, scriptArgs) {
19315
19614
  const walkUp = (start) => {
19316
19615
  let dir = start;
19317
19616
  for (; ; ) {
19318
- const candidate = path38.join(dir, "node_modules", ".bin", binName);
19617
+ const candidate = path40.join(dir, "node_modules", ".bin", binName);
19319
19618
  if (_isFile7(candidate)) {
19320
19619
  return candidate;
19321
19620
  }
19322
- const parent = path38.dirname(dir);
19621
+ const parent = path40.dirname(dir);
19323
19622
  if (parent === dir) {
19324
19623
  return null;
19325
19624
  }
19326
19625
  dir = parent;
19327
19626
  }
19328
19627
  };
19329
- const tsx = walkUp(path38.dirname(scriptPath)) ?? walkUp(path38.dirname(fileURLToPath29(import.meta.url)));
19628
+ const tsx = walkUp(path40.dirname(scriptPath)) ?? walkUp(path40.dirname(fileURLToPath30(import.meta.url)));
19330
19629
  if (tsx !== null) {
19331
19630
  return { command: tsx, args: [scriptPath, ...scriptArgs] };
19332
19631
  }
19333
19632
  return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
19334
19633
  }
19335
19634
  function _run_concern_inproc(main_fn, concern, envelope) {
19336
- const scriptAbs = path38.join(REPO_ROOT, String(concern["script"]));
19635
+ const scriptAbs = path40.join(REPO_ROOT, String(concern["script"]));
19337
19636
  const argsList = Array.isArray(concern["args"]) ? concern["args"].map((a) => String(a)) : [];
19338
19637
  argsList.push("--platform", String(envelope["platform"] || "generic"));
19339
19638
  const workspace = String(envelope["workspace_root"] || process.cwd());
@@ -19410,7 +19709,7 @@ function _run_concern(concern, envelope) {
19410
19709
  return _run_concern_inproc(inproc, concern, envelope);
19411
19710
  }
19412
19711
  }
19413
- const script = path38.join(REPO_ROOT, String(concern["script"]));
19712
+ const script = path40.join(REPO_ROOT, String(concern["script"]));
19414
19713
  const argsList = Array.isArray(concern["args"]) ? concern["args"].map((a) => String(a)) : [];
19415
19714
  const cmd = [script, ...argsList];
19416
19715
  cmd.push("--platform", String(envelope["platform"] || "generic"));
@@ -19467,7 +19766,7 @@ function _run_concern(concern, envelope) {
19467
19766
  }
19468
19767
  function _isFile7(p) {
19469
19768
  try {
19470
- return fs38.statSync(p).isFile();
19769
+ return fs40.statSync(p).isFile();
19471
19770
  } catch {
19472
19771
  return false;
19473
19772
  }
@@ -19476,23 +19775,23 @@ function _compactJsonDumps(value) {
19476
19775
  return JSON.stringify(value);
19477
19776
  }
19478
19777
  function _reduce(rcs) {
19479
- if (rcs.some((rc) => rc === EXIT_BLOCK)) {
19480
- return EXIT_BLOCK;
19778
+ if (rcs.some((rc) => rc === EXIT_BLOCK2)) {
19779
+ return EXIT_BLOCK2;
19481
19780
  }
19482
- if (rcs.some((rc) => rc === EXIT_WARN6)) {
19483
- return EXIT_WARN6;
19781
+ if (rcs.some((rc) => rc === EXIT_WARN7)) {
19782
+ return EXIT_WARN7;
19484
19783
  }
19485
- return EXIT_ALLOW8;
19784
+ return EXIT_ALLOW9;
19486
19785
  }
19487
19786
  function _write_feedback(envelope, session_id, entries, final_rc, started_at) {
19488
19787
  if (is_replay_mode()) {
19489
19788
  return;
19490
19789
  }
19491
19790
  const workspace = String(envelope["workspace_root"] || process.cwd());
19492
- const state_root = path38.join(workspace, "agents", "runtime", "state");
19791
+ const state_root = path40.join(workspace, "agents", "runtime", "state");
19493
19792
  const fb_dir = feedback_dir(state_root, session_id);
19494
19793
  try {
19495
- fs38.mkdirSync(fb_dir, { recursive: true });
19794
+ fs40.mkdirSync(fb_dir, { recursive: true });
19496
19795
  } catch (exc) {
19497
19796
  const msg = exc instanceof Error ? exc.message : String(exc);
19498
19797
  process.stderr.write(`dispatch_hook: feedback dir unavailable: ${msg}
@@ -19500,7 +19799,7 @@ function _write_feedback(envelope, session_id, entries, final_rc, started_at) {
19500
19799
  return;
19501
19800
  }
19502
19801
  for (const entry of entries) {
19503
- const target = path38.join(fb_dir, `${entry["concern"]}.json`);
19802
+ const target = path40.join(fb_dir, `${entry["concern"]}.json`);
19504
19803
  try {
19505
19804
  atomic_write_json(target, entry);
19506
19805
  } catch (exc) {
@@ -19540,7 +19839,7 @@ function _write_feedback(envelope, session_id, entries, final_rc, started_at) {
19540
19839
  })
19541
19840
  };
19542
19841
  try {
19543
- atomic_write_json(path38.join(fb_dir, "summary.json"), summary);
19842
+ atomic_write_json(path40.join(fb_dir, "summary.json"), summary);
19544
19843
  } catch (exc) {
19545
19844
  const msg = exc instanceof Error ? exc.message : String(exc);
19546
19845
  process.stderr.write(`dispatch_hook: summary write failed: ${msg}
@@ -19550,17 +19849,17 @@ function _write_feedback(envelope, session_id, entries, final_rc, started_at) {
19550
19849
  function _record_rule_trips(envelope, entries) {
19551
19850
  if (is_replay_mode()) return;
19552
19851
  const tripped = entries.filter(
19553
- (e) => e["exit_code"] === EXIT_BLOCK || e["exit_code"] === EXIT_WARN6
19852
+ (e) => e["exit_code"] === EXIT_BLOCK2 || e["exit_code"] === EXIT_WARN7
19554
19853
  );
19555
19854
  if (tripped.length === 0) return;
19556
19855
  try {
19557
19856
  const workspace = String(envelope["workspace_root"] || process.cwd());
19558
- const state_dir = path38.join(workspace, "agents", "runtime", "state");
19559
- const target = path38.join(state_dir, "rule-trips.json");
19560
- fs38.mkdirSync(state_dir, { recursive: true });
19857
+ const state_dir = path40.join(workspace, "agents", "runtime", "state");
19858
+ const target = path40.join(state_dir, "rule-trips.json");
19859
+ fs40.mkdirSync(state_dir, { recursive: true });
19561
19860
  let doc = { schema_version: 1, concerns: {} };
19562
19861
  try {
19563
- const parsed = JSON.parse(fs38.readFileSync(target, "utf-8"));
19862
+ const parsed = JSON.parse(fs40.readFileSync(target, "utf-8"));
19564
19863
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) doc = parsed;
19565
19864
  } catch {
19566
19865
  }
@@ -19570,8 +19869,8 @@ function _record_rule_trips(envelope, entries) {
19570
19869
  const name = String(e["concern"]);
19571
19870
  const prev = concerns[name] ?? { block: 0, warn: 0 };
19572
19871
  concerns[name] = {
19573
- block: (Number(prev["block"]) || 0) + (e["exit_code"] === EXIT_BLOCK ? 1 : 0),
19574
- warn: (Number(prev["warn"]) || 0) + (e["exit_code"] === EXIT_WARN6 ? 1 : 0),
19872
+ block: (Number(prev["block"]) || 0) + (e["exit_code"] === EXIT_BLOCK2 ? 1 : 0),
19873
+ warn: (Number(prev["warn"]) || 0) + (e["exit_code"] === EXIT_WARN7 ? 1 : 0),
19575
19874
  last_trip: today
19576
19875
  };
19577
19876
  }
@@ -19659,7 +19958,7 @@ function _parse_args(argv) {
19659
19958
  }
19660
19959
  return args;
19661
19960
  }
19662
- function main28(argv) {
19961
+ function main29(argv) {
19663
19962
  const args = _parse_args(argv ?? process.argv.slice(2));
19664
19963
  if (args.project_dir) {
19665
19964
  const project_dir = _expanduser2(args.project_dir);
@@ -19677,13 +19976,13 @@ function main28(argv) {
19677
19976
  `dispatch_hook: unknown event '${args.event}'; allowed: ${_sortedRepr(EVENT_VOCABULARY)}
19678
19977
  `
19679
19978
  );
19680
- return EXIT_ALLOW8;
19979
+ return EXIT_ALLOW9;
19681
19980
  }
19682
19981
  const manifest_path = args.manifest;
19683
- if (!fs38.existsSync(manifest_path)) {
19982
+ if (!fs40.existsSync(manifest_path)) {
19684
19983
  process.stderr.write(`dispatch_hook: manifest missing at ${manifest_path}
19685
19984
  `);
19686
- return EXIT_ALLOW8;
19985
+ return EXIT_ALLOW9;
19687
19986
  }
19688
19987
  const manifest = _load_yaml3(manifest_path);
19689
19988
  if (args.min_version) {
@@ -19705,10 +20004,10 @@ function main28(argv) {
19705
20004
  concerns: concerns.map((c) => c["name"])
19706
20005
  };
19707
20006
  process.stdout.write(_py_json_dumps2(plan, 2) + "\n");
19708
- return EXIT_ALLOW8;
20007
+ return EXIT_ALLOW9;
19709
20008
  }
19710
20009
  if (concerns.length === 0) {
19711
- return EXIT_ALLOW8;
20010
+ return EXIT_ALLOW9;
19712
20011
  }
19713
20012
  const envelope = _build_envelope(args, payload_text);
19714
20013
  const session_id = _resolve_session_id(envelope);
@@ -19723,9 +20022,9 @@ function main28(argv) {
19723
20022
  const raw_rc = rc;
19724
20023
  if (rc >= 3) {
19725
20024
  if (!concern["fail_closed"]) {
19726
- rc = EXIT_ALLOW8;
20025
+ rc = EXIT_ALLOW9;
19727
20026
  } else {
19728
- rc = EXIT_BLOCK;
20027
+ rc = EXIT_BLOCK2;
19729
20028
  }
19730
20029
  if (stderr_text) {
19731
20030
  process.stderr.write(stderr_text);
@@ -19733,7 +20032,7 @@ function main28(argv) {
19733
20032
  }
19734
20033
  rcs.push(rc);
19735
20034
  const reply = _parse_concern_stdout(stdout_text);
19736
- if (args.event === "session_start" && rc === EXIT_ALLOW8 && typeof reply["context"] === "string" && reply["context"].trim()) {
20035
+ if (args.event === "session_start" && rc === EXIT_ALLOW9 && typeof reply["context"] === "string" && reply["context"].trim()) {
19737
20036
  context_blocks.push(reply["context"].trim());
19738
20037
  }
19739
20038
  feedback_entries.push({
@@ -19752,14 +20051,14 @@ function main28(argv) {
19752
20051
  const final_rc = _reduce(rcs);
19753
20052
  _write_feedback(envelope, session_id, feedback_entries, final_rc, started_at);
19754
20053
  _record_rule_trips(envelope, feedback_entries);
19755
- if (context_blocks.length > 0 && final_rc === EXIT_ALLOW8) {
20054
+ if (context_blocks.length > 0 && final_rc === EXIT_ALLOW9) {
19756
20055
  process.stdout.write(context_blocks.join("\n\n") + "\n");
19757
20056
  }
19758
20057
  return final_rc;
19759
20058
  }
19760
20059
  function _isDir4(p) {
19761
20060
  try {
19762
- return fs38.statSync(p).isDirectory();
20061
+ return fs40.statSync(p).isDirectory();
19763
20062
  } catch {
19764
20063
  return false;
19765
20064
  }
@@ -19770,41 +20069,41 @@ function _sortedRepr(s) {
19770
20069
  }
19771
20070
  function _readStdin14() {
19772
20071
  try {
19773
- return fs38.readFileSync(0, "utf-8");
20072
+ return fs40.readFileSync(0, "utf-8");
19774
20073
  } catch {
19775
20074
  return "";
19776
20075
  }
19777
20076
  }
19778
- function _isCliEntry23() {
20077
+ function _isCliEntry24() {
19779
20078
  if (true) {
19780
20079
  return false;
19781
20080
  }
19782
20081
  if (process.argv[1] === void 0) {
19783
20082
  return false;
19784
20083
  }
19785
- const argvUrl = pathToFileURL25(path38.resolve(process.argv[1])).href;
20084
+ const argvUrl = pathToFileURL26(path40.resolve(process.argv[1])).href;
19786
20085
  if (import.meta.url === argvUrl) {
19787
20086
  return true;
19788
20087
  }
19789
20088
  try {
19790
- const here = fs38.realpathSync(fileURLToPath29(import.meta.url));
19791
- const argv = fs38.realpathSync(path38.resolve(process.argv[1]));
20089
+ const here = fs40.realpathSync(fileURLToPath30(import.meta.url));
20090
+ const argv = fs40.realpathSync(path40.resolve(process.argv[1]));
19792
20091
  return here === argv;
19793
20092
  } catch {
19794
20093
  return false;
19795
20094
  }
19796
20095
  }
19797
- var isCliEntry11 = _isCliEntry23();
20096
+ var isCliEntry11 = _isCliEntry24();
19798
20097
  if (isCliEntry11) {
19799
- process.exit(main28(process.argv.slice(2)));
20098
+ process.exit(main29(process.argv.slice(2)));
19800
20099
  }
19801
20100
 
19802
20101
  // src/scripts/hooks/dispatch_entry.ts
19803
- var _selfPath = fileURLToPath30(import.meta.url);
19804
- var _invokedDirectly2 = globalThis.__AC_HOOKS_BUNDLE_DIRECT === true || process.argv[1] !== void 0 && path39.resolve(process.argv[1]) === path39.resolve(_selfPath);
20102
+ var _selfPath = fileURLToPath31(import.meta.url);
20103
+ var _invokedDirectly2 = globalThis.__AC_HOOKS_BUNDLE_DIRECT === true || process.argv[1] !== void 0 && path41.resolve(process.argv[1]) === path41.resolve(_selfPath);
19805
20104
  if (_invokedDirectly2) {
19806
- process.exitCode = main28(process.argv.slice(2));
20105
+ process.exitCode = main29(process.argv.slice(2));
19807
20106
  }
19808
20107
  export {
19809
- main28 as main
20108
+ main29 as main
19810
20109
  };