@event4u/agent-config 14.7.0 → 14.8.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 (138) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +245 -388
  3. package/README.md +1 -1
  4. package/dist/agent-src/commands/evals/git-pr-merge.json +13 -0
  5. package/dist/agent-src/commands/evals/roadmap.json +17 -1
  6. package/dist/agent-src/commands/pr/create.md +14 -2
  7. package/dist/agent-src/commands/pr/merge.md +379 -0
  8. package/dist/agent-src/commands/roadmap/process-full.md +157 -3
  9. package/dist/agent-src/commands/roadmap.md +1 -1
  10. package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +46 -36
  11. package/dist/agent-src/contexts/execution/autonomy-mechanics.md +37 -2
  12. package/dist/agent-src/contexts/execution/roadmap-execution-contract.md +64 -2
  13. package/dist/agent-src/contexts/execution/roadmap-process-loop.md +154 -2
  14. package/dist/agent-src/rules/artifact-drafting-protocol.md +5 -1
  15. package/dist/agent-src/rules/decision-revisit-gate.md +65 -33
  16. package/dist/agent-src/rules/recurring-criticism.md +1 -1
  17. package/dist/agent-src/rules/roadmap-progress-sync.md +19 -0
  18. package/dist/agent-src/rules/source-confidentiality.md +1 -1
  19. package/dist/agent-src/scripts/archive_completed_roadmaps.ts +7 -4
  20. package/dist/agent-src/scripts/dashboard_mode.ts +212 -0
  21. package/dist/agent-src/scripts/update_roadmap_progress.ts +47 -48
  22. package/dist/agent-src/skills/adr-create/SKILL.md +124 -5
  23. package/dist/agent-src/skills/decision-record/SKILL.md +61 -3
  24. package/dist/agent-src/skills/decision-review/SKILL.md +65 -0
  25. package/dist/agent-src/skills/merge-conflicts/SKILL.md +26 -0
  26. package/dist/agent-src/skills/security/SKILL.md +8 -0
  27. package/dist/agent-src/skills/security-audit/SKILL.md +12 -1
  28. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  29. package/dist/agent-src/templates/roadmaps.md +20 -2
  30. package/dist/cli/registry.js +1 -0
  31. package/dist/cli/registry.js.map +1 -1
  32. package/dist/cli-delegate/{chunk-JZ4NR2TW.js → chunk-7PRE6ZV2.js} +1 -1
  33. package/dist/cli-delegate/{chunk-7F3VYSM2.js → chunk-EEJUMCDZ.js} +14 -14
  34. package/dist/cli-delegate/{chunk-74E3TKWV.js → chunk-H4VIVD4C.js} +5 -5
  35. package/dist/cli-delegate/chunk-I3EIN2YG.js +36 -0
  36. package/dist/cli-delegate/{chunk-4VR4ORQ6.js → chunk-LPPWO5CE.js} +4 -3
  37. package/dist/cli-delegate/{chunk-UEZ7D35A.js → chunk-N7CDDGI3.js} +4 -23
  38. package/dist/cli-delegate/cmd_adr_effective.js +1162 -0
  39. package/dist/cli-delegate/cmd_conformance.js +14 -14
  40. package/dist/cli-delegate/cmd_converge.js +3 -3
  41. package/dist/cli-delegate/cmd_doctor.js +7 -7
  42. package/dist/cli-delegate/cmd_export.js +6 -6
  43. package/dist/cli-delegate/cmd_handoff.js +7 -6
  44. package/dist/cli-delegate/cmd_memory_get.js +2 -1
  45. package/dist/cli-delegate/cmd_migrate.js +2 -2
  46. package/dist/cli-delegate/cmd_preflight.js +5 -5
  47. package/dist/cli-delegate/cmd_prune.js +6 -6
  48. package/dist/cli-delegate/cmd_route_audit.js +6 -5
  49. package/dist/cli-delegate/cmd_route_explain.js +3 -3
  50. package/dist/cli-delegate/cmd_session_recycle.js +3 -3
  51. package/dist/cli-delegate/cmd_settings_get.js +3 -3
  52. package/dist/cli-delegate/cmd_settings_migrate.js +6 -6
  53. package/dist/cli-delegate/cmd_sync.js +6 -6
  54. package/dist/cli-delegate/cmd_uninstall.js +6 -6
  55. package/dist/cli-delegate/cmd_update.js +3 -3
  56. package/dist/cli-delegate/cmd_upgrade.js +3 -3
  57. package/dist/cli-delegate/cmd_validate.js +6 -6
  58. package/dist/cli-delegate/cmd_versions.js +3 -3
  59. package/dist/discovery/deprecation-report.md +1 -1
  60. package/dist/discovery/discovery-manifest.json +53 -22
  61. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  62. package/dist/discovery/discovery-manifest.summary.md +3 -3
  63. package/dist/discovery/dormancy-report.md +1 -1
  64. package/dist/discovery/orphan-report.md +1 -1
  65. package/dist/discovery/packs.json +7 -6
  66. package/dist/discovery/trust-report.md +2 -2
  67. package/dist/discovery/workspaces.json +6 -5
  68. package/dist/hooks/dispatch.js +806 -681
  69. package/dist/install/globalRuleLayers.js +169 -0
  70. package/dist/install/globalRuleLayers.js.map +1 -0
  71. package/dist/install/partitionEligibility.js +156 -0
  72. package/dist/install/partitionEligibility.js.map +1 -1
  73. package/dist/install/ruleLayerPartition.js +157 -0
  74. package/dist/install/ruleLayerPartition.js.map +1 -0
  75. package/dist/mcp/registry-manifest.json +3 -3
  76. package/dist/mcp/server.json +2 -2
  77. package/dist/mcp/server.mjs +654 -578
  78. package/dist/scripts/_lib/prune_empty_dirs.js +85 -0
  79. package/dist/scripts/_lib/prune_empty_dirs.js.map +1 -0
  80. package/dist/scripts/condense.js +52 -89
  81. package/dist/scripts/condense.js.map +1 -1
  82. package/docs/guidelines/agent-infra/artifact-drafting-protocol-mechanics.md +45 -1
  83. package/docs/guidelines/agent-infra/false-green.md +47 -1
  84. package/package.json +1 -1
  85. package/src/agent-src/scripts/archive_completed_roadmaps.ts +7 -4
  86. package/src/agent-src/scripts/dashboard_mode.ts +212 -0
  87. package/src/agent-src/scripts/update_roadmap_progress.ts +47 -48
  88. package/src/config/ci-local-parity.yml +21 -0
  89. package/src/config/estate-count-budget.json +275 -2
  90. package/src/config/evaluator-budgets.json +3 -3
  91. package/src/config/gate-coverage.yml +220 -12
  92. package/src/config/gate-violation-baselines.json +73 -63
  93. package/src/config/gitignore-block.txt +15 -2
  94. package/src/config/hook-latency-budget.json +5 -0
  95. package/src/config/rule-stub-ceilings.json +17 -3
  96. package/src/install/globalRuleLayers.ts +197 -0
  97. package/src/install/partitionEligibility.ts +177 -0
  98. package/src/install/ruleLayerPartition.ts +212 -0
  99. package/src/scripts/_cli/cmd_adr_effective.ts +484 -0
  100. package/src/scripts/_dispatch.bash +11 -0
  101. package/src/scripts/_lib/adr_frontmatter.test.ts +365 -0
  102. package/src/scripts/_lib/adr_frontmatter.ts +459 -0
  103. package/src/scripts/_lib/envelope_grounding.ts +11 -1
  104. package/src/scripts/_lib/layer_overlap_notice.ts +11 -2
  105. package/src/scripts/_lib/prune_empty_dirs.ts +80 -0
  106. package/src/scripts/adr/evidence_census.ts +899 -0
  107. package/src/scripts/adr/regenerate_index.ts +12 -32
  108. package/src/scripts/adr_cite_check.ts +540 -39
  109. package/src/scripts/audit_adr_coverage.ts +103 -17
  110. package/src/scripts/bench_hook_latency.ts +204 -0
  111. package/src/scripts/build_archive_index.ts +34 -0
  112. package/src/scripts/check_adr_frontmatter.ts +574 -39
  113. package/src/scripts/check_hook_bundle_content.ts +219 -0
  114. package/src/scripts/check_new_adr_evidence.ts +529 -0
  115. package/src/scripts/check_references.ts +18 -0
  116. package/src/scripts/check_rule_layer_partition.ts +531 -0
  117. package/src/scripts/check_single_delivery.ts +137 -4
  118. package/src/scripts/check_standing_rule_delivery.ts +8 -2
  119. package/src/scripts/condense.ts +61 -91
  120. package/src/scripts/external_sources_denylist.json +4 -1
  121. package/src/scripts/hooks/block_unauthorized_git.ts +22 -2
  122. package/src/scripts/hooks/dispatch_hook.ts +154 -187
  123. package/src/scripts/hooks/dispatch_issues.ts +38 -19
  124. package/src/scripts/hooks/fallback_yaml.ts +66 -0
  125. package/src/scripts/hooks/host_semantics.ts +21 -0
  126. package/src/scripts/hooks/injection_budget.ts +13 -3
  127. package/src/scripts/hooks/py_json_dumps.ts +103 -0
  128. package/src/scripts/hooks/state_io.ts +88 -1
  129. package/src/scripts/hooks/stdin_failure_policy.ts +96 -0
  130. package/src/scripts/injection_scan_hook.ts +137 -5
  131. package/src/scripts/lint_hook_manifest.ts +49 -0
  132. package/src/scripts/lint_provenance_vocabulary.ts +472 -4
  133. package/src/scripts/routing_doctor.ts +5 -1
  134. package/src/scripts/sync_pr_branch.ts +163 -20
  135. package/dist/cli-delegate/{chunk-PPQO4NGR.js → chunk-6RJA2F5A.js} +3 -3
  136. package/dist/cli-delegate/{chunk-6EOCNQAM.js → chunk-E4XIZDIB.js} +0 -0
  137. package/dist/cli-delegate/{chunk-FBKL6JWT.js → chunk-MMSGVZKV.js} +3 -3
  138. package/dist/cli-delegate/{chunk-GJ5BVHXM.js → chunk-PMEKGDED.js} +3 -3
