@event4u/agent-config 9.14.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 (276) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +110 -112
  3. package/README.md +8 -0
  4. package/dist/agent-src/commands/agents/audit.md +7 -7
  5. package/dist/agent-src/commands/agents/optimize.md +1 -1
  6. package/dist/agent-src/commands/analyze/reference-repo.md +1 -1
  7. package/dist/agent-src/commands/chat-history.md +1 -0
  8. package/dist/agent-src/commands/context.md +1 -0
  9. package/dist/agent-src/commands/council.md +1 -1
  10. package/dist/agent-src/commands/ghostwriter.md +1 -1
  11. package/dist/agent-src/commands/memory.md +2 -1
  12. package/dist/agent-src/commands/module.md +1 -0
  13. package/dist/agent-src/commands/optimize/agents-dir.md +1 -1
  14. package/dist/agent-src/commands/optimize/deep.md +5 -2
  15. package/dist/agent-src/commands/optimize/skills.md +5 -5
  16. package/dist/agent-src/commands/override.md +1 -0
  17. package/dist/agent-src/commands/prediction-pool.md +4 -4
  18. package/dist/agent-src/commands/research/deep.md +1 -1
  19. package/dist/agent-src/commands/roadmap.md +2 -1
  20. package/dist/agent-src/commands/rule-compliance-audit.md +1 -1
  21. package/dist/agent-src/commands/tdd.md +1 -0
  22. package/dist/agent-src/commands/tests.md +1 -0
  23. package/dist/agent-src/commands/upstream-contribute.md +5 -5
  24. package/dist/agent-src/commands/video/from-script.md +1 -1
  25. package/dist/agent-src/commands/video/from-song.md +1 -1
  26. package/dist/agent-src/commands/video/scene.md +1 -1
  27. package/dist/agent-src/commands/video/stitch.md +1 -1
  28. package/dist/agent-src/commands/video/storyboard.md +1 -1
  29. package/dist/agent-src/commands/worktree/create.md +2 -1
  30. package/dist/agent-src/contexts/augment-infrastructure.md +1 -1
  31. package/dist/agent-src/contexts/contracts/artifact-engagement-flow.md +5 -5
  32. package/dist/agent-src/contexts/contracts/command-suggestion-flow.md +3 -3
  33. package/dist/agent-src/contexts/contracts/emergency-triage-block.md +2 -2
  34. package/dist/agent-src/contexts/execution/roadmap-process-loop.md +4 -3
  35. package/dist/agent-src/contexts/execution/subagent-routing.md +19 -0
  36. package/dist/agent-src/contexts/override-system.md +1 -1
  37. package/dist/agent-src/ghostwriter/fictional-fixture-v1.md +1 -1
  38. package/dist/agent-src/rules/augment-edit-discipline.md +1 -1
  39. package/dist/agent-src/rules/autonomous-execution.md +2 -1
  40. package/dist/agent-src/rules/brand-consistency.md +1 -0
  41. package/dist/agent-src/rules/brand-source-of-truth.md +1 -0
  42. package/dist/agent-src/rules/code-comment-discipline.md +2 -0
  43. package/dist/agent-src/rules/communication-through-line.md +1 -0
  44. package/dist/agent-src/rules/content-quoting-floor.md +1 -0
  45. package/dist/agent-src/rules/cross-source-consistency.md +0 -1
  46. package/dist/agent-src/rules/downstream-changes.md +1 -0
  47. package/dist/agent-src/rules/external-code-graph-interop.md +1 -0
  48. package/dist/agent-src/rules/external-reference-deep-dive.md +1 -0
  49. package/dist/agent-src/rules/fast-path-marker-visibility.md +1 -0
  50. package/dist/agent-src/rules/finance-safety-floor.md +0 -1
  51. package/dist/agent-src/rules/icon-consistency.md +1 -0
  52. package/dist/agent-src/rules/image-likeness-and-rights.md +1 -0
  53. package/dist/agent-src/rules/improve-before-implement.md +1 -1
  54. package/dist/agent-src/rules/invite-challenge.md +1 -0
  55. package/dist/agent-src/rules/lethal-trifecta-guard.md +1 -0
  56. package/dist/agent-src/rules/low-impact-corpus-privacy-floor.md +1 -0
  57. package/dist/agent-src/rules/markdown-safe-codeblocks.md +1 -0
  58. package/dist/agent-src/rules/media-governance-routing.md +4 -3
  59. package/dist/agent-src/rules/media-sync-ground-truth.md +1 -0
  60. package/dist/agent-src/rules/no-attribution-footers.md +1 -0
  61. package/dist/agent-src/rules/no-decorative-emojis-in-git-surfaces.md +1 -0
  62. package/dist/agent-src/rules/no-pr-progress-comments.md +1 -0
  63. package/dist/agent-src/rules/onboarding-gate.md +1 -0
  64. package/dist/agent-src/rules/output-discipline.md +1 -0
  65. package/dist/agent-src/rules/prefer-enums-over-literals.md +1 -0
  66. package/dist/agent-src/rules/preservation-guard.md +1 -0
  67. package/dist/agent-src/rules/question-not-instruction.md +1 -0
  68. package/dist/agent-src/rules/roadmap-ci-steps-policy.md +1 -0
  69. package/dist/agent-src/rules/role-mode-adherence.md +1 -0
  70. package/dist/agent-src/rules/runtime-safety.md +1 -0
  71. package/dist/agent-src/rules/security-sensitive-stop.md +1 -0
  72. package/dist/agent-src/rules/session-canary.md +9 -2
  73. package/dist/agent-src/rules/source-confidentiality.md +1 -0
  74. package/dist/agent-src/rules/source-of-truth.md +1 -0
  75. package/dist/agent-src/rules/spreadsheet-source-quality.md +1 -0
  76. package/dist/agent-src/rules/think-before-action.md +1 -0
  77. package/dist/agent-src/rules/token-budget-discipline.md +1 -0
  78. package/dist/agent-src/rules/token-efficiency.md +1 -0
  79. package/dist/agent-src/rules/token-optimizer-maintenance.md +5 -5
  80. package/dist/agent-src/rules/tool-safety.md +1 -0
  81. package/dist/agent-src/rules/untrusted-input-defense.md +2 -0
  82. package/dist/agent-src/rules/user-interaction.md +1 -0
  83. package/dist/agent-src/rules/user-interrupt-priority.md +1 -0
  84. package/dist/agent-src/skills/adr-create/SKILL.md +1 -1
  85. package/dist/agent-src/skills/check-refs/SKILL.md +1 -1
  86. package/dist/agent-src/skills/competitive-positioning/SKILL.md +1 -1
  87. package/dist/agent-src/skills/condense-memory/SKILL.md +1 -1
  88. package/dist/agent-src/skills/context-authoring/SKILL.md +1 -1
  89. package/dist/agent-src/skills/copilot-agents-optimization/SKILL.md +1 -1
  90. package/dist/agent-src/skills/description-assist/SKILL.md +1 -1
  91. package/dist/agent-src/skills/github-ci/SKILL.md +1 -0
  92. package/dist/agent-src/skills/guideline-writing/SKILL.md +1 -1
  93. package/dist/agent-src/skills/lint-skills/SKILL.md +1 -1
  94. package/dist/agent-src/skills/readme-reviewer/SKILL.md +1 -1
  95. package/dist/agent-src/skills/roadmap-management/SKILL.md +8 -1
  96. package/dist/agent-src/skills/roadmap-writing/SKILL.md +1 -1
  97. package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +1 -1
  98. package/dist/agent-src/skills/skill-writing/SKILL.md +4 -4
  99. package/dist/agent-src/skills/token-optimizer/SKILL.md +4 -4
  100. package/dist/agent-src/skills/upstream-contribute/SKILL.md +6 -6
  101. package/dist/agent-src/skills/using-git-worktrees/SKILL.md +25 -0
  102. package/dist/agent-src/templates/AGENTS.md +1 -1
  103. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  104. package/dist/agent-src/templates/command.md +1 -1
  105. package/dist/agent-src/templates/copilot-instructions.md +3 -3
  106. package/dist/agent-src/templates/rule.md +2 -2
  107. package/dist/agent-src/templates/scripts/work_engine/orchestration.ts +1 -1
  108. package/dist/agent-src/templates/skill-archive-note.md +5 -5
  109. package/dist/agent-src/templates/skill.md +1 -1
  110. package/dist/cli/agent-config.js +66 -19
  111. package/dist/cli/agent-config.js.map +1 -1
  112. package/dist/cli/main.js +9 -4
  113. package/dist/cli/main.js.map +1 -1
  114. package/dist/cli/python/workspace_drive.js +2 -0
  115. package/dist/cli/python/workspace_drive.js.map +1 -1
  116. package/dist/cli/python/workspace_drive_health.js +2 -0
  117. package/dist/cli/python/workspace_drive_health.js.map +1 -1
  118. package/dist/cli/python/workspace_hosts.js +2 -0
  119. package/dist/cli/python/workspace_hosts.js.map +1 -1
  120. package/dist/cli/python/workspace_sessions.js +2 -0
  121. package/dist/cli/python/workspace_sessions.js.map +1 -1
  122. package/dist/cli/registry.js +1 -0
  123. package/dist/cli/registry.js.map +1 -1
  124. package/dist/cli-delegate/{chunk-A3HJ6NTI.js → chunk-63WSP6YZ.js} +2 -1
  125. package/dist/cli-delegate/{chunk-EJYIGZ3T.js → chunk-BKO2AZ7Z.js} +1 -1
  126. package/dist/cli-delegate/{chunk-GCVFLBP2.js → chunk-H574KOUH.js} +338 -494
  127. package/dist/cli-delegate/chunk-NXFWFAYV.js +339 -0
  128. package/dist/cli-delegate/{chunk-TEGJU2JX.js → chunk-ZXXJLL5K.js} +2 -2
  129. package/dist/cli-delegate/cmd_conformance.js +29 -23
  130. package/dist/cli-delegate/cmd_doctor.js +3 -3
  131. package/dist/cli-delegate/cmd_export.js +4 -4
  132. package/dist/cli-delegate/cmd_preflight.js +2 -2
  133. package/dist/cli-delegate/cmd_prune.js +4 -4
  134. package/dist/cli-delegate/cmd_settings_migrate.js +4 -4
  135. package/dist/cli-delegate/cmd_sync.js +4 -4
  136. package/dist/cli-delegate/cmd_uninstall.js +4 -4
  137. package/dist/cli-delegate/cmd_validate.js +4 -4
  138. package/dist/discovery/deprecation-report.md +1 -1
  139. package/dist/discovery/discovery-manifest.json +127 -95
  140. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  141. package/dist/discovery/discovery-manifest.summary.md +1 -1
  142. package/dist/discovery/orphan-report.md +1 -1
  143. package/dist/discovery/packs.json +2 -2
  144. package/dist/discovery/trust-report.md +1 -1
  145. package/dist/discovery/workspaces.json +2 -2
  146. package/dist/hooks/dispatch.js +729 -430
  147. package/dist/install/install.mjs +52 -11
  148. package/dist/install/rule_scope.js +18 -2
  149. package/dist/install/rule_scope.js.map +1 -1
  150. package/dist/mcp/registry-manifest.json +2 -2
  151. package/dist/mcp/server.json +2 -2
  152. package/dist/mcp/server.mjs +518 -411
  153. package/dist/router.json +1 -1
  154. package/dist/scripts/_lib/claude_settings_hooks.js +30 -5
  155. package/dist/scripts/_lib/claude_settings_hooks.js.map +1 -1
  156. package/dist/scripts/_lib/scoped_projection.js +223 -0
  157. package/dist/scripts/_lib/scoped_projection.js.map +1 -0
  158. package/dist/scripts/_lib/surface_tiers.js +125 -0
  159. package/dist/scripts/_lib/surface_tiers.js.map +1 -0
  160. package/dist/scripts/_lib/token_count.js +166 -0
  161. package/dist/scripts/_lib/token_count.js.map +1 -0
  162. package/dist/scripts/_lib/trigger_eval_floors.js +8 -0
  163. package/dist/scripts/_lib/trigger_eval_floors.js.map +1 -1
  164. package/dist/scripts/condense.js +139 -9
  165. package/dist/scripts/condense.js.map +1 -1
  166. package/dist/scripts/project_thin_rules.js +450 -0
  167. package/dist/scripts/project_thin_rules.js.map +1 -0
  168. package/dist/server/routes/workspace.js +2 -0
  169. package/dist/server/routes/workspace.js.map +1 -1
  170. package/dist/server/schemas/settings.js +9 -3
  171. package/dist/server/schemas/settings.js.map +1 -1
  172. package/dist/ui/assets/index-DJY_vQVn.js +40 -0
  173. package/dist/ui/assets/index-DJY_vQVn.js.map +1 -0
  174. package/dist/ui/index.html +1 -1
  175. package/docs/guidelines/agent-infra/roadmap-progress-mechanics.md +1 -1
  176. package/package.json +11 -11
  177. package/src/agent-src/templates/AGENTS.md +1 -1
  178. package/src/agent-src/templates/scripts/work_engine/orchestration.ts +1 -1
  179. package/src/config/agent-settings.template.yml +59 -11
  180. package/src/config/ci-local-parity.yml +8 -0
  181. package/src/config/discovery/unassigned-artefacts.yml +23 -25
  182. package/src/config/evaluator-budgets.json +35 -5
  183. package/src/config/gate-coverage.yml +147 -0
  184. package/src/config/gate-violation-baselines.json +25 -0
  185. package/src/install/rule_scope.ts +27 -2
  186. package/src/scripts/_cli/cmd_conformance.ts +13 -24
  187. package/src/scripts/_dispatch.bash +10 -0
  188. package/src/scripts/_lib/claude_settings_hooks.ts +30 -4
  189. package/src/scripts/_lib/gate_baseline.ts +213 -0
  190. package/src/scripts/_lib/scoped_projection.ts +50 -0
  191. package/src/scripts/_lib/tier_budget_routing.ts +234 -0
  192. package/src/scripts/_lib/tool_adapter_registry.ts +8 -1
  193. package/src/scripts/_lib/trigger_eval_floors.ts +9 -0
  194. package/src/scripts/_lib/trigger_routers.ts +17 -5
  195. package/src/scripts/adr/regenerate_index.ts +4 -3
  196. package/src/scripts/ai-video/lib/parse-blueprint.sh +1 -1
  197. package/src/scripts/ai_council/compile_corpus.ts +1 -1
  198. package/src/scripts/audit_cloud_compatibility.ts +37 -2
  199. package/src/scripts/audit_initial_context.ts +53 -19
  200. package/src/scripts/audit_likelihood.ts +31 -2
  201. package/src/scripts/audit_user_type_axis.ts +58 -11
  202. package/src/scripts/bench_hook_latency.ts +172 -41
  203. package/src/scripts/build_mcp_catalog.ts +12 -1
  204. package/src/scripts/check_always_budget.ts +122 -11
  205. package/src/scripts/check_augment_description_cap.ts +24 -3
  206. package/src/scripts/check_ci_strict_superset.ts +150 -0
  207. package/src/scripts/check_cluster_patterns.ts +100 -0
  208. package/src/scripts/check_consumer_scope_flip.ts +26 -4
  209. package/src/scripts/check_evaluator_budgets.ts +198 -19
  210. package/src/scripts/check_gate_coverage.ts +337 -1
  211. package/src/scripts/check_generator_output_coverage.ts +2 -1
  212. package/src/scripts/check_iron_law_prominence.ts +1 -1
  213. package/src/scripts/check_kernel_rule_bundle.ts +1 -1
  214. package/src/scripts/check_no_new_legacy_path.ts +167 -3
  215. package/src/scripts/check_pack_size.ts +18 -4
  216. package/src/scripts/check_portability.ts +37 -7
  217. package/src/scripts/check_references.ts +19 -3
  218. package/src/scripts/check_release_pr_shape.ts +13 -0
  219. package/src/scripts/check_token_regression.ts +9 -2
  220. package/src/scripts/condense.ts +155 -12
  221. package/src/scripts/cost/budget.mjs +63 -2
  222. package/src/scripts/evaluator_umbrella.sh +34 -1
  223. package/src/scripts/generate_capability_matrix.ts +8 -0
  224. package/src/scripts/generate_router_coverage_from_matrix.ts +155 -0
  225. package/src/scripts/hook_manifest.yaml +17 -3
  226. package/src/scripts/hooks/block_config_weakening.ts +337 -0
  227. package/src/scripts/hooks/concern_registry.ts +2 -0
  228. package/src/scripts/hooks/probe_throttle.ts +75 -0
  229. package/src/scripts/install-hooks.sh +24 -2
  230. package/src/scripts/install.ts +2 -2
  231. package/src/scripts/lint_agents_md.ts +9 -3
  232. package/src/scripts/lint_archived_skills.ts +1 -1
  233. package/src/scripts/lint_artefact_frontmatter.ts +185 -37
  234. package/src/scripts/lint_command_routing.ts +21 -52
  235. package/src/scripts/lint_command_verbs.ts +47 -28
  236. package/src/scripts/lint_context_spine_usage.ts +38 -12
  237. package/src/scripts/lint_framework_leakage.ts +25 -6
  238. package/src/scripts/lint_handoffs.ts +49 -2
  239. package/src/scripts/lint_media_policy_linkage.ts +62 -30
  240. package/src/scripts/lint_namespace.ts +92 -7
  241. package/src/scripts/lint_new_skill_gate.ts +39 -31
  242. package/src/scripts/lint_originality_shingles.ts +7 -1
  243. package/src/scripts/lint_override_kernel_guard.ts +21 -3
  244. package/src/scripts/lint_pack_boundaries.ts +461 -91
  245. package/src/scripts/lint_pack_dependencies.ts +24 -57
  246. package/src/scripts/lint_persona_governance.ts +1 -1
  247. package/src/scripts/lint_role_experiences.ts +34 -5
  248. package/src/scripts/lint_trigger_precision.ts +142 -0
  249. package/src/scripts/mcp_server/consumer_tool_catalog.json +12 -201
  250. package/src/scripts/mcp_server/tools.ts +1 -1
  251. package/src/scripts/prepack-check.mjs +40 -1
  252. package/src/scripts/prepack_router_targets.d.mts +7 -0
  253. package/src/scripts/prepack_router_targets.mjs +93 -0
  254. package/src/scripts/print_required_checks.ts +72 -18
  255. package/src/scripts/profile_staleness_hook.ts +12 -0
  256. package/src/scripts/record_evaluator_measurements.mjs +105 -0
  257. package/src/scripts/recruit_preflight.sh +1 -1
  258. package/src/scripts/release.ts +105 -1
  259. package/src/scripts/router_target_paths.d.mts +4 -0
  260. package/src/scripts/router_target_paths.mjs +69 -0
  261. package/src/scripts/router_telemetry.ts +52 -1
  262. package/src/scripts/routing_doctor.ts +485 -0
  263. package/src/scripts/rule_trigger_eval.ts +403 -0
  264. package/src/scripts/schemas/rule.schema.json +5 -1
  265. package/src/scripts/session_canary_hook.ts +96 -5
  266. package/src/scripts/skill_linter.ts +9 -28
  267. package/src/scripts/smoke/skills.sh +1 -1
  268. package/src/scripts/sweep_dead_scan_roots.ts +356 -10
  269. package/src/scripts/trigger_coverage.ts +13 -2
  270. package/src/scripts/update_counts.ts +1 -1
  271. package/src/scripts/validate_telegraph_carveouts.ts +1 -1
  272. package/src/scripts/wrapper_freshness_hook.ts +14 -0
  273. package/src/server/schemas/settings.ts +19 -5
  274. package/dist/cli-delegate/chunk-TJIAM5FW.js +0 -133
  275. package/dist/ui/assets/index-BpSQt5vm.js +0 -40
  276. 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":
