@event4u/agent-config 9.13.0 → 9.15.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 (280) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +113 -67
  3. package/README.md +9 -1
  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 +150 -0
  15. package/dist/agent-src/commands/optimize/skills.md +5 -5
  16. package/dist/agent-src/commands/optimize.md +12 -6
  17. package/dist/agent-src/commands/override.md +1 -0
  18. package/dist/agent-src/commands/prediction-pool.md +4 -4
  19. package/dist/agent-src/commands/research/deep.md +1 -1
  20. package/dist/agent-src/commands/roadmap.md +2 -1
  21. package/dist/agent-src/commands/rule-compliance-audit.md +1 -1
  22. package/dist/agent-src/commands/tdd.md +1 -0
  23. package/dist/agent-src/commands/tests.md +1 -0
  24. package/dist/agent-src/commands/upstream-contribute.md +5 -5
  25. package/dist/agent-src/commands/video/from-script.md +1 -1
  26. package/dist/agent-src/commands/video/from-song.md +1 -1
  27. package/dist/agent-src/commands/video/scene.md +1 -1
  28. package/dist/agent-src/commands/video/stitch.md +1 -1
  29. package/dist/agent-src/commands/video/storyboard.md +1 -1
  30. package/dist/agent-src/commands/worktree/create.md +2 -1
  31. package/dist/agent-src/contexts/augment-infrastructure.md +1 -1
  32. package/dist/agent-src/contexts/contracts/artifact-engagement-flow.md +5 -5
  33. package/dist/agent-src/contexts/contracts/command-suggestion-flow.md +3 -3
  34. package/dist/agent-src/contexts/contracts/emergency-triage-block.md +2 -2
  35. package/dist/agent-src/contexts/execution/roadmap-process-loop.md +4 -3
  36. package/dist/agent-src/contexts/execution/subagent-routing.md +19 -0
  37. package/dist/agent-src/contexts/override-system.md +1 -1
  38. package/dist/agent-src/ghostwriter/fictional-fixture-v1.md +1 -1
  39. package/dist/agent-src/rules/augment-edit-discipline.md +1 -1
  40. package/dist/agent-src/rules/autonomous-execution.md +2 -1
  41. package/dist/agent-src/rules/brand-consistency.md +1 -0
  42. package/dist/agent-src/rules/brand-source-of-truth.md +1 -0
  43. package/dist/agent-src/rules/code-comment-discipline.md +2 -0
  44. package/dist/agent-src/rules/communication-through-line.md +1 -0
  45. package/dist/agent-src/rules/content-quoting-floor.md +1 -0
  46. package/dist/agent-src/rules/cross-source-consistency.md +0 -1
  47. package/dist/agent-src/rules/downstream-changes.md +1 -0
  48. package/dist/agent-src/rules/external-code-graph-interop.md +1 -0
  49. package/dist/agent-src/rules/external-reference-deep-dive.md +1 -0
  50. package/dist/agent-src/rules/fast-path-marker-visibility.md +1 -0
  51. package/dist/agent-src/rules/finance-safety-floor.md +0 -1
  52. package/dist/agent-src/rules/icon-consistency.md +1 -0
  53. package/dist/agent-src/rules/image-likeness-and-rights.md +1 -0
  54. package/dist/agent-src/rules/improve-before-implement.md +1 -1
  55. package/dist/agent-src/rules/invite-challenge.md +1 -0
  56. package/dist/agent-src/rules/lethal-trifecta-guard.md +1 -0
  57. package/dist/agent-src/rules/low-impact-corpus-privacy-floor.md +1 -0
  58. package/dist/agent-src/rules/markdown-safe-codeblocks.md +1 -0
  59. package/dist/agent-src/rules/media-governance-routing.md +4 -3
  60. package/dist/agent-src/rules/media-sync-ground-truth.md +1 -0
  61. package/dist/agent-src/rules/no-attribution-footers.md +1 -0
  62. package/dist/agent-src/rules/no-decorative-emojis-in-git-surfaces.md +1 -0
  63. package/dist/agent-src/rules/no-pr-progress-comments.md +1 -0
  64. package/dist/agent-src/rules/onboarding-gate.md +1 -0
  65. package/dist/agent-src/rules/output-discipline.md +1 -0
  66. package/dist/agent-src/rules/prefer-enums-over-literals.md +1 -0
  67. package/dist/agent-src/rules/preservation-guard.md +1 -0
  68. package/dist/agent-src/rules/question-not-instruction.md +1 -0
  69. package/dist/agent-src/rules/roadmap-ci-steps-policy.md +1 -0
  70. package/dist/agent-src/rules/role-mode-adherence.md +1 -0
  71. package/dist/agent-src/rules/runtime-safety.md +1 -0
  72. package/dist/agent-src/rules/security-sensitive-stop.md +1 -0
  73. package/dist/agent-src/rules/session-canary.md +9 -2
  74. package/dist/agent-src/rules/source-confidentiality.md +1 -0
  75. package/dist/agent-src/rules/source-of-truth.md +1 -0
  76. package/dist/agent-src/rules/spreadsheet-source-quality.md +1 -0
  77. package/dist/agent-src/rules/think-before-action.md +1 -0
  78. package/dist/agent-src/rules/token-budget-discipline.md +1 -0
  79. package/dist/agent-src/rules/token-efficiency.md +1 -0
  80. package/dist/agent-src/rules/token-optimizer-maintenance.md +5 -5
  81. package/dist/agent-src/rules/tool-safety.md +1 -0
  82. package/dist/agent-src/rules/untrusted-input-defense.md +2 -0
  83. package/dist/agent-src/rules/user-interaction.md +1 -0
  84. package/dist/agent-src/rules/user-interrupt-priority.md +1 -0
  85. package/dist/agent-src/skills/adr-create/SKILL.md +1 -1
  86. package/dist/agent-src/skills/check-refs/SKILL.md +1 -1
  87. package/dist/agent-src/skills/competitive-positioning/SKILL.md +1 -1
  88. package/dist/agent-src/skills/condense-memory/SKILL.md +1 -1
  89. package/dist/agent-src/skills/context-authoring/SKILL.md +1 -1
  90. package/dist/agent-src/skills/copilot-agents-optimization/SKILL.md +1 -1
  91. package/dist/agent-src/skills/description-assist/SKILL.md +1 -1
  92. package/dist/agent-src/skills/github-ci/SKILL.md +1 -0
  93. package/dist/agent-src/skills/guideline-writing/SKILL.md +1 -1
  94. package/dist/agent-src/skills/lint-skills/SKILL.md +1 -1
  95. package/dist/agent-src/skills/readme-reviewer/SKILL.md +1 -1
  96. package/dist/agent-src/skills/roadmap-management/SKILL.md +8 -1
  97. package/dist/agent-src/skills/roadmap-writing/SKILL.md +1 -1
  98. package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +1 -1
  99. package/dist/agent-src/skills/skill-writing/SKILL.md +4 -4
  100. package/dist/agent-src/skills/token-optimizer/SKILL.md +4 -4
  101. package/dist/agent-src/skills/upstream-contribute/SKILL.md +6 -6
  102. package/dist/agent-src/skills/using-git-worktrees/SKILL.md +25 -0
  103. package/dist/agent-src/templates/AGENTS.md +1 -1
  104. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  105. package/dist/agent-src/templates/command.md +1 -1
  106. package/dist/agent-src/templates/copilot-instructions.md +3 -3
  107. package/dist/agent-src/templates/rule.md +2 -2
  108. package/dist/agent-src/templates/scripts/work_engine/orchestration.ts +1 -1
  109. package/dist/agent-src/templates/skill-archive-note.md +5 -5
  110. package/dist/agent-src/templates/skill.md +1 -1
  111. package/dist/cli/agent-config.js +66 -19
  112. package/dist/cli/agent-config.js.map +1 -1
  113. package/dist/cli/main.js +9 -4
  114. package/dist/cli/main.js.map +1 -1
  115. package/dist/cli/python/workspace_drive.js +2 -0
  116. package/dist/cli/python/workspace_drive.js.map +1 -1
  117. package/dist/cli/python/workspace_drive_health.js +2 -0
  118. package/dist/cli/python/workspace_drive_health.js.map +1 -1
  119. package/dist/cli/python/workspace_hosts.js +2 -0
  120. package/dist/cli/python/workspace_hosts.js.map +1 -1
  121. package/dist/cli/python/workspace_sessions.js +2 -0
  122. package/dist/cli/python/workspace_sessions.js.map +1 -1
  123. package/dist/cli/registry.js +1 -0
  124. package/dist/cli/registry.js.map +1 -1
  125. package/dist/cli-delegate/{chunk-A3HJ6NTI.js → chunk-63WSP6YZ.js} +2 -1
  126. package/dist/cli-delegate/{chunk-EJYIGZ3T.js → chunk-BKO2AZ7Z.js} +1 -1
  127. package/dist/cli-delegate/{chunk-QFKQLQ7X.js → chunk-H574KOUH.js} +340 -462
  128. package/dist/cli-delegate/chunk-NXFWFAYV.js +339 -0
  129. package/dist/cli-delegate/{chunk-TEGJU2JX.js → chunk-ZXXJLL5K.js} +2 -2
  130. package/dist/cli-delegate/cmd_conformance.js +29 -23
  131. package/dist/cli-delegate/cmd_doctor.js +3 -3
  132. package/dist/cli-delegate/cmd_export.js +4 -4
  133. package/dist/cli-delegate/cmd_preflight.js +2 -2
  134. package/dist/cli-delegate/cmd_prune.js +4 -4
  135. package/dist/cli-delegate/cmd_settings_migrate.js +4 -4
  136. package/dist/cli-delegate/cmd_sync.js +4 -4
  137. package/dist/cli-delegate/cmd_uninstall.js +4 -4
  138. package/dist/cli-delegate/cmd_validate.js +4 -4
  139. package/dist/discovery/deprecation-report.md +1 -1
  140. package/dist/discovery/discovery-manifest.json +163 -103
  141. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  142. package/dist/discovery/discovery-manifest.summary.md +3 -3
  143. package/dist/discovery/orphan-report.md +1 -1
  144. package/dist/discovery/packs.json +6 -5
  145. package/dist/discovery/trust-report.md +3 -3
  146. package/dist/discovery/workspaces.json +5 -4
  147. package/dist/hooks/dispatch.js +729 -430
  148. package/dist/install/install.mjs +700 -625
  149. package/dist/install/rule_scope.js +18 -2
  150. package/dist/install/rule_scope.js.map +1 -1
  151. package/dist/mcp/registry-manifest.json +3 -3
  152. package/dist/mcp/server.json +2 -2
  153. package/dist/mcp/server.mjs +564 -424
  154. package/dist/router.json +1 -1
  155. package/dist/scripts/_lib/claude_settings_hooks.js +30 -5
  156. package/dist/scripts/_lib/claude_settings_hooks.js.map +1 -1
  157. package/dist/scripts/_lib/scoped_projection.js +223 -0
  158. package/dist/scripts/_lib/scoped_projection.js.map +1 -0
  159. package/dist/scripts/_lib/surface_tiers.js +125 -0
  160. package/dist/scripts/_lib/surface_tiers.js.map +1 -0
  161. package/dist/scripts/_lib/token_count.js +166 -0
  162. package/dist/scripts/_lib/token_count.js.map +1 -0
  163. package/dist/scripts/_lib/trigger_eval_floors.js +8 -0
  164. package/dist/scripts/_lib/trigger_eval_floors.js.map +1 -1
  165. package/dist/scripts/condense.js +139 -9
  166. package/dist/scripts/condense.js.map +1 -1
  167. package/dist/scripts/project_thin_rules.js +450 -0
  168. package/dist/scripts/project_thin_rules.js.map +1 -0
  169. package/dist/server/routes/workspace.js +2 -0
  170. package/dist/server/routes/workspace.js.map +1 -1
  171. package/dist/server/schemas/settings.js +9 -3
  172. package/dist/server/schemas/settings.js.map +1 -1
  173. package/dist/ui/assets/index-DJY_vQVn.js +40 -0
  174. package/dist/ui/assets/index-DJY_vQVn.js.map +1 -0
  175. package/dist/ui/index.html +1 -1
  176. package/docs/guidelines/agent-infra/roadmap-progress-mechanics.md +1 -1
  177. package/package.json +11 -11
  178. package/src/agent-src/templates/AGENTS.md +1 -1
  179. package/src/agent-src/templates/scripts/work_engine/orchestration.ts +1 -1
  180. package/src/config/agent-settings.template.yml +59 -11
  181. package/src/config/ci-local-parity.yml +8 -0
  182. package/src/config/discovery/unassigned-artefacts.yml +23 -25
  183. package/src/config/evaluator-budgets.json +35 -5
  184. package/src/config/gate-coverage.yml +147 -0
  185. package/src/config/gate-violation-baselines.json +25 -0
  186. package/src/install/rule_scope.ts +27 -2
  187. package/src/scripts/_cli/cmd_conformance.ts +13 -24
  188. package/src/scripts/_dispatch.bash +10 -0
  189. package/src/scripts/_lib/claude_settings_hooks.ts +30 -4
  190. package/src/scripts/_lib/exec_evidence.ts +5 -0
  191. package/src/scripts/_lib/gate_baseline.ts +213 -0
  192. package/src/scripts/_lib/scoped_projection.ts +262 -0
  193. package/src/scripts/_lib/tier_budget_routing.ts +234 -0
  194. package/src/scripts/_lib/tool_adapter_registry.ts +8 -1
  195. package/src/scripts/_lib/trigger_eval_floors.ts +9 -0
  196. package/src/scripts/_lib/trigger_routers.ts +17 -5
  197. package/src/scripts/adr/regenerate_index.ts +4 -3
  198. package/src/scripts/ai-video/lib/parse-blueprint.sh +1 -1
  199. package/src/scripts/ai_council/compile_corpus.ts +1 -1
  200. package/src/scripts/audit_cloud_compatibility.ts +37 -2
  201. package/src/scripts/audit_initial_context.ts +53 -19
  202. package/src/scripts/audit_likelihood.ts +31 -2
  203. package/src/scripts/audit_user_type_axis.ts +58 -11
  204. package/src/scripts/bench_hook_latency.ts +172 -41
  205. package/src/scripts/build_mcp_catalog.ts +12 -1
  206. package/src/scripts/check_always_budget.ts +122 -11
  207. package/src/scripts/check_artefact_count_messaging.ts +128 -15
  208. package/src/scripts/check_augment_description_cap.ts +24 -3
  209. package/src/scripts/check_ci_strict_superset.ts +150 -0
  210. package/src/scripts/check_cluster_patterns.ts +100 -0
  211. package/src/scripts/check_consumer_scope_flip.ts +26 -4
  212. package/src/scripts/check_evaluator_budgets.ts +198 -19
  213. package/src/scripts/check_gate_coverage.ts +337 -1
  214. package/src/scripts/check_generator_output_coverage.ts +2 -1
  215. package/src/scripts/check_iron_law_prominence.ts +1 -1
  216. package/src/scripts/check_kernel_rule_bundle.ts +1 -1
  217. package/src/scripts/check_no_new_legacy_path.ts +167 -3
  218. package/src/scripts/check_pack_size.ts +18 -4
  219. package/src/scripts/check_portability.ts +37 -7
  220. package/src/scripts/check_references.ts +19 -3
  221. package/src/scripts/check_release_pr_shape.ts +13 -0
  222. package/src/scripts/check_token_regression.ts +9 -2
  223. package/src/scripts/condense.ts +155 -12
  224. package/src/scripts/cost/budget.mjs +63 -2
  225. package/src/scripts/count_scoped_projection.ts +104 -0
  226. package/src/scripts/evaluator_umbrella.sh +34 -1
  227. package/src/scripts/generate_capability_matrix.ts +8 -0
  228. package/src/scripts/generate_router_coverage_from_matrix.ts +155 -0
  229. package/src/scripts/hook_manifest.yaml +17 -3
  230. package/src/scripts/hooks/block_config_weakening.ts +337 -0
  231. package/src/scripts/hooks/concern_registry.ts +2 -0
  232. package/src/scripts/hooks/probe_throttle.ts +75 -0
  233. package/src/scripts/install-hooks.sh +24 -2
  234. package/src/scripts/install.ts +15 -92
  235. package/src/scripts/lint_agents_md.ts +9 -3
  236. package/src/scripts/lint_archived_skills.ts +1 -1
  237. package/src/scripts/lint_artefact_frontmatter.ts +185 -37
  238. package/src/scripts/lint_command_routing.ts +21 -52
  239. package/src/scripts/lint_command_verbs.ts +47 -28
  240. package/src/scripts/lint_context_spine_usage.ts +38 -12
  241. package/src/scripts/lint_framework_leakage.ts +25 -6
  242. package/src/scripts/lint_handoffs.ts +49 -2
  243. package/src/scripts/lint_media_policy_linkage.ts +62 -30
  244. package/src/scripts/lint_namespace.ts +92 -7
  245. package/src/scripts/lint_new_skill_gate.ts +39 -31
  246. package/src/scripts/lint_originality_shingles.ts +7 -1
  247. package/src/scripts/lint_override_kernel_guard.ts +21 -3
  248. package/src/scripts/lint_pack_boundaries.ts +461 -91
  249. package/src/scripts/lint_pack_dependencies.ts +24 -57
  250. package/src/scripts/lint_persona_governance.ts +1 -1
  251. package/src/scripts/lint_role_experiences.ts +34 -5
  252. package/src/scripts/lint_trigger_precision.ts +142 -0
  253. package/src/scripts/mcp_server/consumer_tool_catalog.json +12 -201
  254. package/src/scripts/mcp_server/tools.ts +1 -1
  255. package/src/scripts/prepack-check.mjs +40 -1
  256. package/src/scripts/prepack_router_targets.d.mts +7 -0
  257. package/src/scripts/prepack_router_targets.mjs +93 -0
  258. package/src/scripts/print_required_checks.ts +72 -18
  259. package/src/scripts/profile_staleness_hook.ts +12 -0
  260. package/src/scripts/record_evaluator_measurements.mjs +105 -0
  261. package/src/scripts/recruit_preflight.sh +1 -1
  262. package/src/scripts/release.ts +105 -1
  263. package/src/scripts/router_target_paths.d.mts +4 -0
  264. package/src/scripts/router_target_paths.mjs +69 -0
  265. package/src/scripts/router_telemetry.ts +52 -1
  266. package/src/scripts/routing_doctor.ts +485 -0
  267. package/src/scripts/rule_trigger_eval.ts +403 -0
  268. package/src/scripts/schemas/rule.schema.json +5 -1
  269. package/src/scripts/session_canary_hook.ts +96 -5
  270. package/src/scripts/skill_linter.ts +90 -42
  271. package/src/scripts/smoke/skills.sh +1 -1
  272. package/src/scripts/sweep_dead_scan_roots.ts +356 -10
  273. package/src/scripts/trigger_coverage.ts +13 -2
  274. package/src/scripts/update_counts.ts +91 -12
  275. package/src/scripts/validate_telegraph_carveouts.ts +1 -1
  276. package/src/scripts/wrapper_freshness_hook.ts +14 -0
  277. package/src/server/schemas/settings.ts +19 -5
  278. package/dist/cli-delegate/chunk-TJIAM5FW.js +0 -133
  279. package/dist/ui/assets/index-BpSQt5vm.js +0 -40
  280. package/dist/ui/assets/index-BpSQt5vm.js.map +0 -1
