@event4u/agent-config 9.35.0 → 10.0.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 (117) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +95 -142
  3. package/agents/templates/.ai-council.yml.example +31 -51
  4. package/dist/agent-src/commands/analyze/conformance.md +15 -4
  5. package/dist/agent-src/commands/analyze/reference-repo.md +135 -42
  6. package/dist/agent-src/contexts/augment-infrastructure.md +1 -1
  7. package/dist/agent-src/rules/design-review-after-ui-write.md +53 -6
  8. package/dist/agent-src/rules/improve-before-implement.md +1 -1
  9. package/dist/agent-src/rules/session-canary.md +28 -0
  10. package/dist/agent-src/rules/ui-audit-gate.md +35 -0
  11. package/dist/agent-src/skills/design-system-capture/SKILL.md +2 -2
  12. package/dist/agent-src/skills/existing-ui-audit/SKILL.md +1 -1
  13. package/dist/agent-src/skills/fe-design/SKILL.md +84 -12
  14. package/dist/agent-src/skills/fe-design/evals/triggers.json +11 -3
  15. package/dist/agent-src/skills/prediction-pool-optimizer/SKILL.md +5 -5
  16. package/dist/agent-src/skills/react-shadcn-ui/SKILL.md +1 -1
  17. package/dist/agent-src/skills/skill-writing/SKILL.md +24 -0
  18. package/dist/agent-src/skills/subagent-orchestration/prompts/README.md +29 -0
  19. package/dist/agent-src/templates/AGENTS.md +1 -1
  20. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  21. package/dist/cli-delegate/{chunk-2TGMGLBL.js → chunk-2H5SE7DU.js} +35 -5
  22. package/dist/cli-delegate/{chunk-DS6BLDMG.js → chunk-3JUTT26I.js} +8 -3
  23. package/dist/cli-delegate/{chunk-ZAXH3ZWU.js → chunk-HJSKTMIF.js} +14 -13
  24. package/dist/cli-delegate/{chunk-QEEB4LHO.js → chunk-LRXJK6GN.js} +1 -1
  25. package/dist/cli-delegate/{chunk-736JCWLM.js → chunk-M2DPGFZ4.js} +10 -0
  26. package/dist/cli-delegate/{chunk-H6F2CQFI.js → chunk-NX5AXSLD.js} +3 -3
  27. package/dist/cli-delegate/{chunk-AG47LAGQ.js → chunk-TVGXH7VA.js} +1 -1
  28. package/dist/cli-delegate/{chunk-55RI5UXK.js → chunk-XT2YTJCZ.js} +22 -18
  29. package/dist/cli-delegate/{chunk-JEJABGKB.js → chunk-XTC5ARB6.js} +16 -12
  30. package/dist/cli-delegate/cmd_analyze_session.js +1 -1
  31. package/dist/cli-delegate/cmd_brand_status.js +1 -1
  32. package/dist/cli-delegate/cmd_conformance.js +1038 -197
  33. package/dist/cli-delegate/cmd_doctor.js +4 -4
  34. package/dist/cli-delegate/cmd_explain.js +2 -2
  35. package/dist/cli-delegate/cmd_export.js +4 -4
  36. package/dist/cli-delegate/cmd_handoff.js +3 -3
  37. package/dist/cli-delegate/cmd_mcp_available.js +1 -1
  38. package/dist/cli-delegate/cmd_migrate.js +2 -2
  39. package/dist/cli-delegate/cmd_packs_active.js +2 -2
  40. package/dist/cli-delegate/cmd_prune.js +4 -4
  41. package/dist/cli-delegate/cmd_refresh.js +1 -1
  42. package/dist/cli-delegate/cmd_route_audit.js +2 -2
  43. package/dist/cli-delegate/cmd_route_explain.js +1 -1
  44. package/dist/cli-delegate/cmd_session_recycle.js +9 -2
  45. package/dist/cli-delegate/cmd_settings_get.js +1 -1
  46. package/dist/cli-delegate/cmd_settings_migrate.js +4 -4
  47. package/dist/cli-delegate/cmd_settings_set.js +1 -1
  48. package/dist/cli-delegate/cmd_sync.js +4 -4
  49. package/dist/cli-delegate/cmd_uninstall.js +4 -4
  50. package/dist/cli-delegate/cmd_update.js +1 -1
  51. package/dist/cli-delegate/cmd_upgrade.js +2 -2
  52. package/dist/cli-delegate/cmd_validate.js +4 -4
  53. package/dist/cli-delegate/cmd_versions.js +1 -1
  54. package/dist/discovery/deprecation-report.md +1 -1
  55. package/dist/discovery/discovery-manifest.json +14 -14
  56. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  57. package/dist/discovery/discovery-manifest.summary.md +1 -1
  58. package/dist/discovery/dormancy-report.md +1 -1
  59. package/dist/discovery/orphan-report.md +1 -1
  60. package/dist/discovery/packs.json +2 -2
  61. package/dist/discovery/trust-report.md +1 -1
  62. package/dist/discovery/workspaces.json +2 -2
  63. package/dist/hooks/dispatch.js +654 -411
  64. package/dist/install/install.mjs +39 -29
  65. package/dist/mcp/registry-manifest.json +1 -1
  66. package/dist/mcp/server.json +2 -2
  67. package/dist/mcp/server.mjs +1580 -617
  68. package/dist/router.json +1 -1
  69. package/dist/scripts/_lib/agent_settings.js +39 -25
  70. package/dist/scripts/_lib/agent_settings.js.map +1 -1
  71. package/dist/scripts/condense.js +15 -2
  72. package/dist/scripts/condense.js.map +1 -1
  73. package/dist/server/routes/wizard.js +23 -3
  74. package/dist/server/routes/wizard.js.map +1 -1
  75. package/dist/server/schemas/settings.js +11 -6
  76. package/dist/server/schemas/settings.js.map +1 -1
  77. package/docs/contracts/settings-classes.md +16 -9
  78. package/docs/guidelines/agent-infra/agent-interaction-and-decision-quality.md +46 -4
  79. package/package.json +2 -2
  80. package/src/agent-src/templates/AGENTS.md +1 -1
  81. package/src/config/agent-settings.template.yml +38 -36
  82. package/src/config/ci-local-parity.yml +44 -0
  83. package/src/config/gate-coverage.yml +12 -0
  84. package/src/scripts/_cli/cmd_doctor.ts +32 -0
  85. package/src/scripts/_cli/cmd_migrate.ts +26 -3
  86. package/src/scripts/_cli/cmd_refresh.ts +29 -0
  87. package/src/scripts/_cli/cmd_session_recycle.ts +40 -2
  88. package/src/scripts/_lib/agent_settings.ts +39 -25
  89. package/src/scripts/_lib/environment_detector.ts +52 -1
  90. package/src/scripts/_lib/hook_settings.ts +79 -0
  91. package/src/scripts/_lib/ui_surface.ts +97 -0
  92. package/src/scripts/ai_council/config.ts +62 -24
  93. package/src/scripts/before_complete_hook.ts +39 -0
  94. package/src/scripts/capture_skill_catalogue.ts +483 -0
  95. package/src/scripts/check_bridge_derivation.ts +89 -3
  96. package/src/scripts/check_ci_local_parity.ts +74 -0
  97. package/src/scripts/check_references.ts +15 -1
  98. package/src/scripts/condense.ts +16 -2
  99. package/src/scripts/conformance_scan.ts +200 -9
  100. package/src/scripts/council_cli.ts +95 -3
  101. package/src/scripts/hook_manifest.yaml +30 -9
  102. package/src/scripts/hooks/block_no_verify.ts +82 -9
  103. package/src/scripts/hooks/concern_registry.ts +2 -0
  104. package/src/scripts/hooks/design_slop_hook.ts +1 -1
  105. package/src/scripts/hooks/turn_end_gate_hook.ts +138 -105
  106. package/src/scripts/hooks/ui_route_nudge_hook.ts +250 -0
  107. package/src/scripts/lint_roadmap_complexity.ts +60 -0
  108. package/src/scripts/lint_rule_skill_pack_reach.ts +263 -0
  109. package/src/scripts/probe_promissory_closing.ts +180 -0
  110. package/src/scripts/probe_session_canary.ts +180 -0
  111. package/src/scripts/report_consultation_rate.ts +358 -0
  112. package/src/scripts/report_skill_activation.ts +5 -1
  113. package/src/server/schemas/settings.ts +14 -13
  114. /package/dist/agent-src/skills/design-system-capture/{reference → references}/design-system-json.md +0 -0
  115. /package/dist/agent-src/skills/prediction-pool-optimizer/{reference → references}/ev-fixtures.md +0 -0
  116. /package/dist/agent-src/skills/prediction-pool-optimizer/{reference → references}/odds-and-bonus.md +0 -0
  117. /package/dist/agent-src/skills/react-shadcn-ui/{reference → references}/registry.md +0 -0
@@ -591,15 +591,15 @@ function _readDottedSettingsPath(root, dotted) {
591
591
  return node;
592
592
  }
593
593
  function _warn_removed_always_on_keys(merged) {
594
- for (const key of REMOVED_ALWAYS_ON_KEYS) {
595
- if (_warnedRemovedAlwaysOnKeys.has(key)) {
594
+ for (const [key, reason] of REMOVED_KEYS) {
595
+ if (_warnedRemovedKeys.has(key)) {
596
596
  continue;
597
597
  }
598
598
  if (_readDottedSettingsPath(merged, key) === void 0) {
599
599
  continue;
600
600
  }
601
- _warnedRemovedAlwaysOnKeys.add(key);
602
- process.stderr.write(`${key} was removed (always-on orchestration); ignored.
601
+ _warnedRemovedKeys.add(key);
602
+ process.stderr.write(`${key} was removed (${reason}); ignored.
603
603
  `);
604
604
  }
605
605
  }
@@ -877,7 +877,7 @@ function _relative_to(child, root) {
877
877
  function _posix_join(a, b) {
878
878
  return `${a.split(path3.sep).join("/")}/${b}`;
879
879
  }
880
- var _require, Logger, logger, DEFAULT_PROJECT_FILE, LOCAL_PROJECT_FILE, LOCAL_PROJECT_SUBDIR, DEFAULT_TEAM_FILE, USER_GLOBAL_FILENAME, USER_GLOBAL_CANONICAL_RELATIVE, MERGEABLE_KEYS, TEMPLATE_RELATIVE, _PACKAGE_ROOT, _template_defaults_cache, MODULES_DEFAULTS, ANCHOR_AGENT_SETTINGS, ANCHOR_AGENTS_DIR, ANCHOR_GIT, _AGENTS_DIR_MARKERS, _LEGACY_ANCHOR_ENV, ORIGIN_ROOT_FLAG, ORIGIN_EXPLICIT, ORIGIN_ENV, ORIGIN_CWD_FALLBACK, PROJECT_ROOT_ENV, ROOT_OVERRIDE_ENV, ProjectRootError, REMOVED_ALWAYS_ON_KEYS, _warnedRemovedAlwaysOnKeys;
880
+ var _require, Logger, logger, DEFAULT_PROJECT_FILE, LOCAL_PROJECT_FILE, LOCAL_PROJECT_SUBDIR, DEFAULT_TEAM_FILE, USER_GLOBAL_FILENAME, USER_GLOBAL_CANONICAL_RELATIVE, MERGEABLE_KEYS, TEMPLATE_RELATIVE, _PACKAGE_ROOT, _template_defaults_cache, MODULES_DEFAULTS, ANCHOR_AGENT_SETTINGS, ANCHOR_AGENTS_DIR, ANCHOR_GIT, _AGENTS_DIR_MARKERS, _LEGACY_ANCHOR_ENV, ORIGIN_ROOT_FLAG, ORIGIN_EXPLICIT, ORIGIN_ENV, ORIGIN_CWD_FALLBACK, PROJECT_ROOT_ENV, ROOT_OVERRIDE_ENV, ProjectRootError, REMOVED_KEYS, _warnedRemovedKeys;
881
881
  var init_agent_settings = __esm({
882
882
  "src/scripts/_lib/agent_settings.ts"() {
883
883
  "use strict";
@@ -970,14 +970,18 @@ var init_agent_settings = __esm({
970
970
  this.name = "ProjectRootError";
971
971
  }
972
972
  };
973
- REMOVED_ALWAYS_ON_KEYS = [
974
- "subagents.enabled",
975
- "subagents.auto",
976
- "subagents.host_capabilities",
977
- "subagents.budget_routing",
978
- "ai_team.enabled"
979
- ];
980
- _warnedRemovedAlwaysOnKeys = /* @__PURE__ */ new Set();
973
+ REMOVED_KEYS = /* @__PURE__ */ new Map([
974
+ ["subagents.enabled", "always-on orchestration"],
975
+ ["subagents.auto", "always-on orchestration"],
976
+ ["subagents.host_capabilities", "always-on orchestration"],
977
+ ["subagents.budget_routing", "always-on orchestration"],
978
+ ["ai_team.enabled", "always-on orchestration"],
979
+ ["hooks.turn_end_gate.enabled", "the turn-end gate is always armed"],
980
+ ["hooks.turn_end_gate.promissory", "the turn-end gate is always armed"],
981
+ ["hooks.turn_end_gate.language", "the turn-end gate is always armed"],
982
+ ["hooks.turn_end_gate.verification", "the turn-end gate is always armed"]
983
+ ]);
984
+ _warnedRemovedKeys = /* @__PURE__ */ new Set();
981
985
  }
982
986
  });
983
987
 
@@ -1831,17 +1835,17 @@ var require_visit = __commonJS({
1831
1835
  visit.BREAK = BREAK;
1832
1836
  visit.SKIP = SKIP;
1833
1837
  visit.REMOVE = REMOVE;
1834
- function visit_(key, node, visitor, path71) {
1835
- const ctrl = callVisitor(key, node, visitor, path71);
1838
+ function visit_(key, node, visitor, path73) {
1839
+ const ctrl = callVisitor(key, node, visitor, path73);
1836
1840
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
1837
- replaceNode(key, path71, ctrl);
1838
- return visit_(key, ctrl, visitor, path71);
1841
+ replaceNode(key, path73, ctrl);
1842
+ return visit_(key, ctrl, visitor, path73);
1839
1843
  }
1840
1844
  if (typeof ctrl !== "symbol") {
1841
1845
  if (identity.isCollection(node)) {
1842
- path71 = Object.freeze(path71.concat(node));
1846
+ path73 = Object.freeze(path73.concat(node));
1843
1847
  for (let i = 0; i < node.items.length; ++i) {
1844
- const ci = visit_(i, node.items[i], visitor, path71);
1848
+ const ci = visit_(i, node.items[i], visitor, path73);
1845
1849
  if (typeof ci === "number")
1846
1850
  i = ci - 1;
1847
1851
  else if (ci === BREAK)
@@ -1852,13 +1856,13 @@ var require_visit = __commonJS({
1852
1856
  }
1853
1857
  }
1854
1858
  } else if (identity.isPair(node)) {
1855
- path71 = Object.freeze(path71.concat(node));
1856
- const ck = visit_("key", node.key, visitor, path71);
1859
+ path73 = Object.freeze(path73.concat(node));
1860
+ const ck = visit_("key", node.key, visitor, path73);
1857
1861
  if (ck === BREAK)
1858
1862
  return BREAK;
1859
1863
  else if (ck === REMOVE)
1860
1864
  node.key = null;
1861
- const cv = visit_("value", node.value, visitor, path71);
1865
+ const cv = visit_("value", node.value, visitor, path73);
1862
1866
  if (cv === BREAK)
1863
1867
  return BREAK;
1864
1868
  else if (cv === REMOVE)
@@ -1879,17 +1883,17 @@ var require_visit = __commonJS({
1879
1883
  visitAsync.BREAK = BREAK;
1880
1884
  visitAsync.SKIP = SKIP;
1881
1885
  visitAsync.REMOVE = REMOVE;
1882
- async function visitAsync_(key, node, visitor, path71) {
1883
- const ctrl = await callVisitor(key, node, visitor, path71);
1886
+ async function visitAsync_(key, node, visitor, path73) {
1887
+ const ctrl = await callVisitor(key, node, visitor, path73);
1884
1888
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
1885
- replaceNode(key, path71, ctrl);
1886
- return visitAsync_(key, ctrl, visitor, path71);
1889
+ replaceNode(key, path73, ctrl);
1890
+ return visitAsync_(key, ctrl, visitor, path73);
1887
1891
  }
1888
1892
  if (typeof ctrl !== "symbol") {
1889
1893
  if (identity.isCollection(node)) {
1890
- path71 = Object.freeze(path71.concat(node));
1894
+ path73 = Object.freeze(path73.concat(node));
1891
1895
  for (let i = 0; i < node.items.length; ++i) {
1892
- const ci = await visitAsync_(i, node.items[i], visitor, path71);
1896
+ const ci = await visitAsync_(i, node.items[i], visitor, path73);
1893
1897
  if (typeof ci === "number")
1894
1898
  i = ci - 1;
1895
1899
  else if (ci === BREAK)
@@ -1900,13 +1904,13 @@ var require_visit = __commonJS({
1900
1904
  }
1901
1905
  }
1902
1906
  } else if (identity.isPair(node)) {
1903
- path71 = Object.freeze(path71.concat(node));
1904
- const ck = await visitAsync_("key", node.key, visitor, path71);
1907
+ path73 = Object.freeze(path73.concat(node));
1908
+ const ck = await visitAsync_("key", node.key, visitor, path73);
1905
1909
  if (ck === BREAK)
1906
1910
  return BREAK;
1907
1911
  else if (ck === REMOVE)
1908
1912
  node.key = null;
1909
- const cv = await visitAsync_("value", node.value, visitor, path71);
1913
+ const cv = await visitAsync_("value", node.value, visitor, path73);
1910
1914
  if (cv === BREAK)
1911
1915
  return BREAK;
1912
1916
  else if (cv === REMOVE)
@@ -1933,23 +1937,23 @@ var require_visit = __commonJS({
1933
1937
  }
1934
1938
  return visitor;
1935
1939
  }
1936
- function callVisitor(key, node, visitor, path71) {
1940
+ function callVisitor(key, node, visitor, path73) {
1937
1941
  if (typeof visitor === "function")
1938
- return visitor(key, node, path71);
1942
+ return visitor(key, node, path73);
1939
1943
  if (identity.isMap(node))
1940
- return visitor.Map?.(key, node, path71);
1944
+ return visitor.Map?.(key, node, path73);
1941
1945
  if (identity.isSeq(node))
1942
- return visitor.Seq?.(key, node, path71);
1946
+ return visitor.Seq?.(key, node, path73);
1943
1947
  if (identity.isPair(node))
1944
- return visitor.Pair?.(key, node, path71);
1948
+ return visitor.Pair?.(key, node, path73);
1945
1949
  if (identity.isScalar(node))
1946
- return visitor.Scalar?.(key, node, path71);
1950
+ return visitor.Scalar?.(key, node, path73);
1947
1951
  if (identity.isAlias(node))
1948
- return visitor.Alias?.(key, node, path71);
1952
+ return visitor.Alias?.(key, node, path73);
1949
1953
  return void 0;
1950
1954
  }
1951
- function replaceNode(key, path71, node) {
1952
- const parent = path71[path71.length - 1];
1955
+ function replaceNode(key, path73, node) {
1956
+ const parent = path73[path73.length - 1];
1953
1957
  if (identity.isCollection(parent)) {
1954
1958
  parent.items[key] = node;
1955
1959
  } else if (identity.isPair(parent)) {
@@ -2559,10 +2563,10 @@ var require_Collection = __commonJS({
2559
2563
  var createNode = require_createNode();
2560
2564
  var identity = require_identity();
2561
2565
  var Node = require_Node();
2562
- function collectionFromPath(schema, path71, value) {
2566
+ function collectionFromPath(schema, path73, value) {
2563
2567
  let v = value;
2564
- for (let i = path71.length - 1; i >= 0; --i) {
2565
- const k = path71[i];
2568
+ for (let i = path73.length - 1; i >= 0; --i) {
2569
+ const k = path73[i];
2566
2570
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
2567
2571
  const a = [];
2568
2572
  a[k] = v;
@@ -2581,7 +2585,7 @@ var require_Collection = __commonJS({
2581
2585
  sourceObjects: /* @__PURE__ */ new Map()
2582
2586
  });
2583
2587
  }
2584
- var isEmptyPath = (path71) => path71 == null || typeof path71 === "object" && !!path71[Symbol.iterator]().next().done;
2588
+ var isEmptyPath = (path73) => path73 == null || typeof path73 === "object" && !!path73[Symbol.iterator]().next().done;
2585
2589
  var Collection = class extends Node.NodeBase {
2586
2590
  constructor(type, schema) {
2587
2591
  super(type);
@@ -2611,11 +2615,11 @@ var require_Collection = __commonJS({
2611
2615
  * be a Pair instance or a `{ key, value }` object, which may not have a key
2612
2616
  * that already exists in the map.
2613
2617
  */
2614
- addIn(path71, value) {
2615
- if (isEmptyPath(path71))
2618
+ addIn(path73, value) {
2619
+ if (isEmptyPath(path73))
2616
2620
  this.add(value);
2617
2621
  else {
2618
- const [key, ...rest] = path71;
2622
+ const [key, ...rest] = path73;
2619
2623
  const node = this.get(key, true);
2620
2624
  if (identity.isCollection(node))
2621
2625
  node.addIn(rest, value);
@@ -2629,8 +2633,8 @@ var require_Collection = __commonJS({
2629
2633
  * Removes a value from the collection.
2630
2634
  * @returns `true` if the item was found and removed.
2631
2635
  */
2632
- deleteIn(path71) {
2633
- const [key, ...rest] = path71;
2636
+ deleteIn(path73) {
2637
+ const [key, ...rest] = path73;
2634
2638
  if (rest.length === 0)
2635
2639
  return this.delete(key);
2636
2640
  const node = this.get(key, true);
@@ -2644,8 +2648,8 @@ var require_Collection = __commonJS({
2644
2648
  * scalar values from their surrounding node; to disable set `keepScalar` to
2645
2649
  * `true` (collections are always returned intact).
2646
2650
  */
2647
- getIn(path71, keepScalar) {
2648
- const [key, ...rest] = path71;
2651
+ getIn(path73, keepScalar) {
2652
+ const [key, ...rest] = path73;
2649
2653
  const node = this.get(key, true);
2650
2654
  if (rest.length === 0)
2651
2655
  return !keepScalar && identity.isScalar(node) ? node.value : node;
@@ -2663,8 +2667,8 @@ var require_Collection = __commonJS({
2663
2667
  /**
2664
2668
  * Checks if the collection includes a value with the key `key`.
2665
2669
  */
2666
- hasIn(path71) {
2667
- const [key, ...rest] = path71;
2670
+ hasIn(path73) {
2671
+ const [key, ...rest] = path73;
2668
2672
  if (rest.length === 0)
2669
2673
  return this.has(key);
2670
2674
  const node = this.get(key, true);
@@ -2674,8 +2678,8 @@ var require_Collection = __commonJS({
2674
2678
  * Sets a value in this collection. For `!!set`, `value` needs to be a
2675
2679
  * boolean to add/remove the item from the set.
2676
2680
  */
2677
- setIn(path71, value) {
2678
- const [key, ...rest] = path71;
2681
+ setIn(path73, value) {
2682
+ const [key, ...rest] = path73;
2679
2683
  if (rest.length === 0) {
2680
2684
  this.set(key, value);
2681
2685
  } else {
@@ -2699,13 +2703,13 @@ var require_Collection = __commonJS({
2699
2703
  var require_stringifyComment = __commonJS({
2700
2704
  "node_modules/yaml/dist/stringify/stringifyComment.js"(exports) {
2701
2705
  "use strict";
2702
- var stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, "#");
2706
+ var stringifyComment = (str3) => str3.replace(/^(?!$)(?: $)?/gm, "#");
2703
2707
  function indentComment(comment, indent) {
2704
2708
  if (/^\n+$/.test(comment))
2705
2709
  return comment.substring(1);
2706
2710
  return indent ? comment.replace(/^(?! *$)/gm, indent) : comment;
2707
2711
  }
2708
- var lineComment = (str, indent, comment) => str.endsWith("\n") ? indentComment(comment, indent) : comment.includes("\n") ? "\n" + indentComment(comment, indent) : (str.endsWith(" ") ? "" : " ") + comment;
2712
+ var lineComment = (str3, indent, comment) => str3.endsWith("\n") ? indentComment(comment, indent) : comment.includes("\n") ? "\n" + indentComment(comment, indent) : (str3.endsWith(" ") ? "" : " ") + comment;
2709
2713
  exports.indentComment = indentComment;
2710
2714
  exports.lineComment = lineComment;
2711
2715
  exports.stringifyComment = stringifyComment;
@@ -2859,16 +2863,16 @@ var require_stringifyString = __commonJS({
2859
2863
  lineWidth: ctx.options.lineWidth,
2860
2864
  minContentWidth: ctx.options.minContentWidth
2861
2865
  });
2862
- var containsDocumentMarker = (str) => /^(%|---|\.\.\.)/m.test(str);
2863
- function lineLengthOverLimit(str, lineWidth, indentLength) {
2866
+ var containsDocumentMarker = (str3) => /^(%|---|\.\.\.)/m.test(str3);
2867
+ function lineLengthOverLimit(str3, lineWidth, indentLength) {
2864
2868
  if (!lineWidth || lineWidth < 0)
2865
2869
  return false;
2866
2870
  const limit = lineWidth - indentLength;
2867
- const strLen = str.length;
2871
+ const strLen = str3.length;
2868
2872
  if (strLen <= limit)
2869
2873
  return false;
2870
2874
  for (let i = 0, start = 0; i < strLen; ++i) {
2871
- if (str[i] === "\n") {
2875
+ if (str3[i] === "\n") {
2872
2876
  if (i - start > limit)
2873
2877
  return true;
2874
2878
  start = i + 1;
@@ -2885,11 +2889,11 @@ var require_stringifyString = __commonJS({
2885
2889
  const { implicitKey } = ctx;
2886
2890
  const minMultiLineLength = ctx.options.doubleQuotedMinMultiLineLength;
2887
2891
  const indent = ctx.indent || (containsDocumentMarker(value) ? " " : "");
2888
- let str = "";
2892
+ let str3 = "";
2889
2893
  let start = 0;
2890
2894
  for (let i = 0, ch = json[i]; ch; ch = json[++i]) {
2891
2895
  if (ch === " " && json[i + 1] === "\\" && json[i + 2] === "n") {
2892
- str += json.slice(start, i) + "\\ ";
2896
+ str3 += json.slice(start, i) + "\\ ";
2893
2897
  i += 1;
2894
2898
  start = i;
2895
2899
  ch = "\\";
@@ -2898,38 +2902,38 @@ var require_stringifyString = __commonJS({
2898
2902
  switch (json[i + 1]) {
2899
2903
  case "u":
2900
2904
  {
2901
- str += json.slice(start, i);
2905
+ str3 += json.slice(start, i);
2902
2906
  const code = json.substr(i + 2, 4);
2903
2907
  switch (code) {
2904
2908
  case "0000":
2905
- str += "\\0";
2909
+ str3 += "\\0";
2906
2910
  break;
2907
2911
  case "0007":
2908
- str += "\\a";
2912
+ str3 += "\\a";
2909
2913
  break;
2910
2914
  case "000b":
2911
- str += "\\v";
2915
+ str3 += "\\v";
2912
2916
  break;
2913
2917
  case "001b":
2914
- str += "\\e";
2918
+ str3 += "\\e";
2915
2919
  break;
2916
2920
  case "0085":
2917
- str += "\\N";
2921
+ str3 += "\\N";
2918
2922
  break;
2919
2923
  case "00a0":
2920
- str += "\\_";
2924
+ str3 += "\\_";
2921
2925
  break;
2922
2926
  case "2028":
2923
- str += "\\L";
2927
+ str3 += "\\L";
2924
2928
  break;
2925
2929
  case "2029":
2926
- str += "\\P";
2930
+ str3 += "\\P";
2927
2931
  break;
2928
2932
  default:
2929
2933
  if (code.substr(0, 2) === "00")
2930
- str += "\\x" + code.substr(2);
2934
+ str3 += "\\x" + code.substr(2);
2931
2935
  else
2932
- str += json.substr(i, 6);
2936
+ str3 += json.substr(i, 6);
2933
2937
  }
2934
2938
  i += 5;
2935
2939
  start = i + 1;
@@ -2939,14 +2943,14 @@ var require_stringifyString = __commonJS({
2939
2943
  if (implicitKey || json[i + 2] === '"' || json.length < minMultiLineLength) {
2940
2944
  i += 1;
2941
2945
  } else {
2942
- str += json.slice(start, i) + "\n\n";
2946
+ str3 += json.slice(start, i) + "\n\n";
2943
2947
  while (json[i + 2] === "\\" && json[i + 3] === "n" && json[i + 4] !== '"') {
2944
- str += "\n";
2948
+ str3 += "\n";
2945
2949
  i += 2;
2946
2950
  }
2947
- str += indent;
2951
+ str3 += indent;
2948
2952
  if (json[i + 2] === " ")
2949
- str += "\\";
2953
+ str3 += "\\";
2950
2954
  i += 1;
2951
2955
  start = i + 1;
2952
2956
  }
@@ -2955,8 +2959,8 @@ var require_stringifyString = __commonJS({
2955
2959
  i += 1;
2956
2960
  }
2957
2961
  }
2958
- str = start ? str + json.slice(start) : json;
2959
- return implicitKey ? str : foldFlowLines.foldFlowLines(str, indent, foldFlowLines.FOLD_QUOTED, getFoldOptions(ctx, false));
2962
+ str3 = start ? str3 + json.slice(start) : json;
2963
+ return implicitKey ? str3 : foldFlowLines.foldFlowLines(str3, indent, foldFlowLines.FOLD_QUOTED, getFoldOptions(ctx, false));
2960
2964
  }
2961
2965
  function singleQuotedString(value, ctx) {
2962
2966
  if (ctx.options.singleQuote === false || ctx.implicitKey && value.includes("\n") || /[ \t]\n|\n[ \t]/.test(value))
@@ -3084,15 +3088,15 @@ ${indent}${start}${value}${end}`;
3084
3088
  return quotedString(value, ctx);
3085
3089
  }
3086
3090
  }
3087
- const str = value.replace(/\n+/g, `$&
3091
+ const str3 = value.replace(/\n+/g, `$&
3088
3092
  ${indent}`);
3089
3093
  if (actualString) {
3090
- const test = (tag) => tag.default && tag.tag !== "tag:yaml.org,2002:str" && tag.test?.test(str);
3094
+ const test = (tag) => tag.default && tag.tag !== "tag:yaml.org,2002:str" && tag.test?.test(str3);
3091
3095
  const { compat, tags } = ctx.doc.schema;
3092
3096
  if (tags.some(test) || compat?.some(test))
3093
3097
  return quotedString(value, ctx);
3094
3098
  }
3095
- return implicitKey ? str : foldFlowLines.foldFlowLines(str, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));
3099
+ return implicitKey ? str3 : foldFlowLines.foldFlowLines(str3, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));
3096
3100
  }
3097
3101
  function stringifyString(item, ctx, onComment, onChompKeep) {
3098
3102
  const { implicitKey, inFlow } = ctx;
@@ -3244,11 +3248,11 @@ var require_stringify = __commonJS({
3244
3248
  const props = stringifyProps(node, tagObj, ctx);
3245
3249
  if (props.length > 0)
3246
3250
  ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
3247
- const str = typeof tagObj.stringify === "function" ? tagObj.stringify(node, ctx, onComment, onChompKeep) : identity.isScalar(node) ? stringifyString.stringifyString(node, ctx, onComment, onChompKeep) : node.toString(ctx, onComment, onChompKeep);
3251
+ const str3 = typeof tagObj.stringify === "function" ? tagObj.stringify(node, ctx, onComment, onChompKeep) : identity.isScalar(node) ? stringifyString.stringifyString(node, ctx, onComment, onChompKeep) : node.toString(ctx, onComment, onChompKeep);
3248
3252
  if (!props)
3249
- return str;
3250
- return identity.isScalar(node) || str[0] === "{" || str[0] === "[" ? `${props} ${str}` : `${props}
3251
- ${ctx.indent}${str}`;
3253
+ return str3;
3254
+ return identity.isScalar(node) || str3[0] === "{" || str3[0] === "[" ? `${props} ${str3}` : `${props}
3255
+ ${ctx.indent}${str3}`;
3252
3256
  }
3253
3257
  exports.createStringifyContext = createStringifyContext;
3254
3258
  exports.stringify = stringify;
@@ -3283,8 +3287,8 @@ var require_stringifyPair = __commonJS({
3283
3287
  });
3284
3288
  let keyCommentDone = false;
3285
3289
  let chompKeep = false;
3286
- let str = stringify.stringify(key, ctx, () => keyCommentDone = true, () => chompKeep = true);
3287
- if (!explicitKey && !ctx.inFlow && str.length > 1024) {
3290
+ let str3 = stringify.stringify(key, ctx, () => keyCommentDone = true, () => chompKeep = true);
3291
+ if (!explicitKey && !ctx.inFlow && str3.length > 1024) {
3288
3292
  if (simpleKeys)
3289
3293
  throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
3290
3294
  explicitKey = true;
@@ -3293,27 +3297,27 @@ var require_stringifyPair = __commonJS({
3293
3297
  if (allNullValues || value == null) {
3294
3298
  if (keyCommentDone && onComment)
3295
3299
  onComment();
3296
- return str === "" ? "?" : explicitKey ? `? ${str}` : str;
3300
+ return str3 === "" ? "?" : explicitKey ? `? ${str3}` : str3;
3297
3301
  }
3298
3302
  } else if (allNullValues && !simpleKeys || value == null && explicitKey) {
3299
- str = `? ${str}`;
3303
+ str3 = `? ${str3}`;
3300
3304
  if (keyComment && !keyCommentDone) {
3301
- str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));
3305
+ str3 += stringifyComment.lineComment(str3, ctx.indent, commentString(keyComment));
3302
3306
  } else if (chompKeep && onChompKeep)
3303
3307
  onChompKeep();
3304
- return str;
3308
+ return str3;
3305
3309
  }
3306
3310
  if (keyCommentDone)
3307
3311
  keyComment = null;
3308
3312
  if (explicitKey) {
3309
3313
  if (keyComment)
3310
- str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));
3311
- str = `? ${str}
3314
+ str3 += stringifyComment.lineComment(str3, ctx.indent, commentString(keyComment));
3315
+ str3 = `? ${str3}
3312
3316
  ${indent}:`;
3313
3317
  } else {
3314
- str = `${str}:`;
3318
+ str3 = `${str3}:`;
3315
3319
  if (keyComment)
3316
- str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));
3320
+ str3 += stringifyComment.lineComment(str3, ctx.indent, commentString(keyComment));
3317
3321
  }
3318
3322
  let vsb, vcb, valueComment;
3319
3323
  if (identity.isNode(value)) {
@@ -3329,7 +3333,7 @@ ${indent}:`;
3329
3333
  }
3330
3334
  ctx.implicitKey = false;
3331
3335
  if (!explicitKey && !keyComment && identity.isScalar(value))
3332
- ctx.indentAtStart = str.length + 1;
3336
+ ctx.indentAtStart = str3.length + 1;
3333
3337
  chompKeep = false;
3334
3338
  if (!indentSeq && indentStep.length >= 2 && !ctx.inFlow && !explicitKey && identity.isSeq(value) && !value.flow && !value.tag && !value.anchor) {
3335
3339
  ctx.indent = ctx.indent.substring(2);
@@ -3373,16 +3377,16 @@ ${ctx.indent}`;
3373
3377
  } else if (valueStr === "" || valueStr[0] === "\n") {
3374
3378
  ws = "";
3375
3379
  }
3376
- str += ws + valueStr;
3380
+ str3 += ws + valueStr;
3377
3381
  if (ctx.inFlow) {
3378
3382
  if (valueCommentDone && onComment)
3379
3383
  onComment();
3380
3384
  } else if (valueComment && !valueCommentDone) {
3381
- str += stringifyComment.lineComment(str, ctx.indent, commentString(valueComment));
3385
+ str3 += stringifyComment.lineComment(str3, ctx.indent, commentString(valueComment));
3382
3386
  } else if (chompKeep && onChompKeep) {
3383
3387
  onChompKeep();
3384
3388
  }
3385
- return str;
3389
+ return str3;
3386
3390
  }