@@ -8642,14 +8642,14 @@ var require_parser = __commonJS({
8642
8642
  case "scalar":
8643
8643
  case "single-quoted-scalar":
8644
8644
  case "double-quoted-scalar": {
8645
- const fs83 = this.flowScalar(this.type);
8645
+ const fs84 = this.flowScalar(this.type);
8646
8646
  if (atNextItem || it.value) {
8647
- map.items.push({ start, key: fs83, sep: [] });
8647
+ map.items.push({ start, key: fs84, sep: [] });
8648
8648
  this.onKeyLine = true;
8649
8649
  } else if (it.sep) {
8650
- this.stack.push(fs83);
8650
+ this.stack.push(fs84);
8651
8651
  } else {
8652
- Object.assign(it, { key: fs83, sep: [] });
8652
+ Object.assign(it, { key: fs84, sep: [] });
8653
8653
  this.onKeyLine = true;
8654
8654
  }
8655
8655
  return;
@@ -8777,13 +8777,13 @@ var require_parser = __commonJS({
8777
8777
  case "scalar":
8778
8778
  case "single-quoted-scalar":
8779
8779
  case "double-quoted-scalar": {
8780
- const fs83 = this.flowScalar(this.type);
8780
+ const fs84 = this.flowScalar(this.type);
8781
8781
  if (!it || it.value)
8782
- fc.items.push({ start: [], key: fs83, sep: [] });
8782
+ fc.items.push({ start: [], key: fs84, sep: [] });
8783
8783
  else if (it.sep)
8784
- this.stack.push(fs83);
8784
+ this.stack.push(fs84);
8785
8785
  else
8786
- Object.assign(it, { key: fs83, sep: [] });
8786
+ Object.assign(it, { key: fs84, sep: [] });
8787
8787
  return;
8788
8788
  }
8789
8789
  case "flow-map-end":
@@ -18807,6 +18807,99 @@ var init_archival_sweep = __esm({
18807
18807
  }
18808
18808
  });
18809
18809
 
18810
+ // src/agent-src/scripts/dashboard_mode.ts
18811
+ import { spawnSync as spawnSync5 } from "node:child_process";
18812
+ import * as fs22 from "node:fs";
18813
+ function isTrackedInGit(abs, repo_root) {
18814
+ const r = spawnSync5("git", ["ls-files", "--error-unmatch", "--", abs], {
18815
+ cwd: repo_root,
18816
+ encoding: "utf-8",
18817
+ timeout: 1e4
18818
+ });
18819
+ return r.status === 0;
18820
+ }
18821
+ function evaluateDashboardState(inp) {
18822
+ const { mode, present, trackedInGit, current, rel } = inp;
18823
+ const regen = inp.regen ?? REGEN;
18824
+ const noun = inp.noun ?? "dashboard";
18825
+ if (mode === "untracked" && trackedInGit) {
18826
+ return {
18827
+ stale: true,
18828
+ error: `\u274C ${rel} is still tracked by git, but this repository runs \`--untracked-mode\`. Untrack it, keeping the working-tree file:
18829
+ git rm --cached ${rel}
18830
+ `,
18831
+ ok: null
18832
+ };
18833
+ }
18834
+ if (!present) {
18835
+ if (mode === "tracked") {
18836
+ return {
18837
+ stale: true,
18838
+ error: `\u274C ${rel} is missing. ` + regen.replace("to regenerate", "to generate it") + ` If this repository deliberately does not commit the ${noun}, pass \`--untracked-mode\`.
18839
+ `,
18840
+ ok: null
18841
+ };
18842
+ }
18843
+ return {
18844
+ stale: false,
18845
+ error: null,
18846
+ ok: `\u2705 ${rel} is not committed here (--untracked-mode) and no stale copy is on disk.
18847
+ `
18848
+ };
18849
+ }
18850
+ if (!current) {
18851
+ return { stale: true, error: `\u274C ${rel} is stale. ${regen}
18852
+ `, ok: null };
18853
+ }
18854
+ return { stale: false, error: null, ok: `\u2705 ${rel} is up to date.
18855
+ ` };
18856
+ }
18857
+ function evaluateDashboardOnDisk(opts) {
18858
+ const present = fs22.existsSync(opts.target);
18859
+ return evaluateDashboardState({
18860
+ mode: opts.mode,
18861
+ present,
18862
+ trackedInGit: opts.mode === "untracked" && isTrackedInGit(opts.target, opts.repo_root),
18863
+ current: present && fs22.readFileSync(opts.target, { encoding: "utf-8" }) === opts.rendered,
18864
+ rel: opts.rel,
18865
+ ...opts.regen === void 0 ? {} : { regen: opts.regen },
18866
+ ...opts.noun === void 0 ? {} : { noun: opts.noun }
18867
+ });
18868
+ }
18869
+ function reportCheckVerdict(inp) {
18870
+ const { verdict, dashboardOnly } = inp;
18871
+ const complete = dashboardOnly ? [] : inp.complete;
18872
+ const pending = dashboardOnly ? [] : inp.pending;
18873
+ let err = verdict.error ?? "";
18874
+ if (complete.length) {
18875
+ err += "\u274C Completed roadmaps are still in `agents/roadmaps/` \u2014 move them to `agents/roadmaps/archive/` (per the `roadmap-progress-sync` rule):\n";
18876
+ for (const r of complete) err += ` - ${r.rel} (${r.done}/${r.total_active} done)
18877
+ `;
18878
+ }
18879
+ if (pending.length) {
18880
+ err += "\u274C Iron Law 3 \u2014 roadmaps with unresolved `[~]` deferred items must NOT auto-archive. Resolve via `roadmap-management \xA7 4b` (spawn follow-up, restore, or cancel):\n";
18881
+ for (const r of pending) {
18882
+ err += ` - ${r.rel} (${r.done}/${r.total_active} done \xB7 ${r.deferred} deferred)
18883
+ `;
18884
+ }
18885
+ }
18886
+ if (!dashboardOnly && inp.gatedCount > 0) inp.warnMergeGated();
18887
+ const rc = verdict.stale || complete.length > 0 || pending.length > 0 ? 1 : 0;
18888
+ return { rc, stdout: rc === 0 ? verdict.ok ?? "" : "", stderr: err };
18889
+ }
18890
+ function parseModeToken(tok) {
18891
+ if (tok === "--tracked-mode") return "tracked";
18892
+ if (tok === "--untracked-mode") return "untracked";
18893
+ return null;
18894
+ }
18895
+ var REGEN;
18896
+ var init_dashboard_mode = __esm({
18897
+ "src/agent-src/scripts/dashboard_mode.ts"() {
18898
+ "use strict";
18899
+ REGEN = "Run `./scripts-run src/agent-src/scripts/update_roadmap_progress` to regenerate (or `task roadmap-progress` in Taskfile projects).";
18900
+ }
18901
+ });
18902
+
18810
18903
  // src/agent-src/scripts/update_roadmap_progress.ts
18811
18904
  var update_roadmap_progress_exports = {};
18812
18905
  __export(update_roadmap_progress_exports, {
@@ -18836,8 +18929,8 @@ __export(update_roadmap_progress_exports, {
18836
18929
  unarchived_complete: () => unarchived_complete
18837
18930
  });
18838
18931
  import { createRequire as createRequire4 } from "node:module";
18839
- import { spawnSync as spawnSync5 } from "node:child_process";
18840
- import * as fs22 from "node:fs";
18932
+ import { spawnSync as spawnSync6 } from "node:child_process";
18933
+ import * as fs23 from "node:fs";
18841
18934
  import * as path22 from "node:path";
18842
18935
  import { fileURLToPath as fileURLToPath17, pathToFileURL as pathToFileURL9 } from "node:url";
18843
18936
  function _pyRound4(x) {
@@ -19080,7 +19173,7 @@ function blocker_needs_user(owner) {
19080
19173
  return /\buser\b/i.test(owner);
19081
19174
  }
19082
19175
  function parse_roadmap(p, roadmap_root) {
19083
- const text = fs22.readFileSync(p, { encoding: "utf-8" });
19176
+ const text = fs23.readFileSync(p, { encoding: "utf-8" });
19084
19177
  const phase_matches = [];
19085
19178
  PHASE_RE.lastIndex = 0;
19086
19179
  let pm;
@@ -19134,7 +19227,7 @@ function _rglobMdSorted3(root) {
19134
19227
  const walk = (dir) => {
19135
19228
  let entries;
19136
19229
  try {
19137
- entries = fs22.readdirSync(dir, { withFileTypes: true });
19230
+ entries = fs23.readdirSync(dir, { withFileTypes: true });
19138
19231
  } catch {
19139
19232
  return;
19140
19233
  }
@@ -19155,14 +19248,14 @@ function _rglobMdSorted3(root) {
19155
19248
  }
19156
19249
  function _isDir8(p) {
19157
19250
  try {
19158
- return fs22.statSync(p).isDirectory();
19251
+ return fs23.statSync(p).isDirectory();
19159
19252
  } catch {
19160
19253
  return false;
19161
19254
  }
19162
19255
  }
19163
19256
  function _isFile8(p) {
19164
19257
  try {
19165
- return fs22.statSync(p).isFile();
19258
+ return fs23.statSync(p).isFile();
19166
19259
  } catch {
19167
19260
  return false;
19168
19261
  }
@@ -19173,7 +19266,7 @@ function collect(roadmap_root) {
19173
19266
  if (!_isFile8(p) || !is_roadmap_candidate(p)) {
19174
19267
  continue;
19175
19268
  }
19176
- const text = fs22.readFileSync(p, { encoding: "utf-8" });
19269
+ const text = fs23.readFileSync(p, { encoding: "utf-8" });
19177
19270
  if (is_draft(parse_frontmatter2(text))) {
19178
19271
  continue;
19179
19272
  }
@@ -19188,7 +19281,7 @@ function collect_parked(roadmap_root) {
19188
19281
  const dir = path22.join(roadmap_root, "later");
19189
19282
  let names;
19190
19283
  try {
19191
- names = fs22.readdirSync(dir).sort();
19284
+ names = fs23.readdirSync(dir).sort();
19192
19285
  } catch {
19193
19286
  return [];
19194
19287
  }
@@ -19200,7 +19293,7 @@ function collect_parked(roadmap_root) {
19200
19293
  }
19201
19294
  let text;
19202
19295
  try {
19203
- text = fs22.readFileSync(full, { encoding: "utf-8" });
19296
+ text = fs23.readFileSync(full, { encoding: "utf-8" });
19204
19297
  } catch {
19205
19298
  continue;
19206
19299
  }
@@ -19260,7 +19353,7 @@ function pending_iron_law_3(roadmaps) {
19260
19353
  }
19261
19354
  function collect_bundles(repo_root) {
19262
19355
  const reg = path22.join(repo_root, "agents", "tickets", "_registry.yml");
19263
- if (!fs22.existsSync(reg)) {
19356
+ if (!fs23.existsSync(reg)) {
19264
19357
  return [];
19265
19358
  }
19266
19359
  let YAML9;
@@ -19271,7 +19364,7 @@ function collect_bundles(repo_root) {
19271
19364
  }
19272
19365
  let data;
19273
19366
  try {
19274
- data = YAML9.parse(fs22.readFileSync(reg, { encoding: "utf-8" }), { version: "1.1" }) ?? {};
19367
+ data = YAML9.parse(fs23.readFileSync(reg, { encoding: "utf-8" }), { version: "1.1" }) ?? {};
19275
19368
  } catch {
19276
19369
  return [];
19277
19370
  }
@@ -19285,7 +19378,7 @@ function collect_bundles(repo_root) {
19285
19378
  let n = 0;
19286
19379
  if (_isDir8(bdir)) {
19287
19380
  try {
19288
- n = fs22.readdirSync(bdir).filter((f) => f.startsWith("T-") && f.endsWith(".md")).length;
19381
+ n = fs23.readdirSync(bdir).filter((f) => f.startsWith("T-") && f.endsWith(".md")).length;
19289
19382
  } catch {
19290
19383
  n = 0;
19291
19384
  }
@@ -19319,7 +19412,7 @@ function render(roadmaps, bundles, roadmap_root) {
19319
19412
  // `.augment/scripts/...` that a script-less / non-Augment consumer does
19320
19413
  // not have. `task roadmap-progress` covers Taskfile projects; the bare
19321
19414
  // script name covers the rest.
19322
- "> Auto-generated \u2014 do not edit. Regenerate with `task roadmap-progress` or by running the `update_roadmap_progress` script for your install; rewritten on every roadmap create / execute / completion change (timestamp lives in git history).\n>\n" + header_meta
19415
+ "> Auto-generated \u2014 do not edit. Regenerate with `task roadmap-progress` or by running the `update_roadmap_progress` script for your install; rewritten on every roadmap create / execute / completion change. A repository that does not commit this file has no git history for it \u2014 regenerate to see the current state.\n>\n" + header_meta
19323
19416
  );
19324
19417
  lines.push("## Overall\n");
19325
19418
  lines.push(`**${total_done} / ${total_active} steps done \xB7 ${overall_pct}%**
@@ -19476,12 +19569,15 @@ _${resolvedCount} blocker${resolvedCount !== 1 ? "s" : ""} resolved._`
19476
19569
  return lines.join("\n") + "\n";
19477
19570
  }
19478
19571
  function _usage() {
19479
- return `usage: ${_PROG5} [-h] [--check] [--archive | --no-archive] [--repo-root REPO_ROOT]
19572
+ return `usage: ${_PROG5} [-h] [--check] [--tracked-mode | --untracked-mode]
19573
+ [--archive | --no-archive] [--repo-root REPO_ROOT] [--dashboard-only]
19480
19574
  `;
19481
19575
  }
19482
19576
  function _parseArgs5(argv) {
19483
19577
  let check = false;
19578
+ let mode = "tracked";
19484
19579
  let archive = false;
19580
+ let dashboard_only = false;
19485
19581
  let repo_root = process.cwd();
19486
19582
  const emitError = (msg) => {
19487
19583
  process.stderr.write(_usage());
@@ -19498,6 +19594,12 @@ function _parseArgs5(argv) {
19498
19594
  } else if (tok === "--check") {
19499
19595
  check = true;
19500
19596
  i += 1;
19597
+ } else if (parseModeToken(tok) !== null) {
19598
+ mode = parseModeToken(tok);
19599
+ i += 1;
19600
+ } else if (tok === "--dashboard-only") {
19601
+ dashboard_only = true;
19602
+ i += 1;
19501
19603
  } else if (tok === "--archive") {
19502
19604
  archive = true;
19503
19605
  i += 1;
@@ -19521,11 +19623,14 @@ function _parseArgs5(argv) {
19521
19623
  if (check && archive) {
19522
19624
  emitError("argument --archive: not allowed with --check");
19523
19625
  }
19524
- return { check, archive, repo_root };
19626
+ if (dashboard_only && !check) {
19627
+ emitError("argument --dashboard-only: only meaningful with --check");
19628
+ }
19629
+ return { check, mode, archive, repo_root, dashboard_only };
19525
19630
  }
19526
19631
  function _fallback_git_toplevel(repo_root) {
19527
19632
  try {
19528
- const r = spawnSync5("git", ["rev-parse", "--show-toplevel"], {
19633
+ const r = spawnSync6("git", ["rev-parse", "--show-toplevel"], {
19529
19634
  cwd: repo_root,
19530
19635
  encoding: "utf-8",
19531
19636
  timeout: 1e4
@@ -19570,11 +19675,9 @@ function main9(argv) {
19570
19675
  }
19571
19676
  const roadmaps = collect(roadmap_root);
19572
19677
  const new_text = render(roadmaps, collect_bundles(repo_root), roadmap_root);
19573
- const current = fs22.existsSync(target) ? fs22.readFileSync(target, { encoding: "utf-8" }) : "";
19574
19678
  const complete = unarchived_complete(roadmaps);
19575
19679
  const pending = pending_iron_law_3(roadmaps);
19576
19680
  const gated = merge_gated_pending(roadmaps);
19577
- const _relToRepo = (p) => _relPosix(repo_root, p);
19578
19681
  const _warn_merge_gated = () => {
19579
19682
  process.stderr.write(
19580
19683
  "\u23F3 Merge-gated roadmaps (every open item gated on a PR) \u2014 flip + archive the moment the gating PR merges (`roadmap-progress-sync` Iron Law 1):\n"
@@ -19588,46 +19691,22 @@ function main9(argv) {
19588
19691
  }
19589
19692
  };
19590
19693
  if (args.check) {
19591
- const stale = current !== new_text;
19592
- if (stale) {
19593
- process.stderr.write(
19594
- `\u274C ${_relToRepo(target)} is stale. Run \`node node_modules/.bin/tsx .augment/scripts/update_roadmap_progress.ts\` to regenerate (or \`task roadmap-progress\` in Taskfile projects).
19595
- `
19596
- );
19597
- }
19598
- if (complete.length) {
19599
- process.stderr.write(
19600
- "\u274C Completed roadmaps are still in `agents/roadmaps/` \u2014 move them to `agents/roadmaps/archive/` (per the `roadmap-progress-sync` rule):\n"
19601
- );
19602
- for (const r of complete) {
19603
- process.stderr.write(` - ${r.rel} (${r.done}/${r.total_active} done)
19604
- `);
19605
- }
19606
- }
19607
- if (pending.length) {
19608
- process.stderr.write(
19609
- "\u274C Iron Law 3 \u2014 roadmaps with unresolved `[~]` deferred items must NOT auto-archive. Resolve via `roadmap-management \xA7 4b` (spawn follow-up, restore, or cancel):\n"
19610
- );
19611
- for (const r of pending) {
19612
- process.stderr.write(
19613
- ` - ${r.rel} (${r.done}/${r.total_active} done \xB7 ${r.deferred} deferred)
19614
- `
19615
- );
19616
- }
19617
- }
19618
- if (gated.length) {
19619
- _warn_merge_gated();
19620
- }
19621
- if (stale || complete.length || pending.length) {
19622
- return 1;
19623
- }
19624
- process.stdout.write(`\u2705 ${_relToRepo(target)} is up to date.
19625
- `);
19626
- return 0;
19694
+ const rel = _relPosix(repo_root, target);
19695
+ const r = reportCheckVerdict({
19696
+ verdict: evaluateDashboardOnDisk({ mode: args.mode, target, repo_root, rendered: new_text, rel }),
19697
+ complete,
19698
+ pending,
19699
+ dashboardOnly: args.dashboard_only,
19700
+ warnMergeGated: _warn_merge_gated,
19701
+ gatedCount: gated.length
19702
+ });
19703
+ if (r.stderr) process.stderr.write(r.stderr);
19704
+ if (r.stdout) process.stdout.write(r.stdout);
19705
+ return r.rc;
19627
19706
  }
19628
- fs22.writeFileSync(target, new_text, { encoding: "utf-8" });
19707
+ fs23.writeFileSync(target, new_text, { encoding: "utf-8" });
19629
19708
  process.stdout.write(
19630
- `\u2705 Wrote ${_relToRepo(target)} \xB7 ${roadmaps.length} roadmap(s) \xB7 ${roadmaps.reduce((s, r) => s + r.done, 0)}/${roadmaps.reduce((s, r) => s + r.total_active, 0)} steps done.
19709
+ `\u2705 Wrote ${_relPosix(repo_root, target)} \xB7 ${roadmaps.length} roadmap(s) \xB7 ${roadmaps.reduce((s, r) => s + r.done, 0)}/${roadmaps.reduce((s, r) => s + r.total_active, 0)} steps done.
19631
19710
  `
19632
19711
  );
19633
19712
  if (sweep_out) {
@@ -19665,8 +19744,8 @@ function _isCliEntry9() {
19665
19744
  return true;
19666
19745
  }
19667
19746
  try {
19668
- const here = fs22.realpathSync(fileURLToPath17(import.meta.url));
19669
- const argv = fs22.realpathSync(path22.resolve(process.argv[1]));
19747
+ const here = fs23.realpathSync(fileURLToPath17(import.meta.url));
19748
+ const argv = fs23.realpathSync(path22.resolve(process.argv[1]));
19670
19749
  return here === argv;
19671
19750
  } catch {
19672
19751
  return false;
@@ -19677,6 +19756,7 @@ var init_update_roadmap_progress = __esm({
19677
19756
  "src/agent-src/scripts/update_roadmap_progress.ts"() {
19678
19757
  "use strict";
19679
19758
  init_archival_sweep();
19759
+ init_dashboard_mode();
19680
19760
  _HERE6 = fileURLToPath17(import.meta.url);
19681
19761
  _require3 = createRequire4(import.meta.url);
19682
19762
  CHECKBOX_RE = /^[ \t\n\r\f\v]*[-*][ \t\n\r\f\v]+\[([ xX~\-])\][ \t\n\r\f\v]/gm;
@@ -19835,13 +19915,13 @@ __export(archive_completed_roadmaps_exports, {
19835
19915
  archive_completed: () => archive_completed,
19836
19916
  main: () => main10
19837
19917
  });
19838
- import { spawnSync as spawnSync6 } from "node:child_process";
19839
- import * as fs23 from "node:fs";
19918
+ import { spawnSync as spawnSync7 } from "node:child_process";
19919
+ import * as fs24 from "node:fs";
19840
19920
  import * as path23 from "node:path";
19841
19921
  import process9 from "node:process";
19842
19922
  import { fileURLToPath as fileURLToPath18, pathToFileURL as pathToFileURL10 } from "node:url";
19843
19923
  function _run(cmd, cwd) {
19844
- const res = spawnSync6(cmd[0], cmd.slice(1), { cwd, encoding: "utf-8" });
19924
+ const res = spawnSync7(cmd[0], cmd.slice(1), { cwd, encoding: "utf-8" });
19845
19925
  if (res.error) {
19846
19926
  return { returncode: -1, stdout: res.stdout ?? "", stderr: String(res.error.message ?? "") };
19847
19927
  }
@@ -19907,7 +19987,7 @@ function _inbound_ref_rewrite(root, old_rel, new_rel, dry_run, tracked = true) {
19907
19987
  const fp = path23.join(root, rel);
19908
19988
  let text;
19909
19989
  try {
19910
- text = fs23.readFileSync(fp, { encoding: "utf-8" });
19990
+ text = fs24.readFileSync(fp, { encoding: "utf-8" });
19911
19991
  } catch {
19912
19992
  continue;
19913
19993
  }
@@ -19915,7 +19995,7 @@ function _inbound_ref_rewrite(root, old_rel, new_rel, dry_run, tracked = true) {
19915
19995
  continue;
19916
19996
  }
19917
19997
  if (!dry_run) {
19918
- fs23.writeFileSync(fp, _replaceAll(text, old_rel, new_rel), { encoding: "utf-8" });
19998
+ fs24.writeFileSync(fp, _replaceAll(text, old_rel, new_rel), { encoding: "utf-8" });
19919
19999
  }
19920
20000
  changed.push(rel);
19921
20001
  }
@@ -19929,13 +20009,13 @@ function _git_mv(root, src_rel, dst_rel, dry_run) {
19929
20009
  if (dry_run) {
19930
20010
  return { ok: true, tracked: true };
19931
20011
  }
19932
- fs23.mkdirSync(path23.dirname(dst), { recursive: true });
20012
+ fs24.mkdirSync(path23.dirname(dst), { recursive: true });
19933
20013
  const cp = _run(["git", "mv", src_rel, dst_rel], root);
19934
20014
  if (cp.returncode === 0) {
19935
20015
  return { ok: true, tracked: true };
19936
20016
  }
19937
20017
  try {
19938
- fs23.renameSync(path23.join(root, src_rel), dst);
20018
+ fs24.renameSync(path23.join(root, src_rel), dst);
19939
20019
  return { ok: true, tracked: false };
19940
20020
  } catch {
19941
20021
  return { ok: false, tracked: false };
@@ -19947,7 +20027,7 @@ function _fs_grep_files(root, needle) {
19947
20027
  const walk = (dirAbs) => {
19948
20028
  let entries;
19949
20029
  try {
19950
- entries = fs23.readdirSync(dirAbs, { withFileTypes: true });
20030
+ entries = fs24.readdirSync(dirAbs, { withFileTypes: true });
19951
20031
  } catch {
19952
20032
  return;
19953
20033
  }
@@ -19961,7 +20041,7 @@ function _fs_grep_files(root, needle) {
19961
20041
  } else if (e.isFile() && /\.(md|json|ya?ml|ts|js|txt)$/.test(e.name)) {
19962
20042
  let text;
19963
20043
  try {
19964
- text = fs23.readFileSync(abs, { encoding: "utf-8" });
20044
+ text = fs24.readFileSync(abs, { encoding: "utf-8" });
19965
20045
  } catch {
19966
20046
  continue;
19967
20047
  }
@@ -20023,14 +20103,14 @@ function archive_completed(root, opts) {
20023
20103
  }
20024
20104
  function _isDir9(p) {
20025
20105
  try {
20026
- return fs23.statSync(p).isDirectory();
20106
+ return fs24.statSync(p).isDirectory();
20027
20107
  } catch {
20028
20108
  return false;
20029
20109
  }
20030
20110
  }
20031
20111
  function _isFile9(p) {
20032
20112
  try {
20033
- return fs23.statSync(p).isFile();
20113
+ return fs24.statSync(p).isFile();
20034
20114
  } catch {
20035
20115
  return false;
20036
20116
  }
@@ -20041,10 +20121,6 @@ function _regen_dashboard(root, dry_run) {
20041
20121
  }
20042
20122
  const script = path23.join(path23.dirname(_HERE7), "update_roadmap_progress.ts");
20043
20123
  _runTwin(root, script);
20044
- const dash = path23.join(root, "agents", "roadmaps-progress.md");
20045
- if (_isFile9(dash)) {
20046
- _run(["git", "add", "--", "agents/roadmaps-progress.md"], root);
20047
- }
20048
20124
  }
20049
20125
  function _regen_archive_index(root, dry_run) {
20050
20126
  if (dry_run) {
@@ -20066,8 +20142,8 @@ function _runTwin(root, script) {
20066
20142
  let dir = path23.dirname(_HERE7);
20067
20143
  for (; ; ) {
20068
20144
  const candidate = path23.join(dir, "node_modules", ".bin", binName);
20069
- if (fs23.existsSync(candidate)) {
20070
- spawnSync6(candidate, [script], { cwd: root, encoding: "utf-8" });
20145
+ if (fs24.existsSync(candidate)) {
20146
+ spawnSync7(candidate, [script], { cwd: root, encoding: "utf-8" });
20071
20147
  return;
20072
20148
  }
20073
20149
  const parent = path23.dirname(dir);
@@ -20076,7 +20152,7 @@ function _runTwin(root, script) {
20076
20152
  }
20077
20153
  dir = parent;
20078
20154
  }
20079
- spawnSync6("npx", ["tsx", script], { cwd: root, encoding: "utf-8" });
20155
+ spawnSync7("npx", ["tsx", script], { cwd: root, encoding: "utf-8" });
20080
20156
  }
20081
20157
  function _usage2() {
20082
20158
  return `usage: ${_PROG6} [-h] [--all] [--base BASE] [--dry-run] [--repo-root REPO_ROOT]
@@ -20162,8 +20238,8 @@ function _isCliEntry10() {
20162
20238
  return true;
20163
20239
  }
20164
20240
  try {
20165
- const here = fs23.realpathSync(fileURLToPath18(import.meta.url));
20166
- const argv = fs23.realpathSync(path23.resolve(process9.argv[1]));
20241
+ const here = fs24.realpathSync(fileURLToPath18(import.meta.url));
20242
+ const argv = fs24.realpathSync(path23.resolve(process9.argv[1]));
20167
20243
  return here === argv;
20168
20244
  } catch {
20169
20245
  return false;
@@ -20211,20 +20287,20 @@ __export(generate_capabilities_index_exports, {
20211
20287
  build: () => build,
20212
20288
  main: () => main11
20213
20289
  });
20214
- import * as fs24 from "node:fs";
20290
+ import * as fs25 from "node:fs";
20215
20291
  import * as path24 from "node:path";
20216
20292
  import process10 from "node:process";
20217
20293
  import { fileURLToPath as fileURLToPath19, pathToFileURL as pathToFileURL11 } from "node:url";
20218
20294
  function _isFile10(p) {
20219
20295
  try {
20220
- return fs24.statSync(p).isFile();
20296
+ return fs25.statSync(p).isFile();
20221
20297
  } catch {
20222
20298
  return false;
20223
20299
  }
20224
20300
  }
20225
20301
  function _exists4(p) {
20226
20302
  try {
20227
- fs24.statSync(p);
20303
+ fs25.statSync(p);
20228
20304
  return true;
20229
20305
  } catch {
20230
20306
  return false;
@@ -20260,7 +20336,7 @@ function _coverage_band(count) {
20260
20336
  function _load_packs() {
20261
20337
  let raw;
20262
20338
  try {
20263
- raw = (0, import_yaml4.parse)(fs24.readFileSync(PACKS_YML, "utf-8"), { version: "1.1" });
20339
+ raw = (0, import_yaml4.parse)(fs25.readFileSync(PACKS_YML, "utf-8"), { version: "1.1" });
20264
20340
  } catch {
20265
20341
  raw = null;
20266
20342
  }
@@ -20284,7 +20360,7 @@ function _sortedPosix(items) {
20284
20360
  function _globSkillMds() {
20285
20361
  let entries;
20286
20362
  try {
20287
- entries = fs24.readdirSync(SKILLS_DIR, { withFileTypes: true });
20363
+ entries = fs25.readdirSync(SKILLS_DIR, { withFileTypes: true });
20288
20364
  } catch {
20289
20365
  return [];
20290
20366
  }
@@ -20293,7 +20369,7 @@ function _globSkillMds() {
20293
20369
  const dir = path24.join(SKILLS_DIR, ent.name);
20294
20370
  const isDir4 = ent.isDirectory() || ent.isSymbolicLink() && (() => {
20295
20371
  try {
20296
- return fs24.statSync(dir).isDirectory();
20372
+ return fs25.statSync(dir).isDirectory();
20297
20373
  } catch {
20298
20374
  return false;
20299
20375
  }
@@ -20317,7 +20393,7 @@ function _nameOr(v, fallback) {
20317
20393
  function _skill_packs() {
20318
20394
  const byPack = {};
20319
20395
  for (const skillMd of _globSkillMds()) {
20320
- const [fm] = parse_frontmatter(fs24.readFileSync(skillMd, "utf-8"));
20396
+ const [fm] = parse_frontmatter(fs25.readFileSync(skillMd, "utf-8"));
20321
20397
  if (!fm || !_pyTruthy(fm)) {
20322
20398
  continue;
20323
20399
  }
@@ -20339,7 +20415,7 @@ function _skill_packs() {
20339
20415
  function _command_packs() {
20340
20416
  const byPack = {};
20341
20417
  for (const cmdMd of iter_commands()) {
20342
- const [fm] = parse_frontmatter(fs24.readFileSync(cmdMd, "utf-8"));
20418
+ const [fm] = parse_frontmatter(fs25.readFileSync(cmdMd, "utf-8"));
20343
20419
  if (!fm || !_pyTruthy(fm)) {
20344
20420
  continue;
20345
20421
  }
@@ -20550,7 +20626,7 @@ function main11(argv = null) {
20550
20626
  return 1;
20551
20627
  }
20552
20628
  if (args.check) {
20553
- const onDisk = _exists4(OUT) ? fs24.readFileSync(OUT, "utf-8") : "";
20629
+ const onDisk = _exists4(OUT) ? fs25.readFileSync(OUT, "utf-8") : "";
20554
20630
  if (onDisk !== content) {
20555
20631
  process10.stderr.write(
20556
20632
  "\u274C CAPABILITIES.yaml is stale \u2014 run `./scripts-run src/scripts/generate_capabilities_index`\n"
@@ -20563,7 +20639,7 @@ function main11(argv = null) {
20563
20639
  );
20564
20640
  return 0;
20565
20641
  }
20566
- fs24.writeFileSync(OUT, content, "utf-8");
20642
+ fs25.writeFileSync(OUT, content, "utf-8");
20567
20643
  process10.stdout.write(
20568
20644
  `\u2705 Wrote CAPABILITIES.yaml \u2014 ${_kib(size)} KB, ${_msFmt(elapsed)}ms \xB7 ${_load_packs().length} areas.
20569
20645
  `
@@ -20579,8 +20655,8 @@ function _isCliEntry11() {
20579
20655
  return true;
20580
20656
  }
20581
20657
  try {
20582
- const here = fs24.realpathSync(fileURLToPath19(import.meta.url));
20583
- const argv = fs24.realpathSync(path24.resolve(process10.argv[1]));
20658
+ const here = fs25.realpathSync(fileURLToPath19(import.meta.url));
20659
+ const argv = fs25.realpathSync(path24.resolve(process10.argv[1]));
20584
20660
  return here === argv;
20585
20661
  } catch {
20586
20662
  return false;
@@ -20609,7 +20685,7 @@ var init_generate_capabilities_index = __esm({
20609
20685
  });
20610
20686
 
20611
20687
  // src/scripts/_lib/claude_plugin.ts
20612
- import * as fs25 from "node:fs";
20688
+ import * as fs26 from "node:fs";
20613
20689
  import * as os4 from "node:os";
20614
20690
  import * as path25 from "node:path";
20615
20691
  import process11 from "node:process";
@@ -20621,7 +20697,7 @@ function _plugin_id_recorded(plugin_id) {
20621
20697
  const p = path25.join(claude_config_dir(), "plugins", "installed_plugins.json");
20622
20698
  let data;
20623
20699
  try {
20624
- data = JSON.parse(fs25.readFileSync(p, "utf-8"));
20700
+ data = JSON.parse(fs26.readFileSync(p, "utf-8"));
20625
20701
  } catch {
20626
20702
  return false;
20627
20703
  }
@@ -20639,7 +20715,7 @@ function _plugin_marketplaces(plugin_id) {
20639
20715
  const p = path25.join(claude_config_dir(), "plugins", "installed_plugins.json");
20640
20716
  let data;
20641
20717
  try {
20642
- data = JSON.parse(fs25.readFileSync(p, "utf-8"));
20718
+ data = JSON.parse(fs26.readFileSync(p, "utf-8"));
20643
20719
  } catch {
20644
20720
  return [];
20645
20721
  }
@@ -20653,7 +20729,7 @@ function _marketplace_source_repo(marketplace) {
20653
20729
  const p = path25.join(claude_config_dir(), "plugins", "known_marketplaces.json");
20654
20730
  let data;
20655
20731
  try {
20656
- data = JSON.parse(fs25.readFileSync(p, "utf-8"));
20732
+ data = JSON.parse(fs26.readFileSync(p, "utf-8"));
20657
20733
  } catch {
20658
20734
  return null;
20659
20735
  }
@@ -20687,7 +20763,7 @@ function claude_plugin_snapshot_version() {
20687
20763
  );
20688
20764
  let data;
20689
20765
  try {
20690
- data = JSON.parse(fs25.readFileSync(p, "utf-8"));
20766
+ data = JSON.parse(fs26.readFileSync(p, "utf-8"));
20691
20767
  } catch {
20692
20768
  return null;
20693
20769
  }
@@ -20724,7 +20800,7 @@ import {
20724
20800
  fsyncSync,
20725
20801
  mkdirSync as mkdirSync8,
20726
20802
  openSync,
20727
- readFileSync as readFileSync21,
20803
+ readFileSync as readFileSync22,
20728
20804
  renameSync as renameSync4,
20729
20805
  unlinkSync as unlinkSync2,
20730
20806
  writeSync
@@ -20761,7 +20837,7 @@ function atomicWriteFile(target, data, options = {}) {
20761
20837
  function atomicAppendLine(target, line) {
20762
20838
  let existing = "";
20763
20839
  try {
20764
- existing = readFileSync21(target, "utf8");
20840
+ existing = readFileSync22(target, "utf8");
20765
20841
  } catch {
20766
20842
  existing = "";
20767
20843
  }
@@ -20779,12 +20855,12 @@ var init_atomic = __esm({
20779
20855
  });
20780
20856
 
20781
20857
  // src/scripts/_lib/claude_settings_hooks.ts
20782
- import * as fs26 from "node:fs";
20858
+ import * as fs27 from "node:fs";
20783
20859
  function _yaml_parse(text) {
20784
20860
  return YAML3.parse(text);
20785
20861
  }
20786
20862
  function build_claude_hook_matrix(manifest_path2) {
20787
- const raw = fs26.readFileSync(manifest_path2, "utf8");
20863
+ const raw = fs27.readFileSync(manifest_path2, "utf8");
20788
20864
  const manifest = _yaml_parse(raw) ?? {};
20789
20865
  const hook_spec = manifest["schema_version"] ?? 1;
20790
20866
  const platforms = manifest["platforms"] ?? {};
@@ -20816,12 +20892,12 @@ var init_claude_settings_hooks = __esm({
20816
20892
  });
20817
20893
 
20818
20894
  // src/scripts/_lib/cli_wrapper.ts
20819
- import fs27 from "node:fs";
20895
+ import fs28 from "node:fs";
20820
20896
  import path26 from "node:path";
20821
20897
  import { fileURLToPath as fileURLToPath20 } from "node:url";
20822
20898
  function _is_file2(p) {
20823
20899
  try {
20824
- return fs27.statSync(p).isFile();
20900
+ return fs28.statSync(p).isFile();
20825
20901
  } catch {
20826
20902
  return false;
20827
20903
  }
@@ -20832,8 +20908,8 @@ function _target(project_root) {
20832
20908
  function install_cli_wrapper(project_root) {
20833
20909
  if (!_is_file2(_TEMPLATE)) return null;
20834
20910
  const target = _target(project_root);
20835
- fs27.copyFileSync(_TEMPLATE, target);
20836
- fs27.chmodSync(target, 493);
20911
+ fs28.copyFileSync(_TEMPLATE, target);
20912
+ fs28.chmodSync(target, 493);
20837
20913
  return target;
20838
20914
  }
20839
20915
  var _PACKAGE_ROOT2, _TEMPLATE;
@@ -20876,7 +20952,7 @@ __export(sync_gitignore_exports, {
20876
20952
  template_entries: () => template_entries,
20877
20953
  unified_diff: () => unified_diff
20878
20954
  });
20879
- import * as fs28 from "node:fs";
20955
+ import * as fs29 from "node:fs";
20880
20956
  import * as path27 from "node:path";
20881
20957
  import process12 from "node:process";
20882
20958
  import { fileURLToPath as fileURLToPath21, pathToFileURL as pathToFileURL12 } from "node:url";
@@ -20889,7 +20965,7 @@ function _is_entry(ln) {
20889
20965
  }
20890
20966
  function _isFile11(p) {
20891
20967
  try {
20892
- return fs28.statSync(p).isFile();
20968
+ return fs29.statSync(p).isFile();
20893
20969
  } catch {
20894
20970
  return false;
20895
20971
  }
@@ -20904,7 +20980,7 @@ function load_template(p) {
20904
20980
  if (!_isFile11(p)) {
20905
20981
  throw new TemplateNotFoundError(p);
20906
20982
  }
20907
- const text = fs28.readFileSync(p, "utf-8");
20983
+ const text = fs29.readFileSync(p, "utf-8");
20908
20984
  return _splitlines4(text).map(_strip4);
20909
20985
  }
20910
20986
  function find_block(lines) {
@@ -21241,7 +21317,7 @@ function main12(argv) {
21241
21317
  let existing_text;
21242
21318
  let existing_lines;
21243
21319
  if (_isFile11(target)) {
21244
- existing_text = fs28.readFileSync(target, "utf-8");
21320
+ existing_text = fs29.readFileSync(target, "utf-8");
21245
21321
  existing_lines = _splitlines4(existing_text).map(_strip4);
21246
21322
  } else {
21247
21323
  existing_text = "";
@@ -21280,8 +21356,8 @@ function main12(argv) {
21280
21356
  }
21281
21357
  return 0;
21282
21358
  }
21283
- fs28.mkdirSync(path27.dirname(path27.resolve(target)), { recursive: true });
21284
- fs28.writeFileSync(target, new_text, "utf-8");
21359
+ fs29.mkdirSync(path27.dirname(path27.resolve(target)), { recursive: true });
21360
+ fs29.writeFileSync(target, new_text, "utf-8");
21285
21361
  if (!args.quiet) {
21286
21362
  const action = args.replace ? "replaced" : "updated";
21287
21363
  process12.stdout.write(
@@ -21306,8 +21382,8 @@ function _isCliEntry12() {
21306
21382
  return true;
21307
21383
  }
21308
21384
  try {
21309
- const here = fs28.realpathSync(fileURLToPath21(import.meta.url));
21310
- const argv = fs28.realpathSync(path27.resolve(process12.argv[1]));
21385
+ const here = fs29.realpathSync(fileURLToPath21(import.meta.url));
21386
+ const argv = fs29.realpathSync(path27.resolve(process12.argv[1]));
21311
21387
  return here === argv;
21312
21388
  } catch {
21313
21389
  return false;
@@ -21376,7 +21452,7 @@ __export(sync_gitattributes_exports, {
21376
21452
  sync_block: () => sync_block2,
21377
21453
  template_entries: () => template_entries2
21378
21454
  });
21379
- import * as fs29 from "node:fs";
21455
+ import * as fs30 from "node:fs";
21380
21456
  import * as path28 from "node:path";
21381
21457
  import process13 from "node:process";
21382
21458
  import { fileURLToPath as fileURLToPath22, pathToFileURL as pathToFileURL13 } from "node:url";
@@ -21389,7 +21465,7 @@ function _is_entry2(ln) {
21389
21465
  }
21390
21466
  function _isFile12(p) {
21391
21467
  try {
21392
- return fs29.statSync(p).isFile();
21468
+ return fs30.statSync(p).isFile();
21393
21469
  } catch {
21394
21470
  return false;
21395
21471
  }
@@ -21404,7 +21480,7 @@ function load_template2(p) {
21404
21480
  if (!_isFile12(p)) {
21405
21481
  throw new TemplateNotFoundError2(p);
21406
21482
  }
21407
- const text = fs29.readFileSync(p, "utf-8");
21483
+ const text = fs30.readFileSync(p, "utf-8");
21408
21484
  return _splitlines5(text).map(_strip5);
21409
21485
  }
21410
21486
  function find_block2(lines) {
@@ -21526,7 +21602,7 @@ function main13(argv) {
21526
21602
  let existing_text;
21527
21603
  let existing_lines;
21528
21604
  if (_isFile12(target)) {
21529
- existing_text = fs29.readFileSync(target, "utf-8");
21605
+ existing_text = fs30.readFileSync(target, "utf-8");
21530
21606
  existing_lines = _splitlines5(existing_text).map(_strip5);
21531
21607
  } else {
21532
21608
  existing_text = "";
@@ -21552,8 +21628,8 @@ function main13(argv) {
21552
21628
  }
21553
21629
  return 1;
21554
21630
  }
21555
- fs29.mkdirSync(path28.dirname(path28.resolve(target)), { recursive: true });
21556
- fs29.writeFileSync(target, new_text, "utf-8");
21631
+ fs30.mkdirSync(path28.dirname(path28.resolve(target)), { recursive: true });
21632
+ fs30.writeFileSync(target, new_text, "utf-8");
21557
21633
  if (!args.quiet) {
21558
21634
  process13.stdout.write(
21559
21635
  `\u2705 ${target}: updated block (${added.length} entr${added.length === 1 ? "y" : "ies"} added)
@@ -21571,8 +21647,8 @@ function _isCliEntry13() {
21571
21647
  return true;
21572
21648
  }
21573
21649
  try {
21574
- const here = fs29.realpathSync(fileURLToPath22(import.meta.url));
21575
- const argv = fs29.realpathSync(path28.resolve(process13.argv[1]));
21650
+ const here = fs30.realpathSync(fileURLToPath22(import.meta.url));
21651
+ const argv = fs30.realpathSync(path28.resolve(process13.argv[1]));
21576
21652
  return here === argv;
21577
21653
  } catch {
21578
21654
  return false;
@@ -21608,7 +21684,7 @@ var init_sync_gitattributes = __esm({
21608
21684
  });
21609
21685
 
21610
21686
  // src/scripts/_lib/package_root.ts
21611
- import * as fs30 from "node:fs";
21687
+ import * as fs31 from "node:fs";
21612
21688
  import * as path29 from "node:path";
21613
21689
  import { fileURLToPath as fileURLToPath23 } from "node:url";
21614
21690
  function resolvePackageRoot(fromUrlOrPath, legacyHops = 3) {
@@ -21617,9 +21693,9 @@ function resolvePackageRoot(fromUrlOrPath, legacyHops = 3) {
21617
21693
  let dir = startDir;
21618
21694
  for (let i = 0; i < MAX_ASCENT; i++) {
21619
21695
  const manifest = path29.join(dir, "package.json");
21620
- if (fs30.existsSync(manifest)) {
21696
+ if (fs31.existsSync(manifest)) {
21621
21697
  try {
21622
- const parsed = JSON.parse(fs30.readFileSync(manifest, "utf8"));
21698
+ const parsed = JSON.parse(fs31.readFileSync(manifest, "utf8"));
21623
21699
  if (parsed.name === PACKAGE_NAME) {
21624
21700
  return dir;
21625
21701
  }
@@ -21644,9 +21720,9 @@ var init_package_root = __esm({
21644
21720
  });
21645
21721
 
21646
21722
  // src/scripts/_cli/cmd_refresh.ts
21647
- import * as fs31 from "node:fs";
21723
+ import * as fs32 from "node:fs";
21648
21724
  import * as path30 from "node:path";
21649
- import { spawnSync as spawnSync7 } from "node:child_process";
21725
+ import { spawnSync as spawnSync8 } from "node:child_process";
21650
21726
  import process14 from "node:process";
21651
21727
  import { fileURLToPath as fileURLToPath24, pathToFileURL as pathToFileURL14 } from "node:url";
21652
21728
  function _print2(out, line = "") {
@@ -21654,31 +21730,31 @@ function _print2(out, line = "") {
21654
21730
  }
21655
21731
  function _isFile13(p) {
21656
21732
  try {
21657
- return fs31.statSync(p).isFile();
21733
+ return fs32.statSync(p).isFile();
21658
21734
  } catch {
21659
21735
  return false;
21660
21736
  }
21661
21737
  }
21662
21738
  function _isDir10(p) {
21663
21739
  try {
21664
- return fs31.statSync(p).isDirectory();
21740
+ return fs32.statSync(p).isDirectory();
21665
21741
  } catch {
21666
21742
  return false;
21667
21743
  }
21668
21744
  }
21669
21745
  function _exists5(p) {
21670
21746
  try {
21671
- fs31.statSync(p);
21747
+ fs32.statSync(p);
21672
21748
  return true;
21673
21749
  } catch {
21674
21750
  return false;
21675
21751
  }
21676
21752
  }
21677
21753
  function _readText(p) {
21678
- return fs31.readFileSync(p, { encoding: "utf-8" });
21754
+ return fs32.readFileSync(p, { encoding: "utf-8" });
21679
21755
  }
21680
21756
  function _writeText(p, text) {
21681
- fs31.writeFileSync(p, text, { encoding: "utf-8" });
21757
+ fs32.writeFileSync(p, text, { encoding: "utf-8" });
21682
21758
  }
21683
21759
  function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
21684
21760
  const env_map = env ?? process14.env;
@@ -21687,14 +21763,14 @@ function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
21687
21763
  const target = path30.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
21688
21764
  if (!_isFile13(target)) return null;
21689
21765
  try {
21690
- fs31.rmSync(target);
21766
+ fs32.rmSync(target);
21691
21767
  } catch {
21692
21768
  return null;
21693
21769
  }
21694
21770
  return target;
21695
21771
  }
21696
21772
  function _default_runner(cmd) {
21697
- const r = spawnSync7(cmd[0], cmd.slice(1), { stdio: "inherit" });
21773
+ const r = spawnSync8(cmd[0], cmd.slice(1), { stdio: "inherit" });
21698
21774
  if (r.error) {
21699
21775
  _stderr.write(`agent-config refresh: cannot run ${cmd[0]}: ${osErrorStr(r.error)}
21700
21776
  `);
@@ -21746,7 +21822,7 @@ function _glob_packages_uncondensed(project_root) {
21746
21822
  const packages = path30.join(project_root, "packages");
21747
21823
  let entries;
21748
21824
  try {
21749
- entries = fs31.readdirSync(packages);
21825
+ entries = fs32.readdirSync(packages);
21750
21826
  } catch {
21751
21827
  return [];
21752
21828
  }
@@ -21772,7 +21848,7 @@ function _refresh_project(project_root, out, err) {
21772
21848
  _print2(out, `\u2705 removed legacy bridge marker: ${removed}`);
21773
21849
  }
21774
21850
  const overrides = path30.join(project_root, "agents", "overrides");
21775
- fs31.mkdirSync(overrides, { recursive: true });
21851
+ fs32.mkdirSync(overrides, { recursive: true });
21776
21852
  const keep = path30.join(overrides, "README.md");
21777
21853
  if (!_exists5(keep)) {
21778
21854
  _writeText(
@@ -21912,8 +21988,8 @@ function _isCliEntry14() {
21912
21988
  return true;
21913
21989
  }
21914
21990
  try {
21915
- const here = fs31.realpathSync(fileURLToPath24(import.meta.url));
21916
- const argv = fs31.realpathSync(path30.resolve(process14.argv[1]));
21991
+ const here = fs32.realpathSync(fileURLToPath24(import.meta.url));
21992
+ const argv = fs32.realpathSync(path30.resolve(process14.argv[1]));
21917
21993
  return here === argv;
21918
21994
  } catch {
21919
21995
  return false;
@@ -21965,7 +22041,7 @@ var init_install_layout = __esm({
21965
22041
  });
21966
22042
 
21967
22043
  // src/scripts/_lib/installed_lock.ts
21968
- import * as fs32 from "node:fs";
22044
+ import * as fs33 from "node:fs";
21969
22045
  import * as os5 from "node:os";
21970
22046
  import * as path31 from "node:path";
21971
22047
  function _default_lockfile() {
@@ -21996,7 +22072,7 @@ function read_lockfile(path81) {
21996
22072
  const target = path81 ?? lockfile_path();
21997
22073
  let text;
21998
22074
  try {
21999
- text = fs32.readFileSync(target, { encoding: "utf-8" });
22075
+ text = fs33.readFileSync(target, { encoding: "utf-8" });
22000
22076
  } catch {
22001
22077
  return null;
22002
22078
  }
@@ -22073,7 +22149,7 @@ var init_installed_lock = __esm({
22073
22149
  });
22074
22150
 
22075
22151
  // src/scripts/_lib/fs_atomic.ts
22076
- import fs33 from "node:fs";
22152
+ import fs34 from "node:fs";
22077
22153
  import path32 from "node:path";
22078
22154
  import { randomBytes as randomBytes2 } from "node:crypto";
22079
22155
  function _normalize_encoding(encoding) {
@@ -22092,7 +22168,7 @@ function write_atomic(p, data, options = {}) {
22092
22168
  const encoding = options.encoding ?? "utf-8";
22093
22169
  const target = path32.normalize(p);
22094
22170
  const parent = path32.dirname(target);
22095
- fs33.mkdirSync(parent, { recursive: true });
22171
+ fs34.mkdirSync(parent, { recursive: true });
22096
22172
  let payload;
22097
22173
  if (typeof data === "string") {
22098
22174
  payload = Buffer.from(data, _normalize_encoding(encoding));
@@ -22111,7 +22187,7 @@ function write_atomic(p, data, options = {}) {
22111
22187
  `.${path32.basename(target)}.tmp.${randomBytes2(6).toString("hex")}`
22112
22188
  );
22113
22189
  try {
22114
- fd = fs33.openSync(tmp_path, "wx", 384);
22190
+ fd = fs34.openSync(tmp_path, "wx", 384);
22115
22191
  break;
22116
22192
  } catch (err) {
22117
22193
  if (err.code === "EEXIST") continue;
@@ -22125,24 +22201,24 @@ function write_atomic(p, data, options = {}) {
22125
22201
  try {
22126
22202
  let offset = 0;
22127
22203
  while (offset < payload.length) {
22128
- offset += fs33.writeSync(fd, payload, offset, payload.length - offset);
22204
+ offset += fs34.writeSync(fd, payload, offset, payload.length - offset);
22129
22205
  }
22130
22206
  try {
22131
- fs33.fsyncSync(fd);
22207
+ fs34.fsyncSync(fd);
22132
22208
  } catch {
22133
22209
  }
22134
- fs33.closeSync(fd);
22210
+ fs34.closeSync(fd);
22135
22211
  closed = true;
22136
- fs33.renameSync(tmp_path, target);
22212
+ fs34.renameSync(tmp_path, target);
22137
22213
  } catch (err) {
22138
22214
  if (!closed) {
22139
22215
  try {
22140
- fs33.closeSync(fd);
22216
+ fs34.closeSync(fd);
22141
22217
  } catch {
22142
22218
  }
22143
22219
  }
22144
22220
  try {
22145
- fs33.unlinkSync(tmp_path);
22221
+ fs34.unlinkSync(tmp_path);
22146
22222
  } catch {
22147
22223
  }
22148
22224
  throw err;
@@ -22153,17 +22229,17 @@ function write_atomic(p, data, options = {}) {
22153
22229
  function _fsync_dir(directory) {
22154
22230
  let dir_fd;
22155
22231
  try {
22156
- dir_fd = fs33.openSync(directory, fs33.constants.O_RDONLY);
22232
+ dir_fd = fs34.openSync(directory, fs34.constants.O_RDONLY);
22157
22233
  } catch {
22158
22234
  return;
22159
22235
  }
22160
22236
  try {
22161
22237
  try {
22162
- fs33.fsyncSync(dir_fd);
22238
+ fs34.fsyncSync(dir_fd);
22163
22239
  } catch {
22164
22240
  }
22165
22241
  } finally {
22166
- fs33.closeSync(dir_fd);
22242
+ fs34.closeSync(dir_fd);
22167
22243
  }
22168
22244
  }
22169
22245
  var init_fs_atomic = __esm({
@@ -22190,7 +22266,7 @@ __export(installed_tools_exports, {
22190
22266
  upsert_tool: () => upsert_tool,
22191
22267
  write_manifest: () => write_manifest
22192
22268
  });
22193
- import * as fs34 from "node:fs";
22269
+ import * as fs35 from "node:fs";
22194
22270
  import * as os6 from "node:os";
22195
22271
  import * as fsPath from "node:path";
22196
22272
  function expanduser3(p) {
@@ -22221,7 +22297,7 @@ function read_manifest(path81) {
22221
22297
  return _normalise_v2_shape(data);
22222
22298
  }
22223
22299
  function require_read_text(path81) {
22224
- return fs34.readFileSync(path81, { encoding: "utf-8" });
22300
+ return fs35.readFileSync(path81, { encoding: "utf-8" });
22225
22301
  }
22226
22302
  function _normalise_v2_shape(data) {
22227
22303
  if (data["tools"] === void 0 || data["tools"] === null) {
@@ -22534,7 +22610,7 @@ __export(global_deploy_inventory_exports, {
22534
22610
  save_inventory: () => save_inventory
22535
22611
  });
22536
22612
  import { randomBytes as randomBytes3 } from "node:crypto";
22537
- import * as fs35 from "node:fs";
22613
+ import * as fs36 from "node:fs";
22538
22614
  import * as os7 from "node:os";
22539
22615
  import * as path33 from "node:path";
22540
22616
  function expanduser4(p) {
@@ -22548,14 +22624,14 @@ function expanduser4(p) {
22548
22624
  }
22549
22625
  function resolve_path(p) {
22550
22626
  try {
22551
- return fs35.realpathSync(p);
22627
+ return fs36.realpathSync(p);
22552
22628
  } catch {
22553
22629
  const abs = path33.resolve(p);
22554
22630
  const parts = abs.split(path33.sep);
22555
22631
  for (let i = parts.length; i > 0; i -= 1) {
22556
22632
  const prefix = parts.slice(0, i).join(path33.sep) || path33.sep;
22557
22633
  try {
22558
- const real = fs35.realpathSync(prefix);
22634
+ const real = fs36.realpathSync(prefix);
22559
22635
  const rest = parts.slice(i);
22560
22636
  return rest.length > 0 ? path33.join(real, ...rest) : real;
22561
22637
  } catch {
@@ -22567,7 +22643,7 @@ function resolve_path(p) {
22567
22643
  }
22568
22644
  function path_exists(p) {
22569
22645
  try {
22570
- fs35.statSync(p);
22646
+ fs36.statSync(p);
22571
22647
  return true;
22572
22648
  } catch {
22573
22649
  return false;
@@ -22585,7 +22661,7 @@ function load_inventory(p) {
22585
22661
  const target = p ?? inventory_path();
22586
22662
  let data;
22587
22663
  try {
22588
- data = JSON.parse(fs35.readFileSync(target, { encoding: "utf-8" }));
22664
+ data = JSON.parse(fs36.readFileSync(target, { encoding: "utf-8" }));
22589
22665
  } catch {
22590
22666
  return { schema_version: SCHEMA_VERSION5, tools: {} };
22591
22667
  }
@@ -22596,7 +22672,7 @@ function load_inventory(p) {
22596
22672
  }
22597
22673
  function save_inventory(data, p) {
22598
22674
  const target = p ?? inventory_path();
22599
- fs35.mkdirSync(path33.dirname(target), { recursive: true });
22675
+ fs36.mkdirSync(path33.dirname(target), { recursive: true });
22600
22676
  const payload = json_dumps_sorted(data, 2) + "\n";
22601
22677
  const parent = path33.dirname(target);
22602
22678
  let fd = null;
@@ -22604,7 +22680,7 @@ function save_inventory(data, p) {
22604
22680
  for (let attempt = 0; attempt < 32; attempt += 1) {
22605
22681
  tmp_name = path33.join(parent, `${path33.basename(target)}.${randomBytes3(6).toString("hex")}`);
22606
22682
  try {
22607
- fd = fs35.openSync(tmp_name, "wx", 384);
22683
+ fd = fs36.openSync(tmp_name, "wx", 384);
22608
22684
  break;
22609
22685
  } catch (err) {
22610
22686
  if (err.code === "EEXIST") {
@@ -22617,16 +22693,16 @@ function save_inventory(data, p) {
22617
22693
  throw new Error("save_inventory: could not create a unique temp file");
22618
22694
  }
22619
22695
  try {
22620
- fs35.writeFileSync(fd, payload, { encoding: "utf-8" });
22621
- fs35.closeSync(fd);
22622
- fs35.renameSync(tmp_name, target);
22696
+ fs36.writeFileSync(fd, payload, { encoding: "utf-8" });
22697
+ fs36.closeSync(fd);
22698
+ fs36.renameSync(tmp_name, target);
22623
22699
  } catch (err) {
22624
22700
  try {
22625
- fs35.closeSync(fd);
22701
+ fs36.closeSync(fd);
22626
22702
  } catch {
22627
22703
  }
22628
22704
  try {
22629
- fs35.unlinkSync(tmp_name);
22705
+ fs36.unlinkSync(tmp_name);
22630
22706
  } catch {
22631
22707
  }
22632
22708
  throw err;
@@ -22685,7 +22761,7 @@ function expected_deploy_files(src, dest_rel, file_filter = null) {
22685
22761
  const out = /* @__PURE__ */ new Set();
22686
22762
  let src_stat;
22687
22763
  try {
22688
- src_stat = fs35.statSync(src);
22764
+ src_stat = fs36.statSync(src);
22689
22765
  } catch {
22690
22766
  return out;
22691
22767
  }
@@ -22697,23 +22773,23 @@ function expected_deploy_files(src, dest_rel, file_filter = null) {
22697
22773
  return out;
22698
22774
  }
22699
22775
  const _walk = (node, prefix) => {
22700
- const entries = fs35.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
22776
+ const entries = fs36.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
22701
22777
  for (const name of entries) {
22702
22778
  const entry = path33.join(node, name);
22703
22779
  const rel = join_rel(prefix, name);
22704
- const lst = fs35.lstatSync(entry);
22780
+ const lst = fs36.lstatSync(entry);
22705
22781
  if (lst.isDirectory() && !lst.isSymbolicLink()) {
22706
22782
  _walk(entry, rel);
22707
22783
  continue;
22708
22784
  }
22709
22785
  let resolved_is_dir = false;
22710
22786
  try {
22711
- resolved_is_dir = fs35.statSync(entry).isDirectory();
22787
+ resolved_is_dir = fs36.statSync(entry).isDirectory();
22712
22788
  } catch {
22713
22789
  resolved_is_dir = false;
22714
22790
  }
22715
22791
  if (resolved_is_dir) {
22716
- _walk(fs35.realpathSync(entry), rel);
22792
+ _walk(fs36.realpathSync(entry), rel);
22717
22793
  continue;
22718
22794
  }
22719
22795
  if (file_filter !== null && !file_filter(entry)) {
@@ -22765,7 +22841,7 @@ function reap_stale(tool_id, anchor, current_files, inventory, dry_run = false)
22765
22841
  }
22766
22842
  let lst = null;
22767
22843
  try {
22768
- lst = fs35.lstatSync(target);
22844
+ lst = fs36.lstatSync(target);
22769
22845
  } catch {
22770
22846
  lst = null;
22771
22847
  }
@@ -22779,7 +22855,7 @@ function reap_stale(tool_id, anchor, current_files, inventory, dry_run = false)
22779
22855
  continue;
22780
22856
  }
22781
22857
  try {
22782
- fs35.unlinkSync(target);
22858
+ fs36.unlinkSync(target);
22783
22859
  } catch {
22784
22860
  continue;
22785
22861
  }
@@ -22798,7 +22874,7 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
22798
22874
  const root = dest_sub ? path33.join(anchor_resolved, dest_sub) : anchor_resolved;
22799
22875
  let root_stat;
22800
22876
  try {
22801
- root_stat = fs35.statSync(root);
22877
+ root_stat = fs36.statSync(root);
22802
22878
  } catch {
22803
22879
  continue;
22804
22880
  }
@@ -22808,7 +22884,7 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
22808
22884
  for (const md of rglob_md(root)) {
22809
22885
  let md_lst;
22810
22886
  try {
22811
- md_lst = fs35.lstatSync(md);
22887
+ md_lst = fs36.lstatSync(md);
22812
22888
  } catch {
22813
22889
  continue;
22814
22890
  }
@@ -22826,7 +22902,7 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
22826
22902
  }
22827
22903
  let head;
22828
22904
  try {
22829
- head = fs35.readFileSync(md, { encoding: "utf-8" });
22905
+ head = fs36.readFileSync(md, { encoding: "utf-8" });
22830
22906
  } catch {
22831
22907
  continue;
22832
22908
  }
@@ -22844,7 +22920,7 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
22844
22920
  continue;
22845
22921
  }
22846
22922
  try {
22847
- fs35.unlinkSync(md);
22923
+ fs36.unlinkSync(md);
22848
22924
  } catch {
22849
22925
  continue;
22850
22926
  }
@@ -22875,7 +22951,7 @@ function prune_empty_dirs(prune_candidates, anchor_resolved) {
22875
22951
  let node = start;
22876
22952
  while (node !== anchor_resolved && is_ancestor(anchor_resolved, node)) {
22877
22953
  try {
22878
- fs35.rmdirSync(node);
22954
+ fs36.rmdirSync(node);
22879
22955
  } catch {
22880
22956
  break;
22881
22957
  }
@@ -22905,7 +22981,7 @@ function rglob_md(root) {
22905
22981
  const walk = (dir) => {
22906
22982
  let names;
22907
22983
  try {
22908
- names = fs35.readdirSync(dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
22984
+ names = fs36.readdirSync(dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
22909
22985
  } catch {
22910
22986
  return;
22911
22987
  }
@@ -22913,7 +22989,7 @@ function rglob_md(root) {
22913
22989
  const full = path33.join(dir, name);
22914
22990
  let lst;
22915
22991
  try {
22916
- lst = fs35.lstatSync(full);
22992
+ lst = fs36.lstatSync(full);
22917
22993
  } catch {
22918
22994
  continue;
22919
22995
  }
@@ -22964,10 +23040,10 @@ var init_global_deploy_inventory = __esm({
22964
23040
  });
22965
23041
 
22966
23042
  // src/scripts/_lib/duplicate_scope_census.ts
22967
- import * as fs36 from "node:fs";
23043
+ import * as fs37 from "node:fs";
22968
23044
  import * as path34 from "node:path";
22969
23045
  function censusDuplicateScope(userRulesDir, projectRulesDir) {
22970
- if (!fs36.existsSync(userRulesDir) || !fs36.existsSync(projectRulesDir)) {
23046
+ if (!fs37.existsSync(userRulesDir) || !fs37.existsSync(projectRulesDir)) {
22971
23047
  return {
22972
23048
  evaluable: false,
22973
23049
  reason: `one or both rule directories are missing (user: ${userRulesDir}, project: ${projectRulesDir})`,
@@ -22975,15 +23051,15 @@ function censusDuplicateScope(userRulesDir, projectRulesDir) {
22975
23051
  duplicate_chars: 0
22976
23052
  };
22977
23053
  }
22978
- const userFiles = new Set(fs36.readdirSync(userRulesDir).filter((f) => f.endsWith(".md")));
22979
- const projectFiles = fs36.readdirSync(projectRulesDir).filter((f) => f.endsWith(".md"));
23054
+ const userFiles = new Set(fs37.readdirSync(userRulesDir).filter((f) => f.endsWith(".md")));
23055
+ const projectFiles = fs37.readdirSync(projectRulesDir).filter((f) => f.endsWith(".md"));
22980
23056
  const shared = [];
22981
23057
  let duplicateChars = 0;
22982
23058
  for (const f of projectFiles) {
22983
23059
  if (!userFiles.has(f)) continue;
22984
23060
  shared.push(f);
22985
- const a = fs36.statSync(path34.join(userRulesDir, f)).size;
22986
- const b = fs36.statSync(path34.join(projectRulesDir, f)).size;
23061
+ const a = fs37.statSync(path34.join(userRulesDir, f)).size;
23062
+ const b = fs37.statSync(path34.join(projectRulesDir, f)).size;
22987
23063
  duplicateChars += Math.min(a, b);
22988
23064
  }
22989
23065
  shared.sort();
@@ -23930,7 +24006,7 @@ var init_agent_user_profile = __esm({
23930
24006
  });
23931
24007
 
23932
24008
  // src/scripts/_lib/carrier_divergence.ts
23933
- import * as fs37 from "node:fs";
24009
+ import * as fs38 from "node:fs";
23934
24010
  import * as path38 from "node:path";
23935
24011
  function stripOwnershipKeys(text) {
23936
24012
  return text.split("\n").filter((line) => !OWNERSHIP_KEYS.some((k) => line.startsWith(`${k}:`))).join("\n");
@@ -23980,14 +24056,14 @@ function censusRuleDir(dir) {
23980
24056
  let chars = 0;
23981
24057
  let entries;
23982
24058
  try {
23983
- entries = fs37.readdirSync(dir);
24059
+ entries = fs38.readdirSync(dir);
23984
24060
  } catch {
23985
24061
  return { files: 0, chars: 0 };
23986
24062
  }
23987
24063
  for (const name of entries) {
23988
24064
  if (!name.endsWith(".md")) continue;
23989
24065
  try {
23990
- chars += fs37.statSync(path38.join(dir, name)).size;
24066
+ chars += fs38.statSync(path38.join(dir, name)).size;
23991
24067
  files += 1;
23992
24068
  } catch {
23993
24069
  }
@@ -24003,7 +24079,7 @@ var init_carrier_divergence = __esm({
24003
24079
  });
24004
24080
 
24005
24081
  // src/scripts/_lib/cc_transcript.ts
24006
- import * as fs38 from "node:fs";
24082
+ import * as fs39 from "node:fs";
24007
24083
  import * as path39 from "node:path";
24008
24084
  import { homedir as homedir7 } from "node:os";
24009
24085
  function projectStoreSlug(cwd) {
@@ -24051,7 +24127,7 @@ function parseLine(line) {
24051
24127
  function listTranscriptFiles(opts = {}) {
24052
24128
  const root = opts.root ?? DEFAULT_PROJECTS_ROOT;
24053
24129
  const base = opts.projectDir ? path39.isAbsolute(opts.projectDir) ? opts.projectDir : path39.join(root, opts.projectDir) : root;
24054
- if (!fs38.existsSync(base)) return [];
24130
+ if (!fs39.existsSync(base)) return [];
24055
24131
  const cutoffMs = opts.maxAgeDays !== void 0 ? (opts.now ?? /* @__PURE__ */ new Date()).getTime() - opts.maxAgeDays * 24 * 60 * 60 * 1e3 : null;
24056
24132
  const out = [];
24057
24133
  const stack = [base];
@@ -24059,7 +24135,7 @@ function listTranscriptFiles(opts = {}) {
24059
24135
  const dir = stack.pop();
24060
24136
  let entries;
24061
24137
  try {
24062
- entries = fs38.readdirSync(dir, { withFileTypes: true });
24138
+ entries = fs39.readdirSync(dir, { withFileTypes: true });
24063
24139
  } catch {
24064
24140
  continue;
24065
24141
  }
@@ -24073,7 +24149,7 @@ function listTranscriptFiles(opts = {}) {
24073
24149
  if (cutoffMs !== null) {
24074
24150
  let mtimeMs;
24075
24151
  try {
24076
- mtimeMs = fs38.statSync(full).mtimeMs;
24152
+ mtimeMs = fs39.statSync(full).mtimeMs;
24077
24153
  } catch {
24078
24154
  continue;
24079
24155
  }
@@ -24092,7 +24168,7 @@ function scanTranscripts(opts = {}) {
24092
24168
  for (const file of files) {
24093
24169
  let text;
24094
24170
  try {
24095
- text = fs38.readFileSync(file, "utf-8");
24171
+ text = fs39.readFileSync(file, "utf-8");
24096
24172
  } catch {
24097
24173
  continue;
24098
24174
  }
@@ -24232,7 +24308,7 @@ __export(pricing_exports, {
24232
24308
  prices_file_for: () => prices_file_for,
24233
24309
  reprice_with_cache: () => reprice_with_cache
24234
24310
  });
24235
- import * as fs39 from "node:fs";
24311
+ import * as fs40 from "node:fs";
24236
24312
  import * as path40 from "node:path";
24237
24313
  import { fileURLToPath as fileURLToPath25 } from "node:url";
24238
24314
  function prices_file_for(repo_root) {
@@ -24354,16 +24430,16 @@ function is_stale(table, now) {
24354
24430
  return last < last_monday_utc(now);
24355
24431
  }
24356
24432
  function load_prices(p = PRICES_FILE) {
24357
- if (!fs39.existsSync(p)) {
24433
+ if (!fs40.existsSync(p)) {
24358
24434
  bootstrap_from_defaults(p);
24359
24435
  }
24360
- return _parse2(fs39.readFileSync(p, "utf-8"));
24436
+ return _parse2(fs40.readFileSync(p, "utf-8"));
24361
24437
  }
24362
24438
  function bootstrap_from_defaults(p = PRICES_FILE) {
24363
- fs39.mkdirSync(path40.dirname(p), { recursive: true });
24439
+ fs40.mkdirSync(path40.dirname(p), { recursive: true });
24364
24440
  const rows = as_rows();
24365
24441
  const body = _render_markdown(LAST_UPDATED, "shipped-default", rows);
24366
- fs39.writeFileSync(p, body, "utf-8");
24442
+ fs40.writeFileSync(p, body, "utf-8");
24367
24443
  }
24368
24444
  function _fmt62f(x) {
24369
24445
  const s = x.toFixed(2);
@@ -24497,7 +24573,7 @@ var init_pricing = __esm({
24497
24573
 
24498
24574
  // src/scripts/cache_realization_report.ts
24499
24575
  import { execFileSync } from "node:child_process";
24500
- import * as fs40 from "node:fs";
24576
+ import * as fs41 from "node:fs";
24501
24577
  import { homedir as homedir8 } from "node:os";
24502
24578
  import * as path41 from "node:path";
24503
24579
  import { fileURLToPath as fileURLToPath26, pathToFileURL as pathToFileURL15 } from "node:url";
@@ -24599,14 +24675,14 @@ function computeDuplicateScope(userRulesDir, projectRulesDir, subagentWriteVolum
24599
24675
  }
24600
24676
  function findDebateRoundFiles(councilRoot) {
24601
24677
  const base = path41.join(councilRoot, "agents", "runtime", "council", "responses");
24602
- if (!fs40.existsSync(base)) return [];
24678
+ if (!fs41.existsSync(base)) return [];
24603
24679
  const out = [];
24604
24680
  const stack = [base];
24605
24681
  while (stack.length > 0) {
24606
24682
  const dir = stack.pop();
24607
24683
  let entries;
24608
24684
  try {
24609
- entries = fs40.readdirSync(dir, { withFileTypes: true });
24685
+ entries = fs41.readdirSync(dir, { withFileTypes: true });
24610
24686
  } catch {
24611
24687
  continue;
24612
24688
  }
@@ -24655,7 +24731,7 @@ function computeCouncilMispricing(councilRoot) {
24655
24731
  for (const f of groupFiles) {
24656
24732
  let data;
24657
24733
  try {
24658
- data = JSON.parse(fs40.readFileSync(f, "utf-8"));
24734
+ data = JSON.parse(fs41.readFileSync(f, "utf-8"));
24659
24735
  } catch {
24660
24736
  continue;
24661
24737
  }
@@ -24723,8 +24799,8 @@ function computeWorktreeFragmentation(projectsRoot, worktreePaths, maxAgeDays) {
24723
24799
  }
24724
24800
  const established = worktreePaths[0];
24725
24801
  const encodedEstablished = encodeProjectPath(established);
24726
- const worktreeDirs = worktreePaths.slice(1).map(encodeProjectPath).filter((d) => fs40.existsSync(path41.join(projectsRoot, d)));
24727
- if (!fs40.existsSync(path41.join(projectsRoot, encodedEstablished)) || worktreeDirs.length === 0) {
24802
+ const worktreeDirs = worktreePaths.slice(1).map(encodeProjectPath).filter((d) => fs41.existsSync(path41.join(projectsRoot, d)));
24803
+ if (!fs41.existsSync(path41.join(projectsRoot, encodedEstablished)) || worktreeDirs.length === 0) {
24728
24804
  return {
24729
24805
  status: "pending",
24730
24806
  reason: "no transcript directory found for both an established and a fresh-worktree checkout of this repo"
@@ -25004,7 +25080,7 @@ __export(preamble_byte_census_exports, {
25004
25080
  renderText: () => renderText2,
25005
25081
  topRulesByCost: () => topRulesByCost
25006
25082
  });
25007
- import * as fs41 from "node:fs";
25083
+ import * as fs42 from "node:fs";
25008
25084
  import { homedir as homedir9 } from "node:os";
25009
25085
  import * as path42 from "node:path";
25010
25086
  import { fileURLToPath as fileURLToPath27, pathToFileURL as pathToFileURL16 } from "node:url";
@@ -25013,19 +25089,19 @@ function tokensFromChars(chars) {
25013
25089
  }
25014
25090
  function readCharsIfExists(p) {
25015
25091
  try {
25016
- return fs41.statSync(p).size;
25092
+ return fs42.statSync(p).size;
25017
25093
  } catch {
25018
25094
  return 0;
25019
25095
  }
25020
25096
  }
25021
25097
  function topRulesByCost(dir, limit = 10) {
25022
- if (!fs41.existsSync(dir)) return [];
25098
+ if (!fs42.existsSync(dir)) return [];
25023
25099
  const entries = [];
25024
- for (const name of fs41.readdirSync(dir)) {
25100
+ for (const name of fs42.readdirSync(dir)) {
25025
25101
  if (!name.endsWith(".md")) continue;
25026
25102
  let chars;
25027
25103
  try {
25028
- chars = fs41.statSync(path42.join(dir, name)).size;
25104
+ chars = fs42.statSync(path42.join(dir, name)).size;
25029
25105
  } catch {
25030
25106
  continue;
25031
25107
  }
@@ -25037,7 +25113,7 @@ function topRulesByCost(dir, limit = 10) {
25037
25113
  function parseClaudeMdImports(claudeMdPath) {
25038
25114
  let text;
25039
25115
  try {
25040
- text = fs41.readFileSync(claudeMdPath, "utf-8");
25116
+ text = fs42.readFileSync(claudeMdPath, "utf-8");
25041
25117
  } catch {
25042
25118
  return [];
25043
25119
  }
@@ -25059,11 +25135,11 @@ function censusClaudeMdHierarchy(repoRoot, userHome) {
25059
25135
  const userClaudeMd = path42.join(userHome, ".claude", "CLAUDE.md");
25060
25136
  return {
25061
25137
  project_claude_md_chars: readCharsIfExists(projectClaudeMd),
25062
- project_claude_md_present: fs41.existsSync(projectClaudeMd),
25138
+ project_claude_md_present: fs42.existsSync(projectClaudeMd),
25063
25139
  project_claude_local_md_chars: readCharsIfExists(projectClaudeLocalMd),
25064
- project_claude_local_md_present: fs41.existsSync(projectClaudeLocalMd),
25140
+ project_claude_local_md_present: fs42.existsSync(projectClaudeLocalMd),
25065
25141
  user_claude_md_chars: readCharsIfExists(userClaudeMd),
25066
- user_claude_md_present: fs41.existsSync(userClaudeMd),
25142
+ user_claude_md_present: fs42.existsSync(userClaudeMd),
25067
25143
  user_imports: parseClaudeMdImports(userClaudeMd)
25068
25144
  };
25069
25145
  }
@@ -25085,15 +25161,15 @@ function parseFrontmatter(text) {
25085
25161
  }
25086
25162
  }
25087
25163
  function censusSkillsCatalog(skillsDir) {
25088
- if (!fs41.existsSync(skillsDir)) return { skills: 0, chars: 0 };
25164
+ if (!fs42.existsSync(skillsDir)) return { skills: 0, chars: 0 };
25089
25165
  let skills = 0;
25090
25166
  let chars = 0;
25091
- for (const entry of fs41.readdirSync(skillsDir, { withFileTypes: true })) {
25167
+ for (const entry of fs42.readdirSync(skillsDir, { withFileTypes: true })) {
25092
25168
  if (!entry.isDirectory()) continue;
25093
25169
  const skillMd = path42.join(skillsDir, entry.name, "SKILL.md");
25094
25170
  let text;
25095
25171
  try {
25096
- text = fs41.readFileSync(skillMd, "utf-8");
25172
+ text = fs42.readFileSync(skillMd, "utf-8");
25097
25173
  } catch {
25098
25174
  continue;
25099
25175
  }
@@ -25363,7 +25439,7 @@ __export(dispatch_economy_report_exports, {
25363
25439
  readAuditOrchestrations: () => readAuditOrchestrations,
25364
25440
  renderText: () => renderText3
25365
25441
  });
25366
- import * as fs42 from "node:fs";
25442
+ import * as fs43 from "node:fs";
25367
25443
  import * as path43 from "node:path";
25368
25444
  import { fileURLToPath as fileURLToPath28, pathToFileURL as pathToFileURL17 } from "node:url";
25369
25445
  function median2(values) {
@@ -25410,19 +25486,19 @@ function isFiniteNonNegInt(v) {
25410
25486
  return typeof v === "number" && Number.isInteger(v) && v >= 0;
25411
25487
  }
25412
25488
  function readAuditOrchestrations(auditDir, opts = {}) {
25413
- if (!fs42.existsSync(auditDir)) return [];
25489
+ if (!fs43.existsSync(auditDir)) return [];
25414
25490
  const out = [];
25415
25491
  const cutoffMs = opts.maxAgeDays !== void 0 ? (opts.now ?? /* @__PURE__ */ new Date()).getTime() - opts.maxAgeDays * 24 * 60 * 60 * 1e3 : null;
25416
25492
  let entries;
25417
25493
  try {
25418
- entries = fs42.readdirSync(auditDir).filter((f) => f.endsWith(".jsonl")).sort();
25494
+ entries = fs43.readdirSync(auditDir).filter((f) => f.endsWith(".jsonl")).sort();
25419
25495
  } catch {
25420
25496
  return [];
25421
25497
  }
25422
25498
  if (cutoffMs !== null) {
25423
25499
  entries = entries.filter((f) => {
25424
25500
  try {
25425
- return fs42.statSync(path43.join(auditDir, f)).mtimeMs >= cutoffMs;
25501
+ return fs43.statSync(path43.join(auditDir, f)).mtimeMs >= cutoffMs;
25426
25502
  } catch {
25427
25503
  return false;
25428
25504
  }
@@ -25431,7 +25507,7 @@ function readAuditOrchestrations(auditDir, opts = {}) {
25431
25507
  for (const f of entries) {
25432
25508
  let text;
25433
25509
  try {
25434
- text = fs42.readFileSync(path43.join(auditDir, f), "utf8");
25510
+ text = fs43.readFileSync(path43.join(auditDir, f), "utf8");
25435
25511
  } catch {
25436
25512
  continue;
25437
25513
  }
@@ -25453,7 +25529,7 @@ function readAuditOrchestrations(auditDir, opts = {}) {
25453
25529
  return out;
25454
25530
  }
25455
25531
  function buildReport3(opts) {
25456
- const registrationRaw = fs42.readFileSync(REGISTRATION_FILE, "utf8");
25532
+ const registrationRaw = fs43.readFileSync(REGISTRATION_FILE, "utf8");
25457
25533
  const registration = JSON.parse(registrationRaw);
25458
25534
  const scanOpts = {
25459
25535
  root: opts.root,
@@ -25617,7 +25693,7 @@ function _isCliEntry15() {
25617
25693
  const argvUrl = pathToFileURL17(path43.resolve(process.argv[1])).href;
25618
25694
  if (import.meta.url === argvUrl) return true;
25619
25695
  try {
25620
- return fs42.realpathSync(fileURLToPath28(import.meta.url)) === fs42.realpathSync(path43.resolve(process.argv[1]));
25696
+ return fs43.realpathSync(fileURLToPath28(import.meta.url)) === fs43.realpathSync(path43.resolve(process.argv[1]));
25621
25697
  } catch {
25622
25698
  return false;
25623
25699
  }
@@ -25637,11 +25713,11 @@ var init_dispatch_economy_report = __esm({
25637
25713
  });
25638
25714
 
25639
25715
  // src/scripts/_lib/git_common_dir.ts
25640
- import fs43 from "node:fs";
25716
+ import fs44 from "node:fs";
25641
25717
  import path44 from "node:path";
25642
25718
  function realpath_or_self(p) {
25643
25719
  try {
25644
- return fs43.realpathSync(p);
25720
+ return fs44.realpathSync(p);
25645
25721
  } catch {
25646
25722
  return p;
25647
25723
  }
@@ -25649,18 +25725,18 @@ function realpath_or_self(p) {
25649
25725
  function git_common_dir(project_root) {
25650
25726
  const dot_git = path44.join(project_root, ".git");
25651
25727
  try {
25652
- const st = fs43.statSync(dot_git);
25728
+ const st = fs44.statSync(dot_git);
25653
25729
  if (st.isDirectory()) {
25654
25730
  return realpath_or_self(dot_git);
25655
25731
  }
25656
- const m = fs43.readFileSync(dot_git, "utf-8").match(/^gitdir:\s*(.+)\s*$/m);
25732
+ const m = fs44.readFileSync(dot_git, "utf-8").match(/^gitdir:\s*(.+)\s*$/m);
25657
25733
  if (m === null) {
25658
25734
  return null;
25659
25735
  }
25660
25736
  const gitdir = path44.resolve(project_root, m[1].trim());
25661
25737
  const commondir_file = path44.join(gitdir, "commondir");
25662
- if (fs43.existsSync(commondir_file)) {
25663
- const common = path44.resolve(gitdir, fs43.readFileSync(commondir_file, "utf-8").trim());
25738
+ if (fs44.existsSync(commondir_file)) {
25739
+ const common = path44.resolve(gitdir, fs44.readFileSync(commondir_file, "utf-8").trim());
25664
25740
  return realpath_or_self(common);
25665
25741
  }
25666
25742
  return realpath_or_self(gitdir);
@@ -25850,7 +25926,7 @@ var init_py_json = __esm({
25850
25926
  });
25851
25927
 
25852
25928
  // src/scripts/ai_council/cli_call_budget.ts
25853
- import * as fs44 from "node:fs";
25929
+ import * as fs45 from "node:fs";
25854
25930
  import * as path45 from "node:path";
25855
25931
  function attributionPath(target) {
25856
25932
  return `${target}${CLI_CALLS_ATTRIBUTION_SUFFIX}`;
@@ -25876,14 +25952,14 @@ function resolveCliCallCaps(raw, validProviders) {
25876
25952
  return out;
25877
25953
  }
25878
25954
  function writeStateAtomically(target, payload) {
25879
- fs44.mkdirSync(path45.dirname(target), { recursive: true });
25955
+ fs45.mkdirSync(path45.dirname(target), { recursive: true });
25880
25956
  const tmp = `${target}.${process.pid}.${_monotonicish()}.tmp`;
25881
25957
  try {
25882
- fs44.writeFileSync(tmp, payload, { encoding: "utf-8" });
25883
- fs44.renameSync(tmp, target);
25958
+ fs45.writeFileSync(tmp, payload, { encoding: "utf-8" });
25959
+ fs45.renameSync(tmp, target);
25884
25960
  } catch (exc) {
25885
25961
  try {
25886
- fs44.unlinkSync(tmp);
25962
+ fs45.unlinkSync(tmp);
25887
25963
  } catch {
25888
25964
  }
25889
25965
  throw exc;
@@ -25896,14 +25972,14 @@ function withStateLock(target, fn) {
25896
25972
  const started = _monotonicish();
25897
25973
  while (_monotonicish() - started < waitMs) {
25898
25974
  try {
25899
- fs44.mkdirSync(path45.dirname(lockPath), { recursive: true });
25900
- fs44.closeSync(fs44.openSync(lockPath, "wx"));
25975
+ fs45.mkdirSync(path45.dirname(lockPath), { recursive: true });
25976
+ fs45.closeSync(fs45.openSync(lockPath, "wx"));
25901
25977
  held = true;
25902
25978
  break;
25903
25979
  } catch {
25904
25980
  try {
25905
- if (_monotonicish() - fs44.statSync(lockPath).mtimeMs > waitMs) {
25906
- fs44.unlinkSync(lockPath);
25981
+ if (_monotonicish() - fs45.statSync(lockPath).mtimeMs > waitMs) {
25982
+ fs45.unlinkSync(lockPath);
25907
25983
  continue;
25908
25984
  }
25909
25985
  } catch {
@@ -25916,7 +25992,7 @@ function withStateLock(target, fn) {
25916
25992
  } finally {
25917
25993
  if (held) {
25918
25994
  try {
25919
- fs44.unlinkSync(lockPath);
25995
+ fs45.unlinkSync(lockPath);
25920
25996
  } catch {
25921
25997
  }
25922
25998
  }
@@ -25924,12 +26000,12 @@ function withStateLock(target, fn) {
25924
26000
  }
25925
26001
  function readAttribution(target, todayIso) {
25926
26002
  const p = attributionPath(target);
25927
- if (!fs44.existsSync(p)) {
26003
+ if (!fs45.existsSync(p)) {
25928
26004
  return {};
25929
26005
  }
25930
26006
  let data;
25931
26007
  try {
25932
- data = JSON.parse(fs44.readFileSync(p, { encoding: "utf-8" }));
26008
+ data = JSON.parse(fs45.readFileSync(p, { encoding: "utf-8" }));
25933
26009
  } catch {
25934
26010
  return {};
25935
26011
  }
@@ -26081,7 +26157,7 @@ var init_quorum = __esm({
26081
26157
 
26082
26158
  // src/scripts/ai_council/events_log.ts
26083
26159
  import * as crypto4 from "node:crypto";
26084
- import * as fs45 from "node:fs";
26160
+ import * as fs46 from "node:fs";
26085
26161
  import * as path46 from "node:path";
26086
26162
  import { fileURLToPath as fileURLToPath29 } from "node:url";
26087
26163
  function _hash_original_ask(originalAsk) {
@@ -26177,9 +26253,9 @@ function appendEvent(event, opts = {}) {
26177
26253
  }
26178
26254
  }
26179
26255
  const target = opts.logPath != null ? opts.logPath : _DEFAULT_LOG_PATH;
26180
- fs45.mkdirSync(path46.dirname(target), { recursive: true });
26256
+ fs46.mkdirSync(path46.dirname(target), { recursive: true });
26181
26257
  const line = _pyJsonDumpsCompact(record);
26182
- fs45.appendFileSync(target, line + "\n", { encoding: "utf-8" });
26258
+ fs46.appendFileSync(target, line + "\n", { encoding: "utf-8" });
26183
26259
  return true;
26184
26260
  }
26185
26261
  function appendQuorumEvent(input, opts = {}) {
@@ -26425,8 +26501,8 @@ __export(clients_exports, {
26425
26501
  record_cli_call: () => record_cli_call,
26426
26502
  reset_cli_call_counts: () => reset_cli_call_counts
26427
26503
  });
26428
- import { spawnSync as spawnSync8 } from "node:child_process";
26429
- import * as fs46 from "node:fs";
26504
+ import { spawnSync as spawnSync9 } from "node:child_process";
26505
+ import * as fs47 from "node:fs";
26430
26506
  import * as os8 from "node:os";
26431
26507
  import * as path47 from "node:path";
26432
26508
  function _subagentModelCeiling(cwd = process.cwd()) {
@@ -26486,13 +26562,13 @@ function _setMonotonicSource(fn) {
26486
26562
  return prev;
26487
26563
  }
26488
26564
  function _loadKey(p, prefix, installScript) {
26489
- if (!fs46.existsSync(p)) {
26565
+ if (!fs47.existsSync(p)) {
26490
26566
  throw new KeyGateError(
26491
26567
  `Key not found at ${p}.
26492
26568
  Install it with: bash ${installScript}`
26493
26569
  );
26494
26570
  }
26495
- const st = fs46.statSync(p);
26571
+ const st = fs47.statSync(p);
26496
26572
  const mode = st.mode & 511;
26497
26573
  if (mode !== 384) {
26498
26574
  throw new KeyGateError(
@@ -26500,7 +26576,7 @@ function _loadKey(p, prefix, installScript) {
26500
26576
  Fix: chmod 600 ${p}`
26501
26577
  );
26502
26578
  }
26503
- const key = fs46.readFileSync(p, { encoding: "utf-8" }).trim();
26579
+ const key = fs47.readFileSync(p, { encoding: "utf-8" }).trim();
26504
26580
  if (!key) {
26505
26581
  throw new KeyGateError(`${p} is empty.`);
26506
26582
  }
@@ -26540,7 +26616,7 @@ function _curlJsonPost(url, extraHeaders, body) {
26540
26616
  }
26541
26617
  args.push("--connect-timeout", "30", "--max-time", "290");
26542
26618
  args.push("-w", "\n%{http_code}", "--data-binary", "@-");
26543
- const r = spawnSync8("curl", args, {
26619
+ const r = spawnSync9("curl", args, {
26544
26620
  input: JSON.stringify(body),
26545
26621
  encoding: "utf8",
26546
26622
  maxBuffer: 64 * 1024 * 1024,
@@ -26573,12 +26649,12 @@ function _today_utc_iso() {
26573
26649
  }
26574
26650
  function load_cli_call_counts(p = null) {
26575
26651
  const target = p !== null ? p : _cliCallsStatePath();
26576
- if (!fs46.existsSync(target)) {
26652
+ if (!fs47.existsSync(target)) {
26577
26653
  return {};
26578
26654
  }
26579
26655
  let data;
26580
26656
  try {
26581
- data = JSON.parse(fs46.readFileSync(target, { encoding: "utf-8" }));
26657
+ data = JSON.parse(fs47.readFileSync(target, { encoding: "utf-8" }));
26582
26658
  } catch {
26583
26659
  return {};
26584
26660
  }
@@ -26850,7 +26926,7 @@ function _which(name) {
26850
26926
  }
26851
26927
  function _isExecutable(p) {
26852
26928
  try {
26853
- const st = fs46.statSync(p);
26929
+ const st = fs47.statSync(p);
26854
26930
  if (!st.isFile()) {
26855
26931
  return false;
26856
26932
  }
@@ -26877,7 +26953,7 @@ function _defaultStdin() {
26877
26953
  function ensure() {
26878
26954
  if (buffer === null) {
26879
26955
  try {
26880
- buffer = fs46.readFileSync(0, { encoding: "utf-8" });
26956
+ buffer = fs47.readFileSync(0, { encoding: "utf-8" });
26881
26957
  } catch {
26882
26958
  buffer = "";
26883
26959
  }
@@ -27573,7 +27649,7 @@ ${user_prompt}`;
27573
27649
  if (stdinPayload !== null) {
27574
27650
  spawnOpts.input = stdinPayload;
27575
27651
  }
27576
- const r = spawnSync8(argv0, cmd.slice(1), spawnOpts);
27652
+ const r = spawnSync9(argv0, cmd.slice(1), spawnOpts);
27577
27653
  if (r.error) {
27578
27654
  const err = r.error;
27579
27655
  if (r.signal === "SIGTERM" || err.code === "ETIMEDOUT") {
@@ -28418,7 +28494,7 @@ __export(config_exports, {
28418
28494
  resolve_cli_call_caps: () => resolve_cli_call_caps,
28419
28495
  resolve_config_path: () => resolve_config_path
28420
28496
  });
28421
- import * as fs47 from "node:fs";
28497
+ import * as fs48 from "node:fs";
28422
28498
  import * as os9 from "node:os";
28423
28499
  import * as path48 from "node:path";
28424
28500
  function _pyReprStr(s) {
@@ -28620,14 +28696,14 @@ function resolve_config_path(project_root, options = {}) {
28620
28696
  });
28621
28697
  }
28622
28698
  function load_council_config(p) {
28623
- if (!fs47.existsSync(p)) {
28699
+ if (!fs48.existsSync(p)) {
28624
28700
  throw new CouncilConfigError(
28625
28701
  `Council config not found at ${p}. Create it per docs/contracts/ai-council-config.md.`
28626
28702
  );
28627
28703
  }
28628
28704
  let raw;
28629
28705
  try {
28630
- const text = fs47.readFileSync(p, "utf-8");
28706
+ const text = fs48.readFileSync(p, "utf-8");
28631
28707
  const parsed = (0, import_yaml5.parse)(text, { version: "1.1" });
28632
28708
  raw = parsed === null || parsed === void 0 ? {} : parsed;
28633
28709
  } catch (exc) {
@@ -29651,16 +29727,16 @@ function resolve_api_key(ref, scope = "api_key_ref") {
29651
29727
  }
29652
29728
  resolved = found;
29653
29729
  }
29654
- if (!fs47.existsSync(resolved)) {
29730
+ if (!fs48.existsSync(resolved)) {
29655
29731
  throw new CouncilConfigError(`${scope}: key file does not exist at ${resolved}.`);
29656
29732
  }
29657
- const mode = fs47.statSync(resolved).mode & 4095;
29733
+ const mode = fs48.statSync(resolved).mode & 4095;
29658
29734
  if (mode !== 384) {
29659
29735
  throw new CouncilConfigError(
29660
29736
  `${scope}: unsafe permissions on ${resolved}: got ${_pyOct(mode)}, expected 0o600. Fix: chmod 600 ${resolved}`
29661
29737
  );
29662
29738
  }
29663
- const value = fs47.readFileSync(resolved, "utf-8").trim();
29739
+ const value = fs48.readFileSync(resolved, "utf-8").trim();
29664
29740
  if (value === "") {
29665
29741
  throw new CouncilConfigError(`${scope}: key file at ${resolved} is empty.`);
29666
29742
  }
@@ -29780,7 +29856,7 @@ var init_config = __esm({
29780
29856
  });
29781
29857
 
29782
29858
  // src/install/toolDetection.ts
29783
- import { existsSync as existsSync23 } from "node:fs";
29859
+ import { existsSync as existsSync24 } from "node:fs";
29784
29860
  import { homedir as homedir11 } from "node:os";
29785
29861
  import { delimiter as delimiter2, join as join44 } from "node:path";
29786
29862
  function knownToolIds() {
@@ -29803,7 +29879,7 @@ function resolveBinaryPath(name, pathEnv) {
29803
29879
  if (dir.length === 0) continue;
29804
29880
  for (const candidate of [name, `${name}.exe`, `${name}.cmd`]) {
29805
29881
  const full = join44(dir, candidate);
29806
- if (existsSync23(full)) return full;
29882
+ if (existsSync24(full)) return full;
29807
29883
  }
29808
29884
  }
29809
29885
  return null;
@@ -29813,10 +29889,10 @@ function binOnPath(name, pathEnv) {
29813
29889
  }
29814
29890
  function isToolInstalled(signal, home, pathEnv) {
29815
29891
  for (const rel of signal.homePaths ?? []) {
29816
- if (existsSync23(join44(home, rel))) return true;
29892
+ if (existsSync24(join44(home, rel))) return true;
29817
29893
  }
29818
29894
  for (const abs of signal.absPaths ?? []) {
29819
- if (existsSync23(abs)) return true;
29895
+ if (existsSync24(abs)) return true;
29820
29896
  }
29821
29897
  for (const bin of signal.bins ?? []) {
29822
29898
  if (binOnPath(bin, pathEnv)) return true;
@@ -29884,8 +29960,8 @@ var init_agentSwitchDetection = __esm({
29884
29960
  });
29885
29961
 
29886
29962
  // src/scripts/_lib/environment_detector.ts
29887
- import { spawnSync as spawnSync9 } from "node:child_process";
29888
- import * as fs48 from "node:fs";
29963
+ import { spawnSync as spawnSync10 } from "node:child_process";
29964
+ import * as fs49 from "node:fs";
29889
29965
  import * as os10 from "node:os";
29890
29966
  import * as path49 from "node:path";
29891
29967
  function knownProviders() {
@@ -29912,7 +29988,7 @@ function homeOf(env) {
29912
29988
  function defaultProbeKeychain(service) {
29913
29989
  if (process.platform !== "darwin") return false;
29914
29990
  try {
29915
- const res = spawnSync9("security", ["find-generic-password", "-s", service], {
29991
+ const res = spawnSync10("security", ["find-generic-password", "-s", service], {
29916
29992
  timeout: VERSION_PROBE_TIMEOUT_MS,
29917
29993
  encoding: "utf-8",
29918
29994
  windowsHide: true,
@@ -29926,7 +30002,7 @@ function defaultProbeKeychain(service) {
29926
30002
  }
29927
30003
  function defaultProbeVersion(binary) {
29928
30004
  try {
29929
- const res = spawnSync9(binary, ["--version"], {
30005
+ const res = spawnSync10(binary, ["--version"], {
29930
30006
  timeout: VERSION_PROBE_TIMEOUT_MS,
29931
30007
  encoding: "utf-8",
29932
30008
  windowsHide: true,
@@ -29941,14 +30017,14 @@ ${res.stderr ?? ""}`;
29941
30017
  }
29942
30018
  function isFile2(p) {
29943
30019
  try {
29944
- return fs48.statSync(p).isFile();
30020
+ return fs49.statSync(p).isFile();
29945
30021
  } catch {
29946
30022
  return false;
29947
30023
  }
29948
30024
  }
29949
30025
  function exists2(p) {
29950
30026
  try {
29951
- return fs48.existsSync(p);
30027
+ return fs49.existsSync(p);
29952
30028
  } catch {
29953
30029
  return false;
29954
30030
  }
@@ -29956,7 +30032,7 @@ function exists2(p) {
29956
30032
  function classifyCodexAuth(authPath) {
29957
30033
  let data;
29958
30034
  try {
29959
- data = JSON.parse(fs48.readFileSync(authPath, "utf-8"));
30035
+ data = JSON.parse(fs49.readFileSync(authPath, "utf-8"));
29960
30036
  } catch {
29961
30037
  return "cli-api-key";
29962
30038
  }
@@ -30696,7 +30772,7 @@ var init_detection_report = __esm({
30696
30772
 
30697
30773
  // src/scripts/hooks/state_io.ts
30698
30774
  import { createHash as createHash6 } from "node:crypto";
30699
- import fs49 from "node:fs";
30775
+ import fs50 from "node:fs";
30700
30776
  import path51 from "node:path";
30701
30777
  function is_replay_mode() {
30702
30778
  return (process.env[REPLAY_ENV_VAR2] ?? "").trim() === "1";
@@ -30800,7 +30876,7 @@ function atomic_write_json(target, payload, options = {}) {
30800
30876
  const indent = options.indent ?? 2;
30801
30877
  const targetPath = path51.resolve(target);
30802
30878
  const state_dir = path51.dirname(targetPath);
30803
- fs49.mkdirSync(state_dir, { recursive: true });
30879
+ fs50.mkdirSync(state_dir, { recursive: true });
30804
30880
  const body = _py_json_dumps(payload, indent) + "\n";
30805
30881
  _atomic_write_text2(targetPath, body);
30806
30882
  }
@@ -30810,7 +30886,7 @@ function atomic_write_text(target, text) {
30810
30886
  }
30811
30887
  const targetPath = path51.resolve(target);
30812
30888
  const state_dir = path51.dirname(targetPath);
30813
- fs49.mkdirSync(state_dir, { recursive: true });
30889
+ fs50.mkdirSync(state_dir, { recursive: true });
30814
30890
  _atomic_write_text2(targetPath, text);
30815
30891
  }
30816
30892
  function _sleep(ms) {
@@ -30819,11 +30895,11 @@ function _sleep(ms) {
30819
30895
  }
30820
30896
  function _acquire_lock(lock_path, options = {}) {
30821
30897
  const blocking = options.blocking ?? true;
30822
- const fd = fs49.openSync(lock_path, "a", 420);
30898
+ const fd = fs50.openSync(lock_path, "a", 420);
30823
30899
  const held = lock_path + ".held";
30824
30900
  const give_up = () => {
30825
30901
  try {
30826
- fs49.closeSync(fd);
30902
+ fs50.closeSync(fd);
30827
30903
  } catch {
30828
30904
  }
30829
30905
  return null;
@@ -30831,8 +30907,8 @@ function _acquire_lock(lock_path, options = {}) {
30831
30907
  const start = Date.now();
30832
30908
  for (; ; ) {
30833
30909
  try {
30834
- const heldFd = fs49.openSync(held, "wx", 420);
30835
- fs49.closeSync(heldFd);
30910
+ const heldFd = fs50.openSync(held, "wx", 420);
30911
+ fs50.closeSync(heldFd);
30836
30912
  return fd;
30837
30913
  } catch (err) {
30838
30914
  if (err.code !== "EEXIST") {
@@ -30840,13 +30916,13 @@ function _acquire_lock(lock_path, options = {}) {
30840
30916
  }
30841
30917
  let age_ms;
30842
30918
  try {
30843
- age_ms = Date.now() - fs49.statSync(held).mtimeMs;
30919
+ age_ms = Date.now() - fs50.statSync(held).mtimeMs;
30844
30920
  } catch {
30845
30921
  continue;
30846
30922
  }
30847
30923
  if (age_ms >= LOCK_STALE_MS) {
30848
30924
  try {
30849
- fs49.rmSync(held, { force: true });
30925
+ fs50.rmSync(held, { force: true });
30850
30926
  } catch {
30851
30927
  }
30852
30928
  continue;
@@ -30863,18 +30939,18 @@ function _acquire_lock(lock_path, options = {}) {
30863
30939
  }
30864
30940
  function _release_lock(fd, lock_path) {
30865
30941
  try {
30866
- fs49.closeSync(fd);
30942
+ fs50.closeSync(fd);
30867
30943
  } catch {
30868
30944
  }
30869
30945
  try {
30870
- fs49.rmSync(lock_path + ".held", { force: true });
30946
+ fs50.rmSync(lock_path + ".held", { force: true });
30871
30947
  } catch {
30872
30948
  }
30873
30949
  }
30874
30950
  function _publish_text_locked(target, text) {
30875
30951
  const tmp = target + `.tmp.${process.pid}`;
30876
- fs49.writeFileSync(tmp, text, { encoding: "utf-8" });
30877
- fs49.renameSync(tmp, target);
30952
+ fs50.writeFileSync(tmp, text, { encoding: "utf-8" });
30953
+ fs50.renameSync(tmp, target);
30878
30954
  }
30879
30955
  function _atomic_write_text2(target, text) {
30880
30956
  const lock_path = _lock_path(path51.dirname(target));
@@ -30896,27 +30972,27 @@ function session_state_file(dir, session_id) {
30896
30972
  const digest = createHash6("sha256").update(session_id, "utf8").digest("hex").slice(0, 32);
30897
30973
  return path51.join(dir, `${digest}.json`);
30898
30974
  }
30899
- function restore_claimed_state(tomb, live, link = fs49.linkSync) {
30975
+ function restore_claimed_state(tomb, live, link = fs50.linkSync) {
30900
30976
  try {
30901
30977
  link(tomb, live);
30902
30978
  } catch (err) {
30903
30979
  const code = err.code;
30904
30980
  if (code !== "EEXIST" && code !== "ENOENT") {
30905
30981
  if (!NO_HARD_LINK_CODES.has(code ?? "")) throw err;
30906
- if (!fs49.existsSync(live)) {
30907
- fs49.renameSync(tomb, live);
30982
+ if (!fs50.existsSync(live)) {
30983
+ fs50.renameSync(tomb, live);
30908
30984
  return;
30909
30985
  }
30910
30986
  }
30911
30987
  }
30912
- fs49.rmSync(tomb, { force: true });
30988
+ fs50.rmSync(tomb, { force: true });
30913
30989
  }
30914
- function prune_stale_session_states(dir, now_ms, retention_days, mtime_of = (target) => fs49.statSync(target).mtimeMs) {
30990
+ function prune_stale_session_states(dir, now_ms, retention_days, mtime_of = (target) => fs50.statSync(target).mtimeMs) {
30915
30991
  if (is_replay_mode()) return 0;
30916
30992
  const cutoff = now_ms - retention_days * 24 * 60 * 60 * 1e3;
30917
30993
  let entries;
30918
30994
  try {
30919
- entries = fs49.readdirSync(dir);
30995
+ entries = fs50.readdirSync(dir);
30920
30996
  } catch {
30921
30997
  return 0;
30922
30998
  }
@@ -30933,7 +31009,7 @@ function prune_stale_session_states(dir, now_ms, retention_days, mtime_of = (tar
30933
31009
  restore_claimed_state(tomb, live);
30934
31010
  continue;
30935
31011
  }
30936
- fs49.rmSync(tomb, { force: true });
31012
+ fs50.rmSync(tomb, { force: true });
30937
31013
  removed += 1;
30938
31014
  } catch {
30939
31015
  }
@@ -30945,15 +31021,15 @@ function prune_stale_session_states(dir, now_ms, retention_days, mtime_of = (tar
30945
31021
  if (mtime_of(full) >= cutoff) continue;
30946
31022
  claim += 1;
30947
31023
  const tomb = `${full}.${process.pid}.${claim}.tomb`;
30948
- fs49.renameSync(full, tomb);
31024
+ fs50.renameSync(full, tomb);
30949
31025
  if (mtime_of(tomb) >= cutoff) {
30950
31026
  restore_claimed_state(tomb, full);
30951
31027
  continue;
30952
31028
  }
30953
- fs49.rmSync(tomb, { force: true });
31029
+ fs50.rmSync(tomb, { force: true });
30954
31030
  for (const suffix of [".lock", ".lock.held"]) {
30955
31031
  try {
30956
- fs49.rmSync(`${full}${suffix}`, { force: true });
31032
+ fs50.rmSync(`${full}${suffix}`, { force: true });
30957
31033
  } catch {
30958
31034
  }
30959
31035
  }
@@ -30966,8 +31042,8 @@ function prune_stale_session_states(dir, now_ms, retention_days, mtime_of = (tar
30966
31042
  function prune_legacy_state_file(target) {
30967
31043
  if (is_replay_mode()) return;
30968
31044
  try {
30969
- if (fs49.statSync(target).isFile()) {
30970
- fs49.rmSync(target, { force: true });
31045
+ if (fs50.statSync(target).isFile()) {
31046
+ fs50.rmSync(target, { force: true });
30971
31047
  }
30972
31048
  } catch {
30973
31049
  }
@@ -30981,7 +31057,7 @@ function update_json_under_lock(target, mutate, options = {}) {
30981
31057
  const targetPath = path51.resolve(target);
30982
31058
  const state_dir = path51.dirname(targetPath);
30983
31059
  try {
30984
- fs49.mkdirSync(state_dir, { recursive: true });
31060
+ fs50.mkdirSync(state_dir, { recursive: true });
30985
31061
  } catch {
30986
31062
  return "failed";
30987
31063
  }
@@ -30996,7 +31072,7 @@ function update_json_under_lock(target, mutate, options = {}) {
30996
31072
  try {
30997
31073
  let loaded = {};
30998
31074
  try {
30999
- const raw = fs49.readFileSync(targetPath, "utf-8");
31075
+ const raw = fs50.readFileSync(targetPath, "utf-8");
31000
31076
  const decoded = JSON.parse(raw);
31001
31077
  if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
31002
31078
  loaded = decoded;
@@ -31048,13 +31124,13 @@ var init_config2 = __esm({
31048
31124
 
31049
31125
  // src/scripts/ai_team/review_gate.ts
31050
31126
  import * as crypto5 from "node:crypto";
31051
- import * as fs50 from "node:fs";
31127
+ import * as fs51 from "node:fs";
31052
31128
  import * as os11 from "node:os";
31053
31129
  import * as path52 from "node:path";
31054
31130
  function _workspace_state_segment(workspace_root) {
31055
31131
  let canonical = workspace_root;
31056
31132
  try {
31057
- canonical = fs50.realpathSync.native(workspace_root);
31133
+ canonical = fs51.realpathSync.native(workspace_root);
31058
31134
  } catch {
31059
31135
  canonical = workspace_root;
31060
31136
  }
@@ -31080,7 +31156,7 @@ function upstream_gate_enabled(workspace_root) {
31080
31156
  for (const dir of upstream_state_dir_candidates(workspace_root)) {
31081
31157
  let parsed;
31082
31158
  try {
31083
- parsed = JSON.parse(fs50.readFileSync(path52.join(dir, "state.json"), "utf-8"));
31159
+ parsed = JSON.parse(fs51.readFileSync(path52.join(dir, "state.json"), "utf-8"));
31084
31160
  } catch {
31085
31161
  continue;
31086
31162
  }
@@ -31148,7 +31224,7 @@ var init_surface_tiers = __esm({
31148
31224
  });
31149
31225
 
31150
31226
  // src/scripts/_lib/scoped_projection.ts
31151
- import * as fs51 from "node:fs";
31227
+ import * as fs52 from "node:fs";
31152
31228
  import { createRequire as createRequire5 } from "node:module";
31153
31229
  import * as path53 from "node:path";
31154
31230
  function isPlainObject3(v) {
@@ -31169,7 +31245,7 @@ function yamlSafeLoad(text) {
31169
31245
  }
31170
31246
  function load_packs_registry(package_root) {
31171
31247
  const vocab_path = path53.join(package_root, PACKS_YML_REL);
31172
- const data = yamlSafeLoad(fs51.readFileSync(vocab_path, "utf-8"));
31248
+ const data = yamlSafeLoad(fs52.readFileSync(vocab_path, "utf-8"));
31173
31249
  if (!Array.isArray(data)) {
31174
31250
  throw new Error(`packs.yml did not parse to a list: ${vocab_path}`);
31175
31251
  }
@@ -31247,7 +31323,7 @@ var init_scoped_projection = __esm({
31247
31323
  });
31248
31324
 
31249
31325
  // src/install/ruleInScope.ts
31250
- import * as fs52 from "node:fs";
31326
+ import * as fs53 from "node:fs";
31251
31327
  function parseYaml4(text) {
31252
31328
  try {
31253
31329
  const data = YAML5.parse(text, { version: "1.1" });
@@ -31285,7 +31361,7 @@ function rule_in_scope(source_path, scope, pack_scope = null, role_scope = null)
31285
31361
  if (scope === null && pack_scope === null && role_scope === null) {
31286
31362
  return true;
31287
31363
  }
31288
- const [meta] = parseFrontmatter2(fs52.readFileSync(source_path, "utf-8"));
31364
+ const [meta] = parseFrontmatter2(fs53.readFileSync(source_path, "utf-8"));
31289
31365
  if (meta["type"] === "always" || meta["alwaysApply"] === true) {
31290
31366
  return true;
31291
31367
  }
@@ -31310,7 +31386,7 @@ var init_ruleInScope = __esm({
31310
31386
  });
31311
31387
 
31312
31388
  // src/install/rule_scope.ts
31313
- import * as fs53 from "node:fs";
31389
+ import * as fs54 from "node:fs";
31314
31390
  import * as path54 from "node:path";
31315
31391
  function _list(value) {
31316
31392
  if (Array.isArray(value) && value.length > 0) {
@@ -31352,7 +31428,7 @@ function ruleFileArrives(sourcePath, scope) {
31352
31428
  function excludedRuleBasenames(rulesDir, scope) {
31353
31429
  let entries;
31354
31430
  try {
31355
- entries = fs53.readdirSync(rulesDir).sort();
31431
+ entries = fs54.readdirSync(rulesDir).sort();
31356
31432
  } catch {
31357
31433
  return [];
31358
31434
  }
@@ -31363,7 +31439,7 @@ function excludedRuleBasenames(rulesDir, scope) {
31363
31439
  }
31364
31440
  const full = path54.join(rulesDir, name);
31365
31441
  try {
31366
- if (!fs53.statSync(full).isFile()) {
31442
+ if (!fs54.statSync(full).isFile()) {
31367
31443
  continue;
31368
31444
  }
31369
31445
  } catch {
@@ -31456,7 +31532,7 @@ __export(cmd_doctor_exports, {
31456
31532
  shutilWhich: () => shutilWhich
31457
31533
  });
31458
31534
  import * as crypto6 from "node:crypto";
31459
- import * as fs54 from "node:fs";
31535
+ import * as fs55 from "node:fs";
31460
31536
  import * as os12 from "node:os";
31461
31537
  import * as path55 from "node:path";
31462
31538
  import process15 from "node:process";
@@ -31470,7 +31546,7 @@ function expanduser5(p) {
31470
31546
  }
31471
31547
  function pathExists(p) {
31472
31548
  try {
31473
- fs54.statSync(p);
31549
+ fs55.statSync(p);
31474
31550
  return true;
31475
31551
  } catch {
31476
31552
  return false;
@@ -31478,27 +31554,27 @@ function pathExists(p) {
31478
31554
  }
31479
31555
  function isFile3(p) {
31480
31556
  try {
31481
- return fs54.statSync(p).isFile();
31557
+ return fs55.statSync(p).isFile();
31482
31558
  } catch {
31483
31559
  return false;
31484
31560
  }
31485
31561
  }
31486
31562
  function isDir2(p) {
31487
31563
  try {
31488
- return fs54.statSync(p).isDirectory();
31564
+ return fs55.statSync(p).isDirectory();
31489
31565
  } catch {
31490
31566
  return false;
31491
31567
  }
31492
31568
  }
31493
31569
  function resolvePath(p) {
31494
31570
  try {
31495
- return fs54.realpathSync(path55.resolve(p));
31571
+ return fs55.realpathSync(path55.resolve(p));
31496
31572
  } catch {
31497
31573
  return path55.resolve(p);
31498
31574
  }
31499
31575
  }
31500
31576
  function readText2(p) {
31501
- return fs54.readFileSync(p, "utf-8");
31577
+ return fs55.readFileSync(p, "utf-8");
31502
31578
  }
31503
31579
  function _jsonStrAscii3(s) {
31504
31580
  let out = '"';
@@ -31713,7 +31789,7 @@ function _resolve_path(project_root, raw) {
31713
31789
  }
31714
31790
  function _sha256(p) {
31715
31791
  try {
31716
- const data = fs54.readFileSync(p);
31792
+ const data = fs55.readFileSync(p);
31717
31793
  return crypto6.createHash("sha256").update(data).digest("hex");
31718
31794
  } catch {
31719
31795
  return null;
@@ -31849,7 +31925,7 @@ function rglob2(root) {
31849
31925
  const walk = (dir) => {
31850
31926
  let entries;
31851
31927
  try {
31852
- entries = fs54.readdirSync(dir, { withFileTypes: true });
31928
+ entries = fs55.readdirSync(dir, { withFileTypes: true });
31853
31929
  } catch {
31854
31930
  return;
31855
31931
  }
@@ -32137,10 +32213,10 @@ function shutilWhich(name) {
32137
32213
  }
32138
32214
  function isExecutableFile(p) {
32139
32215
  try {
32140
- const st = fs54.statSync(p);
32216
+ const st = fs55.statSync(p);
32141
32217
  if (!st.isFile()) return false;
32142
32218
  if (process15.platform === "win32") return true;
32143
- fs54.accessSync(p, fs54.constants.X_OK);
32219
+ fs55.accessSync(p, fs55.constants.X_OK);
32144
32220
  return true;
32145
32221
  } catch {
32146
32222
  return false;
@@ -32251,8 +32327,8 @@ function _check_claude_command_wrappers() {
32251
32327
  remedy: ""
32252
32328
  };
32253
32329
  }
32254
- const flat_probe = fs54.existsSync(path55.join(commands_dir, "commit.md"));
32255
- const wrapper_probe = fs54.existsSync(path55.join(anchor, "skills", "commit", "SKILL.md"));
32330
+ const flat_probe = fs55.existsSync(path55.join(commands_dir, "commit.md"));
32331
+ const wrapper_probe = fs55.existsSync(path55.join(anchor, "skills", "commit", "SKILL.md"));
32256
32332
  if (wrapper_probe) {
32257
32333
  return {
32258
32334
  id: "claude-command-wrappers",
@@ -32343,7 +32419,7 @@ function _check_surface_state() {
32343
32419
  }
32344
32420
  function pathExistsAny(p) {
32345
32421
  try {
32346
- fs54.statSync(p);
32422
+ fs55.statSync(p);
32347
32423
  return true;
32348
32424
  } catch {
32349
32425
  return false;
@@ -32365,7 +32441,7 @@ function _check_hook_wiring() {
32365
32441
  const matrix = build_claude_hook_matrix(
32366
32442
  path55.join(_package_root(), "src", "scripts", "hook_manifest.yaml")
32367
32443
  );
32368
- const settings = pathExists(settings_path) ? JSON.parse(fs54.readFileSync(settings_path, "utf8")) : {};
32444
+ const settings = pathExists(settings_path) ? JSON.parse(fs55.readFileSync(settings_path, "utf8")) : {};
32369
32445
  const hooks = (settings["hooks"] ?? {}) || {};
32370
32446
  missing = Object.keys(matrix).filter((ev) => {
32371
32447
  const groups = hooks[ev];
@@ -32600,7 +32676,7 @@ function _check_rule_scope_drift(project_root) {
32600
32676
  }
32601
32677
  let count = 0;
32602
32678
  try {
32603
- for (const name of fs54.readdirSync(cand)) {
32679
+ for (const name of fs55.readdirSync(cand)) {
32604
32680
  if (name.endsWith(".md") && isFile3(path55.join(cand, name))) {
32605
32681
  count += 1;
32606
32682
  }
@@ -32862,7 +32938,7 @@ function _check_tier_usage_readiness(project_root) {
32862
32938
  };
32863
32939
  }
32864
32940
  function readText0(p) {
32865
- return fs54.readFileSync(p, "utf-8");
32941
+ return fs55.readFileSync(p, "utf-8");
32866
32942
  }
32867
32943
  function osErrorStr2(exc) {
32868
32944
  if (exc && typeof exc === "object" && "message" in exc) {
@@ -33034,7 +33110,7 @@ function _epoch_seconds(value) {
33034
33110
  function _codex_auth_expiry(auth_path) {
33035
33111
  let data;
33036
33112
  try {
33037
- data = JSON.parse(fs54.readFileSync(auth_path, "utf-8"));
33113
+ data = JSON.parse(fs55.readFileSync(auth_path, "utf-8"));
33038
33114
  } catch {
33039
33115
  return null;
33040
33116
  }
@@ -33877,7 +33953,7 @@ function _run_repair(opts) {
33877
33953
  };
33878
33954
  if (exists3) {
33879
33955
  try {
33880
- fs54.unlinkSync(state_pth);
33956
+ fs55.unlinkSync(state_pth);
33881
33957
  } catch (exc) {
33882
33958
  payload["action"] = "error";
33883
33959
  payload["error"] = osErrorStr2(exc);
@@ -33990,8 +34066,8 @@ function _isCliEntry16() {
33990
34066
  return true;
33991
34067
  }
33992
34068
  try {
33993
- const here = fs54.realpathSync(fileURLToPath30(import.meta.url));
33994
- const argv = fs54.realpathSync(path55.resolve(process15.argv[1]));
34069
+ const here = fs55.realpathSync(fileURLToPath30(import.meta.url));
34070
+ const argv = fs55.realpathSync(path55.resolve(process15.argv[1]));
33995
34071
  return here === argv;
33996
34072
  } catch {
33997
34073
  return false;
@@ -34152,12 +34228,12 @@ var init_cmd_doctor = __esm({
34152
34228
  });
34153
34229
 
34154
34230
  // src/install/txlog.ts
34155
- import { createReadStream, createWriteStream, existsSync as existsSync26, readFileSync as readFileSync43, renameSync as renameSync8, statSync as statSync33, unlinkSync as unlinkSync7 } from "node:fs";
34231
+ import { createReadStream, createWriteStream, existsSync as existsSync27, readFileSync as readFileSync44, renameSync as renameSync8, statSync as statSync33, unlinkSync as unlinkSync7 } from "node:fs";
34156
34232
  function readRecentEntries(logPath) {
34157
- if (!existsSync26(logPath)) {
34233
+ if (!existsSync27(logPath)) {
34158
34234
  return [];
34159
34235
  }
34160
- const raw = readFileSync43(logPath, "utf8");
34236
+ const raw = readFileSync44(logPath, "utf8");
34161
34237
  const lines = raw.split("\n").filter((l) => l.length > 0);
34162
34238
  const tail = lines.slice(-RECOVERY_DEPTH_CAP);
34163
34239
  const out = [];
@@ -34192,7 +34268,7 @@ var init_txlog = __esm({
34192
34268
  });
34193
34269
 
34194
34270
  // src/install/detect.ts
34195
- import { existsSync as existsSync27, readFileSync as readFileSync44, readdirSync as readdirSync28, statSync as statSync34 } from "node:fs";
34271
+ import { existsSync as existsSync28, readFileSync as readFileSync45, readdirSync as readdirSync28, statSync as statSync34 } from "node:fs";
34196
34272
  import { join as join50, resolve as resolve30 } from "node:path";
34197
34273
  function detectToolPresence(root) {
34198
34274
  return {
@@ -34200,8 +34276,8 @@ function detectToolPresence(root) {
34200
34276
  claude: isDir3(join50(root, ".claude")),
34201
34277
  cursor: isDir3(join50(root, ".cursor")),
34202
34278
  cline: isDir3(join50(root, ".clinerules")),
34203
- windsurf: isDir3(join50(root, ".windsurf")) || existsSync27(join50(root, ".windsurfrules")),
34204
- agentsMd: existsSync27(join50(root, "AGENTS.md"))
34279
+ windsurf: isDir3(join50(root, ".windsurf")) || existsSync28(join50(root, ".windsurfrules")),
34280
+ agentsMd: existsSync28(join50(root, "AGENTS.md"))
34205
34281
  };
34206
34282
  }
34207
34283
  function isDir3(path81) {
@@ -34314,7 +34390,7 @@ var init_prompt_shape = __esm({
34314
34390
  });
34315
34391
 
34316
34392
  // src/scripts/language_mirror_hook.ts
34317
- import fs55 from "node:fs";
34393
+ import fs56 from "node:fs";
34318
34394
  import path56 from "node:path";
34319
34395
  import { fileURLToPath as fileURLToPath31, pathToFileURL as pathToFileURL19 } from "node:url";
34320
34396
  function hasStableSessionId(session_id) {
@@ -34413,7 +34489,7 @@ This pin exists because the trigger is not observable from the transcript alone:
34413
34489
  }
34414
34490
  function _loadState(target) {
34415
34491
  try {
34416
- const raw = fs55.readFileSync(target, "utf8");
34492
+ const raw = fs56.readFileSync(target, "utf8");
34417
34493
  const decoded = JSON.parse(raw);
34418
34494
  return _isObject3(decoded) ? decoded : {};
34419
34495
  } catch {
@@ -34469,8 +34545,8 @@ function _sessionId(envelope) {
34469
34545
  function _migrateLegacyMarker(consumer_root) {
34470
34546
  const legacy = path56.join(consumer_root, PIN_LOST_DIR);
34471
34547
  try {
34472
- if (fs55.statSync(legacy).isFile()) {
34473
- fs55.rmSync(legacy, { force: true });
34548
+ if (fs56.statSync(legacy).isFile()) {
34549
+ fs56.rmSync(legacy, { force: true });
34474
34550
  }
34475
34551
  } catch {
34476
34552
  }
@@ -34485,7 +34561,7 @@ function _setPinLost(consumer_root, session_id) {
34485
34561
  }
34486
34562
  function _pinLost(consumer_root, session_id) {
34487
34563
  try {
34488
- return fs55.existsSync(path56.join(consumer_root, pinLostMarker(session_id)));
34564
+ return fs56.existsSync(path56.join(consumer_root, pinLostMarker(session_id)));
34489
34565
  } catch {
34490
34566
  return false;
34491
34567
  }
@@ -34493,7 +34569,7 @@ function _pinLost(consumer_root, session_id) {
34493
34569
  function _clearPinLost(consumer_root, session_id) {
34494
34570
  if (is_replay_mode()) return;
34495
34571
  try {
34496
- fs55.rmSync(path56.join(consumer_root, pinLostMarker(session_id)), { force: true });
34572
+ fs56.rmSync(path56.join(consumer_root, pinLostMarker(session_id)), { force: true });
34497
34573
  } catch {
34498
34574
  }
34499
34575
  }
@@ -34532,7 +34608,7 @@ function _reEmitAfterCompaction(consumer_root, session_id, write_json = atomic_w
34532
34608
  function _pruneLegacyState(consumer_root) {
34533
34609
  prune_legacy_state_file(path56.join(consumer_root, STATE_FILE));
34534
34610
  }
34535
- function _pruneStaleSessions(consumer_root, now_ms, mtimeOf = (target) => fs55.statSync(target).mtimeMs) {
34611
+ function _pruneStaleSessions(consumer_root, now_ms, mtimeOf = (target) => fs56.statSync(target).mtimeMs) {
34536
34612
  return prune_stale_session_states(
34537
34613
  path56.join(consumer_root, STATE_DIR),
34538
34614
  now_ms,
@@ -34545,20 +34621,20 @@ function _withToolWriteLock(consumer_root, session_id, when_busy, body, now_ms =
34545
34621
  let fd;
34546
34622
  const acquire = () => {
34547
34623
  try {
34548
- fs55.mkdirSync(path56.dirname(lock), { recursive: true });
34549
- return fs55.openSync(lock, "wx");
34624
+ fs56.mkdirSync(path56.dirname(lock), { recursive: true });
34625
+ return fs56.openSync(lock, "wx");
34550
34626
  } catch (err) {
34551
34627
  if (err.code !== "EEXIST") return null;
34552
34628
  let age;
34553
34629
  try {
34554
- age = now_ms - fs55.statSync(lock).mtimeMs;
34630
+ age = now_ms - fs56.statSync(lock).mtimeMs;
34555
34631
  } catch {
34556
34632
  return null;
34557
34633
  }
34558
34634
  if (age < LOCK_STALE_MS2) return null;
34559
34635
  try {
34560
- fs55.rmSync(lock, { force: true });
34561
- return fs55.openSync(lock, "wx");
34636
+ fs56.rmSync(lock, { force: true });
34637
+ return fs56.openSync(lock, "wx");
34562
34638
  } catch {
34563
34639
  return null;
34564
34640
  }
@@ -34571,11 +34647,11 @@ function _withToolWriteLock(consumer_root, session_id, when_busy, body, now_ms =
34571
34647
  return body();
34572
34648
  } finally {
34573
34649
  try {
34574
- fs55.closeSync(fd);
34650
+ fs56.closeSync(fd);
34575
34651
  } catch {
34576
34652
  }
34577
34653
  try {
34578
- fs55.rmSync(lock, { force: true });
34654
+ fs56.rmSync(lock, { force: true });
34579
34655
  } catch {
34580
34656
  }
34581
34657
  }
@@ -34743,8 +34819,8 @@ function _isCliEntry17() {
34743
34819
  return true;
34744
34820
  }
34745
34821
  try {
34746
- const here = fs55.realpathSync(fileURLToPath31(import.meta.url));
34747
- const argv = fs55.realpathSync(path56.resolve(process.argv[1]));
34822
+ const here = fs56.realpathSync(fileURLToPath31(import.meta.url));
34823
+ const argv = fs56.realpathSync(path56.resolve(process.argv[1]));
34748
34824
  return here === argv;
34749
34825
  } catch {
34750
34826
  return false;
@@ -34780,7 +34856,7 @@ var init_language_mirror_hook = __esm({
34780
34856
  });
34781
34857
 
34782
34858
  // src/scripts/git_authorization_hook.ts
34783
- import fs56 from "node:fs";
34859
+ import fs57 from "node:fs";
34784
34860
  import path57 from "node:path";
34785
34861
  import { fileURLToPath as fileURLToPath32, pathToFileURL as pathToFileURL20 } from "node:url";
34786
34862
  function sessionSlug(session_id) {
@@ -34870,12 +34946,12 @@ function takePending(consumer_root, session_id, now) {
34870
34946
  const file = path57.join(consumer_root, pendingFileFor(session_id));
34871
34947
  let raw;
34872
34948
  try {
34873
- raw = fs56.readFileSync(file, "utf8");
34949
+ raw = fs57.readFileSync(file, "utf8");
34874
34950
  } catch {
34875
34951
  return null;
34876
34952
  }
34877
34953
  try {
34878
- fs56.rmSync(file, { force: true });
34954
+ fs57.rmSync(file, { force: true });
34879
34955
  } catch {
34880
34956
  }
34881
34957
  try {
@@ -34970,8 +35046,8 @@ function _isCliEntry18() {
34970
35046
  return true;
34971
35047
  }
34972
35048
  try {
34973
- const here = fs56.realpathSync(fileURLToPath32(import.meta.url));
34974
- const argv = fs56.realpathSync(path57.resolve(process.argv[1]));
35049
+ const here = fs57.realpathSync(fileURLToPath32(import.meta.url));
35050
+ const argv = fs57.realpathSync(path57.resolve(process.argv[1]));
34975
35051
  return here === argv;
34976
35052
  } catch {
34977
35053
  return false;
@@ -35038,7 +35114,7 @@ var init_git_authorization_hook = __esm({
35038
35114
  });
35039
35115
 
35040
35116
  // src/scripts/hooks/block_unauthorized_git.ts
35041
- import fs57 from "node:fs";
35117
+ import fs58 from "node:fs";
35042
35118
  import path58 from "node:path";
35043
35119
  import { fileURLToPath as fileURLToPath33, pathToFileURL as pathToFileURL21 } from "node:url";
35044
35120
  function _isObject5(v) {
@@ -35242,7 +35318,7 @@ function _loadLedger(consumer_root, session_id, now) {
35242
35318
  }
35243
35319
  function _readLedgerFile(file, session_id, now) {
35244
35320
  try {
35245
- const raw = fs57.readFileSync(file, "utf8");
35321
+ const raw = fs58.readFileSync(file, "utf8");
35246
35322
  const decoded = JSON.parse(raw);
35247
35323
  if (_isObject5(decoded) && Array.isArray(decoded["authorized"])) {
35248
35324
  const ledgerSession = typeof decoded["session_id"] === "string" ? decoded["session_id"] : "";
@@ -35348,8 +35424,8 @@ function _isCliEntry19() {
35348
35424
  return true;
35349
35425
  }
35350
35426
  try {
35351
- const here = fs57.realpathSync(fileURLToPath33(import.meta.url));
35352
- const argv = fs57.realpathSync(path58.resolve(process.argv[1]));
35427
+ const here = fs58.realpathSync(fileURLToPath33(import.meta.url));
35428
+ const argv = fs58.realpathSync(path58.resolve(process.argv[1]));
35353
35429
  return here === argv;
35354
35430
  } catch {
35355
35431
  return false;
@@ -35414,7 +35490,7 @@ var init_block_unauthorized_git = __esm({
35414
35490
  "execute_shell",
35415
35491
  "RunShellCommand"
35416
35492
  ]);
35417
- LEDGER_MAX_AGE_MS = 6 * 60 * 60 * 1e3;
35493
+ LEDGER_MAX_AGE_MS = 30 * 60 * 1e3;
35418
35494
  if (_isCliEntry19()) {
35419
35495
  process.exit(main21());
35420
35496
  }
@@ -35422,7 +35498,7 @@ var init_block_unauthorized_git = __esm({
35422
35498
  });
35423
35499
 
35424
35500
  // src/scripts/before_complete_hook.ts
35425
- import fs58 from "node:fs";
35501
+ import fs59 from "node:fs";
35426
35502
  import path59 from "node:path";
35427
35503
  import { fileURLToPath as fileURLToPath34, pathToFileURL as pathToFileURL22 } from "node:url";
35428
35504
  function statePathFor2(session_id) {
@@ -35695,8 +35771,8 @@ function _isCliEntry20() {
35695
35771
  return true;
35696
35772
  }
35697
35773
  try {
35698
- const here = fs58.realpathSync(fileURLToPath34(import.meta.url));
35699
- const argv = fs58.realpathSync(path59.resolve(process.argv[1]));
35774
+ const here = fs59.realpathSync(fileURLToPath34(import.meta.url));
35775
+ const argv = fs59.realpathSync(path59.resolve(process.argv[1]));
35700
35776
  return here === argv;
35701
35777
  } catch {
35702
35778
  return false;
@@ -35856,9 +35932,9 @@ var init_envelope = __esm({
35856
35932
  });
35857
35933
 
35858
35934
  // src/scripts/hooks/end_review_nudge_hook.ts
35859
- import { spawnSync as spawnSync10 } from "node:child_process";
35935
+ import { spawnSync as spawnSync11 } from "node:child_process";
35860
35936
  import * as crypto7 from "node:crypto";
35861
- import * as fs59 from "node:fs";
35937
+ import * as fs60 from "node:fs";
35862
35938
  import * as os13 from "node:os";
35863
35939
  import * as path60 from "node:path";
35864
35940
  import { fileURLToPath as fileURLToPath35, pathToFileURL as pathToFileURL23 } from "node:url";
@@ -35867,13 +35943,13 @@ function isSafeTranscriptPath(rawPath, opts = {}) {
35867
35943
  const homeDir = opts.homeDir ?? os13.homedir();
35868
35944
  const maxBytes = opts.maxBytes ?? TRANSCRIPT_SCAN_MAX_BYTES;
35869
35945
  try {
35870
- const realHome = fs59.realpathSync(homeDir);
35871
- const realPath = fs59.realpathSync(rawPath);
35946
+ const realHome = fs60.realpathSync(homeDir);
35947
+ const realPath = fs60.realpathSync(rawPath);
35872
35948
  const relative16 = path60.relative(realHome, realPath);
35873
35949
  if (relative16 === "" || relative16.startsWith("..") || path60.isAbsolute(relative16)) {
35874
35950
  return false;
35875
35951
  }
35876
- const { size } = fs59.statSync(realPath);
35952
+ const { size } = fs60.statSync(realPath);
35877
35953
  return size <= maxBytes;
35878
35954
  } catch {
35879
35955
  return false;
@@ -35902,7 +35978,7 @@ function nonDocMutatedLines(rows) {
35902
35978
  }
35903
35979
  function gitNumstatRows(cwd) {
35904
35980
  try {
35905
- const r = spawnSync10("git", ["diff", "--numstat", "HEAD"], {
35981
+ const r = spawnSync11("git", ["diff", "--numstat", "HEAD"], {
35906
35982
  cwd,
35907
35983
  encoding: "utf8",
35908
35984
  maxBuffer: 16 * 1024 * 1024
@@ -35915,7 +35991,7 @@ function gitNumstatRows(cwd) {
35915
35991
  }
35916
35992
  function untrackedNonDocFiles(cwd) {
35917
35993
  try {
35918
- const r = spawnSync10("git", ["ls-files", "--others", "--exclude-standard"], {
35994
+ const r = spawnSync11("git", ["ls-files", "--others", "--exclude-standard"], {
35919
35995
  cwd,
35920
35996
  encoding: "utf8",
35921
35997
  maxBuffer: 16 * 1024 * 1024
@@ -35929,12 +36005,12 @@ function untrackedNonDocFiles(cwd) {
35929
36005
  function untrackedFileLineCount(cwd, relPath) {
35930
36006
  try {
35931
36007
  const abs = path60.resolve(cwd, relPath);
35932
- const size = fs59.statSync(abs).size;
36008
+ const size = fs60.statSync(abs).size;
35933
36009
  if (size === 0) return 0;
35934
36010
  if (size > UNTRACKED_FILE_READ_CAP_BYTES) {
35935
36011
  return MUTATION_LINE_THRESHOLD + 1;
35936
36012
  }
35937
- const buf = fs59.readFileSync(abs);
36013
+ const buf = fs60.readFileSync(abs);
35938
36014
  if (buf.length === 0) return 0;
35939
36015
  const probe = buf.subarray(0, Math.min(buf.length, BINARY_PROBE_BYTES));
35940
36016
  if (probe.includes(0)) return 0;
@@ -36021,9 +36097,9 @@ function appendReviewSkippedTelemetry(workspaceRoot, diffLines, mutationMeasure)
36021
36097
  if (errors.length || line === null) return;
36022
36098
  try {
36023
36099
  const dir = path60.join(workspaceRoot, "agents", "runtime", "state", "audit");
36024
- fs59.mkdirSync(dir, { recursive: true });
36100
+ fs60.mkdirSync(dir, { recursive: true });
36025
36101
  const file = path60.join(dir, `${ts.slice(0, 7)}.jsonl`);
36026
- fs59.appendFileSync(file, `${JSON.stringify(line)}
36102
+ fs60.appendFileSync(file, `${JSON.stringify(line)}
36027
36103
  `, "utf8");
36028
36104
  } catch {
36029
36105
  }
@@ -36041,7 +36117,7 @@ function deriveSessionKey(envelope, payload) {
36041
36117
  }
36042
36118
  function hasFiredThisSession(workspaceRoot, sessionKey) {
36043
36119
  try {
36044
- return fs59.existsSync(sessionStateFile(workspaceRoot, sessionKey));
36120
+ return fs60.existsSync(sessionStateFile(workspaceRoot, sessionKey));
36045
36121
  } catch {
36046
36122
  return false;
36047
36123
  }
@@ -36084,7 +36160,7 @@ function main23() {
36084
36160
  let reviewerRan = false;
36085
36161
  if (transcriptPath && isSafeTranscriptPath(transcriptPath)) {
36086
36162
  try {
36087
- reviewerRan = scanTranscriptForReviewer(fs59.readFileSync(transcriptPath, "utf-8"));
36163
+ reviewerRan = scanTranscriptForReviewer(fs60.readFileSync(transcriptPath, "utf-8"));
36088
36164
  } catch {
36089
36165
  reviewerRan = false;
36090
36166
  }
@@ -36119,8 +36195,8 @@ function _isCliEntry21() {
36119
36195
  return true;
36120
36196
  }
36121
36197
  try {
36122
- const here = fs59.realpathSync(fileURLToPath35(import.meta.url));
36123
- const argv = fs59.realpathSync(path60.resolve(process.argv[1]));
36198
+ const here = fs60.realpathSync(fileURLToPath35(import.meta.url));
36199
+ const argv = fs60.realpathSync(path60.resolve(process.argv[1]));
36124
36200
  return here === argv;
36125
36201
  } catch {
36126
36202
  return false;
@@ -36287,7 +36363,7 @@ var init_subagent_response = __esm({
36287
36363
 
36288
36364
  // src/scripts/hooks/subagent_ledger_hook.ts
36289
36365
  import * as crypto8 from "node:crypto";
36290
- import * as fs60 from "node:fs";
36366
+ import * as fs61 from "node:fs";
36291
36367
  import * as path61 from "node:path";
36292
36368
  import { fileURLToPath as fileURLToPath36, pathToFileURL as pathToFileURL24 } from "node:url";
36293
36369
  function isObject2(v) {
@@ -36400,7 +36476,7 @@ function readOpenRecords(root) {
36400
36476
  const out = /* @__PURE__ */ new Map();
36401
36477
  let names;
36402
36478
  try {
36403
- names = fs60.readdirSync(openDir(root));
36479
+ names = fs61.readdirSync(openDir(root));
36404
36480
  } catch {
36405
36481
  return out;
36406
36482
  }
@@ -36408,7 +36484,7 @@ function readOpenRecords(root) {
36408
36484
  if (!name.endsWith(".json")) continue;
36409
36485
  const expectedRef = name.slice(0, -".json".length);
36410
36486
  try {
36411
- const raw = fs60.readFileSync(path61.join(openDir(root), name), "utf8");
36487
+ const raw = fs61.readFileSync(path61.join(openDir(root), name), "utf8");
36412
36488
  const rec = _asOpenRecord(JSON.parse(raw), expectedRef);
36413
36489
  if (rec) out.set(rec.ref, rec);
36414
36490
  } catch {
@@ -36428,8 +36504,8 @@ function ledgerFileFor2(root, ts) {
36428
36504
  function appendLedgerLine(root, ts, line) {
36429
36505
  if (is_replay_mode()) return;
36430
36506
  const file = ledgerFileFor2(root, ts);
36431
- fs60.mkdirSync(path61.dirname(file), { recursive: true });
36432
- fs60.appendFileSync(file, `${JSON.stringify(line)}
36507
+ fs61.mkdirSync(path61.dirname(file), { recursive: true });
36508
+ fs61.appendFileSync(file, `${JSON.stringify(line)}
36433
36509
  `, "utf8");
36434
36510
  }
36435
36511
  function armsExceeded(elapsedMs) {
@@ -36437,7 +36513,7 @@ function armsExceeded(elapsedMs) {
36437
36513
  return WALL_CLOCK_ARMS_MS.filter((a) => elapsedMs >= a.ms).map((a) => a.label);
36438
36514
  }
36439
36515
  function openRecordStats(root, nowMs = Date.now()) {
36440
- const ledgerPresent = fs60.existsSync(path61.join(root, LEDGER_DIR));
36516
+ const ledgerPresent = fs61.existsSync(path61.join(root, LEDGER_DIR));
36441
36517
  const open = readOpenRecords(root);
36442
36518
  let maxDepth = 0;
36443
36519
  let counted = 0;
@@ -36465,13 +36541,13 @@ function writeOpenRecord(root, rec) {
36465
36541
  function removeOpenRecord(root, ref) {
36466
36542
  if (is_replay_mode()) return;
36467
36543
  try {
36468
- fs60.unlinkSync(openFile(root, ref));
36544
+ fs61.unlinkSync(openFile(root, ref));
36469
36545
  } catch {
36470
36546
  }
36471
36547
  }
36472
36548
  function countOpen(root) {
36473
36549
  try {
36474
- return fs60.readdirSync(openDir(root)).filter((n) => n.endsWith(".json")).length;
36550
+ return fs61.readdirSync(openDir(root)).filter((n) => n.endsWith(".json")).length;
36475
36551
  } catch {
36476
36552
  return 0;
36477
36553
  }
@@ -36637,7 +36713,7 @@ function _isCliEntry22() {
36637
36713
  const argvUrl = pathToFileURL24(path61.resolve(process.argv[1])).href;
36638
36714
  if (import.meta.url === argvUrl) return true;
36639
36715
  try {
36640
- return fs60.realpathSync(fileURLToPath36(import.meta.url)) === fs60.realpathSync(path61.resolve(process.argv[1]));
36716
+ return fs61.realpathSync(fileURLToPath36(import.meta.url)) === fs61.realpathSync(path61.resolve(process.argv[1]));
36641
36717
  } catch {
36642
36718
  return false;
36643
36719
  }
@@ -36776,7 +36852,7 @@ var init_turn_end_refusals = __esm({
36776
36852
  });
36777
36853
 
36778
36854
  // src/scripts/hooks/turn_end_gate_hook.ts
36779
- import * as fs61 from "node:fs";
36855
+ import * as fs62 from "node:fs";
36780
36856
  import * as path63 from "node:path";
36781
36857
  import { fileURLToPath as fileURLToPath37, pathToFileURL as pathToFileURL25 } from "node:url";
36782
36858
  function stripFencedBlocks(text) {
@@ -36835,7 +36911,7 @@ function detectPromissory(reply) {
36835
36911
  function readCiSettled(workspaceRoot, session_id) {
36836
36912
  if (!hasStableSessionId(session_id)) return { seen: false, settled: false };
36837
36913
  try {
36838
- const raw = fs61.readFileSync(path63.join(workspaceRoot, statePathFor2(session_id)), "utf-8");
36914
+ const raw = fs62.readFileSync(path63.join(workspaceRoot, statePathFor2(session_id)), "utf-8");
36839
36915
  const decoded = JSON.parse(raw);
36840
36916
  if (!owns_session_state(decoded, session_id)) return { seen: false, settled: false };
36841
36917
  if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
@@ -36869,7 +36945,7 @@ function detectCompletionClaim(reply, ci) {
36869
36945
  function readLanguagePin(workspaceRoot, session_id) {
36870
36946
  if (!hasStableSessionId(session_id)) return "und";
36871
36947
  try {
36872
- const raw = fs61.readFileSync(
36948
+ const raw = fs62.readFileSync(
36873
36949
  path63.join(workspaceRoot, statePathFor(session_id)),
36874
36950
  "utf-8"
36875
36951
  );
@@ -36924,7 +37000,7 @@ function sessionStateFile2(workspaceRoot, sessionKey) {
36924
37000
  }
36925
37001
  function alreadyRefusedTurn(workspaceRoot, sessionKey, turnOrdinal) {
36926
37002
  try {
36927
- const raw = fs61.readFileSync(sessionStateFile2(workspaceRoot, sessionKey), "utf-8");
37003
+ const raw = fs62.readFileSync(sessionStateFile2(workspaceRoot, sessionKey), "utf-8");
36928
37004
  const decoded = JSON.parse(raw);
36929
37005
  if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
36930
37006
  return decoded["refused_turn"] === turnOrdinal;
@@ -36938,7 +37014,7 @@ function markRefusedTurn(workspaceRoot, sessionKey, turnOrdinal, detectors) {
36938
37014
  const file = sessionStateFile2(workspaceRoot, sessionKey);
36939
37015
  let prev = null;
36940
37016
  try {
36941
- prev = parseRecord(fs61.readFileSync(file, "utf-8"));
37017
+ prev = parseRecord(fs62.readFileSync(file, "utf-8"));
36942
37018
  } catch {
36943
37019
  }
36944
37020
  let version;
@@ -36965,10 +37041,10 @@ function readTranscriptTail(transcriptPath, opts = {}) {
36965
37041
  if (!transcriptPath || !isSafeTranscriptPath(transcriptPath, opts)) return empty;
36966
37042
  let lines;
36967
37043
  try {
36968
- if (opts.maxBytes !== void 0 && fs61.statSync(transcriptPath).size > opts.maxBytes) {
37044
+ if (opts.maxBytes !== void 0 && fs62.statSync(transcriptPath).size > opts.maxBytes) {
36969
37045
  return empty;
36970
37046
  }
36971
- lines = fs61.readFileSync(transcriptPath, "utf-8").split("\n");
37047
+ lines = fs62.readFileSync(transcriptPath, "utf-8").split("\n");
36972
37048
  } catch {
36973
37049
  return empty;
36974
37050
  }
@@ -37123,8 +37199,8 @@ function _isCliEntry23() {
37123
37199
  return true;
37124
37200
  }
37125
37201
  try {
37126
- const here = fs61.realpathSync(fileURLToPath37(import.meta.url));
37127
- const argv = fs61.realpathSync(path63.resolve(process.argv[1]));
37202
+ const here = fs62.realpathSync(fileURLToPath37(import.meta.url));
37203
+ const argv = fs62.realpathSync(path63.resolve(process.argv[1]));
37128
37204
  return here === argv;
37129
37205
  } catch {
37130
37206
  return false;
@@ -37204,7 +37280,7 @@ var init_turn_end_gate_hook = __esm({
37204
37280
 
37205
37281
  // src/scripts/hooks/evidence_independence.ts
37206
37282
  import crypto10 from "node:crypto";
37207
- import fs62 from "node:fs";
37283
+ import fs63 from "node:fs";
37208
37284
  import path64 from "node:path";
37209
37285
  import { fileURLToPath as fileURLToPath38, pathToFileURL as pathToFileURL26 } from "node:url";
37210
37286
  function _isObject7(v) {
@@ -37243,7 +37319,7 @@ function extractDispatch(envelope) {
37243
37319
  }
37244
37320
  function _ledgerStamp(consumer_root) {
37245
37321
  try {
37246
- const raw = fs62.readFileSync(
37322
+ const raw = fs63.readFileSync(
37247
37323
  path64.join(consumer_root, "agents", "state", "git-authorization.json"),
37248
37324
  "utf8"
37249
37325
  );
@@ -37255,7 +37331,7 @@ function _ledgerStamp(consumer_root) {
37255
37331
  }
37256
37332
  function _load2(target) {
37257
37333
  try {
37258
- const decoded = JSON.parse(fs62.readFileSync(target, "utf8"));
37334
+ const decoded = JSON.parse(fs63.readFileSync(target, "utf8"));
37259
37335
  if (_isObject7(decoded) && Array.isArray(decoded["evaluations"])) {
37260
37336
  return decoded;
37261
37337
  }
@@ -37368,8 +37444,8 @@ function _isCliEntry24() {
37368
37444
  return true;
37369
37445
  }
37370
37446
  try {
37371
- const here = fs62.realpathSync(fileURLToPath38(import.meta.url));
37372
- const argv = fs62.realpathSync(path64.resolve(process.argv[1]));
37447
+ const here = fs63.realpathSync(fileURLToPath38(import.meta.url));
37448
+ const argv = fs63.realpathSync(path64.resolve(process.argv[1]));
37373
37449
  return here === argv;
37374
37450
  } catch {
37375
37451
  return false;
@@ -37771,7 +37847,7 @@ var init_subagent_routing = __esm({
37771
37847
  });
37772
37848
 
37773
37849
  // src/scripts/hooks/delegation_nudge_hook.ts
37774
- import fs63 from "node:fs";
37850
+ import fs64 from "node:fs";
37775
37851
  import path65 from "node:path";
37776
37852
  import { fileURLToPath as fileURLToPath39, pathToFileURL as pathToFileURL27 } from "node:url";
37777
37853
  function _isObject8(v) {
@@ -37976,8 +38052,8 @@ function _isCliEntry25() {
37976
38052
  return true;
37977
38053
  }
37978
38054
  try {
37979
- const here = fs63.realpathSync(fileURLToPath39(import.meta.url));
37980
- const argv = fs63.realpathSync(path65.resolve(process.argv[1]));
38055
+ const here = fs64.realpathSync(fileURLToPath39(import.meta.url));
38056
+ const argv = fs64.realpathSync(path65.resolve(process.argv[1]));
37981
38057
  return here === argv;
37982
38058
  } catch {
37983
38059
  return false;
@@ -38012,7 +38088,7 @@ var init_delegation_nudge_hook = __esm({
38012
38088
 
38013
38089
  // src/scripts/conformance_scan.ts
38014
38090
  import { createHash as createHash12 } from "node:crypto";
38015
- import fs64 from "node:fs";
38091
+ import fs65 from "node:fs";
38016
38092
  import os14 from "node:os";
38017
38093
  import path66 from "node:path";
38018
38094
  import { fileURLToPath as fileURLToPath40, pathToFileURL as pathToFileURL28 } from "node:url";
@@ -38352,13 +38428,13 @@ function measureDelivered(projectRulesDir, globalRulesDir) {
38352
38428
  return {
38353
38429
  project: {
38354
38430
  dir: projectRulesDir,
38355
- present: fs64.existsSync(projectRulesDir),
38431
+ present: fs65.existsSync(projectRulesDir),
38356
38432
  files: p.files,
38357
38433
  tokens: _tokens(p.chars)
38358
38434
  },
38359
38435
  global: {
38360
38436
  dir: globalRulesDir,
38361
- present: fs64.existsSync(globalRulesDir),
38437
+ present: fs65.existsSync(globalRulesDir),
38362
38438
  files: g.files,
38363
38439
  tokens: _tokens(g.chars)
38364
38440
  },
@@ -38369,10 +38445,10 @@ function storeKey(store) {
38369
38445
  return createHash12("sha256").update(path66.resolve(store)).digest("hex").slice(0, 12);
38370
38446
  }
38371
38447
  function scanStore(store, limit) {
38372
- const files = fs64.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ f, m: fs64.statSync(path66.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.f);
38448
+ const files = fs65.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ f, m: fs65.statSync(path66.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.f);
38373
38449
  const per_session = [];
38374
38450
  for (const f of files) {
38375
- const lines = fs64.readFileSync(path66.join(store, f), "utf8").split("\n");
38451
+ const lines = fs65.readFileSync(path66.join(store, f), "utf8").split("\n");
38376
38452
  const r = scanSession(f.replace(/\.jsonl$/, "").slice(0, 8), lines);
38377
38453
  if (r.assistant_turns > 0) {
38378
38454
  per_session.push(r);
@@ -38433,8 +38509,8 @@ function scanStore(store, limit) {
38433
38509
  };
38434
38510
  }
38435
38511
  function recordRate(file, scanned_at, rate) {
38436
- fs64.mkdirSync(path66.dirname(file), { recursive: true });
38437
- fs64.appendFileSync(file, `${JSON.stringify({ measured_at: scanned_at, ...rate })}
38512
+ fs65.mkdirSync(path66.dirname(file), { recursive: true });
38513
+ fs65.appendFileSync(file, `${JSON.stringify({ measured_at: scanned_at, ...rate })}
38438
38514
  `, "utf8");
38439
38515
  }
38440
38516
  function render2(report2) {
@@ -38565,14 +38641,14 @@ function main28(argv) {
38565
38641
  return 2;
38566
38642
  }
38567
38643
  const resolved = store ?? defaultStore(process.cwd());
38568
- if (!fs64.existsSync(resolved)) {
38644
+ if (!fs65.existsSync(resolved)) {
38569
38645
  process.stderr.write(`conformance:behavior: no transcript store at ${resolved}
38570
38646
  `);
38571
38647
  return 1;
38572
38648
  }
38573
38649
  const report2 = scanStore(resolved, Number.isFinite(limit) && limit > 0 ? limit : 30);
38574
38650
  if (out) {
38575
- fs64.writeFileSync(out, `${JSON.stringify(report2, null, 2)}
38651
+ fs65.writeFileSync(out, `${JSON.stringify(report2, null, 2)}
38576
38652
  `, "utf8");
38577
38653
  }
38578
38654
  if (record) {
@@ -38580,7 +38656,7 @@ function main28(argv) {
38580
38656
  }
38581
38657
  if (why !== null) {
38582
38658
  const id = why;
38583
- fs64.writeSync(
38659
+ fs65.writeSync(
38584
38660
  1,
38585
38661
  json ? `${JSON.stringify(
38586
38662
  {
@@ -38600,7 +38676,7 @@ function main28(argv) {
38600
38676
  );
38601
38677
  return 0;
38602
38678
  }
38603
- fs64.writeSync(1, json ? `${JSON.stringify(report2, null, 2)}
38679
+ fs65.writeSync(1, json ? `${JSON.stringify(report2, null, 2)}
38604
38680
  ` : `${render2(report2)}
38605
38681
  `);
38606
38682
  return 0;
@@ -38617,8 +38693,8 @@ function _isCliEntry26() {
38617
38693
  return true;
38618
38694
  }
38619
38695
  try {
38620
- const here = fs64.realpathSync(fileURLToPath40(import.meta.url));
38621
- const argv = fs64.realpathSync(path66.resolve(process.argv[1]));
38696
+ const here = fs65.realpathSync(fileURLToPath40(import.meta.url));
38697
+ const argv = fs65.realpathSync(path66.resolve(process.argv[1]));
38622
38698
  return here === argv;
38623
38699
  } catch {
38624
38700
  return false;
@@ -38680,14 +38756,14 @@ var init_conformance_scan = __esm({
38680
38756
  });
38681
38757
 
38682
38758
  // src/scripts/report_carrier_divergence.ts
38683
- import * as fs65 from "node:fs";
38759
+ import * as fs66 from "node:fs";
38684
38760
  import * as os15 from "node:os";
38685
38761
  import * as path67 from "node:path";
38686
38762
  import process17 from "node:process";
38687
38763
  import { fileURLToPath as fileURLToPath41, pathToFileURL as pathToFileURL29 } from "node:url";
38688
38764
  function _listRules(dir) {
38689
38765
  try {
38690
- return fs65.readdirSync(dir).filter((f) => f.endsWith(".md")).sort();
38766
+ return fs66.readdirSync(dir).filter((f) => f.endsWith(".md")).sort();
38691
38767
  } catch {
38692
38768
  return [];
38693
38769
  }
@@ -38695,7 +38771,7 @@ function _listRules(dir) {
38695
38771
  function _ruleType(file) {
38696
38772
  let text;
38697
38773
  try {
38698
- text = fs65.readFileSync(file, "utf-8");
38774
+ text = fs66.readFileSync(file, "utf-8");
38699
38775
  } catch {
38700
38776
  return "";
38701
38777
  }
@@ -38706,8 +38782,8 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
38706
38782
  const out = {
38707
38783
  projectDir,
38708
38784
  globalDir,
38709
- globalPresent: fs65.existsSync(globalDir),
38710
- projectPresent: fs65.existsSync(projectDir),
38785
+ globalPresent: fs66.existsSync(globalDir),
38786
+ projectPresent: fs66.existsSync(projectDir),
38711
38787
  shared: 0,
38712
38788
  identical: [],
38713
38789
  provenanceOnly: [],
@@ -38740,8 +38816,8 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
38740
38816
  let projectCopy;
38741
38817
  let globalCopy;
38742
38818
  try {
38743
- projectCopy = fs65.readFileSync(path67.join(projectDir, rule));
38744
- globalCopy = fs65.readFileSync(path67.join(globalDir, rule));
38819
+ projectCopy = fs66.readFileSync(path67.join(projectDir, rule));
38820
+ globalCopy = fs66.readFileSync(path67.join(globalDir, rule));
38745
38821
  verdict = comparePair(projectCopy, globalCopy);
38746
38822
  } catch {
38747
38823
  out.shared -= 1;
@@ -38928,7 +39004,7 @@ function _isCliEntry27() {
38928
39004
  if (process17.argv[1] === void 0) return false;
38929
39005
  if (import.meta.url === pathToFileURL29(path67.resolve(process17.argv[1])).href) return true;
38930
39006
  try {
38931
- return fs65.realpathSync(_HERE18) === fs65.realpathSync(path67.resolve(process17.argv[1]));
39007
+ return fs66.realpathSync(_HERE18) === fs66.realpathSync(path67.resolve(process17.argv[1]));
38932
39008
  } catch {
38933
39009
  return false;
38934
39010
  }
@@ -38950,25 +39026,25 @@ var init_report_carrier_divergence = __esm({
38950
39026
  });
38951
39027
 
38952
39028
  // src/scripts/report_skill_activation.ts
38953
- import * as fs66 from "node:fs";
39029
+ import * as fs67 from "node:fs";
38954
39030
  import * as os16 from "node:os";
38955
39031
  import * as path68 from "node:path";
38956
39032
  import { fileURLToPath as fileURLToPath42, pathToFileURL as pathToFileURL30 } from "node:url";
38957
39033
  function censusSkills(root) {
38958
39034
  const out = { total: 0, withTriggerKey: [], withDeterministicObligation: [] };
38959
- if (!fs66.existsSync(root)) {
39035
+ if (!fs67.existsSync(root)) {
38960
39036
  return out;
38961
39037
  }
38962
- for (const entry of fs66.readdirSync(root, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
39038
+ for (const entry of fs67.readdirSync(root, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
38963
39039
  if (!entry.isDirectory()) {
38964
39040
  continue;
38965
39041
  }
38966
39042
  const file = path68.join(root, entry.name, "SKILL.md");
38967
- if (!fs66.existsSync(file)) {
39043
+ if (!fs67.existsSync(file)) {
38968
39044
  continue;
38969
39045
  }
38970
39046
  out.total += 1;
38971
- const text = fs66.readFileSync(file, "utf8");
39047
+ const text = fs67.readFileSync(file, "utf8");
38972
39048
  const fmEnd = text.startsWith("---") ? text.indexOf("\n---", 3) : -1;
38973
39049
  const fm = fmEnd === -1 ? "" : text.slice(0, fmEnd);
38974
39050
  if (TRIGGER_KEYS.some((k) => new RegExp(`^${k}`, "m").test(fm))) {
@@ -38986,13 +39062,13 @@ function defaultStore2(cwd) {
38986
39062
  }
38987
39063
  function measureUsage(store, limit) {
38988
39064
  const rep = { store, sessions: 0, assistantTurns: 0, invocations: 0, bySkill: {} };
38989
- if (!fs66.existsSync(store)) {
39065
+ if (!fs67.existsSync(store)) {
38990
39066
  return rep;
38991
39067
  }
38992
- const files = fs66.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => path68.join(store, f)).sort((a, b) => fs66.statSync(b).mtimeMs - fs66.statSync(a).mtimeMs).slice(0, limit);
39068
+ const files = fs67.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => path68.join(store, f)).sort((a, b) => fs67.statSync(b).mtimeMs - fs67.statSync(a).mtimeMs).slice(0, limit);
38993
39069
  rep.sessions = files.length;
38994
39070
  for (const file of files) {
38995
- for (const line of fs66.readFileSync(file, "utf8").split("\n")) {
39071
+ for (const line of fs67.readFileSync(file, "utf8").split("\n")) {
38996
39072
  if (!line.trim()) {
38997
39073
  continue;
38998
39074
  }
@@ -39126,7 +39202,7 @@ var init_report_skill_activation = __esm({
39126
39202
  });
39127
39203
 
39128
39204
  // src/scripts/report_skill_obligation_violations.ts
39129
- import * as fs67 from "node:fs";
39205
+ import * as fs68 from "node:fs";
39130
39206
  import * as os17 from "node:os";
39131
39207
  import * as path69 from "node:path";
39132
39208
  import process18 from "node:process";
@@ -39163,7 +39239,7 @@ function extractObligations(repoRoot) {
39163
39239
  for (const skill of census.withDeterministicObligation) {
39164
39240
  let text;
39165
39241
  try {
39166
- text = fs67.readFileSync(path69.join(skillsRoot, skill, "SKILL.md"), "utf-8");
39242
+ text = fs68.readFileSync(path69.join(skillsRoot, skill, "SKILL.md"), "utf-8");
39167
39243
  } catch {
39168
39244
  continue;
39169
39245
  }
@@ -39278,13 +39354,13 @@ function scanStore2(repoRoot, store, limit) {
39278
39354
  };
39279
39355
  let files;
39280
39356
  try {
39281
- files = fs67.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ p: path69.join(store, f), m: fs67.statSync(path69.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.p);
39357
+ files = fs68.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ p: path69.join(store, f), m: fs68.statSync(path69.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.p);
39282
39358
  } catch {
39283
39359
  return report2;
39284
39360
  }
39285
39361
  report2.sessions = files.length;
39286
39362
  for (const file of files) {
39287
- const lines = fs67.readFileSync(file, "utf-8").split("\n");
39363
+ const lines = fs68.readFileSync(file, "utf-8").split("\n");
39288
39364
  const id = path69.basename(file).replace(/\.jsonl$/, "").slice(0, 8);
39289
39365
  const entries = _parseSession(lines);
39290
39366
  if (loadedSkillsFrom(entries).size > 0) report2.sessionsWithASkill += 1;
@@ -39412,7 +39488,7 @@ function _isCliEntry28() {
39412
39488
  if (process18.argv[1] === void 0) return false;
39413
39489
  if (import.meta.url === pathToFileURL31(path69.resolve(process18.argv[1])).href) return true;
39414
39490
  try {
39415
- return fs67.realpathSync(_HERE20) === fs67.realpathSync(path69.resolve(process18.argv[1]));
39491
+ return fs68.realpathSync(_HERE20) === fs68.realpathSync(path69.resolve(process18.argv[1]));
39416
39492
  } catch {
39417
39493
  return false;
39418
39494
  }
@@ -39466,7 +39542,7 @@ var init_report_skill_obligation_violations = __esm({
39466
39542
  });
39467
39543
 
39468
39544
  // src/scripts/report_conformance_funnel.ts
39469
- import * as fs68 from "node:fs";
39545
+ import * as fs69 from "node:fs";
39470
39546
  import * as os18 from "node:os";
39471
39547
  import * as path70 from "node:path";
39472
39548
  import process19 from "node:process";
@@ -39483,7 +39559,7 @@ function buildFunnel(opts = {}) {
39483
39559
  divergence: compareCarriers(projectRulesDir, globalRulesDir, sourceDir),
39484
39560
  skills: censusSkills(path70.join(repoRoot, SKILLS_ROOT)),
39485
39561
  usage: measureUsage(store, limit),
39486
- storePresent: fs68.existsSync(store),
39562
+ storePresent: fs69.existsSync(store),
39487
39563
  sk2: scanStore2(repoRoot, store, limit)
39488
39564
  };
39489
39565
  }
@@ -39658,7 +39734,7 @@ function _isCliEntry29() {
39658
39734
  if (process19.argv[1] === void 0) return false;
39659
39735
  if (import.meta.url === pathToFileURL32(path70.resolve(process19.argv[1])).href) return true;
39660
39736
  try {
39661
- return fs68.realpathSync(_HERE21) === fs68.realpathSync(path70.resolve(process19.argv[1]));
39737
+ return fs69.realpathSync(_HERE21) === fs69.realpathSync(path70.resolve(process19.argv[1]));
39662
39738
  } catch {
39663
39739
  return false;
39664
39740
  }
@@ -39699,11 +39775,11 @@ __export(cmd_conformance_exports, {
39699
39775
  routeTargetPaths: () => routeTargetPaths,
39700
39776
  runConformanceChecks: () => runConformanceChecks
39701
39777
  });
39702
- import * as fs69 from "node:fs";
39778
+ import * as fs70 from "node:fs";
39703
39779
  import * as os19 from "node:os";
39704
39780
  import * as path71 from "node:path";
39705
39781
  import process20 from "node:process";
39706
- import { spawnSync as spawnSync11 } from "node:child_process";
39782
+ import { spawnSync as spawnSync12 } from "node:child_process";
39707
39783
  import { fileURLToPath as fileURLToPath45, pathToFileURL as pathToFileURL33 } from "node:url";
39708
39784
  function print2(s = "") {
39709
39785
  process20.stdout.write(`${s}
@@ -39728,7 +39804,7 @@ function installLogPath() {
39728
39804
  return path71.join(os19.homedir(), ".event4u", "agent-config", "install-log.jsonl");
39729
39805
  }
39730
39806
  function _check_txlog_clean(logPath = installLogPath()) {
39731
- if (!fs69.existsSync(logPath)) {
39807
+ if (!fs70.existsSync(logPath)) {
39732
39808
  return {
39733
39809
  id: "txlog-clean",
39734
39810
  status: "ok",
@@ -39766,7 +39842,7 @@ function routeTargetPaths(target) {
39766
39842
  }
39767
39843
  function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
39768
39844
  const routerPath = path71.join(packageRoot, "dist", "router.json");
39769
- if (!fs69.existsSync(routerPath)) {
39845
+ if (!fs70.existsSync(routerPath)) {
39770
39846
  return {
39771
39847
  id: "router-pointers",
39772
39848
  status: "fail",
@@ -39776,7 +39852,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
39776
39852
  }
39777
39853
  let router;
39778
39854
  try {
39779
- router = JSON.parse(fs69.readFileSync(routerPath, "utf8"));
39855
+ router = JSON.parse(fs70.readFileSync(routerPath, "utf8"));
39780
39856
  } catch (exc) {
39781
39857
  return {
39782
39858
  id: "router-pointers",
@@ -39791,7 +39867,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
39791
39867
  let targets = 0;
39792
39868
  for (const kernelId of router["kernel"] ?? []) {
39793
39869
  ids += 1;
39794
- if (!fs69.existsSync(path71.join(rulesDir, `${kernelId}.md`))) {
39870
+ if (!fs70.existsSync(path71.join(rulesDir, `${kernelId}.md`))) {
39795
39871
  broken.push(`kernel:${kernelId} \u2192 rules/${kernelId}.md missing`);
39796
39872
  }
39797
39873
  }
@@ -39799,7 +39875,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
39799
39875
  for (const entry of router[tier] ?? []) {
39800
39876
  const ruleId = String(entry["id"] ?? "");
39801
39877
  ids += 1;
39802
- if (!fs69.existsSync(path71.join(rulesDir, `${ruleId}.md`))) {
39878
+ if (!fs70.existsSync(path71.join(rulesDir, `${ruleId}.md`))) {
39803
39879
  broken.push(`${tier}:${ruleId} \u2192 rules/${ruleId}.md missing`);
39804
39880
  }
39805
39881
  for (const target of entry["routes_to"] ?? []) {
@@ -39809,7 +39885,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
39809
39885
  broken.push(`${ruleId} \u2192 unparseable routes_to ${JSON.stringify(target)}`);
39810
39886
  continue;
39811
39887
  }
39812
- if (!candidates.some((rel) => fs69.existsSync(path71.join(packageRoot, rel)))) {
39888
+ if (!candidates.some((rel) => fs70.existsSync(path71.join(packageRoot, rel)))) {
39813
39889
  broken.push(`${ruleId} \u2192 ${target} (${candidates[0]} missing)`);
39814
39890
  }
39815
39891
  }
@@ -39843,7 +39919,7 @@ function detectSmokePlatform(projectRoot) {
39843
39919
  function dispatcherRunner(packageRoot) {
39844
39920
  const localTsx = path71.join(packageRoot, "node_modules", ".bin", "tsx");
39845
39921
  const script = path71.join(packageRoot, "src", "scripts", "hooks", "dispatch_hook.ts");
39846
- if (fs69.existsSync(localTsx)) {
39922
+ if (fs70.existsSync(localTsx)) {
39847
39923
  return [localTsx, script];
39848
39924
  }
39849
39925
  return ["npx", "tsx", script];
@@ -39860,7 +39936,7 @@ function _check_hook_dispatcher(projectRoot, packageRoot = PACKAGE_ROOT2, opts =
39860
39936
  ...event === "stop" ? { stop_reason: "conformance-smoke" } : { source: "startup" }
39861
39937
  });
39862
39938
  const argv = [...runner, "--platform", platform, "--event", event];
39863
- const proc = spawnSync11(argv[0], argv.slice(1), {
39939
+ const proc = spawnSync12(argv[0], argv.slice(1), {
39864
39940
  input: payload,
39865
39941
  cwd: projectRoot,
39866
39942
  encoding: "utf8",
@@ -39894,11 +39970,11 @@ function _check_hook_dispatcher(projectRoot, packageRoot = PACKAGE_ROOT2, opts =
39894
39970
  }
39895
39971
  function readSettingsMode(projectRoot) {
39896
39972
  const settingsPath = path71.join(projectRoot, ".agent-settings.yml");
39897
- if (!fs69.existsSync(settingsPath)) {
39973
+ if (!fs70.existsSync(settingsPath)) {
39898
39974
  return "eager-all";
39899
39975
  }
39900
39976
  try {
39901
- const parsed = YAML7.parse(fs69.readFileSync(settingsPath, "utf8"));
39977
+ const parsed = YAML7.parse(fs70.readFileSync(settingsPath, "utf8"));
39902
39978
  const lean = parsed?.["lean_projection"] ?? null;
39903
39979
  const mode = lean?.["mode"];
39904
39980
  return typeof mode === "string" && mode.length > 0 ? mode : "eager-all";
@@ -39909,7 +39985,7 @@ function readSettingsMode(projectRoot) {
39909
39985
  function kernelIdsFromRouter(packageRoot) {
39910
39986
  try {
39911
39987
  const router = JSON.parse(
39912
- fs69.readFileSync(path71.join(packageRoot, "dist", "router.json"), "utf8")
39988
+ fs70.readFileSync(path71.join(packageRoot, "dist", "router.json"), "utf8")
39913
39989
  );
39914
39990
  return new Set((router["kernel"] ?? []).map(String));
39915
39991
  } catch {
@@ -39927,7 +40003,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
39927
40003
  };
39928
40004
  }
39929
40005
  const rulesDir = projectedRulesDir ?? path71.join(projectRoot, ".augment", "rules");
39930
- if (!fs69.existsSync(rulesDir)) {
40006
+ if (!fs70.existsSync(rulesDir)) {
39931
40007
  return {
39932
40008
  id: "lean-projection",
39933
40009
  status: "skipped",
@@ -39936,7 +40012,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
39936
40012
  };
39937
40013
  }
39938
40014
  const kernel = kernelIdsFromRouter(packageRoot);
39939
- const files = fs69.readdirSync(rulesDir).filter((f) => f.endsWith(".md") && f !== "INDEX.md").sort();
40015
+ const files = fs70.readdirSync(rulesDir).filter((f) => f.endsWith(".md") && f !== "INDEX.md").sort();
39940
40016
  const nonKernel = files.filter((f) => !kernel.has(f.replace(/\.md$/, "")));
39941
40017
  if (nonKernel.length === 0) {
39942
40018
  return {
@@ -39950,7 +40026,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
39950
40026
  for (const f of nonKernel) {
39951
40027
  let text = "";
39952
40028
  try {
39953
- text = fs69.readFileSync(path71.join(rulesDir, f), "utf8");
40029
+ text = fs70.readFileSync(path71.join(rulesDir, f), "utf8");
39954
40030
  } catch {
39955
40031
  continue;
39956
40032
  }
@@ -39982,7 +40058,7 @@ function _check_host_manifest(projectRoot) {
39982
40058
  const detected = Object.entries(detectToolPresence(projectRoot)).filter(([, v]) => v === true).map(([k]) => k);
39983
40059
  const detectedNote = detected.length > 0 ? `detected surfaces: ${detected.join(", ")}` : "no surfaces detected";
39984
40060
  const settingsPath = path71.join(projectRoot, ".agent-settings.yml");
39985
- if (!fs69.existsSync(settingsPath)) {
40061
+ if (!fs70.existsSync(settingsPath)) {
39986
40062
  return {
39987
40063
  id: "host-manifest",
39988
40064
  status: "ok",
@@ -39992,7 +40068,7 @@ function _check_host_manifest(projectRoot) {
39992
40068
  }
39993
40069
  let parsed = null;
39994
40070
  try {
39995
- parsed = YAML7.parse(fs69.readFileSync(settingsPath, "utf8"));
40071
+ parsed = YAML7.parse(fs70.readFileSync(settingsPath, "utf8"));
39996
40072
  } catch (exc) {
39997
40073
  return {
39998
40074
  id: "host-manifest",
@@ -40170,8 +40246,8 @@ function _isCliEntry30() {
40170
40246
  return true;
40171
40247
  }
40172
40248
  try {
40173
- const here = fs69.realpathSync(fileURLToPath45(import.meta.url));
40174
- const argv = fs69.realpathSync(path71.resolve(process20.argv[1]));
40249
+ const here = fs70.realpathSync(fileURLToPath45(import.meta.url));
40250
+ const argv = fs70.realpathSync(path71.resolve(process20.argv[1]));
40175
40251
  return here === argv;
40176
40252
  } catch {
40177
40253
  return false;
@@ -40238,7 +40314,7 @@ __export(settings_exports, {
40238
40314
  read_tier_usage_settings: () => read_tier_usage_settings
40239
40315
  });
40240
40316
  import { createRequire as createRequire6 } from "node:module";
40241
- import * as fs70 from "node:fs";
40317
+ import * as fs71 from "node:fs";
40242
40318
  function _isPlainObject8(v) {
40243
40319
  return typeof v === "object" && v !== null && !Array.isArray(v) && !(v instanceof Date);
40244
40320
  }
@@ -40275,7 +40351,7 @@ function _coerce_path(value, def) {
40275
40351
  }
40276
40352
  function _isFile14(p) {
40277
40353
  try {
40278
- return fs70.statSync(p).isFile();
40354
+ return fs71.statSync(p).isFile();
40279
40355
  } catch {
40280
40356
  return false;
40281
40357
  }
@@ -40286,7 +40362,7 @@ function _read_telemetry_section(p, key) {
40286
40362
  }
40287
40363
  let raw = {};
40288
40364
  try {
40289
- raw = YAML8.parse(fs70.readFileSync(p, "utf-8"), { version: "1.1" });
40365
+ raw = YAML8.parse(fs71.readFileSync(p, "utf-8"), { version: "1.1" });
40290
40366
  if (raw === null || raw === void 0) {
40291
40367
  raw = {};
40292
40368
  }
@@ -40930,7 +41006,7 @@ __export(aggregator_exports, {
40930
41006
  aggregate: () => aggregate2,
40931
41007
  rank_artefacts: () => rank_artefacts
40932
41008
  });
40933
- import * as fs71 from "node:fs";
41009
+ import * as fs72 from "node:fs";
40934
41010
  function _key(kind, artId) {
40935
41011
  return `${kind}\0${artId}`;
40936
41012
  }
@@ -40967,7 +41043,7 @@ function* _iter_events(log_path) {
40967
41043
  if (!_isFile15(log_path)) {
40968
41044
  return;
40969
41045
  }
40970
- const text = fs71.readFileSync(log_path, "utf-8");
41046
+ const text = fs72.readFileSync(log_path, "utf-8");
40971
41047
  const lines = _pyFileLines(text);
40972
41048
  let lineNo = 0;
40973
41049
  for (const line of lines) {
@@ -41001,7 +41077,7 @@ function _pyFileLines(text) {
41001
41077
  }
41002
41078
  function _isFile15(p) {
41003
41079
  try {
41004
- return fs71.statSync(p).isFile();
41080
+ return fs72.statSync(p).isFile();
41005
41081
  } catch {
41006
41082
  return false;
41007
41083
  }
@@ -41515,7 +41591,7 @@ var init_report_renderer = __esm({
41515
41591
  });
41516
41592
 
41517
41593
  // src/scripts/ai_council/bundler.ts
41518
- import * as fs72 from "node:fs";
41594
+ import * as fs73 from "node:fs";
41519
41595
  function _context(mode, text, manifest = [], excluded = []) {
41520
41596
  return { mode, text, manifest, excluded };
41521
41597
  }
@@ -41573,10 +41649,10 @@ function bundle_prompt(text) {
41573
41649
  return _context("prompt", _enforceSize(redacted, "prompt"), ["<inline prompt>"]);
41574
41650
  }
41575
41651
  function bundle_roadmap(p) {
41576
- if (!fs72.existsSync(p)) {
41652
+ if (!fs73.existsSync(p)) {
41577
41653
  throw new FileNotFoundError2(`Roadmap not found: ${p}`);
41578
41654
  }
41579
- const raw = fs72.readFileSync(p, { encoding: "utf-8" });
41655
+ const raw = fs73.readFileSync(p, { encoding: "utf-8" });
41580
41656
  const redacted = redact(raw);
41581
41657
  return _context(
41582
41658
  "roadmap",
@@ -42187,7 +42263,7 @@ not. Cite the peer-reviewer label and the targeted response label
42187
42263
  });
42188
42264
 
42189
42265
  // src/scripts/ai_council/advisors.ts
42190
- import * as fs73 from "node:fs";
42266
+ import * as fs74 from "node:fs";
42191
42267
  import * as path72 from "node:path";
42192
42268
  function _split_frontmatter2(raw) {
42193
42269
  const match = _FRONTMATTER_RE2.exec(raw);
@@ -42220,8 +42296,8 @@ function resolve_persona_text(persona_path, repo_root) {
42220
42296
  path72.join(repo_root, ".agent-src.uncondensed", persona_path)
42221
42297
  ];
42222
42298
  for (const candidate of candidates) {
42223
- if (fs73.existsSync(candidate)) {
42224
- const raw = fs73.readFileSync(candidate, "utf-8");
42299
+ if (fs74.existsSync(candidate)) {
42300
+ const raw = fs74.readFileSync(candidate, "utf-8");
42225
42301
  const [meta, body] = _split_frontmatter2(raw);
42226
42302
  return [body.trim(), meta];
42227
42303
  }
@@ -42794,7 +42870,7 @@ var init_qualification = __esm({
42794
42870
  });
42795
42871
 
42796
42872
  // src/scripts/ai_council/probe_store.ts
42797
- import fs74 from "node:fs";
42873
+ import fs75 from "node:fs";
42798
42874
  import path73 from "node:path";
42799
42875
  function probeStorePath(root) {
42800
42876
  return path73.join(root, PROBE_STORE_RELPATH);
@@ -42802,7 +42878,7 @@ function probeStorePath(root) {
42802
42878
  function readProbeStore(root) {
42803
42879
  let raw;
42804
42880
  try {
42805
- raw = fs74.readFileSync(probeStorePath(root), "utf8");
42881
+ raw = fs75.readFileSync(probeStorePath(root), "utf8");
42806
42882
  } catch {
42807
42883
  return EMPTY;
42808
42884
  }
@@ -42852,8 +42928,8 @@ function recordProbes(root, entries) {
42852
42928
  members[e.name] = { at: e.at, outcome: e.outcome };
42853
42929
  }
42854
42930
  const target = probeStorePath(root);
42855
- fs74.mkdirSync(path73.dirname(target), { recursive: true });
42856
- fs74.writeFileSync(target, `${JSON.stringify({ schema: 1, members }, null, 2)}
42931
+ fs75.mkdirSync(path73.dirname(target), { recursive: true });
42932
+ fs75.writeFileSync(target, `${JSON.stringify({ schema: 1, members }, null, 2)}
42857
42933
  `, "utf8");
42858
42934
  } catch {
42859
42935
  }
@@ -43221,7 +43297,7 @@ __export(low_impact_corpus_exports, {
43221
43297
  load_validated_phrases: () => load_validated_phrases,
43222
43298
  parse_corpus_strict: () => parse_corpus_strict
43223
43299
  });
43224
- import * as fs75 from "node:fs";
43300
+ import * as fs76 from "node:fs";
43225
43301
  function _entry(phrase, normalised, section, line_no, trailing_metadata = "") {
43226
43302
  return { phrase, normalised, section, line_no, trailing_metadata };
43227
43303
  }
@@ -43394,10 +43470,10 @@ function _checkHeadingDrift(text, title) {
43394
43470
  }
43395
43471
  function parse_corpus_strict(corpusPath) {
43396
43472
  const p = corpusPath;
43397
- if (!fs75.existsSync(p)) {
43473
+ if (!fs76.existsSync(p)) {
43398
43474
  return new CorpusParseResult();
43399
43475
  }
43400
- const text = fs75.readFileSync(p, { encoding: "utf-8" });
43476
+ const text = fs76.readFileSync(p, { encoding: "utf-8" });
43401
43477
  const allTitles = _SECTION_KEYS.map((k) => _SECTION_TITLES[k]);
43402
43478
  const resultSections = {
43403
43479
  validated: [],
@@ -43460,10 +43536,10 @@ function load_anti_example_phrases(corpusPath) {
43460
43536
  }
43461
43537
  function load_corpus_lock(yamlPath) {
43462
43538
  const p = yamlPath;
43463
- if (!fs75.existsSync(p)) {
43539
+ if (!fs76.existsSync(p)) {
43464
43540
  return new CorpusParseResult();
43465
43541
  }
43466
- const parsed = (0, import_yaml7.parse)(fs75.readFileSync(p, { encoding: "utf-8" }), { version: "1.1" });
43542
+ const parsed = (0, import_yaml7.parse)(fs76.readFileSync(p, { encoding: "utf-8" }), { version: "1.1" });
43467
43543
  const doc = parsed === null || parsed === void 0 ? {} : parsed;
43468
43544
  const schemaVersion = doc["schema_version"];
43469
43545
  if (schemaVersion !== 1) {
@@ -43525,7 +43601,7 @@ function _deriveLockPath(corpusPath) {
43525
43601
  }
43526
43602
  function _loadSectionFromLock(corpusPath, section) {
43527
43603
  const lockPath = _deriveLockPath(corpusPath);
43528
- if (!fs75.existsSync(lockPath)) {
43604
+ if (!fs76.existsSync(lockPath)) {
43529
43605
  return null;
43530
43606
  }
43531
43607
  try {
@@ -43537,10 +43613,10 @@ function _loadSectionFromLock(corpusPath, section) {
43537
43613
  }
43538
43614
  function _loadSectionLenient(corpusPath, section) {
43539
43615
  const p = corpusPath;
43540
- if (!fs75.existsSync(p)) {
43616
+ if (!fs76.existsSync(p)) {
43541
43617
  return [];
43542
43618
  }
43543
- const text = fs75.readFileSync(p, { encoding: "utf-8" });
43619
+ const text = fs76.readFileSync(p, { encoding: "utf-8" });
43544
43620
  const allTitles = _SECTION_KEYS.map((k) => _SECTION_TITLES[k]);
43545
43621
  const bounds = _sectionBounds(text, _SECTION_TITLES[section], allTitles);
43546
43622
  if (bounds === null) {
@@ -44320,7 +44396,7 @@ var init_necessity = __esm({
44320
44396
  });
44321
44397
 
44322
44398
  // src/scripts/ai_council/budget_guard.ts
44323
- import * as fs76 from "node:fs";
44399
+ import * as fs77 from "node:fs";
44324
44400
  import * as path74 from "node:path";
44325
44401
  function _resolveLedgerPath(p) {
44326
44402
  if (p !== null) {
@@ -44338,16 +44414,16 @@ function _nowUtcMs() {
44338
44414
  function _ensureLedgerDir(p) {
44339
44415
  const parent = path74.dirname(p);
44340
44416
  try {
44341
- fs76.mkdirSync(parent, { recursive: true });
44417
+ fs77.mkdirSync(parent, { recursive: true });
44342
44418
  let mode;
44343
44419
  try {
44344
- mode = fs76.statSync(parent).mode & 511;
44420
+ mode = fs77.statSync(parent).mode & 511;
44345
44421
  } catch {
44346
44422
  mode = 448;
44347
44423
  }
44348
44424
  if (mode !== 448) {
44349
44425
  try {
44350
- fs76.chmodSync(parent, 448);
44426
+ fs77.chmodSync(parent, 448);
44351
44427
  } catch {
44352
44428
  }
44353
44429
  }
@@ -44359,18 +44435,18 @@ function _ensureLedgerDir(p) {
44359
44435
  }
44360
44436
  }
44361
44437
  function _ensureLedgerFileMode(p) {
44362
- if (!fs76.existsSync(p)) {
44438
+ if (!fs77.existsSync(p)) {
44363
44439
  return;
44364
44440
  }
44365
44441
  let current;
44366
44442
  try {
44367
- current = fs76.statSync(p).mode & 511;
44443
+ current = fs77.statSync(p).mode & 511;
44368
44444
  } catch {
44369
44445
  return;
44370
44446
  }
44371
44447
  if (current !== 384) {
44372
44448
  try {
44373
- fs76.chmodSync(p, 384);
44449
+ fs77.chmodSync(p, 384);
44374
44450
  } catch {
44375
44451
  }
44376
44452
  }
@@ -44522,11 +44598,11 @@ function pyNumToStr(n) {
44522
44598
  }
44523
44599
  function read_entries2(p = null) {
44524
44600
  const resolved = _resolveLedgerPath(p);
44525
- if (!fs76.existsSync(resolved)) {
44601
+ if (!fs77.existsSync(resolved)) {
44526
44602
  return [];
44527
44603
  }
44528
44604
  const out = [];
44529
- const text = fs76.readFileSync(resolved, "utf-8");
44605
+ const text = fs77.readFileSync(resolved, "utf-8");
44530
44606
  for (const rawLine of text.split(/\r\n|\r|\n/u)) {
44531
44607
  const line = rawLine.trim();
44532
44608
  if (line === "") {
@@ -44629,7 +44705,7 @@ function record_spend(usd, provider, model, options = {}) {
44629
44705
  )}
44630
44706
  `;
44631
44707
  try {
44632
- fs76.appendFileSync(p, entry, { encoding: "utf-8" });
44708
+ fs77.appendFileSync(p, entry, { encoding: "utf-8" });
44633
44709
  } catch (exc) {
44634
44710
  process.stderr.write(`[council:budget_guard] write failed: ${_errStr(exc)}
44635
44711
  `);
@@ -44752,8 +44828,8 @@ function aggregate_scores(findings, scores) {
44752
44828
  by_id.get(s.finding_id).push(s);
44753
44829
  }
44754
44830
  const out = /* @__PURE__ */ new Map();
44755
- for (const [fid, fs83] of by_id) {
44756
- if (fs83.length === 0) {
44831
+ for (const [fid, fs84] of by_id) {
44832
+ if (fs84.length === 0) {
44757
44833
  out.set(
44758
44834
  fid,
44759
44835
  new ConsensusMetadata({
@@ -44769,13 +44845,13 @@ function aggregate_scores(findings, scores) {
44769
44845
  );
44770
44846
  continue;
44771
44847
  }
44772
- const mean2 = fs83.reduce((acc, s) => acc + s.score, 0) / fs83.length;
44773
- const agree_rate = fs83.filter((s) => s.agree).length / fs83.length;
44848
+ const mean2 = fs84.reduce((acc, s) => acc + s.score, 0) / fs84.length;
44849
+ const agree_rate = fs84.filter((s) => s.agree).length / fs84.length;
44774
44850
  const strength = mean2 / 10 * agree_rate;
44775
- const dissent = fs83.filter((s) => !s.agree).length;
44776
- const concur = fs83.filter((s) => s.agree).length;
44777
- const scorers = fs83.map((s) => s.scorer);
44778
- const dissent_reasons = fs83.filter((s) => !s.agree).map((s) => [s.scorer, s.reason]);
44851
+ const dissent = fs84.filter((s) => !s.agree).length;
44852
+ const concur = fs84.filter((s) => s.agree).length;
44853
+ const scorers = fs84.map((s) => s.scorer);
44854
+ const dissent_reasons = fs84.filter((s) => !s.agree).map((s) => [s.scorer, s.reason]);
44779
44855
  const mean_rounded = pyRound(mean2, 2);
44780
44856
  out.set(
44781
44857
  fid,
@@ -46923,18 +46999,18 @@ __export(project_context_exports, {
46923
46999
  REPO_PURPOSE_MAX_CHARS: () => REPO_PURPOSE_MAX_CHARS,
46924
47000
  detect_project_context: () => detect_project_context
46925
47001
  });
46926
- import * as fs77 from "node:fs";
47002
+ import * as fs78 from "node:fs";
46927
47003
  import * as path75 from "node:path";
46928
47004
  function _isPlainObject11(v) {
46929
47005
  return typeof v === "object" && v !== null && !Array.isArray(v);
46930
47006
  }
46931
47007
  function _read_json(p) {
46932
- if (!fs77.existsSync(p)) {
47008
+ if (!fs78.existsSync(p)) {
46933
47009
  return null;
46934
47010
  }
46935
47011
  let raw;
46936
47012
  try {
46937
- raw = fs77.readFileSync(p, "utf-8");
47013
+ raw = fs78.readFileSync(p, "utf-8");
46938
47014
  } catch {
46939
47015
  return null;
46940
47016
  }
@@ -47025,12 +47101,12 @@ function _splitlines10(text) {
47025
47101
  return parts;
47026
47102
  }
47027
47103
  function _purpose_from_readme(p) {
47028
- if (!fs77.existsSync(p)) {
47104
+ if (!fs78.existsSync(p)) {
47029
47105
  return null;
47030
47106
  }
47031
47107
  let text;
47032
47108
  try {
47033
- text = fs77.readFileSync(p, "utf-8");
47109
+ text = fs78.readFileSync(p, "utf-8");
47034
47110
  } catch {
47035
47111
  return null;
47036
47112
  }
@@ -47390,7 +47466,7 @@ __export(shadow_dispatch_exports, {
47390
47466
  slo_banner: () => slo_banner,
47391
47467
  slo_status: () => slo_status
47392
47468
  });
47393
- import * as fs78 from "node:fs";
47469
+ import * as fs79 from "node:fs";
47394
47470
  import { createHash as createHash14 } from "node:crypto";
47395
47471
  function should_shadow(sampleRate, opts = {}) {
47396
47472
  const rate = Math.max(0, Math.min(1, sampleRate));
@@ -47428,7 +47504,7 @@ function record_shadow_decision(logPath, opts) {
47428
47504
  escalated,
47429
47505
  escalation_reason: escalationReason
47430
47506
  };
47431
- fs78.mkdirSync(_dirname2(logPath), { recursive: true });
47507
+ fs79.mkdirSync(_dirname2(logPath), { recursive: true });
47432
47508
  const row = _pyJsonDumps2({
47433
47509
  timestamp: decision.timestamp,
47434
47510
  query_hash: decision.query_hash,
@@ -47438,7 +47514,7 @@ function record_shadow_decision(logPath, opts) {
47438
47514
  escalated: decision.escalated,
47439
47515
  escalation_reason: decision.escalation_reason
47440
47516
  }) + "\n";
47441
- fs78.appendFileSync(logPath, row, { encoding: "utf-8" });
47517
+ fs79.appendFileSync(logPath, row, { encoding: "utf-8" });
47442
47518
  return decision;
47443
47519
  }
47444
47520
  function _isoNowSeconds() {
@@ -47447,10 +47523,10 @@ function _isoNowSeconds() {
47447
47523
  return `${pad(d.getUTCFullYear(), 4)}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())}T${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}:${pad(d.getUTCSeconds())}+00:00`;
47448
47524
  }
47449
47525
  function* _iterLog(logPath) {
47450
- if (!fs78.existsSync(logPath)) {
47526
+ if (!fs79.existsSync(logPath)) {
47451
47527
  return;
47452
47528
  }
47453
- const content = fs78.readFileSync(logPath, { encoding: "utf-8" });
47529
+ const content = fs79.readFileSync(logPath, { encoding: "utf-8" });
47454
47530
  for (const rawLine of _splitlines11(content)) {
47455
47531
  const line = _strip7(rawLine);
47456
47532
  if (!line) {
@@ -48377,7 +48453,7 @@ __export(council_cli_exports, {
48377
48453
  load_settings: () => load_settings,
48378
48454
  main: () => main34
48379
48455
  });
48380
- import * as fs79 from "node:fs";
48456
+ import * as fs80 from "node:fs";
48381
48457
  import * as path76 from "node:path";
48382
48458
  import { fileURLToPath as fileURLToPath46, pathToFileURL as pathToFileURL34 } from "node:url";
48383
48459
  function _pyFixed6(x, ndigits) {
@@ -48587,7 +48663,7 @@ function _stderr2(s) {
48587
48663
  function load_settings(p = SETTINGS_FILE2, opts = {}) {
48588
48664
  const ai_council_path = opts.ai_council_path ?? AI_COUNCIL_FILE;
48589
48665
  const settings = load_agent_settings({ project_path: p });
48590
- if (fs79.existsSync(ai_council_path)) {
48666
+ if (fs80.existsSync(ai_council_path)) {
48591
48667
  const cfg = load_council_config(ai_council_path);
48592
48668
  settings["ai_council"] = synthesizeAiCouncilBlock(cfg);
48593
48669
  }
@@ -48955,7 +49031,7 @@ function build_question(opts) {
48955
49031
  let ctx;
48956
49032
  let artefact;
48957
49033
  if (input_mode === "prompt") {
48958
- const text = fs79.readFileSync(input_path, "utf-8");
49034
+ const text = fs80.readFileSync(input_path, "utf-8");
48959
49035
  ctx = bundle_prompt(text);
48960
49036
  artefact = String(input_path);
48961
49037
  } else if (input_mode === "roadmap") {
@@ -49099,8 +49175,8 @@ function _maybe_write_decision_replay(opts) {
49099
49175
  })
49100
49176
  );
49101
49177
  const target = path76.join(path76.dirname(opts.out_path), "decision-replay.md");
49102
- fs79.mkdirSync(path76.dirname(target), { recursive: true });
49103
- fs79.writeFileSync(target, replay, { encoding: "utf-8" });
49178
+ fs80.mkdirSync(path76.dirname(target), { recursive: true });
49179
+ fs80.writeFileSync(target, replay, { encoding: "utf-8" });
49104
49180
  return target;
49105
49181
  }
49106
49182
  function _peer_review_active(ai_cfg, args) {
@@ -49805,7 +49881,7 @@ function cmd_status(args, opts = {}) {
49805
49881
  const env = opts.env ?? process.env;
49806
49882
  const override = env[COUNCIL_CONFIG_ENV];
49807
49883
  const path_ = resolve_config_path(REPO_ROOT11, { env });
49808
- const exists3 = fs79.existsSync(String(path_));
49884
+ const exists3 = fs80.existsSync(String(path_));
49809
49885
  const provenance = override ? `${COUNCIL_CONFIG_ENV} override` : "user-global";
49810
49886
  let cfg = null;
49811
49887
  let parse_error = null;
@@ -50261,8 +50337,8 @@ function cmd_run(args, opts = {}) {
50261
50337
  kind: "responses",
50262
50338
  subcommand: "run"
50263
50339
  });
50264
- fs79.mkdirSync(path76.dirname(_resolveTarget(out_path)), { recursive: true });
50265
- fs79.writeFileSync(_resolveTarget(out_path), _jsonDumpsIndent2(payload) + "\n", { encoding: "utf-8" });
50340
+ fs80.mkdirSync(path76.dirname(_resolveTarget(out_path)), { recursive: true });
50341
+ fs80.writeFileSync(_resolveTarget(out_path), _jsonDumpsIndent2(payload) + "\n", { encoding: "utf-8" });
50266
50342
  _stdout2(
50267
50343
  `
50268
50344
  council:run \xB7 wrote ${out_path} (estimated $${_pyFixed6(estimated_total, 4)} / actual $${_pyFixed6(actual_total, 4)})
@@ -50287,7 +50363,7 @@ function _debate_round_filename(round_number) {
50287
50363
  return `debate-round-${round_number}.json`;
50288
50364
  }
50289
50365
  function _write_debate_round(out_dir, round_number, responses, opts) {
50290
- fs79.mkdirSync(_resolveTarget(out_dir), { recursive: true });
50366
+ fs80.mkdirSync(_resolveTarget(out_dir), { recursive: true });
50291
50367
  let actual_total = 0;
50292
50368
  for (const r of responses) {
50293
50369
  if (r.error) {
@@ -50312,14 +50388,14 @@ function _write_debate_round(out_dir, round_number, responses, opts) {
50312
50388
  responses: _serialise_responses(responses)
50313
50389
  };
50314
50390
  const out_path = path76.join(_resolveTarget(out_dir), _debate_round_filename(round_number));
50315
- fs79.writeFileSync(out_path, _jsonDumpsIndent2(payload) + "\n", { encoding: "utf-8" });
50391
+ fs80.writeFileSync(out_path, _jsonDumpsIndent2(payload) + "\n", { encoding: "utf-8" });
50316
50392
  return out_path;
50317
50393
  }
50318
50394
  function _load_debate_seed(p, expected_members) {
50319
- if (!fs79.existsSync(p)) {
50395
+ if (!fs80.existsSync(p)) {
50320
50396
  throw new FileNotFoundError3(`--continue-as-debate path not found: ${p}`);
50321
50397
  }
50322
- const payload = JSON.parse(fs79.readFileSync(p, "utf-8"));
50398
+ const payload = JSON.parse(fs80.readFileSync(p, "utf-8"));
50323
50399
  const source_members = (payload["members"] || []).slice();
50324
50400
  const expected_labels = expected_members.map((m) => `${m.name}/${m.model}`);
50325
50401
  if (!_listEq(source_members, expected_labels)) {
@@ -50365,7 +50441,7 @@ function _readStdinLine() {
50365
50441
  try {
50366
50442
  const buf = Buffer.alloc(4096);
50367
50443
  const fd = 0;
50368
- const n = fs79.readSync(fd, buf, 0, buf.length, null);
50444
+ const n = fs80.readSync(fd, buf, 0, buf.length, null);
50369
50445
  return buf.toString("utf-8", 0, n).split("\n")[0]?.trim().toLowerCase() ?? "";
50370
50446
  } catch {
50371
50447
  return "";
@@ -50599,7 +50675,7 @@ council:debate \xB7 ${all_rounds.length} round(s) complete \xB7 actual $${_pyFix
50599
50675
  return errors_last.length > 0 && errors_last.length === last.length ? 1 : 0;
50600
50676
  }
50601
50677
  function cmd_render(args) {
50602
- const payload = JSON.parse(fs79.readFileSync(args.responses, "utf-8"));
50678
+ const payload = JSON.parse(fs80.readFileSync(args.responses, "utf-8"));
50603
50679
  const items = payload["responses"] || [];
50604
50680
  const explicit = _getattr3(args, "prompt_mode", null);
50605
50681
  const mode = explicit || payload["prompt_mode"] || payload["mode"];
@@ -50628,8 +50704,8 @@ function cmd_render(args) {
50628
50704
  kind: "sessions",
50629
50705
  subcommand: "render"
50630
50706
  });
50631
- fs79.mkdirSync(path76.dirname(_resolveTarget(out_path)), { recursive: true });
50632
- fs79.writeFileSync(_resolveTarget(out_path), body + "\n", { encoding: "utf-8" });
50707
+ fs80.mkdirSync(path76.dirname(_resolveTarget(out_path)), { recursive: true });
50708
+ fs80.writeFileSync(_resolveTarget(out_path), body + "\n", { encoding: "utf-8" });
50633
50709
  _stdout2(`council:render \xB7 wrote ${out_path}
50634
50710
  `);
50635
50711
  return 0;
@@ -50641,14 +50717,14 @@ function _cmd_replay_low_impact_stats(args) {
50641
50717
  const li = low_impact_exports;
50642
50718
  const responses_path = args.responses;
50643
50719
  const log_path = path76.join(path76.dirname(responses_path), "low-impact-resolutions.md");
50644
- if (!fs79.existsSync(log_path)) {
50720
+ if (!fs80.existsSync(log_path)) {
50645
50721
  _stdout2(
50646
50722
  `council:replay \xB7 no low-impact-resolutions.md alongside ${responses_path} \u2014 session had no fast-path entries.
50647
50723
  `
50648
50724
  );
50649
50725
  return 0;
50650
50726
  }
50651
- const body = fs79.readFileSync(log_path, "utf-8");
50727
+ const body = fs80.readFileSync(log_path, "utf-8");
50652
50728
  const stats = li.parse_low_impact_log(body);
50653
50729
  const out = li.render_low_impact_stats(stats);
50654
50730
  if (_getattr3(args, "output", null)) {
@@ -50656,8 +50732,8 @@ function _cmd_replay_low_impact_stats(args) {
50656
50732
  kind: "sessions",
50657
50733
  subcommand: "replay"
50658
50734
  });
50659
- fs79.mkdirSync(path76.dirname(_resolveTarget(target)), { recursive: true });
50660
- fs79.writeFileSync(_resolveTarget(target), out, { encoding: "utf-8" });
50735
+ fs80.mkdirSync(path76.dirname(_resolveTarget(target)), { recursive: true });
50736
+ fs80.writeFileSync(_resolveTarget(target), out, { encoding: "utf-8" });
50661
50737
  _stdout2(`council:replay \xB7 wrote ${target}
50662
50738
  `);
50663
50739
  return 0;
@@ -50669,7 +50745,7 @@ function cmd_replay(args) {
50669
50745
  if (_getattr3(args, "low_impact_stats", false)) {
50670
50746
  return _cmd_replay_low_impact_stats(args);
50671
50747
  }
50672
- const payload = JSON.parse(fs79.readFileSync(args.responses, "utf-8"));
50748
+ const payload = JSON.parse(fs80.readFileSync(args.responses, "utf-8"));
50673
50749
  const consensus = _deserialise_consensus(payload["consensus"]);
50674
50750
  if (consensus === null) {
50675
50751
  _stderr2(
@@ -50694,8 +50770,8 @@ function cmd_replay(args) {
50694
50770
  kind: "sessions",
50695
50771
  subcommand: "replay"
50696
50772
  });
50697
- fs79.mkdirSync(path76.dirname(_resolveTarget(out_path)), { recursive: true });
50698
- fs79.writeFileSync(_resolveTarget(out_path), body, { encoding: "utf-8" });
50773
+ fs80.mkdirSync(path76.dirname(_resolveTarget(out_path)), { recursive: true });
50774
+ fs80.writeFileSync(_resolveTarget(out_path), body, { encoding: "utf-8" });
50699
50775
  _stdout2(`council:replay \xB7 wrote ${out_path}
50700
50776
  `);
50701
50777
  } else {
@@ -50768,7 +50844,7 @@ function _resolveTarget(path_str) {
50768
50844
  function _resolveReal(p) {
50769
50845
  const abs = path76.resolve(p);
50770
50846
  try {
50771
- return fs79.realpathSync(abs);
50847
+ return fs80.realpathSync(abs);
50772
50848
  } catch {
50773
50849
  return abs;
50774
50850
  }
@@ -51154,8 +51230,8 @@ function _isCliEntry31() {
51154
51230
  return true;
51155
51231
  }
51156
51232
  try {
51157
- const here = fs79.realpathSync(fileURLToPath46(import.meta.url));
51158
- const argv = fs79.realpathSync(path76.resolve(process.argv[1]));
51233
+ const here = fs80.realpathSync(fileURLToPath46(import.meta.url));
51234
+ const argv = fs80.realpathSync(path76.resolve(process.argv[1]));
51159
51235
  return here === argv;
51160
51236
  } catch {
51161
51237
  return false;
@@ -51355,13 +51431,13 @@ __export(skill_catalogue_exports, {
51355
51431
  resolveSkillsRoot: () => resolveSkillsRoot,
51356
51432
  truncationModeOf: () => truncationModeOf
51357
51433
  });
51358
- import * as fs80 from "node:fs";
51434
+ import * as fs81 from "node:fs";
51359
51435
  import * as path77 from "node:path";
51360
51436
  function resolveSkillsRoot(workspaceRoot) {
51361
51437
  for (const candidate of DEFAULT_CATALOGUE_ROOTS) {
51362
51438
  const abs = path77.join(workspaceRoot, candidate);
51363
51439
  try {
51364
- if (fs80.existsSync(abs) && fs80.statSync(abs).isDirectory()) return abs;
51440
+ if (fs81.existsSync(abs) && fs81.statSync(abs).isDirectory()) return abs;
51365
51441
  } catch {
51366
51442
  }
51367
51443
  }
@@ -51405,9 +51481,9 @@ function descriptionOf(frontmatter) {
51405
51481
  return "";
51406
51482
  }
51407
51483
  function readProjectedCatalogue(root) {
51408
- const names = fs80.readdirSync(root).filter((n) => fs80.existsSync(path77.join(root, n, "SKILL.md"))).sort();
51484
+ const names = fs81.readdirSync(root).filter((n) => fs81.existsSync(path77.join(root, n, "SKILL.md"))).sort();
51409
51485
  return names.map((name, index) => {
51410
- const content = fs80.readFileSync(path77.join(root, name, "SKILL.md"), "utf-8");
51486
+ const content = fs81.readFileSync(path77.join(root, name, "SKILL.md"), "utf-8");
51411
51487
  const frontmatter = frontmatterOf(content);
51412
51488
  const description = descriptionOf(frontmatter);
51413
51489
  return {
@@ -51609,12 +51685,12 @@ function buildNoTruncationRecord(host, observedAt, entriesOffered, projectedSkil
51609
51685
  };
51610
51686
  }
51611
51687
  function markdownFilesUnder(root) {
51612
- if (!fs80.existsSync(root)) return [];
51688
+ if (!fs81.existsSync(root)) return [];
51613
51689
  const out = [];
51614
51690
  const walk = (dir) => {
51615
- for (const entry of fs80.readdirSync(dir, { withFileTypes: true })) {
51691
+ for (const entry of fs81.readdirSync(dir, { withFileTypes: true })) {
51616
51692
  const full = path77.join(dir, entry.name);
51617
- if (fs80.statSync(full).isDirectory()) walk(full);
51693
+ if (fs81.statSync(full).isDirectory()) walk(full);
51618
51694
  else if (entry.name.endsWith(".md")) out.push(full);
51619
51695
  }
51620
51696
  };
@@ -51623,7 +51699,7 @@ function markdownFilesUnder(root) {
51623
51699
  }
51624
51700
  function measureCatalogueVolume(host, root) {
51625
51701
  const skillsRoot = path77.join(root, "skills");
51626
- const skills = fs80.existsSync(skillsRoot) ? readProjectedCatalogue(skillsRoot) : [];
51702
+ const skills = fs81.existsSync(skillsRoot) ? readProjectedCatalogue(skillsRoot) : [];
51627
51703
  const commandEntries = markdownFilesUnder(path77.join(root, "commands")).length;
51628
51704
  return {
51629
51705
  host,
@@ -51755,9 +51831,9 @@ function migrationPromptLines(host, eligibility, settingsPath) {
51755
51831
  ];
51756
51832
  }
51757
51833
  function readObservationLog(logPath) {
51758
- if (!fs80.existsSync(logPath)) return [];
51834
+ if (!fs81.existsSync(logPath)) return [];
51759
51835
  const out = [];
51760
- for (const line of fs80.readFileSync(logPath, "utf-8").split("\n")) {
51836
+ for (const line of fs81.readFileSync(logPath, "utf-8").split("\n")) {
51761
51837
  const trimmed = line.trim();
51762
51838
  if (trimmed.length === 0) continue;
51763
51839
  try {
@@ -51853,7 +51929,7 @@ __export(score_skill_relevance_exports, {
51853
51929
  parse_args: () => parse_args7,
51854
51930
  rank: () => rank
51855
51931
  });
51856
- import * as fs81 from "node:fs";
51932
+ import * as fs82 from "node:fs";
51857
51933
  import * as path78 from "node:path";
51858
51934
  import { fileURLToPath as fileURLToPath47, pathToFileURL as pathToFileURL35 } from "node:url";
51859
51935
  function pyLen(s) {
@@ -51874,7 +51950,7 @@ function _tokenize(text) {
51874
51950
  return out;
51875
51951
  }
51876
51952
  function _parse_frontmatter2(filePath) {
51877
- const text = fs81.readFileSync(filePath, "utf-8");
51953
+ const text = fs82.readFileSync(filePath, "utf-8");
51878
51954
  if (!text.startsWith("---")) {
51879
51955
  return {};
51880
51956
  }
@@ -51957,7 +52033,7 @@ function _truthyStr(v) {
51957
52033
  function _globSkillMd(root) {
51958
52034
  let names;
51959
52035
  try {
51960
- names = fs81.readdirSync(root);
52036
+ names = fs82.readdirSync(root);
51961
52037
  } catch {
51962
52038
  return [];
51963
52039
  }
@@ -51966,7 +52042,7 @@ function _globSkillMd(root) {
51966
52042
  const dir = path78.join(root, name);
51967
52043
  const skillMd = path78.join(dir, "SKILL.md");
51968
52044
  try {
51969
- if (fs81.statSync(dir).isDirectory() && fs81.statSync(skillMd).isFile()) {
52045
+ if (fs82.statSync(dir).isDirectory() && fs82.statSync(skillMd).isFile()) {
51970
52046
  dirs.push(name);
51971
52047
  }
51972
52048
  } catch {
@@ -52201,8 +52277,8 @@ function _isCliEntry32() {
52201
52277
  return true;
52202
52278
  }
52203
52279
  try {
52204
- const here = fs81.realpathSync(fileURLToPath47(import.meta.url));
52205
- const argv = fs81.realpathSync(path78.resolve(process.argv[1]));
52280
+ const here = fs82.realpathSync(fileURLToPath47(import.meta.url));
52281
+ const argv = fs82.realpathSync(path78.resolve(process.argv[1]));
52206
52282
  return here === argv;
52207
52283
  } catch {
52208
52284
  return false;
@@ -52348,7 +52424,7 @@ init_prompts();
52348
52424
  init_resources();
52349
52425
 
52350
52426
  // src/scripts/mcp_server/tools.ts
52351
- import * as fs82 from "node:fs";
52427
+ import * as fs83 from "node:fs";
52352
52428
  import * as path79 from "node:path";
52353
52429
  import { fileURLToPath as fileURLToPath48 } from "node:url";
52354
52430
 
@@ -54583,7 +54659,7 @@ function _strip8(s) {
54583
54659
  }
54584
54660
  function _resolvePath2(p) {
54585
54661
  try {
54586
- return fs82.realpathSync(p);
54662
+ return fs83.realpathSync(p);
54587
54663
  } catch {
54588
54664
  return path79.resolve(p);
54589
54665
  }
@@ -54657,7 +54733,7 @@ async function _lintSkillsHandler(args, consumerRoot) {
54657
54733
  if (_relativeUnder(resolved, root) === null) {
54658
54734
  throw new Error(`path escapes consumer_root: ${resolved}`);
54659
54735
  }
54660
- if (fs82.existsSync(resolved)) {
54736
+ if (fs83.existsSync(resolved)) {
54661
54737
  paths.push(resolved);
54662
54738
  }
54663
54739
  }
@@ -54694,7 +54770,7 @@ async function _chatHistoryAppendHandler(args, consumerRoot) {
54694
54770
  if (typeof minSchema !== "number" || !Number.isInteger(minSchema) || typeof minSchema === "boolean") {
54695
54771
  throw new Error("'min_schema_version' must be an integer");
54696
54772
  }
54697
- const existingHeader = fs82.existsSync(target) ? _chReadHeader(target) : null;
54773
+ const existingHeader = fs83.existsSync(target) ? _chReadHeader(target) : null;
54698
54774
  const observed = existingHeader !== null && typeof existingHeader === "object" ? _pyInt7(existingHeader.v ?? 0) : SCHEMA_VERSION3;
54699
54775
  if (observed < minSchema) {
54700
54776
  throw new Error(`chat-history schema ${observed} below required ${minSchema}`);
@@ -54709,8 +54785,8 @@ async function _chatHistoryAppendHandler(args, consumerRoot) {
54709
54785
  session: session === void 0 ? null : session
54710
54786
  };
54711
54787
  }
54712
- if (!fs82.existsSync(target) || _chReadHeader(target) === null) {
54713
- fs82.mkdirSync(path79.dirname(target), { recursive: true });
54788
+ if (!fs83.existsSync(target) || _chReadHeader(target) === null) {
54789
+ fs83.mkdirSync(path79.dirname(target), { recursive: true });
54714
54790
  _chInit(target);
54715
54791
  }
54716
54792
  _chAppend(entry, target, session ?? null);
@@ -54754,7 +54830,7 @@ async function _chatHistoryReadHandler(args, consumerRoot) {
54754
54830
  if (detail !== "full" && detail !== "index") {
54755
54831
  throw new Error("'detail' must be 'index' or 'full'");
54756
54832
  }
54757
- if (!fs82.existsSync(target)) {
54833
+ if (!fs83.existsSync(target)) {
54758
54834
  return { path: target, entries: [], count: 0 };
54759
54835
  }
54760
54836
  if (around !== void 0 && around !== null) {
@@ -54904,7 +54980,7 @@ async function _roadmapProgressHandler(args, consumerRoot) {
54904
54980
  const roadmapRoot = path79.join(root, "agents", "roadmaps");
54905
54981
  const target = path79.join(root, "agents", "roadmaps-progress.md");
54906
54982
  const urp = await Promise.resolve().then(() => (init_update_roadmap_progress(), update_roadmap_progress_exports));
54907
- if (!fs82.existsSync(roadmapRoot)) {
54983
+ if (!fs83.existsSync(roadmapRoot)) {
54908
54984
  return {
54909
54985
  written: false,
54910
54986
  path: target,
@@ -54919,7 +54995,7 @@ async function _roadmapProgressHandler(args, consumerRoot) {
54919
54995
  const stepsDone = roadmaps.reduce((s, r) => s + r.done, 0);
54920
54996
  const stepsTotal = roadmaps.reduce((s, r) => s + r.total_active, 0);
54921
54997
  if (!dryRun) {
54922
- fs82.writeFileSync(target, content, "utf-8");
54998
+ fs83.writeFileSync(target, content, "utf-8");
54923
54999
  }
54924
55000
  return {
54925
55001
  written: !dryRun,
@@ -54941,9 +55017,9 @@ async function _roadmapArchiveHandler(_args, consumerRoot) {
54941
55017
  if (archived.length > 0) {
54942
55018
  const urp = await Promise.resolve().then(() => (init_update_roadmap_progress(), update_roadmap_progress_exports));
54943
55019
  const roadmapRoot = path79.join(root, "agents", "roadmaps");
54944
- if (fs82.existsSync(roadmapRoot)) {
55020
+ if (fs83.existsSync(roadmapRoot)) {
54945
55021
  const roadmaps = urp.collect(roadmapRoot);
54946
- fs82.writeFileSync(
55022
+ fs83.writeFileSync(
54947
55023
  path79.join(root, "agents", "roadmaps-progress.md"),
54948
55024
  urp.render(roadmaps, urp.collect_bundles(root), roadmapRoot),
54949
55025
  "utf-8"
@@ -54962,7 +55038,7 @@ async function _capabilitiesIndexHandler(args, consumerRoot) {
54962
55038
  const cap = await Promise.resolve().then(() => (init_generate_capabilities_index(), generate_capabilities_index_exports));
54963
55039
  const out = path79.join(_PACKAGE_ROOT3, "CAPABILITIES.yaml");
54964
55040
  const content = cap.build();
54965
- const onDisk = fs82.existsSync(out) ? fs82.readFileSync(out, "utf-8") : "";
55041
+ const onDisk = fs83.existsSync(out) ? fs83.readFileSync(out, "utf-8") : "";
54966
55042
  const drift = onDisk !== content;
54967
55043
  if (check) {
54968
55044
  return { check: true, written: false, drift, path: out };
@@ -54973,7 +55049,7 @@ async function _capabilitiesIndexHandler(args, consumerRoot) {
54973
55049
  `CAPABILITIES.yaml path escapes consumer_root: ${out} not under ${root}`
54974
55050
  );
54975
55051
  }
54976
- fs82.writeFileSync(out, content, "utf-8");
55052
+ fs83.writeFileSync(out, content, "utf-8");
54977
55053
  return { check: false, written: true, drift, path: out };
54978
55054
  }
54979
55055
  async function _runDoctorLeg(consumerRoot) {
@@ -55077,7 +55153,7 @@ async function _councilEstimateHandler(args, consumerRoot) {
55077
55153
  if (_relativeUnder(target, root) === null) {
55078
55154
  throw new Error(`path escapes consumer_root: ${target}`);
55079
55155
  }
55080
- if (!fs82.existsSync(target)) {
55156
+ if (!fs83.existsSync(target)) {
55081
55157
  throw new Error(`input_path not found: ${target}`);
55082
55158
  }
55083
55159
  const cli = await Promise.resolve().then(() => (init_council_cli(), council_cli_exports));
@@ -55144,13 +55220,13 @@ async function _runTestsHandler(args, consumerRoot) {
55144
55220
  if (rel === null) {
55145
55221
  throw new Error(`path escapes consumer_root: ${resolved}`);
55146
55222
  }
55147
- if (!fs82.existsSync(resolved)) {
55223
+ if (!fs83.existsSync(resolved)) {
55148
55224
  throw new Error(`path not found: ${resolved}`);
55149
55225
  }
55150
55226
  relArg = rel;
55151
55227
  }
55152
55228
  const vitestEntry = path79.join(root, "node_modules", "vitest", "vitest.mjs");
55153
- if (!fs82.existsSync(vitestEntry)) {
55229
+ if (!fs83.existsSync(vitestEntry)) {
55154
55230
  throw new Error(
55155
55231
  "run_tests pilot supports vitest projects only \u2014 node_modules/vitest/vitest.mjs not found under consumer_root"
55156
55232
  );