@@ -14514,29 +14514,6 @@ function extractFrontmatterField(frontmatter, pattern) {
14514
14514
  const match = pattern.exec(frontmatter);
14515
14515
  return match ? match[1].trim() : null;
14516
14516
  }
14517
- function _parseTrustLevel(frontmatter) {
14518
- const lines = splitlines(frontmatter);
14519
- let inBlock = false;
14520
- for (const line of lines) {
14521
- if (!inBlock) {
14522
- if (line.startsWith("trust:")) {
14523
- const rhs = line.slice("trust:".length).trim();
14524
- if (rhs === "") {
14525
- inBlock = true;
14526
- }
14527
- }
14528
- continue;
14529
- }
14530
- if (line.startsWith(" level:")) {
14531
- return stripQuotes(line.slice(" level:".length).trim());
14532
- }
14533
- if (line.startsWith(" ")) {
14534
- continue;
14535
- }
14536
- break;
14537
- }
14538
- return null;
14539
- }
14540
14517
  function stripQuotes(s) {
14541
14518
  return s.replace(/^["']/, "").replace(/["']$/, "");
14542
14519
  }
@@ -14639,13 +14616,13 @@ function lint_router_frontmatter(ruleId, frontmatter, ruleType) {
14639
14616
  });
14640
14617
  }