3387
3391
  exports.stringifyPair = stringifyPair;
3388
3392
  }
@@ -3609,31 +3613,31 @@ var require_stringifyCollection = __commonJS({
3609
3613
  }
3610
3614
  }
3611
3615
  chompKeep = false;
3612
- let str2 = stringify.stringify(item, itemCtx, () => comment2 = null, () => chompKeep = true);
3616
+ let str4 = stringify.stringify(item, itemCtx, () => comment2 = null, () => chompKeep = true);
3613
3617
  if (comment2)
3614
- str2 += stringifyComment.lineComment(str2, itemIndent, commentString(comment2));
3618
+ str4 += stringifyComment.lineComment(str4, itemIndent, commentString(comment2));
3615
3619
  if (chompKeep && comment2)
3616
3620
  chompKeep = false;
3617
- lines.push(blockItemPrefix + str2);
3621
+ lines.push(blockItemPrefix + str4);
3618
3622
  }
3619
- let str;
3623
+ let str3;
3620
3624
  if (lines.length === 0) {
3621
- str = flowChars.start + flowChars.end;
3625
+ str3 = flowChars.start + flowChars.end;
3622
3626
  } else {
3623
- str = lines[0];
3627
+ str3 = lines[0];
3624
3628
  for (let i = 1; i < lines.length; ++i) {
3625
3629
  const line = lines[i];
3626
- str += line ? `
3630
+ str3 += line ? `
3627
3631
  ${indent}${line}` : "\n";
3628
3632
  }
3629
3633
  }
3630
3634
  if (comment) {
3631
- str += "\n" + stringifyComment.indentComment(commentString(comment), indent);
3635
+ str3 += "\n" + stringifyComment.indentComment(commentString(comment), indent);
3632
3636
  if (onComment)
3633
3637
  onComment();
3634
3638
  } else if (chompKeep && onChompKeep)
3635
3639
  onChompKeep();
3636
- return str;
3640
+ return str3;
3637
3641
  }
3638
3642
  function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
3639
3643
  const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;
@@ -3676,21 +3680,21 @@ ${indent}${line}` : "\n";
3676
3680
  }
3677
3681
  if (comment)
3678
3682
  reqNewline = true;
3679
- let str = stringify.stringify(item, itemCtx, () => comment = null);
3680
- reqNewline || (reqNewline = lines.length > linesAtValue || str.includes("\n"));
3683
+ let str3 = stringify.stringify(item, itemCtx, () => comment = null);
3684
+ reqNewline || (reqNewline = lines.length > linesAtValue || str3.includes("\n"));
3681
3685
  if (i < items.length - 1) {
3682
- str += ",";
3686
+ str3 += ",";
3683
3687
  } else if (ctx.options.trailingComma) {
3684
3688
  if (ctx.options.lineWidth > 0) {
3685
- reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) + (str.length + 2) > ctx.options.lineWidth);
3689
+ reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) + (str3.length + 2) > ctx.options.lineWidth);
3686
3690
  }
3687
3691
  if (reqNewline) {
3688
- str += ",";
3692
+ str3 += ",";
3689
3693
  }
3690
3694
  }
3691
3695
  if (comment)
3692
- str += stringifyComment.lineComment(str, itemIndent, commentString(comment));
3693
- lines.push(str);
3696
+ str3 += stringifyComment.lineComment(str3, itemIndent, commentString(comment));
3697
+ lines.push(str3);
3694
3698
  linesAtValue = lines.length;
3695
3699
  }
3696
3700
  const { start, end } = flowChars;
@@ -3702,11 +3706,11 @@ ${indent}${line}` : "\n";
3702
3706
  reqNewline = ctx.options.lineWidth > 0 && len > ctx.options.lineWidth;
3703
3707
  }
3704
3708
  if (reqNewline) {
3705
- let str = start;
3709
+ let str3 = start;
3706
3710
  for (const line of lines)
3707
- str += line ? `
3711
+ str3 += line ? `
3708
3712
  ${indentStep}${indent}${line}` : "\n";