@@ -1669,17 +1669,17 @@ var require_visit = __commonJS({
1669
1669
  visit.BREAK = BREAK;
1670
1670
  visit.SKIP = SKIP;
1671
1671
  visit.REMOVE = REMOVE;
1672
- function visit_(key, node, visitor, path50) {
1673
- const ctrl = callVisitor(key, node, visitor, path50);
1672
+ function visit_(key, node, visitor, path51) {
1673
+ const ctrl = callVisitor(key, node, visitor, path51);
1674
1674
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
1675
- replaceNode(key, path50, ctrl);
1676
- return visit_(key, ctrl, visitor, path50);
1675
+ replaceNode(key, path51, ctrl);
1676
+ return visit_(key, ctrl, visitor, path51);
1677
1677
  }
1678
1678
  if (typeof ctrl !== "symbol") {
1679
1679
  if (identity.isCollection(node)) {
1680
- path50 = Object.freeze(path50.concat(node));
1680
+ path51 = Object.freeze(path51.concat(node));
1681
1681
  for (let i = 0; i < node.items.length; ++i) {
1682
- const ci = visit_(i, node.items[i], visitor, path50);
1682
+ const ci = visit_(i, node.items[i], visitor, path51);
1683
1683
  if (typeof ci === "number")
1684
1684
  i = ci - 1;
1685
1685
  else if (ci === BREAK)
@@ -1690,13 +1690,13 @@ var require_visit = __commonJS({
1690
1690
  }
1691
1691
  }
1692
1692
  } else if (identity.isPair(node)) {
1693
- path50 = Object.freeze(path50.concat(node));
1694
- const ck = visit_("key", node.key, visitor, path50);
1693
+ path51 = Object.freeze(path51.concat(node));
1694
+ const ck = visit_("key", node.key, visitor, path51);
1695
1695
  if (ck === BREAK)
1696
1696
  return BREAK;
1697
1697
  else if (ck === REMOVE)
1698
1698
  node.key = null;
1699
- const cv = visit_("value", node.value, visitor, path50);
1699
+ const cv = visit_("value", node.value, visitor, path51);
1700
1700
  if (cv === BREAK)
1701
1701
  return BREAK;
1702
1702
  else if (cv === REMOVE)
@@ -1717,17 +1717,17 @@ var require_visit = __commonJS({
1717
1717
  visitAsync.BREAK = BREAK;
1718
1718
  visitAsync.SKIP = SKIP;
1719
1719
  visitAsync.REMOVE = REMOVE;
1720
- async function visitAsync_(key, node, visitor, path50) {
1721
- const ctrl = await callVisitor(key, node, visitor, path50);
1720
+ async function visitAsync_(key, node, visitor, path51) {
1721
+ const ctrl = await callVisitor(key, node, visitor, path51);
1722
1722
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
1723
- replaceNode(key, path50, ctrl);
1724
- return visitAsync_(key, ctrl, visitor, path50);
1723
+ replaceNode(key, path51, ctrl);
1724
+ return visitAsync_(key, ctrl, visitor, path51);
1725
1725
  }
1726
1726
  if (typeof ctrl !== "symbol") {
1727
1727
  if (identity.isCollection(node)) {
1728
- path50 = Object.freeze(path50.concat(node));
1728
+ path51 = Object.freeze(path51.concat(node));
1729
1729
  for (let i = 0; i < node.items.length; ++i) {
1730
- const ci = await visitAsync_(i, node.items[i], visitor, path50);
1730
+ const ci = await visitAsync_(i, node.items[i], visitor, path51);
1731
1731
  if (typeof ci === "number")
1732
1732
  i = ci - 1;
1733
1733
  else if (ci === BREAK)
@@ -1738,13 +1738,13 @@ var require_visit = __commonJS({
1738
1738
  }
1739
1739
  }
1740
1740
  } else if (identity.isPair(node)) {
1741
- path50 = Object.freeze(path50.concat(node));
1742
- const ck = await visitAsync_("key", node.key, visitor, path50);
1741
+ path51 = Object.freeze(path51.concat(node));
1742
+ const ck = await visitAsync_("key", node.key, visitor, path51);
1743
1743
  if (ck === BREAK)
1744
1744
  return BREAK;
1745
1745
  else if (ck === REMOVE)
1746
1746
  node.key = null;
1747
- const cv = await visitAsync_("value", node.value, visitor, path50);
1747
+ const cv = await visitAsync_("value", node.value, visitor, path51);
1748
1748
  if (cv === BREAK)
1749
1749
  return BREAK;
1750
1750
  else if (cv === REMOVE)
@@ -1771,23 +1771,23 @@ var require_visit = __commonJS({
1771
1771
  }
1772
1772
  return visitor;
1773
1773
  }
1774
- function callVisitor(key, node, visitor, path50) {
1774
+ function callVisitor(key, node, visitor, path51) {
1775
1775
  if (typeof visitor === "function")
1776
- return visitor(key, node, path50);
1776
+ return visitor(key, node, path51);
1777
1777
  if (identity.isMap(node))
1778
- return visitor.Map?.(key, node, path50);
1778
+ return visitor.Map?.(key, node, path51);
1779
1779
  if (identity.isSeq(node))
1780
- return visitor.Seq?.(key, node, path50);
1780
+ return visitor.Seq?.(key, node, path51);
1781
1781
  if (identity.isPair(node))
1782
- return visitor.Pair?.(key, node, path50);
1782
+ return visitor.Pair?.(key, node, path51);
1783
1783
  if (identity.isScalar(node))
1784
- return visitor.Scalar?.(key, node, path50);
1784
+ return visitor.Scalar?.(key, node, path51);
1785
1785
  if (identity.isAlias(node))
1786
- return visitor.Alias?.(key, node, path50);
1786
+ return visitor.Alias?.(key, node, path51);
1787
1787
  return void 0;
1788
1788
  }
1789
- function replaceNode(key, path50, node) {
1790
- const parent = path50[path50.length - 1];
1789
+ function replaceNode(key, path51, node) {
1790
+ const parent = path51[path51.length - 1];
1791
1791
  if (identity.isCollection(parent)) {
1792
1792
  parent.items[key] = node;
1793
1793
  } else if (identity.isPair(parent)) {
@@ -2397,10 +2397,10 @@ var require_Collection = __commonJS({
2397
2397
  var createNode = require_createNode();
2398
2398
  var identity = require_identity();
2399
2399
  var Node = require_Node();
2400
- function collectionFromPath(schema, path50, value) {
2400
+ function collectionFromPath(schema, path51, value) {
2401
2401
  let v = value;
2402
- for (let i = path50.length - 1; i >= 0; --i) {
2403
- const k = path50[i];
2402
+ for (let i = path51.length - 1; i >= 0; --i) {
2403
+ const k = path51[i];
2404
2404
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
2405
2405
  const a = [];
2406
2406
  a[k] = v;
@@ -2419,7 +2419,7 @@ var require_Collection = __commonJS({
2419
2419
  sourceObjects: /* @__PURE__ */ new Map()
2420
2420
  });
2421
2421
  }
2422
- var isEmptyPath = (path50) => path50 == null || typeof path50 === "object" && !!path50[Symbol.iterator]().next().done;
2422
+ var isEmptyPath = (path51) => path51 == null || typeof path51 === "object" && !!path51[Symbol.iterator]().next().done;
2423
2423
  var Collection = class extends Node.NodeBase {
2424
2424
  constructor(type, schema) {
2425
2425
  super(type);
@@ -2449,11 +2449,11 @@ var require_Collection = __commonJS({
2449
2449
  * be a Pair instance or a `{ key, value }` object, which may not have a key
2450
2450
  * that already exists in the map.
2451
2451
  */
2452
- addIn(path50, value) {
2453
- if (isEmptyPath(path50))
2452
+ addIn(path51, value) {
2453
+ if (isEmptyPath(path51))
2454
2454
  this.add(value);
2455
2455
  else {
2456
- const [key, ...rest] = path50;
2456
+ const [key, ...rest] = path51;
2457
2457
  const node = this.get(key, true);
2458
2458
  if (identity.isCollection(node))
2459
2459
  node.addIn(rest, value);
@@ -2467,8 +2467,8 @@ var require_Collection = __commonJS({
2467
2467
  * Removes a value from the collection.
2468
2468
  * @returns `true` if the item was found and removed.
2469
2469
  */
2470
- deleteIn(path50) {
2471
- const [key, ...rest] = path50;
2470
+ deleteIn(path51) {
2471
+ const [key, ...rest] = path51;
2472
2472
  if (rest.length === 0)
2473
2473
  return this.delete(key);
2474
2474
  const node = this.get(key, true);
@@ -2482,8 +2482,8 @@ var require_Collection = __commonJS({
2482
2482
  * scalar values from their surrounding node; to disable set `keepScalar` to
2483
2483
  * `true` (collections are always returned intact).
2484
2484
  */
2485
- getIn(path50, keepScalar) {
2486
- const [key, ...rest] = path50;
2485
+ getIn(path51, keepScalar) {
2486
+ const [key, ...rest] = path51;
2487
2487
  const node = this.get(key, true);
2488
2488
  if (rest.length === 0)
2489
2489
  return !keepScalar && identity.isScalar(node) ? node.value : node;
@@ -2501,8 +2501,8 @@ var require_Collection = __commonJS({
2501
2501
  /**
2502
2502
  * Checks if the collection includes a value with the key `key`.
2503
2503
  */
2504
- hasIn(path50) {
2505
- const [key, ...rest] = path50;
2504
+ hasIn(path51) {
2505
+ const [key, ...rest] = path51;
2506
2506
  if (rest.length === 0)
2507
2507
  return this.has(key);
2508
2508
  const node = this.get(key, true);
@@ -2512,8 +2512,8 @@ var require_Collection = __commonJS({
2512
2512
  * Sets a value in this collection. For `!!set`, `value` needs to be a
2513
2513
  * boolean to add/remove the item from the set.
2514
2514
  */
2515
- setIn(path50, value) {
2516
- const [key, ...rest] = path50;
2515
+ setIn(path51, value) {
2516
+ const [key, ...rest] = path51;
2517
2517
  if (rest.length === 0) {
2518
2518
  this.set(key, value);
2519
2519
  } else {
@@ -5028,9 +5028,9 @@ var require_Document = __commonJS({
5028
5028
  this.contents.add(value);
5029
5029
  }
5030
5030
  /** Adds a value to the document. */
5031
- addIn(path50, value) {
5031
+ addIn(path51, value) {
5032
5032
  if (assertCollection(this.contents))
5033
- this.contents.addIn(path50, value);
5033
+ this.contents.addIn(path51, value);
5034
5034
  }
5035
5035
  /**
5036
5036
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -5105,14 +5105,14 @@ var require_Document = __commonJS({
5105
5105
  * Removes a value from the document.
5106
5106
  * @returns `true` if the item was found and removed.
5107
5107
  */
5108
- deleteIn(path50) {
5109
- if (Collection.isEmptyPath(path50)) {
5108
+ deleteIn(path51) {
5109
+ if (Collection.isEmptyPath(path51)) {
5110
5110
  if (this.contents == null)
5111
5111
  return false;
5112
5112
  this.contents = null;
5113
5113
  return true;
5114
5114
  }
5115
- return assertCollection(this.contents) ? this.contents.deleteIn(path50) : false;
5115
+ return assertCollection(this.contents) ? this.contents.deleteIn(path51) : false;
5116
5116
  }
5117
5117
  /**
5118
5118
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -5127,10 +5127,10 @@ var require_Document = __commonJS({
5127
5127
  * scalar values from their surrounding node; to disable set `keepScalar` to
5128
5128
  * `true` (collections are always returned intact).
5129
5129
  */
5130
- getIn(path50, keepScalar) {
5131
- if (Collection.isEmptyPath(path50))
5130
+ getIn(path51, keepScalar) {
5131
+ if (Collection.isEmptyPath(path51))
5132
5132
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
5133
- return identity.isCollection(this.contents) ? this.contents.getIn(path50, keepScalar) : void 0;
5133
+ return identity.isCollection(this.contents) ? this.contents.getIn(path51, keepScalar) : void 0;
5134
5134
  }
5135
5135
  /**
5136
5136
  * Checks if the document includes a value with the key `key`.
@@ -5141,10 +5141,10 @@ var require_Document = __commonJS({
5141
5141
  /**
5142
5142
  * Checks if the document includes a value at `path`.
5143
5143
  */
5144
- hasIn(path50) {
5145
- if (Collection.isEmptyPath(path50))
5144
+ hasIn(path51) {
5145
+ if (Collection.isEmptyPath(path51))
5146
5146
  return this.contents !== void 0;
5147
- return identity.isCollection(this.contents) ? this.contents.hasIn(path50) : false;
5147
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path51) : false;
5148
5148
  }
5149
5149
  /**
5150
5150
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -5161,13 +5161,13 @@ var require_Document = __commonJS({
5161
5161
  * Sets a value in this document. For `!!set`, `value` needs to be a
5162
5162
  * boolean to add/remove the item from the set.
5163
5163
  */
5164
- setIn(path50, value) {
5165
- if (Collection.isEmptyPath(path50)) {
5164
+ setIn(path51, value) {
5165
+ if (Collection.isEmptyPath(path51)) {
5166
5166
  this.contents = value;
5167
5167
  } else if (this.contents == null) {
5168
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path50), value);
5168
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path51), value);
5169
5169
  } else if (assertCollection(this.contents)) {
5170
- this.contents.setIn(path50, value);
5170
+ this.contents.setIn(path51, value);
5171
5171
  }
5172
5172
  }
5173
5173
  /**
@@ -7127,9 +7127,9 @@ var require_cst_visit = __commonJS({
7127
7127
  visit.BREAK = BREAK;
7128
7128
  visit.SKIP = SKIP;
7129
7129
  visit.REMOVE = REMOVE;
7130
- visit.itemAtPath = (cst, path50) => {
7130
+ visit.itemAtPath = (cst, path51) => {
7131
7131
  let item = cst;
7132
- for (const [field, index] of path50) {
7132
+ for (const [field, index] of path51) {
7133
7133
  const tok = item?.[field];
7134
7134
  if (tok && "items" in tok) {
7135
7135
  item = tok.items[index];
@@ -7138,23 +7138,23 @@ var require_cst_visit = __commonJS({
7138
7138
  }
7139
7139
  return item;
7140
7140
  };
7141
- visit.parentCollection = (cst, path50) => {
7142
- const parent = visit.itemAtPath(cst, path50.slice(0, -1));
7143
- const field = path50[path50.length - 1][0];
7141
+ visit.parentCollection = (cst, path51) => {
7142
+ const parent = visit.itemAtPath(cst, path51.slice(0, -1));
7143
+ const field = path51[path51.length - 1][0];
7144
7144
  const coll = parent?.[field];
7145
7145
  if (coll && "items" in coll)
7146
7146
  return coll;
7147
7147
  throw new Error("Parent collection not found");
7148
7148
  };
7149
- function _visit(path50, item, visitor) {
7150
- let ctrl = visitor(item, path50);
7149
+ function _visit(path51, item, visitor) {
7150
+ let ctrl = visitor(item, path51);
7151
7151
  if (typeof ctrl === "symbol")
7152
7152
  return ctrl;
7153
7153
  for (const field of ["key", "value"]) {
7154
7154
  const token = item[field];
7155
7155
  if (token && "items" in token) {
7156
7156
  for (let i = 0; i < token.items.length; ++i) {
7157
- const ci = _visit(Object.freeze(path50.concat([[field, i]])), token.items[i], visitor);
7157
+ const ci = _visit(Object.freeze(path51.concat([[field, i]])), token.items[i], visitor);
7158
7158
  if (typeof ci === "number")
7159
7159
  i = ci - 1;
7160
7160
  else if (ci === BREAK)
@@ -7165,10 +7165,10 @@ var require_cst_visit = __commonJS({
7165
7165
  }
7166
7166
  }
7167
7167
  if (typeof ctrl === "function" && field === "key")
7168
- ctrl = ctrl(item, path50);
7168
+ ctrl = ctrl(item, path51);
7169
7169
  }
7170
7170
  }
7171
- return typeof ctrl === "function" ? ctrl(item, path50) : ctrl;
7171
+ return typeof ctrl === "function" ? ctrl(item, path51) : ctrl;
7172
7172
  }
7173
7173
  exports.visit = visit;
7174
7174
  }
@@ -8470,14 +8470,14 @@ var require_parser = __commonJS({
8470
8470
  case "scalar":
8471
8471
  case "single-quoted-scalar":
8472
8472
  case "double-quoted-scalar": {
8473
- const fs56 = this.flowScalar(this.type);
8473
+ const fs57 = this.flowScalar(this.type);
8474
8474
  if (atNextItem || it.value) {
8475
- map.items.push({ start, key: fs56, sep: [] });
8475
+ map.items.push({ start, key: fs57, sep: [] });
8476
8476
  this.onKeyLine = true;
8477
8477
  } else if (it.sep) {
8478
- this.stack.push(fs56);
8478
+ this.stack.push(fs57);
8479
8479
  } else {
8480
- Object.assign(it, { key: fs56, sep: [] });
8480
+ Object.assign(it, { key: fs57, sep: [] });
8481
8481
  this.onKeyLine = true;
8482
8482
  }
8483
8483
  return;
@@ -8605,13 +8605,13 @@ var require_parser = __commonJS({
8605
8605
  case "scalar":
8606
8606
  case "single-quoted-scalar":
8607
8607
  case "double-quoted-scalar": {
8608
- const fs56 = this.flowScalar(this.type);
8608
+ const fs57 = this.flowScalar(this.type);
8609
8609
  if (!it || it.value)
8610
- fc.items.push({ start: [], key: fs56, sep: [] });
8610
+ fc.items.push({ start: [], key: fs57, sep: [] });
8611
8611
  else if (it.sep)
8612
- this.stack.push(fs56);
8612
+ this.stack.push(fs57);
8613
8613
  else
8614
- Object.assign(it, { key: fs56, sep: [] });
8614
+ Object.assign(it, { key: fs57, sep: [] });
8615
8615
  return;
8616
8616
  }
8617
8617
  case "flow-map-end":
@@ -14036,6 +14036,7 @@ __export(skill_linter_exports, {
14036
14036
  gather_all_candidate_files: () => gather_all_candidate_files,
14037
14037
  gather_candidate_files_under: () => gather_candidate_files_under,
14038
14038
  gather_changed_candidate_files: () => gather_changed_candidate_files,
14039
+ last_changed_base_diff_ok: () => last_changed_base_diff_ok,
14039
14040
  last_changed_scope_reason: () => last_changed_scope_reason,
14040
14041
  lint_command: () => lint_command,
14041
14042
  lint_file: () => lint_file,
@@ -14513,29 +14514,6 @@ function extractFrontmatterField(frontmatter, pattern) {
14513
14514
  const match = pattern.exec(frontmatter);
14514
14515
  return match ? match[1].trim() : null;
14515
14516
  }
14516
- function _parseTrustLevel(frontmatter) {
14517
- const lines = splitlines(frontmatter);
14518
- let inBlock = false;
14519
- for (const line of lines) {
14520
- if (!inBlock) {
14521
- if (line.startsWith("trust:")) {
14522
- const rhs = line.slice("trust:".length).trim();
14523
- if (rhs === "") {
14524
- inBlock = true;
14525
- }
14526
- }
14527
- continue;
14528
- }
14529
- if (line.startsWith(" level:")) {
14530
- return stripQuotes(line.slice(" level:".length).trim());
14531
- }
14532
- if (line.startsWith(" ")) {
14533
- continue;
14534
- }
14535
- break;
14536
- }
14537
- return null;
14538
- }
14539
14517
  function stripQuotes(s) {
14540
14518
  return s.replace(/^["']/, "").replace(/["']$/, "");
14541
14519
  }
@@ -14638,13 +14616,13 @@ function lint_router_frontmatter(ruleId, frontmatter, ruleType) {
14638
14616
  });
14639
14617
  }
14640
14618
  if (routesTo === null) {
14641
- const trustLevel = _parseTrustLevel(frontmatter);
14642
- if (trustLevel !== "core") {
14619
+ const selfContained = /^self_contained:[ \t]*true[ \t]*$/m.test(frontmatter);
14620
+ if (!selfContained) {
14643
14621
  issues.push(
14644
14622
  new Issue(
14645
- "info",
14623
+ "error",
14646
14624
  "router_routes_to_missing",
14647
- "Non-kernel rule has no routes_to: \u2014 body should migrate to skill / guideline in Phase 4"
14625
+ "Non-kernel rule declares neither routes_to: nor self_contained: true \u2014 route the body to its skill/guideline, or certify it self-contained per docs/contracts/rule-router.md"
14648
14626
  )
14649
14627
  );
14650
14628
  }
@@ -15984,6 +15962,7 @@ function gather_candidate_files_under(srcRoot) {
15984
15962
  function gather_changed_candidate_files(root, since) {
15985
15963
  const scope = resolveContentLintScope({ cwd: root, since: since ?? null });
15986
15964
  last_changed_scope_reason = scope.reason;
15965
+ last_changed_base_diff_ok = false;
15987
15966
  const diffCommands = [
15988
15967
  ["git", "diff", "--name-only", `${scope.base}...HEAD`],
15989
15968
  ["git", "diff", "--name-only", "--cached", "HEAD"],
@@ -15991,8 +15970,13 @@ function gather_changed_candidate_files(root, since) {
15991
15970
  ];
15992
15971
  try {
15993
15972
  let rawLines = [];
15973
+ let first = true;
15994
15974
  for (const cmd of diffCommands) {
15995
15975
  const result = runCountedProbe(cmd[0], cmd.slice(1), { cwd: root });
15976
+ if (first) {
15977
+ last_changed_base_diff_ok = result.ok;
15978
+ first = false;
15979
+ }
15996
15980
  if (result.ok && result.stdout.trim()) {
15997
15981
  rawLines = splitlines(result.stdout);
15998
15982
  break;
@@ -17398,6 +17382,25 @@ function _release_scope_requires_findings(root, since) {
17398
17382
  const scope = resolveContentLintScope({ cwd: root, since: since ?? null });
17399
17383
  return scope.isRelease && scope.previousTag !== null;
17400
17384
  }
17385
+ function _changed_filter_matches_head(root) {
17386
+ const result = runCountedProbe("git", ["ls-files", "--", "dist/agent-src"], { cwd: root });
17387
+ if (!result.ok) {
17388
+ return false;
17389
+ }
17390
+ for (const raw of splitlines(result.stdout)) {
17391
+ const norm = raw.trim().replace(/\\/g, "/");
17392
+ if (!norm || norm.includes("/evals/")) {
17393
+ continue;
17394
+ }
17395
+ if (!norm.startsWith("dist/agent-src/") && !norm.includes("/dist/agent-src/")) {
17396
+ continue;
17397
+ }
17398
+ if (norm.endsWith("/SKILL.md") || norm.endsWith(".md") && (norm.includes("/rules/") || norm.includes("/commands/"))) {
17399
+ return true;
17400
+ }
17401
+ }
17402
+ return false;
17403
+ }
17401
17404
  function main7(argv) {
17402
17405
  let args;
17403
17406
  try {
@@ -17442,20 +17445,26 @@ function main7(argv) {
17442
17445
  `);
17443
17446
  }
17444
17447
  if (args.changed && _release_scope_requires_findings(root, args.since)) {
17445
- try {
17446
- assertScanned({
17447
- gate: "skill_linter --changed (release PR)",
17448
- scanned: 0,
17449
- units: "skill/rule files",
17450
- roots: [last_changed_scope_reason]
17451
- });
17452
- } catch (exc) {
17453
- if (exc instanceof DeadScopeError) {
17454
- process7.stderr.write(`\u274C ${exc.message}
17448
+ if (last_changed_base_diff_ok && _changed_filter_matches_head(root)) {
17449
+ process7.stderr.write(
17450
+ "\u2705 verified-empty release scope: the base-span diff ran cleanly and the corpus filter still matches tracked files at HEAD \u2014 this release genuinely changes no skill/rule file. The gate is alive, not blind.\n"
17451
+ );
17452
+ } else {
17453
+ try {
17454
+ assertScanned({
17455
+ gate: "skill_linter --changed (release PR)",
17456
+ scanned: 0,
17457
+ units: "skill/rule files",
17458
+ roots: [last_changed_scope_reason]
17459
+ });
17460
+ } catch (exc) {
17461
+ if (exc instanceof DeadScopeError) {
17462
+ process7.stderr.write(`\u274C ${exc.message}
17455
17463
  `);
17456
- return 2;
17464
+ return 2;
17465
+ }
17466
+ throw exc;
17457
17467
  }
17458
- throw exc;
17459
17468
  }
17460
17469
  }
17461
17470
  process7.stderr.write("No matching skill/rule files found.\n");
@@ -17635,7 +17644,7 @@ function _isCliEntry7() {
17635
17644
  return false;
17636
17645
  }
17637
17646
  }
17638
- var _HERE4, REQUIRED_PERSONA_SECTIONS_CORE, REQUIRED_PERSONA_SECTIONS_SPECIALIST, VALID_PERSONA_TIERS, PERSONA_LINE_BUDGETS, REQUIRED_USERTYPE_SECTIONS, USERTYPE_LINE_BUDGET, VALID_PERSONA_WINGS, PERSONA_LINE_BUDGETS_BY_WING, REQUIRED_SKILL_SECTIONS, SECTION_ALIASES, RECOMMENDED_SKILL_SECTIONS, RULE_BAD_SIGNS, FRUGALITY_WRITER_SKILLS, FRUGALITY_CHARTER_RELPATH, FRUGALITY_CHARTER_INDEX_RULES, VAGUE_VALIDATION_PATTERNS, TRIGGER_WARNING_PATTERNS, ORDERED_STEP_PATTERN, SECTION_PATTERN, FRONTMATTER_PATTERN, DESCRIPTION_PATTERN, STATUS_PATTERN, REPLACED_BY_PATTERN, TIER_PATTERN, TYPE_PATTERN, SOURCE_PATTERN, SENIOR_RELATED_SKILLS_PATTERN, SENIOR_RELATED_WHEN_PATTERN, SENIOR_RELATED_WHEN_NOT_PATTERN, SENIOR_PROACTIVE_PATTERN, SENIOR_OUTPUT_PATTERN, H1_PATTERN, DOUBLE_BLANK_PATTERN, VALID_RULE_TYPES, VALID_RULE_SOURCES, ROUTER_ALLOWED_TRIGGER_KEYS, KERNEL_RULE_IDS, VALID_EXECUTION_TYPES, VALID_EXECUTION_HANDLERS, VALID_EXECUTION_SAFETY_MODES, VALID_EXECUTION_FIELDS, WING3_SPINE_SLOTS, CONTEXT_SPINE_INLINE_PATTERN, WING3_SAAS_URL_PATTERN, WING3_VENDOR_BLACKLIST, WING3_STACK_LOCKED_PATTERN, WING3_CHANNEL_TACTIC_PATTERN, WING4_SPINE_SLOTS, WING4_SAAS_URL_PATTERN, WING4_VENDOR_BLACKLIST, WING4_STAGE_AGNOSTIC_PATTERN, Issue, LintResult, _ROLE_CONTRACT_CANDIDATES, _ROLE_CONTRACT_SLUGS_CACHE, _ROLE_CONTRACT_REF_PATTERN, PROCEDURE_HEADING_PATTERN, COMMAND_FRONTMATTER_DELEGATION_KEYS, MD_LINK_PATTERN_G, NAME_PATTERN, DISABLE_MODEL_PATTERN, _INSPECT_VERB_PATTERN, last_changed_scope_reason, _INTERACTION_NAME_PATTERNS, _INTERACTION_CONTENT_KEYWORDS, _EXEC_FILE_SIGNALS, _EXEC_CONTENT_SIGNALS, _TASK_TYPE_SIGNALS, _VERIFICATION_TOOLS, _FRUGALITY_STANDARDS_PATTERN, _FRUGALITY_CHARTER_LINK_PATTERN, _MD_LINK_PATTERN, _MALICE_CRED_EXFIL, _MALICE_REMOTE_EXEC, _MALICE_FORCE_PUSH, _MALICE_CHMOD_SECRETS, _MALICE_SHELL_INJECT, _MALICE_PATTERNS, _NAG_UPDATE_CHECK, _NAG_STAY_CURRENT, _NAG_SELF_PROMO, _NAG_BEST_SKILL, _NAG_MUST_USE, _NAG_ALWAYS_USE, _NAG_PATTERNS, _OUTPUT_SCHEMA_KEY_PATTERN, _SCHEMA_ARTEFACT_TYPES, ArgError, isCliEntry2;
17647
+ var _HERE4, REQUIRED_PERSONA_SECTIONS_CORE, REQUIRED_PERSONA_SECTIONS_SPECIALIST, VALID_PERSONA_TIERS, PERSONA_LINE_BUDGETS, REQUIRED_USERTYPE_SECTIONS, USERTYPE_LINE_BUDGET, VALID_PERSONA_WINGS, PERSONA_LINE_BUDGETS_BY_WING, REQUIRED_SKILL_SECTIONS, SECTION_ALIASES, RECOMMENDED_SKILL_SECTIONS, RULE_BAD_SIGNS, FRUGALITY_WRITER_SKILLS, FRUGALITY_CHARTER_RELPATH, FRUGALITY_CHARTER_INDEX_RULES, VAGUE_VALIDATION_PATTERNS, TRIGGER_WARNING_PATTERNS, ORDERED_STEP_PATTERN, SECTION_PATTERN, FRONTMATTER_PATTERN, DESCRIPTION_PATTERN, STATUS_PATTERN, REPLACED_BY_PATTERN, TIER_PATTERN, TYPE_PATTERN, SOURCE_PATTERN, SENIOR_RELATED_SKILLS_PATTERN, SENIOR_RELATED_WHEN_PATTERN, SENIOR_RELATED_WHEN_NOT_PATTERN, SENIOR_PROACTIVE_PATTERN, SENIOR_OUTPUT_PATTERN, H1_PATTERN, DOUBLE_BLANK_PATTERN, VALID_RULE_TYPES, VALID_RULE_SOURCES, ROUTER_ALLOWED_TRIGGER_KEYS, KERNEL_RULE_IDS, VALID_EXECUTION_TYPES, VALID_EXECUTION_HANDLERS, VALID_EXECUTION_SAFETY_MODES, VALID_EXECUTION_FIELDS, WING3_SPINE_SLOTS, CONTEXT_SPINE_INLINE_PATTERN, WING3_SAAS_URL_PATTERN, WING3_VENDOR_BLACKLIST, WING3_STACK_LOCKED_PATTERN, WING3_CHANNEL_TACTIC_PATTERN, WING4_SPINE_SLOTS, WING4_SAAS_URL_PATTERN, WING4_VENDOR_BLACKLIST, WING4_STAGE_AGNOSTIC_PATTERN, Issue, LintResult, _ROLE_CONTRACT_CANDIDATES, _ROLE_CONTRACT_SLUGS_CACHE, _ROLE_CONTRACT_REF_PATTERN, PROCEDURE_HEADING_PATTERN, COMMAND_FRONTMATTER_DELEGATION_KEYS, MD_LINK_PATTERN_G, NAME_PATTERN, DISABLE_MODEL_PATTERN, _INSPECT_VERB_PATTERN, last_changed_scope_reason, last_changed_base_diff_ok, _INTERACTION_NAME_PATTERNS, _INTERACTION_CONTENT_KEYWORDS, _EXEC_FILE_SIGNALS, _EXEC_CONTENT_SIGNALS, _TASK_TYPE_SIGNALS, _VERIFICATION_TOOLS, _FRUGALITY_STANDARDS_PATTERN, _FRUGALITY_CHARTER_LINK_PATTERN, _MD_LINK_PATTERN, _MALICE_CRED_EXFIL, _MALICE_REMOTE_EXEC, _MALICE_FORCE_PUSH, _MALICE_CHMOD_SECRETS, _MALICE_SHELL_INJECT, _MALICE_PATTERNS, _NAG_UPDATE_CHECK, _NAG_STAY_CURRENT, _NAG_SELF_PROMO, _NAG_BEST_SKILL, _NAG_MUST_USE, _NAG_ALWAYS_USE, _NAG_PATTERNS, _OUTPUT_SCHEMA_KEY_PATTERN, _SCHEMA_ARTEFACT_TYPES, ArgError, isCliEntry2;
17639
17648
  var init_skill_linter = __esm({
17640
17649
  "src/scripts/skill_linter.ts"() {
17641
17650
  "use strict";
@@ -17811,6 +17820,7 @@ var init_skill_linter = __esm({
17811
17820
  DISABLE_MODEL_PATTERN = /^disable-model-invocation:\s*"?(true|false)"?\s*$/m;
17812
17821
  _INSPECT_VERB_PATTERN = /\b(?:inspect|examine|audit|survey|read|look\s+at|check|review|understand|identify|analyze|analyse|detect|gather|discover)\b/i;
17813
17822
  last_changed_scope_reason = "";
17823
+ last_changed_base_diff_ok = false;
17814
17824
  _INTERACTION_NAME_PATTERNS = /skill-router|handoff|analysis-skill|skill-writing|skill-reviewer|model-recommendation|developer-like-execution|universal-project-analysis|interaction|autonomous-mode|feature-planning/i;
17815
17825
  _INTERACTION_CONTENT_KEYWORDS = [
17816
17826
  "handoff",
@@ -20018,7 +20028,8 @@ function build_claude_hook_matrix(manifest_path2) {
20018
20028
  if (!concerns || Array.isArray(concerns) && concerns.length === 0) continue;
20019
20029
  const native = ac_to_native[ac_event];
20020
20030
  if (native === void 0) continue;
20021
- matrix[native] = `BIN="$CLAUDE_PROJECT_DIR/agent-config"; [ -x "$BIN" ] || BIN=agent-config; command -v "$BIN" >/dev/null 2>&1 || exit 0; "$BIN" dispatch:hook --platform claude --event ${ac_event} --native-event ${native} --project-dir "$CLAUDE_PROJECT_DIR" --min-version ${String(hook_spec)}`;
20031
+ const dispatchArgs = `--platform claude --event ${ac_event} --native-event ${native} --project-dir "$CLAUDE_PROJECT_DIR" --min-version ${String(hook_spec)}`;
20032
+ matrix[native] = `B=""; [ -f "$CLAUDE_PROJECT_DIR/node_modules/@event4u/agent-config/dist/hooks/dispatch.js" ] && B="$CLAUDE_PROJECT_DIR/node_modules/@event4u/agent-config/dist/hooks/dispatch.js"; [ -z "$B" ] && [ -f "$CLAUDE_PROJECT_DIR/dist/hooks/dispatch.js" ] && [ -f "$CLAUDE_PROJECT_DIR/src/scripts/hook_manifest.yaml" ] && B="$CLAUDE_PROJECT_DIR/dist/hooks/dispatch.js"; if [ -n "$B" ] && command -v node >/dev/null 2>&1; then exec node "$B" ${dispatchArgs}; fi; BIN="$CLAUDE_PROJECT_DIR/agent-config"; [ -x "$BIN" ] || BIN=agent-config; command -v "$BIN" >/dev/null 2>&1 || exit 0; "$BIN" dispatch:hook ${dispatchArgs}`;
20022
20033
  }
20023
20034
  return matrix;
20024
20035
  }
@@ -21199,8 +21210,8 @@ function lockfile_path(env) {
21199
21210
  }
21200
21211
  return write_target("installed.lock", { env: env ?? null });
21201
21212
  }
21202
- function read_lockfile(path50) {
21203
- const target = path50 ?? lockfile_path();
21213
+ function read_lockfile(path51) {
21214
+ const target = path51 ?? lockfile_path();
21204
21215
  let text;
21205
21216
  try {
21206
21217
  text = fs31.readFileSync(target, { encoding: "utf-8" });
@@ -21410,18 +21421,18 @@ function manifest_path(project_root, env) {
21410
21421
  }
21411
21422
  return fsPath.join(project_root, DEFAULT_MANIFEST_RELATIVE);
21412
21423
  }
21413
- function read_manifest(path50) {
21424
+ function read_manifest(path51) {
21414
21425
  let text;
21415
21426
  try {
21416
- text = require_read_text(path50);
21427
+ text = require_read_text(path51);
21417
21428
  } catch {
21418
21429
  return null;
21419
21430
  }
21420
21431
  const data = _parse_manual(text);
21421
21432
  return _normalise_v2_shape(data);
21422
21433
  }
21423
- function require_read_text(path50) {
21424
- return fs33.readFileSync(path50, { encoding: "utf-8" });
21434
+ function require_read_text(path51) {
21435
+ return fs33.readFileSync(path51, { encoding: "utf-8" });
21425
21436
  }
21426
21437
  function _normalise_v2_shape(data) {
21427
21438
  if (data["tools"] === void 0 || data["tools"] === null) {
@@ -21602,9 +21613,9 @@ function stable_sort(items, key) {
21602
21613
  return a.index - b.index;
21603
21614
  }).map((entry) => entry.item);
21604
21615
  }
21605
- function write_manifest(path50, version, tools, options = {}) {
21616
+ function write_manifest(path51, version, tools, options = {}) {
21606
21617
  const rendered = _render(version, tools, { deploy_roots: options.deploy_roots ?? null });
21607
- return write_atomic(path50, rendered);
21618
+ return write_atomic(path51, rendered);
21608
21619
  }
21609
21620
  function upsert_tool(existing, options) {
21610
21621
  const {
@@ -26393,8 +26404,114 @@ var init_review_gate = __esm({
26393
26404
  }
26394
26405
  });
26395
26406
 
26396
- // src/install/ruleInScope.ts
26407
+ // src/scripts/_lib/surface_tiers.ts
26408
+ var init_surface_tiers = __esm({
26409
+ "src/scripts/_lib/surface_tiers.ts"() {
26410
+ "use strict";
26411
+ }
26412
+ });
26413
+
26414
+ // src/scripts/_lib/scoped_projection.ts
26397
26415
  import * as fs41 from "node:fs";
26416
+ import { createRequire as createRequire5 } from "node:module";
26417
+ import * as path40 from "node:path";
26418
+ function isPlainObject2(v) {
26419
+ return typeof v === "object" && v !== null && !Array.isArray(v);
26420
+ }
26421
+ function yamlSafeLoad(text) {
26422
+ let YAML8;
26423
+ try {
26424
+ YAML8 = _require4("yaml");
26425
+ } catch {
26426
+ return null;
26427
+ }
26428
+ try {
26429
+ return YAML8.parse(text, { version: "1.1" }) ?? null;
26430
+ } catch {
26431
+ return null;
26432
+ }
26433
+ }
26434
+ function load_packs_registry(package_root) {
26435
+ const vocab_path = path40.join(package_root, PACKS_YML_REL);
26436
+ const data = yamlSafeLoad(fs41.readFileSync(vocab_path, "utf-8"));
26437
+ if (!Array.isArray(data)) {
26438
+ throw new Error(`packs.yml did not parse to a list: ${vocab_path}`);
26439
+ }
26440
+ const out = [];
26441
+ for (const entry of data) {
26442
+ if (!isPlainObject2(entry)) continue;
26443
+ const id = entry["id"];
26444
+ if (typeof id !== "string" || id === "") continue;
26445
+ const workspaces_raw = entry["workspaces"];
26446
+ const workspaces = Array.isArray(workspaces_raw) ? workspaces_raw.filter((w) => typeof w === "string") : [];
26447
+ const requires_raw = entry["requires"] ?? entry["requires_hint"];
26448
+ const requires = Array.isArray(requires_raw) ? requires_raw.filter((r) => typeof r === "string") : [];
26449
+ out.push({ id, workspaces, requires });
26450
+ }
26451
+ return out;
26452
+ }
26453
+ function compute_active_pack_ids(packs, runtime_active_packs) {
26454
+ const by_id = /* @__PURE__ */ new Map();
26455
+ for (const p of packs) by_id.set(p.id, p);
26456
+ const active = /* @__PURE__ */ new Set();
26457
+ for (const p of packs) {
26458
+ if (p.workspaces.some((w) => SCOPED_ACTIVE_WORKSPACES.has(w))) {
26459
+ active.add(p.id);
26460
+ }
26461
+ }
26462
+ for (const id of runtime_active_packs) {
26463
+ active.add(id);
26464
+ }
26465
+ let frontier = [...active];
26466
+ while (frontier.length > 0) {
26467
+ const next = [];
26468
+ for (const id of frontier) {
26469
+ const rec = by_id.get(id);
26470
+ if (rec === void 0) continue;
26471
+ for (const dep of rec.requires) {
26472
+ if (!active.has(dep)) {
26473
+ active.add(dep);
26474
+ next.push(dep);
26475
+ }
26476
+ }
26477
+ }
26478
+ frontier = next;
26479
+ }
26480
+ return active;
26481
+ }
26482
+ function resolve_rule_pack_scope(raw, package_root, runtime_active_packs = []) {
26483
+ const is_auto = raw === RULE_PACKS_AUTO || Array.isArray(raw) && raw.length === 1 && raw[0] === RULE_PACKS_AUTO;
26484
+ if (is_auto) {
26485
+ try {
26486
+ return [
26487
+ ...compute_active_pack_ids(load_packs_registry(package_root), runtime_active_packs)
26488
+ ].sort();
26489
+ } catch {
26490
+ return null;
26491
+ }
26492
+ }
26493
+ if (Array.isArray(raw) && raw.length > 0) {
26494
+ return raw.map((v) => String(v));
26495
+ }
26496
+ return null;
26497
+ }
26498
+ var _require4, SCOPED_ACTIVE_WORKSPACES, PACKS_YML_REL, RULE_PACKS_AUTO;
26499
+ var init_scoped_projection = __esm({
26500
+ "src/scripts/_lib/scoped_projection.ts"() {
26501
+ "use strict";
26502
+ init_surface_tiers();
26503
+ _require4 = createRequire5(import.meta.url);
26504
+ SCOPED_ACTIVE_WORKSPACES = /* @__PURE__ */ new Set([
26505
+ "engineering",
26506
+ "agent-config-maintainer"
26507
+ ]);
26508
+ PACKS_YML_REL = path40.join("src", "config", "discovery", "packs.yml");
26509
+ RULE_PACKS_AUTO = "auto";
26510
+ }
26511
+ });
26512
+
26513
+ // src/install/ruleInScope.ts
26514
+ import * as fs42 from "node:fs";
26398
26515
  function parseYaml4(text) {
26399
26516
  try {
26400
26517
  const data = YAML4.parse(text, { version: "1.1" });
@@ -26432,7 +26549,7 @@ function rule_in_scope(source_path, scope, pack_scope = null, role_scope = null)
26432
26549
  if (scope === null && pack_scope === null && role_scope === null) {
26433
26550
  return true;
26434
26551
  }
26435
- const [meta] = parseFrontmatter(fs41.readFileSync(source_path, "utf-8"));
26552
+ const [meta] = parseFrontmatter(fs42.readFileSync(source_path, "utf-8"));
26436
26553
  if (meta["type"] === "always" || meta["alwaysApply"] === true) {
26437
26554
  return true;
26438
26555
  }
@@ -26457,31 +26574,40 @@ var init_ruleInScope = __esm({
26457
26574
  });
26458
26575
 
26459
26576
  // src/install/rule_scope.ts
26460
- import * as fs42 from "node:fs";
26461
- import * as path40 from "node:path";
26577
+ import * as fs43 from "node:fs";
26578
+ import * as path41 from "node:path";
26462
26579
  function _list(value) {
26463
26580
  if (Array.isArray(value) && value.length > 0) {
26464
26581
  return value.map((v) => String(v));
26465
26582
  }
26466
26583
  return null;
26467
26584
  }
26468
- function ruleScopeFromSettings(settings) {
26585
+ function ruleScopeFromSettings(settings, packageRoot) {
26469
26586
  const proj = settings["projection"];
26470
26587
  if (typeof proj !== "object" || proj === null || Array.isArray(proj)) {
26471
26588
  return LEGACY_ALL;
26472
26589
  }
26473
26590
  const p = proj;
26591
+ const packs = packageRoot === void 0 ? _list(p["rule_packs"]) : resolve_rule_pack_scope(
26592
+ p["rule_packs"],
26593
+ packageRoot,
26594
+ _list(_runtimeActivePacks(settings)) ?? []
26595
+ );
26474
26596
  return {
26475
26597
  workspaces: _list(p["rule_workspaces"]),
26476
- packs: _list(p["rule_packs"]),
26598
+ packs,
26477
26599
  roles: _list(p["rule_roles"])
26478
26600
  };
26479
26601
  }
26602
+ function _runtimeActivePacks(settings) {
26603
+ const rt = settings["runtime"];
26604
+ return typeof rt === "object" && rt !== null && !Array.isArray(rt) ? rt["active_packs"] : null;
26605
+ }
26480
26606
  function ruleFileArrives(sourcePath, scope) {
26481
26607
  if (!sourcePath.endsWith(".md")) {
26482
26608
  return true;
26483
26609
  }
26484
- const basename18 = path40.basename(sourcePath);
26610
+ const basename18 = path41.basename(sourcePath);
26485
26611
  if (COMPAT_ALWAYS_EXCLUDED.includes(basename18)) {
26486
26612
  return false;
26487
26613
  }
@@ -26490,7 +26616,7 @@ function ruleFileArrives(sourcePath, scope) {
26490
26616
  function excludedRuleBasenames(rulesDir, scope) {
26491
26617
  let entries;
26492
26618
  try {
26493
- entries = fs42.readdirSync(rulesDir).sort();
26619
+ entries = fs43.readdirSync(rulesDir).sort();
26494
26620
  } catch {
26495
26621
  return [];
26496
26622
  }
@@ -26499,9 +26625,9 @@ function excludedRuleBasenames(rulesDir, scope) {
26499
26625
  if (!name.endsWith(".md")) {
26500
26626
  continue;
26501
26627
  }
26502
- const full = path40.join(rulesDir, name);
26628
+ const full = path41.join(rulesDir, name);
26503
26629
  try {
26504
- if (!fs42.statSync(full).isFile()) {
26630
+ if (!fs43.statSync(full).isFile()) {
26505
26631
  continue;
26506
26632
  }
26507
26633
  } catch {
@@ -26517,6 +26643,7 @@ var COMPAT_ALWAYS_EXCLUDED, LEGACY_ALL;
26517
26643
  var init_rule_scope = __esm({
26518
26644
  "src/install/rule_scope.ts"() {
26519
26645
  "use strict";
26646
+ init_scoped_projection();
26520
26647
  init_ruleInScope();
26521
26648
  COMPAT_ALWAYS_EXCLUDED = ["source-of-truth.md"];
26522
26649
  LEGACY_ALL = { workspaces: null, packs: null };
@@ -26591,21 +26718,21 @@ __export(cmd_doctor_exports, {
26591
26718
  main: () => main15
26592
26719
  });
26593
26720
  import * as crypto6 from "node:crypto";
26594
- import * as fs43 from "node:fs";
26721
+ import * as fs44 from "node:fs";
26595
26722
  import * as os11 from "node:os";
26596
- import * as path41 from "node:path";
26723
+ import * as path42 from "node:path";
26597
26724
  import process15 from "node:process";
26598
26725
  import { fileURLToPath as fileURLToPath24, pathToFileURL as pathToFileURL15 } from "node:url";
26599
26726
  function expanduser5(p) {
26600
26727
  if (p === "~") return os11.homedir();
26601
26728
  if (p.startsWith("~/") || p.startsWith("~\\")) {
26602
- return path41.join(os11.homedir(), p.slice(2));
26729
+ return path42.join(os11.homedir(), p.slice(2));
26603
26730
  }
26604
26731
  return p;
26605
26732
  }
26606
26733
  function pathExists(p) {
26607
26734
  try {
26608
- fs43.statSync(p);
26735
+ fs44.statSync(p);
26609
26736
  return true;
26610
26737
  } catch {
26611
26738
  return false;
@@ -26613,27 +26740,27 @@ function pathExists(p) {
26613
26740
  }
26614
26741
  function isFile3(p) {
26615
26742
  try {
26616
- return fs43.statSync(p).isFile();
26743
+ return fs44.statSync(p).isFile();
26617
26744
  } catch {
26618
26745
  return false;
26619
26746
  }
26620
26747
  }
26621
26748
  function isDir2(p) {
26622
26749
  try {
26623
- return fs43.statSync(p).isDirectory();
26750
+ return fs44.statSync(p).isDirectory();
26624
26751
  } catch {
26625
26752
  return false;
26626
26753
  }
26627
26754
  }
26628
26755
  function resolvePath(p) {
26629
26756
  try {
26630
- return fs43.realpathSync(path41.resolve(p));
26757
+ return fs44.realpathSync(path42.resolve(p));
26631
26758
  } catch {
26632
- return path41.resolve(p);
26759
+ return path42.resolve(p);
26633
26760
  }
26634
26761
  }
26635
26762
  function readText2(p) {
26636
- return fs43.readFileSync(p, "utf-8");
26763
+ return fs44.readFileSync(p, "utf-8");
26637
26764
  }
26638
26765
  function _jsonStrAscii3(s) {
26639
26766
  let out = '"';
@@ -26720,7 +26847,7 @@ ${closePad}}`;
26720
26847
  function _jsonDumpsIndentAscii(value, indent) {
26721
26848
  return _dumpIndentAscii(value, indent, 0);
26722
26849
  }
26723
- function yamlSafeLoad(text) {
26850
+ function yamlSafeLoad2(text) {
26724
26851
  if (YAML5 === void 0 || YAML5 === null) {
26725
26852
  return null;
26726
26853
  }
@@ -26740,7 +26867,7 @@ function _resolve_project_root(arg) {
26740
26867
  return resolve_project_root(arg);
26741
26868
  }
26742
26869
  function _detect_install_mode(project_root) {
26743
- const marker = path41.join(project_root, _INSTALL_MODE_MARKER_REL);
26870
+ const marker = path42.join(project_root, _INSTALL_MODE_MARKER_REL);
26744
26871
  if (isFile3(marker)) {
26745
26872
  let value;
26746
26873
  try {
@@ -26752,9 +26879,9 @@ function _detect_install_mode(project_root) {
26752
26879
  return [value, "marker-file"];
26753
26880
  }
26754
26881
  }
26755
- const has_agents_md = pathExists(path41.join(project_root, "AGENTS.md"));
26882
+ const has_agents_md = pathExists(path42.join(project_root, "AGENTS.md"));
26756
26883
  const has_copilot = pathExists(
26757
- path41.join(project_root, ".github", "copilot-instructions.md")
26884
+ path42.join(project_root, ".github", "copilot-instructions.md")
26758
26885
  );
26759
26886
  if (has_agents_md && has_copilot) {
26760
26887
  return ["full", "heuristic"];
@@ -26774,7 +26901,7 @@ function _settings_layer_chain(project_root) {
26774
26901
  return layers;
26775
26902
  }
26776
26903
  function _detect_wrapper(project_root) {
26777
- const wrapper = path41.join(project_root, "agent-config");
26904
+ const wrapper = path42.join(project_root, "agent-config");
26778
26905
  if (!pathExists(wrapper)) {
26779
26906
  return { path: String(wrapper), exists: false, embedded_root: null };
26780
26907
  }
@@ -26841,21 +26968,21 @@ function _emit_context_text(ctx) {
26841
26968
  }
26842
26969
  function _resolve_path(project_root, raw) {
26843
26970
  let p = expanduser5(raw);
26844
- if (!path41.isAbsolute(p)) {
26845
- p = path41.join(project_root, p);
26971
+ if (!path42.isAbsolute(p)) {
26972
+ p = path42.join(project_root, p);
26846
26973
  }
26847
26974
  return p;
26848
26975
  }
26849
26976
  function _sha256(p) {
26850
26977
  try {
26851
- const data = fs43.readFileSync(p);
26978
+ const data = fs44.readFileSync(p);
26852
26979
  return crypto6.createHash("sha256").update(data).digest("hex");
26853
26980
  } catch {
26854
26981
  return null;
26855
26982
  }
26856
26983
  }
26857
26984
  function _read_inline_package_tag(p) {
26858
- if (path41.extname(p) !== ".md") {
26985
+ if (path42.extname(p) !== ".md") {
26859
26986
  return NO_FRONTMATTER;
26860
26987
  }
26861
26988
  let text;
@@ -26984,13 +27111,13 @@ function rglob2(root) {
26984
27111
  const walk = (dir) => {
26985
27112
  let entries;
26986
27113
  try {
26987
- entries = fs43.readdirSync(dir, { withFileTypes: true });
27114
+ entries = fs44.readdirSync(dir, { withFileTypes: true });
26988
27115
  } catch {
26989
27116
  return;
26990
27117
  }
26991
27118
  entries.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
26992
27119
  for (const ent of entries) {
26993
- const full = path41.join(dir, ent.name);
27120
+ const full = path42.join(dir, ent.name);
26994
27121
  out.push(full);
26995
27122
  let dirLike = ent.isDirectory();
26996
27123
  if (ent.isSymbolicLink()) {
@@ -27065,19 +27192,19 @@ function _foreign_records(project_root, foreign) {
27065
27192
  return out;
27066
27193
  }
27067
27194
  function relativeTo(p, base) {
27068
- const rel = path41.relative(base, p);
27195
+ const rel = path42.relative(base, p);
27069
27196
  if (rel === "") return rel;
27070
- if (rel.startsWith("..") || path41.isAbsolute(rel)) {
27197
+ if (rel.startsWith("..") || path42.isAbsolute(rel)) {
27071
27198
  return null;
27072
27199
  }
27073
27200
  return rel;
27074
27201
  }
27075
27202
  function _is_global_only_consumer(project_root) {
27076
- return isFile3(path41.join(project_root, INSTALL_MODE_MARKER_RELATIVE)) || isDir2(path41.join(project_root, "agents", "overrides"));
27203
+ return isFile3(path42.join(project_root, INSTALL_MODE_MARKER_RELATIVE)) || isDir2(path42.join(project_root, "agents", "overrides"));
27077
27204
  }
27078
27205
  function _check_scope(project_root) {
27079
27206
  for (const marker of ["pnpm-workspace.yaml", "lerna.json"]) {
27080
- if (pathExists(path41.join(project_root, marker))) {
27207
+ if (pathExists(path42.join(project_root, marker))) {
27081
27208
  return {
27082
27209
  id: "scope",
27083
27210
  status: "warn",
@@ -27086,7 +27213,7 @@ function _check_scope(project_root) {
27086
27213
  };
27087
27214
  }
27088
27215
  }
27089
- const pkg = path41.join(project_root, "package.json");
27216
+ const pkg = path42.join(project_root, "package.json");
27090
27217
  if (pathExists(pkg)) {
27091
27218
  try {
27092
27219
  const data = JSON.parse(readText2(pkg));
@@ -27109,23 +27236,23 @@ function _check_scope(project_root) {
27109
27236
  };
27110
27237
  }
27111
27238
  function _git_config_path(project_root) {
27112
- const gd = path41.join(project_root, ".git");
27239
+ const gd = path42.join(project_root, ".git");
27113
27240
  try {
27114
- const st = fs43.statSync(gd);
27241
+ const st = fs44.statSync(gd);
27115
27242
  if (st.isDirectory()) {
27116
- return path41.join(gd, "config");
27243
+ return path42.join(gd, "config");
27117
27244
  }
27118
27245
  const m = readText2(gd).match(/^gitdir:\s*(.+)\s*$/m);
27119
27246
  if (m === null) {
27120
27247
  return null;
27121
27248
  }
27122
- const gdPath = path41.resolve(project_root, m[1].trim());
27123
- const commondirFile = path41.join(gdPath, "commondir");
27249
+ const gdPath = path42.resolve(project_root, m[1].trim());
27250
+ const commondirFile = path42.join(gdPath, "commondir");
27124
27251
  if (pathExists(commondirFile)) {
27125
- const common = path41.resolve(gdPath, readText2(commondirFile).trim());
27126
- return path41.join(common, "config");
27252
+ const common = path42.resolve(gdPath, readText2(commondirFile).trim());
27253
+ return path42.join(common, "config");
27127
27254
  }
27128
- return path41.join(gdPath, "config");
27255
+ return path42.join(gdPath, "config");
27129
27256
  } catch {
27130
27257
  return null;
27131
27258
  }
@@ -27158,7 +27285,7 @@ function _check_git_identity(project_root) {
27158
27285
  }
27159
27286
  let ident = _parse_git_user(readText2(cfgPath));
27160
27287
  if (ident.name === null && ident.email === null) {
27161
- const globalCfg = path41.join(os11.homedir(), ".gitconfig");
27288
+ const globalCfg = path42.join(os11.homedir(), ".gitconfig");
27162
27289
  if (pathExists(globalCfg)) {
27163
27290
  ident = _parse_git_user(readText2(globalCfg));
27164
27291
  }
@@ -27219,7 +27346,7 @@ function _package_root() {
27219
27346
  }
27220
27347
  function _current_package_version() {
27221
27348
  try {
27222
- const data = JSON.parse(readText2(path41.join(_package_root(), "package.json")));
27349
+ const data = JSON.parse(readText2(path42.join(_package_root(), "package.json")));
27223
27350
  const v = data["version"];
27224
27351
  if (typeof v === "string" && v.trim()) {
27225
27352
  return v.trim();
@@ -27263,7 +27390,7 @@ function _check_lockfile_freshness(manifest) {
27263
27390
  };
27264
27391
  }
27265
27392
  function shutilWhich(name) {
27266
- if (path41.dirname(name) !== "." && (name.includes("/") || name.includes("\\"))) {
27393
+ if (path42.dirname(name) !== "." && (name.includes("/") || name.includes("\\"))) {
27267
27394
  return isExecutableFile(name) ? name : null;
27268
27395
  }
27269
27396
  const pathEnv = process15.env["PATH"] || "";
@@ -27276,12 +27403,12 @@ function shutilWhich(name) {
27276
27403
  if (seenDirs.has(d)) continue;
27277
27404
  seenDirs.add(d);
27278
27405
  for (const ext of exts) {
27279
- const candidate = path41.join(d, name + (ext === "" ? "" : ext.toLowerCase() === ext ? ext : ext));
27406
+ const candidate = path42.join(d, name + (ext === "" ? "" : ext.toLowerCase() === ext ? ext : ext));
27280
27407
  if (isExecutableFile(candidate)) {
27281
27408
  return candidate;
27282
27409
  }
27283
27410
  if (ext !== "") {
27284
- const upper = path41.join(d, name + ext);
27411
+ const upper = path42.join(d, name + ext);
27285
27412
  if (isExecutableFile(upper)) return upper;
27286
27413
  }
27287
27414
  }
@@ -27290,10 +27417,10 @@ function shutilWhich(name) {
27290
27417
  }
27291
27418
  function isExecutableFile(p) {
27292
27419
  try {
27293
- const st = fs43.statSync(p);
27420
+ const st = fs44.statSync(p);
27294
27421
  if (!st.isFile()) return false;
27295
27422
  if (process15.platform === "win32") return true;
27296
- fs43.accessSync(p, fs43.constants.X_OK);
27423
+ fs44.accessSync(p, fs44.constants.X_OK);
27297
27424
  return true;
27298
27425
  } catch {
27299
27426
  return false;
@@ -27357,7 +27484,7 @@ function _check_claude_plugin() {
27357
27484
  remedy: ""
27358
27485
  };
27359
27486
  }
27360
- const projection = path41.join(os11.homedir(), ".claude", "skills");
27487
+ const projection = path42.join(os11.homedir(), ".claude", "skills");
27361
27488
  const projection_present = isDir2(projection);
27362
27489
  if (projection_present) {
27363
27490
  return {
@@ -27394,8 +27521,8 @@ function _check_claude_command_wrappers() {
27394
27521
  remedy: ""
27395
27522
  };
27396
27523
  }
27397
- const anchor = path41.join(os11.homedir(), ".claude");
27398
- const commands_dir = path41.join(anchor, "commands");
27524
+ const anchor = path42.join(os11.homedir(), ".claude");
27525
+ const commands_dir = path42.join(anchor, "commands");
27399
27526
  if (!isDir2(commands_dir)) {
27400
27527
  return {
27401
27528
  id: "claude-command-wrappers",
@@ -27404,8 +27531,8 @@ function _check_claude_command_wrappers() {
27404
27531
  remedy: ""
27405
27532
  };
27406
27533
  }
27407
- const flat_probe = fs43.existsSync(path41.join(commands_dir, "commit.md"));
27408
- const wrapper_probe = fs43.existsSync(path41.join(anchor, "skills", "commit", "SKILL.md"));
27534
+ const flat_probe = fs44.existsSync(path42.join(commands_dir, "commit.md"));
27535
+ const wrapper_probe = fs44.existsSync(path42.join(anchor, "skills", "commit", "SKILL.md"));
27409
27536
  if (wrapper_probe) {
27410
27537
  return {
27411
27538
  id: "claude-command-wrappers",
@@ -27430,7 +27557,7 @@ function _check_claude_command_wrappers() {
27430
27557
  };
27431
27558
  }
27432
27559
  function _check_surface_state() {
27433
- const matrix_path = path41.join(_package_root(), "src", "config", "surface-matrix.yml");
27560
+ const matrix_path = path42.join(_package_root(), "src", "config", "surface-matrix.yml");
27434
27561
  if (!isFile3(matrix_path)) {
27435
27562
  return {
27436
27563
  id: "surface-state",
@@ -27454,7 +27581,7 @@ function _check_surface_state() {
27454
27581
  remedy: "agent-config upgrade (reinstalls the package data files)"
27455
27582
  };
27456
27583
  }
27457
- const _expand = (p) => p.startsWith("~/") ? path41.join(os11.homedir(), p.slice(2)) : path41.join(_package_root(), p);
27584
+ const _expand = (p) => p.startsWith("~/") ? path42.join(os11.homedir(), p.slice(2)) : path42.join(_package_root(), p);
27458
27585
  const violations = [];
27459
27586
  const remedies = [];
27460
27587
  let checked = 0;
@@ -27496,7 +27623,7 @@ function _check_surface_state() {
27496
27623
  }
27497
27624
  function pathExistsAny(p) {
27498
27625
  try {
27499
- fs43.statSync(p);
27626
+ fs44.statSync(p);
27500
27627
  return true;
27501
27628
  } catch {
27502
27629
  return false;
@@ -27512,13 +27639,13 @@ function _check_hook_wiring() {
27512
27639
  remedy: ""
27513
27640
  };
27514
27641
  }
27515
- const settings_path = path41.join(os11.homedir(), ".claude", "settings.json");
27642
+ const settings_path = path42.join(os11.homedir(), ".claude", "settings.json");
27516
27643
  let missing;
27517
27644
  try {
27518
27645
  const matrix = build_claude_hook_matrix(
27519
- path41.join(_package_root(), "src", "scripts", "hook_manifest.yaml")
27646
+ path42.join(_package_root(), "src", "scripts", "hook_manifest.yaml")
27520
27647
  );
27521
- const settings = pathExists(settings_path) ? JSON.parse(fs43.readFileSync(settings_path, "utf8")) : {};
27648
+ const settings = pathExists(settings_path) ? JSON.parse(fs44.readFileSync(settings_path, "utf8")) : {};
27522
27649
  const hooks = (settings["hooks"] ?? {}) || {};
27523
27650
  missing = Object.keys(matrix).filter((ev) => {
27524
27651
  const groups = hooks[ev];
@@ -27593,7 +27720,7 @@ function _check_mcp_mode(project_root) {
27593
27720
  ];
27594
27721
  const found = [];
27595
27722
  for (const [rel, label] of candidates) {
27596
- const p = path41.join(project_root, rel);
27723
+ const p = path42.join(project_root, rel);
27597
27724
  if (!pathExists(p)) {
27598
27725
  continue;
27599
27726
  }
@@ -27625,7 +27752,7 @@ function _check_mcp_mode(project_root) {
27625
27752
  };
27626
27753
  }
27627
27754
  function _check_offline_readiness() {
27628
- const script = path41.join(_package_root(), "src", "scripts", "hermetic-install.sh");
27755
+ const script = path42.join(_package_root(), "src", "scripts", "hermetic-install.sh");
27629
27756
  if (!pathExists(script)) {
27630
27757
  return {
27631
27758
  id: "offline-readiness",
@@ -27683,7 +27810,7 @@ function _check_stale_orphans() {
27683
27810
  (a, b) => a < b ? -1 : a > b ? 1 : 0
27684
27811
  );
27685
27812
  for (const root_name of ownedSorted) {
27686
- const root = path41.join(anchor, root_name);
27813
+ const root = path42.join(anchor, root_name);
27687
27814
  if (!isDir2(root)) {
27688
27815
  continue;
27689
27816
  }
@@ -27698,7 +27825,7 @@ function _check_stale_orphans() {
27698
27825
  if (rel === null) {
27699
27826
  continue;
27700
27827
  }
27701
- const relPosix2 = rel.split(path41.sep).join("/");
27828
+ const relPosix2 = rel.split(path42.sep).join("/");
27702
27829
  if (recorded_set.has(relPosix2)) {
27703
27830
  continue;
27704
27831
  }
@@ -27740,21 +27867,21 @@ function _check_rule_scope_drift(project_root) {
27740
27867
  let scope = LEGACY_ALL;
27741
27868
  const settings_file = project_settings_path(project_root);
27742
27869
  if (isFile3(settings_file)) {
27743
- const loaded = yamlSafeLoad(readText0(settings_file));
27870
+ const loaded = yamlSafeLoad2(readText0(settings_file));
27744
27871
  const raw = typeof loaded === "object" && loaded !== null && !Array.isArray(loaded) ? loaded : {};
27745
27872
  scope = ruleScopeFromSettings(raw);
27746
27873
  }
27747
27874
  let rules_dir = null;
27748
27875
  let found = 0;
27749
27876
  for (const rel of _RULE_PROJECTION_DIRS) {
27750
- const cand = path41.join(project_root, rel);
27877
+ const cand = path42.join(project_root, rel);
27751
27878
  if (!isDir2(cand)) {
27752
27879
  continue;
27753
27880
  }
27754
27881
  let count = 0;
27755
27882
  try {
27756
- for (const name of fs43.readdirSync(cand)) {
27757
- if (name.endsWith(".md") && isFile3(path41.join(cand, name))) {
27883
+ for (const name of fs44.readdirSync(cand)) {
27884
+ if (name.endsWith(".md") && isFile3(path42.join(cand, name))) {
27758
27885
  count += 1;
27759
27886
  }
27760
27887
  }
@@ -27808,14 +27935,14 @@ function _check_rule_scope_drift(project_root) {
27808
27935
  };
27809
27936
  }
27810
27937
  function _check_duplicate_scope_rules(project_root, userRulesDirOverride) {
27811
- const user_rules_dir = userRulesDirOverride ?? path41.join(os11.homedir(), ".claude", "rules");
27938
+ const user_rules_dir = userRulesDirOverride ?? path42.join(os11.homedir(), ".claude", "rules");
27812
27939
  let project_rules_dir = null;
27813
27940
  if (_is_source_repo(project_root)) {
27814
- const cand = path41.join(project_root, "dist", "agent-src", "rules");
27941
+ const cand = path42.join(project_root, "dist", "agent-src", "rules");
27815
27942
  if (isDir2(cand)) project_rules_dir = cand;
27816
27943
  } else {
27817
27944
  for (const rel of _RULE_PROJECTION_DIRS) {
27818
- const cand = path41.join(project_root, rel);
27945
+ const cand = path42.join(project_root, rel);
27819
27946
  if (isDir2(cand)) {
27820
27947
  project_rules_dir = cand;
27821
27948
  break;
@@ -27884,7 +28011,7 @@ function _check_mcp_beta_readiness(project_root) {
27884
28011
  }
27885
28012
  const pending = [];
27886
28013
  for (const [gate_id, rel] of MCP_BETA_GATES) {
27887
- if (!pathExists(path41.join(project_root, rel))) {
28014
+ if (!pathExists(path42.join(project_root, rel))) {
27888
28015
  pending.push(`${gate_id} (${rel})`);
27889
28016
  }
27890
28017
  }
@@ -27905,11 +28032,11 @@ function _check_mcp_beta_readiness(project_root) {
27905
28032
  }
27906
28033
  function _check_tier_usage_readiness(project_root) {
27907
28034
  const settings_file = project_settings_path(project_root);
27908
- let log_path = path41.join(project_root, ".agent-tier-usage.jsonl");
28035
+ let log_path = path42.join(project_root, ".agent-tier-usage.jsonl");
27909
28036
  let enabled = false;
27910
28037
  if (isFile3(settings_file)) {
27911
28038
  let raw;
27912
- const loaded = yamlSafeLoad(readText0(settings_file));
28039
+ const loaded = yamlSafeLoad2(readText0(settings_file));
27913
28040
  if (loaded === null) {
27914
28041
  raw = null;
27915
28042
  } else {
@@ -27924,7 +28051,7 @@ function _check_tier_usage_readiness(project_root) {
27924
28051
  const outputRaw = tu["output"];
27925
28052
  const output = typeof outputRaw === "object" && outputRaw !== null && !Array.isArray(outputRaw) ? outputRaw : {};
27926
28053
  if (typeof output["path"] === "string" && output["path"].trim()) {
27927
- log_path = path41.join(project_root, output["path"].trim());
28054
+ log_path = path42.join(project_root, output["path"].trim());
27928
28055
  }
27929
28056
  const val = tu["enabled"];
27930
28057
  if (typeof val === "boolean") {
@@ -27949,7 +28076,7 @@ function _check_tier_usage_readiness(project_root) {
27949
28076
  return {
27950
28077
  id: "tier-usage-readiness",
27951
28078
  status: "warn",
27952
- message: `tier-usage telemetry on but ${path41.basename(log_path)} not yet written \u2014 no signal accumulated`,
28079
+ message: `tier-usage telemetry on but ${path42.basename(log_path)} not yet written \u2014 no signal accumulated`,
27953
28080
  remedy: "run any tracked command to seed the log; the dispatcher writes one record per invocation"
27954
28081
  };
27955
28082
  }
@@ -27964,7 +28091,7 @@ function _check_tier_usage_readiness(project_root) {
27964
28091
  return {
27965
28092
  id: "tier-usage-readiness",
27966
28093
  status: "fail",
27967
- message: `cannot read ${path41.basename(log_path)}: ${osErrorStr2(exc)}`,
28094
+ message: `cannot read ${path42.basename(log_path)}: ${osErrorStr2(exc)}`,
27968
28095
  remedy: "fix permissions on the tier-usage log"
27969
28096
  };
27970
28097
  }
@@ -27995,7 +28122,7 @@ function _check_tier_usage_readiness(project_root) {
27995
28122
  return {
27996
28123
  id: "tier-usage-readiness",
27997
28124
  status: "fail",
27998
- message: `${total} record(s) in ${path41.basename(log_path)} but 0 passed the privacy floor \u2014 report would refuse to render`,
28125
+ message: `${total} record(s) in ${path42.basename(log_path)} but 0 passed the privacy floor \u2014 report would refuse to render`,
27999
28126
  remedy: "inspect the log; the dispatcher is writing records the contract forbids (paths, argv, message bodies)"
28000
28127
  };
28001
28128
  }
@@ -28003,19 +28130,19 @@ function _check_tier_usage_readiness(project_root) {
28003
28130
  return {
28004
28131
  id: "tier-usage-readiness",
28005
28132
  status: "warn",
28006
- message: `${path41.basename(log_path)} present but empty \u2014 no signal yet`,
28133
+ message: `${path42.basename(log_path)} present but empty \u2014 no signal yet`,
28007
28134
  remedy: "run any tracked command to seed the log"
28008
28135
  };
28009
28136
  }
28010
28137
  return {
28011
28138
  id: "tier-usage-readiness",
28012
28139
  status: "ok",
28013
- message: `${valid} record(s) past the privacy floor in ${path41.basename(log_path)} \u2014 retiering signal available`,
28140
+ message: `${valid} record(s) past the privacy floor in ${path42.basename(log_path)} \u2014 retiering signal available`,
28014
28141
  remedy: ""
28015
28142
  };
28016
28143
  }
28017
28144
  function readText0(p) {
28018
- return fs43.readFileSync(p, "utf-8");
28145
+ return fs44.readFileSync(p, "utf-8");
28019
28146
  }
28020
28147
  function osErrorStr2(exc) {
28021
28148
  if (exc && typeof exc === "object" && "message" in exc) {
@@ -28187,7 +28314,7 @@ function _epoch_seconds(value) {
28187
28314
  function _codex_auth_expiry(auth_path) {
28188
28315
  let data;
28189
28316
  try {
28190
- data = JSON.parse(fs43.readFileSync(auth_path, "utf-8"));
28317
+ data = JSON.parse(fs44.readFileSync(auth_path, "utf-8"));
28191
28318
  } catch {
28192
28319
  return null;
28193
28320
  }
@@ -28215,7 +28342,7 @@ function _read_ai_team_block(project_root) {
28215
28342
  } catch {
28216
28343
  return {};
28217
28344
  }
28218
- const loaded = yamlSafeLoad(content);
28345
+ const loaded = yamlSafeLoad2(content);
28219
28346
  if (typeof loaded !== "object" || loaded === null || Array.isArray(loaded)) return {};
28220
28347
  const raw = loaded["ai_team"];
28221
28348
  if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return {};
@@ -28349,7 +28476,7 @@ function _check_team(project_root) {
28349
28476
  if (binary_resolved === null) {
28350
28477
  remedies.push("install the codex CLI: `npm install -g @openai/codex`");
28351
28478
  }
28352
- const auth_path = path41.join(_codex_home(), "auth.json");
28479
+ const auth_path = path42.join(_codex_home(), "auth.json");
28353
28480
  const authed = pathExists(auth_path);
28354
28481
  let auth_str;
28355
28482
  if (!authed) {
@@ -28429,7 +28556,7 @@ function _check_unsupported_combos(manifest) {
28429
28556
  };
28430
28557
  }
28431
28558
  function _wizard_state_path() {
28432
- return path41.join(event4u_root(), "state", "wizard-state.json");
28559
+ return path42.join(event4u_root(), "state", "wizard-state.json");
28433
28560
  }
28434
28561
  function _check_wizard_state() {
28435
28562
  const state_pth = _wizard_state_path();
@@ -28509,7 +28636,7 @@ function _check_wizard_state() {
28509
28636
  };
28510
28637
  }
28511
28638
  function _check_settings_review_pending() {
28512
- const delta_pth = path41.join(event4u_root(), "state", "settings-delta.json");
28639
+ const delta_pth = path42.join(event4u_root(), "state", "settings-delta.json");
28513
28640
  if (!pathExists(delta_pth)) {
28514
28641
  return {
28515
28642
  id: "settings-review-pending",
@@ -28535,7 +28662,7 @@ function _check_settings_review_pending() {
28535
28662
  }
28536
28663
  function _check_memory_merge_union(project_root) {
28537
28664
  const remedy = "run: npx tsx src/scripts/sync_gitattributes.ts (or `agent-config refresh --project`)";
28538
- const target = path41.join(project_root, DEFAULT_GITATTRIBUTES);
28665
+ const target = path42.join(project_root, DEFAULT_GITATTRIBUTES);
28539
28666
  if (!pathExists(target)) {
28540
28667
  return {
28541
28668
  id: "memory-merge-union",
@@ -29002,7 +29129,7 @@ function _run_repair(opts) {
29002
29129
  };
29003
29130
  if (exists3) {
29004
29131
  try {
29005
- fs43.unlinkSync(state_pth);
29132
+ fs44.unlinkSync(state_pth);
29006
29133
  } catch (exc) {
29007
29134
  payload["action"] = "error";
29008
29135
  payload["error"] = osErrorStr2(exc);
@@ -29097,13 +29224,13 @@ function _isCliEntry15() {
29097
29224
  if (process15.argv[1] === void 0) {
29098
29225
  return false;
29099
29226
  }
29100
- const argvUrl = pathToFileURL15(path41.resolve(process15.argv[1])).href;
29227
+ const argvUrl = pathToFileURL15(path42.resolve(process15.argv[1])).href;
29101
29228
  if (import.meta.url === argvUrl) {
29102
29229
  return true;
29103
29230
  }
29104
29231
  try {
29105
- const here = fs43.realpathSync(fileURLToPath24(import.meta.url));
29106
- const argv = fs43.realpathSync(path41.resolve(process15.argv[1]));
29232
+ const here = fs44.realpathSync(fileURLToPath24(import.meta.url));
29233
+ const argv = fs44.realpathSync(path42.resolve(process15.argv[1]));
29107
29234
  return here === argv;
29108
29235
  } catch {
29109
29236
  return false;
@@ -29259,12 +29386,12 @@ var init_cmd_doctor = __esm({
29259
29386
  });
29260
29387
 
29261
29388
  // src/install/txlog.ts
29262
- import { createReadStream, createWriteStream, existsSync as existsSync19, readFileSync as readFileSync37, renameSync as renameSync7, statSync as statSync27, unlinkSync as unlinkSync6 } from "node:fs";
29389
+ import { createReadStream, createWriteStream, existsSync as existsSync19, readFileSync as readFileSync38, renameSync as renameSync7, statSync as statSync27, unlinkSync as unlinkSync6 } from "node:fs";
29263
29390
  function readRecentEntries(logPath) {
29264
29391
  if (!existsSync19(logPath)) {
29265
29392
  return [];
29266
29393
  }
29267
- const raw = readFileSync37(logPath, "utf8");
29394
+ const raw = readFileSync38(logPath, "utf8");
29268
29395
  const lines = raw.split("\n").filter((l) => l.length > 0);
29269
29396
  const tail = lines.slice(-RECOVERY_DEPTH_CAP);
29270
29397
  const out = [];
@@ -29299,21 +29426,21 @@ var init_txlog = __esm({
29299
29426
  });
29300
29427
 
29301
29428
  // src/install/detect.ts
29302
- import { existsSync as existsSync20, readFileSync as readFileSync38, readdirSync as readdirSync23, statSync as statSync28 } from "node:fs";
29303
- import { join as join39, resolve as resolve26 } from "node:path";
29429
+ import { existsSync as existsSync20, readFileSync as readFileSync39, readdirSync as readdirSync23, statSync as statSync28 } from "node:fs";
29430
+ import { join as join40, resolve as resolve26 } from "node:path";
29304
29431
  function detectToolPresence(root) {
29305
29432
  return {
29306
- augment: isDir3(join39(root, ".augment")),
29307
- claude: isDir3(join39(root, ".claude")),
29308
- cursor: isDir3(join39(root, ".cursor")),
29309
- cline: isDir3(join39(root, ".clinerules")),
29310
- windsurf: isDir3(join39(root, ".windsurf")) || existsSync20(join39(root, ".windsurfrules")),
29311
- agentsMd: existsSync20(join39(root, "AGENTS.md"))
29433
+ augment: isDir3(join40(root, ".augment")),
29434
+ claude: isDir3(join40(root, ".claude")),
29435
+ cursor: isDir3(join40(root, ".cursor")),
29436
+ cline: isDir3(join40(root, ".clinerules")),
29437
+ windsurf: isDir3(join40(root, ".windsurf")) || existsSync20(join40(root, ".windsurfrules")),
29438
+ agentsMd: existsSync20(join40(root, "AGENTS.md"))
29312
29439
  };
29313
29440
  }
29314
- function isDir3(path50) {
29441
+ function isDir3(path51) {
29315
29442
  try {
29316
- return statSync28(path50).isDirectory();
29443
+ return statSync28(path51).isDirectory();
29317
29444
  } catch {
29318
29445
  return false;
29319
29446
  }
@@ -29324,6 +29451,37 @@ var init_detect = __esm({
29324
29451
  }
29325
29452
  });
29326
29453
 
29454
+ // src/scripts/router_target_paths.mjs
29455
+ function parseRouteTarget(target) {
29456
+ const sep14 = target.indexOf(":");
29457
+ if (sep14 <= 0) return null;
29458
+ const kind = target.slice(0, sep14);
29459
+ const id = target.slice(sep14 + 1);
29460
+ if (!id) return null;
29461
+ if (!Object.prototype.hasOwnProperty.call(ROUTE_TARGET_TEMPLATES, kind)) return null;
29462
+ return { kind, id };
29463
+ }
29464
+ function routeTargetPathsPosix(target) {
29465
+ const parsed = parseRouteTarget(target);
29466
+ if (parsed === null) return [];
29467
+ return ROUTE_TARGET_TEMPLATES[parsed.kind].map((tpl) => tpl.replace("{id}", parsed.id));
29468
+ }
29469
+ var ROUTE_TARGET_TEMPLATES;
29470
+ var init_router_target_paths = __esm({
29471
+ "src/scripts/router_target_paths.mjs"() {
29472
+ "use strict";
29473
+ ROUTE_TARGET_TEMPLATES = Object.freeze({
29474
+ skill: Object.freeze(["dist/agent-src/skills/{id}/SKILL.md"]),
29475
+ command: Object.freeze(["dist/agent-src/commands/{id}.md"]),
29476
+ guideline: Object.freeze(["docs/guidelines/{id}.md"]),
29477
+ contract: Object.freeze([
29478
+ "docs/contracts/{id}.md",
29479
+ "dist/agent-src/contexts/contracts/{id}.md"
29480
+ ])
29481
+ });
29482
+ }
29483
+ });
29484
+
29327
29485
  // src/scripts/_cli/cmd_conformance.ts
29328
29486
  var cmd_conformance_exports = {};
29329
29487
  __export(cmd_conformance_exports, {
@@ -29344,9 +29502,9 @@ __export(cmd_conformance_exports, {
29344
29502
  routeTargetPaths: () => routeTargetPaths,
29345
29503
  runConformanceChecks: () => runConformanceChecks
29346
29504
  });
29347
- import * as fs44 from "node:fs";
29505
+ import * as fs45 from "node:fs";
29348
29506
  import * as os12 from "node:os";
29349
- import * as path42 from "node:path";
29507
+ import * as path43 from "node:path";
29350
29508
  import process16 from "node:process";
29351
29509
  import { spawnSync as spawnSync9 } from "node:child_process";
29352
29510
  import { fileURLToPath as fileURLToPath25, pathToFileURL as pathToFileURL16 } from "node:url";
@@ -29363,17 +29521,17 @@ function conformanceLogPath() {
29363
29521
  if (override && override.trim().length > 0) {
29364
29522
  return override;
29365
29523
  }
29366
- return path42.join(os12.homedir(), ".event4u", "agent-config", "conformance-log.jsonl");
29524
+ return path43.join(os12.homedir(), ".event4u", "agent-config", "conformance-log.jsonl");
29367
29525
  }
29368
29526
  function installLogPath() {
29369
29527
  const override = process16.env["AGENT_CONFIG_INSTALL_LOG"];
29370
29528
  if (override && override.trim().length > 0) {
29371
29529
  return override;
29372
29530
  }
29373
- return path42.join(os12.homedir(), ".event4u", "agent-config", "install-log.jsonl");
29531
+ return path43.join(os12.homedir(), ".event4u", "agent-config", "install-log.jsonl");
29374
29532
  }
29375
29533
  function _check_txlog_clean(logPath = installLogPath()) {
29376
- if (!fs44.existsSync(logPath)) {
29534
+ if (!fs45.existsSync(logPath)) {
29377
29535
  return {
29378
29536
  id: "txlog-clean",
29379
29537
  status: "ok",
@@ -29407,30 +29565,11 @@ function _check_txlog_clean(logPath = installLogPath()) {
29407
29565
  };
29408
29566
  }
29409
29567
  function routeTargetPaths(target) {
29410
- const sep14 = target.indexOf(":");
29411
- if (sep14 <= 0) return [];
29412
- const kind = target.slice(0, sep14);
29413
- const id = target.slice(sep14 + 1);
29414
- if (!id) return [];
29415
- switch (kind) {
29416
- case "skill":
29417
- return [path42.join("dist", "agent-src", "skills", id, "SKILL.md")];
29418
- case "command":
29419
- return [path42.join("dist", "agent-src", "commands", `${id}.md`)];
29420
- case "guideline":
29421
- return [path42.join("docs", "guidelines", `${id}.md`)];
29422
- case "contract":
29423
- return [
29424
- path42.join("docs", "contracts", `${id}.md`),
29425
- path42.join("dist", "agent-src", "contexts", "contracts", `${id}.md`)
29426
- ];
29427
- default:
29428
- return [];
29429
- }
29568
+ return routeTargetPathsPosix(target).map((rel) => path43.join(...rel.split("/")));
29430
29569
  }
29431
29570
  function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
29432
- const routerPath = path42.join(packageRoot, "dist", "router.json");
29433
- if (!fs44.existsSync(routerPath)) {
29571
+ const routerPath = path43.join(packageRoot, "dist", "router.json");
29572
+ if (!fs45.existsSync(routerPath)) {
29434
29573
  return {
29435
29574
  id: "router-pointers",
29436
29575
  status: "fail",
@@ -29440,7 +29579,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
29440
29579
  }
29441
29580
  let router;
29442
29581
  try {
29443
- router = JSON.parse(fs44.readFileSync(routerPath, "utf8"));
29582
+ router = JSON.parse(fs45.readFileSync(routerPath, "utf8"));
29444
29583
  } catch (exc) {
29445
29584
  return {
29446
29585
  id: "router-pointers",
@@ -29449,13 +29588,13 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
29449
29588
  remedy: "reinstall the package \u2014 dist/router.json is corrupt"
29450
29589
  };
29451
29590
  }
29452
- const rulesDir = path42.join(packageRoot, "dist", "agent-src", "rules");
29591
+ const rulesDir = path43.join(packageRoot, "dist", "agent-src", "rules");
29453
29592
  const broken = [];
29454
29593
  let ids = 0;
29455
29594
  let targets = 0;
29456
29595
  for (const kernelId of router["kernel"] ?? []) {
29457
29596
  ids += 1;
29458
- if (!fs44.existsSync(path42.join(rulesDir, `${kernelId}.md`))) {
29597
+ if (!fs45.existsSync(path43.join(rulesDir, `${kernelId}.md`))) {
29459
29598
  broken.push(`kernel:${kernelId} \u2192 rules/${kernelId}.md missing`);
29460
29599
  }
29461
29600
  }
@@ -29463,7 +29602,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
29463
29602
  for (const entry of router[tier] ?? []) {
29464
29603
  const ruleId = String(entry["id"] ?? "");
29465
29604
  ids += 1;
29466
- if (!fs44.existsSync(path42.join(rulesDir, `${ruleId}.md`))) {
29605
+ if (!fs45.existsSync(path43.join(rulesDir, `${ruleId}.md`))) {
29467
29606
  broken.push(`${tier}:${ruleId} \u2192 rules/${ruleId}.md missing`);
29468
29607
  }
29469
29608
  for (const target of entry["routes_to"] ?? []) {
@@ -29473,7 +29612,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
29473
29612
  broken.push(`${ruleId} \u2192 unparseable routes_to ${JSON.stringify(target)}`);
29474
29613
  continue;
29475
29614
  }
29476
- if (!candidates.some((rel) => fs44.existsSync(path42.join(packageRoot, rel)))) {
29615
+ if (!candidates.some((rel) => fs45.existsSync(path43.join(packageRoot, rel)))) {
29477
29616
  broken.push(`${ruleId} \u2192 ${target} (${candidates[0]} missing)`);
29478
29617
  }
29479
29618
  }
@@ -29505,9 +29644,9 @@ function detectSmokePlatform(projectRoot) {
29505
29644
  return "claude";
29506
29645
  }
29507
29646
  function dispatcherRunner(packageRoot) {
29508
- const localTsx = path42.join(packageRoot, "node_modules", ".bin", "tsx");
29509
- const script = path42.join(packageRoot, "src", "scripts", "hooks", "dispatch_hook.ts");
29510
- if (fs44.existsSync(localTsx)) {
29647
+ const localTsx = path43.join(packageRoot, "node_modules", ".bin", "tsx");
29648
+ const script = path43.join(packageRoot, "src", "scripts", "hooks", "dispatch_hook.ts");
29649
+ if (fs45.existsSync(localTsx)) {
29511
29650
  return [localTsx, script];
29512
29651
  }
29513
29652
  return ["npx", "tsx", script];
@@ -29557,12 +29696,12 @@ function _check_hook_dispatcher(projectRoot, packageRoot = PACKAGE_ROOT2, opts =
29557
29696
  };
29558
29697
  }
29559
29698
  function readSettingsMode(projectRoot) {
29560
- const settingsPath = path42.join(projectRoot, ".agent-settings.yml");
29561
- if (!fs44.existsSync(settingsPath)) {
29699
+ const settingsPath = path43.join(projectRoot, ".agent-settings.yml");
29700
+ if (!fs45.existsSync(settingsPath)) {
29562
29701
  return "eager-all";
29563
29702
  }
29564
29703
  try {
29565
- const parsed = YAML6.parse(fs44.readFileSync(settingsPath, "utf8"));
29704
+ const parsed = YAML6.parse(fs45.readFileSync(settingsPath, "utf8"));
29566
29705
  const lean = parsed?.["lean_projection"] ?? null;
29567
29706
  const mode = lean?.["mode"];
29568
29707
  return typeof mode === "string" && mode.length > 0 ? mode : "eager-all";
@@ -29573,7 +29712,7 @@ function readSettingsMode(projectRoot) {
29573
29712
  function kernelIdsFromRouter(packageRoot) {
29574
29713
  try {
29575
29714
  const router = JSON.parse(
29576
- fs44.readFileSync(path42.join(packageRoot, "dist", "router.json"), "utf8")
29715
+ fs45.readFileSync(path43.join(packageRoot, "dist", "router.json"), "utf8")
29577
29716
  );
29578
29717
  return new Set((router["kernel"] ?? []).map(String));
29579
29718
  } catch {
@@ -29590,8 +29729,8 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
29590
29729
  remedy: "set lean_projection.mode to 'eager-all' or 'thin' in .agent-settings.yml"
29591
29730
  };
29592
29731
  }
29593
- const rulesDir = projectedRulesDir ?? path42.join(projectRoot, ".augment", "rules");
29594
- if (!fs44.existsSync(rulesDir)) {
29732
+ const rulesDir = projectedRulesDir ?? path43.join(projectRoot, ".augment", "rules");
29733
+ if (!fs45.existsSync(rulesDir)) {
29595
29734
  return {
29596
29735
  id: "lean-projection",
29597
29736
  status: "skipped",
@@ -29600,7 +29739,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
29600
29739
  };
29601
29740
  }
29602
29741
  const kernel = kernelIdsFromRouter(packageRoot);
29603
- const files = fs44.readdirSync(rulesDir).filter((f) => f.endsWith(".md") && f !== "INDEX.md").sort();
29742
+ const files = fs45.readdirSync(rulesDir).filter((f) => f.endsWith(".md") && f !== "INDEX.md").sort();
29604
29743
  const nonKernel = files.filter((f) => !kernel.has(f.replace(/\.md$/, "")));
29605
29744
  if (nonKernel.length === 0) {
29606
29745
  return {
@@ -29614,7 +29753,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
29614
29753
  for (const f of nonKernel) {
29615
29754
  let text = "";
29616
29755
  try {
29617
- text = fs44.readFileSync(path42.join(rulesDir, f), "utf8");
29756
+ text = fs45.readFileSync(path43.join(rulesDir, f), "utf8");
29618
29757
  } catch {
29619
29758
  continue;
29620
29759
  }
@@ -29645,8 +29784,8 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
29645
29784
  function _check_host_manifest(projectRoot) {
29646
29785
  const detected = Object.entries(detectToolPresence(projectRoot)).filter(([, v]) => v === true).map(([k]) => k);
29647
29786
  const detectedNote = detected.length > 0 ? `detected surfaces: ${detected.join(", ")}` : "no surfaces detected";
29648
- const settingsPath = path42.join(projectRoot, ".agent-settings.yml");
29649
- if (!fs44.existsSync(settingsPath)) {
29787
+ const settingsPath = path43.join(projectRoot, ".agent-settings.yml");
29788
+ if (!fs45.existsSync(settingsPath)) {
29650
29789
  return {
29651
29790
  id: "host-manifest",
29652
29791
  status: "ok",
@@ -29656,7 +29795,7 @@ function _check_host_manifest(projectRoot) {
29656
29795
  }
29657
29796
  let parsed = null;
29658
29797
  try {
29659
- parsed = YAML6.parse(fs44.readFileSync(settingsPath, "utf8"));
29798
+ parsed = YAML6.parse(fs45.readFileSync(settingsPath, "utf8"));
29660
29799
  } catch (exc) {
29661
29800
  return {
29662
29801
  id: "host-manifest",
@@ -29853,13 +29992,13 @@ function _isCliEntry16() {
29853
29992
  if (process16.argv[1] === void 0) {
29854
29993
  return false;
29855
29994
  }
29856
- const argvUrl = pathToFileURL16(path42.resolve(process16.argv[1])).href;
29995
+ const argvUrl = pathToFileURL16(path43.resolve(process16.argv[1])).href;
29857
29996
  if (import.meta.url === argvUrl) {
29858
29997
  return true;
29859
29998
  }
29860
29999
  try {
29861
- const here = fs44.realpathSync(fileURLToPath25(import.meta.url));
29862
- const argv = fs44.realpathSync(path42.resolve(process16.argv[1]));
30000
+ const here = fs45.realpathSync(fileURLToPath25(import.meta.url));
30001
+ const argv = fs45.realpathSync(path43.resolve(process16.argv[1]));
29863
30002
  return here === argv;
29864
30003
  } catch {
29865
30004
  return false;
@@ -29875,6 +30014,7 @@ var init_cmd_conformance = __esm({
29875
30014
  init_txlog();
29876
30015
  init_detect();
29877
30016
  init_package_root();
30017
+ init_router_target_paths();
29878
30018
  init_cmd_doctor();
29879
30019
  _HERE13 = fileURLToPath25(import.meta.url);
29880
30020
  PACKAGE_ROOT2 = resolvePackageRoot(import.meta.url);
@@ -29921,8 +30061,8 @@ __export(settings_exports, {
29921
30061
  read_settings: () => read_settings,
29922
30062
  read_tier_usage_settings: () => read_tier_usage_settings
29923
30063
  });
29924
- import { createRequire as createRequire5 } from "node:module";
29925
- import * as fs45 from "node:fs";
30064
+ import { createRequire as createRequire6 } from "node:module";
30065
+ import * as fs46 from "node:fs";
29926
30066
  function _isPlainObject8(v) {
29927
30067
  return typeof v === "object" && v !== null && !Array.isArray(v) && !(v instanceof Date);
29928
30068
  }
@@ -29959,7 +30099,7 @@ function _coerce_path(value, def) {
29959
30099
  }
29960
30100
  function _isFile13(p) {
29961
30101
  try {
29962
- return fs45.statSync(p).isFile();
30102
+ return fs46.statSync(p).isFile();
29963
30103
  } catch {
29964
30104
  return false;
29965
30105
  }
@@ -29970,7 +30110,7 @@ function read_settings(p) {
29970
30110
  if (_isFile13(p)) {
29971
30111
  let raw = {};
29972
30112
  try {
29973
- raw = YAML7.parse(fs45.readFileSync(p, "utf-8"), { version: "1.1" });
30113
+ raw = YAML7.parse(fs46.readFileSync(p, "utf-8"), { version: "1.1" });
29974
30114
  if (raw === null || raw === void 0) {
29975
30115
  raw = {};
29976
30116
  }
@@ -30004,7 +30144,7 @@ function read_tier_usage_settings(p) {
30004
30144
  if (_isFile13(p)) {
30005
30145
  let raw = {};
30006
30146
  try {
30007
- raw = YAML7.parse(fs45.readFileSync(p, "utf-8"), { version: "1.1" });
30147
+ raw = YAML7.parse(fs46.readFileSync(p, "utf-8"), { version: "1.1" });
30008
30148
  if (raw === null || raw === void 0) {
30009
30149
  raw = {};
30010
30150
  }
@@ -30045,7 +30185,7 @@ var YAML7, DEFAULT_LOG_PATH, DEFAULT_GRANULARITY, ALLOWED_GRANULARITIES, DEFAULT
30045
30185
  var init_settings = __esm({
30046
30186
  "src/agent-src/templates/scripts/telemetry/settings.ts"() {
30047
30187
  "use strict";
30048
- YAML7 = createRequire5(import.meta.url)("yaml");
30188
+ YAML7 = createRequire6(import.meta.url)("yaml");
30049
30189
  DEFAULT_LOG_PATH = ".agent-engagement.jsonl";
30050
30190
  DEFAULT_GRANULARITY = "task";
30051
30191
  ALLOWED_GRANULARITIES = ["task", "phase-step", "tool-call"];
@@ -30542,7 +30682,7 @@ __export(aggregator_exports, {
30542
30682
  aggregate: () => aggregate2,
30543
30683
  rank_artefacts: () => rank_artefacts
30544
30684
  });
30545
- import * as fs46 from "node:fs";
30685
+ import * as fs47 from "node:fs";
30546
30686
  function _key(kind, artId) {
30547
30687
  return `${kind}\0${artId}`;
30548
30688
  }
@@ -30579,7 +30719,7 @@ function* _iter_events(log_path) {
30579
30719
  if (!_isFile14(log_path)) {
30580
30720
  return;
30581
30721
  }
30582
- const text = fs46.readFileSync(log_path, "utf-8");
30722
+ const text = fs47.readFileSync(log_path, "utf-8");
30583
30723
  const lines = _pyFileLines(text);
30584
30724
  let lineNo = 0;
30585
30725
  for (const line of lines) {
@@ -30613,7 +30753,7 @@ function _pyFileLines(text) {
30613
30753
  }
30614
30754
  function _isFile14(p) {
30615
30755
  try {
30616
- return fs46.statSync(p).isFile();
30756
+ return fs47.statSync(p).isFile();
30617
30757
  } catch {
30618
30758
  return false;
30619
30759
  }
@@ -31127,7 +31267,7 @@ var init_report_renderer = __esm({
31127
31267
  });
31128
31268
 
31129
31269
  // src/scripts/ai_council/bundler.ts
31130
- import * as fs47 from "node:fs";
31270
+ import * as fs48 from "node:fs";
31131
31271
  function _context(mode, text, manifest = [], excluded = []) {
31132
31272
  return { mode, text, manifest, excluded };
31133
31273
  }
@@ -31185,10 +31325,10 @@ function bundle_prompt(text) {
31185
31325
  return _context("prompt", _enforceSize(redacted, "prompt"), ["<inline prompt>"]);
31186
31326
  }
31187
31327
  function bundle_roadmap(p) {
31188
- if (!fs47.existsSync(p)) {
31328
+ if (!fs48.existsSync(p)) {
31189
31329
  throw new FileNotFoundError2(`Roadmap not found: ${p}`);
31190
31330
  }
31191
- const raw = fs47.readFileSync(p, { encoding: "utf-8" });
31331
+ const raw = fs48.readFileSync(p, { encoding: "utf-8" });
31192
31332
  const redacted = redact(raw);
31193
31333
  return _context(
31194
31334
  "roadmap",
@@ -31751,8 +31891,8 @@ not. Cite the peer-reviewer label and the targeted response label
31751
31891
  });
31752
31892
 
31753
31893
  // src/scripts/ai_council/advisors.ts
31754
- import * as fs48 from "node:fs";
31755
- import * as path43 from "node:path";
31894
+ import * as fs49 from "node:fs";
31895
+ import * as path44 from "node:path";
31756
31896
  function _split_frontmatter(raw) {
31757
31897
  const match = _FRONTMATTER_RE2.exec(raw);
31758
31898
  if (!match) {
@@ -31780,12 +31920,12 @@ function _display_name_from(advisor_name, frontmatter) {
31780
31920
  }
31781
31921
  function resolve_persona_text(persona_path, repo_root) {
31782
31922
  const candidates = [
31783
- path43.join(repo_root, "dist/agent-src", persona_path),
31784
- path43.join(repo_root, ".agent-src.uncondensed", persona_path)
31923
+ path44.join(repo_root, "dist/agent-src", persona_path),
31924
+ path44.join(repo_root, ".agent-src.uncondensed", persona_path)
31785
31925
  ];
31786
31926
  for (const candidate of candidates) {
31787
- if (fs48.existsSync(candidate)) {
31788
- const raw = fs48.readFileSync(candidate, "utf-8");
31927
+ if (fs49.existsSync(candidate)) {
31928
+ const raw = fs49.readFileSync(candidate, "utf-8");
31789
31929
  const [meta, body] = _split_frontmatter(raw);
31790
31930
  return [body.trim(), meta];
31791
31931
  }
@@ -32195,7 +32335,7 @@ __export(low_impact_corpus_exports, {
32195
32335
  load_validated_phrases: () => load_validated_phrases,
32196
32336
  parse_corpus_strict: () => parse_corpus_strict
32197
32337
  });
32198
- import * as fs49 from "node:fs";
32338
+ import * as fs50 from "node:fs";
32199
32339
  function _entry(phrase, normalised, section, line_no, trailing_metadata = "") {
32200
32340
  return { phrase, normalised, section, line_no, trailing_metadata };
32201
32341
  }
@@ -32368,10 +32508,10 @@ function _checkHeadingDrift(text, title) {
32368
32508
  }
32369
32509
  function parse_corpus_strict(corpusPath) {
32370
32510
  const p = corpusPath;
32371
- if (!fs49.existsSync(p)) {
32511
+ if (!fs50.existsSync(p)) {
32372
32512
  return new CorpusParseResult();
32373
32513
  }
32374
- const text = fs49.readFileSync(p, { encoding: "utf-8" });
32514
+ const text = fs50.readFileSync(p, { encoding: "utf-8" });
32375
32515
  const allTitles = _SECTION_KEYS.map((k) => _SECTION_TITLES[k]);
32376
32516
  const resultSections = {
32377
32517
  validated: [],
@@ -32434,10 +32574,10 @@ function load_anti_example_phrases(corpusPath) {
32434
32574
  }
32435
32575
  function load_corpus_lock(yamlPath) {
32436
32576
  const p = yamlPath;
32437
- if (!fs49.existsSync(p)) {
32577
+ if (!fs50.existsSync(p)) {
32438
32578
  return new CorpusParseResult();
32439
32579
  }
32440
- const parsed = (0, import_yaml7.parse)(fs49.readFileSync(p, { encoding: "utf-8" }), { version: "1.1" });
32580
+ const parsed = (0, import_yaml7.parse)(fs50.readFileSync(p, { encoding: "utf-8" }), { version: "1.1" });
32441
32581
  const doc = parsed === null || parsed === void 0 ? {} : parsed;
32442
32582
  const schemaVersion = doc["schema_version"];
32443
32583
  if (schemaVersion !== 1) {
@@ -32499,7 +32639,7 @@ function _deriveLockPath(corpusPath) {
32499
32639
  }
32500
32640
  function _loadSectionFromLock(corpusPath, section) {
32501
32641
  const lockPath = _deriveLockPath(corpusPath);
32502
- if (!fs49.existsSync(lockPath)) {
32642
+ if (!fs50.existsSync(lockPath)) {
32503
32643
  return null;
32504
32644
  }
32505
32645
  try {
@@ -32511,10 +32651,10 @@ function _loadSectionFromLock(corpusPath, section) {
32511
32651
  }
32512
32652
  function _loadSectionLenient(corpusPath, section) {
32513
32653
  const p = corpusPath;
32514
- if (!fs49.existsSync(p)) {
32654
+ if (!fs50.existsSync(p)) {
32515
32655
  return [];
32516
32656
  }
32517
- const text = fs49.readFileSync(p, { encoding: "utf-8" });
32657
+ const text = fs50.readFileSync(p, { encoding: "utf-8" });
32518
32658
  const allTitles = _SECTION_KEYS.map((k) => _SECTION_TITLES[k]);
32519
32659
  const bounds = _sectionBounds(text, _SECTION_TITLES[section], allTitles);
32520
32660
  if (bounds === null) {
@@ -33294,8 +33434,8 @@ var init_necessity = __esm({
33294
33434
  });
33295
33435
 
33296
33436
  // src/scripts/ai_council/budget_guard.ts
33297
- import * as fs50 from "node:fs";
33298
- import * as path44 from "node:path";
33437
+ import * as fs51 from "node:fs";
33438
+ import * as path45 from "node:path";
33299
33439
  function _resolveLedgerPath(p) {
33300
33440
  if (p !== null) {
33301
33441
  return p;
@@ -33310,18 +33450,18 @@ function _nowUtcMs() {
33310
33450
  return Date.now();
33311
33451
  }
33312
33452
  function _ensureLedgerDir(p) {
33313
- const parent = path44.dirname(p);
33453
+ const parent = path45.dirname(p);
33314
33454
  try {
33315
- fs50.mkdirSync(parent, { recursive: true });
33455
+ fs51.mkdirSync(parent, { recursive: true });
33316
33456
  let mode;
33317
33457
  try {
33318
- mode = fs50.statSync(parent).mode & 511;
33458
+ mode = fs51.statSync(parent).mode & 511;
33319
33459
  } catch {
33320
33460
  mode = 448;
33321
33461
  }
33322
33462
  if (mode !== 448) {
33323
33463
  try {
33324
- fs50.chmodSync(parent, 448);
33464
+ fs51.chmodSync(parent, 448);
33325
33465
  } catch {
33326
33466
  }
33327
33467
  }
@@ -33333,18 +33473,18 @@ function _ensureLedgerDir(p) {
33333
33473
  }
33334
33474
  }
33335
33475
  function _ensureLedgerFileMode(p) {
33336
- if (!fs50.existsSync(p)) {
33476
+ if (!fs51.existsSync(p)) {
33337
33477
  return;
33338
33478
  }
33339
33479
  let current;
33340
33480
  try {
33341
- current = fs50.statSync(p).mode & 511;
33481
+ current = fs51.statSync(p).mode & 511;
33342
33482
  } catch {
33343
33483
  return;
33344
33484
  }
33345
33485
  if (current !== 384) {
33346
33486
  try {
33347
- fs50.chmodSync(p, 384);
33487
+ fs51.chmodSync(p, 384);
33348
33488
  } catch {
33349
33489
  }
33350
33490
  }
@@ -33496,11 +33636,11 @@ function pyNumToStr(n) {
33496
33636
  }
33497
33637
  function read_entries2(p = null) {
33498
33638
  const resolved = _resolveLedgerPath(p);
33499
- if (!fs50.existsSync(resolved)) {
33639
+ if (!fs51.existsSync(resolved)) {
33500
33640
  return [];
33501
33641
  }
33502
33642
  const out = [];
33503
- const text = fs50.readFileSync(resolved, "utf-8");
33643
+ const text = fs51.readFileSync(resolved, "utf-8");
33504
33644
  for (const rawLine of text.split(/\r\n|\r|\n/u)) {
33505
33645
  const line = rawLine.trim();
33506
33646
  if (line === "") {
@@ -33603,7 +33743,7 @@ function record_spend(usd, provider, model, options = {}) {
33603
33743
  )}
33604
33744
  `;
33605
33745
  try {
33606
- fs50.appendFileSync(p, entry, { encoding: "utf-8" });
33746
+ fs51.appendFileSync(p, entry, { encoding: "utf-8" });
33607
33747
  } catch (exc) {
33608
33748
  process.stderr.write(`[council:budget_guard] write failed: ${_errStr(exc)}
33609
33749
  `);
@@ -33726,8 +33866,8 @@ function aggregate_scores(findings, scores) {
33726
33866
  by_id.get(s.finding_id).push(s);
33727
33867
  }
33728
33868
  const out = /* @__PURE__ */ new Map();
33729
- for (const [fid, fs56] of by_id) {
33730
- if (fs56.length === 0) {
33869
+ for (const [fid, fs57] of by_id) {
33870
+ if (fs57.length === 0) {
33731
33871
  out.set(
33732
33872
  fid,
33733
33873
  new ConsensusMetadata({
@@ -33743,13 +33883,13 @@ function aggregate_scores(findings, scores) {
33743
33883
  );
33744
33884
  continue;
33745
33885
  }
33746
- const mean = fs56.reduce((acc, s) => acc + s.score, 0) / fs56.length;
33747
- const agree_rate = fs56.filter((s) => s.agree).length / fs56.length;
33886
+ const mean = fs57.reduce((acc, s) => acc + s.score, 0) / fs57.length;
33887
+ const agree_rate = fs57.filter((s) => s.agree).length / fs57.length;
33748
33888
  const strength = mean / 10 * agree_rate;
33749
- const dissent = fs56.filter((s) => !s.agree).length;
33750
- const concur = fs56.filter((s) => s.agree).length;
33751
- const scorers = fs56.map((s) => s.scorer);
33752
- const dissent_reasons = fs56.filter((s) => !s.agree).map((s) => [s.scorer, s.reason]);
33889
+ const dissent = fs57.filter((s) => !s.agree).length;
33890
+ const concur = fs57.filter((s) => s.agree).length;
33891
+ const scorers = fs57.map((s) => s.scorer);
33892
+ const dissent_reasons = fs57.filter((s) => !s.agree).map((s) => [s.scorer, s.reason]);
33753
33893
  const mean_rounded = pyRound(mean, 2);
33754
33894
  out.set(
33755
33895
  fid,
@@ -34130,11 +34270,11 @@ __export(pricing_exports, {
34130
34270
  prices_file_for: () => prices_file_for,
34131
34271
  reprice_with_cache: () => reprice_with_cache
34132
34272
  });
34133
- import * as fs51 from "node:fs";
34134
- import * as path45 from "node:path";
34273
+ import * as fs52 from "node:fs";
34274
+ import * as path46 from "node:path";
34135
34275
  import { fileURLToPath as fileURLToPath26 } from "node:url";
34136
34276
  function prices_file_for(repo_root) {
34137
- return path45.join(repo_root, "agents", "runtime", ".agent-prices.md");
34277
+ return path46.join(repo_root, "agents", "runtime", ".agent-prices.md");
34138
34278
  }
34139
34279
  function lookup(table, provider, model) {
34140
34280
  return table.prices.get(priceKey(provider, model)) ?? null;
@@ -34228,16 +34368,16 @@ function is_stale(table, now) {
34228
34368
  return last < last_monday_utc(now);
34229
34369
  }
34230
34370
  function load_prices(p = PRICES_FILE) {
34231
- if (!fs51.existsSync(p)) {
34371
+ if (!fs52.existsSync(p)) {
34232
34372
  bootstrap_from_defaults(p);
34233
34373
  }
34234
- return _parse4(fs51.readFileSync(p, "utf-8"));
34374
+ return _parse4(fs52.readFileSync(p, "utf-8"));
34235
34375
  }
34236
34376
  function bootstrap_from_defaults(p = PRICES_FILE) {
34237
- fs51.mkdirSync(path45.dirname(p), { recursive: true });
34377
+ fs52.mkdirSync(path46.dirname(p), { recursive: true });
34238
34378
  const rows = as_rows();
34239
34379
  const body = _render_markdown(LAST_UPDATED, "shipped-default", rows);
34240
- fs51.writeFileSync(p, body, "utf-8");
34380
+ fs52.writeFileSync(p, body, "utf-8");
34241
34381
  }
34242
34382
  function _fmt62f(x) {
34243
34383
  const s = x.toFixed(2);
@@ -34360,8 +34500,8 @@ var init_pricing = __esm({
34360
34500
  "use strict";
34361
34501
  init_default_prices();
34362
34502
  _HERE14 = fileURLToPath26(import.meta.url);
34363
- REPO_ROOT2 = path45.resolve(path45.dirname(_HERE14), "..", "..", "..");
34364
- PRICES_FILE = path45.join(REPO_ROOT2, "agents", "runtime", ".agent-prices.md");
34503
+ REPO_ROOT2 = path46.resolve(path46.dirname(_HERE14), "..", "..", "..");
34504
+ PRICES_FILE = path46.join(REPO_ROOT2, "agents", "runtime", ".agent-prices.md");
34365
34505
  _CHARS_PER_TOKEN = 4;
34366
34506
  CACHE_READ_MULTIPLIER = 0.1;
34367
34507
  CACHE_WRITE_MULTIPLIER_5M = 1.25;
@@ -35901,18 +36041,18 @@ __export(project_context_exports, {
35901
36041
  REPO_PURPOSE_MAX_CHARS: () => REPO_PURPOSE_MAX_CHARS,
35902
36042
  detect_project_context: () => detect_project_context
35903
36043
  });
35904
- import * as fs52 from "node:fs";
35905
- import * as path46 from "node:path";
36044
+ import * as fs53 from "node:fs";
36045
+ import * as path47 from "node:path";
35906
36046
  function _isPlainObject11(v) {
35907
36047
  return typeof v === "object" && v !== null && !Array.isArray(v);
35908
36048
  }
35909
36049
  function _read_json(p) {
35910
- if (!fs52.existsSync(p)) {
36050
+ if (!fs53.existsSync(p)) {
35911
36051
  return null;
35912
36052
  }
35913
36053
  let raw;
35914
36054
  try {
35915
- raw = fs52.readFileSync(p, "utf-8");
36055
+ raw = fs53.readFileSync(p, "utf-8");
35916
36056
  } catch {
35917
36057
  return null;
35918
36058
  }
@@ -35934,7 +36074,7 @@ function _name_from(composer, pkg, root) {
35934
36074
  }
35935
36075
  }
35936
36076
  try {
35937
- const base = path46.basename(root);
36077
+ const base = path47.basename(root);
35938
36078
  return base || null;
35939
36079
  } catch {
35940
36080
  return null;
@@ -36003,12 +36143,12 @@ function _splitlines10(text) {
36003
36143
  return parts;
36004
36144
  }
36005
36145
  function _purpose_from_readme(p) {
36006
- if (!fs52.existsSync(p)) {
36146
+ if (!fs53.existsSync(p)) {
36007
36147
  return null;
36008
36148
  }
36009
36149
  let text;
36010
36150
  try {
36011
- text = fs52.readFileSync(p, "utf-8");
36151
+ text = fs53.readFileSync(p, "utf-8");
36012
36152
  } catch {
36013
36153
  return null;
36014
36154
  }
@@ -36092,13 +36232,13 @@ function _rfind(haystack, needle) {
36092
36232
  return -1;
36093
36233
  }
36094
36234
  function detect_project_context(root) {
36095
- const resolvedRoot = path46.resolve(root ?? process.cwd());
36096
- const composer = _read_json(path46.join(resolvedRoot, "composer.json"));
36097
- const pkg = _read_json(path46.join(resolvedRoot, "package.json"));
36235
+ const resolvedRoot = path47.resolve(root ?? process.cwd());
36236
+ const composer = _read_json(path47.join(resolvedRoot, "composer.json"));
36237
+ const pkg = _read_json(path47.join(resolvedRoot, "package.json"));
36098
36238
  return new ProjectContext(
36099
36239
  _name_from(composer, pkg, resolvedRoot),
36100
36240
  _stack_from(composer, pkg),
36101
- _purpose_from_readme(path46.join(resolvedRoot, "README.md"))
36241
+ _purpose_from_readme(path47.join(resolvedRoot, "README.md"))
36102
36242
  );
36103
36243
  }
36104
36244
  var REPO_PURPOSE_MAX_CHARS, _HEADING_RE, _BADGE_RE, _HTML_RE, ProjectContext;
@@ -36368,7 +36508,7 @@ __export(shadow_dispatch_exports, {
36368
36508
  slo_banner: () => slo_banner,
36369
36509
  slo_status: () => slo_status
36370
36510
  });
36371
- import * as fs53 from "node:fs";
36511
+ import * as fs54 from "node:fs";
36372
36512
  import { createHash as createHash9 } from "node:crypto";
36373
36513
  function should_shadow(sampleRate, opts = {}) {
36374
36514
  const rate = Math.max(0, Math.min(1, sampleRate));
@@ -36406,7 +36546,7 @@ function record_shadow_decision(logPath, opts) {
36406
36546
  escalated,
36407
36547
  escalation_reason: escalationReason
36408
36548
  };
36409
- fs53.mkdirSync(_dirname2(logPath), { recursive: true });
36549
+ fs54.mkdirSync(_dirname2(logPath), { recursive: true });
36410
36550
  const row = _pyJsonDumps2({
36411
36551
  timestamp: decision.timestamp,
36412
36552
  query_hash: decision.query_hash,
@@ -36416,7 +36556,7 @@ function record_shadow_decision(logPath, opts) {
36416
36556
  escalated: decision.escalated,
36417
36557
  escalation_reason: decision.escalation_reason
36418
36558
  }) + "\n";
36419
- fs53.appendFileSync(logPath, row, { encoding: "utf-8" });
36559
+ fs54.appendFileSync(logPath, row, { encoding: "utf-8" });
36420
36560
  return decision;
36421
36561
  }
36422
36562
  function _isoNowSeconds() {
@@ -36425,10 +36565,10 @@ function _isoNowSeconds() {
36425
36565
  return `${pad(d.getUTCFullYear(), 4)}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())}T${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}:${pad(d.getUTCSeconds())}+00:00`;
36426
36566
  }
36427
36567
  function* _iterLog(logPath) {
36428
- if (!fs53.existsSync(logPath)) {
36568
+ if (!fs54.existsSync(logPath)) {
36429
36569
  return;
36430
36570
  }
36431
- const content = fs53.readFileSync(logPath, { encoding: "utf-8" });
36571
+ const content = fs54.readFileSync(logPath, { encoding: "utf-8" });
36432
36572
  for (const rawLine of _splitlines11(content)) {
36433
36573
  const line = _strip7(rawLine);
36434
36574
  if (!line) {
@@ -37349,8 +37489,8 @@ __export(council_cli_exports, {
37349
37489
  load_settings: () => load_settings,
37350
37490
  main: () => main17
37351
37491
  });
37352
- import * as fs54 from "node:fs";
37353
- import * as path47 from "node:path";
37492
+ import * as fs55 from "node:fs";
37493
+ import * as path48 from "node:path";
37354
37494
  import { fileURLToPath as fileURLToPath27, pathToFileURL as pathToFileURL17 } from "node:url";
37355
37495
  function _pyFixed6(x, ndigits) {
37356
37496
  if (!Number.isFinite(x)) {
@@ -37559,7 +37699,7 @@ function _stderr2(s) {
37559
37699
  function load_settings(p = SETTINGS_FILE2, opts = {}) {
37560
37700
  const ai_council_path = opts.ai_council_path ?? AI_COUNCIL_FILE;
37561
37701
  const settings = load_agent_settings({ project_path: p });
37562
- if (fs54.existsSync(ai_council_path)) {
37702
+ if (fs55.existsSync(ai_council_path)) {
37563
37703
  const cfg = load_council_config(ai_council_path);
37564
37704
  settings["ai_council"] = _synthesize_ai_council_block(cfg);
37565
37705
  }
@@ -37935,7 +38075,7 @@ function build_question(opts) {
37935
38075
  let ctx;
37936
38076
  let artefact;
37937
38077
  if (input_mode === "prompt") {
37938
- const text = fs54.readFileSync(input_path, "utf-8");
38078
+ const text = fs55.readFileSync(input_path, "utf-8");
37939
38079
  ctx = bundle_prompt(text);
37940
38080
  artefact = String(input_path);
37941
38081
  } else if (input_mode === "roadmap") {
@@ -38078,9 +38218,9 @@ function _maybe_write_decision_replay(opts) {
38078
38218
  include_member_arguments: include_args
38079
38219
  })
38080
38220
  );
38081
- const target = path47.join(path47.dirname(opts.out_path), "decision-replay.md");
38082
- fs54.mkdirSync(path47.dirname(target), { recursive: true });
38083
- fs54.writeFileSync(target, replay, { encoding: "utf-8" });
38221
+ const target = path48.join(path48.dirname(opts.out_path), "decision-replay.md");
38222
+ fs55.mkdirSync(path48.dirname(target), { recursive: true });
38223
+ fs55.writeFileSync(target, replay, { encoding: "utf-8" });
38084
38224
  return target;
38085
38225
  }
38086
38226
  function _peer_review_active(ai_cfg, args) {
@@ -38970,8 +39110,8 @@ function cmd_run(args, opts = {}) {
38970
39110
  kind: "responses",
38971
39111
  subcommand: "run"
38972
39112
  });
38973
- fs54.mkdirSync(path47.dirname(_resolveTarget(out_path)), { recursive: true });
38974
- fs54.writeFileSync(_resolveTarget(out_path), _jsonDumpsIndent22(payload) + "\n", { encoding: "utf-8" });
39113
+ fs55.mkdirSync(path48.dirname(_resolveTarget(out_path)), { recursive: true });
39114
+ fs55.writeFileSync(_resolveTarget(out_path), _jsonDumpsIndent22(payload) + "\n", { encoding: "utf-8" });
38975
39115
  _stdout2(
38976
39116
  `
38977
39117
  council:run \xB7 wrote ${out_path} (estimated $${_pyFixed6(estimated_total, 4)} / actual $${_pyFixed6(actual_total, 4)})
@@ -38996,7 +39136,7 @@ function _debate_round_filename(round_number) {
38996
39136
  return `debate-round-${round_number}.json`;
38997
39137
  }
38998
39138
  function _write_debate_round(out_dir, round_number, responses, opts) {
38999
- fs54.mkdirSync(_resolveTarget(out_dir), { recursive: true });
39139
+ fs55.mkdirSync(_resolveTarget(out_dir), { recursive: true });
39000
39140
  let actual_total = 0;
39001
39141
  for (const r of responses) {
39002
39142
  if (r.error) {
@@ -39020,15 +39160,15 @@ function _write_debate_round(out_dir, round_number, responses, opts) {
39020
39160
  prompt_cache_round_gap_ms: opts.cache_gap_ms_since_previous_round ?? null,
39021
39161
  responses: _serialise_responses(responses)
39022
39162
  };
39023
- const out_path = path47.join(_resolveTarget(out_dir), _debate_round_filename(round_number));
39024
- fs54.writeFileSync(out_path, _jsonDumpsIndent22(payload) + "\n", { encoding: "utf-8" });
39163
+ const out_path = path48.join(_resolveTarget(out_dir), _debate_round_filename(round_number));
39164
+ fs55.writeFileSync(out_path, _jsonDumpsIndent22(payload) + "\n", { encoding: "utf-8" });
39025
39165
  return out_path;
39026
39166
  }
39027
39167
  function _load_debate_seed(p, expected_members) {
39028
- if (!fs54.existsSync(p)) {
39168
+ if (!fs55.existsSync(p)) {
39029
39169
  throw new FileNotFoundError3(`--continue-as-debate path not found: ${p}`);
39030
39170
  }
39031
- const payload = JSON.parse(fs54.readFileSync(p, "utf-8"));
39171
+ const payload = JSON.parse(fs55.readFileSync(p, "utf-8"));
39032
39172
  const source_members = (payload["members"] || []).slice();
39033
39173
  const expected_labels = expected_members.map((m) => `${m.name}/${m.model}`);
39034
39174
  if (!_listEq(source_members, expected_labels)) {
@@ -39074,7 +39214,7 @@ function _readStdinLine() {
39074
39214
  try {
39075
39215
  const buf = Buffer.alloc(4096);
39076
39216
  const fd = 0;
39077
- const n = fs54.readSync(fd, buf, 0, buf.length, null);
39217
+ const n = fs55.readSync(fd, buf, 0, buf.length, null);
39078
39218
  return buf.toString("utf-8", 0, n).split("\n")[0]?.trim().toLowerCase() ?? "";
39079
39219
  } catch {
39080
39220
  return "";
@@ -39300,7 +39440,7 @@ council:debate \xB7 ${all_rounds.length} round(s) complete \xB7 actual $${_pyFix
39300
39440
  return errors_last.length > 0 && errors_last.length === last.length ? 1 : 0;
39301
39441
  }
39302
39442
  function cmd_render(args) {
39303
- const payload = JSON.parse(fs54.readFileSync(args.responses, "utf-8"));
39443
+ const payload = JSON.parse(fs55.readFileSync(args.responses, "utf-8"));
39304
39444
  const items = payload["responses"] || [];
39305
39445
  const explicit = _getattr3(args, "prompt_mode", null);
39306
39446
  const mode = explicit || payload["prompt_mode"] || payload["mode"];
@@ -39326,8 +39466,8 @@ function cmd_render(args) {
39326
39466
  kind: "sessions",
39327
39467
  subcommand: "render"
39328
39468
  });
39329
- fs54.mkdirSync(path47.dirname(_resolveTarget(out_path)), { recursive: true });
39330
- fs54.writeFileSync(_resolveTarget(out_path), body + "\n", { encoding: "utf-8" });
39469
+ fs55.mkdirSync(path48.dirname(_resolveTarget(out_path)), { recursive: true });
39470
+ fs55.writeFileSync(_resolveTarget(out_path), body + "\n", { encoding: "utf-8" });
39331
39471
  _stdout2(`council:render \xB7 wrote ${out_path}
39332
39472
  `);
39333
39473
  return 0;
@@ -39338,15 +39478,15 @@ function cmd_render(args) {
39338
39478
  function _cmd_replay_low_impact_stats(args) {
39339
39479
  const li = low_impact_exports;
39340
39480
  const responses_path = args.responses;
39341
- const log_path = path47.join(path47.dirname(responses_path), "low-impact-resolutions.md");
39342
- if (!fs54.existsSync(log_path)) {
39481
+ const log_path = path48.join(path48.dirname(responses_path), "low-impact-resolutions.md");
39482
+ if (!fs55.existsSync(log_path)) {
39343
39483
  _stdout2(
39344
39484
  `council:replay \xB7 no low-impact-resolutions.md alongside ${responses_path} \u2014 session had no fast-path entries.
39345
39485
  `
39346
39486
  );
39347
39487
  return 0;
39348
39488
  }
39349
- const body = fs54.readFileSync(log_path, "utf-8");
39489
+ const body = fs55.readFileSync(log_path, "utf-8");
39350
39490
  const stats = li.parse_low_impact_log(body);
39351
39491
  const out = li.render_low_impact_stats(stats);
39352
39492
  if (_getattr3(args, "output", null)) {
@@ -39354,8 +39494,8 @@ function _cmd_replay_low_impact_stats(args) {
39354
39494
  kind: "sessions",
39355
39495
  subcommand: "replay"
39356
39496
  });
39357
- fs54.mkdirSync(path47.dirname(_resolveTarget(target)), { recursive: true });
39358
- fs54.writeFileSync(_resolveTarget(target), out, { encoding: "utf-8" });
39497
+ fs55.mkdirSync(path48.dirname(_resolveTarget(target)), { recursive: true });
39498
+ fs55.writeFileSync(_resolveTarget(target), out, { encoding: "utf-8" });
39359
39499
  _stdout2(`council:replay \xB7 wrote ${target}
39360
39500
  `);
39361
39501
  return 0;
@@ -39367,7 +39507,7 @@ function cmd_replay(args) {
39367
39507
  if (_getattr3(args, "low_impact_stats", false)) {
39368
39508
  return _cmd_replay_low_impact_stats(args);
39369
39509
  }
39370
- const payload = JSON.parse(fs54.readFileSync(args.responses, "utf-8"));
39510
+ const payload = JSON.parse(fs55.readFileSync(args.responses, "utf-8"));
39371
39511
  const consensus = _deserialise_consensus(payload["consensus"]);
39372
39512
  if (consensus === null) {
39373
39513
  _stderr2(
@@ -39392,8 +39532,8 @@ function cmd_replay(args) {
39392
39532
  kind: "sessions",
39393
39533
  subcommand: "replay"
39394
39534
  });
39395
- fs54.mkdirSync(path47.dirname(_resolveTarget(out_path)), { recursive: true });
39396
- fs54.writeFileSync(_resolveTarget(out_path), body, { encoding: "utf-8" });
39535
+ fs55.mkdirSync(path48.dirname(_resolveTarget(out_path)), { recursive: true });
39536
+ fs55.writeFileSync(_resolveTarget(out_path), body, { encoding: "utf-8" });
39397
39537
  _stdout2(`council:replay \xB7 wrote ${out_path}
39398
39538
  `);
39399
39539
  } else {
@@ -39450,8 +39590,8 @@ function cmd_quota(args, opts = {}) {
39450
39590
  }
39451
39591
  function _validate_council_output_path(path_str, opts) {
39452
39592
  const expected_rel = COUNCIL_CANONICAL_DIRS[opts.kind];
39453
- const expected_abs = _resolveReal(path47.join(REPO_ROOT3, expected_rel));
39454
- const target = path47.isAbsolute(path_str) ? path_str : path47.join(REPO_ROOT3, path_str);
39593
+ const expected_abs = _resolveReal(path48.join(REPO_ROOT3, expected_rel));
39594
+ const target = path48.isAbsolute(path_str) ? path_str : path48.join(REPO_ROOT3, path_str);
39455
39595
  const target_resolved = _resolveReal(target);
39456
39596
  if (!_isRelativeTo(target_resolved, expected_abs)) {
39457
39597
  throw new ArgumentTypeError(
@@ -39461,12 +39601,12 @@ function _validate_council_output_path(path_str, opts) {
39461
39601
  return path_str;
39462
39602
  }
39463
39603
  function _resolveTarget(path_str) {
39464
- return path47.isAbsolute(path_str) ? path_str : path47.join(REPO_ROOT3, path_str);
39604
+ return path48.isAbsolute(path_str) ? path_str : path48.join(REPO_ROOT3, path_str);
39465
39605
  }
39466
39606
  function _resolveReal(p) {
39467
- const abs = path47.resolve(p);
39607
+ const abs = path48.resolve(p);
39468
39608
  try {
39469
- return fs54.realpathSync(abs);
39609
+ return fs55.realpathSync(abs);
39470
39610
  } catch {
39471
39611
  return abs;
39472
39612
  }
@@ -39475,8 +39615,8 @@ function _isRelativeTo(target, base) {
39475
39615
  if (target === base) {
39476
39616
  return true;
39477
39617
  }
39478
- const rel = path47.relative(base, target);
39479
- return rel !== "" && !rel.startsWith("..") && !path47.isAbsolute(rel);
39618
+ const rel = path48.relative(base, target);
39619
+ return rel !== "" && !rel.startsWith("..") && !path48.isAbsolute(rel);
39480
39620
  }
39481
39621
  function _topError(message) {
39482
39622
  _stderr2(_TOP_USAGE2);
@@ -39837,13 +39977,13 @@ function _isCliEntry17() {
39837
39977
  if (process.argv[1] === void 0) {
39838
39978
  return false;
39839
39979
  }
39840
- const argvUrl = pathToFileURL17(path47.resolve(process.argv[1])).href;
39980
+ const argvUrl = pathToFileURL17(path48.resolve(process.argv[1])).href;
39841
39981
  if (import.meta.url === argvUrl) {
39842
39982
  return true;
39843
39983
  }
39844
39984
  try {
39845
- const here = fs54.realpathSync(fileURLToPath27(import.meta.url));
39846
- const argv = fs54.realpathSync(path47.resolve(process.argv[1]));
39985
+ const here = fs55.realpathSync(fileURLToPath27(import.meta.url));
39986
+ const argv = fs55.realpathSync(path48.resolve(process.argv[1]));
39847
39987
  return here === argv;
39848
39988
  } catch {
39849
39989
  return false;
@@ -39895,7 +40035,7 @@ var init_council_cli = __esm({
39895
40035
  "xai",
39896
40036
  "perplexity"
39897
40037
  ]);
39898
- _HERE15 = path47.dirname(fileURLToPath27(import.meta.url));
40038
+ _HERE15 = path48.dirname(fileURLToPath27(import.meta.url));
39899
40039
  [REPO_ROOT3] = resolve_project_root(null);
39900
40040
  SETTINGS_FILE2 = project_settings_path(REPO_ROOT3);
39901
40041
  AI_COUNCIL_FILE = resolve_config_path(REPO_ROOT3);
@@ -39997,7 +40137,7 @@ var init_safety_envelope = __esm({
39997
40137
  });
39998
40138
 
39999
40139
  // src/scripts/mcp_server/__main__.ts
40000
- import * as path49 from "node:path";
40140
+ import * as path50 from "node:path";
40001
40141
  import { fileURLToPath as fileURLToPath29 } from "node:url";
40002
40142
 
40003
40143
  // src/scripts/mcp_server/index.ts
@@ -40045,8 +40185,8 @@ init_prompts();
40045
40185
  init_resources();
40046
40186
 
40047
40187
  // src/scripts/mcp_server/tools.ts
40048
- import * as fs55 from "node:fs";
40049
- import * as path48 from "node:path";
40188
+ import * as fs56 from "node:fs";
40189
+ import * as path49 from "node:path";
40050
40190
  import { fileURLToPath as fileURLToPath28 } from "node:url";
40051
40191
 
40052
40192
  // src/scripts/chat_history.ts
@@ -42294,9 +42434,9 @@ function _strip8(s) {
42294
42434
  }
42295
42435
  function _resolvePath2(p) {
42296
42436
  try {
42297
- return fs55.realpathSync(p);
42437
+ return fs56.realpathSync(p);
42298
42438
  } catch {
42299
- return path48.resolve(p);
42439
+ return path49.resolve(p);
42300
42440
  }
42301
42441
  }
42302
42442
  function _resolveConsumerRoot(override) {
@@ -42306,14 +42446,14 @@ function _resolveConsumerRoot(override) {
42306
42446
  return _resolvePath2(process.cwd());
42307
42447
  }
42308
42448
  function _relativeUnder(target, root) {
42309
- const rel = path48.relative(root, target);
42449
+ const rel = path49.relative(root, target);
42310
42450
  if (rel === "") {
42311
42451
  return "";
42312
42452
  }
42313
- if (rel.startsWith("..") || path48.isAbsolute(rel)) {
42453
+ if (rel.startsWith("..") || path49.isAbsolute(rel)) {
42314
42454
  return null;
42315
42455
  }
42316
- return rel.split(path48.sep).join("/");
42456
+ return rel.split(path49.sep).join("/");
42317
42457
  }
42318
42458
  function _reprStrList(values) {
42319
42459
  return `[${values.map((v) => `'${v}'`).join(", ")}]`;
@@ -42322,11 +42462,11 @@ function _validateInTreePath(raw, consumerRoot) {
42322
42462
  const root = _resolvePath2(consumerRoot);
42323
42463
  let target;
42324
42464
  if (raw === null || raw === void 0 || raw === "") {
42325
- target = path48.join(root, "agents", "runtime", ".agent-chat-history");
42326
- } else if (path48.isAbsolute(raw)) {
42465
+ target = path49.join(root, "agents", "runtime", ".agent-chat-history");
42466
+ } else if (path49.isAbsolute(raw)) {
42327
42467
  target = _resolvePath2(raw);
42328
42468
  } else {
42329
- target = _resolvePath2(path48.join(root, raw));
42469
+ target = _resolvePath2(path49.join(root, raw));
42330
42470
  }
42331
42471
  const rel = _relativeUnder(target, root);
42332
42472
  if (rel === null) {
@@ -42364,11 +42504,11 @@ async function _lintSkillsHandler(args, consumerRoot) {
42364
42504
  if (typeof raw !== "string") {
42365
42505
  throw new Error("'paths' entries must be strings");
42366
42506
  }
42367
- const resolved = path48.isAbsolute(raw) ? _resolvePath2(raw) : _resolvePath2(path48.join(root, raw));
42507
+ const resolved = path49.isAbsolute(raw) ? _resolvePath2(raw) : _resolvePath2(path49.join(root, raw));
42368
42508
  if (_relativeUnder(resolved, root) === null) {
42369
42509
  throw new Error(`path escapes consumer_root: ${resolved}`);
42370
42510
  }
42371
- if (fs55.existsSync(resolved)) {
42511
+ if (fs56.existsSync(resolved)) {
42372
42512
  paths.push(resolved);
42373
42513
  }
42374
42514
  }
@@ -42405,7 +42545,7 @@ async function _chatHistoryAppendHandler(args, consumerRoot) {
42405
42545
  if (typeof minSchema !== "number" || !Number.isInteger(minSchema) || typeof minSchema === "boolean") {
42406
42546
  throw new Error("'min_schema_version' must be an integer");
42407
42547
  }
42408
- const existingHeader = fs55.existsSync(target) ? _chReadHeader(target) : null;
42548
+ const existingHeader = fs56.existsSync(target) ? _chReadHeader(target) : null;
42409
42549
  const observed = existingHeader !== null && typeof existingHeader === "object" ? _pyInt7(existingHeader.v ?? 0) : SCHEMA_VERSION3;
42410
42550
  if (observed < minSchema) {
42411
42551
  throw new Error(`chat-history schema ${observed} below required ${minSchema}`);
@@ -42420,8 +42560,8 @@ async function _chatHistoryAppendHandler(args, consumerRoot) {
42420
42560
  session: session === void 0 ? null : session
42421
42561
  };
42422
42562
  }
42423
- if (!fs55.existsSync(target) || _chReadHeader(target) === null) {
42424
- fs55.mkdirSync(path48.dirname(target), { recursive: true });
42563
+ if (!fs56.existsSync(target) || _chReadHeader(target) === null) {
42564
+ fs56.mkdirSync(path49.dirname(target), { recursive: true });
42425
42565
  _chInit(target);
42426
42566
  }
42427
42567
  _chAppend(entry, target, session ?? null);
@@ -42465,7 +42605,7 @@ async function _chatHistoryReadHandler(args, consumerRoot) {
42465
42605
  if (detail !== "full" && detail !== "index") {
42466
42606
  throw new Error("'detail' must be 'index' or 'full'");
42467
42607
  }
42468
- if (!fs55.existsSync(target)) {
42608
+ if (!fs56.existsSync(target)) {
42469
42609
  return { path: target, entries: [], count: 0 };
42470
42610
  }
42471
42611
  if (around !== void 0 && around !== null) {
@@ -42567,8 +42707,8 @@ async function _memoryStatusHandler(_args, consumerRoot) {
42567
42707
  }
42568
42708
  return result;
42569
42709
  }
42570
- var _PACKAGE_ROOT2 = path48.resolve(
42571
- path48.dirname(fileURLToPath28(import.meta.url)),
42710
+ var _PACKAGE_ROOT2 = path49.resolve(
42711
+ path49.dirname(fileURLToPath28(import.meta.url)),
42572
42712
  "..",
42573
42713
  "..",
42574
42714
  ".."
@@ -42612,10 +42752,10 @@ async function _memorySignalHandler(args, consumerRoot) {
42612
42752
  async function _roadmapProgressHandler(args, consumerRoot) {
42613
42753
  const dryRun = _pyTruthy6(args.dry_run ?? false);
42614
42754
  const root = _resolvePath2(consumerRoot);
42615
- const roadmapRoot = path48.join(root, "agents", "roadmaps");
42616
- const target = path48.join(root, "agents", "roadmaps-progress.md");
42755
+ const roadmapRoot = path49.join(root, "agents", "roadmaps");
42756
+ const target = path49.join(root, "agents", "roadmaps-progress.md");
42617
42757
  const urp = await Promise.resolve().then(() => (init_update_roadmap_progress(), update_roadmap_progress_exports));
42618
- if (!fs55.existsSync(roadmapRoot)) {
42758
+ if (!fs56.existsSync(roadmapRoot)) {
42619
42759
  return {
42620
42760
  written: false,
42621
42761
  path: target,
@@ -42630,7 +42770,7 @@ async function _roadmapProgressHandler(args, consumerRoot) {
42630
42770
  const stepsDone = roadmaps.reduce((s, r) => s + r.done, 0);
42631
42771
  const stepsTotal = roadmaps.reduce((s, r) => s + r.total_active, 0);
42632
42772
  if (!dryRun) {
42633
- fs55.writeFileSync(target, content, "utf-8");
42773
+ fs56.writeFileSync(target, content, "utf-8");
42634
42774
  }
42635
42775
  return {
42636
42776
  written: !dryRun,
@@ -42651,11 +42791,11 @@ async function _roadmapArchiveHandler(_args, consumerRoot) {
42651
42791
  let dashboardRegenerated = false;
42652
42792
  if (archived.length > 0) {
42653
42793
  const urp = await Promise.resolve().then(() => (init_update_roadmap_progress(), update_roadmap_progress_exports));
42654
- const roadmapRoot = path48.join(root, "agents", "roadmaps");
42655
- if (fs55.existsSync(roadmapRoot)) {
42794
+ const roadmapRoot = path49.join(root, "agents", "roadmaps");
42795
+ if (fs56.existsSync(roadmapRoot)) {
42656
42796
  const roadmaps = urp.collect(roadmapRoot);
42657
- fs55.writeFileSync(
42658
- path48.join(root, "agents", "roadmaps-progress.md"),
42797
+ fs56.writeFileSync(
42798
+ path49.join(root, "agents", "roadmaps-progress.md"),
42659
42799
  urp.render(roadmaps, urp.collect_bundles(root)),
42660
42800
  "utf-8"
42661
42801
  );
@@ -42671,9 +42811,9 @@ async function _roadmapArchiveHandler(_args, consumerRoot) {
42671
42811
  async function _capabilitiesIndexHandler(args, consumerRoot) {
42672
42812
  const check = _pyTruthy6(args.check ?? false);
42673
42813
  const cap = await Promise.resolve().then(() => (init_generate_capabilities_index(), generate_capabilities_index_exports));
42674
- const out = path48.join(_PACKAGE_ROOT2, "CAPABILITIES.yaml");
42814
+ const out = path49.join(_PACKAGE_ROOT2, "CAPABILITIES.yaml");
42675
42815
  const content = cap.build();
42676
- const onDisk = fs55.existsSync(out) ? fs55.readFileSync(out, "utf-8") : "";
42816
+ const onDisk = fs56.existsSync(out) ? fs56.readFileSync(out, "utf-8") : "";
42677
42817
  const drift = onDisk !== content;
42678
42818
  if (check) {
42679
42819
  return { check: true, written: false, drift, path: out };
@@ -42684,7 +42824,7 @@ async function _capabilitiesIndexHandler(args, consumerRoot) {
42684
42824
  `CAPABILITIES.yaml path escapes consumer_root: ${out} not under ${root}`
42685
42825
  );
42686
42826
  }
42687
- fs55.writeFileSync(out, content, "utf-8");
42827
+ fs56.writeFileSync(out, content, "utf-8");
42688
42828
  return { check: false, written: true, drift, path: out };
42689
42829
  }
42690
42830
  async function _runDoctorLeg(consumerRoot) {
@@ -42784,11 +42924,11 @@ async function _councilEstimateHandler(args, consumerRoot) {
42784
42924
  throw new Error("'depth' must be 'shallow' or 'deep' when provided");
42785
42925
  }
42786
42926
  const root = _resolvePath2(consumerRoot);
42787
- const target = path48.isAbsolute(inputRaw) ? _resolvePath2(inputRaw) : _resolvePath2(path48.join(root, inputRaw));
42927
+ const target = path49.isAbsolute(inputRaw) ? _resolvePath2(inputRaw) : _resolvePath2(path49.join(root, inputRaw));
42788
42928
  if (_relativeUnder(target, root) === null) {
42789
42929
  throw new Error(`path escapes consumer_root: ${target}`);
42790
42930
  }
42791
- if (!fs55.existsSync(target)) {
42931
+ if (!fs56.existsSync(target)) {
42792
42932
  throw new Error(`input_path not found: ${target}`);
42793
42933
  }
42794
42934
  const cli = await Promise.resolve().then(() => (init_council_cli(), council_cli_exports));
@@ -42850,18 +42990,18 @@ async function _runTestsHandler(args, consumerRoot) {
42850
42990
  if (typeof relPathRaw !== "string" || !_strip8(relPathRaw)) {
42851
42991
  throw new Error("'path' must be a non-empty string when provided");
42852
42992
  }
42853
- const resolved = path48.isAbsolute(relPathRaw) ? _resolvePath2(relPathRaw) : _resolvePath2(path48.join(root, relPathRaw));
42993
+ const resolved = path49.isAbsolute(relPathRaw) ? _resolvePath2(relPathRaw) : _resolvePath2(path49.join(root, relPathRaw));
42854
42994
  const rel = _relativeUnder(resolved, root);
42855
42995
  if (rel === null) {
42856
42996
  throw new Error(`path escapes consumer_root: ${resolved}`);
42857
42997
  }
42858
- if (!fs55.existsSync(resolved)) {
42998
+ if (!fs56.existsSync(resolved)) {
42859
42999
  throw new Error(`path not found: ${resolved}`);
42860
43000
  }
42861
43001
  relArg = rel;
42862
43002
  }
42863
- const vitestEntry = path48.join(root, "node_modules", "vitest", "vitest.mjs");
42864
- if (!fs55.existsSync(vitestEntry)) {
43003
+ const vitestEntry = path49.join(root, "node_modules", "vitest", "vitest.mjs");
43004
+ if (!fs56.existsSync(vitestEntry)) {
42865
43005
  throw new Error(
42866
43006
  "run_tests pilot supports vitest projects only \u2014 node_modules/vitest/vitest.mjs not found under consumer_root"
42867
43007
  );
@@ -43467,8 +43607,8 @@ function _strCmp3(a, b) {
43467
43607
  return a < b ? -1 : a > b ? 1 : 0;
43468
43608
  }
43469
43609
  function _pathlibCompare3(a, b) {
43470
- const pa = a.split(path48.sep);
43471
- const pb = b.split(path48.sep);
43610
+ const pa = a.split(path49.sep);
43611
+ const pb = b.split(path49.sep);
43472
43612
  const n = Math.min(pa.length, pb.length);
43473
43613
  for (let i = 0; i < n; i++) {
43474
43614
  const c = _strCmp3(pa[i], pb[i]);
@@ -43693,7 +43833,7 @@ function main18() {
43693
43833
 
43694
43834
  // src/scripts/mcp_server/__main__.ts
43695
43835
  var _selfPath = fileURLToPath29(import.meta.url);
43696
- var _invokedDirectly2 = globalThis.__AC_MCP_BUNDLE_DIRECT === true || process.argv[1] !== void 0 && path49.resolve(process.argv[1]) === path49.resolve(_selfPath);
43836
+ var _invokedDirectly2 = globalThis.__AC_MCP_BUNDLE_DIRECT === true || process.argv[1] !== void 0 && path50.resolve(process.argv[1]) === path50.resolve(_selfPath);
43697
43837
  if (_invokedDirectly2) {
43698
43838
  main18();
43699
43839
  }