14641
14618
  if (routesTo === null) {
14642
- const trustLevel = _parseTrustLevel(frontmatter);
14643
- if (trustLevel !== "core") {
14619
+ const selfContained = /^self_contained:[ \t]*true[ \t]*$/m.test(frontmatter);
14620
+ if (!selfContained) {
14644
14621
  issues.push(
14645
14622
  new Issue(
14646
- "info",
14623
+ "error",
14647
14624
  "router_routes_to_missing",
14648
- "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"
14649
14626
  )
14650
14627
  );
14651
14628
  }
@@ -20051,7 +20028,8 @@ function build_claude_hook_matrix(manifest_path2) {
20051
20028
  if (!concerns || Array.isArray(concerns) && concerns.length === 0) continue;
20052
20029
  const native = ac_to_native[ac_event];
20053
20030
  if (native === void 0) continue;
20054
- 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}`;
20055
20033
  }
20056
20034
  return matrix;
20057
20035
  }
@@ -21232,8 +21210,8 @@ function lockfile_path(env) {
21232
21210
  }
21233
21211
  return write_target("installed.lock", { env: env ?? null });
21234
21212
  }
21235
- function read_lockfile(path50) {
21236
- const target = path50 ?? lockfile_path();
21213
+ function read_lockfile(path51) {
21214
+ const target = path51 ?? lockfile_path();
21237
21215
  let text;
21238
21216
  try {
21239
21217
  text = fs31.readFileSync(target, { encoding: "utf-8" });
@@ -21443,18 +21421,18 @@ function manifest_path(project_root, env) {
21443
21421
  }
21444
21422
  return fsPath.join(project_root, DEFAULT_MANIFEST_RELATIVE);
21445
21423
  }
21446
- function read_manifest(path50) {
21424
+ function read_manifest(path51) {
21447
21425
  let text;
21448
21426
  try {
21449
- text = require_read_text(path50);
21427
+ text = require_read_text(path51);
21450
21428
  } catch {
21451
21429
  return null;
21452
21430
  }
21453
21431
  const data = _parse_manual(text);
21454
21432
  return _normalise_v2_shape(data);
21455
21433
  }
21456
- function require_read_text(path50) {
21457
- return fs33.readFileSync(path50, { encoding: "utf-8" });
21434
+ function require_read_text(path51) {
21435
+ return fs33.readFileSync(path51, { encoding: "utf-8" });
21458
21436
  }
21459
21437
  function _normalise_v2_shape(data) {
21460
21438
  if (data["tools"] === void 0 || data["tools"] === null) {
@@ -21635,9 +21613,9 @@ function stable_sort(items, key) {
21635
21613
  return a.index - b.index;
21636
21614
  }).map((entry) => entry.item);
21637
21615
  }
21638
- function write_manifest(path50, version, tools, options = {}) {
21616
+ function write_manifest(path51, version, tools, options = {}) {
21639
21617
  const rendered = _render(version, tools, { deploy_roots: options.deploy_roots ?? null });
21640
- return write_atomic(path50, rendered);
21618
+ return write_atomic(path51, rendered);
21641
21619
  }
21642
21620
  function upsert_tool(existing, options) {
21643
21621
  const {
@@ -26426,8 +26404,114 @@ var init_review_gate = __esm({
26426
26404
  }
26427
26405
  });
26428
26406
 
26429
- // 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
26430
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";
26431
26515
  function parseYaml4(text) {
26432
26516
  try {
26433
26517
  const data = YAML4.parse(text, { version: "1.1" });
@@ -26465,7 +26549,7 @@ function rule_in_scope(source_path, scope, pack_scope = null, role_scope = null)
26465
26549
  if (scope === null && pack_scope === null && role_scope === null) {
26466
26550
  return true;
26467
26551
  }
26468
- const [meta] = parseFrontmatter(fs41.readFileSync(source_path, "utf-8"));
26552
+ const [meta] = parseFrontmatter(fs42.readFileSync(source_path, "utf-8"));
26469
26553
  if (meta["type"] === "always" || meta["alwaysApply"] === true) {
26470
26554
  return true;
26471
26555
  }
@@ -26490,31 +26574,40 @@ var init_ruleInScope = __esm({
26490
26574
  });
26491
26575
 
26492
26576
  // src/install/rule_scope.ts
26493
- import * as fs42 from "node:fs";
26494
- import * as path40 from "node:path";
26577
+ import * as fs43 from "node:fs";
26578
+ import * as path41 from "node:path";
26495
26579
  function _list(value) {
26496
26580
  if (Array.isArray(value) && value.length > 0) {
26497
26581
  return value.map((v) => String(v));
26498
26582
  }
26499
26583
  return null;
26500
26584
  }
26501
- function ruleScopeFromSettings(settings) {
26585
+ function ruleScopeFromSettings(settings, packageRoot) {
26502
26586
  const proj = settings["projection"];
26503
26587
  if (typeof proj !== "object" || proj === null || Array.isArray(proj)) {
26504
26588
  return LEGACY_ALL;
26505
26589
  }
26506
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
+ );
26507
26596
  return {
26508
26597
  workspaces: _list(p["rule_workspaces"]),
26509
- packs: _list(p["rule_packs"]),
26598
+ packs,
26510
26599
  roles: _list(p["rule_roles"])
26511
26600
  };
26512
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
+ }
26513
26606
  function ruleFileArrives(sourcePath, scope) {
26514
26607
  if (!sourcePath.endsWith(".md")) {
26515
26608
  return true;
26516
26609
  }
26517
- const basename18 = path40.basename(sourcePath);
26610
+ const basename18 = path41.basename(sourcePath);
26518
26611
  if (COMPAT_ALWAYS_EXCLUDED.includes(basename18)) {
26519
26612
  return false;
26520
26613
  }
@@ -26523,7 +26616,7 @@ function ruleFileArrives(sourcePath, scope) {
26523
26616
  function excludedRuleBasenames(rulesDir, scope) {
26524
26617
  let entries;
26525
26618
  try {
26526
- entries = fs42.readdirSync(rulesDir).sort();
26619
+ entries = fs43.readdirSync(rulesDir).sort();
26527
26620
  } catch {
26528
26621
  return [];
26529
26622
  }
@@ -26532,9 +26625,9 @@ function excludedRuleBasenames(rulesDir, scope) {
26532
26625
  if (!name.endsWith(".md")) {
26533
26626
  continue;
26534
26627
  }
26535
- const full = path40.join(rulesDir, name);
26628
+ const full = path41.join(rulesDir, name);
26536
26629
  try {
26537
- if (!fs42.statSync(full).isFile()) {
26630
+ if (!fs43.statSync(full).isFile()) {
26538
26631
  continue;
26539
26632
  }
26540
26633
  } catch {
@@ -26550,6 +26643,7 @@ var COMPAT_ALWAYS_EXCLUDED, LEGACY_ALL;
26550
26643
  var init_rule_scope = __esm({
26551
26644
  "src/install/rule_scope.ts"() {
26552
26645
  "use strict";
26646
+ init_scoped_projection();
26553
26647
  init_ruleInScope();
26554
26648
  COMPAT_ALWAYS_EXCLUDED = ["source-of-truth.md"];
26555
26649
  LEGACY_ALL = { workspaces: null, packs: null };
@@ -26624,21 +26718,21 @@ __export(cmd_doctor_exports, {
26624
26718
  main: () => main15
26625
26719
  });
26626
26720
  import * as crypto6 from "node:crypto";
26627
- import * as fs43 from "node:fs";
26721
+ import * as fs44 from "node:fs";
26628
26722
  import * as os11 from "node:os";
26629
- import * as path41 from "node:path";
26723
+ import * as path42 from "node:path";
26630
26724
  import process15 from "node:process";
26631
26725
  import { fileURLToPath as fileURLToPath24, pathToFileURL as pathToFileURL15 } from "node:url";
26632
26726
  function expanduser5(p) {
26633
26727
  if (p === "~") return os11.homedir();
26634
26728
  if (p.startsWith("~/") || p.startsWith("~\\")) {
26635
- return path41.join(os11.homedir(), p.slice(2));
26729
+ return path42.join(os11.homedir(), p.slice(2));
26636
26730
  }
26637
26731
  return p;
26638
26732
  }
26639
26733
  function pathExists(p) {
26640
26734
  try {
26641
- fs43.statSync(p);
26735
+ fs44.statSync(p);
26642
26736
  return true;
26643
26737
  } catch {
26644
26738
  return false;
@@ -26646,27 +26740,27 @@ function pathExists(p) {
26646
26740
  }
26647
26741
  function isFile3(p) {
26648
26742
  try {
26649
- return fs43.statSync(p).isFile();
26743
+ return fs44.statSync(p).isFile();
26650
26744
  } catch {
26651
26745
  return false;
26652
26746
  }
26653
26747
  }
26654
26748
  function isDir2(p) {
26655
26749
  try {
26656
- return fs43.statSync(p).isDirectory();
26750
+ return fs44.statSync(p).isDirectory();
26657
26751
  } catch {
26658
26752
  return false;
26659
26753
  }
26660
26754
  }
26661
26755
  function resolvePath(p) {
26662
26756
  try {
26663
- return fs43.realpathSync(path41.resolve(p));
26757
+ return fs44.realpathSync(path42.resolve(p));
26664
26758
  } catch {
26665
- return path41.resolve(p);
26759
+ return path42.resolve(p);
26666
26760
  }
26667
26761
  }
26668
26762
  function readText2(p) {
26669
- return fs43.readFileSync(p, "utf-8");
26763
+ return fs44.readFileSync(p, "utf-8");
26670
26764
  }
26671
26765
  function _jsonStrAscii3(s) {
26672
26766
  let out = '"';
@@ -26753,7 +26847,7 @@ ${closePad}}`;
26753
26847
  function _jsonDumpsIndentAscii(value, indent) {
26754
26848
  return _dumpIndentAscii(value, indent, 0);
26755
26849
  }
26756
- function yamlSafeLoad(text) {
26850
+ function yamlSafeLoad2(text) {
26757
26851
  if (YAML5 === void 0 || YAML5 === null) {
26758
26852
  return null;
26759
26853
  }
@@ -26773,7 +26867,7 @@ function _resolve_project_root(arg) {
26773
26867
  return resolve_project_root(arg);
26774
26868
  }
26775
26869
  function _detect_install_mode(project_root) {
26776
- const marker = path41.join(project_root, _INSTALL_MODE_MARKER_REL);
26870
+ const marker = path42.join(project_root, _INSTALL_MODE_MARKER_REL);
26777
26871
  if (isFile3(marker)) {
26778
26872
  let value;
26779
26873
  try {
@@ -26785,9 +26879,9 @@ function _detect_install_mode(project_root) {
26785
26879
  return [value, "marker-file"];
26786
26880
  }
26787
26881
  }
26788
- const has_agents_md = pathExists(path41.join(project_root, "AGENTS.md"));
26882
+ const has_agents_md = pathExists(path42.join(project_root, "AGENTS.md"));
26789
26883
  const has_copilot = pathExists(
26790
- path41.join(project_root, ".github", "copilot-instructions.md")
26884
+ path42.join(project_root, ".github", "copilot-instructions.md")
26791
26885
  );
26792
26886
  if (has_agents_md && has_copilot) {
26793
26887
  return ["full", "heuristic"];
@@ -26807,7 +26901,7 @@ function _settings_layer_chain(project_root) {
26807
26901
  return layers;
26808
26902
  }
26809
26903
  function _detect_wrapper(project_root) {
26810
- const wrapper = path41.join(project_root, "agent-config");
26904
+ const wrapper = path42.join(project_root, "agent-config");
26811
26905
  if (!pathExists(wrapper)) {
26812
26906
  return { path: String(wrapper), exists: false, embedded_root: null };
26813
26907
  }
@@ -26874,21 +26968,21 @@ function _emit_context_text(ctx) {
26874
26968
  }
26875
26969
  function _resolve_path(project_root, raw) {
26876
26970
  let p = expanduser5(raw);
26877
- if (!path41.isAbsolute(p)) {
26878
- p = path41.join(project_root, p);
26971
+ if (!path42.isAbsolute(p)) {
26972
+ p = path42.join(project_root, p);
26879
26973
  }
26880
26974
  return p;
26881
26975
  }
26882
26976
  function _sha256(p) {
26883
26977
  try {
26884
- const data = fs43.readFileSync(p);
26978
+ const data = fs44.readFileSync(p);
26885
26979
  return crypto6.createHash("sha256").update(data).digest("hex");
26886
26980
  } catch {
26887
26981
  return null;
26888
26982
  }
26889
26983
  }
26890
26984
  function _read_inline_package_tag(p) {
26891
- if (path41.extname(p) !== ".md") {
26985
+ if (path42.extname(p) !== ".md") {
26892
26986
  return NO_FRONTMATTER;
26893
26987
  }
26894
26988
  let text;
@@ -27017,13 +27111,13 @@ function rglob2(root) {
27017
27111
  const walk = (dir) => {
27018
27112
  let entries;
27019
27113
  try {
27020
- entries = fs43.readdirSync(dir, { withFileTypes: true });
27114
+ entries = fs44.readdirSync(dir, { withFileTypes: true });
27021
27115
  } catch {
27022
27116
  return;
27023
27117
  }
27024
27118
  entries.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
27025
27119
  for (const ent of entries) {
27026
- const full = path41.join(dir, ent.name);
27120
+ const full = path42.join(dir, ent.name);
27027
27121
  out.push(full);
27028
27122
  let dirLike = ent.isDirectory();
27029
27123
  if (ent.isSymbolicLink()) {
@@ -27098,19 +27192,19 @@ function _foreign_records(project_root, foreign) {
27098
27192
  return out;
27099
27193
  }
27100
27194
  function relativeTo(p, base) {
27101
- const rel = path41.relative(base, p);
27195
+ const rel = path42.relative(base, p);
27102
27196
  if (rel === "") return rel;
27103
- if (rel.startsWith("..") || path41.isAbsolute(rel)) {
27197
+ if (rel.startsWith("..") || path42.isAbsolute(rel)) {
27104
27198
  return null;
27105
27199
  }
27106
27200
  return rel;
27107
27201
  }
27108
27202
  function _is_global_only_consumer(project_root) {
27109
- 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"));
27110
27204
  }
27111
27205
  function _check_scope(project_root) {
27112
27206
  for (const marker of ["pnpm-workspace.yaml", "lerna.json"]) {
27113
- if (pathExists(path41.join(project_root, marker))) {
27207
+ if (pathExists(path42.join(project_root, marker))) {
27114
27208
  return {
27115
27209
  id: "scope",
27116
27210
  status: "warn",
@@ -27119,7 +27213,7 @@ function _check_scope(project_root) {
27119
27213
  };
27120
27214
  }
27121
27215
  }
27122
- const pkg = path41.join(project_root, "package.json");
27216
+ const pkg = path42.join(project_root, "package.json");
27123
27217
  if (pathExists(pkg)) {
27124
27218
  try {
27125
27219
  const data = JSON.parse(readText2(pkg));
@@ -27142,23 +27236,23 @@ function _check_scope(project_root) {
27142
27236
  };
27143
27237
  }
27144
27238
  function _git_config_path(project_root) {
27145
- const gd = path41.join(project_root, ".git");
27239
+ const gd = path42.join(project_root, ".git");
27146
27240
  try {
27147
- const st = fs43.statSync(gd);
27241
+ const st = fs44.statSync(gd);
27148
27242
  if (st.isDirectory()) {
27149
- return path41.join(gd, "config");
27243
+ return path42.join(gd, "config");
27150
27244
  }
27151
27245
  const m = readText2(gd).match(/^gitdir:\s*(.+)\s*$/m);
27152
27246
  if (m === null) {
27153
27247
  return null;
27154
27248
  }
27155
- const gdPath = path41.resolve(project_root, m[1].trim());
27156
- const commondirFile = path41.join(gdPath, "commondir");
27249
+ const gdPath = path42.resolve(project_root, m[1].trim());
27250
+ const commondirFile = path42.join(gdPath, "commondir");
27157
27251
  if (pathExists(commondirFile)) {
27158
- const common = path41.resolve(gdPath, readText2(commondirFile).trim());
27159
- return path41.join(common, "config");
27252
+ const common = path42.resolve(gdPath, readText2(commondirFile).trim());
27253
+ return path42.join(common, "config");
27160
27254
  }
27161
- return path41.join(gdPath, "config");
27255
+ return path42.join(gdPath, "config");
27162
27256
  } catch {
27163
27257
  return null;
27164
27258
  }
@@ -27191,7 +27285,7 @@ function _check_git_identity(project_root) {
27191
27285
  }
27192
27286
  let ident = _parse_git_user(readText2(cfgPath));
27193
27287
  if (ident.name === null && ident.email === null) {
27194
- const globalCfg = path41.join(os11.homedir(), ".gitconfig");
27288
+ const globalCfg = path42.join(os11.homedir(), ".gitconfig");
27195
27289
  if (pathExists(globalCfg)) {
27196
27290
  ident = _parse_git_user(readText2(globalCfg));
27197
27291
  }
@@ -27252,7 +27346,7 @@ function _package_root() {
27252
27346
  }
27253
27347
  function _current_package_version() {
27254
27348
  try {
27255
- const data = JSON.parse(readText2(path41.join(_package_root(), "package.json")));
27349
+ const data = JSON.parse(readText2(path42.join(_package_root(), "package.json")));
27256
27350
  const v = data["version"];
27257
27351
  if (typeof v === "string" && v.trim()) {
27258
27352
  return v.trim();
@@ -27296,7 +27390,7 @@ function _check_lockfile_freshness(manifest) {
27296
27390
  };
27297
27391
  }
27298
27392
  function shutilWhich(name) {
27299
- if (path41.dirname(name) !== "." && (name.includes("/") || name.includes("\\"))) {
27393
+ if (path42.dirname(name) !== "." && (name.includes("/") || name.includes("\\"))) {
27300
27394
  return isExecutableFile(name) ? name : null;
27301
27395
  }
27302
27396
  const pathEnv = process15.env["PATH"] || "";
@@ -27309,12 +27403,12 @@ function shutilWhich(name) {
27309
27403
  if (seenDirs.has(d)) continue;
27310
27404
  seenDirs.add(d);
27311
27405
  for (const ext of exts) {
27312
- 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));
27313
27407
  if (isExecutableFile(candidate)) {
27314
27408
  return candidate;
27315
27409
  }
27316
27410
  if (ext !== "") {
27317
- const upper = path41.join(d, name + ext);
27411
+ const upper = path42.join(d, name + ext);
27318
27412
  if (isExecutableFile(upper)) return upper;
27319
27413
  }
27320
27414
  }
@@ -27323,10 +27417,10 @@ function shutilWhich(name) {
27323
27417
  }
27324
27418
  function isExecutableFile(p) {
27325
27419
  try {
27326
- const st = fs43.statSync(p);
27420
+ const st = fs44.statSync(p);
27327
27421
  if (!st.isFile()) return false;
27328
27422
  if (process15.platform === "win32") return true;
27329
- fs43.accessSync(p, fs43.constants.X_OK);
27423
+ fs44.accessSync(p, fs44.constants.X_OK);
27330
27424
  return true;
27331
27425
  } catch {
27332
27426
  return false;
@@ -27390,7 +27484,7 @@ function _check_claude_plugin() {
27390
27484
  remedy: ""
27391
27485
  };
27392
27486
  }
27393
- const projection = path41.join(os11.homedir(), ".claude", "skills");
27487
+ const projection = path42.join(os11.homedir(), ".claude", "skills");
27394
27488
  const projection_present = isDir2(projection);
27395
27489
  if (projection_present) {
27396
27490
  return {
@@ -27427,8 +27521,8 @@ function _check_claude_command_wrappers() {
27427
27521
  remedy: ""
27428
27522
  };
27429
27523
  }
27430
- const anchor = path41.join(os11.homedir(), ".claude");
27431
- const commands_dir = path41.join(anchor, "commands");
27524
+ const anchor = path42.join(os11.homedir(), ".claude");
27525
+ const commands_dir = path42.join(anchor, "commands");
27432
27526
  if (!isDir2(commands_dir)) {
27433
27527
  return {
27434
27528
  id: "claude-command-wrappers",
@@ -27437,8 +27531,8 @@ function _check_claude_command_wrappers() {
27437
27531
  remedy: ""
27438
27532
  };
27439
27533
  }
27440
- const flat_probe = fs43.existsSync(path41.join(commands_dir, "commit.md"));
27441
- 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"));
27442
27536
  if (wrapper_probe) {
27443
27537
  return {
27444
27538
  id: "claude-command-wrappers",
@@ -27463,7 +27557,7 @@ function _check_claude_command_wrappers() {
27463
27557
  };
27464
27558
  }
27465
27559
  function _check_surface_state() {
27466
- 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");
27467
27561
  if (!isFile3(matrix_path)) {
27468
27562
  return {
27469
27563
  id: "surface-state",
@@ -27487,7 +27581,7 @@ function _check_surface_state() {
27487
27581
  remedy: "agent-config upgrade (reinstalls the package data files)"
27488
27582
  };
27489
27583
  }
27490
- 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);
27491
27585
  const violations = [];
27492
27586
  const remedies = [];
27493
27587
  let checked = 0;
@@ -27529,7 +27623,7 @@ function _check_surface_state() {
27529
27623
  }
27530
27624
  function pathExistsAny(p) {
27531
27625
  try {
27532
- fs43.statSync(p);
27626
+ fs44.statSync(p);
27533
27627
  return true;
27534
27628
  } catch {
27535
27629
  return false;
@@ -27545,13 +27639,13 @@ function _check_hook_wiring() {
27545
27639
  remedy: ""
27546
27640
  };
27547
27641
  }
27548
- const settings_path = path41.join(os11.homedir(), ".claude", "settings.json");
27642
+ const settings_path = path42.join(os11.homedir(), ".claude", "settings.json");
27549
27643
  let missing;
27550
27644
  try {
27551
27645
  const matrix = build_claude_hook_matrix(
27552
- path41.join(_package_root(), "src", "scripts", "hook_manifest.yaml")
27646
+ path42.join(_package_root(), "src", "scripts", "hook_manifest.yaml")
27553
27647
  );
27554
- 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")) : {};
27555
27649
  const hooks = (settings["hooks"] ?? {}) || {};
27556
27650
  missing = Object.keys(matrix).filter((ev) => {
27557
27651
  const groups = hooks[ev];
@@ -27626,7 +27720,7 @@ function _check_mcp_mode(project_root) {
27626
27720
  ];
27627
27721
  const found = [];
27628
27722
  for (const [rel, label] of candidates) {
27629
- const p = path41.join(project_root, rel);
27723
+ const p = path42.join(project_root, rel);
27630
27724
  if (!pathExists(p)) {
27631
27725
  continue;
27632
27726
  }
@@ -27658,7 +27752,7 @@ function _check_mcp_mode(project_root) {
27658
27752
  };
27659
27753
  }
27660
27754
  function _check_offline_readiness() {
27661
- const script = path41.join(_package_root(), "src", "scripts", "hermetic-install.sh");
27755
+ const script = path42.join(_package_root(), "src", "scripts", "hermetic-install.sh");
27662
27756
  if (!pathExists(script)) {
27663
27757
  return {
27664
27758
  id: "offline-readiness",
@@ -27716,7 +27810,7 @@ function _check_stale_orphans() {
27716
27810
  (a, b) => a < b ? -1 : a > b ? 1 : 0
27717
27811
  );
27718
27812
  for (const root_name of ownedSorted) {
27719
- const root = path41.join(anchor, root_name);
27813
+ const root = path42.join(anchor, root_name);
27720
27814
  if (!isDir2(root)) {
27721
27815
  continue;
27722
27816
  }
@@ -27731,7 +27825,7 @@ function _check_stale_orphans() {
27731
27825
  if (rel === null) {
27732
27826
  continue;
27733
27827
  }
27734
- const relPosix2 = rel.split(path41.sep).join("/");
27828
+ const relPosix2 = rel.split(path42.sep).join("/");
27735
27829
  if (recorded_set.has(relPosix2)) {
27736
27830
  continue;
27737
27831
  }
@@ -27773,21 +27867,21 @@ function _check_rule_scope_drift(project_root) {
27773
27867
  let scope = LEGACY_ALL;
27774
27868
  const settings_file = project_settings_path(project_root);
27775
27869
  if (isFile3(settings_file)) {
27776
- const loaded = yamlSafeLoad(readText0(settings_file));
27870
+ const loaded = yamlSafeLoad2(readText0(settings_file));
27777
27871
  const raw = typeof loaded === "object" && loaded !== null && !Array.isArray(loaded) ? loaded : {};
27778
27872
  scope = ruleScopeFromSettings(raw);
27779
27873
  }
27780
27874
  let rules_dir = null;
27781
27875
  let found = 0;
27782
27876
  for (const rel of _RULE_PROJECTION_DIRS) {
27783
- const cand = path41.join(project_root, rel);
27877
+ const cand = path42.join(project_root, rel);
27784
27878
  if (!isDir2(cand)) {
27785
27879
  continue;
27786
27880
  }
27787
27881
  let count = 0;
27788
27882
  try {
27789
- for (const name of fs43.readdirSync(cand)) {
27790
- 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))) {
27791
27885
  count += 1;
27792
27886
  }
27793
27887
  }
@@ -27841,14 +27935,14 @@ function _check_rule_scope_drift(project_root) {
27841
27935
  };
27842
27936
  }
27843
27937
  function _check_duplicate_scope_rules(project_root, userRulesDirOverride) {
27844
- const user_rules_dir = userRulesDirOverride ?? path41.join(os11.homedir(), ".claude", "rules");
27938
+ const user_rules_dir = userRulesDirOverride ?? path42.join(os11.homedir(), ".claude", "rules");
27845
27939
  let project_rules_dir = null;
27846
27940
  if (_is_source_repo(project_root)) {
27847
- const cand = path41.join(project_root, "dist", "agent-src", "rules");
27941
+ const cand = path42.join(project_root, "dist", "agent-src", "rules");
27848
27942
  if (isDir2(cand)) project_rules_dir = cand;
27849
27943
  } else {
27850
27944
  for (const rel of _RULE_PROJECTION_DIRS) {
27851
- const cand = path41.join(project_root, rel);
27945
+ const cand = path42.join(project_root, rel);
27852
27946
  if (isDir2(cand)) {
27853
27947
  project_rules_dir = cand;
27854
27948
  break;
@@ -27917,7 +28011,7 @@ function _check_mcp_beta_readiness(project_root) {
27917
28011
  }
27918
28012
  const pending = [];
27919
28013
  for (const [gate_id, rel] of MCP_BETA_GATES) {
27920
- if (!pathExists(path41.join(project_root, rel))) {
28014
+ if (!pathExists(path42.join(project_root, rel))) {
27921
28015
  pending.push(`${gate_id} (${rel})`);
27922
28016
  }
27923
28017
  }
@@ -27938,11 +28032,11 @@ function _check_mcp_beta_readiness(project_root) {
27938
28032
  }
27939
28033
  function _check_tier_usage_readiness(project_root) {
27940
28034
  const settings_file = project_settings_path(project_root);
27941
- let log_path = path41.join(project_root, ".agent-tier-usage.jsonl");
28035
+ let log_path = path42.join(project_root, ".agent-tier-usage.jsonl");
27942
28036
  let enabled = false;
27943
28037
  if (isFile3(settings_file)) {
27944
28038
  let raw;
27945
- const loaded = yamlSafeLoad(readText0(settings_file));
28039
+ const loaded = yamlSafeLoad2(readText0(settings_file));
27946
28040
  if (loaded === null) {
27947
28041
  raw = null;
27948
28042
  } else {
@@ -27957,7 +28051,7 @@ function _check_tier_usage_readiness(project_root) {
27957
28051
  const outputRaw = tu["output"];
27958
28052
  const output = typeof outputRaw === "object" && outputRaw !== null && !Array.isArray(outputRaw) ? outputRaw : {};
27959
28053
  if (typeof output["path"] === "string" && output["path"].trim()) {
27960
- log_path = path41.join(project_root, output["path"].trim());
28054
+ log_path = path42.join(project_root, output["path"].trim());
27961
28055
  }
27962
28056
  const val = tu["enabled"];
27963
28057
  if (typeof val === "boolean") {
@@ -27982,7 +28076,7 @@ function _check_tier_usage_readiness(project_root) {
27982
28076
  return {
27983
28077
  id: "tier-usage-readiness",
27984
28078
  status: "warn",
27985
- 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`,
27986
28080
  remedy: "run any tracked command to seed the log; the dispatcher writes one record per invocation"
27987
28081
  };
27988
28082
  }
@@ -27997,7 +28091,7 @@ function _check_tier_usage_readiness(project_root) {
27997
28091
  return {
27998
28092
  id: "tier-usage-readiness",
27999
28093
  status: "fail",
28000
- message: `cannot read ${path41.basename(log_path)}: ${osErrorStr2(exc)}`,
28094
+ message: `cannot read ${path42.basename(log_path)}: ${osErrorStr2(exc)}`,
28001
28095
  remedy: "fix permissions on the tier-usage log"
28002
28096
  };
28003
28097
  }
@@ -28028,7 +28122,7 @@ function _check_tier_usage_readiness(project_root) {
28028
28122
  return {
28029
28123
  id: "tier-usage-readiness",
28030
28124
  status: "fail",
28031
- 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`,
28032
28126
  remedy: "inspect the log; the dispatcher is writing records the contract forbids (paths, argv, message bodies)"
28033
28127
  };
28034
28128
  }
@@ -28036,19 +28130,19 @@ function _check_tier_usage_readiness(project_root) {
28036
28130
  return {
28037
28131
  id: "tier-usage-readiness",
28038
28132
  status: "warn",
28039
- 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`,
28040
28134
  remedy: "run any tracked command to seed the log"
28041
28135
  };
28042
28136
  }
28043
28137
  return {
28044
28138
  id: "tier-usage-readiness",
28045
28139
  status: "ok",
28046
- 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`,
28047
28141
  remedy: ""
28048
28142
  };
28049
28143
  }
28050
28144
  function readText0(p) {
28051
- return fs43.readFileSync(p, "utf-8");
28145
+ return fs44.readFileSync(p, "utf-8");
28052
28146
  }
28053
28147
  function osErrorStr2(exc) {
28054
28148
  if (exc && typeof exc === "object" && "message" in exc) {
@@ -28220,7 +28314,7 @@ function _epoch_seconds(value) {
28220
28314
  function _codex_auth_expiry(auth_path) {
28221
28315
  let data;
28222
28316
  try {
28223
- data = JSON.parse(fs43.readFileSync(auth_path, "utf-8"));
28317
+ data = JSON.parse(fs44.readFileSync(auth_path, "utf-8"));
28224
28318
  } catch {
28225
28319
  return null;
28226
28320
  }
@@ -28248,7 +28342,7 @@ function _read_ai_team_block(project_root) {
28248
28342
  } catch {
28249
28343
  return {};
28250
28344
  }
28251
- const loaded = yamlSafeLoad(content);
28345
+ const loaded = yamlSafeLoad2(content);
28252
28346
  if (typeof loaded !== "object" || loaded === null || Array.isArray(loaded)) return {};
28253
28347
  const raw = loaded["ai_team"];
28254
28348
  if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return {};
@@ -28382,7 +28476,7 @@ function _check_team(project_root) {
28382
28476
  if (binary_resolved === null) {
28383
28477
  remedies.push("install the codex CLI: `npm install -g @openai/codex`");
28384
28478
  }
28385
- const auth_path = path41.join(_codex_home(), "auth.json");
28479
+ const auth_path = path42.join(_codex_home(), "auth.json");
28386
28480
  const authed = pathExists(auth_path);
28387
28481
  let auth_str;
28388
28482
  if (!authed) {
@@ -28462,7 +28556,7 @@ function _check_unsupported_combos(manifest) {
28462
28556
  };
28463
28557
  }
28464
28558
  function _wizard_state_path() {
28465
- return path41.join(event4u_root(), "state", "wizard-state.json");
28559
+ return path42.join(event4u_root(), "state", "wizard-state.json");
28466
28560
  }
28467
28561
  function _check_wizard_state() {
28468
28562
  const state_pth = _wizard_state_path();
@@ -28542,7 +28636,7 @@ function _check_wizard_state() {
28542
28636
  };
28543
28637
  }
28544
28638
  function _check_settings_review_pending() {
28545
- const delta_pth = path41.join(event4u_root(), "state", "settings-delta.json");
28639
+ const delta_pth = path42.join(event4u_root(), "state", "settings-delta.json");
28546
28640
  if (!pathExists(delta_pth)) {
28547
28641
  return {
28548
28642
  id: "settings-review-pending",
@@ -28568,7 +28662,7 @@ function _check_settings_review_pending() {
28568
28662
  }
28569
28663
  function _check_memory_merge_union(project_root) {
28570
28664
  const remedy = "run: npx tsx src/scripts/sync_gitattributes.ts (or `agent-config refresh --project`)";
28571
- const target = path41.join(project_root, DEFAULT_GITATTRIBUTES);
28665
+ const target = path42.join(project_root, DEFAULT_GITATTRIBUTES);
28572
28666
  if (!pathExists(target)) {
28573
28667
  return {
28574
28668
  id: "memory-merge-union",
@@ -29035,7 +29129,7 @@ function _run_repair(opts) {
29035
29129
  };
29036
29130
  if (exists3) {
29037
29131
  try {
29038
- fs43.unlinkSync(state_pth);
29132
+ fs44.unlinkSync(state_pth);
29039
29133
  } catch (exc) {
29040
29134
  payload["action"] = "error";
29041
29135
  payload["error"] = osErrorStr2(exc);
@@ -29130,13 +29224,13 @@ function _isCliEntry15() {
29130
29224
  if (process15.argv[1] === void 0) {
29131
29225
  return false;
29132
29226
  }
29133
- const argvUrl = pathToFileURL15(path41.resolve(process15.argv[1])).href;
29227
+ const argvUrl = pathToFileURL15(path42.resolve(process15.argv[1])).href;
29134
29228
  if (import.meta.url === argvUrl) {
29135
29229
  return true;
29136
29230
  }
29137
29231
  try {
29138
- const here = fs43.realpathSync(fileURLToPath24(import.meta.url));
29139
- 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]));
29140
29234
  return here === argv;
29141
29235
  } catch {
29142
29236
  return false;
@@ -29292,12 +29386,12 @@ var init_cmd_doctor = __esm({
29292
29386
  });
29293
29387
 
29294
29388
  // src/install/txlog.ts
29295
- 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";
29296
29390
  function readRecentEntries(logPath) {
29297
29391
  if (!existsSync19(logPath)) {
29298
29392
  return [];
29299
29393
  }
29300
- const raw = readFileSync37(logPath, "utf8");
29394
+ const raw = readFileSync38(logPath, "utf8");
29301
29395
  const lines = raw.split("\n").filter((l) => l.length > 0);
29302
29396
  const tail = lines.slice(-RECOVERY_DEPTH_CAP);
29303
29397
  const out = [];
@@ -29332,21 +29426,21 @@ var init_txlog = __esm({
29332
29426
  });
29333
29427
 
29334
29428
  // src/install/detect.ts
29335
- import { existsSync as existsSync20, readFileSync as readFileSync38, readdirSync as readdirSync23, statSync as statSync28 } from "node:fs";
29336
- 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";
29337
29431
  function detectToolPresence(root) {
29338
29432
  return {
29339
- augment: isDir3(join39(root, ".augment")),
29340
- claude: isDir3(join39(root, ".claude")),
29341
- cursor: isDir3(join39(root, ".cursor")),
29342
- cline: isDir3(join39(root, ".clinerules")),
29343
- windsurf: isDir3(join39(root, ".windsurf")) || existsSync20(join39(root, ".windsurfrules")),
29344
- 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"))
29345
29439
  };
29346
29440
  }
29347
- function isDir3(path50) {
29441
+ function isDir3(path51) {
29348
29442
  try {
29349
- return statSync28(path50).isDirectory();
29443
+ return statSync28(path51).isDirectory();
29350
29444
  } catch {
29351
29445
  return false;
29352
29446
  }
@@ -29357,6 +29451,37 @@ var init_detect = __esm({
29357
29451
  }
29358
29452
  });
29359
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
+
29360
29485
  // src/scripts/_cli/cmd_conformance.ts
29361
29486
  var cmd_conformance_exports = {};
29362
29487
  __export(cmd_conformance_exports, {
@@ -29377,9 +29502,9 @@ __export(cmd_conformance_exports, {
29377
29502
  routeTargetPaths: () => routeTargetPaths,
29378
29503
  runConformanceChecks: () => runConformanceChecks
29379
29504
  });
29380
- import * as fs44 from "node:fs";
29505
+ import * as fs45 from "node:fs";
29381
29506
  import * as os12 from "node:os";
29382
- import * as path42 from "node:path";
29507
+ import * as path43 from "node:path";
29383
29508
  import process16 from "node:process";
29384
29509
  import { spawnSync as spawnSync9 } from "node:child_process";
29385
29510
  import { fileURLToPath as fileURLToPath25, pathToFileURL as pathToFileURL16 } from "node:url";
@@ -29396,17 +29521,17 @@ function conformanceLogPath() {
29396
29521
  if (override && override.trim().length > 0) {
29397
29522
  return override;
29398
29523
  }
29399
- return path42.join(os12.homedir(), ".event4u", "agent-config", "conformance-log.jsonl");
29524
+ return path43.join(os12.homedir(), ".event4u", "agent-config", "conformance-log.jsonl");
29400
29525
  }
29401
29526
  function installLogPath() {
29402
29527
  const override = process16.env["AGENT_CONFIG_INSTALL_LOG"];
29403
29528
  if (override && override.trim().length > 0) {
29404
29529
  return override;
29405
29530
  }
29406
- return path42.join(os12.homedir(), ".event4u", "agent-config", "install-log.jsonl");
29531
+ return path43.join(os12.homedir(), ".event4u", "agent-config", "install-log.jsonl");
29407
29532
  }
29408
29533
  function _check_txlog_clean(logPath = installLogPath()) {
29409
- if (!fs44.existsSync(logPath)) {
29534
+ if (!fs45.existsSync(logPath)) {
29410
29535
  return {
29411
29536
  id: "txlog-clean",
29412
29537
  status: "ok",
@@ -29440,30 +29565,11 @@ function _check_txlog_clean(logPath = installLogPath()) {
29440
29565
  };
29441
29566
  }
29442
29567
  function routeTargetPaths(target) {
29443
- const sep14 = target.indexOf(":");
29444
- if (sep14 <= 0) return [];
29445
- const kind = target.slice(0, sep14);
29446
- const id = target.slice(sep14 + 1);
29447
- if (!id) return [];
29448
- switch (kind) {
29449
- case "skill":
29450
- return [path42.join("dist", "agent-src", "skills", id, "SKILL.md")];
29451
- case "command":
29452
- return [path42.join("dist", "agent-src", "commands", `${id}.md`)];
29453
- case "guideline":
29454
- return [path42.join("docs", "guidelines", `${id}.md`)];
29455
- case "contract":
29456
- return [
29457
- path42.join("docs", "contracts", `${id}.md`),
29458
- path42.join("dist", "agent-src", "contexts", "contracts", `${id}.md`)
29459
- ];
29460
- default:
29461
- return [];
29462
- }
29568
+ return routeTargetPathsPosix(target).map((rel) => path43.join(...rel.split("/")));
29463
29569
  }
29464
29570
  function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
29465
- const routerPath = path42.join(packageRoot, "dist", "router.json");
29466
- if (!fs44.existsSync(routerPath)) {
29571
+ const routerPath = path43.join(packageRoot, "dist", "router.json");
29572
+ if (!fs45.existsSync(routerPath)) {
29467
29573
  return {
29468
29574
  id: "router-pointers",
29469
29575
  status: "fail",
@@ -29473,7 +29579,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
29473
29579
  }
29474
29580
  let router;
29475
29581
  try {
29476
- router = JSON.parse(fs44.readFileSync(routerPath, "utf8"));
29582
+ router = JSON.parse(fs45.readFileSync(routerPath, "utf8"));
29477
29583
  } catch (exc) {
29478
29584
  return {
29479
29585
  id: "router-pointers",
@@ -29482,13 +29588,13 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
29482
29588
  remedy: "reinstall the package \u2014 dist/router.json is corrupt"
29483
29589
  };
29484
29590
  }
29485
- const rulesDir = path42.join(packageRoot, "dist", "agent-src", "rules");
29591
+ const rulesDir = path43.join(packageRoot, "dist", "agent-src", "rules");
29486
29592
  const broken = [];
29487
29593
  let ids = 0;
29488
29594
  let targets = 0;
29489
29595
  for (const kernelId of router["kernel"] ?? []) {
29490
29596
  ids += 1;
29491
- if (!fs44.existsSync(path42.join(rulesDir, `${kernelId}.md`))) {
29597
+ if (!fs45.existsSync(path43.join(rulesDir, `${kernelId}.md`))) {
29492
29598
  broken.push(`kernel:${kernelId} \u2192 rules/${kernelId}.md missing`);
29493
29599
  }
29494
29600
  }
@@ -29496,7 +29602,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
29496
29602
  for (const entry of router[tier] ?? []) {
29497
29603
  const ruleId = String(entry["id"] ?? "");
29498
29604
  ids += 1;
29499
- if (!fs44.existsSync(path42.join(rulesDir, `${ruleId}.md`))) {
29605
+ if (!fs45.existsSync(path43.join(rulesDir, `${ruleId}.md`))) {
29500
29606
  broken.push(`${tier}:${ruleId} \u2192 rules/${ruleId}.md missing`);
29501
29607
  }
29502
29608
  for (const target of entry["routes_to"] ?? []) {
@@ -29506,7 +29612,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
29506
29612
  broken.push(`${ruleId} \u2192 unparseable routes_to ${JSON.stringify(target)}`);
29507
29613
  continue;
29508
29614
  }
29509
- if (!candidates.some((rel) => fs44.existsSync(path42.join(packageRoot, rel)))) {
29615
+ if (!candidates.some((rel) => fs45.existsSync(path43.join(packageRoot, rel)))) {
29510
29616
  broken.push(`${ruleId} \u2192 ${target} (${candidates[0]} missing)`);
29511
29617
  }
29512
29618
  }
@@ -29538,9 +29644,9 @@ function detectSmokePlatform(projectRoot) {
29538
29644
  return "claude";
29539
29645
  }
29540
29646
  function dispatcherRunner(packageRoot) {
29541
- const localTsx = path42.join(packageRoot, "node_modules", ".bin", "tsx");
29542
- const script = path42.join(packageRoot, "src", "scripts", "hooks", "dispatch_hook.ts");
29543
- 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)) {
29544
29650
  return [localTsx, script];
29545
29651
  }
29546
29652
  return ["npx", "tsx", script];
@@ -29590,12 +29696,12 @@ function _check_hook_dispatcher(projectRoot, packageRoot = PACKAGE_ROOT2, opts =
29590
29696
  };
29591
29697
  }
29592
29698
  function readSettingsMode(projectRoot) {
29593
- const settingsPath = path42.join(projectRoot, ".agent-settings.yml");
29594
- if (!fs44.existsSync(settingsPath)) {
29699
+ const settingsPath = path43.join(projectRoot, ".agent-settings.yml");
29700
+ if (!fs45.existsSync(settingsPath)) {
29595
29701
  return "eager-all";
29596
29702
  }
29597
29703
  try {
29598
- const parsed = YAML6.parse(fs44.readFileSync(settingsPath, "utf8"));
29704
+ const parsed = YAML6.parse(fs45.readFileSync(settingsPath, "utf8"));
29599
29705
  const lean = parsed?.["lean_projection"] ?? null;
29600
29706
  const mode = lean?.["mode"];
29601
29707
  return typeof mode === "string" && mode.length > 0 ? mode : "eager-all";
@@ -29606,7 +29712,7 @@ function readSettingsMode(projectRoot) {
29606
29712
  function kernelIdsFromRouter(packageRoot) {
29607
29713
  try {
29608
29714
  const router = JSON.parse(
29609
- fs44.readFileSync(path42.join(packageRoot, "dist", "router.json"), "utf8")
29715
+ fs45.readFileSync(path43.join(packageRoot, "dist", "router.json"), "utf8")
29610
29716
  );
29611
29717
  return new Set((router["kernel"] ?? []).map(String));
29612
29718
  } catch {
@@ -29623,8 +29729,8 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
29623
29729
  remedy: "set lean_projection.mode to 'eager-all' or 'thin' in .agent-settings.yml"
29624
29730
  };
29625
29731
  }
29626
- const rulesDir = projectedRulesDir ?? path42.join(projectRoot, ".augment", "rules");
29627
- if (!fs44.existsSync(rulesDir)) {
29732
+ const rulesDir = projectedRulesDir ?? path43.join(projectRoot, ".augment", "rules");
29733
+ if (!fs45.existsSync(rulesDir)) {
29628
29734
  return {
29629
29735
  id: "lean-projection",
29630
29736
  status: "skipped",
@@ -29633,7 +29739,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
29633
29739
  };
29634
29740
  }
29635
29741
  const kernel = kernelIdsFromRouter(packageRoot);
29636
- 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();
29637
29743
  const nonKernel = files.filter((f) => !kernel.has(f.replace(/\.md$/, "")));
29638
29744
  if (nonKernel.length === 0) {
29639
29745
  return {
@@ -29647,7 +29753,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
29647
29753
  for (const f of nonKernel) {
29648
29754
  let text = "";
29649
29755
  try {
29650
- text = fs44.readFileSync(path42.join(rulesDir, f), "utf8");
29756
+ text = fs45.readFileSync(path43.join(rulesDir, f), "utf8");
29651
29757
  } catch {
29652
29758
  continue;
29653
29759
  }
@@ -29678,8 +29784,8 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
29678
29784
  function _check_host_manifest(projectRoot) {
29679
29785
  const detected = Object.entries(detectToolPresence(projectRoot)).filter(([, v]) => v === true).map(([k]) => k);
29680
29786
  const detectedNote = detected.length > 0 ? `detected surfaces: ${detected.join(", ")}` : "no surfaces detected";
29681
- const settingsPath = path42.join(projectRoot, ".agent-settings.yml");
29682
- if (!fs44.existsSync(settingsPath)) {
29787
+ const settingsPath = path43.join(projectRoot, ".agent-settings.yml");
29788
+ if (!fs45.existsSync(settingsPath)) {
29683
29789
  return {
29684
29790
  id: "host-manifest",
29685
29791
  status: "ok",
@@ -29689,7 +29795,7 @@ function _check_host_manifest(projectRoot) {
29689
29795
  }
29690
29796
  let parsed = null;
29691
29797
  try {
29692
- parsed = YAML6.parse(fs44.readFileSync(settingsPath, "utf8"));
29798
+ parsed = YAML6.parse(fs45.readFileSync(settingsPath, "utf8"));
29693
29799
  } catch (exc) {
29694
29800
  return {
29695
29801
  id: "host-manifest",
@@ -29886,13 +29992,13 @@ function _isCliEntry16() {
29886
29992
  if (process16.argv[1] === void 0) {
29887
29993
  return false;
29888
29994
  }
29889
- const argvUrl = pathToFileURL16(path42.resolve(process16.argv[1])).href;
29995
+ const argvUrl = pathToFileURL16(path43.resolve(process16.argv[1])).href;
29890
29996
  if (import.meta.url === argvUrl) {
29891
29997
  return true;
29892
29998
  }
29893
29999
  try {
29894
- const here = fs44.realpathSync(fileURLToPath25(import.meta.url));
29895
- 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]));
29896
30002
  return here === argv;
29897
30003
  } catch {
29898
30004
  return false;
@@ -29908,6 +30014,7 @@ var init_cmd_conformance = __esm({
29908
30014
  init_txlog();
29909
30015
  init_detect();
29910
30016
  init_package_root();
30017
+ init_router_target_paths();
29911
30018
  init_cmd_doctor();
29912
30019
  _HERE13 = fileURLToPath25(import.meta.url);
29913
30020
  PACKAGE_ROOT2 = resolvePackageRoot(import.meta.url);
@@ -29954,8 +30061,8 @@ __export(settings_exports, {
29954
30061
  read_settings: () => read_settings,
29955
30062
  read_tier_usage_settings: () => read_tier_usage_settings
29956
30063
  });
29957
- import { createRequire as createRequire5 } from "node:module";
29958
- import * as fs45 from "node:fs";
30064
+ import { createRequire as createRequire6 } from "node:module";
30065
+ import * as fs46 from "node:fs";
29959
30066
  function _isPlainObject8(v) {
29960
30067
  return typeof v === "object" && v !== null && !Array.isArray(v) && !(v instanceof Date);
29961
30068
  }
@@ -29992,7 +30099,7 @@ function _coerce_path(value, def) {
29992
30099
  }
29993
30100
  function _isFile13(p) {
29994
30101
  try {
29995
- return fs45.statSync(p).isFile();
30102
+ return fs46.statSync(p).isFile();
29996
30103
  } catch {
29997
30104
  return false;
29998
30105
  }
@@ -30003,7 +30110,7 @@ function read_settings(p) {
30003
30110
  if (_isFile13(p)) {
30004
30111
  let raw = {};
30005
30112
  try {
30006
- raw = YAML7.parse(fs45.readFileSync(p, "utf-8"), { version: "1.1" });
30113
+ raw = YAML7.parse(fs46.readFileSync(p, "utf-8"), { version: "1.1" });
30007
30114
  if (raw === null || raw === void 0) {
30008
30115
  raw = {};
30009
30116
  }
@@ -30037,7 +30144,7 @@ function read_tier_usage_settings(p) {
30037
30144
  if (_isFile13(p)) {
30038
30145
  let raw = {};
30039
30146
  try {
30040
- raw = YAML7.parse(fs45.readFileSync(p, "utf-8"), { version: "1.1" });
30147
+ raw = YAML7.parse(fs46.readFileSync(p, "utf-8"), { version: "1.1" });
30041
30148
  if (raw === null || raw === void 0) {
30042
30149
  raw = {};
30043
30150
  }
@@ -30078,7 +30185,7 @@ var YAML7, DEFAULT_LOG_PATH, DEFAULT_GRANULARITY, ALLOWED_GRANULARITIES, DEFAULT
30078
30185
  var init_settings = __esm({
30079
30186
  "src/agent-src/templates/scripts/telemetry/settings.ts"() {
30080
30187
  "use strict";
30081
- YAML7 = createRequire5(import.meta.url)("yaml");
30188
+ YAML7 = createRequire6(import.meta.url)("yaml");
30082
30189
  DEFAULT_LOG_PATH = ".agent-engagement.jsonl";
30083
30190
  DEFAULT_GRANULARITY = "task";
30084
30191
  ALLOWED_GRANULARITIES = ["task", "phase-step", "tool-call"];
@@ -30575,7 +30682,7 @@ __export(aggregator_exports, {
30575
30682
  aggregate: () => aggregate2,
30576
30683
  rank_artefacts: () => rank_artefacts
30577
30684
  });
30578
- import * as fs46 from "node:fs";
30685
+ import * as fs47 from "node:fs";
30579
30686
  function _key(kind, artId) {
30580
30687
  return `${kind}\0${artId}`;
30581
30688
  }
@@ -30612,7 +30719,7 @@ function* _iter_events(log_path) {
30612
30719
  if (!_isFile14(log_path)) {
30613
30720
  return;
30614
30721
  }
30615
- const text = fs46.readFileSync(log_path, "utf-8");
30722
+ const text = fs47.readFileSync(log_path, "utf-8");
30616
30723
  const lines = _pyFileLines(text);
30617
30724
  let lineNo = 0;
30618
30725
  for (const line of lines) {
@@ -30646,7 +30753,7 @@ function _pyFileLines(text) {
30646
30753
  }
30647
30754
  function _isFile14(p) {
30648
30755
  try {
30649
- return fs46.statSync(p).isFile();
30756
+ return fs47.statSync(p).isFile();
30650
30757
  } catch {
30651
30758
  return false;
30652
30759
  }
@@ -31160,7 +31267,7 @@ var init_report_renderer = __esm({
31160
31267
  });
31161
31268
 
31162
31269
  // src/scripts/ai_council/bundler.ts
31163
- import * as fs47 from "node:fs";
31270
+ import * as fs48 from "node:fs";
31164
31271
  function _context(mode, text, manifest = [], excluded = []) {
31165
31272
  return { mode, text, manifest, excluded };
31166
31273
  }
@@ -31218,10 +31325,10 @@ function bundle_prompt(text) {
31218
31325
  return _context("prompt", _enforceSize(redacted, "prompt"), ["<inline prompt>"]);
31219
31326
  }
31220
31327
  function bundle_roadmap(p) {
31221
- if (!fs47.existsSync(p)) {
31328
+ if (!fs48.existsSync(p)) {
31222
31329
  throw new FileNotFoundError2(`Roadmap not found: ${p}`);
31223
31330
  }
31224
- const raw = fs47.readFileSync(p, { encoding: "utf-8" });
31331
+ const raw = fs48.readFileSync(p, { encoding: "utf-8" });
31225
31332
  const redacted = redact(raw);
31226
31333
  return _context(
31227
31334
  "roadmap",
@@ -31784,8 +31891,8 @@ not. Cite the peer-reviewer label and the targeted response label
31784
31891
  });
31785
31892
 
31786
31893
  // src/scripts/ai_council/advisors.ts
31787
- import * as fs48 from "node:fs";
31788
- import * as path43 from "node:path";
31894
+ import * as fs49 from "node:fs";
31895
+ import * as path44 from "node:path";
31789
31896
  function _split_frontmatter(raw) {
31790
31897
  const match = _FRONTMATTER_RE2.exec(raw);
31791
31898
  if (!match) {
@@ -31813,12 +31920,12 @@ function _display_name_from(advisor_name, frontmatter) {
31813
31920
  }
31814
31921
  function resolve_persona_text(persona_path, repo_root) {
31815
31922
  const candidates = [
31816
- path43.join(repo_root, "dist/agent-src", persona_path),
31817
- 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)
31818
31925
  ];
31819
31926
  for (const candidate of candidates) {
31820
- if (fs48.existsSync(candidate)) {
31821
- const raw = fs48.readFileSync(candidate, "utf-8");
31927
+ if (fs49.existsSync(candidate)) {
31928
+ const raw = fs49.readFileSync(candidate, "utf-8");
31822
31929
  const [meta, body] = _split_frontmatter(raw);
31823
31930
  return [body.trim(), meta];
31824
31931
  }
@@ -32228,7 +32335,7 @@ __export(low_impact_corpus_exports, {
32228
32335
  load_validated_phrases: () => load_validated_phrases,
32229
32336
  parse_corpus_strict: () => parse_corpus_strict
32230
32337
  });
32231
- import * as fs49 from "node:fs";
32338
+ import * as fs50 from "node:fs";
32232
32339
  function _entry(phrase, normalised, section, line_no, trailing_metadata = "") {
32233
32340
  return { phrase, normalised, section, line_no, trailing_metadata };
32234
32341
  }
@@ -32401,10 +32508,10 @@ function _checkHeadingDrift(text, title) {
32401
32508
  }
32402
32509
  function parse_corpus_strict(corpusPath) {
32403
32510
  const p = corpusPath;
32404
- if (!fs49.existsSync(p)) {
32511
+ if (!fs50.existsSync(p)) {
32405
32512
  return new CorpusParseResult();
32406
32513
  }
32407
- const text = fs49.readFileSync(p, { encoding: "utf-8" });
32514
+ const text = fs50.readFileSync(p, { encoding: "utf-8" });
32408
32515
  const allTitles = _SECTION_KEYS.map((k) => _SECTION_TITLES[k]);
32409
32516
  const resultSections = {
32410
32517
  validated: [],
@@ -32467,10 +32574,10 @@ function load_anti_example_phrases(corpusPath) {
32467
32574
  }
32468
32575
  function load_corpus_lock(yamlPath) {
32469
32576
  const p = yamlPath;
32470
- if (!fs49.existsSync(p)) {
32577
+ if (!fs50.existsSync(p)) {
32471
32578
  return new CorpusParseResult();
32472
32579
  }
32473
- 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" });
32474
32581
  const doc = parsed === null || parsed === void 0 ? {} : parsed;
32475
32582
  const schemaVersion = doc["schema_version"];
32476
32583
  if (schemaVersion !== 1) {
@@ -32532,7 +32639,7 @@ function _deriveLockPath(corpusPath) {
32532
32639
  }
32533
32640
  function _loadSectionFromLock(corpusPath, section) {
32534
32641
  const lockPath = _deriveLockPath(corpusPath);
32535
- if (!fs49.existsSync(lockPath)) {
32642
+ if (!fs50.existsSync(lockPath)) {
32536
32643
  return null;
32537
32644
  }
32538
32645
  try {
@@ -32544,10 +32651,10 @@ function _loadSectionFromLock(corpusPath, section) {
32544
32651
  }
32545
32652
  function _loadSectionLenient(corpusPath, section) {
32546
32653
  const p = corpusPath;
32547
- if (!fs49.existsSync(p)) {
32654
+ if (!fs50.existsSync(p)) {
32548
32655
  return [];
32549
32656
  }
32550
- const text = fs49.readFileSync(p, { encoding: "utf-8" });
32657
+ const text = fs50.readFileSync(p, { encoding: "utf-8" });
32551
32658
  const allTitles = _SECTION_KEYS.map((k) => _SECTION_TITLES[k]);
32552
32659
  const bounds = _sectionBounds(text, _SECTION_TITLES[section], allTitles);
32553
32660
  if (bounds === null) {
@@ -33327,8 +33434,8 @@ var init_necessity = __esm({
33327
33434
  });
33328
33435
 
33329
33436
  // src/scripts/ai_council/budget_guard.ts
33330
- import * as fs50 from "node:fs";
33331
- import * as path44 from "node:path";
33437
+ import * as fs51 from "node:fs";
33438
+ import * as path45 from "node:path";
33332
33439
  function _resolveLedgerPath(p) {
33333
33440
  if (p !== null) {
33334
33441
  return p;
@@ -33343,18 +33450,18 @@ function _nowUtcMs() {
33343
33450
  return Date.now();
33344
33451
  }
33345
33452
  function _ensureLedgerDir(p) {
33346
- const parent = path44.dirname(p);
33453
+ const parent = path45.dirname(p);
33347
33454
  try {
33348
- fs50.mkdirSync(parent, { recursive: true });
33455
+ fs51.mkdirSync(parent, { recursive: true });
33349
33456
  let mode;
33350
33457
  try {
33351
- mode = fs50.statSync(parent).mode & 511;
33458
+ mode = fs51.statSync(parent).mode & 511;
33352
33459
  } catch {
33353
33460
  mode = 448;
33354
33461
  }
33355
33462
  if (mode !== 448) {
33356
33463
  try {
33357
- fs50.chmodSync(parent, 448);
33464
+ fs51.chmodSync(parent, 448);
33358
33465
  } catch {
33359
33466
  }
33360
33467
  }
@@ -33366,18 +33473,18 @@ function _ensureLedgerDir(p) {
33366
33473
  }
33367
33474
  }
33368
33475
  function _ensureLedgerFileMode(p) {
33369
- if (!fs50.existsSync(p)) {
33476
+ if (!fs51.existsSync(p)) {
33370
33477
  return;
33371
33478
  }
33372
33479
  let current;
33373
33480
  try {
33374
- current = fs50.statSync(p).mode & 511;
33481
+ current = fs51.statSync(p).mode & 511;
33375
33482
  } catch {
33376
33483
  return;
33377
33484
  }
33378
33485
  if (current !== 384) {
33379
33486
  try {
33380
- fs50.chmodSync(p, 384);
33487
+ fs51.chmodSync(p, 384);
33381
33488
  } catch {
33382
33489
  }
33383
33490
  }
@@ -33529,11 +33636,11 @@ function pyNumToStr(n) {
33529
33636
  }
33530
33637
  function read_entries2(p = null) {
33531
33638
  const resolved = _resolveLedgerPath(p);
33532
- if (!fs50.existsSync(resolved)) {
33639
+ if (!fs51.existsSync(resolved)) {
33533
33640
  return [];
33534
33641
  }
33535
33642
  const out = [];
33536
- const text = fs50.readFileSync(resolved, "utf-8");
33643
+ const text = fs51.readFileSync(resolved, "utf-8");
33537
33644
  for (const rawLine of text.split(/\r\n|\r|\n/u)) {
33538
33645
  const line = rawLine.trim();
33539
33646
  if (line === "") {
@@ -33636,7 +33743,7 @@ function record_spend(usd, provider, model, options = {}) {
33636
33743
  )}
33637
33744
  `;
33638
33745
  try {
33639
- fs50.appendFileSync(p, entry, { encoding: "utf-8" });
33746
+ fs51.appendFileSync(p, entry, { encoding: "utf-8" });
33640
33747
  } catch (exc) {
33641
33748
  process.stderr.write(`[council:budget_guard] write failed: ${_errStr(exc)}
33642
33749
  `);
@@ -33759,8 +33866,8 @@ function aggregate_scores(findings, scores) {
33759
33866
  by_id.get(s.finding_id).push(s);
33760
33867
  }
33761
33868
  const out = /* @__PURE__ */ new Map();
33762
- for (const [fid, fs56] of by_id) {
33763
- if (fs56.length === 0) {
33869
+ for (const [fid, fs57] of by_id) {
33870
+ if (fs57.length === 0) {
33764
33871
  out.set(
33765
33872
  fid,
33766
33873
  new ConsensusMetadata({
@@ -33776,13 +33883,13 @@ function aggregate_scores(findings, scores) {
33776
33883
  );
33777
33884
  continue;
33778
33885
  }
33779
- const mean = fs56.reduce((acc, s) => acc + s.score, 0) / fs56.length;
33780
- 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;
33781
33888
  const strength = mean / 10 * agree_rate;
33782
- const dissent = fs56.filter((s) => !s.agree).length;
33783
- const concur = fs56.filter((s) => s.agree).length;
33784
- const scorers = fs56.map((s) => s.scorer);
33785
- 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]);
33786
33893
  const mean_rounded = pyRound(mean, 2);
33787
33894
  out.set(
33788
33895
  fid,
@@ -34163,11 +34270,11 @@ __export(pricing_exports, {
34163
34270
  prices_file_for: () => prices_file_for,
34164
34271
  reprice_with_cache: () => reprice_with_cache
34165
34272
  });
34166
- import * as fs51 from "node:fs";
34167
- import * as path45 from "node:path";
34273
+ import * as fs52 from "node:fs";
34274
+ import * as path46 from "node:path";
34168
34275
  import { fileURLToPath as fileURLToPath26 } from "node:url";
34169
34276
  function prices_file_for(repo_root) {
34170
- return path45.join(repo_root, "agents", "runtime", ".agent-prices.md");
34277
+ return path46.join(repo_root, "agents", "runtime", ".agent-prices.md");
34171
34278
  }
34172
34279
  function lookup(table, provider, model) {
34173
34280
  return table.prices.get(priceKey(provider, model)) ?? null;
@@ -34261,16 +34368,16 @@ function is_stale(table, now) {
34261
34368
  return last < last_monday_utc(now);
34262
34369
  }
34263
34370
  function load_prices(p = PRICES_FILE) {
34264
- if (!fs51.existsSync(p)) {
34371
+ if (!fs52.existsSync(p)) {
34265
34372
  bootstrap_from_defaults(p);
34266
34373
  }
34267
- return _parse4(fs51.readFileSync(p, "utf-8"));
34374
+ return _parse4(fs52.readFileSync(p, "utf-8"));
34268
34375
  }
34269
34376
  function bootstrap_from_defaults(p = PRICES_FILE) {
34270
- fs51.mkdirSync(path45.dirname(p), { recursive: true });
34377
+ fs52.mkdirSync(path46.dirname(p), { recursive: true });
34271
34378
  const rows = as_rows();
34272
34379
  const body = _render_markdown(LAST_UPDATED, "shipped-default", rows);
34273
- fs51.writeFileSync(p, body, "utf-8");
34380
+ fs52.writeFileSync(p, body, "utf-8");
34274
34381
  }
34275
34382
  function _fmt62f(x) {
34276
34383
  const s = x.toFixed(2);
@@ -34393,8 +34500,8 @@ var init_pricing = __esm({
34393
34500
  "use strict";
34394
34501
  init_default_prices();
34395
34502
  _HERE14 = fileURLToPath26(import.meta.url);
34396
- REPO_ROOT2 = path45.resolve(path45.dirname(_HERE14), "..", "..", "..");
34397
- 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");
34398
34505
  _CHARS_PER_TOKEN = 4;
34399
34506
  CACHE_READ_MULTIPLIER = 0.1;
34400
34507
  CACHE_WRITE_MULTIPLIER_5M = 1.25;
@@ -35934,18 +36041,18 @@ __export(project_context_exports, {
35934
36041
  REPO_PURPOSE_MAX_CHARS: () => REPO_PURPOSE_MAX_CHARS,
35935
36042
  detect_project_context: () => detect_project_context
35936
36043
  });
35937
- import * as fs52 from "node:fs";
35938
- import * as path46 from "node:path";
36044
+ import * as fs53 from "node:fs";
36045
+ import * as path47 from "node:path";
35939
36046
  function _isPlainObject11(v) {
35940
36047
  return typeof v === "object" && v !== null && !Array.isArray(v);
35941
36048
  }
35942
36049
  function _read_json(p) {
35943
- if (!fs52.existsSync(p)) {
36050
+ if (!fs53.existsSync(p)) {
35944
36051
  return null;
35945
36052
  }
35946
36053
  let raw;
35947
36054
  try {
35948
- raw = fs52.readFileSync(p, "utf-8");
36055
+ raw = fs53.readFileSync(p, "utf-8");
35949
36056
  } catch {
35950
36057
  return null;
35951
36058
  }
@@ -35967,7 +36074,7 @@ function _name_from(composer, pkg, root) {
35967
36074
  }
35968
36075
  }
35969
36076
  try {
35970
- const base = path46.basename(root);
36077
+ const base = path47.basename(root);
35971
36078
  return base || null;
35972
36079
  } catch {
35973
36080
  return null;
@@ -36036,12 +36143,12 @@ function _splitlines10(text) {
36036
36143
  return parts;
36037
36144
  }
36038
36145
  function _purpose_from_readme(p) {
36039
- if (!fs52.existsSync(p)) {
36146
+ if (!fs53.existsSync(p)) {
36040
36147
  return null;
36041
36148
  }
36042
36149
  let text;
36043
36150
  try {
36044
- text = fs52.readFileSync(p, "utf-8");
36151
+ text = fs53.readFileSync(p, "utf-8");
36045
36152
  } catch {
36046
36153
  return null;
36047
36154
  }
@@ -36125,13 +36232,13 @@ function _rfind(haystack, needle) {
36125
36232
  return -1;
36126
36233
  }
36127
36234
  function detect_project_context(root) {
36128
- const resolvedRoot = path46.resolve(root ?? process.cwd());
36129
- const composer = _read_json(path46.join(resolvedRoot, "composer.json"));
36130
- 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"));
36131
36238
  return new ProjectContext(
36132
36239
  _name_from(composer, pkg, resolvedRoot),
36133
36240
  _stack_from(composer, pkg),
36134
- _purpose_from_readme(path46.join(resolvedRoot, "README.md"))
36241
+ _purpose_from_readme(path47.join(resolvedRoot, "README.md"))
36135
36242
  );
36136
36243
  }
36137
36244
  var REPO_PURPOSE_MAX_CHARS, _HEADING_RE, _BADGE_RE, _HTML_RE, ProjectContext;
@@ -36401,7 +36508,7 @@ __export(shadow_dispatch_exports, {
36401
36508
  slo_banner: () => slo_banner,
36402
36509
  slo_status: () => slo_status
36403
36510
  });
36404
- import * as fs53 from "node:fs";
36511
+ import * as fs54 from "node:fs";
36405
36512
  import { createHash as createHash9 } from "node:crypto";
36406
36513
  function should_shadow(sampleRate, opts = {}) {
36407
36514
  const rate = Math.max(0, Math.min(1, sampleRate));
@@ -36439,7 +36546,7 @@ function record_shadow_decision(logPath, opts) {
36439
36546
  escalated,
36440
36547
  escalation_reason: escalationReason
36441
36548
  };
36442
- fs53.mkdirSync(_dirname2(logPath), { recursive: true });
36549
+ fs54.mkdirSync(_dirname2(logPath), { recursive: true });
36443
36550
  const row = _pyJsonDumps2({
36444
36551
  timestamp: decision.timestamp,
36445
36552
  query_hash: decision.query_hash,
@@ -36449,7 +36556,7 @@ function record_shadow_decision(logPath, opts) {
36449
36556
  escalated: decision.escalated,
36450
36557
  escalation_reason: decision.escalation_reason
36451
36558
  }) + "\n";
36452
- fs53.appendFileSync(logPath, row, { encoding: "utf-8" });
36559
+ fs54.appendFileSync(logPath, row, { encoding: "utf-8" });
36453
36560
  return decision;
36454
36561
  }
36455
36562
  function _isoNowSeconds() {
@@ -36458,10 +36565,10 @@ function _isoNowSeconds() {
36458
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`;
36459
36566
  }
36460
36567
  function* _iterLog(logPath) {
36461
- if (!fs53.existsSync(logPath)) {
36568
+ if (!fs54.existsSync(logPath)) {
36462
36569
  return;
36463
36570
  }
36464
- const content = fs53.readFileSync(logPath, { encoding: "utf-8" });
36571
+ const content = fs54.readFileSync(logPath, { encoding: "utf-8" });
36465
36572
  for (const rawLine of _splitlines11(content)) {
36466
36573
  const line = _strip7(rawLine);
36467
36574
  if (!line) {
@@ -37382,8 +37489,8 @@ __export(council_cli_exports, {
37382
37489
  load_settings: () => load_settings,
37383
37490
  main: () => main17
37384
37491
  });
37385
- import * as fs54 from "node:fs";
37386
- import * as path47 from "node:path";
37492
+ import * as fs55 from "node:fs";
37493
+ import * as path48 from "node:path";
37387
37494
  import { fileURLToPath as fileURLToPath27, pathToFileURL as pathToFileURL17 } from "node:url";
37388
37495
  function _pyFixed6(x, ndigits) {
37389
37496
  if (!Number.isFinite(x)) {
@@ -37592,7 +37699,7 @@ function _stderr2(s) {
37592
37699
  function load_settings(p = SETTINGS_FILE2, opts = {}) {
37593
37700
  const ai_council_path = opts.ai_council_path ?? AI_COUNCIL_FILE;
37594
37701
  const settings = load_agent_settings({ project_path: p });
37595
- if (fs54.existsSync(ai_council_path)) {
37702
+ if (fs55.existsSync(ai_council_path)) {
37596
37703
  const cfg = load_council_config(ai_council_path);
37597
37704
  settings["ai_council"] = _synthesize_ai_council_block(cfg);
37598
37705
  }
@@ -37968,7 +38075,7 @@ function build_question(opts) {
37968
38075
  let ctx;
37969
38076
  let artefact;
37970
38077
  if (input_mode === "prompt") {
37971
- const text = fs54.readFileSync(input_path, "utf-8");
38078
+ const text = fs55.readFileSync(input_path, "utf-8");
37972
38079
  ctx = bundle_prompt(text);
37973
38080
  artefact = String(input_path);
37974
38081
  } else if (input_mode === "roadmap") {
@@ -38111,9 +38218,9 @@ function _maybe_write_decision_replay(opts) {
38111
38218
  include_member_arguments: include_args
38112
38219
  })
38113
38220
  );
38114
- const target = path47.join(path47.dirname(opts.out_path), "decision-replay.md");
38115
- fs54.mkdirSync(path47.dirname(target), { recursive: true });
38116
- 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" });
38117
38224
  return target;
38118
38225
  }
38119
38226
  function _peer_review_active(ai_cfg, args) {
@@ -39003,8 +39110,8 @@ function cmd_run(args, opts = {}) {
39003
39110
  kind: "responses",
39004
39111
  subcommand: "run"
39005
39112
  });
39006
- fs54.mkdirSync(path47.dirname(_resolveTarget(out_path)), { recursive: true });
39007
- 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" });
39008
39115
  _stdout2(
39009
39116
  `
39010
39117
  council:run \xB7 wrote ${out_path} (estimated $${_pyFixed6(estimated_total, 4)} / actual $${_pyFixed6(actual_total, 4)})
@@ -39029,7 +39136,7 @@ function _debate_round_filename(round_number) {
39029
39136
  return `debate-round-${round_number}.json`;
39030
39137
  }
39031
39138
  function _write_debate_round(out_dir, round_number, responses, opts) {
39032
- fs54.mkdirSync(_resolveTarget(out_dir), { recursive: true });
39139
+ fs55.mkdirSync(_resolveTarget(out_dir), { recursive: true });
39033
39140
  let actual_total = 0;
39034
39141
  for (const r of responses) {
39035
39142
  if (r.error) {
@@ -39053,15 +39160,15 @@ function _write_debate_round(out_dir, round_number, responses, opts) {
39053
39160
  prompt_cache_round_gap_ms: opts.cache_gap_ms_since_previous_round ?? null,
39054
39161
  responses: _serialise_responses(responses)
39055
39162
  };
39056
- const out_path = path47.join(_resolveTarget(out_dir), _debate_round_filename(round_number));
39057
- 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" });
39058
39165
  return out_path;
39059
39166
  }
39060
39167
  function _load_debate_seed(p, expected_members) {
39061
- if (!fs54.existsSync(p)) {
39168
+ if (!fs55.existsSync(p)) {
39062
39169
  throw new FileNotFoundError3(`--continue-as-debate path not found: ${p}`);
39063
39170
  }
39064
- const payload = JSON.parse(fs54.readFileSync(p, "utf-8"));
39171
+ const payload = JSON.parse(fs55.readFileSync(p, "utf-8"));
39065
39172
  const source_members = (payload["members"] || []).slice();
39066
39173
  const expected_labels = expected_members.map((m) => `${m.name}/${m.model}`);
39067
39174
  if (!_listEq(source_members, expected_labels)) {
@@ -39107,7 +39214,7 @@ function _readStdinLine() {
39107
39214
  try {
39108
39215
  const buf = Buffer.alloc(4096);
39109
39216
  const fd = 0;
39110
- const n = fs54.readSync(fd, buf, 0, buf.length, null);
39217
+ const n = fs55.readSync(fd, buf, 0, buf.length, null);
39111
39218
  return buf.toString("utf-8", 0, n).split("\n")[0]?.trim().toLowerCase() ?? "";
39112
39219
  } catch {
39113
39220
  return "";
@@ -39333,7 +39440,7 @@ council:debate \xB7 ${all_rounds.length} round(s) complete \xB7 actual $${_pyFix
39333
39440
  return errors_last.length > 0 && errors_last.length === last.length ? 1 : 0;
39334
39441
  }
39335
39442
  function cmd_render(args) {
39336
- const payload = JSON.parse(fs54.readFileSync(args.responses, "utf-8"));
39443
+ const payload = JSON.parse(fs55.readFileSync(args.responses, "utf-8"));
39337
39444
  const items = payload["responses"] || [];
39338
39445
  const explicit = _getattr3(args, "prompt_mode", null);
39339
39446
  const mode = explicit || payload["prompt_mode"] || payload["mode"];
@@ -39359,8 +39466,8 @@ function cmd_render(args) {
39359
39466
  kind: "sessions",
39360
39467
  subcommand: "render"
39361
39468
  });
39362
- fs54.mkdirSync(path47.dirname(_resolveTarget(out_path)), { recursive: true });
39363
- 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" });
39364
39471
  _stdout2(`council:render \xB7 wrote ${out_path}
39365
39472
  `);
39366
39473
  return 0;
@@ -39371,15 +39478,15 @@ function cmd_render(args) {
39371
39478
  function _cmd_replay_low_impact_stats(args) {
39372
39479
  const li = low_impact_exports;
39373
39480
  const responses_path = args.responses;
39374
- const log_path = path47.join(path47.dirname(responses_path), "low-impact-resolutions.md");
39375
- 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)) {
39376
39483
  _stdout2(
39377
39484
  `council:replay \xB7 no low-impact-resolutions.md alongside ${responses_path} \u2014 session had no fast-path entries.
39378
39485
  `
39379
39486
  );
39380
39487
  return 0;
39381
39488
  }
39382
- const body = fs54.readFileSync(log_path, "utf-8");
39489
+ const body = fs55.readFileSync(log_path, "utf-8");
39383
39490
  const stats = li.parse_low_impact_log(body);
39384
39491
  const out = li.render_low_impact_stats(stats);
39385
39492
  if (_getattr3(args, "output", null)) {
@@ -39387,8 +39494,8 @@ function _cmd_replay_low_impact_stats(args) {
39387
39494
  kind: "sessions",
39388
39495
  subcommand: "replay"
39389
39496
  });
39390
- fs54.mkdirSync(path47.dirname(_resolveTarget(target)), { recursive: true });
39391
- 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" });
39392
39499
  _stdout2(`council:replay \xB7 wrote ${target}
39393
39500
  `);
39394
39501
  return 0;
@@ -39400,7 +39507,7 @@ function cmd_replay(args) {
39400
39507
  if (_getattr3(args, "low_impact_stats", false)) {
39401
39508
  return _cmd_replay_low_impact_stats(args);
39402
39509
  }
39403
- const payload = JSON.parse(fs54.readFileSync(args.responses, "utf-8"));
39510
+ const payload = JSON.parse(fs55.readFileSync(args.responses, "utf-8"));
39404
39511
  const consensus = _deserialise_consensus(payload["consensus"]);
39405
39512
  if (consensus === null) {
39406
39513
  _stderr2(
@@ -39425,8 +39532,8 @@ function cmd_replay(args) {
39425
39532
  kind: "sessions",
39426
39533
  subcommand: "replay"
39427
39534
  });
39428
- fs54.mkdirSync(path47.dirname(_resolveTarget(out_path)), { recursive: true });
39429
- 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" });
39430
39537
  _stdout2(`council:replay \xB7 wrote ${out_path}
39431
39538
  `);
39432
39539
  } else {
@@ -39483,8 +39590,8 @@ function cmd_quota(args, opts = {}) {
39483
39590
  }
39484
39591
  function _validate_council_output_path(path_str, opts) {
39485
39592
  const expected_rel = COUNCIL_CANONICAL_DIRS[opts.kind];
39486
- const expected_abs = _resolveReal(path47.join(REPO_ROOT3, expected_rel));
39487
- 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);
39488
39595
  const target_resolved = _resolveReal(target);
39489
39596
  if (!_isRelativeTo(target_resolved, expected_abs)) {
39490
39597
  throw new ArgumentTypeError(
@@ -39494,12 +39601,12 @@ function _validate_council_output_path(path_str, opts) {
39494
39601
  return path_str;
39495
39602
  }
39496
39603
  function _resolveTarget(path_str) {
39497
- 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);
39498
39605
  }
39499
39606
  function _resolveReal(p) {
39500
- const abs = path47.resolve(p);
39607
+ const abs = path48.resolve(p);
39501
39608
  try {
39502
- return fs54.realpathSync(abs);
39609
+ return fs55.realpathSync(abs);
39503
39610
  } catch {
39504
39611
  return abs;
39505
39612
  }
@@ -39508,8 +39615,8 @@ function _isRelativeTo(target, base) {
39508
39615
  if (target === base) {
39509
39616
  return true;
39510
39617
  }
39511
- const rel = path47.relative(base, target);
39512
- return rel !== "" && !rel.startsWith("..") && !path47.isAbsolute(rel);
39618
+ const rel = path48.relative(base, target);
39619
+ return rel !== "" && !rel.startsWith("..") && !path48.isAbsolute(rel);
39513
39620
  }
39514
39621
  function _topError(message) {
39515
39622
  _stderr2(_TOP_USAGE2);
@@ -39870,13 +39977,13 @@ function _isCliEntry17() {
39870
39977
  if (process.argv[1] === void 0) {
39871
39978
  return false;
39872
39979
  }
39873
- const argvUrl = pathToFileURL17(path47.resolve(process.argv[1])).href;
39980
+ const argvUrl = pathToFileURL17(path48.resolve(process.argv[1])).href;
39874
39981
  if (import.meta.url === argvUrl) {
39875
39982
  return true;
39876
39983
  }
39877
39984
  try {
39878
- const here = fs54.realpathSync(fileURLToPath27(import.meta.url));
39879
- 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]));
39880
39987
  return here === argv;
39881
39988
  } catch {
39882
39989
  return false;
@@ -39928,7 +40035,7 @@ var init_council_cli = __esm({
39928
40035
  "xai",
39929
40036
  "perplexity"
39930
40037
  ]);
39931
- _HERE15 = path47.dirname(fileURLToPath27(import.meta.url));
40038
+ _HERE15 = path48.dirname(fileURLToPath27(import.meta.url));
39932
40039
  [REPO_ROOT3] = resolve_project_root(null);
39933
40040
  SETTINGS_FILE2 = project_settings_path(REPO_ROOT3);
39934
40041
  AI_COUNCIL_FILE = resolve_config_path(REPO_ROOT3);
@@ -40030,7 +40137,7 @@ var init_safety_envelope = __esm({
40030
40137
  });
40031
40138
 
40032
40139
  // src/scripts/mcp_server/__main__.ts
40033
- import * as path49 from "node:path";
40140
+ import * as path50 from "node:path";
40034
40141
  import { fileURLToPath as fileURLToPath29 } from "node:url";
40035
40142
 
40036
40143
  // src/scripts/mcp_server/index.ts
@@ -40078,8 +40185,8 @@ init_prompts();
40078
40185
  init_resources();
40079
40186
 
40080
40187
  // src/scripts/mcp_server/tools.ts
40081
- import * as fs55 from "node:fs";
40082
- import * as path48 from "node:path";
40188
+ import * as fs56 from "node:fs";
40189
+ import * as path49 from "node:path";
40083
40190
  import { fileURLToPath as fileURLToPath28 } from "node:url";
40084
40191
 
40085
40192
  // src/scripts/chat_history.ts
@@ -42327,9 +42434,9 @@ function _strip8(s) {
42327
42434
  }
42328
42435
  function _resolvePath2(p) {
42329
42436
  try {
42330
- return fs55.realpathSync(p);
42437
+ return fs56.realpathSync(p);
42331
42438
  } catch {
42332
- return path48.resolve(p);
42439
+ return path49.resolve(p);
42333
42440
  }
42334
42441
  }
42335
42442
  function _resolveConsumerRoot(override) {
@@ -42339,14 +42446,14 @@ function _resolveConsumerRoot(override) {
42339
42446
  return _resolvePath2(process.cwd());
42340
42447
  }
42341
42448
  function _relativeUnder(target, root) {
42342
- const rel = path48.relative(root, target);
42449
+ const rel = path49.relative(root, target);
42343
42450
  if (rel === "") {
42344
42451
  return "";
42345
42452
  }
42346
- if (rel.startsWith("..") || path48.isAbsolute(rel)) {
42453
+ if (rel.startsWith("..") || path49.isAbsolute(rel)) {
42347
42454
  return null;
42348
42455
  }
42349
- return rel.split(path48.sep).join("/");
42456
+ return rel.split(path49.sep).join("/");
42350
42457
  }
42351
42458
  function _reprStrList(values) {
42352
42459
  return `[${values.map((v) => `'${v}'`).join(", ")}]`;
@@ -42355,11 +42462,11 @@ function _validateInTreePath(raw, consumerRoot) {
42355
42462
  const root = _resolvePath2(consumerRoot);
42356
42463
  let target;
42357
42464
  if (raw === null || raw === void 0 || raw === "") {
42358
- target = path48.join(root, "agents", "runtime", ".agent-chat-history");
42359
- } else if (path48.isAbsolute(raw)) {
42465
+ target = path49.join(root, "agents", "runtime", ".agent-chat-history");
42466
+ } else if (path49.isAbsolute(raw)) {
42360
42467
  target = _resolvePath2(raw);
42361
42468
  } else {
42362
- target = _resolvePath2(path48.join(root, raw));
42469
+ target = _resolvePath2(path49.join(root, raw));
42363
42470
  }
42364
42471
  const rel = _relativeUnder(target, root);
42365
42472
  if (rel === null) {
@@ -42397,11 +42504,11 @@ async function _lintSkillsHandler(args, consumerRoot) {
42397
42504
  if (typeof raw !== "string") {
42398
42505
  throw new Error("'paths' entries must be strings");
42399
42506
  }
42400
- 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));
42401
42508
  if (_relativeUnder(resolved, root) === null) {
42402
42509
  throw new Error(`path escapes consumer_root: ${resolved}`);
42403
42510
  }
42404
- if (fs55.existsSync(resolved)) {
42511
+ if (fs56.existsSync(resolved)) {
42405
42512
  paths.push(resolved);
42406
42513
  }
42407
42514
  }
@@ -42438,7 +42545,7 @@ async function _chatHistoryAppendHandler(args, consumerRoot) {
42438
42545
  if (typeof minSchema !== "number" || !Number.isInteger(minSchema) || typeof minSchema === "boolean") {
42439
42546
  throw new Error("'min_schema_version' must be an integer");
42440
42547
  }
42441
- const existingHeader = fs55.existsSync(target) ? _chReadHeader(target) : null;
42548
+ const existingHeader = fs56.existsSync(target) ? _chReadHeader(target) : null;
42442
42549
  const observed = existingHeader !== null && typeof existingHeader === "object" ? _pyInt7(existingHeader.v ?? 0) : SCHEMA_VERSION3;
42443
42550
  if (observed < minSchema) {
42444
42551
  throw new Error(`chat-history schema ${observed} below required ${minSchema}`);
@@ -42453,8 +42560,8 @@ async function _chatHistoryAppendHandler(args, consumerRoot) {
42453
42560
  session: session === void 0 ? null : session
42454
42561
  };
42455
42562
  }
42456
- if (!fs55.existsSync(target) || _chReadHeader(target) === null) {
42457
- fs55.mkdirSync(path48.dirname(target), { recursive: true });
42563
+ if (!fs56.existsSync(target) || _chReadHeader(target) === null) {
42564
+ fs56.mkdirSync(path49.dirname(target), { recursive: true });
42458
42565
  _chInit(target);
42459
42566
  }
42460
42567
  _chAppend(entry, target, session ?? null);
@@ -42498,7 +42605,7 @@ async function _chatHistoryReadHandler(args, consumerRoot) {
42498
42605
  if (detail !== "full" && detail !== "index") {
42499
42606
  throw new Error("'detail' must be 'index' or 'full'");
42500
42607
  }
42501
- if (!fs55.existsSync(target)) {
42608
+ if (!fs56.existsSync(target)) {
42502
42609
  return { path: target, entries: [], count: 0 };
42503
42610
  }
42504
42611
  if (around !== void 0 && around !== null) {
@@ -42600,8 +42707,8 @@ async function _memoryStatusHandler(_args, consumerRoot) {
42600
42707
  }
42601
42708
  return result;
42602
42709
  }
42603
- var _PACKAGE_ROOT2 = path48.resolve(
42604
- path48.dirname(fileURLToPath28(import.meta.url)),
42710
+ var _PACKAGE_ROOT2 = path49.resolve(
42711
+ path49.dirname(fileURLToPath28(import.meta.url)),
42605
42712
  "..",
42606
42713
  "..",
42607
42714
  ".."
@@ -42645,10 +42752,10 @@ async function _memorySignalHandler(args, consumerRoot) {
42645
42752
  async function _roadmapProgressHandler(args, consumerRoot) {
42646
42753
  const dryRun = _pyTruthy6(args.dry_run ?? false);
42647
42754
  const root = _resolvePath2(consumerRoot);
42648
- const roadmapRoot = path48.join(root, "agents", "roadmaps");
42649
- 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");
42650
42757
  const urp = await Promise.resolve().then(() => (init_update_roadmap_progress(), update_roadmap_progress_exports));
42651
- if (!fs55.existsSync(roadmapRoot)) {
42758
+ if (!fs56.existsSync(roadmapRoot)) {
42652
42759
  return {
42653
42760
  written: false,
42654
42761
  path: target,
@@ -42663,7 +42770,7 @@ async function _roadmapProgressHandler(args, consumerRoot) {
42663
42770
  const stepsDone = roadmaps.reduce((s, r) => s + r.done, 0);
42664
42771
  const stepsTotal = roadmaps.reduce((s, r) => s + r.total_active, 0);
42665
42772
  if (!dryRun) {
42666
- fs55.writeFileSync(target, content, "utf-8");
42773
+ fs56.writeFileSync(target, content, "utf-8");
42667
42774
  }
42668
42775
  return {
42669
42776
  written: !dryRun,
@@ -42684,11 +42791,11 @@ async function _roadmapArchiveHandler(_args, consumerRoot) {
42684
42791
  let dashboardRegenerated = false;
42685
42792
  if (archived.length > 0) {
42686
42793
  const urp = await Promise.resolve().then(() => (init_update_roadmap_progress(), update_roadmap_progress_exports));
42687
- const roadmapRoot = path48.join(root, "agents", "roadmaps");
42688
- if (fs55.existsSync(roadmapRoot)) {
42794
+ const roadmapRoot = path49.join(root, "agents", "roadmaps");
42795
+ if (fs56.existsSync(roadmapRoot)) {
42689
42796
  const roadmaps = urp.collect(roadmapRoot);
42690
- fs55.writeFileSync(
42691
- path48.join(root, "agents", "roadmaps-progress.md"),
42797
+ fs56.writeFileSync(
42798
+ path49.join(root, "agents", "roadmaps-progress.md"),
42692
42799
  urp.render(roadmaps, urp.collect_bundles(root)),
42693
42800
  "utf-8"
42694
42801
  );
@@ -42704,9 +42811,9 @@ async function _roadmapArchiveHandler(_args, consumerRoot) {
42704
42811
  async function _capabilitiesIndexHandler(args, consumerRoot) {
42705
42812
  const check = _pyTruthy6(args.check ?? false);
42706
42813
  const cap = await Promise.resolve().then(() => (init_generate_capabilities_index(), generate_capabilities_index_exports));
42707
- const out = path48.join(_PACKAGE_ROOT2, "CAPABILITIES.yaml");
42814
+ const out = path49.join(_PACKAGE_ROOT2, "CAPABILITIES.yaml");
42708
42815
  const content = cap.build();
42709
- const onDisk = fs55.existsSync(out) ? fs55.readFileSync(out, "utf-8") : "";
42816
+ const onDisk = fs56.existsSync(out) ? fs56.readFileSync(out, "utf-8") : "";
42710
42817
  const drift = onDisk !== content;
42711
42818
  if (check) {
42712
42819
  return { check: true, written: false, drift, path: out };
@@ -42717,7 +42824,7 @@ async function _capabilitiesIndexHandler(args, consumerRoot) {
42717
42824
  `CAPABILITIES.yaml path escapes consumer_root: ${out} not under ${root}`
42718
42825
  );
42719
42826
  }
42720
- fs55.writeFileSync(out, content, "utf-8");
42827
+ fs56.writeFileSync(out, content, "utf-8");
42721
42828
  return { check: false, written: true, drift, path: out };
42722
42829
  }
42723
42830
  async function _runDoctorLeg(consumerRoot) {
@@ -42817,11 +42924,11 @@ async function _councilEstimateHandler(args, consumerRoot) {
42817
42924
  throw new Error("'depth' must be 'shallow' or 'deep' when provided");
42818
42925
  }
42819
42926
  const root = _resolvePath2(consumerRoot);
42820
- 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));
42821
42928
  if (_relativeUnder(target, root) === null) {
42822
42929
  throw new Error(`path escapes consumer_root: ${target}`);
42823
42930
  }
42824
- if (!fs55.existsSync(target)) {
42931
+ if (!fs56.existsSync(target)) {
42825
42932
  throw new Error(`input_path not found: ${target}`);
42826
42933
  }
42827
42934
  const cli = await Promise.resolve().then(() => (init_council_cli(), council_cli_exports));
@@ -42883,18 +42990,18 @@ async function _runTestsHandler(args, consumerRoot) {
42883
42990
  if (typeof relPathRaw !== "string" || !_strip8(relPathRaw)) {
42884
42991
  throw new Error("'path' must be a non-empty string when provided");
42885
42992
  }
42886
- 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));
42887
42994
  const rel = _relativeUnder(resolved, root);
42888
42995
  if (rel === null) {
42889
42996
  throw new Error(`path escapes consumer_root: ${resolved}`);
42890
42997
  }
42891
- if (!fs55.existsSync(resolved)) {
42998
+ if (!fs56.existsSync(resolved)) {
42892
42999
  throw new Error(`path not found: ${resolved}`);
42893
43000
  }
42894
43001
  relArg = rel;
42895
43002
  }
42896
- const vitestEntry = path48.join(root, "node_modules", "vitest", "vitest.mjs");
42897
- if (!fs55.existsSync(vitestEntry)) {
43003
+ const vitestEntry = path49.join(root, "node_modules", "vitest", "vitest.mjs");
43004
+ if (!fs56.existsSync(vitestEntry)) {
42898
43005
  throw new Error(
42899
43006
  "run_tests pilot supports vitest projects only \u2014 node_modules/vitest/vitest.mjs not found under consumer_root"
42900
43007
  );
@@ -43500,8 +43607,8 @@ function _strCmp3(a, b) {
43500
43607
  return a < b ? -1 : a > b ? 1 : 0;
43501
43608
  }
43502
43609
  function _pathlibCompare3(a, b) {
43503
- const pa = a.split(path48.sep);
43504
- const pb = b.split(path48.sep);
43610
+ const pa = a.split(path49.sep);
43611
+ const pb = b.split(path49.sep);
43505
43612
  const n = Math.min(pa.length, pb.length);
43506
43613
  for (let i = 0; i < n; i++) {
43507
43614
  const c = _strCmp3(pa[i], pb[i]);
@@ -43726,7 +43833,7 @@ function main18() {
43726
43833
 
43727
43834
  // src/scripts/mcp_server/__main__.ts
43728
43835
  var _selfPath = fileURLToPath29(import.meta.url);
43729
- 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);
43730
43837
  if (_invokedDirectly2) {
43731
43838
  main18();
43732
43839
  }