3709
- return `${str}
3713
+ return `${str3}
3710
3714
  ${indent}${end}`;
3711
3715
  } else {
3712
3716
  return `${start}${fcPadding}${lines.join(" ")}${fcPadding}${end}`;
@@ -4038,7 +4042,7 @@ var require_string = __commonJS({
4038
4042
  identify: (value) => typeof value === "string",
4039
4043
  default: true,
4040
4044
  tag: "tag:yaml.org,2002:str",
4041
- resolve: (str) => str,
4045
+ resolve: (str3) => str3,
4042
4046
  stringify(item, ctx, onComment, onChompKeep) {
4043
4047
  ctx = Object.assign({ actualString: true }, ctx);
4044
4048
  return stringifyString.stringifyString(item, ctx, onComment, onChompKeep);
@@ -4076,7 +4080,7 @@ var require_bool = __commonJS({
4076
4080
  default: true,
4077
4081
  tag: "tag:yaml.org,2002:bool",
4078
4082
  test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
4079
- resolve: (str) => new Scalar.Scalar(str[0] === "t" || str[0] === "T"),
4083
+ resolve: (str3) => new Scalar.Scalar(str3[0] === "t" || str3[0] === "T"),
4080
4084
  stringify({ source, value }, ctx) {
4081
4085
  if (source && boolTag.test.test(source)) {
4082
4086
  const sv = source[0] === "t" || source[0] === "T";
@@ -4128,7 +4132,7 @@ var require_float = __commonJS({
4128
4132
  default: true,
4129
4133
  tag: "tag:yaml.org,2002:float",
4130
4134
  test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
4131
- resolve: (str) => str.slice(-3).toLowerCase() === "nan" ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
4135
+ resolve: (str3) => str3.slice(-3).toLowerCase() === "nan" ? NaN : str3[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
4132
4136
  stringify: stringifyNumber.stringifyNumber
4133
4137
  };
4134
4138
  var floatExp = {
@@ -4137,7 +4141,7 @@ var require_float = __commonJS({
4137
4141
  tag: "tag:yaml.org,2002:float",
4138
4142
  format: "EXP",
4139
4143
  test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
4140
- resolve: (str) => parseFloat(str),
4144
+ resolve: (str3) => parseFloat(str3),
4141
4145
  stringify(node) {
4142
4146
  const num = Number(node.value);
4143
4147
  return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);
@@ -4148,11 +4152,11 @@ var require_float = __commonJS({
4148
4152
  default: true,
4149
4153
  tag: "tag:yaml.org,2002:float",
4150
4154
  test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
4151
- resolve(str) {
4152
- const node = new Scalar.Scalar(parseFloat(str));
4153
- const dot = str.indexOf(".");
4154
- if (dot !== -1 && str[str.length - 1] === "0")
4155
- node.minFractionDigits = str.length - dot - 1;
4155
+ resolve(str3) {
4156
+ const node = new Scalar.Scalar(parseFloat(str3));
4157
+ const dot = str3.indexOf(".");
4158
+ if (dot !== -1 && str3[str3.length - 1] === "0")
4159
+ node.minFractionDigits = str3.length - dot - 1;
4156
4160
  return node;
4157
4161
  },
4158
4162
  stringify: stringifyNumber.stringifyNumber
@@ -4169,7 +4173,7 @@ var require_int = __commonJS({
4169
4173
  "use strict";
4170
4174
  var stringifyNumber = require_stringifyNumber();
4171
4175
  var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
4172
- var intResolve = (str, offset, radix, { intAsBigInt }) => intAsBigInt ? BigInt(str) : parseInt(str.substring(offset), radix);
4176
+ var intResolve = (str3, offset, radix, { intAsBigInt }) => intAsBigInt ? BigInt(str3) : parseInt(str3.substring(offset), radix);
4173
4177
  function intStringify(node, radix, prefix) {
4174
4178
  const { value } = node;
4175
4179
  if (intIdentify(value) && value >= 0)
@@ -4182,7 +4186,7 @@ var require_int = __commonJS({
4182
4186
  tag: "tag:yaml.org,2002:int",
4183
4187
  format: "OCT",
4184
4188
  test: /^0o[0-7]+$/,
4185
- resolve: (str, _onError, opt) => intResolve(str, 2, 8, opt),
4189
+ resolve: (str3, _onError, opt) => intResolve(str3, 2, 8, opt),
4186
4190
  stringify: (node) => intStringify(node, 8, "0o")
4187
4191
  };
4188
4192
  var int = {
@@ -4190,7 +4194,7 @@ var require_int = __commonJS({
4190
4194
  default: true,
4191
4195
  tag: "tag:yaml.org,2002:int",
4192
4196
  test: /^[-+]?[0-9]+$/,
4193
- resolve: (str, _onError, opt) => intResolve(str, 0, 10, opt),
4197
+ resolve: (str3, _onError, opt) => intResolve(str3, 0, 10, opt),
4194
4198
  stringify: stringifyNumber.stringifyNumber
4195
4199
  };
4196
4200
  var intHex = {
@@ -4199,7 +4203,7 @@ var require_int = __commonJS({
4199
4203
  tag: "tag:yaml.org,2002:int",
4200
4204
  format: "HEX",
4201
4205
  test: /^0x[0-9a-fA-F]+$/,
4202
- resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),
4206
+ resolve: (str3, _onError, opt) => intResolve(str3, 2, 16, opt),
4203
4207
  stringify: (node) => intStringify(node, 16, "0x")
4204
4208
  };
4205
4209
  exports.int = int;
@@ -4252,7 +4256,7 @@ var require_schema2 = __commonJS({
4252
4256
  identify: (value) => typeof value === "string",
4253
4257
  default: true,
4254
4258
  tag: "tag:yaml.org,2002:str",
4255
- resolve: (str) => str,
4259
+ resolve: (str3) => str3,
4256
4260
  stringify: stringifyJSON
4257
4261
  },
4258
4262
  {
@@ -4269,7 +4273,7 @@ var require_schema2 = __commonJS({
4269
4273
  default: true,
4270
4274
  tag: "tag:yaml.org,2002:bool",
4271
4275
  test: /^true$|^false$/,
4272
- resolve: (str) => str === "true",
4276
+ resolve: (str3) => str3 === "true",
4273
4277
  stringify: stringifyJSON
4274
4278
  },
4275
4279
  {
@@ -4277,7 +4281,7 @@ var require_schema2 = __commonJS({
4277
4281
  default: true,
4278
4282
  tag: "tag:yaml.org,2002:int",
4279
4283
  test: /^-?(?:0|[1-9][0-9]*)$/,
4280
- resolve: (str, _onError, { intAsBigInt }) => intAsBigInt ? BigInt(str) : parseInt(str, 10),
4284
+ resolve: (str3, _onError, { intAsBigInt }) => intAsBigInt ? BigInt(str3) : parseInt(str3, 10),
4281
4285
  stringify: ({ value }) => intIdentify(value) ? value.toString() : JSON.stringify(value)
4282
4286
  },
4283
4287
  {
@@ -4285,7 +4289,7 @@ var require_schema2 = __commonJS({
4285
4289
  default: true,
4286
4290
  tag: "tag:yaml.org,2002:float",
4287
4291
  test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
4288
- resolve: (str) => parseFloat(str),
4292
+ resolve: (str3) => parseFloat(str3),
4289
4293
  stringify: stringifyJSON
4290
4294
  }
4291
4295
  ];
@@ -4293,9 +4297,9 @@ var require_schema2 = __commonJS({
4293
4297
  default: true,
4294
4298
  tag: "",
4295
4299
  test: /^/,
4296
- resolve(str, onError) {
4297
- onError(`Unresolved plain scalar ${JSON.stringify(str)}`);
4298
- return str;
4300
+ resolve(str3, onError) {
4301
+ onError(`Unresolved plain scalar ${JSON.stringify(str3)}`);
4302
+ return str3;
4299
4303
  }
4300
4304
  };
4301
4305
  var schema = [map.map, seq.seq].concat(jsonScalars, jsonError);
@@ -4327,10 +4331,10 @@ var require_binary = __commonJS({
4327
4331
  if (typeof node_buffer.Buffer === "function") {
4328
4332
  return node_buffer.Buffer.from(src, "base64");
4329
4333
  } else if (typeof atob === "function") {
4330
- const str = atob(src.replace(/[\n\r]/g, ""));
4331
- const buffer = new Uint8Array(str.length);
4332
- for (let i = 0; i < str.length; ++i)
4333
- buffer[i] = str.charCodeAt(i);
4334
+ const str3 = atob(src.replace(/[\n\r]/g, ""));
4335
+ const buffer = new Uint8Array(str3.length);
4336
+ for (let i = 0; i < str3.length; ++i)
4337
+ buffer[i] = str3.charCodeAt(i);
4334
4338
  return buffer;
4335
4339
  } else {
4336
4340
  onError("This environment does not support reading binary tags; either Buffer or atob is required");
@@ -4341,28 +4345,28 @@ var require_binary = __commonJS({
4341
4345
  if (!value)
4342
4346
  return "";
4343
4347
  const buf = value;
4344
- let str;
4348
+ let str3;
4345
4349
  if (typeof node_buffer.Buffer === "function") {
4346
- str = buf instanceof node_buffer.Buffer ? buf.toString("base64") : node_buffer.Buffer.from(buf.buffer).toString("base64");
4350
+ str3 = buf instanceof node_buffer.Buffer ? buf.toString("base64") : node_buffer.Buffer.from(buf.buffer).toString("base64");
4347
4351
  } else if (typeof btoa === "function") {
4348
4352
  let s = "";
4349
4353
  for (let i = 0; i < buf.length; ++i)
4350
4354
  s += String.fromCharCode(buf[i]);
4351
- str = btoa(s);
4355
+ str3 = btoa(s);
4352
4356
  } else {
4353
4357
  throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
4354
4358
  }
4355
4359
  type ?? (type = Scalar.Scalar.BLOCK_LITERAL);
4356
4360
  if (type !== Scalar.Scalar.QUOTE_DOUBLE) {
4357
4361
  const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
4358
- const n = Math.ceil(str.length / lineWidth);
4362
+ const n = Math.ceil(str3.length / lineWidth);
4359
4363
  const lines = new Array(n);
4360
4364
  for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {
4361
- lines[i] = str.substr(o, lineWidth);
4365
+ lines[i] = str3.substr(o, lineWidth);
4362
4366
  }
4363
- str = lines.join(type === Scalar.Scalar.BLOCK_LITERAL ? "\n" : " ");
4367
+ str3 = lines.join(type === Scalar.Scalar.BLOCK_LITERAL ? "\n" : " ");
4364
4368
  }
4365
- return stringifyString.stringifyString({ comment, type, value: str }, ctx, onComment, onChompKeep);
4369
+ return stringifyString.stringifyString({ comment, type, value: str3 }, ctx, onComment, onChompKeep);
4366
4370
  }
4367
4371
  };
4368
4372
  exports.binary = binary;
@@ -4568,7 +4572,7 @@ var require_float2 = __commonJS({
4568
4572
  default: true,
4569
4573
  tag: "tag:yaml.org,2002:float",
4570
4574
  test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
4571
- resolve: (str) => str.slice(-3).toLowerCase() === "nan" ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
4575
+ resolve: (str3) => str3.slice(-3).toLowerCase() === "nan" ? NaN : str3[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
4572
4576
  stringify: stringifyNumber.stringifyNumber
4573
4577
  };
4574
4578
  var floatExp = {
@@ -4577,7 +4581,7 @@ var require_float2 = __commonJS({
4577
4581
  tag: "tag:yaml.org,2002:float",
4578
4582
  format: "EXP",
4579
4583
  test: /^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,
4580
- resolve: (str) => parseFloat(str.replace(/_/g, "")),
4584
+ resolve: (str3) => parseFloat(str3.replace(/_/g, "")),
4581
4585
  stringify(node) {
4582
4586
  const num = Number(node.value);
4583
4587
  return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);
@@ -4588,11 +4592,11 @@ var require_float2 = __commonJS({
4588
4592
  default: true,
4589
4593
  tag: "tag:yaml.org,2002:float",
4590
4594
  test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
4591
- resolve(str) {
4592
- const node = new Scalar.Scalar(parseFloat(str.replace(/_/g, "")));
4593
- const dot = str.indexOf(".");
4595
+ resolve(str3) {
4596
+ const node = new Scalar.Scalar(parseFloat(str3.replace(/_/g, "")));
4597
+ const dot = str3.indexOf(".");
4594
4598
  if (dot !== -1) {
4595
- const f = str.substring(dot + 1).replace(/_/g, "");
4599
+ const f = str3.substring(dot + 1).replace(/_/g, "");
4596
4600
  if (f[f.length - 1] === "0")
4597
4601
  node.minFractionDigits = f.length;
4598
4602
  }
@@ -4612,34 +4616,34 @@ var require_int2 = __commonJS({
4612
4616
  "use strict";
4613
4617
  var stringifyNumber = require_stringifyNumber();
4614
4618
  var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
4615
- function intResolve(str, offset, radix, { intAsBigInt }) {
4616
- const sign = str[0];
4619
+ function intResolve(str3, offset, radix, { intAsBigInt }) {
4620
+ const sign = str3[0];
4617
4621
  if (sign === "-" || sign === "+")
4618
4622
  offset += 1;
4619
- str = str.substring(offset).replace(/_/g, "");
4623
+ str3 = str3.substring(offset).replace(/_/g, "");
4620
4624
  if (intAsBigInt) {
4621
4625
  switch (radix) {
4622
4626
  case 2:
4623
- str = `0b${str}`;
4627
+ str3 = `0b${str3}`;
4624
4628
  break;
4625
4629
  case 8:
4626
- str = `0o${str}`;
4630
+ str3 = `0o${str3}`;
4627
4631
  break;
4628
4632
  case 16:
4629
- str = `0x${str}`;
4633
+ str3 = `0x${str3}`;
4630
4634
  break;
4631
4635
  }
4632
- const n2 = BigInt(str);
4636
+ const n2 = BigInt(str3);
4633
4637
  return sign === "-" ? BigInt(-1) * n2 : n2;
4634
4638
  }
4635
- const n = parseInt(str, radix);
4639
+ const n = parseInt(str3, radix);
4636
4640
  return sign === "-" ? -1 * n : n;
4637
4641
  }
4638
4642
  function intStringify(node, radix, prefix) {
4639
4643
  const { value } = node;
4640
4644
  if (intIdentify(value)) {
4641
- const str = value.toString(radix);
4642
- return value < 0 ? "-" + prefix + str.substr(1) : prefix + str;
4645
+ const str3 = value.toString(radix);
4646
+ return value < 0 ? "-" + prefix + str3.substr(1) : prefix + str3;
4643
4647
  }
4644
4648
  return stringifyNumber.stringifyNumber(node);
4645
4649
  }
@@ -4649,7 +4653,7 @@ var require_int2 = __commonJS({
4649
4653
  tag: "tag:yaml.org,2002:int",
4650
4654
  format: "BIN",
4651
4655
  test: /^[-+]?0b[0-1_]+$/,
4652
- resolve: (str, _onError, opt) => intResolve(str, 2, 2, opt),
4656
+ resolve: (str3, _onError, opt) => intResolve(str3, 2, 2, opt),
4653
4657
  stringify: (node) => intStringify(node, 2, "0b")
4654
4658
  };
4655
4659
  var intOct = {
@@ -4658,7 +4662,7 @@ var require_int2 = __commonJS({
4658
4662
  tag: "tag:yaml.org,2002:int",
4659
4663
  format: "OCT",
4660
4664
  test: /^[-+]?0[0-7_]+$/,
4661
- resolve: (str, _onError, opt) => intResolve(str, 1, 8, opt),
4665
+ resolve: (str3, _onError, opt) => intResolve(str3, 1, 8, opt),
4662
4666
  stringify: (node) => intStringify(node, 8, "0")
4663
4667
  };
4664
4668
  var int = {
@@ -4666,7 +4670,7 @@ var require_int2 = __commonJS({
4666
4670
  default: true,
4667
4671
  tag: "tag:yaml.org,2002:int",
4668
4672
  test: /^[-+]?[0-9][0-9_]*$/,
4669
- resolve: (str, _onError, opt) => intResolve(str, 0, 10, opt),
4673
+ resolve: (str3, _onError, opt) => intResolve(str3, 0, 10, opt),
4670
4674
  stringify: stringifyNumber.stringifyNumber
4671
4675
  };
4672
4676
  var intHex = {
@@ -4675,7 +4679,7 @@ var require_int2 = __commonJS({
4675
4679
  tag: "tag:yaml.org,2002:int",
4676
4680
  format: "HEX",
4677
4681
  test: /^[-+]?0x[0-9a-fA-F_]+$/,
4678
- resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),
4682
+ resolve: (str3, _onError, opt) => intResolve(str3, 2, 16, opt),
4679
4683
  stringify: (node) => intStringify(node, 16, "0x")
4680
4684
  };
4681
4685
  exports.int = int;
@@ -4779,9 +4783,9 @@ var require_timestamp = __commonJS({
4779
4783
  "node_modules/yaml/dist/schema/yaml-1.1/timestamp.js"(exports) {
4780
4784
  "use strict";
4781
4785
  var stringifyNumber = require_stringifyNumber();
4782
- function parseSexagesimal(str, asBigInt) {
4783
- const sign = str[0];
4784
- const parts = sign === "-" || sign === "+" ? str.substring(1) : str;
4786
+ function parseSexagesimal(str3, asBigInt) {
4787
+ const sign = str3[0];
4788
+ const parts = sign === "-" || sign === "+" ? str3.substring(1) : str3;
4785
4789
  const num = (n) => asBigInt ? BigInt(n) : Number(n);
4786
4790
  const res = parts.replace(/_/g, "").split(":").reduce((res2, p) => res2 * num(60) + num(p), num(0));
4787
4791
  return sign === "-" ? num(-1) * res : res;
@@ -4818,7 +4822,7 @@ var require_timestamp = __commonJS({
4818
4822
  tag: "tag:yaml.org,2002:int",
4819
4823
  format: "TIME",
4820
4824
  test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
4821
- resolve: (str, _onError, { intAsBigInt }) => parseSexagesimal(str, intAsBigInt),
4825
+ resolve: (str3, _onError, { intAsBigInt }) => parseSexagesimal(str3, intAsBigInt),
4822
4826
  stringify: stringifySexagesimal
4823
4827
  };
4824
4828
  var floatTime = {
@@ -4827,7 +4831,7 @@ var require_timestamp = __commonJS({
4827
4831
  tag: "tag:yaml.org,2002:float",
4828
4832
  format: "TIME",
4829
4833
  test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
4830
- resolve: (str) => parseSexagesimal(str, false),
4834
+ resolve: (str3) => parseSexagesimal(str3, false),
4831
4835
  stringify: stringifySexagesimal
4832
4836
  };
4833
4837
  var timestamp = {
@@ -4838,8 +4842,8 @@ var require_timestamp = __commonJS({
4838
4842
  // may be omitted altogether, resulting in a date format. In such a case, the time part is
4839
4843
  // assumed to be 00:00:00Z (start of day, UTC).
4840
4844
  test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
4841
- resolve(str) {
4842
- const match = str.match(timestamp.test);
4845
+ resolve(str3) {
4846
+ const match = str3.match(timestamp.test);
4843
4847
  if (!match)
4844
4848
  throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
4845
4849
  const [, year, month, day, hour, minute, second] = match.map(Number);
@@ -5190,9 +5194,9 @@ var require_Document = __commonJS({
5190
5194
  this.contents.add(value);
5191
5195
  }
5192
5196
  /** Adds a value to the document. */
5193
- addIn(path71, value) {
5197
+ addIn(path73, value) {
5194
5198
  if (assertCollection(this.contents))
5195
- this.contents.addIn(path71, value);
5199
+ this.contents.addIn(path73, value);
5196
5200
  }
5197
5201
  /**
5198
5202
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -5267,14 +5271,14 @@ var require_Document = __commonJS({
5267
5271
  * Removes a value from the document.
5268
5272
  * @returns `true` if the item was found and removed.
5269
5273
  */
5270
- deleteIn(path71) {
5271
- if (Collection.isEmptyPath(path71)) {
5274
+ deleteIn(path73) {
5275
+ if (Collection.isEmptyPath(path73)) {
5272
5276
  if (this.contents == null)
5273
5277
  return false;
5274
5278
  this.contents = null;
5275
5279
  return true;
5276
5280
  }
5277
- return assertCollection(this.contents) ? this.contents.deleteIn(path71) : false;
5281
+ return assertCollection(this.contents) ? this.contents.deleteIn(path73) : false;
5278
5282
  }
5279
5283
  /**
5280
5284
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -5289,10 +5293,10 @@ var require_Document = __commonJS({
5289
5293
  * scalar values from their surrounding node; to disable set `keepScalar` to
5290
5294
  * `true` (collections are always returned intact).
5291
5295
  */
5292
- getIn(path71, keepScalar) {
5293
- if (Collection.isEmptyPath(path71))
5296
+ getIn(path73, keepScalar) {
5297
+ if (Collection.isEmptyPath(path73))
5294
5298
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
5295
- return identity.isCollection(this.contents) ? this.contents.getIn(path71, keepScalar) : void 0;
5299
+ return identity.isCollection(this.contents) ? this.contents.getIn(path73, keepScalar) : void 0;
5296
5300
  }
5297
5301
  /**
5298
5302
  * Checks if the document includes a value with the key `key`.
@@ -5303,10 +5307,10 @@ var require_Document = __commonJS({
5303
5307
  /**
5304
5308
  * Checks if the document includes a value at `path`.
5305
5309
  */
5306
- hasIn(path71) {
5307
- if (Collection.isEmptyPath(path71))
5310
+ hasIn(path73) {
5311
+ if (Collection.isEmptyPath(path73))
5308
5312
  return this.contents !== void 0;
5309
- return identity.isCollection(this.contents) ? this.contents.hasIn(path71) : false;
5313
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path73) : false;
5310
5314
  }
5311
5315
  /**
5312
5316
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -5323,13 +5327,13 @@ var require_Document = __commonJS({
5323
5327
  * Sets a value in this document. For `!!set`, `value` needs to be a
5324
5328
  * boolean to add/remove the item from the set.
5325
5329
  */
5326
- setIn(path71, value) {
5327
- if (Collection.isEmptyPath(path71)) {
5330
+ setIn(path73, value) {
5331
+ if (Collection.isEmptyPath(path73)) {
5328
5332
  this.contents = value;
5329
5333
  } else if (this.contents == null) {
5330
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path71), value);
5334
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path73), value);
5331
5335
  } else if (assertCollection(this.contents)) {
5332
- this.contents.setIn(path71, value);
5336
+ this.contents.setIn(path73, value);
5333
5337
  }
5334
5338
  }
5335
5339
  /**
@@ -7289,9 +7293,9 @@ var require_cst_visit = __commonJS({
7289
7293
  visit.BREAK = BREAK;
7290
7294
  visit.SKIP = SKIP;
7291
7295
  visit.REMOVE = REMOVE;
7292
- visit.itemAtPath = (cst, path71) => {
7296
+ visit.itemAtPath = (cst, path73) => {
7293
7297
  let item = cst;
7294
- for (const [field, index] of path71) {
7298
+ for (const [field, index] of path73) {
7295
7299
  const tok = item?.[field];
7296
7300
  if (tok && "items" in tok) {
7297
7301
  item = tok.items[index];
@@ -7300,23 +7304,23 @@ var require_cst_visit = __commonJS({
7300
7304
  }
7301
7305
  return item;
7302
7306
  };
7303
- visit.parentCollection = (cst, path71) => {
7304
- const parent = visit.itemAtPath(cst, path71.slice(0, -1));
7305
- const field = path71[path71.length - 1][0];
7307
+ visit.parentCollection = (cst, path73) => {
7308
+ const parent = visit.itemAtPath(cst, path73.slice(0, -1));
7309
+ const field = path73[path73.length - 1][0];
7306
7310
  const coll = parent?.[field];
7307
7311
  if (coll && "items" in coll)
7308
7312
  return coll;
7309
7313
  throw new Error("Parent collection not found");
7310
7314
  };
7311
- function _visit(path71, item, visitor) {
7312
- let ctrl = visitor(item, path71);
7315
+ function _visit(path73, item, visitor) {
7316
+ let ctrl = visitor(item, path73);
7313
7317
  if (typeof ctrl === "symbol")
7314
7318
  return ctrl;
7315
7319
  for (const field of ["key", "value"]) {
7316
7320
  const token = item[field];
7317
7321
  if (token && "items" in token) {
7318
7322
  for (let i = 0; i < token.items.length; ++i) {
7319
- const ci = _visit(Object.freeze(path71.concat([[field, i]])), token.items[i], visitor);
7323
+ const ci = _visit(Object.freeze(path73.concat([[field, i]])), token.items[i], visitor);
7320
7324
  if (typeof ci === "number")
7321
7325
  i = ci - 1;
7322
7326
  else if (ci === BREAK)
@@ -7327,10 +7331,10 @@ var require_cst_visit = __commonJS({
7327
7331
  }
7328
7332
  }
7329
7333
  if (typeof ctrl === "function" && field === "key")
7330
- ctrl = ctrl(item, path71);
7334
+ ctrl = ctrl(item, path73);
7331
7335
  }
7332
7336
  }
7333
- return typeof ctrl === "function" ? ctrl(item, path71) : ctrl;
7337
+ return typeof ctrl === "function" ? ctrl(item, path73) : ctrl;
7334
7338
  }
7335
7339
  exports.visit = visit;
7336
7340
  }
@@ -8632,14 +8636,14 @@ var require_parser = __commonJS({
8632
8636
  case "scalar":
8633
8637
  case "single-quoted-scalar":
8634
8638
  case "double-quoted-scalar": {
8635
- const fs74 = this.flowScalar(this.type);
8639
+ const fs76 = this.flowScalar(this.type);
8636
8640
  if (atNextItem || it.value) {
8637
- map.items.push({ start, key: fs74, sep: [] });
8641
+ map.items.push({ start, key: fs76, sep: [] });
8638
8642
  this.onKeyLine = true;
8639
8643
  } else if (it.sep) {
8640
- this.stack.push(fs74);
8644
+ this.stack.push(fs76);
8641
8645
  } else {
8642
- Object.assign(it, { key: fs74, sep: [] });
8646
+ Object.assign(it, { key: fs76, sep: [] });
8643
8647
  this.onKeyLine = true;
8644
8648
  }
8645
8649
  return;
@@ -8767,13 +8771,13 @@ var require_parser = __commonJS({
8767
8771
  case "scalar":
8768
8772
  case "single-quoted-scalar":
8769
8773
  case "double-quoted-scalar": {
8770
- const fs74 = this.flowScalar(this.type);
8774
+ const fs76 = this.flowScalar(this.type);
8771
8775
  if (!it || it.value)
8772
- fc.items.push({ start: [], key: fs74, sep: [] });
8776
+ fc.items.push({ start: [], key: fs76, sep: [] });
8773
8777
  else if (it.sep)
8774
- this.stack.push(fs74);
8778
+ this.stack.push(fs76);
8775
8779
  else
8776
- Object.assign(it, { key: fs74, sep: [] });
8780
+ Object.assign(it, { key: fs76, sep: [] });
8777
8781
  return;
8778
8782
  }
8779
8783
  case "flow-map-end":
@@ -21543,9 +21547,19 @@ function main14(argv = null, options = {}) {
21543
21547
  return rc;
21544
21548
  }
21545
21549
  function _isCliEntry14() {
21550
+ const bundled = true;
21551
+ const cliDelegate = typeof __AGENT_CONFIG_CLI_DELEGATE__ !== "undefined" && __AGENT_CONFIG_CLI_DELEGATE__;
21552
+ if (bundled && !cliDelegate) {
21553
+ return false;
21554
+ }
21546
21555
  if (process14.argv[1] === void 0) {
21547
21556
  return false;
21548
21557
  }
21558
+ if (cliDelegate) {
21559
+ if (path29.basename(process14.argv[1], ".js") === "cmd_refresh") {
21560
+ return true;
21561
+ }
21562
+ }
21549
21563
  const argvUrl = pathToFileURL14(path29.resolve(process14.argv[1])).href;
21550
21564
  if (import.meta.url === argvUrl) {
21551
21565
  return true;
@@ -21631,8 +21645,8 @@ function lockfile_path(env) {
21631
21645
  }
21632
21646
  return write_target("installed.lock", { env: env ?? null });
21633
21647
  }
21634
- function read_lockfile(path71) {
21635
- const target = path71 ?? lockfile_path();
21648
+ function read_lockfile(path73) {
21649
+ const target = path73 ?? lockfile_path();
21636
21650
  let text;
21637
21651
  try {
21638
21652
  text = fs31.readFileSync(target, { encoding: "utf-8" });
@@ -21842,18 +21856,18 @@ function manifest_path(project_root, env) {
21842
21856
  }
21843
21857
  return fsPath.join(project_root, DEFAULT_MANIFEST_RELATIVE);
21844
21858
  }
21845
- function read_manifest(path71) {
21859
+ function read_manifest(path73) {
21846
21860
  let text;
21847
21861
  try {
21848
- text = require_read_text(path71);
21862
+ text = require_read_text(path73);
21849
21863
  } catch {
21850
21864
  return null;
21851
21865
  }
21852
21866
  const data = _parse_manual(text);
21853
21867
  return _normalise_v2_shape(data);
21854
21868
  }
21855
- function require_read_text(path71) {
21856
- return fs33.readFileSync(path71, { encoding: "utf-8" });
21869
+ function require_read_text(path73) {
21870
+ return fs33.readFileSync(path73, { encoding: "utf-8" });
21857
21871
  }
21858
21872
  function _normalise_v2_shape(data) {
21859
21873
  if (data["tools"] === void 0 || data["tools"] === null) {
@@ -22034,9 +22048,9 @@ function stable_sort(items, key) {
22034
22048
  return a.index - b.index;
22035
22049
  }).map((entry) => entry.item);
22036
22050
  }
22037
- function write_manifest(path71, version, tools, options = {}) {
22051
+ function write_manifest(path73, version, tools, options = {}) {
22038
22052
  const rendered = _render(version, tools, { deploy_roots: options.deploy_roots ?? null });
22039
- return write_atomic(path71, rendered);
22053
+ return write_atomic(path73, rendered);
22040
22054
  }
22041
22055
  function upsert_tool(existing, options) {
22042
22056
  const {
@@ -27832,7 +27846,11 @@ function _build_config(raw, source_path) {
27832
27846
  if (!_isBool(enabled)) {
27833
27847
  throw new CouncilConfigError("`enabled` must be a bool.");
27834
27848
  }
27835
- const defaults = _build_defaults(_asDict(_getOr(raw, "defaults", {})));
27849
+ const ignored_transport_keys = [];
27850
+ const defaults = _build_defaults(
27851
+ _asDict(_getOr(raw, "defaults", {})),
27852
+ ignored_transport_keys
27853
+ );
27836
27854
  const cost_budget = _build_cost_budget(
27837
27855
  _asDict(_getOr(raw, "cost_budget", {}))
27838
27856
  );
@@ -27844,7 +27862,12 @@ function _build_config(raw, source_path) {
27844
27862
  for (const [name, cfg] of Object.entries(members_raw)) {
27845
27863
  members.set(
27846
27864
  name,
27847
- _build_member(name, _asDict(_orEmpty(cfg)), defaults.mode)
27865
+ _build_member(
27866
+ name,
27867
+ _asDict(_orEmpty(cfg)),
27868
+ defaults.mode,
27869
+ ignored_transport_keys
27870
+ )
27848
27871
  );
27849
27872
  }
27850
27873
  const advisors_raw = _getOr(raw, "advisors", {});
@@ -27943,7 +27966,8 @@ function _build_config(raw, source_path) {
27943
27966
  routing,
27944
27967
  low_impact,
27945
27968
  lens_overrides,
27946
- source_path
27969
+ source_path,
27970
+ ignored_transport_keys
27947
27971
  };
27948
27972
  }
27949
27973
  function _orEmpty(value) {
@@ -28396,16 +28420,14 @@ function _build_consensus_scoring(d) {
28396
28420
  lenses: lenses_raw
28397
28421
  };
28398
28422
  }
28399
- function _build_defaults(d) {
28423
+ function _build_defaults(d, ignored = []) {
28400
28424
  if (!_isDict(d)) {
28401
28425
  throw new CouncilConfigError("`defaults` must be a mapping.");
28402
28426
  }
28403
- const mode = _get(d, "mode", "auto");
28404
- if (!(_isStr(mode) && _VALID_MODES.has(mode))) {
28405
- throw new CouncilConfigError(
28406
- `defaults.mode=${_pyRepr6(mode)} not in ${_sortedListRepr(_VALID_MODES)}.`
28407
- );
28427
+ if (_get(d, "mode", null) !== null) {
28428
+ ignored.push("defaults.mode");
28408
28429
  }
28430
+ const mode = "auto";
28409
28431
  const member_mode = _get(d, "member_mode", "cli");
28410
28432
  if (!(_isStr(member_mode) && _VALID_MEMBER_MODES.has(member_mode))) {
28411
28433
  throw new CouncilConfigError(
@@ -28561,7 +28583,7 @@ function _build_cost_budget(d) {
28561
28583
  }
28562
28584
  return cb;
28563
28585
  }
28564
- function _build_member(name, cfg, default_mode = "auto") {
28586
+ function _build_member(name, cfg, default_mode = "auto", ignored = []) {
28565
28587
  if (!_VALID_PROVIDERS.has(name)) {
28566
28588
  throw new CouncilConfigError(
28567
28589
  `members.${name}: unknown provider; valid: ${_sortedListRepr(_VALID_PROVIDERS)}.`
@@ -28572,14 +28594,11 @@ function _build_member(name, cfg, default_mode = "auto") {
28572
28594
  const model = _pyTruthy3(modelVal) ? modelVal : "";
28573
28595
  const api_key_ref_raw = _get(cfg, "api_key_ref", null);
28574
28596
  const api_key_ref = api_key_ref_raw === void 0 ? null : api_key_ref_raw;
28575
- const member_mode_raw = _get(cfg, "mode", null);
28576
- const member_mode = member_mode_raw === void 0 ? null : member_mode_raw;
28577
- if (member_mode !== null && !(_isStr(member_mode) && _VALID_MODES.has(member_mode))) {
28578
- throw new CouncilConfigError(
28579
- `members.${name}.mode=${_pyRepr6(member_mode)} not in ${_sortedListRepr(_VALID_MODES)}.`
28580
- );
28597
+ if (_get(cfg, "mode", null) !== null) {
28598
+ ignored.push(`members.${name}.mode`);
28581
28599
  }
28582
- const effective_mode = member_mode !== null ? member_mode : default_mode;
28600
+ const member_mode = null;
28601
+ const effective_mode = default_mode;
28583
28602
  const binary_raw = _get(cfg, "binary", null);
28584
28603
  const binary = binary_raw === void 0 ? null : binary_raw;
28585
28604
  if (binary !== null) {
@@ -28858,7 +28877,7 @@ function _pyTruthy3(value) {
28858
28877
  }
28859
28878
  return Object.keys(value).length > 0;
28860
28879
  }
28861
- var import_yaml5, _VALID_PROVIDERS, _VALID_MODES, _RAW_KEY_PREFIXES, CouncilConfigError, _Float, _VALID_NECESSITY_MODES, _VALID_DISCLOSURE_MODES, _VALID_CHAIRMAN_MODES, COUNCIL_CONFIG_RELNAME, COUNCIL_CONFIG_USER_GLOBAL_REL, COUNCIL_CONFIG_ENV, _VALID_CRITIC_PROTOCOLS, _VALID_RESOLUTION_MODES, _IMPACT_CLASSES, _LOCKED_IMPACT_CLASSES, _DEFAULT_RESOLUTION_MODES, _VALID_MEMBER_MODES, _VALID_DISPATCH_MODES, _DEFAULT_CLI_CALLS_PER_DAY;
28880
+ var import_yaml5, _VALID_PROVIDERS, _RAW_KEY_PREFIXES, CouncilConfigError, _Float, _VALID_NECESSITY_MODES, _VALID_DISCLOSURE_MODES, _VALID_CHAIRMAN_MODES, COUNCIL_CONFIG_RELNAME, COUNCIL_CONFIG_USER_GLOBAL_REL, COUNCIL_CONFIG_ENV, _VALID_CRITIC_PROTOCOLS, _VALID_RESOLUTION_MODES, _IMPACT_CLASSES, _LOCKED_IMPACT_CLASSES, _DEFAULT_RESOLUTION_MODES, _VALID_MEMBER_MODES, _VALID_DISPATCH_MODES, _DEFAULT_CLI_CALLS_PER_DAY;
28862
28881
  var init_config = __esm({
28863
28882
  "src/scripts/ai_council/config.ts"() {
28864
28883
  "use strict";
@@ -28872,7 +28891,6 @@ var init_config = __esm({
28872
28891
  "xai",
28873
28892
  "perplexity"
28874
28893
  ]);
28875
- _VALID_MODES = /* @__PURE__ */ new Set(["api", "manual", "cli", "auto"]);
28876
28894
  _RAW_KEY_PREFIXES = [
28877
28895
  "sk-",
28878
28896
  "sk-ant-",
@@ -29069,6 +29087,21 @@ function homeOf(env) {
29069
29087
  const injected = (map["HOME"] ?? "").trim();
29070
29088
  return injected !== "" ? injected : os9.homedir();
29071
29089
  }
29090
+ function defaultProbeKeychain(service) {
29091
+ if (process.platform !== "darwin") return false;
29092
+ try {
29093
+ const res = spawnSync8("security", ["find-generic-password", "-s", service], {
29094
+ timeout: VERSION_PROBE_TIMEOUT_MS,
29095
+ encoding: "utf-8",
29096
+ windowsHide: true,
29097
+ env: hardenedSpawnEnv()
29098
+ });
29099
+ if (res.error !== void 0 || res.signal !== null) return false;
29100
+ return res.status === 0;
29101
+ } catch {
29102
+ return false;
29103
+ }
29104
+ }
29072
29105
  function defaultProbeVersion(binary) {
29073
29106
  try {
29074
29107
  const res = spawnSync8(binary, ["--version"], {
@@ -29114,13 +29147,16 @@ function classifyCodexAuth(authPath) {
29114
29147
  if (hasOauth) return "cli-subscription";
29115
29148
  return "cli-api-key";
29116
29149
  }
29117
- function cliSubscriptionEvidence(provider, home, env, claudeConfigDir) {
29150
+ function cliSubscriptionEvidence(provider, home, env, claudeConfigDir, probeKeychain) {
29118
29151
  if (provider === "anthropic") {
29119
29152
  const configDir = claudeConfigDir;
29120
29153
  for (const rel of [".credentials.json", "credentials.json"]) {
29121
29154
  const p = path47.join(configDir, rel);
29122
29155
  if (isFile2(p)) return { source: "cli-subscription", evidence: p };
29123
29156
  }
29157
+ if (probeKeychain(CLAUDE_KEYCHAIN_SERVICE)) {
29158
+ return { source: "cli-subscription", evidence: `keychain:${CLAUDE_KEYCHAIN_SERVICE}` };
29159
+ }
29124
29160
  return null;
29125
29161
  }
29126
29162
  if (provider === "openai") {
@@ -29162,10 +29198,11 @@ function detectAuth(opts) {
29162
29198
  const env = opts.env ?? process.env;
29163
29199
  const home = opts.home ?? homeOf(opts.env);
29164
29200
  const claudeConfigDir = opts.home === void 0 && opts.env === void 0 ? claude_config_dir() : (env["CLAUDE_CONFIG_DIR"] ?? "").trim() || path47.join(home, ".claude");
29201
+ const probeKeychain = opts.probeKeychain ?? defaultProbeKeychain;
29165
29202
  const auth = [];
29166
29203
  const keys = [];
29167
29204
  for (const provider of knownProviders()) {
29168
- const cli = cliSubscriptionEvidence(provider, home, env, claudeConfigDir);
29205
+ const cli = cliSubscriptionEvidence(provider, home, env, claudeConfigDir, probeKeychain);
29169
29206
  if (cli !== null) {
29170
29207
  auth.push({ provider, source: cli.source, evidence: cli.evidence });
29171
29208
  }
@@ -29212,7 +29249,7 @@ function detectEnvironment(opts = {}) {
29212
29249
  if (isDefaultCall) _cached = report2;
29213
29250
  return report2;
29214
29251
  }
29215
- var PROVIDER_CLI_META, PROVIDER_ENV_KEY, PROVIDER_KEY_FILE, VERSION_PROBE_TIMEOUT_MS, _cached;
29252
+ var PROVIDER_CLI_META, PROVIDER_ENV_KEY, PROVIDER_KEY_FILE, VERSION_PROBE_TIMEOUT_MS, CLAUDE_KEYCHAIN_SERVICE, _cached;
29216
29253
  var init_environment_detector = __esm({
29217
29254
  "src/scripts/_lib/environment_detector.ts"() {
29218
29255
  "use strict";
@@ -29243,6 +29280,7 @@ var init_environment_detector = __esm({
29243
29280
  perplexity: "perplexity.key"
29244
29281
  };
29245
29282
  VERSION_PROBE_TIMEOUT_MS = 2e3;
29283
+ CLAUDE_KEYCHAIN_SERVICE = "Claude Code-credentials";
29246
29284
  _cached = null;
29247
29285
  }
29248
29286
  });
@@ -29362,11 +29400,11 @@ function cliBinary(report2, provider) {
29362
29400
  if (meta === void 0) return null;
29363
29401
  const binaryName = meta[0];
29364
29402
  const host = report2.hosts.find(
29365
- (h) => h.binary !== null && stripExeSuffix(basename12(h.binary)) === binaryName
29403
+ (h) => h.binary !== null && stripExeSuffix(basename13(h.binary)) === binaryName
29366
29404
  );
29367
29405
  return host?.binary ?? null;
29368
29406
  }
29369
- function basename12(p) {
29407
+ function basename13(p) {
29370
29408
  const parts = p.split(/[/\\]/);
29371
29409
  return parts[parts.length - 1] ?? p;
29372
29410
  }
@@ -30263,8 +30301,8 @@ function ruleFileArrives(sourcePath, scope) {
30263
30301
  if (!sourcePath.endsWith(".md")) {
30264
30302
  return true;
30265
30303
  }
30266
- const basename20 = path52.basename(sourcePath);
30267
- if (COMPAT_ALWAYS_EXCLUDED.includes(basename20)) {
30304
+ const basename21 = path52.basename(sourcePath);
30305
+ if (COMPAT_ALWAYS_EXCLUDED.includes(basename21)) {
30268
30306
  return false;
30269
30307
  }
30270
30308
  return rule_in_scope(sourcePath, scope.workspaces, scope.packs, scope.roles ?? null);
@@ -32892,9 +32930,19 @@ function main18(argv = null) {
32892
32930
  return drift_present ? 1 : 0;
32893
32931
  }
32894
32932
  function _isCliEntry16() {
32933
+ const bundled = true;
32934
+ const cliDelegate = typeof __AGENT_CONFIG_CLI_DELEGATE__ !== "undefined" && __AGENT_CONFIG_CLI_DELEGATE__;
32935
+ if (bundled && !cliDelegate) {
32936
+ return false;
32937
+ }
32895
32938
  if (process15.argv[1] === void 0) {
32896
32939
  return false;
32897
32940
  }
32941
+ if (cliDelegate) {
32942
+ if (path53.basename(process15.argv[1], ".js") === "cmd_doctor") {
32943
+ return true;
32944
+ }
32945
+ }
32898
32946
  const argvUrl = pathToFileURL18(path53.resolve(process15.argv[1])).href;
32899
32947
  if (import.meta.url === argvUrl) {
32900
32948
  return true;
@@ -33114,9 +33162,9 @@ function detectToolPresence(root) {
33114
33162
  agentsMd: existsSync25(join49(root, "AGENTS.md"))
33115
33163
  };
33116
33164
  }
33117
- function isDir3(path71) {
33165
+ function isDir3(path73) {
33118
33166
  try {
33119
- return statSync32(path71).isDirectory();
33167
+ return statSync32(path73).isDirectory();
33120
33168
  } catch {
33121
33169
  return false;
33122
33170
  }
@@ -34075,6 +34123,14 @@ function _empty_state() {
34075
34123
  verified_this_turn: false,
34076
34124
  ci_saw_pending: false,
34077
34125
  nonevidence_this_turn: 0,
34126
+ // Round 7 § Phase 1 — the last CI read, SESSION-scoped on purpose. Every
34127
+ // other counter here is turn-scoped because a stale POSITIVE would wrongly
34128
+ // vouch ("I verified"). This one is a NEGATIVE ("CI was not settled"), and a
34129
+ // stale negative only ever refuses more often — so surviving the turn
34130
+ // boundary preserves the freshness invariant rather than bypassing it. It
34131
+ // has to survive it: the measured failure is a completion claim in a LATER
34132
+ // turn than the poll it rests on.
34133
+ ci_last: null,
34078
34134
  checked_at: _now2()
34079
34135
  };
34080
34136
  }
@@ -34187,6 +34243,7 @@ function _update(state, event, envelope) {
34187
34243
  if (session_id && session_id !== state["session_id"]) {
34188
34244
  state["session_id"] = session_id;
34189
34245
  state["verifications_this_session"] = 0;
34246
+ state["ci_last"] = null;
34190
34247
  state = _reset_turn(state, session_id);
34191
34248
  }
34192
34249
  let payload = envelope["payload"];
@@ -34212,6 +34269,12 @@ function _update(state, event, envelope) {
34212
34269
  } else {
34213
34270
  counts = false;
34214
34271
  }
34272
+ state["ci_last"] = {
34273
+ at: _now2(),
34274
+ command: cmd.slice(0, 512),
34275
+ pending,
34276
+ settled: pending === 0 && counts === true
34277
+ };
34215
34278
  }
34216
34279
  state["last_verification"] = {
34217
34280
  command: cmd.slice(0, 512),
@@ -34369,12 +34432,785 @@ var init_before_complete_hook = __esm({
34369
34432
  }
34370
34433
  });
34371
34434
 
34372
- // src/scripts/hooks/evidence_independence.ts
34373
- import crypto7 from "node:crypto";
34374
- import fs57 from "node:fs";
34375
- import path58 from "node:path";
34435
+ // src/scripts/_lib/review_skipped_record.ts
34436
+ function isNonNegInt(n) {
34437
+ return typeof n === "number" && Number.isFinite(n) && Number.isInteger(n) && n >= 0;
34438
+ }
34439
+ function buildReviewSkippedLine(input) {
34440
+ const errors = [];
34441
+ if (!isNonNegInt(input.diff_lines)) {
34442
+ errors.push("diff_lines must be a non-negative integer");
34443
+ }
34444
+ if (input.mutation_measure !== "exact" && input.mutation_measure !== "capped_approximation") {
34445
+ errors.push('mutation_measure must be "exact" or "capped_approximation"');
34446
+ }
34447
+ if (!input.ts) errors.push("ts (ISO-8601 UTC) is required");
34448
+ if (!input.id) errors.push("id (ULID, UUID, or content hash) is required");
34449
+ if (errors.length) return { line: null, errors };
34450
+ const line = {
34451
+ schema_version: 1,
34452
+ id: input.id,
34453
+ ts: input.ts,
34454
+ work_id: input.work_id ?? `review-skipped-${input.ts}`,
34455
+ phase: "report",
34456
+ outcome: "skipped",
34457
+ confidence_band: "medium",
34458
+ risk_class: input.diff_lines >= HIGH_RISK_DIFF_LINES ? "high" : "medium",
34459
+ memory: { asks: 0, hits: 0 },
34460
+ verify: { claims: 0, first_try_passes: 0 },
34461
+ rules_applied: ["delegation-policy"],
34462
+ persona: null,
34463
+ input_kind: "prompt",
34464
+ type: "note",
34465
+ review_skipped: { diff_lines: input.diff_lines, mutation_measure: input.mutation_measure }
34466
+ };
34467
+ return { line, errors: [] };
34468
+ }
34469
+ var HIGH_RISK_DIFF_LINES;
34470
+ var init_review_skipped_record = __esm({
34471
+ "src/scripts/_lib/review_skipped_record.ts"() {
34472
+ "use strict";
34473
+ HIGH_RISK_DIFF_LINES = 200;
34474
+ }
34475
+ });
34476
+
34477
+ // src/scripts/hooks/envelope.ts
34478
+ function _isObject5(obj) {
34479
+ return typeof obj === "object" && obj !== null && !Array.isArray(obj);
34480
+ }
34481
+ function looks_like_envelope(obj) {
34482
+ if (!_isObject5(obj)) {
34483
+ return false;
34484
+ }
34485
+ return ENVELOPE_KEYS.every((key) => key in obj);
34486
+ }
34487
+ function unwrap(stdin_text, default_platform = "generic") {
34488
+ const text = (stdin_text ?? "").trim();
34489
+ if (!text) {
34490
+ return [{}, {}, default_platform];
34491
+ }
34492
+ let decoded;
34493
+ try {
34494
+ decoded = JSON.parse(text);
34495
+ } catch {
34496
+ return [{}, {}, default_platform];
34497
+ }
34498
+ if (looks_like_envelope(decoded)) {
34499
+ const env = decoded;
34500
+ let payload2 = env["payload"];
34501
+ if (!payload2 || !_isObject5(payload2)) {
34502
+ payload2 = {};
34503
+ }
34504
+ const platRaw = env["platform"];
34505
+ const platform = String(platRaw || default_platform);
34506
+ return [env, payload2, platform];
34507
+ }
34508
+ const payload = _isObject5(decoded) ? decoded : {};
34509
+ return [
34510
+ {
34511
+ schema_version: 1,
34512
+ platform: default_platform,
34513
+ event: "",
34514
+ native_event: "",
34515
+ session_id: "",
34516
+ workspace_root: "",
34517
+ payload,
34518
+ settings: {}
34519
+ },
34520
+ payload,
34521
+ default_platform
34522
+ ];
34523
+ }
34524
+ var ENVELOPE_KEYS;
34525
+ var init_envelope = __esm({
34526
+ "src/scripts/hooks/envelope.ts"() {
34527
+ "use strict";
34528
+ ENVELOPE_KEYS = [
34529
+ "schema_version",
34530
+ "platform",
34531
+ "event",
34532
+ "payload"
34533
+ ];
34534
+ }
34535
+ });
34536
+
34537
+ // src/scripts/hooks/end_review_nudge_hook.ts
34538
+ import { spawnSync as spawnSync9 } from "node:child_process";
34539
+ import * as crypto7 from "node:crypto";
34540
+ import * as fs57 from "node:fs";
34541
+ import * as os12 from "node:os";
34542
+ import * as path58 from "node:path";
34376
34543
  import { fileURLToPath as fileURLToPath34, pathToFileURL as pathToFileURL23 } from "node:url";
34377
- function _isObject5(v) {
34544
+ function isSafeTranscriptPath(rawPath, opts = {}) {
34545
+ if (!rawPath || !/\.jsonl$/i.test(rawPath)) return false;
34546
+ const homeDir = opts.homeDir ?? os12.homedir();
34547
+ const maxBytes = opts.maxBytes ?? TRANSCRIPT_SCAN_MAX_BYTES;
34548
+ try {
34549
+ const realHome = fs57.realpathSync(homeDir);
34550
+ const realPath = fs57.realpathSync(rawPath);
34551
+ const relative16 = path58.relative(realHome, realPath);
34552
+ if (relative16 === "" || relative16.startsWith("..") || path58.isAbsolute(relative16)) {
34553
+ return false;
34554
+ }
34555
+ const { size } = fs57.statSync(realPath);
34556
+ return size <= maxBytes;
34557
+ } catch {
34558
+ return false;
34559
+ }
34560
+ }
34561
+ function parseNumstat(raw) {
34562
+ const rows = [];
34563
+ for (const line of raw.split("\n")) {
34564
+ const m = /^(\d+|-)\t(\d+|-)\t(.+)$/.exec(line);
34565
+ if (!m) continue;
34566
+ const addedStr = m[1];
34567
+ const deletedStr = m[2];
34568
+ rows.push({
34569
+ added: addedStr === "-" ? 0 : Number(addedStr),
34570
+ deleted: deletedStr === "-" ? 0 : Number(deletedStr),
34571
+ path: m[3]
34572
+ });
34573
+ }
34574
+ return rows;
34575
+ }
34576
+ function isDocPath(p) {
34577
+ return DOC_PATH_RE.test(p);
34578
+ }
34579
+ function nonDocMutatedLines(rows) {
34580
+ return rows.filter((r) => !isDocPath(r.path)).reduce((sum, r) => sum + r.added + r.deleted, 0);
34581
+ }
34582
+ function gitNumstatRows(cwd) {
34583
+ try {
34584
+ const r = spawnSync9("git", ["diff", "--numstat", "HEAD"], {
34585
+ cwd,
34586
+ encoding: "utf8",
34587
+ maxBuffer: 16 * 1024 * 1024
34588
+ });
34589
+ if (r.status !== 0) return [];
34590
+ return parseNumstat(r.stdout ?? "");
34591
+ } catch {
34592
+ return [];
34593
+ }
34594
+ }
34595
+ function untrackedNonDocFiles(cwd) {
34596
+ try {
34597
+ const r = spawnSync9("git", ["ls-files", "--others", "--exclude-standard"], {
34598
+ cwd,
34599
+ encoding: "utf8",
34600
+ maxBuffer: 16 * 1024 * 1024
34601
+ });
34602
+ if (r.status !== 0) return [];
34603
+ return (r.stdout ?? "").split("\n").map((l) => l.trim()).filter((l) => l.length > 0 && !isDocPath(l));
34604
+ } catch {
34605
+ return [];
34606
+ }
34607
+ }
34608
+ function untrackedFileLineCount(cwd, relPath) {
34609
+ try {
34610
+ const r = spawnSync9("git", ["diff", "--numstat", "--no-index", "/dev/null", relPath], {
34611
+ cwd,
34612
+ encoding: "utf8",
34613
+ maxBuffer: 16 * 1024 * 1024
34614
+ });
34615
+ return parseNumstat(r.stdout ?? "").reduce((sum, row) => sum + row.added + row.deleted, 0);
34616
+ } catch {
34617
+ return 0;
34618
+ }
34619
+ }
34620
+ function totalNonDocMutatedLinesWithMeasure(cwd) {
34621
+ const trackedLines = nonDocMutatedLines(gitNumstatRows(cwd));
34622
+ const untracked = untrackedNonDocFiles(cwd);
34623
+ if (untracked.length > UNTRACKED_FILE_CAP) {
34624
+ return { lines: MUTATION_LINE_THRESHOLD + 1 + trackedLines, measure: "capped_approximation" };
34625
+ }
34626
+ const untrackedLines = untracked.reduce(
34627
+ (sum, relPath) => sum + untrackedFileLineCount(cwd, relPath),
34628
+ 0
34629
+ );
34630
+ return { lines: trackedLines + untrackedLines, measure: "exact" };
34631
+ }
34632
+ function isObject(v) {
34633
+ return typeof v === "object" && v !== null && !Array.isArray(v);
34634
+ }
34635
+ function str(v) {
34636
+ return typeof v === "string" ? v : "";
34637
+ }
34638
+ function scanTranscriptForReviewer(transcriptText) {
34639
+ for (const raw of transcriptText.split("\n")) {
34640
+ const line = raw.trim();
34641
+ if (!line) continue;
34642
+ let obj;
34643
+ try {
34644
+ obj = JSON.parse(line);
34645
+ } catch {
34646
+ continue;
34647
+ }
34648
+ if (!isObject(obj) || obj["type"] !== "assistant") continue;
34649
+ const msg = obj["message"];
34650
+ if (!isObject(msg)) continue;
34651
+ const content = msg["content"];
34652
+ if (!Array.isArray(content)) continue;
34653
+ for (const blk of content) {
34654
+ if (!isObject(blk) || blk["type"] !== "tool_use") continue;
34655
+ const name = str(blk["name"]);
34656
+ const input = blk["input"];
34657
+ const inputObj = isObject(input) ? input : {};
34658
+ if (DISPATCH_TOOL_RE.test(name)) {
34659
+ const label = [
34660
+ str(inputObj["description"]),
34661
+ str(inputObj["subagent_type"])
34662
+ ].filter(Boolean).join(" ");
34663
+ if (REVIEW_SHAPED_LABEL_RE.test(label)) return true;
34664
+ const prompt = str(inputObj["prompt"]);
34665
+ if (REVIEW_SHAPED_PROMPT_RE.test(prompt)) return true;
34666
+ continue;
34667
+ }
34668
+ if (/^skill$/i.test(name)) {
34669
+ const skillName = str(inputObj["skill"]) || str(inputObj["name"]) || str(inputObj["command"]);
34670
+ if (REVIEW_SKILL_NAME_RE.test(skillName)) return true;
34671
+ continue;
34672
+ }
34673
+ if (REVIEW_SKILL_NAME_RE.test(name)) return true;
34674
+ }
34675
+ }
34676
+ return false;
34677
+ }
34678
+ function buildAdvisoryLine(diffLines) {
34679
+ return `this session mutated ${diffLines} lines without a neutral review; spawn a cross-model reviewer before claiming done (delegation-policy / verify-budget)`;
34680
+ }
34681
+ function appendReviewSkippedTelemetry(workspaceRoot, diffLines, mutationMeasure) {
34682
+ if (is_replay_mode()) return;
34683
+ const ts = (/* @__PURE__ */ new Date()).toISOString();
34684
+ const { line, errors } = buildReviewSkippedLine({
34685
+ diff_lines: diffLines,
34686
+ mutation_measure: mutationMeasure,
34687
+ ts,
34688
+ id: crypto7.randomUUID()
34689
+ });
34690
+ if (errors.length || line === null) return;
34691
+ try {
34692
+ const dir = path58.join(workspaceRoot, "agents", "runtime", "state", "audit");
34693
+ fs57.mkdirSync(dir, { recursive: true });
34694
+ const file = path58.join(dir, `${ts.slice(0, 7)}.jsonl`);
34695
+ fs57.appendFileSync(file, `${JSON.stringify(line)}
34696
+ `, "utf8");
34697
+ } catch {
34698
+ }
34699
+ }
34700
+ function sessionStateDir(workspaceRoot) {
34701
+ return path58.join(workspaceRoot, "agents", "runtime", "state", "end-review-nudge");
34702
+ }
34703
+ function sessionStateFile(workspaceRoot, sessionKey) {
34704
+ return path58.join(sessionStateDir(workspaceRoot), `${sessionKey}.json`);
34705
+ }
34706
+ function deriveSessionKey(envelope, payload) {
34707
+ const raw = str(envelope["session_id"]) || str(payload["transcript_path"] ?? payload["transcriptPath"]);
34708
+ const material = raw || "unknown-session";
34709
+ return crypto7.createHash("sha256").update(material).digest("hex");
34710
+ }
34711
+ function hasFiredThisSession(workspaceRoot, sessionKey) {
34712
+ try {
34713
+ return fs57.existsSync(sessionStateFile(workspaceRoot, sessionKey));
34714
+ } catch {
34715
+ return false;
34716
+ }
34717
+ }
34718
+ function markFiredThisSession(workspaceRoot, sessionKey, ts) {
34719
+ try {
34720
+ atomic_write_json(sessionStateFile(workspaceRoot, sessionKey), { fired_at: ts });
34721
+ } catch {
34722
+ }
34723
+ }
34724
+ function _read_stdin() {
34725
+ return readHookStdin();
34726
+ }
34727
+ function main23() {
34728
+ const [envelope, payload] = unwrap(_read_stdin(), "claude");
34729
+ const event = String(envelope["event"] ?? "");
34730
+ if (event !== "" && event !== "stop") {
34731
+ return 0;
34732
+ }
34733
+ const workspace_root = String(envelope["workspace_root"] ?? "").trim() || process.cwd();
34734
+ let diffLines;
34735
+ let mutationMeasure;
34736
+ try {
34737
+ const measured = totalNonDocMutatedLinesWithMeasure(workspace_root);
34738
+ diffLines = measured.lines;
34739
+ mutationMeasure = measured.measure;
34740
+ } catch {
34741
+ return 0;
34742
+ }
34743
+ if (diffLines <= MUTATION_LINE_THRESHOLD) {
34744
+ return 0;
34745
+ }
34746
+ const sessionKey = deriveSessionKey(envelope, payload);
34747
+ if (hasFiredThisSession(workspace_root, sessionKey)) {
34748
+ return 0;
34749
+ }
34750
+ const transcriptPath = str(
34751
+ payload["transcript_path"] ?? payload["transcriptPath"]
34752
+ ).trim();
34753
+ let reviewerRan = false;
34754
+ if (transcriptPath && isSafeTranscriptPath(transcriptPath)) {
34755
+ try {
34756
+ reviewerRan = scanTranscriptForReviewer(fs57.readFileSync(transcriptPath, "utf-8"));
34757
+ } catch {
34758
+ reviewerRan = false;
34759
+ }
34760
+ }
34761
+ if (reviewerRan) {
34762
+ return 0;
34763
+ }
34764
+ markFiredThisSession(workspace_root, sessionKey, (/* @__PURE__ */ new Date()).toISOString());
34765
+ try {
34766
+ appendReviewSkippedTelemetry(workspace_root, diffLines, mutationMeasure);
34767
+ } catch {
34768
+ }
34769
+ process.stdout.write(
34770
+ `${JSON.stringify({
34771
+ decision: "warn",
34772
+ reason: `end-review-nudge: session mutated ${diffLines} non-doc lines without a neutral review`,
34773
+ additional_context: buildAdvisoryLine(diffLines)
34774
+ })}
34775
+ `
34776
+ );
34777
+ return EXIT_WARN2;
34778
+ }
34779
+ function _isCliEntry21() {
34780
+ if (true) {
34781
+ return false;
34782
+ }
34783
+ if (process.argv[1] === void 0) {
34784
+ return false;
34785
+ }
34786
+ const argvUrl = pathToFileURL23(path58.resolve(process.argv[1])).href;
34787
+ if (import.meta.url === argvUrl) {
34788
+ return true;
34789
+ }
34790
+ try {
34791
+ const here = fs57.realpathSync(fileURLToPath34(import.meta.url));
34792
+ const argv = fs57.realpathSync(path58.resolve(process.argv[1]));
34793
+ return here === argv;
34794
+ } catch {
34795
+ return false;
34796
+ }
34797
+ }
34798
+ var MUTATION_LINE_THRESHOLD, UNTRACKED_FILE_CAP, TRANSCRIPT_SCAN_MAX_BYTES, EXIT_WARN2, DOC_PATH_RE, DISPATCH_TOOL_RE, REVIEW_SHAPED_LABEL_RE, REVIEW_SHAPED_PROMPT_RE, REVIEW_SKILL_NAME_RE;
34799
+ var init_end_review_nudge_hook = __esm({
34800
+ "src/scripts/hooks/end_review_nudge_hook.ts"() {
34801
+ "use strict";
34802
+ init_review_skipped_record();
34803
+ init_envelope();
34804
+ init_hook_stdin();
34805
+ init_state_io();
34806
+ MUTATION_LINE_THRESHOLD = 50;
34807
+ UNTRACKED_FILE_CAP = 20;
34808
+ TRANSCRIPT_SCAN_MAX_BYTES = 50 * 1024 * 1024;
34809
+ EXIT_WARN2 = 2;
34810
+ DOC_PATH_RE = /\.md$/i;
34811
+ DISPATCH_TOOL_RE = /^(agent|task)$/i;
34812
+ REVIEW_SHAPED_LABEL_RE = /\b(review|judge|adversarial|critique|second[- ]opinion|blind\s+(pass|review)|cross-model)\b/i;
34813
+ REVIEW_SHAPED_PROMPT_RE = /\b(code\s+review|neutral\s+review|adversarial|judge|critique|second[- ]opinion|blind\s+(pass|review)|cross-model)\b/i;
34814
+ REVIEW_SKILL_NAME_RE = /^(review[-:]changes|judge[-:][a-z0-9-]+|adversarial-review|code-review)$/i;
34815
+ if (_isCliEntry21()) {
34816
+ process.exit(main23());
34817
+ }
34818
+ }
34819
+ });
34820
+
34821
+ // src/scripts/hooks/turn_end_gate_hook.ts
34822
+ import * as crypto8 from "node:crypto";
34823
+ import * as fs58 from "node:fs";
34824
+ import * as path59 from "node:path";
34825
+ import { fileURLToPath as fileURLToPath35, pathToFileURL as pathToFileURL24 } from "node:url";
34826
+ function stripFencedBlocks(text) {
34827
+ const out = [];
34828
+ let open = null;
34829
+ for (const line of text.split("\n")) {
34830
+ const m = /^[ \t]{0,3}([`~]{3,})(.*)$/.exec(line);
34831
+ if (open === null) {
34832
+ if (m) {
34833
+ open = { ch: m[1][0], len: m[1].length };
34834
+ out.push(" ");
34835
+ continue;
34836
+ }
34837
+ out.push(line);
34838
+ continue;
34839
+ }
34840
+ if (m && m[1][0] === open.ch && m[1].length >= open.len && (m[2] ?? "").trim() === "") {
34841
+ open = null;
34842
+ }
34843
+ }
34844
+ return out.join("\n");
34845
+ }
34846
+ function visibleProse(reply) {
34847
+ let text = stripFencedBlocks(reply);
34848
+ text = text.replace(/`[^`\n]*`/g, " ");
34849
+ text = text.replace(/^[ \t]*>.*$/gm, " ");
34850
+ text = text.replace(/^[ \t]*\|.*\|[ \t]*$/gm, " ");
34851
+ text = text.replace(/\bhttps?:\/\/\S+/g, " ");
34852
+ text = text.replace(/\S*\/\S+/g, " ");
34853
+ text = text.replace(/\b[\w.-]+\.(ts|js|md|json|ya?ml|py|php|txt|sh)\b/g, " ");
34854
+ return text;
34855
+ }
34856
+ function finalParagraph(reply) {
34857
+ const prose = visibleProse(reply).trim();
34858
+ if (!prose) return "";
34859
+ const paragraphs = prose.split(/\n\s*\n/).map((p) => p.trim()).filter((p) => p.length > 0);
34860
+ return paragraphs.length === 0 ? "" : paragraphs[paragraphs.length - 1];
34861
+ }
34862
+ function detectPromissory(reply) {
34863
+ const tail = finalParagraph(reply);
34864
+ if (!tail) return null;
34865
+ if (/\?["'’)\]]*\s*$/.test(tail)) return null;
34866
+ if (HANDBACK.some((re) => re.test(tail))) return null;
34867
+ for (const re of PROMISSORY) {
34868
+ const m = tail.match(re);
34869
+ if (m) {
34870
+ return {
34871
+ detector: "promissory",
34872
+ evidence: m[0],
34873
+ reason: "the closing paragraph promises work that has not been performed, and the turn asks the user nothing \u2014 so nothing ends this turn but the promise itself"
34874
+ };
34875
+ }
34876
+ }
34877
+ return null;
34878
+ }
34879
+ function readCiSettled(workspaceRoot) {
34880
+ try {
34881
+ const raw = fs58.readFileSync(path59.join(workspaceRoot, STATE_FILE3), "utf-8");
34882
+ const decoded = JSON.parse(raw);
34883
+ if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
34884
+ const ci = decoded["ci_last"];
34885
+ if (typeof ci === "object" && ci !== null && !Array.isArray(ci)) {
34886
+ return { seen: true, settled: ci["settled"] === true };
34887
+ }
34888
+ }
34889
+ } catch {
34890
+ }
34891
+ return { seen: false, settled: false };
34892
+ }
34893
+ function detectCompletionClaim(reply, ci) {
34894
+ if (!ci.seen || ci.settled) return null;
34895
+ const prose = visibleProse(reply);
34896
+ const m = _COMPLETION_RE.exec(prose);
34897
+ if (!m) return null;
34898
+ const at = m.index;
34899
+ return {
34900
+ detector: "completion",
34901
+ evidence: prose.slice(at, at + 120).trim(),
34902
+ reason: "a completion claim while the last CI read was not settled \u2014 read the verdict, then claim it (verify-before-complete)"
34903
+ };
34904
+ }
34905
+ function readLanguagePin(workspaceRoot) {
34906
+ try {
34907
+ const raw = fs58.readFileSync(path59.join(workspaceRoot, STATE_FILE), "utf-8");
34908
+ const decoded = JSON.parse(raw);
34909
+ if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
34910
+ const lang = decoded["language"];
34911
+ if (lang === "de" || lang === "en") return lang;
34912
+ }
34913
+ } catch {
34914
+ }
34915
+ return "und";
34916
+ }
34917
+ function detectLanguage(reply, pinned) {
34918
+ if (pinned !== "de" && pinned !== "en") return null;
34919
+ const prose = visibleProse(reply);
34920
+ const verdict = classify(prose);
34921
+ if (verdict.language === "und") return null;
34922
+ if (verdict.language === pinned) return null;
34923
+ return {
34924
+ detector: "language",
34925
+ evidence: prose.trim().slice(0, 120),
34926
+ reason: `the pinned reply language is "${pinned}" but the reply classifies as "${verdict.language}" (${verdict.de_markers} de / ${verdict.en_markers} en markers; code, quotes, tables, URLs and paths excluded, then scored lead-first by the same classifier that sets the pin)`
34927
+ };
34928
+ }
34929
+ function isVerificationCommand(command) {
34930
+ return _VERIFY_RE.test(command);
34931
+ }
34932
+ function detectUnverifiedEdit(toolCalls) {
34933
+ let lastEdit = -1;
34934
+ for (let i = 0; i < toolCalls.length; i += 1) {
34935
+ if (_EDIT_TOOLS.has(toolCalls[i].name)) lastEdit = i;
34936
+ }
34937
+ if (lastEdit === -1) return null;
34938
+ for (let i = lastEdit + 1; i < toolCalls.length; i += 1) {
34939
+ const c = toolCalls[i];
34940
+ if (c.name === "Bash" && c.command !== void 0 && isVerificationCommand(c.command)) {
34941
+ return null;
34942
+ }
34943
+ }
34944
+ const edited = toolCalls[lastEdit].path;
34945
+ return {
34946
+ detector: "verification",
34947
+ // The path, never the diff: the evidence span is quoted into a refusal,
34948
+ // and `ToolCall` is shaped so a file body cannot reach it.
34949
+ evidence: edited ?? toolCalls[lastEdit].name,
34950
+ reason: "this turn changed a file and then ran no verification command \u2014 no test, type-check, lint or build call follows the last edit (verify-before-complete: a claim without a fresh run is unverified)"
34951
+ };
34952
+ }
34953
+ function stateDir(workspaceRoot) {
34954
+ return path59.join(workspaceRoot, "agents", "runtime", "state", "turn-end-gate");
34955
+ }
34956
+ function sessionStateFile2(workspaceRoot, sessionKey) {
34957
+ return path59.join(stateDir(workspaceRoot), `${sessionKey}.json`);
34958
+ }
34959
+ function deriveSessionKey2(sessionId) {
34960
+ return crypto8.createHash("sha256").update(sessionId).digest("hex").slice(0, 32);
34961
+ }
34962
+ function alreadyRefusedTurn(workspaceRoot, sessionKey, turnOrdinal) {
34963
+ try {
34964
+ const raw = fs58.readFileSync(sessionStateFile2(workspaceRoot, sessionKey), "utf-8");
34965
+ const decoded = JSON.parse(raw);
34966
+ if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
34967
+ return decoded["refused_turn"] === turnOrdinal;
34968
+ }
34969
+ } catch {
34970
+ }
34971
+ return false;
34972
+ }
34973
+ function markRefusedTurn(workspaceRoot, sessionKey, turnOrdinal, detector) {
34974
+ if (is_replay_mode()) return;
34975
+ try {
34976
+ atomic_write_json(sessionStateFile2(workspaceRoot, sessionKey), {
34977
+ refused_at: (/* @__PURE__ */ new Date()).toISOString(),
34978
+ refused_turn: turnOrdinal,
34979
+ detector
34980
+ });
34981
+ } catch {
34982
+ }
34983
+ }
34984
+ function readTranscriptTail(transcriptPath, opts = {}) {
34985
+ const empty = { lastAssistant: "", turnOrdinal: 0, toolCalls: [] };
34986
+ if (!transcriptPath || !isSafeTranscriptPath(transcriptPath, opts)) return empty;
34987
+ let lines;
34988
+ try {
34989
+ if (opts.maxBytes !== void 0 && fs58.statSync(transcriptPath).size > opts.maxBytes) {
34990
+ return empty;
34991
+ }
34992
+ lines = fs58.readFileSync(transcriptPath, "utf-8").split("\n");
34993
+ } catch {
34994
+ return empty;
34995
+ }
34996
+ let lastAssistant = "";
34997
+ let turnOrdinal = 0;
34998
+ let toolCalls = [];
34999
+ for (const rawLine of lines) {
35000
+ const line = rawLine.trim();
35001
+ if (!line) continue;
35002
+ let obj;
35003
+ try {
35004
+ obj = JSON.parse(line);
35005
+ } catch {
35006
+ continue;
35007
+ }
35008
+ if (typeof obj !== "object" || obj === null || Array.isArray(obj)) continue;
35009
+ const entry = obj;
35010
+ if (entry["isSidechain"] === true) continue;
35011
+ const role = entry["type"];
35012
+ if (role !== "assistant" && role !== "user") continue;
35013
+ const msg = entry["message"];
35014
+ if (typeof msg !== "object" || msg === null || Array.isArray(msg)) continue;
35015
+ const content = msg["content"];
35016
+ if (role === "assistant") {
35017
+ toolCalls.push(..._toolCalls(content));
35018
+ }
35019
+ const text = _messageText(content);
35020
+ if (text === null) continue;
35021
+ if (role === "assistant") {
35022
+ lastAssistant = text;
35023
+ } else if (!isSyntheticPrompt(text)) {
35024
+ turnOrdinal += 1;
35025
+ toolCalls = [];
35026
+ }
35027
+ }
35028
+ return { lastAssistant: lastAssistant.trim(), turnOrdinal, toolCalls };
35029
+ }
35030
+ function _toolCalls(content) {
35031
+ if (!Array.isArray(content)) return [];
35032
+ const out = [];
35033
+ for (const blk of content) {
35034
+ if (typeof blk !== "object" || blk === null || Array.isArray(blk)) continue;
35035
+ const b = blk;
35036
+ if (b["type"] !== "tool_use") continue;
35037
+ const name = b["name"];
35038
+ if (typeof name !== "string") continue;
35039
+ const input = b["input"];
35040
+ const call = { name };
35041
+ if (typeof input === "object" && input !== null && !Array.isArray(input)) {
35042
+ const inp = input;
35043
+ const cmd = inp["command"];
35044
+ if (typeof cmd === "string") call.command = cmd;
35045
+ const p = inp["file_path"] ?? inp["path"] ?? inp["notebook_path"];
35046
+ if (typeof p === "string") call.path = p;
35047
+ }
35048
+ out.push(call);
35049
+ }
35050
+ return out;
35051
+ }
35052
+ function _messageText(content) {
35053
+ if (typeof content === "string") return content;
35054
+ if (!Array.isArray(content)) return null;
35055
+ const parts = [];
35056
+ for (const blk of content) {
35057
+ if (typeof blk !== "object" || blk === null || Array.isArray(blk)) continue;
35058
+ const b = blk;
35059
+ if (b["type"] !== "text") continue;
35060
+ const t = b["text"];
35061
+ if (typeof t === "string") parts.push(t);
35062
+ }
35063
+ return parts.length > 0 ? parts.join("\n") : null;
35064
+ }
35065
+ function str2(v) {
35066
+ return typeof v === "string" ? v : "";
35067
+ }
35068
+ function main24() {
35069
+ let envelope;
35070
+ let payload;
35071
+ try {
35072
+ [envelope, payload] = unwrap(readHookStdin(), "claude");
35073
+ } catch {
35074
+ return EXIT_ALLOW4;
35075
+ }
35076
+ if (payload["stop_hook_active"] === true) return EXIT_ALLOW4;
35077
+ const workspaceRoot = str2(envelope["workspace_root"]) || process.cwd();
35078
+ const transcriptPath = str2(
35079
+ payload["transcript_path"] ?? payload["transcriptPath"]
35080
+ );
35081
+ const { lastAssistant, turnOrdinal, toolCalls } = readTranscriptTail(transcriptPath, {
35082
+ maxBytes: TRANSCRIPT_READ_MAX_BYTES
35083
+ });
35084
+ if (!lastAssistant) return EXIT_ALLOW4;
35085
+ const sessionKey = deriveSessionKey2(
35086
+ str2(envelope["session_id"]) || "unknown-session"
35087
+ );
35088
+ if (alreadyRefusedTurn(workspaceRoot, sessionKey, turnOrdinal)) return EXIT_ALLOW4;
35089
+ const findings = [];
35090
+ for (const f of [
35091
+ detectPromissory(lastAssistant),
35092
+ detectLanguage(lastAssistant, readLanguagePin(workspaceRoot)),
35093
+ detectUnverifiedEdit(toolCalls),
35094
+ // Round 7 § Phase 1 — detector D, in the same unconditional list as the
35095
+ // other three. It shipped with its own settings flag one commit earlier
35096
+ // and that flag is gone: `hooks.turn_end_gate.*` was deleted on
35097
+ // 2026-08-12 because a default-off safety gate is an absent one. Its
35098
+ // gating is where the comment above says gating belongs — inside the
35099
+ // detector: no CI observed, or a settled read, or no completion claim
35100
+ // ⇒ no finding.
35101
+ detectCompletionClaim(lastAssistant, readCiSettled(workspaceRoot))
35102
+ ]) {
35103
+ if (f) findings.push(f);
35104
+ }
35105
+ if (findings.length === 0) return EXIT_ALLOW4;
35106
+ markRefusedTurn(workspaceRoot, sessionKey, turnOrdinal, findings[0].detector);
35107
+ const lines = findings.map(
35108
+ (f) => ` \xB7 ${f.detector}: ${f.reason}
35109
+ evidence: ${JSON.stringify(f.evidence)}`
35110
+ );
35111
+ process.stderr.write(
35112
+ `turn-end-gate: REFUSED \u2014 this turn is not finished.
35113
+ ${lines.join("\n")}
35114
+ Do the promised work now, correct the language, run the verification the edit needs, or read the CI verdict before claiming it \u2014 then end the turn.
35115
+ This turn will not be refused a second time.
35116
+ `
35117
+ );
35118
+ return EXIT_BLOCK2;
35119
+ }
35120
+ function _isCliEntry22() {
35121
+ if (true) {
35122
+ return false;
35123
+ }
35124
+ if (process.argv[1] === void 0) {
35125
+ return false;
35126
+ }
35127
+ const argvUrl = pathToFileURL24(path59.resolve(process.argv[1])).href;
35128
+ if (import.meta.url === argvUrl) {
35129
+ return true;
35130
+ }
35131
+ try {
35132
+ const here = fs58.realpathSync(fileURLToPath35(import.meta.url));
35133
+ const argv = fs58.realpathSync(path59.resolve(process.argv[1]));
35134
+ return here === argv;
35135
+ } catch {
35136
+ return false;
35137
+ }
35138
+ }
35139
+ var EXIT_BLOCK2, EXIT_ALLOW4, TRANSCRIPT_READ_MAX_BYTES, PROMISSORY, HANDBACK, _COMPLETION_RE, _EDIT_TOOLS, _VERIFY_RE;
35140
+ var init_turn_end_gate_hook = __esm({
35141
+ "src/scripts/hooks/turn_end_gate_hook.ts"() {
35142
+ "use strict";
35143
+ init_language_mirror_hook();
35144
+ init_before_complete_hook();
35145
+ init_end_review_nudge_hook();
35146
+ init_envelope();
35147
+ init_hook_stdin();
35148
+ init_state_io();
35149
+ EXIT_BLOCK2 = 1;
35150
+ EXIT_ALLOW4 = 0;
35151
+ TRANSCRIPT_READ_MAX_BYTES = 8 * 1024 * 1024;
35152
+ PROMISSORY = [
35153
+ /\bich melde mich\b/i,
35154
+ /\bmelde ich (mich|dir|Dir)\b/i,
35155
+ /\bich melde\b/i,
35156
+ /\bich berichte\b/i,
35157
+ /\bich (sage|gebe) (dir |Dir )?Bescheid\b/i,
35158
+ /\bals n(ä|ae)chstes (werde|mache|baue|pr(ü|ue)fe) ich\b/i,
35159
+ // German puts the infinitive at the END of the clause ("ich werde jetzt
35160
+ // die Tests schreiben"), so the verb cannot be matched adjacent to
35161
+ // "werde" — it has to be looked for across the rest of the sentence.
35162
+ //
35163
+ // The lookahead excludes a stated REFUSAL to act: declining to do
35164
+ // something is not a promise to do it. R2 finding 4 reproduced four live
35165
+ // false refusals against the old `\bnicht\b`-only version — "Ich werde
35166
+ // nichts anfassen" (no word boundary after `nicht`), "keine Tests
35167
+ // schreiben", "niemals raten", and the passive non-promise "Ich werde
35168
+ // gefragt, ob …". Each was a false refusal on a BLOCKING guard, which is
35169
+ // the precision failure the council warning is about.
35170
+ // `\p{L}` with the `u` flag, NOT `\w`: R2 round 2, finding 15 verified that
35171
+ // `\b\w{3,}en\b` cannot reach an infinitive whose post-umlaut fragment is
35172
+ // short, because `ü`/`ö`/`ä` are not `\w` and create a word boundary — so
35173
+ // "prüfen" and "lösen" were silent while the comment above claimed the
35174
+ // verb-final construction was handled.
35175
+ //
35176
+ // Honest about what this proxy matches: any word of 3+ letters ending in
35177
+ // "en" within the clause, which is the infinitive in practice but also hits
35178
+ // a plural noun ("die Zeilen zählen" matches on "Zeilen"). That is
35179
+ // acceptable here — the clause already requires "ich werde" and excludes
35180
+ // negations and passives, so a forward commitment is what remains — but it
35181
+ // is a proxy for the infinitive, not a parse of one.
35182
+ new RegExp("\\bich werde\\b(?![^.!?\\n]*\\b(?:nicht|nichts|kein(?:e|en|em|er|es)?|niemals|nie)\\b)(?![^.!?\\n]*\\b(?:gefragt|gebeten|informiert|benachrichtigt)\\b)[^.!?\\n]*(?<!\\p{L})\\p{L}{3,}en(?!\\p{L})", "iu"),
35183
+ /\bI(?:'| wi)ll (report|let you know|update you|follow up)\b/i,
35184
+ /\bI(?:'| wi)ll (now |then )?\w+ (it|that|this|next)\b/i,
35185
+ /\bnext,? I(?:'| wi)ll\b/i,
35186
+ /\bI am going to\b/i
35187
+ ];
35188
+ HANDBACK = [
35189
+ /\bdas entscheidest (du|Du)\b/i,
35190
+ /\bdeine Entscheidung\b/i,
35191
+ /\bich fasse .{0,40}nicht ungefragt an\b/i,
35192
+ /\bsag (Bescheid|ein Wort)\b/i,
35193
+ /\bwarte auf (deine|Deine|dein|Dein)\b/i,
35194
+ /\byour call\b/i,
35195
+ /\byou decide\b/i,
35196
+ /\blet me know (which|if|whether)\b/i,
35197
+ /\bwaiting for your\b/i
35198
+ ];
35199
+ _COMPLETION_RE = /(^|\n)\s*(?:\*\*)?(?:fertig\b|damit ist alles erledigt|aufgabe erledigt|alles erledigt\b|komplett(?:er)? (?:auftrag|abgearbeitet)|der komplette auftrag ist durch|done[.!]|all done\b|task complete)/i;
35200
+ _EDIT_TOOLS = /* @__PURE__ */ new Set(["Edit", "Write", "MultiEdit", "NotebookEdit"]);
35201
+ _VERIFY_RE = /\b(test|tests|vitest|jest|pytest|phpunit|pest|tsc|eslint|ruff|mypy|pyright|clippy|typecheck|lint|build|ci|preflight|smoke[-_:a-z]*|check[-_:a-z]*|validate[-_:a-z]*)\b|\b(task|npm|pnpm|yarn|composer|cargo|go|make|php artisan|bun)\s+(run\s+)?\S*(test|check|lint|build|ci|typecheck)/i;
35202
+ if (_isCliEntry22()) {
35203
+ process.exit(main24());
35204
+ }
35205
+ }
35206
+ });
35207
+
35208
+ // src/scripts/hooks/evidence_independence.ts
35209
+ import crypto9 from "node:crypto";
35210
+ import fs59 from "node:fs";
35211
+ import path60 from "node:path";
35212
+ import { fileURLToPath as fileURLToPath36, pathToFileURL as pathToFileURL25 } from "node:url";
35213
+ function _isObject6(v) {
34378
35214
  return typeof v === "object" && v !== null && !Array.isArray(v);
34379
35215
  }
34380
35216
  function isDispatchTool(tool) {
@@ -34396,10 +35232,10 @@ function preloadedVerdict(prompt) {
34396
35232
  return null;
34397
35233
  }
34398
35234
  function extractDispatch(envelope) {
34399
- const payload = _isObject5(envelope["payload"]) ? envelope["payload"] : envelope;
35235
+ const payload = _isObject6(envelope["payload"]) ? envelope["payload"] : envelope;
34400
35236
  const toolRaw = payload["tool_name"] ?? payload["toolName"] ?? payload["tool"];
34401
35237
  const tool = typeof toolRaw === "string" ? toolRaw : null;
34402
- const input = _isObject5(payload["tool_input"]) ? payload["tool_input"] : _isObject5(payload["toolInput"]) ? payload["toolInput"] : payload;
35238
+ const input = _isObject6(payload["tool_input"]) ? payload["tool_input"] : _isObject6(payload["toolInput"]) ? payload["toolInput"] : payload;
34403
35239
  for (const key of ["prompt", "instructions", "task", "description"]) {
34404
35240
  const v = input[key];
34405
35241
  if (typeof v === "string" && v.trim()) {
@@ -34410,8 +35246,8 @@ function extractDispatch(envelope) {
34410
35246
  }
34411
35247
  function _ledgerStamp(consumer_root) {
34412
35248
  try {
34413
- const raw = fs57.readFileSync(
34414
- path58.join(consumer_root, "agents", "state", "git-authorization.json"),
35249
+ const raw = fs59.readFileSync(
35250
+ path60.join(consumer_root, "agents", "state", "git-authorization.json"),
34415
35251
  "utf8"
34416
35252
  );
34417
35253
  const d = JSON.parse(raw);
@@ -34422,8 +35258,8 @@ function _ledgerStamp(consumer_root) {
34422
35258
  }
34423
35259
  function _load2(target) {
34424
35260
  try {
34425
- const decoded = JSON.parse(fs57.readFileSync(target, "utf8"));
34426
- if (_isObject5(decoded) && Array.isArray(decoded["evaluations"])) {
35261
+ const decoded = JSON.parse(fs59.readFileSync(target, "utf8"));
35262
+ if (_isObject6(decoded) && Array.isArray(decoded["evaluations"])) {
34427
35263
  return decoded;
34428
35264
  }
34429
35265
  } catch {
@@ -34432,12 +35268,12 @@ function _load2(target) {
34432
35268
  }
34433
35269
  function decide2(tool, prompt, priorEvaluations) {
34434
35270
  if (!isDispatchTool(tool) || !isEvaluationPrompt(prompt)) {
34435
- return { exit: EXIT_ALLOW4, stdout: "", stderr: "", evaluations: priorEvaluations };
35271
+ return { exit: EXIT_ALLOW5, stdout: "", stderr: "", evaluations: priorEvaluations };
34436
35272
  }
34437
35273
  const preloaded = preloadedVerdict(prompt);
34438
35274
  if (preloaded !== null) {
34439
35275
  return {
34440
- exit: EXIT_BLOCK2,
35276
+ exit: EXIT_BLOCK3,
34441
35277
  stdout: "",
34442
35278
  stderr: `Blocked: this evaluation prompt pre-loads its verdict ("${preloaded}"). That is the construct that produced a fabricated NO-FINDINGS committed as binding gate evidence, over a delta an unsteered pass then found a live critical in. Remove the expectation from the prompt and let the evaluator reach its own verdict.
34443
35279
  `,
@@ -34445,11 +35281,11 @@ function decide2(tool, prompt, priorEvaluations) {
34445
35281
  };
34446
35282
  }
34447
35283
  if (!isSelfScoped(prompt)) {
34448
- return { exit: EXIT_ALLOW4, stdout: "", stderr: "", evaluations: priorEvaluations };
35284
+ return { exit: EXIT_ALLOW5, stdout: "", stderr: "", evaluations: priorEvaluations };
34449
35285
  }
34450
35286
  if (priorEvaluations >= 1) {
34451
35287
  return {
34452
- exit: EXIT_BLOCK2,
35288
+ exit: EXIT_BLOCK3,
34453
35289
  stdout: "",
34454
35290
  stderr: `Blocked: second evaluation dispatch of your own work in this turn (verdict shopping). One evaluation has already run; commissioning another with a different prompt or scope selects the answer instead of measuring it. Report what the first pass returned, then re-plan.
34455
35291
  `,
@@ -34457,7 +35293,7 @@ function decide2(tool, prompt, priorEvaluations) {
34457
35293
  };
34458
35294
  }
34459
35295
  return {
34460
- exit: EXIT_ALLOW4,
35296
+ exit: EXIT_ALLOW5,
34461
35297
  stdout: `${JSON.stringify({ decision: "warn", reason: WARN_TEXT })}
34462
35298
  `,
34463
35299
  stderr: "",
@@ -34469,14 +35305,14 @@ function run5(stdin_text, options) {
34469
35305
  if (stdin_text.trim()) {
34470
35306
  try {
34471
35307
  const decoded = JSON.parse(stdin_text);
34472
- if (_isObject5(decoded)) {
35308
+ if (_isObject6(decoded)) {
34473
35309
  envelope = decoded;
34474
35310
  }
34475
35311
  } catch {
34476
- return EXIT_ALLOW4;
35312
+ return EXIT_ALLOW5;
34477
35313
  }
34478
35314
  }
34479
- const target = path58.join(options.consumer_root, STATE_FILE4);
35315
+ const target = path60.join(options.consumer_root, STATE_FILE4);
34480
35316
  const state = _load2(target);
34481
35317
  const session_id = typeof envelope["session_id"] === "string" ? envelope["session_id"] : "";
34482
35318
  const turnMarker = `${session_id}:${_ledgerStamp(options.consumer_root)}`;
@@ -34490,7 +35326,7 @@ function run5(stdin_text, options) {
34490
35326
  if (decision.evaluations > state.evaluations.length) {
34491
35327
  state.evaluations.push({
34492
35328
  at: (/* @__PURE__ */ new Date()).toISOString(),
34493
- digest: crypto7.createHash("sha256").update(prompt).digest("hex").slice(0, 16),
35329
+ digest: crypto9.createHash("sha256").update(prompt).digest("hex").slice(0, 16),
34494
35330
  prompt_chars: prompt.length
34495
35331
  });
34496
35332
  try {
@@ -34506,7 +35342,7 @@ function run5(stdin_text, options) {
34506
35342
  }
34507
35343
  return decision.exit;
34508
35344
  }
34509
- function main23(argv) {
35345
+ function main25(argv) {
34510
35346
  const args = argv ?? process.argv.slice(2);
34511
35347
  let consumer_root = process.cwd();
34512
35348
  for (let i = 0; i < args.length; i += 1) {
@@ -34520,34 +35356,34 @@ function main23(argv) {
34520
35356
  }
34521
35357
  return run5(readHookStdin(), { consumer_root });
34522
35358
  }
34523
- function _isCliEntry21() {
35359
+ function _isCliEntry23() {
34524
35360
  if (true) {
34525
35361
  return false;
34526
35362
  }
34527
35363
  if (process.argv[1] === void 0) {
34528
35364
  return false;
34529
35365
  }
34530
- const argvUrl = pathToFileURL23(path58.resolve(process.argv[1])).href;
35366
+ const argvUrl = pathToFileURL25(path60.resolve(process.argv[1])).href;
34531
35367
  if (import.meta.url === argvUrl) {
34532
35368
  return true;
34533
35369
  }
34534
35370
  try {
34535
- const here = fs57.realpathSync(fileURLToPath34(import.meta.url));
34536
- const argv = fs57.realpathSync(path58.resolve(process.argv[1]));
35371
+ const here = fs59.realpathSync(fileURLToPath36(import.meta.url));
35372
+ const argv = fs59.realpathSync(path60.resolve(process.argv[1]));
34537
35373
  return here === argv;
34538
35374
  } catch {
34539
35375
  return false;
34540
35376
  }
34541
35377
  }
34542
- var EXIT_ALLOW4, EXIT_BLOCK2, STATE_FILE4, DISPATCH_TOOLS, EVALUATION_RE, PRELOADED_VERDICT_RE, SELF_SCOPE_RE, WARN_TEXT;
35378
+ var EXIT_ALLOW5, EXIT_BLOCK3, STATE_FILE4, DISPATCH_TOOLS, EVALUATION_RE, PRELOADED_VERDICT_RE, SELF_SCOPE_RE, WARN_TEXT;
34543
35379
  var init_evidence_independence = __esm({
34544
35380
  "src/scripts/hooks/evidence_independence.ts"() {
34545
35381
  "use strict";
34546
35382
  init_state_io();
34547
35383
  init_hook_stdin();
34548
- EXIT_ALLOW4 = 0;
34549
- EXIT_BLOCK2 = 1;
34550
- STATE_FILE4 = path58.join("agents", "state", "evidence-dispatch.json");
35384
+ EXIT_ALLOW5 = 0;
35385
+ EXIT_BLOCK3 = 1;
35386
+ STATE_FILE4 = path60.join("agents", "state", "evidence-dispatch.json");
34551
35387
  DISPATCH_TOOLS = /* @__PURE__ */ new Set([
34552
35388
  "Agent",
34553
35389
  "Task",
@@ -34580,19 +35416,36 @@ var init_evidence_independence = __esm({
34580
35416
  ];
34581
35417
  SELF_SCOPE_RE = /\b(my (work|change|diff|implementation|code|fix|patch|branch|pr)|this (diff|change|branch|pr|delta|implementation|patch)|the delta|the change i|what i (wrote|built|changed|implemented)|i just (wrote|built|changed|implemented))\b/i;
34582
35418
  WARN_TEXT = "First evaluation dispatch this turn. Two shapes fabricated a binding honest-null in the audited sessions \u2014 check your prompt for both before it goes out: (1) a verdict pre-loaded into the prompt, and (2) a scope narrowed to files you chose. A review you commissioned on your own work is admissible as gate evidence only when the prompt is recorded alongside the verdict.";
34583
- if (_isCliEntry21()) {
34584
- process.exit(main23());
35419
+ if (_isCliEntry23()) {
35420
+ process.exit(main25());
34585
35421
  }
34586
35422
  }
34587
35423
  });
34588
35424
 
34589
35425
  // src/scripts/conformance_scan.ts
34590
- import { createHash as createHash8 } from "node:crypto";
34591
- import fs58 from "node:fs";
34592
- import os12 from "node:os";
34593
- import path59 from "node:path";
34594
- import { fileURLToPath as fileURLToPath35, pathToFileURL as pathToFileURL24 } from "node:url";
34595
- function bandVerdict(rate_pct, assistant_turns) {
35426
+ import { createHash as createHash10 } from "node:crypto";
35427
+ import fs60 from "node:fs";
35428
+ import os13 from "node:os";
35429
+ import path61 from "node:path";
35430
+ import { fileURLToPath as fileURLToPath37, pathToFileURL as pathToFileURL26 } from "node:url";
35431
+ function spansCarrierChange(firstAts) {
35432
+ const stamps = firstAts.filter((s) => s !== "").sort();
35433
+ if (stamps.length === 0) {
35434
+ return { spans: false, what: "" };
35435
+ }
35436
+ const lo = stamps[0];
35437
+ const hi = stamps[stamps.length - 1];
35438
+ for (const c of CARRIER_CHANGES) {
35439
+ if (lo < c.at && hi >= c.at) {
35440
+ return { spans: true, what: c.what };
35441
+ }
35442
+ }
35443
+ return { spans: false, what: "" };
35444
+ }
35445
+ function bandVerdict(rate_pct, assistant_turns, opts = {}) {
35446
+ if (opts.spansCarrier === true) {
35447
+ return "era-spanning";
35448
+ }
34596
35449
  if (assistant_turns < BAND_MIN_TURNS) {
34597
35450
  return "corpus-too-small";
34598
35451
  }
@@ -34626,7 +35479,7 @@ function renderWhy(report2, id) {
34626
35479
  }
34627
35480
  return lines.join("\n");
34628
35481
  }
34629
- function _isObject6(v) {
35482
+ function _isObject7(v) {
34630
35483
  return typeof v === "object" && v !== null && !Array.isArray(v);
34631
35484
  }
34632
35485
  function userText(entry) {
@@ -34650,15 +35503,15 @@ function assistantText(entry) {
34650
35503
  }
34651
35504
  function toolUses2(entry) {
34652
35505
  const msg = entry["message"];
34653
- const content = _isObject6(msg) ? msg["content"] : void 0;
35506
+ const content = _isObject7(msg) ? msg["content"] : void 0;
34654
35507
  if (!Array.isArray(content)) {
34655
35508
  return [];
34656
35509
  }
34657
- return content.filter((b) => _isObject6(b) && b["type"] === "tool_use").map((b) => {
35510
+ return content.filter((b) => _isObject7(b) && b["type"] === "tool_use").map((b) => {
34658
35511
  const o = b;
34659
35512
  return {
34660
35513
  name: String(o["name"] ?? ""),
34661
- input: _isObject6(o["input"]) ? o["input"] : {}
35514
+ input: _isObject7(o["input"]) ? o["input"] : {}
34662
35515
  };
34663
35516
  });
34664
35517
  }
@@ -34673,7 +35526,9 @@ function scanSession(sessionId, lines) {
34673
35526
  session: sessionId,
34674
35527
  user_turns: 0,
34675
35528
  assistant_turns: 0,
34676
- violations: []
35529
+ violations: [],
35530
+ de_pin_turns: 0,
35531
+ first_at: ""
34677
35532
  };
34678
35533
  let pinned = null;
34679
35534
  let pendingPoll = null;
@@ -34682,6 +35537,8 @@ function scanSession(sessionId, lines) {
34682
35537
  let evaluationsThisTurn = 0;
34683
35538
  let turnsSincePrompt = 0;
34684
35539
  let compactionSincePrompt = false;
35540
+ let ciSeen = false;
35541
+ let ciSettled = false;
34685
35542
  for (const line of lines) {
34686
35543
  if (!line.trim()) {
34687
35544
  continue;
@@ -34692,6 +35549,9 @@ function scanSession(sessionId, lines) {
34692
35549
  } catch {
34693
35550
  continue;
34694
35551
  }
35552
+ if (report2.first_at === "" && typeof entry["timestamp"] === "string") {
35553
+ report2.first_at = entry["timestamp"];
35554
+ }
34695
35555
  if (entry["type"] === "user" && entry["toolUseResult"] !== void 0 && pendingPoll !== null) {
34696
35556
  const raw = entry["toolUseResult"];
34697
35557
  const out = typeof raw === "string" ? raw : JSON.stringify(raw);
@@ -34706,6 +35566,8 @@ function scanSession(sessionId, lines) {
34706
35566
  detail: `CI poll read as settled without an in-flight observation: ${out.slice(0, 90)}`
34707
35567
  });
34708
35568
  }
35569
+ ciSeen = true;
35570
+ ciSettled = pending === 0 && sawPending && !isVacuousOutput(out);
34709
35571
  pendingPoll = null;
34710
35572
  continue;
34711
35573
  }
@@ -34745,6 +35607,20 @@ function scanSession(sessionId, lines) {
34745
35607
  if (prose !== null) {
34746
35608
  report2.assistant_turns += 1;
34747
35609
  turnsSincePrompt += 1;
35610
+ if (pinned === "de") {
35611
+ report2.de_pin_turns += 1;
35612
+ }
35613
+ if (!HARNESS_TEXT.test((prose.split("\n").find((l) => l.trim()) ?? "").trim())) {
35614
+ const cc = detectCompletionClaim(prose, { seen: ciSeen, settled: ciSettled });
35615
+ if (cc !== null) {
35616
+ report2.violations.push({
35617
+ check: "completion-claim",
35618
+ session: sessionId,
35619
+ at,
35620
+ detail: `completion claimed over an unsettled CI read: "${cc.evidence.slice(0, 110)}"`
35621
+ });
35622
+ }
35623
+ }
34748
35624
  if (pinned === "de") {
34749
35625
  const first = prose.split("\n").find((l) => l.trim()) ?? "";
34750
35626
  if (HARNESS_TEXT.test(first.trim())) {
@@ -34807,7 +35683,7 @@ function scanSession(sessionId, lines) {
34807
35683
  }
34808
35684
  function defaultStore(projectDir) {
34809
35685
  const slug = projectDir.replace(/[/.]/g, "-");
34810
- return path59.join(process.env["HOME"] ?? "", ".claude", "projects", slug);
35686
+ return path61.join(process.env["HOME"] ?? "", ".claude", "projects", slug);
34811
35687
  }
34812
35688
  function _tokens(chars) {
34813
35689
  return Math.round(chars / 4);
@@ -34818,13 +35694,13 @@ function measureDelivered(projectRulesDir, globalRulesDir) {
34818
35694
  return {
34819
35695
  project: {
34820
35696
  dir: projectRulesDir,
34821
- present: fs58.existsSync(projectRulesDir),
35697
+ present: fs60.existsSync(projectRulesDir),
34822
35698
  files: p.files,
34823
35699
  tokens: _tokens(p.chars)
34824
35700
  },
34825
35701
  global: {
34826
35702
  dir: globalRulesDir,
34827
- present: fs58.existsSync(globalRulesDir),
35703
+ present: fs60.existsSync(globalRulesDir),
34828
35704
  files: g.files,
34829
35705
  tokens: _tokens(g.chars)
34830
35706
  },
@@ -34832,13 +35708,13 @@ function measureDelivered(projectRulesDir, globalRulesDir) {
34832
35708
  };
34833
35709
  }
34834
35710
  function storeKey(store) {
34835
- return createHash8("sha256").update(path59.resolve(store)).digest("hex").slice(0, 12);
35711
+ return createHash10("sha256").update(path61.resolve(store)).digest("hex").slice(0, 12);
34836
35712
  }
34837
35713
  function scanStore(store, limit) {
34838
- const files = fs58.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ f, m: fs58.statSync(path59.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.f);
35714
+ const files = fs60.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ f, m: fs60.statSync(path61.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.f);
34839
35715
  const per_session = [];
34840
35716
  for (const f of files) {
34841
- const lines = fs58.readFileSync(path59.join(store, f), "utf8").split("\n");
35717
+ const lines = fs60.readFileSync(path61.join(store, f), "utf8").split("\n");
34842
35718
  const r = scanSession(f.replace(/\.jsonl$/, "").slice(0, 8), lines);
34843
35719
  if (r.assistant_turns > 0) {
34844
35720
  per_session.push(r);
@@ -34848,7 +35724,8 @@ function scanStore(store, limit) {
34848
35724
  "language-pin": 0,
34849
35725
  "git-authorization": 0,
34850
35726
  "vacuous-evidence": 0,
34851
- "evidence-steering": 0
35727
+ "evidence-steering": 0,
35728
+ "completion-claim": 0
34852
35729
  };
34853
35730
  for (const s of per_session) {
34854
35731
  for (const v of s.violations) {
@@ -34858,11 +35735,14 @@ function scanStore(store, limit) {
34858
35735
  const assistant_turns = per_session.reduce((n, s) => n + s.assistant_turns, 0);
34859
35736
  const language_pin = totals["language-pin"] ?? 0;
34860
35737
  const rate_pct = assistant_turns === 0 ? 0 : Number((100 * language_pin / assistant_turns).toFixed(1));
35738
+ const de_pin_turns = per_session.reduce((n, s) => n + s.de_pin_turns, 0);
35739
+ const rate_pct_de_pin = de_pin_turns === 0 ? 0 : Number((100 * language_pin / de_pin_turns).toFixed(1));
35740
+ const era = spansCarrierChange(per_session.map((s) => s.first_at));
34861
35741
  const delivered = measureDelivered(
34862
- path59.join(REPO_ROOT6, ".claude", "rules"),
34863
- path59.join(process.env["HOME"] ?? os12.homedir(), ".claude", "rules")
35742
+ path61.join(REPO_ROOT6, ".claude", "rules"),
35743
+ path61.join(process.env["HOME"] ?? os13.homedir(), ".claude", "rules")
34864
35744
  );
34865
- const ownStore = path59.resolve(store) === path59.resolve(defaultStore(REPO_ROOT6));
35745
+ const ownStore = path61.resolve(store) === path61.resolve(defaultStore(REPO_ROOT6));
34866
35746
  return {
34867
35747
  scanned_at: (/* @__PURE__ */ new Date()).toISOString(),
34868
35748
  store,
@@ -34876,7 +35756,11 @@ function scanStore(store, limit) {
34876
35756
  assistant_turns,
34877
35757
  language_pin,
34878
35758
  rate_pct,
34879
- band: bandVerdict(rate_pct, assistant_turns),
35759
+ de_pin_turns,
35760
+ rate_pct_de_pin,
35761
+ era_spanning: era.spans,
35762
+ era_reason: era.what,
35763
+ band: bandVerdict(rate_pct, assistant_turns, { spansCarrier: era.spans }),
34880
35764
  // Only attach the carrier figures when the rate and the carriers describe
34881
35765
  // the same project.
34882
35766
  delivered_project_tokens: ownStore ? delivered.project.tokens : null,
@@ -34885,8 +35769,8 @@ function scanStore(store, limit) {
34885
35769
  };
34886
35770
  }
34887
35771
  function recordRate(file, scanned_at, rate) {
34888
- fs58.mkdirSync(path59.dirname(file), { recursive: true });
34889
- fs58.appendFileSync(file, `${JSON.stringify({ measured_at: scanned_at, ...rate })}
35772
+ fs60.mkdirSync(path61.dirname(file), { recursive: true });
35773
+ fs60.appendFileSync(file, `${JSON.stringify({ measured_at: scanned_at, ...rate })}
34890
35774
  `, "utf8");
34891
35775
  }
34892
35776
  function render2(report2) {
@@ -34917,7 +35801,26 @@ function render2(report2) {
34917
35801
  lines.push(
34918
35802
  ` language-pin rate ${report2.rate.rate_pct.toFixed(1)}% (${report2.rate.language_pin} of ${report2.rate.assistant_turns} assistant turns)`
34919
35803
  );
34920
- if (report2.rate.band === "corpus-too-small") {
35804
+ const dePinTurns = report2.rate.de_pin_turns;
35805
+ const dePinRate = report2.rate.rate_pct_de_pin;
35806
+ if (typeof dePinTurns === "number" && typeof dePinRate === "number") {
35807
+ lines.push(
35808
+ ` ${dePinRate.toFixed(1)}% (${report2.rate.language_pin} of ${dePinTurns} turns under a GERMAN pin \u2014 the only turns this check can fire on)`
35809
+ );
35810
+ lines.push(
35811
+ " The band (M5, n=3) was computed on the ALL-turns denominator, so the first figure"
35812
+ );
35813
+ lines.push(" is the comparable one and the second is the honest one. Both are printed.");
35814
+ }
35815
+ if (report2.rate.band === "era-spanning") {
35816
+ lines.push(
35817
+ ` Not compared: the corpus SPANS a carrier landing \u2014 ${report2.rate.era_reason || "see CARRIER_CHANGES"}.`
35818
+ );
35819
+ lines.push(" A rate pooled across it is a weighted average of two different systems, not");
35820
+ lines.push(" a reading about behaviour. Round 7 measured 23.1% before and 0.0% after that");
35821
+ lines.push(" exact carrier; the pooled 6.5% was announced as the falsifier firing.");
35822
+ lines.push(" Split the window at the carrier date and read each era on its own.");
35823
+ } else if (report2.rate.band === "corpus-too-small") {
34921
35824
  lines.push(
34922
35825
  ` Not compared: ${report2.rate.assistant_turns} turns is below the ${BAND_MIN_TURNS} of the`
34923
35826
  );
@@ -34939,11 +35842,22 @@ function render2(report2) {
34939
35842
  lines.push(" as new. Store novelty is not project novelty.");
34940
35843
  }
34941
35844
  lines.push("");
34942
- lines.push(" Scanned checks are exactly the mechanised ones. Ask-shape, session-canary,");
34943
- lines.push(" promissory closings and checkbox batching are left as prose and NOT measured.");
35845
+ lines.push(" Scanned checks are exactly the mechanised ones. What is NOT in the counts above:");
35846
+ lines.push(" ask-shape (trailing free-text offer) \u2014 measured NOWHERE. ~11 findings in round 7's");
35847
+ lines.push(" reading half; the discriminator needs judgement, so it stays advisory on purpose.");
35848
+ lines.push(" session-canary (opening greeting) \u2014 not here, but PROBEABLE:");
35849
+ lines.push(" `./scripts-run src/scripts/probe_session_canary`. Round 7: 25/28 sessions,");
35850
+ lines.push(" 24/25 post-carrier. The per-TASK instance is undecidable \u2014 no task boundary");
35851
+ lines.push(" is recorded in a transcript.");
35852
+ lines.push(" promissory closings \u2014 not here, but ALREADY GATED: `turn-end-gate`");
35853
+ lines.push(" ships a blocking `detectPromissory`. Round 7 probe: 1 of 120 hand-back turns");
35854
+ lines.push(" (the 163 this line first printed was the retracted denominator \u2014 it counted");
35855
+ lines.push(" synthetic user turns as hand-back closers).");
35856
+ lines.push(" `./scripts-run src/scripts/probe_promissory_closing`.");
35857
+ lines.push(" checkbox batching \u2014 measured NOWHERE. ~5 low-severity findings.");
34944
35858
  return lines.join("\n");
34945
35859
  }
34946
- function main24(argv) {
35860
+ function main26(argv) {
34947
35861
  const args = argv ?? process.argv.slice(2);
34948
35862
  let store = null;
34949
35863
  let limit = 30;
@@ -34975,14 +35889,14 @@ function main24(argv) {
34975
35889
  return 2;
34976
35890
  }
34977
35891
  const resolved = store ?? defaultStore(process.cwd());
34978
- if (!fs58.existsSync(resolved)) {
35892
+ if (!fs60.existsSync(resolved)) {
34979
35893
  process.stderr.write(`conformance:behavior: no transcript store at ${resolved}
34980
35894
  `);
34981
35895
  return 1;
34982
35896
  }
34983
35897
  const report2 = scanStore(resolved, Number.isFinite(limit) && limit > 0 ? limit : 30);
34984
35898
  if (out) {
34985
- fs58.writeFileSync(out, `${JSON.stringify(report2, null, 2)}
35899
+ fs60.writeFileSync(out, `${JSON.stringify(report2, null, 2)}
34986
35900
  `, "utf8");
34987
35901
  }
34988
35902
  if (record) {
@@ -34990,7 +35904,7 @@ function main24(argv) {
34990
35904
  }
34991
35905
  if (why !== null) {
34992
35906
  const id = why;
34993
- fs58.writeSync(
35907
+ fs60.writeSync(
34994
35908
  1,
34995
35909
  json ? `${JSON.stringify(
34996
35910
  {
@@ -35010,31 +35924,31 @@ function main24(argv) {
35010
35924
  );
35011
35925
  return 0;
35012
35926
  }
35013
- fs58.writeSync(1, json ? `${JSON.stringify(report2, null, 2)}
35927
+ fs60.writeSync(1, json ? `${JSON.stringify(report2, null, 2)}
35014
35928
  ` : `${render2(report2)}
35015
35929
  `);
35016
35930
  return 0;
35017
35931
  }
35018
- function _isCliEntry22() {
35932
+ function _isCliEntry24() {
35019
35933
  if (true) {
35020
35934
  return false;
35021
35935
  }
35022
35936
  if (process.argv[1] === void 0) {
35023
35937
  return false;
35024
35938
  }
35025
- const argvUrl = pathToFileURL24(path59.resolve(process.argv[1])).href;
35939
+ const argvUrl = pathToFileURL26(path61.resolve(process.argv[1])).href;
35026
35940
  if (import.meta.url === argvUrl) {
35027
35941
  return true;
35028
35942
  }
35029
35943
  try {
35030
- const here = fs58.realpathSync(fileURLToPath35(import.meta.url));
35031
- const argv = fs58.realpathSync(path59.resolve(process.argv[1]));
35944
+ const here = fs60.realpathSync(fileURLToPath37(import.meta.url));
35945
+ const argv = fs60.realpathSync(path61.resolve(process.argv[1]));
35032
35946
  return here === argv;
35033
35947
  } catch {
35034
35948
  return false;
35035
35949
  }
35036
35950
  }
35037
- var REPO_ROOT6, OBSERVED_BAND, BAND_MIN_TURNS, CHECK_IDS2, CHECK_MEANINGS, HARNESS_TEXT, EN_OPENER, DEFAULT_RATE_SERIES;
35951
+ var REPO_ROOT6, OBSERVED_BAND, BAND_MIN_TURNS, CARRIER_CHANGES, CHECK_IDS2, CHECK_MEANINGS, HARNESS_TEXT, EN_OPENER, DEFAULT_RATE_SERIES;
35038
35952
  var init_conformance_scan = __esm({
35039
35953
  "src/scripts/conformance_scan.ts"() {
35040
35954
  "use strict";
@@ -35045,46 +35959,52 @@ var init_conformance_scan = __esm({
35045
35959
  init_git_authorization_hook();
35046
35960
  init_block_unauthorized_git();
35047
35961
  init_before_complete_hook();
35962
+ init_turn_end_gate_hook();
35048
35963
  init_evidence_independence();
35049
- REPO_ROOT6 = path59.resolve(path59.dirname(fileURLToPath35(import.meta.url)), "..", "..");
35964
+ REPO_ROOT6 = path61.resolve(path61.dirname(fileURLToPath37(import.meta.url)), "..", "..");
35050
35965
  OBSERVED_BAND = { low: 9.1, high: 39.2 };
35051
35966
  BAND_MIN_TURNS = 1978;
35967
+ CARRIER_CHANGES = [
35968
+ { at: "2026-08-07T00:00:00Z", what: "language-pin bound on user_prompt_submit (round 5)" }
35969
+ ];
35052
35970
  CHECK_IDS2 = [
35053
35971
  "language-pin",
35054
35972
  "git-authorization",
35055
35973
  "vacuous-evidence",
35056
- "evidence-steering"
35974
+ "evidence-steering",
35975
+ "completion-claim"
35057
35976
  ];
35058
35977
  CHECK_MEANINGS = {
35059
35978
  "language-pin": "An assistant turn whose user-visible prose is not in the language that turn's own pin named. Carries provenance (turns_since_prompt, compaction_since_prompt) so a pin that was ABSENT because compaction removed it stays distinguishable from one that was present and ignored.",
35060
35979
  "git-authorization": "A gated git operation performed in a session where no authorization for that operation was observed. Authorization is per-operation and never carries from one to the next.",
35061
35980
  "vacuous-evidence": "A CI poll read as settled without ever observing an in-flight run \u2014 the poll gap that reports a green settle over a window in which nothing was pending yet.",
35062
- "evidence-steering": "A self-commissioned evaluation whose prompt pre-loaded its own verdict, or a second self-scoped evaluation of the same subject within one turn."
35981
+ "evidence-steering": "A self-commissioned evaluation whose prompt pre-loaded its own verdict, or a second self-scoped evaluation of the same subject within one turn.",
35982
+ "completion-claim": "An assistant turn claiming the work is complete while the last CI read in that session was NOT settled. Round 7 measured 14 instances by reading, each followed by the user handing the work back; this is the same predicate `turn-end-gate`'s completion detector refuses on, so the rate and the gate cannot disagree. A session that never polled CI can never hit."
35063
35983
  };
35064
35984
  HARNESS_TEXT = /^(API Error:|Request (timed out|was aborted)|\[Request interrupted|Error: |Credit balance is too low|You've hit your|Prompt is too long)/i;
35065
35985
  EN_OPENER = /^(let me|i'?ll |i'?m |found it|ok[,. ]|okay|alright|here'?s|now[,. ]|looking|checking|reading|running|the |this |that |there |we |you |good |right[,. ]|perfect|done[.,]|all |confirmed|correct)/i;
35066
- DEFAULT_RATE_SERIES = path59.join(
35986
+ DEFAULT_RATE_SERIES = path61.join(
35067
35987
  REPO_ROOT6,
35068
35988
  "agents",
35069
35989
  "runtime",
35070
35990
  "state",
35071
35991
  "conformance-rates.jsonl"
35072
35992
  );
35073
- if (_isCliEntry22()) {
35074
- process.exit(main24());
35993
+ if (_isCliEntry24()) {
35994
+ process.exit(main26());
35075
35995
  }
35076
35996
  }
35077
35997
  });
35078
35998
 
35079
35999
  // src/scripts/report_carrier_divergence.ts
35080
- import * as fs59 from "node:fs";
35081
- import * as os13 from "node:os";
35082
- import * as path60 from "node:path";
36000
+ import * as fs61 from "node:fs";
36001
+ import * as os14 from "node:os";
36002
+ import * as path62 from "node:path";
35083
36003
  import process16 from "node:process";
35084
- import { fileURLToPath as fileURLToPath36, pathToFileURL as pathToFileURL25 } from "node:url";
36004
+ import { fileURLToPath as fileURLToPath38, pathToFileURL as pathToFileURL27 } from "node:url";
35085
36005
  function _listRules(dir) {
35086
36006
  try {
35087
- return fs59.readdirSync(dir).filter((f) => f.endsWith(".md")).sort();
36007
+ return fs61.readdirSync(dir).filter((f) => f.endsWith(".md")).sort();
35088
36008
  } catch {
35089
36009
  return [];
35090
36010
  }
@@ -35092,7 +36012,7 @@ function _listRules(dir) {
35092
36012
  function _ruleType(file) {
35093
36013
  let text;
35094
36014
  try {
35095
- text = fs59.readFileSync(file, "utf-8");
36015
+ text = fs61.readFileSync(file, "utf-8");
35096
36016
  } catch {
35097
36017
  return "";
35098
36018
  }
@@ -35103,8 +36023,8 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
35103
36023
  const out = {
35104
36024
  projectDir,
35105
36025
  globalDir,
35106
- globalPresent: fs59.existsSync(globalDir),
35107
- projectPresent: fs59.existsSync(projectDir),
36026
+ globalPresent: fs61.existsSync(globalDir),
36027
+ projectPresent: fs61.existsSync(projectDir),
35108
36028
  shared: 0,
35109
36029
  identical: [],
35110
36030
  provenanceOnly: [],
@@ -35127,7 +36047,7 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
35127
36047
  }
35128
36048
  if (!inP && inG) {
35129
36049
  out.globalOnly.push(rule);
35130
- if (sourceDir !== void 0 && _ruleType(path60.join(sourceDir, rule)) === "manual") {
36050
+ if (sourceDir !== void 0 && _ruleType(path62.join(sourceDir, rule)) === "manual") {
35131
36051
  out.manualOnlyGlobal.push(rule);
35132
36052
  }
35133
36053
  continue;
@@ -35137,8 +36057,8 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
35137
36057
  let projectCopy;
35138
36058
  let globalCopy;
35139
36059
  try {
35140
- projectCopy = fs59.readFileSync(path60.join(projectDir, rule));
35141
- globalCopy = fs59.readFileSync(path60.join(globalDir, rule));
36060
+ projectCopy = fs61.readFileSync(path62.join(projectDir, rule));
36061
+ globalCopy = fs61.readFileSync(path62.join(globalDir, rule));
35142
36062
  verdict = comparePair(projectCopy, globalCopy);
35143
36063
  } catch {
35144
36064
  out.shared -= 1;
@@ -35283,11 +36203,11 @@ function render3(d) {
35283
36203
  }
35284
36204
  return lines.join("\n");
35285
36205
  }
35286
- function main25(argv) {
36206
+ function main27(argv) {
35287
36207
  const args = argv ?? process16.argv.slice(2);
35288
- let projectDir = path60.join(REPO_ROOT7, PROJECT_RULES);
35289
- let globalDir = path60.join(os13.homedir(), GLOBAL_RULES);
35290
- let sourceDir = path60.join(REPO_ROOT7, PROJECTION_SOURCE);
36208
+ let projectDir = path62.join(REPO_ROOT7, PROJECT_RULES);
36209
+ let globalDir = path62.join(os14.homedir(), GLOBAL_RULES);
36210
+ let sourceDir = path62.join(REPO_ROOT7, PROJECTION_SOURCE);
35291
36211
  const value = (i) => {
35292
36212
  const v = args[i + 1];
35293
36213
  return v === void 0 || v.startsWith("-") ? null : v;
@@ -35301,7 +36221,7 @@ function main25(argv) {
35301
36221
  `);
35302
36222
  return 1;
35303
36223
  }
35304
- const resolved = path60.resolve(v);
36224
+ const resolved = path62.resolve(v);
35305
36225
  if (a === "--project") projectDir = resolved;
35306
36226
  else if (a === "--global") globalDir = resolved;
35307
36227
  else sourceDir = resolved;
@@ -35321,11 +36241,11 @@ function main25(argv) {
35321
36241
  `);
35322
36242
  return 0;
35323
36243
  }
35324
- function _isCliEntry23() {
36244
+ function _isCliEntry25() {
35325
36245
  if (process16.argv[1] === void 0) return false;
35326
- if (import.meta.url === pathToFileURL25(path60.resolve(process16.argv[1])).href) return true;
36246
+ if (import.meta.url === pathToFileURL27(path62.resolve(process16.argv[1])).href) return true;
35327
36247
  try {
35328
- return fs59.realpathSync(_HERE17) === fs59.realpathSync(path60.resolve(process16.argv[1]));
36248
+ return fs61.realpathSync(_HERE17) === fs61.realpathSync(path62.resolve(process16.argv[1]));
35329
36249
  } catch {
35330
36250
  return false;
35331
36251
  }
@@ -35335,37 +36255,37 @@ var init_report_carrier_divergence = __esm({
35335
36255
  "src/scripts/report_carrier_divergence.ts"() {
35336
36256
  "use strict";
35337
36257
  init_carrier_divergence();
35338
- _HERE17 = fileURLToPath36(import.meta.url);
35339
- REPO_ROOT7 = path60.resolve(path60.dirname(_HERE17), "..", "..");
35340
- PROJECT_RULES = path60.join(".claude", "rules");
35341
- PROJECTION_SOURCE = path60.join("dist", "agent-src", "rules");
35342
- GLOBAL_RULES = path60.join(".claude", "rules");
35343
- if (_isCliEntry23()) {
35344
- process16.exit(main25());
36258
+ _HERE17 = fileURLToPath38(import.meta.url);
36259
+ REPO_ROOT7 = path62.resolve(path62.dirname(_HERE17), "..", "..");
36260
+ PROJECT_RULES = path62.join(".claude", "rules");
36261
+ PROJECTION_SOURCE = path62.join("dist", "agent-src", "rules");
36262
+ GLOBAL_RULES = path62.join(".claude", "rules");
36263
+ if (_isCliEntry25()) {
36264
+ process16.exit(main27());
35345
36265
  }
35346
36266
  }
35347
36267
  });
35348
36268
 
35349
36269
  // src/scripts/report_skill_activation.ts
35350
- import * as fs60 from "node:fs";
35351
- import * as os14 from "node:os";
35352
- import * as path61 from "node:path";
35353
- import { fileURLToPath as fileURLToPath37, pathToFileURL as pathToFileURL26 } from "node:url";
36270
+ import * as fs62 from "node:fs";
36271
+ import * as os15 from "node:os";
36272
+ import * as path63 from "node:path";
36273
+ import { fileURLToPath as fileURLToPath39, pathToFileURL as pathToFileURL28 } from "node:url";
35354
36274
  function censusSkills(root) {
35355
36275
  const out = { total: 0, withTriggerKey: [], withDeterministicObligation: [] };
35356
- if (!fs60.existsSync(root)) {
36276
+ if (!fs62.existsSync(root)) {
35357
36277
  return out;
35358
36278
  }
35359
- for (const entry of fs60.readdirSync(root, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
36279
+ for (const entry of fs62.readdirSync(root, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
35360
36280
  if (!entry.isDirectory()) {
35361
36281
  continue;
35362
36282
  }
35363
- const file = path61.join(root, entry.name, "SKILL.md");
35364
- if (!fs60.existsSync(file)) {
36283
+ const file = path63.join(root, entry.name, "SKILL.md");
36284
+ if (!fs62.existsSync(file)) {
35365
36285
  continue;
35366
36286
  }
35367
36287
  out.total += 1;
35368
- const text = fs60.readFileSync(file, "utf8");
36288
+ const text = fs62.readFileSync(file, "utf8");
35369
36289
  const fmEnd = text.startsWith("---") ? text.indexOf("\n---", 3) : -1;
35370
36290
  const fm = fmEnd === -1 ? "" : text.slice(0, fmEnd);
35371
36291
  if (TRIGGER_KEYS.some((k) => new RegExp(`^${k}`, "m").test(fm))) {
@@ -35379,17 +36299,17 @@ function censusSkills(root) {
35379
36299
  return out;
35380
36300
  }
35381
36301
  function defaultStore2(cwd) {
35382
- return path61.join(os14.homedir(), ".claude", "projects", cwd.replace(/\//g, "-"));
36302
+ return path63.join(os15.homedir(), ".claude", "projects", cwd.replace(/[/.]/g, "-"));
35383
36303
  }
35384
36304
  function measureUsage(store, limit) {
35385
36305
  const rep = { store, sessions: 0, assistantTurns: 0, invocations: 0, bySkill: {} };
35386
- if (!fs60.existsSync(store)) {
36306
+ if (!fs62.existsSync(store)) {
35387
36307
  return rep;
35388
36308
  }
35389
- const files = fs60.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => path61.join(store, f)).sort((a, b) => fs60.statSync(b).mtimeMs - fs60.statSync(a).mtimeMs).slice(0, limit);
36309
+ const files = fs62.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => path63.join(store, f)).sort((a, b) => fs62.statSync(b).mtimeMs - fs62.statSync(a).mtimeMs).slice(0, limit);
35390
36310
  rep.sessions = files.length;
35391
36311
  for (const file of files) {
35392
- for (const line of fs60.readFileSync(file, "utf8").split("\n")) {
36312
+ for (const line of fs62.readFileSync(file, "utf8").split("\n")) {
35393
36313
  if (!line.trim()) {
35394
36314
  continue;
35395
36315
  }
@@ -35452,7 +36372,7 @@ function render4(census, usage) {
35452
36372
  }
35453
36373
  totalInv += u.invocations;
35454
36374
  lines.push(
35455
- ` ${path61.basename(u.store).slice(-38).padEnd(38)} sessions=${String(u.sessions).padStart(3)} asst=${String(u.assistantTurns).padStart(6)} Skill calls=${String(u.invocations).padStart(3)}`
36375
+ ` ${path63.basename(u.store).slice(-38).padEnd(38)} sessions=${String(u.sessions).padStart(3)} asst=${String(u.assistantTurns).padStart(6)} Skill calls=${String(u.invocations).padStart(3)}`
35456
36376
  );
35457
36377
  }
35458
36378
  lines.push("");
@@ -35477,7 +36397,7 @@ function render4(census, usage) {
35477
36397
  lines.push(" catalogue once per session, then count descriptions against bare names.");
35478
36398
  return lines.join("\n");
35479
36399
  }
35480
- function main26(argv) {
36400
+ function main28(argv) {
35481
36401
  let limit = 30;
35482
36402
  const stores = [];
35483
36403
  for (let i = 0; i < argv.length; i += 1) {
@@ -35500,7 +36420,7 @@ function main26(argv) {
35500
36420
  if (stores.length === 0) {
35501
36421
  stores.push(defaultStore2(REPO_ROOT8));
35502
36422
  }
35503
- const census = censusSkills(path61.join(REPO_ROOT8, SKILLS_ROOT));
36423
+ const census = censusSkills(path63.join(REPO_ROOT8, SKILLS_ROOT));
35504
36424
  const usage = stores.map((s) => measureUsage(s, limit));
35505
36425
  process.stdout.write(`${render4(census, usage)}
35506
36426
  `);
@@ -35510,23 +36430,23 @@ var _HERE18, REPO_ROOT8, SKILLS_ROOT, TRIGGER_KEYS, DETERMINISTIC_RE;
35510
36430
  var init_report_skill_activation = __esm({
35511
36431
  "src/scripts/report_skill_activation.ts"() {
35512
36432
  "use strict";
35513
- _HERE18 = fileURLToPath37(import.meta.url);
35514
- REPO_ROOT8 = path61.resolve(path61.dirname(_HERE18), "..", "..");
36433
+ _HERE18 = fileURLToPath39(import.meta.url);
36434
+ REPO_ROOT8 = path63.resolve(path63.dirname(_HERE18), "..", "..");
35515
36435
  SKILLS_ROOT = "src/skills";
35516
36436
  TRIGGER_KEYS = ["triggers:", "trigger_description:", "file_pattern:", "path_prefix:"];
35517
36437
  DETERMINISTIC_RE = /^\s*(?:[-*]\s*)?(?:\*\*)?(MUST|NEVER|ALWAYS)\b/m;
35518
- if (process.argv[1] !== void 0 && import.meta.url === pathToFileURL26(path61.resolve(process.argv[1])).href) {
35519
- process.exit(main26(process.argv.slice(2)));
36438
+ if (process.argv[1] !== void 0 && import.meta.url === pathToFileURL28(path63.resolve(process.argv[1])).href) {
36439
+ process.exit(main28(process.argv.slice(2)));
35520
36440
  }
35521
36441
  }
35522
36442
  });
35523
36443
 
35524
36444
  // src/scripts/report_skill_obligation_violations.ts
35525
- import * as fs61 from "node:fs";
35526
- import * as os15 from "node:os";
35527
- import * as path62 from "node:path";
36445
+ import * as fs63 from "node:fs";
36446
+ import * as os16 from "node:os";
36447
+ import * as path64 from "node:path";
35528
36448
  import process17 from "node:process";
35529
- import { fileURLToPath as fileURLToPath38, pathToFileURL as pathToFileURL27 } from "node:url";
36449
+ import { fileURLToPath as fileURLToPath40, pathToFileURL as pathToFileURL29 } from "node:url";
35530
36450
  function _verb(line) {
35531
36451
  const m = /\b(NEVER|MUST|ALWAYS)\b/.exec(line);
35532
36452
  return m?.[1] ?? "NEVER";
@@ -35545,7 +36465,7 @@ function _artefacts(line) {
35545
36465
  return out;
35546
36466
  }
35547
36467
  function extractObligations(repoRoot) {
35548
- const skillsRoot = path62.join(repoRoot, SKILLS_ROOT);
36468
+ const skillsRoot = path64.join(repoRoot, SKILLS_ROOT);
35549
36469
  const census = censusSkills(skillsRoot);
35550
36470
  const out = {
35551
36471
  skills: census.withDeterministicObligation,
@@ -35559,7 +36479,7 @@ function extractObligations(repoRoot) {
35559
36479
  for (const skill of census.withDeterministicObligation) {
35560
36480
  let text;
35561
36481
  try {
35562
- text = fs61.readFileSync(path62.join(skillsRoot, skill, "SKILL.md"), "utf-8");
36482
+ text = fs63.readFileSync(path64.join(skillsRoot, skill, "SKILL.md"), "utf-8");
35563
36483
  } catch {
35564
36484
  continue;
35565
36485
  }
@@ -35661,7 +36581,7 @@ function scanSessionForViolations(session, lines, forbidden, parsed) {
35661
36581
  return flags;
35662
36582
  }
35663
36583
  function defaultStore3(cwd) {
35664
- return path62.join(os15.homedir(), ".claude", "projects", cwd.replace(/[/.]/g, "-"));
36584
+ return path64.join(os16.homedir(), ".claude", "projects", cwd.replace(/[/.]/g, "-"));
35665
36585
  }
35666
36586
  function scanStore2(repoRoot, store, limit) {
35667
36587
  const census = extractObligations(repoRoot);
@@ -35674,14 +36594,14 @@ function scanStore2(repoRoot, store, limit) {
35674
36594
  };
35675
36595
  let files;
35676
36596
  try {
35677
- files = fs61.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ p: path62.join(store, f), m: fs61.statSync(path62.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.p);
36597
+ files = fs63.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ p: path64.join(store, f), m: fs63.statSync(path64.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.p);
35678
36598
  } catch {
35679
36599
  return report2;
35680
36600
  }
35681
36601
  report2.sessions = files.length;
35682
36602
  for (const file of files) {
35683
- const lines = fs61.readFileSync(file, "utf-8").split("\n");
35684
- const id = path62.basename(file).replace(/\.jsonl$/, "").slice(0, 8);
36603
+ const lines = fs63.readFileSync(file, "utf-8").split("\n");
36604
+ const id = path64.basename(file).replace(/\.jsonl$/, "").slice(0, 8);
35685
36605
  const entries = _parseSession(lines);
35686
36606
  if (loadedSkillsFrom(entries).size > 0) report2.sessionsWithASkill += 1;
35687
36607
  report2.flags.push(...scanSessionForViolations(id, lines, census.forbidden, entries));
@@ -35751,7 +36671,7 @@ function render5(r) {
35751
36671
  lines.push(" ships as detection-only, and this one says so.");
35752
36672
  return lines.join("\n");
35753
36673
  }
35754
- function main27(argv) {
36674
+ function main29(argv) {
35755
36675
  const args = argv ?? process17.argv.slice(2);
35756
36676
  let limit = 30;
35757
36677
  let json = false;
@@ -35804,11 +36724,11 @@ function main27(argv) {
35804
36724
  }
35805
36725
  return 0;
35806
36726
  }
35807
- function _isCliEntry24() {
36727
+ function _isCliEntry26() {
35808
36728
  if (process17.argv[1] === void 0) return false;
35809
- if (import.meta.url === pathToFileURL27(path62.resolve(process17.argv[1])).href) return true;
36729
+ if (import.meta.url === pathToFileURL29(path64.resolve(process17.argv[1])).href) return true;
35810
36730
  try {
35811
- return fs61.realpathSync(_HERE19) === fs61.realpathSync(path62.resolve(process17.argv[1]));
36731
+ return fs63.realpathSync(_HERE19) === fs63.realpathSync(path64.resolve(process17.argv[1]));
35812
36732
  } catch {
35813
36733
  return false;
35814
36734
  }
@@ -35819,8 +36739,8 @@ var init_report_skill_obligation_violations = __esm({
35819
36739
  "use strict";
35820
36740
  init_transcript_entry();
35821
36741
  init_report_skill_activation();
35822
- _HERE19 = fileURLToPath38(import.meta.url);
35823
- REPO_ROOT9 = path62.resolve(path62.dirname(_HERE19), "..", "..");
36742
+ _HERE19 = fileURLToPath40(import.meta.url);
36743
+ REPO_ROOT9 = path64.resolve(path64.dirname(_HERE19), "..", "..");
35824
36744
  OBLIGATION_LINE_RE = new RegExp(`${DETERMINISTIC_RE.source}.*`, "gm");
35825
36745
  PATH_RE = /`([A-Za-z0-9_./-]*\/[A-Za-z0-9_.-]+\.[a-z]{2,6})`/g;
35826
36746
  CMD_RE = /`([a-z][a-z0-9-]*(?: [a-z][a-z0-9:._-]*){1,3})`/g;
@@ -35854,31 +36774,31 @@ var init_report_skill_obligation_violations = __esm({
35854
36774
  SKILL_BODY_RE = /Base directory for this skill:\s*\S*?\/skills\/([A-Za-z0-9_-]+)/;
35855
36775
  PATH_FIELDS = ["file_path", "path", "filePath", "notebook_path", "target_file"];
35856
36776
  COMMAND_FIELDS = ["command", "cmd"];
35857
- if (_isCliEntry24()) {
35858
- process17.exit(main27());
36777
+ if (_isCliEntry26()) {
36778
+ process17.exit(main29());
35859
36779
  }
35860
36780
  }
35861
36781
  });
35862
36782
 
35863
36783
  // src/scripts/report_conformance_funnel.ts
35864
- import * as fs62 from "node:fs";
35865
- import * as os16 from "node:os";
35866
- import * as path63 from "node:path";
36784
+ import * as fs64 from "node:fs";
36785
+ import * as os17 from "node:os";
36786
+ import * as path65 from "node:path";
35867
36787
  import process18 from "node:process";
35868
- import { fileURLToPath as fileURLToPath39, pathToFileURL as pathToFileURL28 } from "node:url";
36788
+ import { fileURLToPath as fileURLToPath41, pathToFileURL as pathToFileURL30 } from "node:url";
35869
36789
  function buildFunnel(opts = {}) {
35870
36790
  const repoRoot = opts.repoRoot ?? REPO_ROOT10;
35871
- const projectRulesDir = opts.projectRulesDir ?? path63.join(repoRoot, PROJECT_RULES);
35872
- const globalRulesDir = opts.globalRulesDir ?? path63.join(os16.homedir(), GLOBAL_RULES);
35873
- const sourceDir = opts.sourceDir ?? path63.join(repoRoot, PROJECTION_SOURCE);
36791
+ const projectRulesDir = opts.projectRulesDir ?? path65.join(repoRoot, PROJECT_RULES);
36792
+ const globalRulesDir = opts.globalRulesDir ?? path65.join(os17.homedir(), GLOBAL_RULES);
36793
+ const sourceDir = opts.sourceDir ?? path65.join(repoRoot, PROJECTION_SOURCE);
35874
36794
  const store = opts.store ?? defaultStore(repoRoot);
35875
36795
  const limit = opts.limit ?? 30;
35876
36796
  return {
35877
36797
  delivered: measureDelivered(projectRulesDir, globalRulesDir),
35878
36798
  divergence: compareCarriers(projectRulesDir, globalRulesDir, sourceDir),
35879
- skills: censusSkills(path63.join(repoRoot, SKILLS_ROOT)),
36799
+ skills: censusSkills(path65.join(repoRoot, SKILLS_ROOT)),
35880
36800
  usage: measureUsage(store, limit),
35881
- storePresent: fs62.existsSync(store),
36801
+ storePresent: fs64.existsSync(store),
35882
36802
  sk2: scanStore2(repoRoot, store, limit)
35883
36803
  };
35884
36804
  }
@@ -36003,7 +36923,7 @@ function render6(r) {
36003
36923
  lines.push("workflow without a measured false-positive rate first (locked policy).");
36004
36924
  return lines.join("\n");
36005
36925
  }
36006
- function main28(argv) {
36926
+ function main30(argv) {
36007
36927
  const args = argv ?? process18.argv.slice(2);
36008
36928
  const opts = {};
36009
36929
  const value = (i) => {
@@ -36019,7 +36939,7 @@ function main28(argv) {
36019
36939
  `);
36020
36940
  return 1;
36021
36941
  }
36022
- const resolved = path63.resolve(v);
36942
+ const resolved = path65.resolve(v);
36023
36943
  if (a === "--store") opts.store = resolved;
36024
36944
  else if (a === "--project") opts.projectRulesDir = resolved;
36025
36945
  else if (a === "--global") opts.globalRulesDir = resolved;
@@ -36049,11 +36969,11 @@ function main28(argv) {
36049
36969
  `);
36050
36970
  return 0;
36051
36971
  }
36052
- function _isCliEntry25() {
36972
+ function _isCliEntry27() {
36053
36973
  if (process18.argv[1] === void 0) return false;
36054
- if (import.meta.url === pathToFileURL28(path63.resolve(process18.argv[1])).href) return true;
36974
+ if (import.meta.url === pathToFileURL30(path65.resolve(process18.argv[1])).href) return true;
36055
36975
  try {
36056
- return fs62.realpathSync(_HERE20) === fs62.realpathSync(path63.resolve(process18.argv[1]));
36976
+ return fs64.realpathSync(_HERE20) === fs64.realpathSync(path65.resolve(process18.argv[1]));
36057
36977
  } catch {
36058
36978
  return false;
36059
36979
  }
@@ -36066,10 +36986,10 @@ var init_report_conformance_funnel = __esm({
36066
36986
  init_report_carrier_divergence();
36067
36987
  init_report_skill_activation();
36068
36988
  init_report_skill_obligation_violations();
36069
- _HERE20 = fileURLToPath39(import.meta.url);
36070
- REPO_ROOT10 = path63.resolve(path63.dirname(_HERE20), "..", "..");
36071
- if (_isCliEntry25()) {
36072
- process18.exit(main28());
36989
+ _HERE20 = fileURLToPath41(import.meta.url);
36990
+ REPO_ROOT10 = path65.resolve(path65.dirname(_HERE20), "..", "..");
36991
+ if (_isCliEntry27()) {
36992
+ process18.exit(main30());
36073
36993
  }
36074
36994
  }
36075
36995
  });
@@ -36090,16 +37010,16 @@ __export(cmd_conformance_exports, {
36090
37010
  conformanceLogPath: () => conformanceLogPath,
36091
37011
  detectSmokePlatform: () => detectSmokePlatform,
36092
37012
  installLogPath: () => installLogPath,
36093
- main: () => main29,
37013
+ main: () => main31,
36094
37014
  routeTargetPaths: () => routeTargetPaths,
36095
37015
  runConformanceChecks: () => runConformanceChecks
36096
37016
  });
36097
- import * as fs63 from "node:fs";
36098
- import * as os17 from "node:os";
36099
- import * as path64 from "node:path";
37017
+ import * as fs65 from "node:fs";
37018
+ import * as os18 from "node:os";
37019
+ import * as path66 from "node:path";
36100
37020
  import process19 from "node:process";
36101
- import { spawnSync as spawnSync9 } from "node:child_process";
36102
- import { fileURLToPath as fileURLToPath40, pathToFileURL as pathToFileURL29 } from "node:url";
37021
+ import { spawnSync as spawnSync10 } from "node:child_process";
37022
+ import { fileURLToPath as fileURLToPath42, pathToFileURL as pathToFileURL31 } from "node:url";
36103
37023
  function print2(s = "") {
36104
37024
  process19.stdout.write(`${s}
36105
37025
  `);
@@ -36113,17 +37033,17 @@ function conformanceLogPath() {
36113
37033
  if (override && override.trim().length > 0) {
36114
37034
  return override;
36115
37035
  }
36116
- return path64.join(os17.homedir(), ".event4u", "agent-config", "conformance-log.jsonl");
37036
+ return path66.join(os18.homedir(), ".event4u", "agent-config", "conformance-log.jsonl");
36117
37037
  }
36118
37038
  function installLogPath() {
36119
37039
  const override = process19.env["AGENT_CONFIG_INSTALL_LOG"];
36120
37040
  if (override && override.trim().length > 0) {
36121
37041
  return override;
36122
37042
  }
36123
- return path64.join(os17.homedir(), ".event4u", "agent-config", "install-log.jsonl");
37043
+ return path66.join(os18.homedir(), ".event4u", "agent-config", "install-log.jsonl");
36124
37044
  }
36125
37045
  function _check_txlog_clean(logPath = installLogPath()) {
36126
- if (!fs63.existsSync(logPath)) {
37046
+ if (!fs65.existsSync(logPath)) {
36127
37047
  return {
36128
37048
  id: "txlog-clean",
36129
37049
  status: "ok",
@@ -36157,11 +37077,11 @@ function _check_txlog_clean(logPath = installLogPath()) {
36157
37077
  };
36158
37078
  }
36159
37079
  function routeTargetPaths(target) {
36160
- return routeTargetPathsPosix(target).map((rel) => path64.join(...rel.split("/")));
37080
+ return routeTargetPathsPosix(target).map((rel) => path66.join(...rel.split("/")));
36161
37081
  }
36162
37082
  function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
36163
- const routerPath = path64.join(packageRoot, "dist", "router.json");
36164
- if (!fs63.existsSync(routerPath)) {
37083
+ const routerPath = path66.join(packageRoot, "dist", "router.json");
37084
+ if (!fs65.existsSync(routerPath)) {
36165
37085
  return {
36166
37086
  id: "router-pointers",
36167
37087
  status: "fail",
@@ -36171,7 +37091,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
36171
37091
  }
36172
37092
  let router;
36173
37093
  try {
36174
- router = JSON.parse(fs63.readFileSync(routerPath, "utf8"));
37094
+ router = JSON.parse(fs65.readFileSync(routerPath, "utf8"));
36175
37095
  } catch (exc) {
36176
37096
  return {
36177
37097
  id: "router-pointers",
@@ -36180,13 +37100,13 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
36180
37100
  remedy: "reinstall the package \u2014 dist/router.json is corrupt"
36181
37101
  };
36182
37102
  }
36183
- const rulesDir = path64.join(packageRoot, "dist", "agent-src", "rules");
37103
+ const rulesDir = path66.join(packageRoot, "dist", "agent-src", "rules");
36184
37104
  const broken = [];
36185
37105
  let ids = 0;
36186
37106
  let targets = 0;
36187
37107
  for (const kernelId of router["kernel"] ?? []) {
36188
37108
  ids += 1;
36189
- if (!fs63.existsSync(path64.join(rulesDir, `${kernelId}.md`))) {
37109
+ if (!fs65.existsSync(path66.join(rulesDir, `${kernelId}.md`))) {
36190
37110
  broken.push(`kernel:${kernelId} \u2192 rules/${kernelId}.md missing`);
36191
37111
  }
36192
37112
  }
@@ -36194,7 +37114,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
36194
37114
  for (const entry of router[tier] ?? []) {
36195
37115
  const ruleId = String(entry["id"] ?? "");
36196
37116
  ids += 1;
36197
- if (!fs63.existsSync(path64.join(rulesDir, `${ruleId}.md`))) {
37117
+ if (!fs65.existsSync(path66.join(rulesDir, `${ruleId}.md`))) {
36198
37118
  broken.push(`${tier}:${ruleId} \u2192 rules/${ruleId}.md missing`);
36199
37119
  }
36200
37120
  for (const target of entry["routes_to"] ?? []) {
@@ -36204,7 +37124,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
36204
37124
  broken.push(`${ruleId} \u2192 unparseable routes_to ${JSON.stringify(target)}`);
36205
37125
  continue;
36206
37126
  }
36207
- if (!candidates.some((rel) => fs63.existsSync(path64.join(packageRoot, rel)))) {
37127
+ if (!candidates.some((rel) => fs65.existsSync(path66.join(packageRoot, rel)))) {
36208
37128
  broken.push(`${ruleId} \u2192 ${target} (${candidates[0]} missing)`);
36209
37129
  }
36210
37130
  }
@@ -36236,9 +37156,9 @@ function detectSmokePlatform(projectRoot) {
36236
37156
  return "claude";
36237
37157
  }
36238
37158
  function dispatcherRunner(packageRoot) {
36239
- const localTsx = path64.join(packageRoot, "node_modules", ".bin", "tsx");
36240
- const script = path64.join(packageRoot, "src", "scripts", "hooks", "dispatch_hook.ts");
36241
- if (fs63.existsSync(localTsx)) {
37159
+ const localTsx = path66.join(packageRoot, "node_modules", ".bin", "tsx");
37160
+ const script = path66.join(packageRoot, "src", "scripts", "hooks", "dispatch_hook.ts");
37161
+ if (fs65.existsSync(localTsx)) {
36242
37162
  return [localTsx, script];
36243
37163
  }
36244
37164
  return ["npx", "tsx", script];
@@ -36255,7 +37175,7 @@ function _check_hook_dispatcher(projectRoot, packageRoot = PACKAGE_ROOT2, opts =
36255
37175
  ...event === "stop" ? { stop_reason: "conformance-smoke" } : { source: "startup" }
36256
37176
  });
36257
37177
  const argv = [...runner, "--platform", platform, "--event", event];
36258
- const proc = spawnSync9(argv[0], argv.slice(1), {
37178
+ const proc = spawnSync10(argv[0], argv.slice(1), {
36259
37179
  input: payload,
36260
37180
  cwd: projectRoot,
36261
37181
  encoding: "utf8",
@@ -36288,12 +37208,12 @@ function _check_hook_dispatcher(projectRoot, packageRoot = PACKAGE_ROOT2, opts =
36288
37208
  };
36289
37209
  }
36290
37210
  function readSettingsMode(projectRoot) {
36291
- const settingsPath = path64.join(projectRoot, ".agent-settings.yml");
36292
- if (!fs63.existsSync(settingsPath)) {
37211
+ const settingsPath = path66.join(projectRoot, ".agent-settings.yml");
37212
+ if (!fs65.existsSync(settingsPath)) {
36293
37213
  return "eager-all";
36294
37214
  }
36295
37215
  try {
36296
- const parsed = YAML7.parse(fs63.readFileSync(settingsPath, "utf8"));
37216
+ const parsed = YAML7.parse(fs65.readFileSync(settingsPath, "utf8"));
36297
37217
  const lean = parsed?.["lean_projection"] ?? null;
36298
37218
  const mode = lean?.["mode"];
36299
37219
  return typeof mode === "string" && mode.length > 0 ? mode : "eager-all";
@@ -36304,7 +37224,7 @@ function readSettingsMode(projectRoot) {
36304
37224
  function kernelIdsFromRouter(packageRoot) {
36305
37225
  try {
36306
37226
  const router = JSON.parse(
36307
- fs63.readFileSync(path64.join(packageRoot, "dist", "router.json"), "utf8")
37227
+ fs65.readFileSync(path66.join(packageRoot, "dist", "router.json"), "utf8")
36308
37228
  );
36309
37229
  return new Set((router["kernel"] ?? []).map(String));
36310
37230
  } catch {
@@ -36321,8 +37241,8 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
36321
37241
  remedy: "set lean_projection.mode to 'eager-all' or 'thin' in .agent-settings.yml"
36322
37242
  };
36323
37243
  }
36324
- const rulesDir = projectedRulesDir ?? path64.join(projectRoot, ".augment", "rules");
36325
- if (!fs63.existsSync(rulesDir)) {
37244
+ const rulesDir = projectedRulesDir ?? path66.join(projectRoot, ".augment", "rules");
37245
+ if (!fs65.existsSync(rulesDir)) {
36326
37246
  return {
36327
37247
  id: "lean-projection",
36328
37248
  status: "skipped",
@@ -36331,7 +37251,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
36331
37251
  };
36332
37252
  }
36333
37253
  const kernel = kernelIdsFromRouter(packageRoot);
36334
- const files = fs63.readdirSync(rulesDir).filter((f) => f.endsWith(".md") && f !== "INDEX.md").sort();
37254
+ const files = fs65.readdirSync(rulesDir).filter((f) => f.endsWith(".md") && f !== "INDEX.md").sort();
36335
37255
  const nonKernel = files.filter((f) => !kernel.has(f.replace(/\.md$/, "")));
36336
37256
  if (nonKernel.length === 0) {
36337
37257
  return {
@@ -36345,7 +37265,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
36345
37265
  for (const f of nonKernel) {
36346
37266
  let text = "";
36347
37267
  try {
36348
- text = fs63.readFileSync(path64.join(rulesDir, f), "utf8");
37268
+ text = fs65.readFileSync(path66.join(rulesDir, f), "utf8");
36349
37269
  } catch {
36350
37270
  continue;
36351
37271
  }
@@ -36376,8 +37296,8 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
36376
37296
  function _check_host_manifest(projectRoot) {
36377
37297
  const detected = Object.entries(detectToolPresence(projectRoot)).filter(([, v]) => v === true).map(([k]) => k);
36378
37298
  const detectedNote = detected.length > 0 ? `detected surfaces: ${detected.join(", ")}` : "no surfaces detected";
36379
- const settingsPath = path64.join(projectRoot, ".agent-settings.yml");
36380
- if (!fs63.existsSync(settingsPath)) {
37299
+ const settingsPath = path66.join(projectRoot, ".agent-settings.yml");
37300
+ if (!fs65.existsSync(settingsPath)) {
36381
37301
  return {
36382
37302
  id: "host-manifest",
36383
37303
  status: "ok",
@@ -36387,7 +37307,7 @@ function _check_host_manifest(projectRoot) {
36387
37307
  }
36388
37308
  let parsed = null;
36389
37309
  try {
36390
- parsed = YAML7.parse(fs63.readFileSync(settingsPath, "utf8"));
37310
+ parsed = YAML7.parse(fs65.readFileSync(settingsPath, "utf8"));
36391
37311
  } catch (exc) {
36392
37312
  return {
36393
37313
  id: "host-manifest",
@@ -36485,7 +37405,7 @@ function _parse4(argv) {
36485
37405
  }
36486
37406
  return opts;
36487
37407
  }
36488
- function main29(argv = null) {
37408
+ function main31(argv = null) {
36489
37409
  const opts = _parse4(argv !== null ? Array.from(argv) : process19.argv.slice(2));
36490
37410
  if (opts.funnel) {
36491
37411
  print2(render6(buildFunnel()));
@@ -36556,17 +37476,17 @@ function main29(argv = null) {
36556
37476
  }
36557
37477
  return failed ? 1 : 0;
36558
37478
  }
36559
- function _isCliEntry26() {
37479
+ function _isCliEntry28() {
36560
37480
  if (process19.argv[1] === void 0) {
36561
37481
  return false;
36562
37482
  }
36563
- const argvUrl = pathToFileURL29(path64.resolve(process19.argv[1])).href;
37483
+ const argvUrl = pathToFileURL31(path66.resolve(process19.argv[1])).href;
36564
37484
  if (import.meta.url === argvUrl) {
36565
37485
  return true;
36566
37486
  }
36567
37487
  try {
36568
- const here = fs63.realpathSync(fileURLToPath40(import.meta.url));
36569
- const argv = fs63.realpathSync(path64.resolve(process19.argv[1]));
37488
+ const here = fs65.realpathSync(fileURLToPath42(import.meta.url));
37489
+ const argv = fs65.realpathSync(path66.resolve(process19.argv[1]));
36570
37490
  return here === argv;
36571
37491
  } catch {
36572
37492
  return false;
@@ -36585,7 +37505,7 @@ var init_cmd_conformance = __esm({
36585
37505
  init_router_target_paths();
36586
37506
  init_report_conformance_funnel();
36587
37507
  init_cmd_doctor();
36588
- _HERE21 = fileURLToPath40(import.meta.url);
37508
+ _HERE21 = fileURLToPath42(import.meta.url);
36589
37509
  PACKAGE_ROOT2 = resolvePackageRoot(import.meta.url);
36590
37510
  CONFORMANCE_CHECK_IDS = [
36591
37511
  "txlog-clean",
@@ -36596,9 +37516,9 @@ var init_cmd_conformance = __esm({
36596
37516
  ];
36597
37517
  THIN_STUB_MARKER = "Routed rule \u2014 load the body on trigger-match";
36598
37518
  USAGE3 = "usage: agent-config conformance [-h] [--project PROJECT] [--json]\n [--skip-dispatcher] [--funnel]\n";
36599
- if (_isCliEntry26() || process19.argv[1] === _HERE21) {
37519
+ if (_isCliEntry28() || process19.argv[1] === _HERE21) {
36600
37520
  try {
36601
- process19.exitCode = main29(process19.argv.slice(2));
37521
+ process19.exitCode = main31(process19.argv.slice(2));
36602
37522
  } catch (e) {
36603
37523
  if (e instanceof ArgparseExit4) {
36604
37524
  process19.exitCode = e.code;
@@ -36624,7 +37544,7 @@ __export(settings_exports, {
36624
37544
  read_tier_usage_settings: () => read_tier_usage_settings
36625
37545
  });
36626
37546
  import { createRequire as createRequire6 } from "node:module";
36627
- import * as fs64 from "node:fs";
37547
+ import * as fs66 from "node:fs";
36628
37548
  function _isPlainObject8(v) {
36629
37549
  return typeof v === "object" && v !== null && !Array.isArray(v) && !(v instanceof Date);
36630
37550
  }
@@ -36661,7 +37581,7 @@ function _coerce_path(value, def) {
36661
37581
  }
36662
37582
  function _isFile13(p) {
36663
37583
  try {
36664
- return fs64.statSync(p).isFile();
37584
+ return fs66.statSync(p).isFile();
36665
37585
  } catch {
36666
37586
  return false;
36667
37587
  }
@@ -36672,7 +37592,7 @@ function read_settings(p) {
36672
37592
  if (_isFile13(p)) {
36673
37593
  let raw = {};
36674
37594
  try {
36675
- raw = YAML8.parse(fs64.readFileSync(p, "utf-8"), { version: "1.1" });
37595
+ raw = YAML8.parse(fs66.readFileSync(p, "utf-8"), { version: "1.1" });
36676
37596
  if (raw === null || raw === void 0) {
36677
37597
  raw = {};
36678
37598
  }
@@ -36706,7 +37626,7 @@ function read_tier_usage_settings(p) {
36706
37626
  if (_isFile13(p)) {
36707
37627
  let raw = {};
36708
37628
  try {
36709
- raw = YAML8.parse(fs64.readFileSync(p, "utf-8"), { version: "1.1" });
37629
+ raw = YAML8.parse(fs66.readFileSync(p, "utf-8"), { version: "1.1" });
36710
37630
  if (raw === null || raw === void 0) {
36711
37631
  raw = {};
36712
37632
  }
@@ -37244,7 +38164,7 @@ __export(aggregator_exports, {
37244
38164
  aggregate: () => aggregate2,
37245
38165
  rank_artefacts: () => rank_artefacts
37246
38166
  });
37247
- import * as fs65 from "node:fs";
38167
+ import * as fs67 from "node:fs";
37248
38168
  function _key(kind, artId) {
37249
38169
  return `${kind}\0${artId}`;
37250
38170
  }
@@ -37281,7 +38201,7 @@ function* _iter_events(log_path) {
37281
38201
  if (!_isFile14(log_path)) {
37282
38202
  return;
37283
38203
  }
37284
- const text = fs65.readFileSync(log_path, "utf-8");
38204
+ const text = fs67.readFileSync(log_path, "utf-8");
37285
38205
  const lines = _pyFileLines(text);
37286
38206
  let lineNo = 0;
37287
38207
  for (const line of lines) {
@@ -37315,7 +38235,7 @@ function _pyFileLines(text) {
37315
38235
  }
37316
38236
  function _isFile14(p) {
37317
38237
  try {
37318
- return fs65.statSync(p).isFile();
38238
+ return fs67.statSync(p).isFile();
37319
38239
  } catch {
37320
38240
  return false;
37321
38241
  }
@@ -37659,14 +38579,14 @@ function _pyRound5(value, ndigits = 0) {
37659
38579
  }
37660
38580
  const sign = value < 0 ? -1 : 1;
37661
38581
  const abs = Math.abs(value);
37662
- const str = abs.toPrecision(17);
37663
- if (str.includes("e") || str.includes("E")) {
38582
+ const str3 = abs.toPrecision(17);
38583
+ if (str3.includes("e") || str3.includes("E")) {
37664
38584
  const factor = 10 ** ndigits;
37665
38585
  return value > 0 ? Math.round(abs * factor) / factor * sign : -Math.round(abs * factor) / factor;
37666
38586
  }
37667
- const dot = str.indexOf(".");
37668
- const intPart = dot === -1 ? str : str.slice(0, dot);
37669
- let fracPart = dot === -1 ? "" : str.slice(dot + 1);
38587
+ const dot = str3.indexOf(".");
38588
+ const intPart = dot === -1 ? str3 : str3.slice(0, dot);
38589
+ let fracPart = dot === -1 ? "" : str3.slice(dot + 1);
37670
38590
  while (fracPart.length <= ndigits) {
37671
38591
  fracPart += "0";
37672
38592
  }
@@ -37694,13 +38614,13 @@ function _pyFixed(value, ndigits) {
37694
38614
  }
37695
38615
  const sign = value < 0 ? "-" : "";
37696
38616
  const abs = Math.abs(value);
37697
- const str = abs.toPrecision(17);
37698
- if (str.includes("e") || str.includes("E")) {
38617
+ const str3 = abs.toPrecision(17);
38618
+ if (str3.includes("e") || str3.includes("E")) {
37699
38619
  return sign + abs.toFixed(ndigits);
37700
38620
  }
37701
- const dot = str.indexOf(".");
37702
- const intPart = dot === -1 ? str : str.slice(0, dot);
37703
- let fracPart = dot === -1 ? "" : str.slice(dot + 1);
38621
+ const dot = str3.indexOf(".");
38622
+ const intPart = dot === -1 ? str3 : str3.slice(0, dot);
38623
+ let fracPart = dot === -1 ? "" : str3.slice(dot + 1);
37704
38624
  while (fracPart.length <= ndigits) {
37705
38625
  fracPart += "0";
37706
38626
  }
@@ -37829,7 +38749,7 @@ var init_report_renderer = __esm({
37829
38749
  });
37830
38750
 
37831
38751
  // src/scripts/ai_council/bundler.ts
37832
- import * as fs66 from "node:fs";
38752
+ import * as fs68 from "node:fs";
37833
38753
  function _context(mode, text, manifest = [], excluded = []) {
37834
38754
  return { mode, text, manifest, excluded };
37835
38755
  }
@@ -37887,10 +38807,10 @@ function bundle_prompt(text) {
37887
38807
  return _context("prompt", _enforceSize(redacted, "prompt"), ["<inline prompt>"]);
37888
38808
  }
37889
38809
  function bundle_roadmap(p) {
37890
- if (!fs66.existsSync(p)) {
38810
+ if (!fs68.existsSync(p)) {
37891
38811
  throw new FileNotFoundError2(`Roadmap not found: ${p}`);
37892
38812
  }
37893
- const raw = fs66.readFileSync(p, { encoding: "utf-8" });
38813
+ const raw = fs68.readFileSync(p, { encoding: "utf-8" });
37894
38814
  const redacted = redact(raw);
37895
38815
  return _context(
37896
38816
  "roadmap",
@@ -38501,8 +39421,8 @@ not. Cite the peer-reviewer label and the targeted response label
38501
39421
  });
38502
39422
 
38503
39423
  // src/scripts/ai_council/advisors.ts
38504
- import * as fs67 from "node:fs";
38505
- import * as path65 from "node:path";
39424
+ import * as fs69 from "node:fs";
39425
+ import * as path67 from "node:path";
38506
39426
  function _split_frontmatter2(raw) {
38507
39427
  const match = _FRONTMATTER_RE2.exec(raw);
38508
39428
  if (!match) {
@@ -38530,12 +39450,12 @@ function _display_name_from(advisor_name, frontmatter) {
38530
39450
  }
38531
39451
  function resolve_persona_text(persona_path, repo_root) {
38532
39452
  const candidates = [
38533
- path65.join(repo_root, "dist/agent-src", persona_path),
38534
- path65.join(repo_root, ".agent-src.uncondensed", persona_path)
39453
+ path67.join(repo_root, "dist/agent-src", persona_path),
39454
+ path67.join(repo_root, ".agent-src.uncondensed", persona_path)
38535
39455
  ];
38536
39456
  for (const candidate of candidates) {
38537
- if (fs67.existsSync(candidate)) {
38538
- const raw = fs67.readFileSync(candidate, "utf-8");
39457
+ if (fs69.existsSync(candidate)) {
39458
+ const raw = fs69.readFileSync(candidate, "utf-8");
38539
39459
  const [meta, body] = _split_frontmatter2(raw);
38540
39460
  return [body.trim(), meta];
38541
39461
  }
@@ -38839,7 +39759,7 @@ __export(low_impact_corpus_exports, {
38839
39759
  load_validated_phrases: () => load_validated_phrases,
38840
39760
  parse_corpus_strict: () => parse_corpus_strict
38841
39761
  });
38842
- import * as fs68 from "node:fs";
39762
+ import * as fs70 from "node:fs";
38843
39763
  function _entry(phrase, normalised, section, line_no, trailing_metadata = "") {
38844
39764
  return { phrase, normalised, section, line_no, trailing_metadata };
38845
39765
  }
@@ -39012,10 +39932,10 @@ function _checkHeadingDrift(text, title) {
39012
39932
  }
39013
39933
  function parse_corpus_strict(corpusPath) {
39014
39934
  const p = corpusPath;
39015
- if (!fs68.existsSync(p)) {
39935
+ if (!fs70.existsSync(p)) {
39016
39936
  return new CorpusParseResult();
39017
39937
  }
39018
- const text = fs68.readFileSync(p, { encoding: "utf-8" });
39938
+ const text = fs70.readFileSync(p, { encoding: "utf-8" });
39019
39939
  const allTitles = _SECTION_KEYS.map((k) => _SECTION_TITLES[k]);
39020
39940
  const resultSections = {
39021
39941
  validated: [],
@@ -39078,10 +39998,10 @@ function load_anti_example_phrases(corpusPath) {
39078
39998
  }
39079
39999
  function load_corpus_lock(yamlPath) {
39080
40000
  const p = yamlPath;
39081
- if (!fs68.existsSync(p)) {
40001
+ if (!fs70.existsSync(p)) {
39082
40002
  return new CorpusParseResult();
39083
40003
  }
39084
- const parsed = (0, import_yaml7.parse)(fs68.readFileSync(p, { encoding: "utf-8" }), { version: "1.1" });
40004
+ const parsed = (0, import_yaml7.parse)(fs70.readFileSync(p, { encoding: "utf-8" }), { version: "1.1" });
39085
40005
  const doc = parsed === null || parsed === void 0 ? {} : parsed;
39086
40006
  const schemaVersion = doc["schema_version"];
39087
40007
  if (schemaVersion !== 1) {
@@ -39143,7 +40063,7 @@ function _deriveLockPath(corpusPath) {
39143
40063
  }
39144
40064
  function _loadSectionFromLock(corpusPath, section) {
39145
40065
  const lockPath = _deriveLockPath(corpusPath);
39146
- if (!fs68.existsSync(lockPath)) {
40066
+ if (!fs70.existsSync(lockPath)) {
39147
40067
  return null;
39148
40068
  }
39149
40069
  try {
@@ -39155,10 +40075,10 @@ function _loadSectionFromLock(corpusPath, section) {
39155
40075
  }
39156
40076
  function _loadSectionLenient(corpusPath, section) {
39157
40077
  const p = corpusPath;
39158
- if (!fs68.existsSync(p)) {
40078
+ if (!fs70.existsSync(p)) {
39159
40079
  return [];
39160
40080
  }
39161
- const text = fs68.readFileSync(p, { encoding: "utf-8" });
40081
+ const text = fs70.readFileSync(p, { encoding: "utf-8" });
39162
40082
  const allTitles = _SECTION_KEYS.map((k) => _SECTION_TITLES[k]);
39163
40083
  const bounds = _sectionBounds(text, _SECTION_TITLES[section], allTitles);
39164
40084
  if (bounds === null) {
@@ -39938,8 +40858,8 @@ var init_necessity = __esm({
39938
40858
  });
39939
40859
 
39940
40860
  // src/scripts/ai_council/budget_guard.ts
39941
- import * as fs69 from "node:fs";
39942
- import * as path66 from "node:path";
40861
+ import * as fs71 from "node:fs";
40862
+ import * as path68 from "node:path";
39943
40863
  function _resolveLedgerPath(p) {
39944
40864
  if (p !== null) {
39945
40865
  return p;
@@ -39954,18 +40874,18 @@ function _nowUtcMs() {
39954
40874
  return Date.now();
39955
40875
  }
39956
40876
  function _ensureLedgerDir(p) {
39957
- const parent = path66.dirname(p);
40877
+ const parent = path68.dirname(p);
39958
40878
  try {
39959
- fs69.mkdirSync(parent, { recursive: true });
40879
+ fs71.mkdirSync(parent, { recursive: true });
39960
40880
  let mode;
39961
40881
  try {
39962
- mode = fs69.statSync(parent).mode & 511;
40882
+ mode = fs71.statSync(parent).mode & 511;
39963
40883
  } catch {
39964
40884
  mode = 448;
39965
40885
  }
39966
40886
  if (mode !== 448) {
39967
40887
  try {
39968
- fs69.chmodSync(parent, 448);
40888
+ fs71.chmodSync(parent, 448);
39969
40889
  } catch {
39970
40890
  }
39971
40891
  }
@@ -39977,18 +40897,18 @@ function _ensureLedgerDir(p) {
39977
40897
  }
39978
40898
  }
39979
40899
  function _ensureLedgerFileMode(p) {
39980
- if (!fs69.existsSync(p)) {
40900
+ if (!fs71.existsSync(p)) {
39981
40901
  return;
39982
40902
  }
39983
40903
  let current;
39984
40904
  try {
39985
- current = fs69.statSync(p).mode & 511;
40905
+ current = fs71.statSync(p).mode & 511;
39986
40906
  } catch {
39987
40907
  return;
39988
40908
  }
39989
40909
  if (current !== 384) {
39990
40910
  try {
39991
- fs69.chmodSync(p, 384);
40911
+ fs71.chmodSync(p, 384);
39992
40912
  } catch {
39993
40913
  }
39994
40914
  }
@@ -40140,11 +41060,11 @@ function pyNumToStr(n) {
40140
41060
  }
40141
41061
  function read_entries2(p = null) {
40142
41062
  const resolved = _resolveLedgerPath(p);
40143
- if (!fs69.existsSync(resolved)) {
41063
+ if (!fs71.existsSync(resolved)) {
40144
41064
  return [];
40145
41065
  }
40146
41066
  const out = [];
40147
- const text = fs69.readFileSync(resolved, "utf-8");
41067
+ const text = fs71.readFileSync(resolved, "utf-8");
40148
41068
  for (const rawLine of text.split(/\r\n|\r|\n/u)) {
40149
41069
  const line = rawLine.trim();
40150
41070
  if (line === "") {
@@ -40247,7 +41167,7 @@ function record_spend(usd, provider, model, options = {}) {
40247
41167
  )}
40248
41168
  `;
40249
41169
  try {
40250
- fs69.appendFileSync(p, entry, { encoding: "utf-8" });
41170
+ fs71.appendFileSync(p, entry, { encoding: "utf-8" });
40251
41171
  } catch (exc) {
40252
41172
  process.stderr.write(`[council:budget_guard] write failed: ${_errStr(exc)}
40253
41173
  `);
@@ -40263,12 +41183,12 @@ function _pyRound6(value) {
40263
41183
  const ndigits = 6;
40264
41184
  const sign = value < 0 ? -1 : 1;
40265
41185
  const abs = Math.abs(value);
40266
- const str = abs.toPrecision(17);
40267
- if (str.includes("e") || str.includes("E")) {
41186
+ const str3 = abs.toPrecision(17);
41187
+ if (str3.includes("e") || str3.includes("E")) {
40268
41188
  const factor = 10 ** ndigits;
40269
41189
  return value > 0 ? Math.round(abs * factor) / factor * sign : -Math.round(abs * factor) / factor;
40270
41190
  }
40271
- const [intPart, fracPartRaw = ""] = str.split(".");
41191
+ const [intPart, fracPartRaw = ""] = str3.split(".");
40272
41192
  let fracPart = fracPartRaw;
40273
41193
  while (fracPart.length <= ndigits) {
40274
41194
  fracPart += "0";
@@ -40309,12 +41229,12 @@ function pyRound(value, ndigits = 0) {
40309
41229
  }
40310
41230
  const sign = value < 0 ? -1 : 1;
40311
41231
  const abs = Math.abs(value);
40312
- let str = abs.toPrecision(17);
40313
- if (str.includes("e") || str.includes("E")) {
41232
+ let str3 = abs.toPrecision(17);
41233
+ if (str3.includes("e") || str3.includes("E")) {
40314
41234
  const factor2 = 10 ** ndigits;
40315
41235
  return value > 0 ? Math.round(abs * factor2) / factor2 * sign : -Math.round(abs * factor2) / factor2;
40316
41236
  }
40317
- let [intPart, fracPart = ""] = str.split(".");
41237
+ let [intPart, fracPart = ""] = str3.split(".");
40318
41238
  while (fracPart.length <= ndigits) {
40319
41239
  fracPart += "0";
40320
41240
  }
@@ -40370,8 +41290,8 @@ function aggregate_scores(findings, scores) {
40370
41290
  by_id.get(s.finding_id).push(s);
40371
41291
  }
40372
41292
  const out = /* @__PURE__ */ new Map();
40373
- for (const [fid, fs74] of by_id) {
40374
- if (fs74.length === 0) {
41293
+ for (const [fid, fs76] of by_id) {
41294
+ if (fs76.length === 0) {
40375
41295
  out.set(
40376
41296
  fid,
40377
41297
  new ConsensusMetadata({
@@ -40387,13 +41307,13 @@ function aggregate_scores(findings, scores) {
40387
41307
  );
40388
41308
  continue;
40389
41309
  }
40390
- const mean2 = fs74.reduce((acc, s) => acc + s.score, 0) / fs74.length;
40391
- const agree_rate = fs74.filter((s) => s.agree).length / fs74.length;
41310
+ const mean2 = fs76.reduce((acc, s) => acc + s.score, 0) / fs76.length;
41311
+ const agree_rate = fs76.filter((s) => s.agree).length / fs76.length;
40392
41312
  const strength = mean2 / 10 * agree_rate;
40393
- const dissent = fs74.filter((s) => !s.agree).length;
40394
- const concur = fs74.filter((s) => s.agree).length;
40395
- const scorers = fs74.map((s) => s.scorer);
40396
- const dissent_reasons = fs74.filter((s) => !s.agree).map((s) => [s.scorer, s.reason]);
41313
+ const dissent = fs76.filter((s) => !s.agree).length;
41314
+ const concur = fs76.filter((s) => s.agree).length;
41315
+ const scorers = fs76.map((s) => s.scorer);
41316
+ const dissent_reasons = fs76.filter((s) => !s.agree).map((s) => [s.scorer, s.reason]);
40397
41317
  const mean_rounded = pyRound(mean2, 2);
40398
41318
  out.set(
40399
41319
  fid,
@@ -40868,9 +41788,9 @@ var init_stance_tally = __esm({
40868
41788
  });
40869
41789
 
40870
41790
  // src/scripts/ai_council/blind_review.ts
40871
- import { createHash as createHash9 } from "node:crypto";
41791
+ import { createHash as createHash11 } from "node:crypto";
40872
41792
  function _sha256_hex(s) {
40873
- return createHash9("sha256").update(s, "utf-8").digest("hex");
41793
+ return createHash11("sha256").update(s, "utf-8").digest("hex");
40874
41794
  }
40875
41795
  function deterministic_shuffle_indices(seed, n) {
40876
41796
  const keyed = Array.from({ length: n }, (_, i) => ({ i, key: _sha256_hex(`${seed}\0${i}`) }));
@@ -42328,18 +43248,18 @@ __export(project_context_exports, {
42328
43248
  REPO_PURPOSE_MAX_CHARS: () => REPO_PURPOSE_MAX_CHARS,
42329
43249
  detect_project_context: () => detect_project_context
42330
43250
  });
42331
- import * as fs70 from "node:fs";
42332
- import * as path67 from "node:path";
43251
+ import * as fs72 from "node:fs";
43252
+ import * as path69 from "node:path";
42333
43253
  function _isPlainObject11(v) {
42334
43254
  return typeof v === "object" && v !== null && !Array.isArray(v);
42335
43255
  }
42336
43256
  function _read_json(p) {
42337
- if (!fs70.existsSync(p)) {
43257
+ if (!fs72.existsSync(p)) {
42338
43258
  return null;
42339
43259
  }
42340
43260
  let raw;
42341
43261
  try {
42342
- raw = fs70.readFileSync(p, "utf-8");
43262
+ raw = fs72.readFileSync(p, "utf-8");
42343
43263
  } catch {
42344
43264
  return null;
42345
43265
  }
@@ -42361,7 +43281,7 @@ function _name_from(composer, pkg, root) {
42361
43281
  }
42362
43282
  }
42363
43283
  try {
42364
- const base = path67.basename(root);
43284
+ const base = path69.basename(root);
42365
43285
  return base || null;
42366
43286
  } catch {
42367
43287
  return null;
@@ -42430,12 +43350,12 @@ function _splitlines10(text) {
42430
43350
  return parts;
42431
43351
  }
42432
43352
  function _purpose_from_readme(p) {
42433
- if (!fs70.existsSync(p)) {
43353
+ if (!fs72.existsSync(p)) {
42434
43354
  return null;
42435
43355
  }
42436
43356
  let text;
42437
43357
  try {
42438
- text = fs70.readFileSync(p, "utf-8");
43358
+ text = fs72.readFileSync(p, "utf-8");
42439
43359
  } catch {
42440
43360
  return null;
42441
43361
  }
@@ -42519,13 +43439,13 @@ function _rfind(haystack, needle) {
42519
43439
  return -1;
42520
43440
  }
42521
43441
  function detect_project_context(root) {
42522
- const resolvedRoot = path67.resolve(root ?? process.cwd());
42523
- const composer = _read_json(path67.join(resolvedRoot, "composer.json"));
42524
- const pkg = _read_json(path67.join(resolvedRoot, "package.json"));
43442
+ const resolvedRoot = path69.resolve(root ?? process.cwd());
43443
+ const composer = _read_json(path69.join(resolvedRoot, "composer.json"));
43444
+ const pkg = _read_json(path69.join(resolvedRoot, "package.json"));
42525
43445
  return new ProjectContext(
42526
43446
  _name_from(composer, pkg, resolvedRoot),
42527
43447
  _stack_from(composer, pkg),
42528
- _purpose_from_readme(path67.join(resolvedRoot, "README.md"))
43448
+ _purpose_from_readme(path69.join(resolvedRoot, "README.md"))
42529
43449
  );
42530
43450
  }
42531
43451
  var REPO_PURPOSE_MAX_CHARS, _HEADING_RE, _BADGE_RE, _HTML_RE, ProjectContext;
@@ -42795,8 +43715,8 @@ __export(shadow_dispatch_exports, {
42795
43715
  slo_banner: () => slo_banner,
42796
43716
  slo_status: () => slo_status
42797
43717
  });
42798
- import * as fs71 from "node:fs";
42799
- import { createHash as createHash10 } from "node:crypto";
43718
+ import * as fs73 from "node:fs";
43719
+ import { createHash as createHash12 } from "node:crypto";
42800
43720
  function should_shadow(sampleRate, opts = {}) {
42801
43721
  const rate = Math.max(0, Math.min(1, sampleRate));
42802
43722
  const rng = opts.rng ?? null;
@@ -42805,7 +43725,7 @@ function should_shadow(sampleRate, opts = {}) {
42805
43725
  }
42806
43726
  function _hashQuery(query) {
42807
43727
  const redacted = redact(query);
42808
- return createHash10("sha256").update(Buffer.from(redacted, "utf-8")).digest("hex").slice(0, 16);
43728
+ return createHash12("sha256").update(Buffer.from(redacted, "utf-8")).digest("hex").slice(0, 16);
42809
43729
  }
42810
43730
  function _privacyDropped(redacted) {
42811
43731
  const stripped = _strip7(redacted);
@@ -42833,7 +43753,7 @@ function record_shadow_decision(logPath, opts) {
42833
43753
  escalated,
42834
43754
  escalation_reason: escalationReason
42835
43755
  };
42836
- fs71.mkdirSync(_dirname2(logPath), { recursive: true });
43756
+ fs73.mkdirSync(_dirname2(logPath), { recursive: true });
42837
43757
  const row = _pyJsonDumps2({
42838
43758
  timestamp: decision.timestamp,
42839
43759
  query_hash: decision.query_hash,
@@ -42843,7 +43763,7 @@ function record_shadow_decision(logPath, opts) {
42843
43763
  escalated: decision.escalated,
42844
43764
  escalation_reason: decision.escalation_reason
42845
43765
  }) + "\n";
42846
- fs71.appendFileSync(logPath, row, { encoding: "utf-8" });
43766
+ fs73.appendFileSync(logPath, row, { encoding: "utf-8" });
42847
43767
  return decision;
42848
43768
  }
42849
43769
  function _isoNowSeconds() {
@@ -42852,10 +43772,10 @@ function _isoNowSeconds() {
42852
43772
  return `${pad(d.getUTCFullYear(), 4)}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())}T${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}:${pad(d.getUTCSeconds())}+00:00`;
42853
43773
  }
42854
43774
  function* _iterLog(logPath) {
42855
- if (!fs71.existsSync(logPath)) {
43775
+ if (!fs73.existsSync(logPath)) {
42856
43776
  return;
42857
43777
  }
42858
- const content = fs71.readFileSync(logPath, { encoding: "utf-8" });
43778
+ const content = fs73.readFileSync(logPath, { encoding: "utf-8" });
42859
43779
  for (const rawLine of _splitlines11(content)) {
42860
43780
  const line = _strip7(rawLine);
42861
43781
  if (!line) {
@@ -43776,11 +44696,11 @@ __export(council_cli_exports, {
43776
44696
  cmd_status: () => cmd_status,
43777
44697
  format_estimate_table: () => format_estimate_table,
43778
44698
  load_settings: () => load_settings,
43779
- main: () => main30
44699
+ main: () => main32
43780
44700
  });
43781
- import * as fs72 from "node:fs";
43782
- import * as path68 from "node:path";
43783
- import { fileURLToPath as fileURLToPath41, pathToFileURL as pathToFileURL30 } from "node:url";
44701
+ import * as fs74 from "node:fs";
44702
+ import * as path70 from "node:path";
44703
+ import { fileURLToPath as fileURLToPath43, pathToFileURL as pathToFileURL32 } from "node:url";
43784
44704
  function _pyFixed6(x, ndigits) {
43785
44705
  if (!Number.isFinite(x)) {
43786
44706
  return String(x);
@@ -43988,7 +44908,7 @@ function _stderr2(s) {
43988
44908
  function load_settings(p = SETTINGS_FILE2, opts = {}) {
43989
44909
  const ai_council_path = opts.ai_council_path ?? AI_COUNCIL_FILE;
43990
44910
  const settings = load_agent_settings({ project_path: p });
43991
- if (fs72.existsSync(ai_council_path)) {
44911
+ if (fs74.existsSync(ai_council_path)) {
43992
44912
  const cfg = load_council_config(ai_council_path);
43993
44913
  settings["ai_council"] = _synthesize_ai_council_block(cfg);
43994
44914
  }
@@ -44168,11 +45088,11 @@ function _postRunQuorum(members, responses, ai_cfg) {
44168
45088
  for (let i = 0; i < members.length; i++) {
44169
45089
  const m = members[i];
44170
45090
  const r = responses[i];
44171
- if (r !== void 0 && !r.error) {
45091
+ if (r !== void 0 && !r.error && r.text.trim() !== "") {
44172
45092
  present += 1;
44173
45093
  continue;
44174
45094
  }
44175
- const raw = r?.error ?? "no response";
45095
+ const raw = r?.error ?? (r !== void 0 && r.text.trim() === "" ? "empty response body" : "no response");
44176
45096
  const failure = classifyCliFailure(raw);
44177
45097
  absent.push({
44178
45098
  member: m.name,
@@ -44184,7 +45104,8 @@ function _postRunQuorum(members, responses, ai_cfg) {
44184
45104
  }
44185
45105
  function _format_quorum_line(q) {
44186
45106
  const verdict = q.status === "concluded" ? "concluded" : "INCONCLUSIVE \u2014 release gate holds";
44187
- return `council:quorum \xB7 ${q.present}/${q.total} present, needed ${q.threshold} \u2014 ${verdict}.`;
45107
+ const degraded = q.present < q.total ? ` \u26A0\uFE0F DEGRADED \u2014 ${String(q.total - q.present)} member(s) did not answer; this is not convergence.` : "";
45108
+ return `council:quorum \xB7 ${q.present}/${q.total} present, needed ${q.threshold} \u2014 ${verdict}.${degraded}`;
44188
45109
  }
44189
45110
  function build_members(settings, opts = {}) {
44190
45111
  const invocation_mode = opts.invocation_mode ?? null;
@@ -44495,7 +45416,7 @@ function build_question(opts) {
44495
45416
  let ctx;
44496
45417
  let artefact;
44497
45418
  if (input_mode === "prompt") {
44498
- const text = fs72.readFileSync(input_path, "utf-8");
45419
+ const text = fs74.readFileSync(input_path, "utf-8");
44499
45420
  ctx = bundle_prompt(text);
44500
45421
  artefact = String(input_path);
44501
45422
  } else if (input_mode === "roadmap") {
@@ -44638,9 +45559,9 @@ function _maybe_write_decision_replay(opts) {
44638
45559
  include_member_arguments: include_args
44639
45560
  })
44640
45561
  );
44641
- const target = path68.join(path68.dirname(opts.out_path), "decision-replay.md");
44642
- fs72.mkdirSync(path68.dirname(target), { recursive: true });
44643
- fs72.writeFileSync(target, replay, { encoding: "utf-8" });
45562
+ const target = path70.join(path70.dirname(opts.out_path), "decision-replay.md");
45563
+ fs74.mkdirSync(path70.dirname(target), { recursive: true });
45564
+ fs74.writeFileSync(target, replay, { encoding: "utf-8" });
44644
45565
  return target;
44645
45566
  }
44646
45567
  function _peer_review_active(ai_cfg, args) {
@@ -45315,11 +46236,21 @@ function _emit_shadow_slo_banner() {
45315
46236
  return;
45316
46237
  }
45317
46238
  }
46239
+ function _resolvedTransportFor(name, member, report2) {
46240
+ return resolveMemberTransport({
46241
+ provider: name,
46242
+ report: report2 ?? detectEnvironment(),
46243
+ invocationMode: null,
46244
+ memberSettings: null,
46245
+ globalMode: "auto",
46246
+ binaryOverride: member.binary
46247
+ });
46248
+ }
45318
46249
  function cmd_status(args, opts = {}) {
45319
46250
  const env = opts.env ?? process.env;
45320
46251
  const override = env[COUNCIL_CONFIG_ENV];
45321
46252
  const path_ = resolve_config_path(REPO_ROOT11, { env });
45322
- const exists3 = fs72.existsSync(String(path_));
46253
+ const exists3 = fs74.existsSync(String(path_));
45323
46254
  const provenance = override ? `${COUNCIL_CONFIG_ENV} override` : "user-global";
45324
46255
  let cfg = null;
45325
46256
  let parse_error = null;
@@ -45343,6 +46274,21 @@ function cmd_status(args, opts = {}) {
45343
46274
  members_total: cfg === null ? null : cfg.members.size,
45344
46275
  members_enabled: cfg === null ? null : enabledMembers.length,
45345
46276
  member_names: enabledMembers.map(([n]) => n),
46277
+ transports: Object.fromEntries(
46278
+ enabledMembers.map(([n, m]) => {
46279
+ const t = _resolvedTransportFor(n, m);
46280
+ return [
46281
+ n,
46282
+ {
46283
+ available: t.available,
46284
+ transport: t.available ? t.transport : null,
46285
+ billing: t.available ? t.billing : null,
46286
+ reason: t.reason
46287
+ }
46288
+ ];
46289
+ })
46290
+ ),
46291
+ ignored_transport_keys: cfg?.ignored_transport_keys ?? [],
45346
46292
  parse_error,
45347
46293
  project_tree_consulted: false
45348
46294
  })}
@@ -45371,6 +46317,22 @@ function cmd_status(args, opts = {}) {
45371
46317
  _stdout2(` ${enabledMembers.map(([n]) => n).join(", ")}
45372
46318
  `);
45373
46319
  }
46320
+ for (const [name, member] of enabledMembers) {
46321
+ const t = _resolvedTransportFor(name, member);
46322
+ const billing = t.available ? ` \xB7 ${t.billing}` : "";
46323
+ const detail = t.available ? t.transport : `unavailable \u2014 ${t.reason ?? "no usable transport"}`;
46324
+ _stdout2(` transport ${name}: ${detail}${billing}
46325
+ `);
46326
+ }
46327
+ if (cfg.ignored_transport_keys.length > 0) {
46328
+ _stdout2("\n");
46329
+ _stdout2(" Ignored transport keys \u2014 transport is resolved, not configured:\n");
46330
+ for (const key of cfg.ignored_transport_keys) {
46331
+ _stdout2(` ${key}
46332
+ `);
46333
+ }
46334
+ _stdout2(" Safe to delete from the config file; they change nothing.\n");
46335
+ }
45374
46336
  }
45375
46337
  _stdout2("\n");
45376
46338
  _stdout2(" The project tree is NEVER consulted (ADR-104). No project file \u2014\n");
@@ -45553,6 +46515,7 @@ function cmd_run(args, opts = {}) {
45553
46515
  );
45554
46516
  return 0;
45555
46517
  }
46518
+ _validate_council_output_path(args.output, { kind: "responses", subcommand: "run" });
45556
46519
  const cost_cfg = ai_cfg["cost_budget"] || {};
45557
46520
  const budget = new CostBudget({
45558
46521
  max_input_tokens: _pyInt6(cost_cfg["max_input_tokens"] ?? 5e4, 5e4),
@@ -45696,8 +46659,8 @@ function cmd_run(args, opts = {}) {
45696
46659
  kind: "responses",
45697
46660
  subcommand: "run"
45698
46661
  });
45699
- fs72.mkdirSync(path68.dirname(_resolveTarget(out_path)), { recursive: true });
45700
- fs72.writeFileSync(_resolveTarget(out_path), _jsonDumpsIndent22(payload) + "\n", { encoding: "utf-8" });
46662
+ fs74.mkdirSync(path70.dirname(_resolveTarget(out_path)), { recursive: true });
46663
+ fs74.writeFileSync(_resolveTarget(out_path), _jsonDumpsIndent22(payload) + "\n", { encoding: "utf-8" });
45701
46664
  _stdout2(
45702
46665
  `
45703
46666
  council:run \xB7 wrote ${out_path} (estimated $${_pyFixed6(estimated_total, 4)} / actual $${_pyFixed6(actual_total, 4)})
@@ -45722,7 +46685,7 @@ function _debate_round_filename(round_number) {
45722
46685
  return `debate-round-${round_number}.json`;
45723
46686
  }
45724
46687
  function _write_debate_round(out_dir, round_number, responses, opts) {
45725
- fs72.mkdirSync(_resolveTarget(out_dir), { recursive: true });
46688
+ fs74.mkdirSync(_resolveTarget(out_dir), { recursive: true });
45726
46689
  let actual_total = 0;
45727
46690
  for (const r of responses) {
45728
46691
  if (r.error) {
@@ -45746,15 +46709,15 @@ function _write_debate_round(out_dir, round_number, responses, opts) {
45746
46709
  prompt_cache_round_gap_ms: opts.cache_gap_ms_since_previous_round ?? null,
45747
46710
  responses: _serialise_responses(responses)
45748
46711
  };
45749
- const out_path = path68.join(_resolveTarget(out_dir), _debate_round_filename(round_number));
45750
- fs72.writeFileSync(out_path, _jsonDumpsIndent22(payload) + "\n", { encoding: "utf-8" });
46712
+ const out_path = path70.join(_resolveTarget(out_dir), _debate_round_filename(round_number));
46713
+ fs74.writeFileSync(out_path, _jsonDumpsIndent22(payload) + "\n", { encoding: "utf-8" });
45751
46714
  return out_path;
45752
46715
  }
45753
46716
  function _load_debate_seed(p, expected_members) {
45754
- if (!fs72.existsSync(p)) {
46717
+ if (!fs74.existsSync(p)) {
45755
46718
  throw new FileNotFoundError3(`--continue-as-debate path not found: ${p}`);
45756
46719
  }
45757
- const payload = JSON.parse(fs72.readFileSync(p, "utf-8"));
46720
+ const payload = JSON.parse(fs74.readFileSync(p, "utf-8"));
45758
46721
  const source_members = (payload["members"] || []).slice();
45759
46722
  const expected_labels = expected_members.map((m) => `${m.name}/${m.model}`);
45760
46723
  if (!_listEq(source_members, expected_labels)) {
@@ -45800,7 +46763,7 @@ function _readStdinLine() {
45800
46763
  try {
45801
46764
  const buf = Buffer.alloc(4096);
45802
46765
  const fd = 0;
45803
- const n = fs72.readSync(fd, buf, 0, buf.length, null);
46766
+ const n = fs74.readSync(fd, buf, 0, buf.length, null);
45804
46767
  return buf.toString("utf-8", 0, n).split("\n")[0]?.trim().toLowerCase() ?? "";
45805
46768
  } catch {
45806
46769
  return "";
@@ -46029,7 +46992,7 @@ council:debate \xB7 ${all_rounds.length} round(s) complete \xB7 actual $${_pyFix
46029
46992
  return errors_last.length > 0 && errors_last.length === last.length ? 1 : 0;
46030
46993
  }
46031
46994
  function cmd_render(args) {
46032
- const payload = JSON.parse(fs72.readFileSync(args.responses, "utf-8"));
46995
+ const payload = JSON.parse(fs74.readFileSync(args.responses, "utf-8"));
46033
46996
  const items = payload["responses"] || [];
46034
46997
  const explicit = _getattr3(args, "prompt_mode", null);
46035
46998
  const mode = explicit || payload["prompt_mode"] || payload["mode"];
@@ -46058,8 +47021,8 @@ function cmd_render(args) {
46058
47021
  kind: "sessions",
46059
47022
  subcommand: "render"
46060
47023
  });
46061
- fs72.mkdirSync(path68.dirname(_resolveTarget(out_path)), { recursive: true });
46062
- fs72.writeFileSync(_resolveTarget(out_path), body + "\n", { encoding: "utf-8" });
47024
+ fs74.mkdirSync(path70.dirname(_resolveTarget(out_path)), { recursive: true });
47025
+ fs74.writeFileSync(_resolveTarget(out_path), body + "\n", { encoding: "utf-8" });
46063
47026
  _stdout2(`council:render \xB7 wrote ${out_path}
46064
47027
  `);
46065
47028
  return 0;
@@ -46070,15 +47033,15 @@ function cmd_render(args) {
46070
47033
  function _cmd_replay_low_impact_stats(args) {
46071
47034
  const li = low_impact_exports;
46072
47035
  const responses_path = args.responses;
46073
- const log_path = path68.join(path68.dirname(responses_path), "low-impact-resolutions.md");
46074
- if (!fs72.existsSync(log_path)) {
47036
+ const log_path = path70.join(path70.dirname(responses_path), "low-impact-resolutions.md");
47037
+ if (!fs74.existsSync(log_path)) {
46075
47038
  _stdout2(
46076
47039
  `council:replay \xB7 no low-impact-resolutions.md alongside ${responses_path} \u2014 session had no fast-path entries.
46077
47040
  `
46078
47041
  );
46079
47042
  return 0;
46080
47043
  }
46081
- const body = fs72.readFileSync(log_path, "utf-8");
47044
+ const body = fs74.readFileSync(log_path, "utf-8");
46082
47045
  const stats = li.parse_low_impact_log(body);
46083
47046
  const out = li.render_low_impact_stats(stats);
46084
47047
  if (_getattr3(args, "output", null)) {
@@ -46086,8 +47049,8 @@ function _cmd_replay_low_impact_stats(args) {
46086
47049
  kind: "sessions",
46087
47050
  subcommand: "replay"
46088
47051
  });
46089
- fs72.mkdirSync(path68.dirname(_resolveTarget(target)), { recursive: true });
46090
- fs72.writeFileSync(_resolveTarget(target), out, { encoding: "utf-8" });
47052
+ fs74.mkdirSync(path70.dirname(_resolveTarget(target)), { recursive: true });
47053
+ fs74.writeFileSync(_resolveTarget(target), out, { encoding: "utf-8" });
46091
47054
  _stdout2(`council:replay \xB7 wrote ${target}
46092
47055
  `);
46093
47056
  return 0;
@@ -46099,7 +47062,7 @@ function cmd_replay(args) {
46099
47062
  if (_getattr3(args, "low_impact_stats", false)) {
46100
47063
  return _cmd_replay_low_impact_stats(args);
46101
47064
  }
46102
- const payload = JSON.parse(fs72.readFileSync(args.responses, "utf-8"));
47065
+ const payload = JSON.parse(fs74.readFileSync(args.responses, "utf-8"));
46103
47066
  const consensus = _deserialise_consensus(payload["consensus"]);
46104
47067
  if (consensus === null) {
46105
47068
  _stderr2(
@@ -46124,8 +47087,8 @@ function cmd_replay(args) {
46124
47087
  kind: "sessions",
46125
47088
  subcommand: "replay"
46126
47089
  });
46127
- fs72.mkdirSync(path68.dirname(_resolveTarget(out_path)), { recursive: true });
46128
- fs72.writeFileSync(_resolveTarget(out_path), body, { encoding: "utf-8" });
47090
+ fs74.mkdirSync(path70.dirname(_resolveTarget(out_path)), { recursive: true });
47091
+ fs74.writeFileSync(_resolveTarget(out_path), body, { encoding: "utf-8" });
46129
47092
  _stdout2(`council:replay \xB7 wrote ${out_path}
46130
47093
  `);
46131
47094
  } else {
@@ -46182,8 +47145,8 @@ function cmd_quota(args, opts = {}) {
46182
47145
  }
46183
47146
  function _validate_council_output_path(path_str, opts) {
46184
47147
  const expected_rel = COUNCIL_CANONICAL_DIRS[opts.kind];
46185
- const expected_abs = _resolveReal(path68.join(REPO_ROOT11, expected_rel));
46186
- const target = path68.isAbsolute(path_str) ? path_str : path68.join(REPO_ROOT11, path_str);
47148
+ const expected_abs = _resolveReal(path70.join(REPO_ROOT11, expected_rel));
47149
+ const target = path70.isAbsolute(path_str) ? path_str : path70.join(REPO_ROOT11, path_str);
46187
47150
  const target_resolved = _resolveReal(target);
46188
47151
  if (!_isRelativeTo(target_resolved, expected_abs)) {
46189
47152
  throw new ArgumentTypeError(
@@ -46193,12 +47156,12 @@ function _validate_council_output_path(path_str, opts) {
46193
47156
  return path_str;
46194
47157
  }
46195
47158
  function _resolveTarget(path_str) {
46196
- return path68.isAbsolute(path_str) ? path_str : path68.join(REPO_ROOT11, path_str);
47159
+ return path70.isAbsolute(path_str) ? path_str : path70.join(REPO_ROOT11, path_str);
46197
47160
  }
46198
47161
  function _resolveReal(p) {
46199
- const abs = path68.resolve(p);
47162
+ const abs = path70.resolve(p);
46200
47163
  try {
46201
- return fs72.realpathSync(abs);
47164
+ return fs74.realpathSync(abs);
46202
47165
  } catch {
46203
47166
  return abs;
46204
47167
  }
@@ -46207,8 +47170,8 @@ function _isRelativeTo(target, base) {
46207
47170
  if (target === base) {
46208
47171
  return true;
46209
47172
  }
46210
- const rel = path68.relative(base, target);
46211
- return rel !== "" && !rel.startsWith("..") && !path68.isAbsolute(rel);
47173
+ const rel = path70.relative(base, target);
47174
+ return rel !== "" && !rel.startsWith("..") && !path70.isAbsolute(rel);
46212
47175
  }
46213
47176
  function _topError(message) {
46214
47177
  _stderr2(_TOP_USAGE2);
@@ -46533,7 +47496,7 @@ function _parse_siblings_overrides(items) {
46533
47496
  function _isFileNotFound(exc) {
46534
47497
  return exc instanceof FileNotFoundError3 || exc instanceof Error && exc.code === "ENOENT";
46535
47498
  }
46536
- function main30(argv = null) {
47499
+ function main32(argv = null) {
46537
47500
  const args = _parseArgs7(argv ?? process.argv.slice(2));
46538
47501
  try {
46539
47502
  if (args.cmd === "estimate") {
@@ -46575,17 +47538,17 @@ function main30(argv = null) {
46575
47538
  }
46576
47539
  return 1;
46577
47540
  }
46578
- function _isCliEntry27() {
47541
+ function _isCliEntry29() {
46579
47542
  if (process.argv[1] === void 0) {
46580
47543
  return false;
46581
47544
  }
46582
- const argvUrl = pathToFileURL30(path68.resolve(process.argv[1])).href;
47545
+ const argvUrl = pathToFileURL32(path70.resolve(process.argv[1])).href;
46583
47546
  if (import.meta.url === argvUrl) {
46584
47547
  return true;
46585
47548
  }
46586
47549
  try {
46587
- const here = fs72.realpathSync(fileURLToPath41(import.meta.url));
46588
- const argv = fs72.realpathSync(path68.resolve(process.argv[1]));
47550
+ const here = fs74.realpathSync(fileURLToPath43(import.meta.url));
47551
+ const argv = fs74.realpathSync(path70.resolve(process.argv[1]));
46589
47552
  return here === argv;
46590
47553
  } catch {
46591
47554
  return false;
@@ -46643,7 +47606,7 @@ var init_council_cli = __esm({
46643
47606
  "xai",
46644
47607
  "perplexity"
46645
47608
  ]);
46646
- _HERE22 = path68.dirname(fileURLToPath41(import.meta.url));
47609
+ _HERE22 = path70.dirname(fileURLToPath43(import.meta.url));
46647
47610
  [REPO_ROOT11] = resolve_project_root(null);
46648
47611
  SETTINGS_FILE2 = project_settings_path(REPO_ROOT11);
46649
47612
  AI_COUNCIL_FILE = resolve_config_path(REPO_ROOT11);
@@ -46676,9 +47639,9 @@ var init_council_cli = __esm({
46676
47639
  {estimate,run,debate,render,replay,quota,shadow-report,status}
46677
47640
  ...
46678
47641
  `;
46679
- if (_isCliEntry27()) {
47642
+ if (_isCliEntry29()) {
46680
47643
  try {
46681
- process.exitCode = main30(process.argv.slice(2));
47644
+ process.exitCode = main32(process.argv.slice(2));
46682
47645
  } catch (err) {
46683
47646
  if (!(err instanceof _ArgExit2)) {
46684
47647
  throw err;
@@ -46707,7 +47670,7 @@ function run_enveloped(spec) {
46707
47670
  if (cmd === void 0) {
46708
47671
  throw new Error("envelope argv must not be empty");
46709
47672
  }
46710
- return new Promise((resolve40) => {
47673
+ return new Promise((resolve42) => {
46711
47674
  execFile(
46712
47675
  cmd,
46713
47676
  args,
@@ -46730,7 +47693,7 @@ function run_enveloped(spec) {
46730
47693
  }
46731
47694
  const [out, outTrunc] = _truncate(String(stdout ?? ""), spec.max_output_bytes);
46732
47695
  const [err, errTrunc] = _truncate(String(stderr ?? ""), spec.max_output_bytes);
46733
- resolve40({
47696
+ resolve42({
46734
47697
  exit_code: timedOut ? null : exitCode,
46735
47698
  timed_out: timedOut,
46736
47699
  stdout: out,
@@ -46751,8 +47714,8 @@ var init_safety_envelope = __esm({
46751
47714
  });
46752
47715
 
46753
47716
  // src/scripts/mcp_server/__main__.ts
46754
- import * as path70 from "node:path";
46755
- import { fileURLToPath as fileURLToPath43 } from "node:url";
47717
+ import * as path72 from "node:path";
47718
+ import { fileURLToPath as fileURLToPath45 } from "node:url";
46756
47719
 
46757
47720
  // src/scripts/mcp_server/index.ts
46758
47721
  var __version__ = "0.1.0";
@@ -46799,9 +47762,9 @@ init_prompts();
46799
47762
  init_resources();
46800
47763
 
46801
47764
  // src/scripts/mcp_server/tools.ts
46802
- import * as fs73 from "node:fs";
46803
- import * as path69 from "node:path";
46804
- import { fileURLToPath as fileURLToPath42 } from "node:url";
47765
+ import * as fs75 from "node:fs";
47766
+ import * as path71 from "node:path";
47767
+ import { fileURLToPath as fileURLToPath44 } from "node:url";
46805
47768
 
46806
47769
  // src/scripts/chat_history.ts
46807
47770
  init_memory_lookup();
@@ -49034,9 +49997,9 @@ function _strip8(s) {
49034
49997
  }
49035
49998
  function _resolvePath2(p) {
49036
49999
  try {
49037
- return fs73.realpathSync(p);
50000
+ return fs75.realpathSync(p);
49038
50001
  } catch {
49039
- return path69.resolve(p);
50002
+ return path71.resolve(p);
49040
50003
  }
49041
50004
  }
49042
50005
  function _resolveConsumerRoot(override) {
@@ -49046,14 +50009,14 @@ function _resolveConsumerRoot(override) {
49046
50009
  return _resolvePath2(process.cwd());
49047
50010
  }
49048
50011
  function _relativeUnder(target, root) {
49049
- const rel = path69.relative(root, target);
50012
+ const rel = path71.relative(root, target);
49050
50013
  if (rel === "") {
49051
50014
  return "";
49052
50015
  }
49053
- if (rel.startsWith("..") || path69.isAbsolute(rel)) {
50016
+ if (rel.startsWith("..") || path71.isAbsolute(rel)) {
49054
50017
  return null;
49055
50018
  }
49056
- return rel.split(path69.sep).join("/");
50019
+ return rel.split(path71.sep).join("/");
49057
50020
  }
49058
50021
  function _reprStrList(values) {
49059
50022
  return `[${values.map((v) => `'${v}'`).join(", ")}]`;
@@ -49062,11 +50025,11 @@ function _validateInTreePath(raw, consumerRoot) {
49062
50025
  const root = _resolvePath2(consumerRoot);
49063
50026
  let target;
49064
50027
  if (raw === null || raw === void 0 || raw === "") {
49065
- target = path69.join(root, "agents", "runtime", ".agent-chat-history");
49066
- } else if (path69.isAbsolute(raw)) {
50028
+ target = path71.join(root, "agents", "runtime", ".agent-chat-history");
50029
+ } else if (path71.isAbsolute(raw)) {
49067
50030
  target = _resolvePath2(raw);
49068
50031
  } else {
49069
- target = _resolvePath2(path69.join(root, raw));
50032
+ target = _resolvePath2(path71.join(root, raw));
49070
50033
  }
49071
50034
  const rel = _relativeUnder(target, root);
49072
50035
  if (rel === null) {
@@ -49104,11 +50067,11 @@ async function _lintSkillsHandler(args, consumerRoot) {
49104
50067
  if (typeof raw !== "string") {
49105
50068
  throw new Error("'paths' entries must be strings");
49106
50069
  }
49107
- const resolved = path69.isAbsolute(raw) ? _resolvePath2(raw) : _resolvePath2(path69.join(root, raw));
50070
+ const resolved = path71.isAbsolute(raw) ? _resolvePath2(raw) : _resolvePath2(path71.join(root, raw));
49108
50071
  if (_relativeUnder(resolved, root) === null) {
49109
50072
  throw new Error(`path escapes consumer_root: ${resolved}`);
49110
50073
  }
49111
- if (fs73.existsSync(resolved)) {
50074
+ if (fs75.existsSync(resolved)) {
49112
50075
  paths.push(resolved);
49113
50076
  }
49114
50077
  }
@@ -49145,7 +50108,7 @@ async function _chatHistoryAppendHandler(args, consumerRoot) {
49145
50108
  if (typeof minSchema !== "number" || !Number.isInteger(minSchema) || typeof minSchema === "boolean") {
49146
50109
  throw new Error("'min_schema_version' must be an integer");
49147
50110
  }
49148
- const existingHeader = fs73.existsSync(target) ? _chReadHeader(target) : null;
50111
+ const existingHeader = fs75.existsSync(target) ? _chReadHeader(target) : null;
49149
50112
  const observed = existingHeader !== null && typeof existingHeader === "object" ? _pyInt7(existingHeader.v ?? 0) : SCHEMA_VERSION3;
49150
50113
  if (observed < minSchema) {
49151
50114
  throw new Error(`chat-history schema ${observed} below required ${minSchema}`);
@@ -49160,8 +50123,8 @@ async function _chatHistoryAppendHandler(args, consumerRoot) {
49160
50123
  session: session === void 0 ? null : session
49161
50124
  };
49162
50125
  }
49163
- if (!fs73.existsSync(target) || _chReadHeader(target) === null) {
49164
- fs73.mkdirSync(path69.dirname(target), { recursive: true });
50126
+ if (!fs75.existsSync(target) || _chReadHeader(target) === null) {
50127
+ fs75.mkdirSync(path71.dirname(target), { recursive: true });
49165
50128
  _chInit(target);
49166
50129
  }
49167
50130
  _chAppend(entry, target, session ?? null);
@@ -49205,7 +50168,7 @@ async function _chatHistoryReadHandler(args, consumerRoot) {
49205
50168
  if (detail !== "full" && detail !== "index") {
49206
50169
  throw new Error("'detail' must be 'index' or 'full'");
49207
50170
  }
49208
- if (!fs73.existsSync(target)) {
50171
+ if (!fs75.existsSync(target)) {
49209
50172
  return { path: target, entries: [], count: 0 };
49210
50173
  }
49211
50174
  if (around !== void 0 && around !== null) {
@@ -49307,8 +50270,8 @@ async function _memoryStatusHandler(_args, consumerRoot) {
49307
50270
  }
49308
50271
  return result;
49309
50272
  }
49310
- var _PACKAGE_ROOT3 = path69.resolve(
49311
- path69.dirname(fileURLToPath42(import.meta.url)),
50273
+ var _PACKAGE_ROOT3 = path71.resolve(
50274
+ path71.dirname(fileURLToPath44(import.meta.url)),
49312
50275
  "..",
49313
50276
  "..",
49314
50277
  ".."
@@ -49352,10 +50315,10 @@ async function _memorySignalHandler(args, consumerRoot) {
49352
50315
  async function _roadmapProgressHandler(args, consumerRoot) {
49353
50316
  const dryRun = _pyTruthy6(args.dry_run ?? false);
49354
50317
  const root = _resolvePath2(consumerRoot);
49355
- const roadmapRoot = path69.join(root, "agents", "roadmaps");
49356
- const target = path69.join(root, "agents", "roadmaps-progress.md");
50318
+ const roadmapRoot = path71.join(root, "agents", "roadmaps");
50319
+ const target = path71.join(root, "agents", "roadmaps-progress.md");
49357
50320
  const urp = await Promise.resolve().then(() => (init_update_roadmap_progress(), update_roadmap_progress_exports));
49358
- if (!fs73.existsSync(roadmapRoot)) {
50321
+ if (!fs75.existsSync(roadmapRoot)) {
49359
50322
  return {
49360
50323
  written: false,
49361
50324
  path: target,
@@ -49370,7 +50333,7 @@ async function _roadmapProgressHandler(args, consumerRoot) {
49370
50333
  const stepsDone = roadmaps.reduce((s, r) => s + r.done, 0);
49371
50334
  const stepsTotal = roadmaps.reduce((s, r) => s + r.total_active, 0);
49372
50335
  if (!dryRun) {
49373
- fs73.writeFileSync(target, content, "utf-8");
50336
+ fs75.writeFileSync(target, content, "utf-8");
49374
50337
  }
49375
50338
  return {
49376
50339
  written: !dryRun,
@@ -49391,11 +50354,11 @@ async function _roadmapArchiveHandler(_args, consumerRoot) {
49391
50354
  let dashboardRegenerated = false;
49392
50355
  if (archived.length > 0) {
49393
50356
  const urp = await Promise.resolve().then(() => (init_update_roadmap_progress(), update_roadmap_progress_exports));
49394
- const roadmapRoot = path69.join(root, "agents", "roadmaps");
49395
- if (fs73.existsSync(roadmapRoot)) {
50357
+ const roadmapRoot = path71.join(root, "agents", "roadmaps");
50358
+ if (fs75.existsSync(roadmapRoot)) {
49396
50359
  const roadmaps = urp.collect(roadmapRoot);
49397
- fs73.writeFileSync(
49398
- path69.join(root, "agents", "roadmaps-progress.md"),
50360
+ fs75.writeFileSync(
50361
+ path71.join(root, "agents", "roadmaps-progress.md"),
49399
50362
  urp.render(roadmaps, urp.collect_bundles(root)),
49400
50363
  "utf-8"
49401
50364
  );
@@ -49411,9 +50374,9 @@ async function _roadmapArchiveHandler(_args, consumerRoot) {
49411
50374
  async function _capabilitiesIndexHandler(args, consumerRoot) {
49412
50375
  const check = _pyTruthy6(args.check ?? false);
49413
50376
  const cap = await Promise.resolve().then(() => (init_generate_capabilities_index(), generate_capabilities_index_exports));
49414
- const out = path69.join(_PACKAGE_ROOT3, "CAPABILITIES.yaml");
50377
+ const out = path71.join(_PACKAGE_ROOT3, "CAPABILITIES.yaml");
49415
50378
  const content = cap.build();
49416
- const onDisk = fs73.existsSync(out) ? fs73.readFileSync(out, "utf-8") : "";
50379
+ const onDisk = fs75.existsSync(out) ? fs75.readFileSync(out, "utf-8") : "";
49417
50380
  const drift = onDisk !== content;
49418
50381
  if (check) {
49419
50382
  return { check: true, written: false, drift, path: out };
@@ -49424,7 +50387,7 @@ async function _capabilitiesIndexHandler(args, consumerRoot) {
49424
50387
  `CAPABILITIES.yaml path escapes consumer_root: ${out} not under ${root}`
49425
50388
  );
49426
50389
  }
49427
- fs73.writeFileSync(out, content, "utf-8");
50390
+ fs75.writeFileSync(out, content, "utf-8");
49428
50391
  return { check: false, written: true, drift, path: out };
49429
50392
  }
49430
50393
  async function _runDoctorLeg(consumerRoot) {
@@ -49524,11 +50487,11 @@ async function _councilEstimateHandler(args, consumerRoot) {
49524
50487
  throw new Error("'depth' must be 'shallow' or 'deep' when provided");
49525
50488
  }
49526
50489
  const root = _resolvePath2(consumerRoot);
49527
- const target = path69.isAbsolute(inputRaw) ? _resolvePath2(inputRaw) : _resolvePath2(path69.join(root, inputRaw));
50490
+ const target = path71.isAbsolute(inputRaw) ? _resolvePath2(inputRaw) : _resolvePath2(path71.join(root, inputRaw));
49528
50491
  if (_relativeUnder(target, root) === null) {
49529
50492
  throw new Error(`path escapes consumer_root: ${target}`);
49530
50493
  }
49531
- if (!fs73.existsSync(target)) {
50494
+ if (!fs75.existsSync(target)) {
49532
50495
  throw new Error(`input_path not found: ${target}`);
49533
50496
  }
49534
50497
  const cli = await Promise.resolve().then(() => (init_council_cli(), council_cli_exports));
@@ -49590,18 +50553,18 @@ async function _runTestsHandler(args, consumerRoot) {
49590
50553
  if (typeof relPathRaw !== "string" || !_strip8(relPathRaw)) {
49591
50554
  throw new Error("'path' must be a non-empty string when provided");
49592
50555
  }
49593
- const resolved = path69.isAbsolute(relPathRaw) ? _resolvePath2(relPathRaw) : _resolvePath2(path69.join(root, relPathRaw));
50556
+ const resolved = path71.isAbsolute(relPathRaw) ? _resolvePath2(relPathRaw) : _resolvePath2(path71.join(root, relPathRaw));
49594
50557
  const rel = _relativeUnder(resolved, root);
49595
50558
  if (rel === null) {
49596
50559
  throw new Error(`path escapes consumer_root: ${resolved}`);
49597
50560
  }
49598
- if (!fs73.existsSync(resolved)) {
50561
+ if (!fs75.existsSync(resolved)) {
49599
50562
  throw new Error(`path not found: ${resolved}`);
49600
50563
  }
49601
50564
  relArg = rel;
49602
50565
  }
49603
- const vitestEntry = path69.join(root, "node_modules", "vitest", "vitest.mjs");
49604
- if (!fs73.existsSync(vitestEntry)) {
50566
+ const vitestEntry = path71.join(root, "node_modules", "vitest", "vitest.mjs");
50567
+ if (!fs75.existsSync(vitestEntry)) {
49605
50568
  throw new Error(
49606
50569
  "run_tests pilot supports vitest projects only \u2014 node_modules/vitest/vitest.mjs not found under consumer_root"
49607
50570
  );
@@ -50207,8 +51170,8 @@ function _strCmp3(a, b) {
50207
51170
  return a < b ? -1 : a > b ? 1 : 0;
50208
51171
  }
50209
51172
  function _pathlibCompare3(a, b) {
50210
- const pa = a.split(path69.sep);
50211
- const pb = b.split(path69.sep);
51173
+ const pa = a.split(path71.sep);
51174
+ const pb = b.split(path71.sep);
50212
51175
  const n = Math.min(pa.length, pb.length);
50213
51176
  for (let i = 0; i < n; i++) {
50214
51177
  const c = _strCmp3(pa[i], pb[i]);
@@ -50427,18 +51390,18 @@ async function _serveOverSdk(server) {
50427
51390
  const transport = new StdioServerTransport();
50428
51391
  await sdkServer.connect(transport);
50429
51392
  }
50430
- function main31() {
51393
+ function main33() {
50431
51394
  void run_stdio();
50432
51395
  }
50433
51396
 
50434
51397
  // src/scripts/mcp_server/__main__.ts
50435
- var _selfPath = fileURLToPath43(import.meta.url);
50436
- var _invokedDirectly2 = globalThis.__AC_MCP_BUNDLE_DIRECT === true || process.argv[1] !== void 0 && path70.resolve(process.argv[1]) === path70.resolve(_selfPath);
51398
+ var _selfPath = fileURLToPath45(import.meta.url);
51399
+ var _invokedDirectly2 = globalThis.__AC_MCP_BUNDLE_DIRECT === true || process.argv[1] !== void 0 && path72.resolve(process.argv[1]) === path72.resolve(_selfPath);
50437
51400
  if (_invokedDirectly2) {
50438
- main31();
51401
+ main33();
50439
51402
  }
50440
51403
  export {
50441
- main31 as main
51404
+ main33 as main
50442
51405
  };
50443
51406
  /*! Bundled license information:
50444
51407