@event4u/agent-config 16.4.0 → 16.5.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 (77) hide show
  1. package/.augment-plugin/marketplace.json +3 -3
  2. package/.augment-plugin/plugin.json +1 -1
  3. package/.claude-plugin/marketplace.json +1 -1
  4. package/CHANGELOG.md +40 -191
  5. package/README.md +1 -1
  6. package/dist/agent-src/commands/design.md +1 -1
  7. package/dist/agent-src/guidelines/design-antipatterns.md +1 -1
  8. package/dist/agent-src/rules/token-budget-discipline.md +2 -2
  9. package/dist/agent-src/skills/accessibility-auditor/data/aria-patterns.csv +2 -0
  10. package/dist/agent-src/skills/accessibility-auditor/data/manifest.json +3 -3
  11. package/dist/agent-src/skills/canvas-design/SKILL.md +4 -2
  12. package/dist/agent-src/skills/design-intelligence/references/integration-mapping.md +13 -10
  13. package/dist/agent-src/skills/fe-design/references/design-patterns.md +49 -2
  14. package/dist/agent-src/skills/frontend-render-security/SKILL.md +9 -0
  15. package/dist/agent-src/skills/iconography/SKILL.md +4 -2
  16. package/dist/agent-src/skills/image-provider-routing/SKILL.md +16 -5
  17. package/dist/agent-src/skills/logo-generation/SKILL.md +12 -8
  18. package/dist/agent-src/skills/svg-authoring/SKILL.md +318 -0
  19. package/dist/agent-src/skills/wireframe/SKILL.md +5 -2
  20. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  21. package/dist/cli/commands/uiRender.js +201 -4
  22. package/dist/cli/commands/uiRenderAsset.js +1308 -0
  23. package/dist/cli/commands/uiRenderAssetCompare.js +752 -0
  24. package/dist/cli/commands/uiRenderAssetGrid.js +265 -0
  25. package/dist/cli/commands/uiRenderAssetGrounds.js +323 -0
  26. package/dist/cli/commands/uiRenderAssetIsolation.js +85 -0
  27. package/dist/cli/commands/uiRenderAssetTypes.js +145 -0
  28. package/dist/cli/main.js +47 -1
  29. package/dist/cli/registry.js +1 -1
  30. package/dist/cli-delegate/{chunk-MSUL5NYP.js → chunk-4DBG5K7M.js} +1 -1
  31. package/dist/cli-delegate/{chunk-AED2VQGM.js → chunk-TMWYUOK4.js} +10 -1
  32. package/dist/cli-delegate/cmd_conformance.js +395 -214
  33. package/dist/cli-delegate/cmd_handoff.js +2 -2
  34. package/dist/cli-delegate/cmd_session_recycle.js +2 -2
  35. package/dist/discovery/deprecation-report.md +1 -1
  36. package/dist/discovery/discovery-manifest.json +47 -22
  37. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  38. package/dist/discovery/discovery-manifest.summary.md +6 -6
  39. package/dist/discovery/dormancy-report.md +1 -1
  40. package/dist/discovery/orphan-report.md +1 -1
  41. package/dist/discovery/packs.json +19 -15
  42. package/dist/discovery/trust-report.md +2 -2
  43. package/dist/discovery/workspaces.json +13 -9
  44. package/dist/hooks/dispatch.js +1073 -808
  45. package/dist/hooks/dispatch.sha256 +1 -1
  46. package/dist/hooks/svg_rules.chunk.cjs +1626 -0
  47. package/dist/hooks/svg_rules.chunk.cjs.sha256 +1 -0
  48. package/dist/mcp/registry-manifest.json +3 -3
  49. package/dist/mcp/server.json +2 -2
  50. package/dist/mcp/server.mjs +931 -735
  51. package/dist/scripts/_lib/scan_scope.js +105 -0
  52. package/dist/scripts/_lib/svg_dom.js +284 -0
  53. package/dist/scripts/_lib/svg_geometry.js +477 -0
  54. package/dist/scripts/_lib/svg_motion.js +179 -0
  55. package/dist/scripts/_lib/svg_rules.js +1337 -0
  56. package/dist/scripts/_lib/svg_urls.js +67 -0
  57. package/dist/scripts/lint_svg_asset.js +324 -0
  58. package/docs/guidelines/design-antipatterns.md +1 -1
  59. package/package.json +4 -3
  60. package/src/config/gate-violation-baselines.json +3 -3
  61. package/src/config/routing-coverage-seed.json +9 -2
  62. package/src/scripts/_lib/svg_dom.ts +318 -0
  63. package/src/scripts/_lib/svg_geometry.ts +480 -0
  64. package/src/scripts/_lib/svg_motion.ts +208 -0
  65. package/src/scripts/_lib/svg_rules.ts +1453 -0
  66. package/src/scripts/_lib/svg_urls.ts +72 -0
  67. package/src/scripts/_lib/verification_command.ts +59 -0
  68. package/src/scripts/_lib/verify_clause.ts +27 -17
  69. package/src/scripts/hooks/block_speaking_inbox_dir.ts +16 -1
  70. package/src/scripts/hooks/design_pass_hook.ts +157 -3
  71. package/src/scripts/hooks/svg_obligation.ts +497 -0
  72. package/src/scripts/hooks/svg_rules_loader.ts +133 -0
  73. package/src/scripts/hooks/turn_end_gate_hook.ts +5 -3
  74. package/src/scripts/lint_consolidation_lineage.ts +6 -3
  75. package/src/scripts/lint_design_quality.ts +60 -12
  76. package/src/scripts/lint_motion_authority_drift.ts +27 -0
  77. package/src/scripts/lint_svg_asset.ts +365 -0
@@ -112,17 +112,17 @@ var require_visit = __commonJS({
112
112
  visit.BREAK = BREAK;
113
113
  visit.SKIP = SKIP;
114
114
  visit.REMOVE = REMOVE;
115
- function visit_(key, node, visitor, path133) {
116
- const ctrl = callVisitor(key, node, visitor, path133);
115
+ function visit_(key, node, visitor, path135) {
116
+ const ctrl = callVisitor(key, node, visitor, path135);
117
117
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
118
- replaceNode(key, path133, ctrl);
119
- return visit_(key, ctrl, visitor, path133);
118
+ replaceNode(key, path135, ctrl);
119
+ return visit_(key, ctrl, visitor, path135);
120
120
  }
121
121
  if (typeof ctrl !== "symbol") {
122
122
  if (identity.isCollection(node)) {
123
- path133 = Object.freeze(path133.concat(node));
123
+ path135 = Object.freeze(path135.concat(node));
124
124
  for (let i = 0; i < node.items.length; ++i) {
125
- const ci = visit_(i, node.items[i], visitor, path133);
125
+ const ci = visit_(i, node.items[i], visitor, path135);
126
126
  if (typeof ci === "number")
127
127
  i = ci - 1;
128
128
  else if (ci === BREAK)
@@ -133,13 +133,13 @@ var require_visit = __commonJS({
133
133
  }
134
134
  }
135
135
  } else if (identity.isPair(node)) {
136
- path133 = Object.freeze(path133.concat(node));
137
- const ck = visit_("key", node.key, visitor, path133);
136
+ path135 = Object.freeze(path135.concat(node));
137
+ const ck = visit_("key", node.key, visitor, path135);
138
138
  if (ck === BREAK)
139
139
  return BREAK;
140
140
  else if (ck === REMOVE)
141
141
  node.key = null;
142
- const cv = visit_("value", node.value, visitor, path133);
142
+ const cv = visit_("value", node.value, visitor, path135);
143
143
  if (cv === BREAK)
144
144
  return BREAK;
145
145
  else if (cv === REMOVE)
@@ -160,17 +160,17 @@ var require_visit = __commonJS({
160
160
  visitAsync.BREAK = BREAK;
161
161
  visitAsync.SKIP = SKIP;
162
162
  visitAsync.REMOVE = REMOVE;
163
- async function visitAsync_(key, node, visitor, path133) {
164
- const ctrl = await callVisitor(key, node, visitor, path133);
163
+ async function visitAsync_(key, node, visitor, path135) {
164
+ const ctrl = await callVisitor(key, node, visitor, path135);
165
165
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
166
- replaceNode(key, path133, ctrl);
167
- return visitAsync_(key, ctrl, visitor, path133);
166
+ replaceNode(key, path135, ctrl);
167
+ return visitAsync_(key, ctrl, visitor, path135);
168
168
  }
169
169
  if (typeof ctrl !== "symbol") {
170
170
  if (identity.isCollection(node)) {
171
- path133 = Object.freeze(path133.concat(node));
171
+ path135 = Object.freeze(path135.concat(node));
172
172
  for (let i = 0; i < node.items.length; ++i) {
173
- const ci = await visitAsync_(i, node.items[i], visitor, path133);
173
+ const ci = await visitAsync_(i, node.items[i], visitor, path135);
174
174
  if (typeof ci === "number")
175
175
  i = ci - 1;
176
176
  else if (ci === BREAK)
@@ -181,13 +181,13 @@ var require_visit = __commonJS({
181
181
  }
182
182
  }
183
183
  } else if (identity.isPair(node)) {
184
- path133 = Object.freeze(path133.concat(node));
185
- const ck = await visitAsync_("key", node.key, visitor, path133);
184
+ path135 = Object.freeze(path135.concat(node));
185
+ const ck = await visitAsync_("key", node.key, visitor, path135);
186
186
  if (ck === BREAK)
187
187
  return BREAK;
188
188
  else if (ck === REMOVE)
189
189
  node.key = null;
190
- const cv = await visitAsync_("value", node.value, visitor, path133);
190
+ const cv = await visitAsync_("value", node.value, visitor, path135);
191
191
  if (cv === BREAK)
192
192
  return BREAK;
193
193
  else if (cv === REMOVE)
@@ -214,23 +214,23 @@ var require_visit = __commonJS({
214
214
  }
215
215
  return visitor;
216
216
  }
217
- function callVisitor(key, node, visitor, path133) {
217
+ function callVisitor(key, node, visitor, path135) {
218
218
  if (typeof visitor === "function")
219
- return visitor(key, node, path133);
219
+ return visitor(key, node, path135);
220
220
  if (identity.isMap(node))
221
- return visitor.Map?.(key, node, path133);
221
+ return visitor.Map?.(key, node, path135);
222
222
  if (identity.isSeq(node))
223
- return visitor.Seq?.(key, node, path133);
223
+ return visitor.Seq?.(key, node, path135);
224
224
  if (identity.isPair(node))
225
- return visitor.Pair?.(key, node, path133);
225
+ return visitor.Pair?.(key, node, path135);
226
226
  if (identity.isScalar(node))
227
- return visitor.Scalar?.(key, node, path133);
227
+ return visitor.Scalar?.(key, node, path135);
228
228
  if (identity.isAlias(node))
229
- return visitor.Alias?.(key, node, path133);
229
+ return visitor.Alias?.(key, node, path135);
230
230
  return void 0;
231
231
  }
232
- function replaceNode(key, path133, node) {
233
- const parent = path133[path133.length - 1];
232
+ function replaceNode(key, path135, node) {
233
+ const parent = path135[path135.length - 1];
234
234
  if (identity.isCollection(parent)) {
235
235
  parent.items[key] = node;
236
236
  } else if (identity.isPair(parent)) {
@@ -840,10 +840,10 @@ var require_Collection = __commonJS({
840
840
  var createNode = require_createNode();
841
841
  var identity = require_identity();
842
842
  var Node = require_Node();
843
- function collectionFromPath(schema, path133, value) {
843
+ function collectionFromPath(schema, path135, value) {
844
844
  let v = value;
845
- for (let i = path133.length - 1; i >= 0; --i) {
846
- const k = path133[i];
845
+ for (let i = path135.length - 1; i >= 0; --i) {
846
+ const k = path135[i];
847
847
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
848
848
  const a = [];
849
849
  a[k] = v;
@@ -862,7 +862,7 @@ var require_Collection = __commonJS({
862
862
  sourceObjects: /* @__PURE__ */ new Map()
863
863
  });
864
864
  }
865
- var isEmptyPath = (path133) => path133 == null || typeof path133 === "object" && !!path133[Symbol.iterator]().next().done;
865
+ var isEmptyPath = (path135) => path135 == null || typeof path135 === "object" && !!path135[Symbol.iterator]().next().done;
866
866
  var Collection = class extends Node.NodeBase {
867
867
  constructor(type, schema) {
868
868
  super(type);
@@ -892,11 +892,11 @@ var require_Collection = __commonJS({
892
892
  * be a Pair instance or a `{ key, value }` object, which may not have a key
893
893
  * that already exists in the map.
894
894
  */
895
- addIn(path133, value) {
896
- if (isEmptyPath(path133))
895
+ addIn(path135, value) {
896
+ if (isEmptyPath(path135))
897
897
  this.add(value);
898
898
  else {
899
- const [key, ...rest] = path133;
899
+ const [key, ...rest] = path135;
900
900
  const node = this.get(key, true);
901
901
  if (identity.isCollection(node))
902
902
  node.addIn(rest, value);
@@ -910,8 +910,8 @@ var require_Collection = __commonJS({
910
910
  * Removes a value from the collection.
911
911
  * @returns `true` if the item was found and removed.
912
912
  */
913
- deleteIn(path133) {
914
- const [key, ...rest] = path133;
913
+ deleteIn(path135) {
914
+ const [key, ...rest] = path135;
915
915
  if (rest.length === 0)
916
916
  return this.delete(key);
917
917
  const node = this.get(key, true);
@@ -925,8 +925,8 @@ var require_Collection = __commonJS({
925
925
  * scalar values from their surrounding node; to disable set `keepScalar` to
926
926
  * `true` (collections are always returned intact).
927
927
  */
928
- getIn(path133, keepScalar) {
929
- const [key, ...rest] = path133;
928
+ getIn(path135, keepScalar) {
929
+ const [key, ...rest] = path135;
930
930
  const node = this.get(key, true);
931
931
  if (rest.length === 0)
932
932
  return !keepScalar && identity.isScalar(node) ? node.value : node;
@@ -944,8 +944,8 @@ var require_Collection = __commonJS({
944
944
  /**
945
945
  * Checks if the collection includes a value with the key `key`.
946
946
  */
947
- hasIn(path133) {
948
- const [key, ...rest] = path133;
947
+ hasIn(path135) {
948
+ const [key, ...rest] = path135;
949
949
  if (rest.length === 0)
950
950
  return this.has(key);
951
951
  const node = this.get(key, true);
@@ -955,8 +955,8 @@ var require_Collection = __commonJS({
955
955
  * Sets a value in this collection. For `!!set`, `value` needs to be a
956
956
  * boolean to add/remove the item from the set.
957
957
  */
958
- setIn(path133, value) {
959
- const [key, ...rest] = path133;
958
+ setIn(path135, value) {
959
+ const [key, ...rest] = path135;
960
960
  if (rest.length === 0) {
961
961
  this.set(key, value);
962
962
  } else {
@@ -3471,9 +3471,9 @@ var require_Document = __commonJS({
3471
3471
  this.contents.add(value);
3472
3472
  }
3473
3473
  /** Adds a value to the document. */
3474
- addIn(path133, value) {
3474
+ addIn(path135, value) {
3475
3475
  if (assertCollection(this.contents))
3476
- this.contents.addIn(path133, value);
3476
+ this.contents.addIn(path135, value);
3477
3477
  }
3478
3478
  /**
3479
3479
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -3548,14 +3548,14 @@ var require_Document = __commonJS({
3548
3548
  * Removes a value from the document.
3549
3549
  * @returns `true` if the item was found and removed.
3550
3550
  */
3551
- deleteIn(path133) {
3552
- if (Collection.isEmptyPath(path133)) {
3551
+ deleteIn(path135) {
3552
+ if (Collection.isEmptyPath(path135)) {
3553
3553
  if (this.contents == null)
3554
3554
  return false;
3555
3555
  this.contents = null;
3556
3556
  return true;
3557
3557
  }
3558
- return assertCollection(this.contents) ? this.contents.deleteIn(path133) : false;
3558
+ return assertCollection(this.contents) ? this.contents.deleteIn(path135) : false;
3559
3559
  }
3560
3560
  /**
3561
3561
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -3570,10 +3570,10 @@ var require_Document = __commonJS({
3570
3570
  * scalar values from their surrounding node; to disable set `keepScalar` to
3571
3571
  * `true` (collections are always returned intact).
3572
3572
  */
3573
- getIn(path133, keepScalar) {
3574
- if (Collection.isEmptyPath(path133))
3573
+ getIn(path135, keepScalar) {
3574
+ if (Collection.isEmptyPath(path135))
3575
3575
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
3576
- return identity.isCollection(this.contents) ? this.contents.getIn(path133, keepScalar) : void 0;
3576
+ return identity.isCollection(this.contents) ? this.contents.getIn(path135, keepScalar) : void 0;
3577
3577
  }
3578
3578
  /**
3579
3579
  * Checks if the document includes a value with the key `key`.
@@ -3584,10 +3584,10 @@ var require_Document = __commonJS({
3584
3584
  /**
3585
3585
  * Checks if the document includes a value at `path`.
3586
3586
  */
3587
- hasIn(path133) {
3588
- if (Collection.isEmptyPath(path133))
3587
+ hasIn(path135) {
3588
+ if (Collection.isEmptyPath(path135))
3589
3589
  return this.contents !== void 0;
3590
- return identity.isCollection(this.contents) ? this.contents.hasIn(path133) : false;
3590
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path135) : false;
3591
3591
  }
3592
3592
  /**
3593
3593
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -3604,13 +3604,13 @@ var require_Document = __commonJS({
3604
3604
  * Sets a value in this document. For `!!set`, `value` needs to be a
3605
3605
  * boolean to add/remove the item from the set.
3606
3606
  */
3607
- setIn(path133, value) {
3608
- if (Collection.isEmptyPath(path133)) {
3607
+ setIn(path135, value) {
3608
+ if (Collection.isEmptyPath(path135)) {
3609
3609
  this.contents = value;
3610
3610
  } else if (this.contents == null) {
3611
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path133), value);
3611
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path135), value);
3612
3612
  } else if (assertCollection(this.contents)) {
3613
- this.contents.setIn(path133, value);
3613
+ this.contents.setIn(path135, value);
3614
3614
  }
3615
3615
  }
3616
3616
  /**
@@ -3996,10 +3996,10 @@ var require_resolve_block_map = __commonJS({
3996
3996
  let offset = bm.offset;
3997
3997
  let commentEnd = null;
3998
3998
  for (const collItem of bm.items) {
3999
- const { start, key, sep: sep15, value } = collItem;
3999
+ const { start, key, sep: sep16, value } = collItem;
4000
4000
  const keyProps = resolveProps.resolveProps(start, {
4001
4001
  indicator: "explicit-key-ind",
4002
- next: key ?? sep15?.[0],
4002
+ next: key ?? sep16?.[0],
4003
4003
  offset,
4004
4004
  onError,
4005
4005
  parentIndent: bm.indent,
@@ -4013,7 +4013,7 @@ var require_resolve_block_map = __commonJS({
4013
4013
  else if ("indent" in key && key.indent !== bm.indent)
4014
4014
  onError(offset, "BAD_INDENT", startColMsg);
4015
4015
  }
4016
- if (!keyProps.anchor && !keyProps.tag && !sep15) {
4016
+ if (!keyProps.anchor && !keyProps.tag && !sep16) {
4017
4017
  commentEnd = keyProps.end;
4018
4018
  if (keyProps.comment) {
4019
4019
  if (map.comment)
@@ -4037,7 +4037,7 @@ var require_resolve_block_map = __commonJS({
4037
4037
  ctx.atKey = false;
4038
4038
  if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
4039
4039
  onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
4040
- const valueProps = resolveProps.resolveProps(sep15 ?? [], {
4040
+ const valueProps = resolveProps.resolveProps(sep16 ?? [], {
4041
4041
  indicator: "map-value-ind",
4042
4042
  next: value,
4043
4043
  offset: keyNode.range[2],
@@ -4053,7 +4053,7 @@ var require_resolve_block_map = __commonJS({
4053
4053
  if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
4054
4054
  onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
4055
4055
  }
4056
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep15, null, valueProps, onError);
4056
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep16, null, valueProps, onError);
4057
4057
  if (ctx.schema.compat)
4058
4058
  utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
4059
4059
  offset = valueNode.range[2];
@@ -4144,7 +4144,7 @@ var require_resolve_end = __commonJS({
4144
4144
  let comment = "";
4145
4145
  if (end) {
4146
4146
  let hasSpace = false;
4147
- let sep15 = "";
4147
+ let sep16 = "";
4148
4148
  for (const token of end) {
4149
4149
  const { source, type } = token;
4150
4150
  switch (type) {
@@ -4158,13 +4158,13 @@ var require_resolve_end = __commonJS({
4158
4158
  if (!comment)
4159
4159
  comment = cb;
4160
4160
  else
4161
- comment += sep15 + cb;
4162
- sep15 = "";
4161
+ comment += sep16 + cb;
4162
+ sep16 = "";
4163
4163
  break;
4164
4164
  }
4165
4165
  case "newline":
4166
4166
  if (comment)
4167
- sep15 += source;
4167
+ sep16 += source;
4168
4168
  hasSpace = true;
4169
4169
  break;
4170
4170
  default:
@@ -4207,18 +4207,18 @@ var require_resolve_flow_collection = __commonJS({
4207
4207
  let offset = fc.offset + fc.start.source.length;
4208
4208
  for (let i = 0; i < fc.items.length; ++i) {
4209
4209
  const collItem = fc.items[i];
4210
- const { start, key, sep: sep15, value } = collItem;
4210
+ const { start, key, sep: sep16, value } = collItem;
4211
4211
  const props = resolveProps.resolveProps(start, {
4212
4212
  flow: fcName,
4213
4213
  indicator: "explicit-key-ind",
4214
- next: key ?? sep15?.[0],
4214
+ next: key ?? sep16?.[0],
4215
4215
  offset,
4216
4216
  onError,
4217
4217
  parentIndent: fc.indent,
4218
4218
  startOnNewline: false
4219
4219
  });
4220
4220
  if (!props.found) {
4221
- if (!props.anchor && !props.tag && !sep15 && !value) {
4221
+ if (!props.anchor && !props.tag && !sep16 && !value) {
4222
4222
  if (i === 0 && props.comma)
4223
4223
  onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
4224
4224
  else if (i < fc.items.length - 1)
@@ -4272,8 +4272,8 @@ var require_resolve_flow_collection = __commonJS({
4272
4272
  }
4273
4273
  }
4274
4274
  }
4275
- if (!isMap && !sep15 && !props.found) {
4276
- const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep15, null, props, onError);
4275
+ if (!isMap && !sep16 && !props.found) {
4276
+ const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep16, null, props, onError);
4277
4277
  coll.items.push(valueNode);
4278
4278
  offset = valueNode.range[2];
4279
4279
  if (isBlock(value))
@@ -4285,7 +4285,7 @@ var require_resolve_flow_collection = __commonJS({
4285
4285
  if (isBlock(key))
4286
4286
  onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
4287
4287
  ctx.atKey = false;
4288
- const valueProps = resolveProps.resolveProps(sep15 ?? [], {
4288
+ const valueProps = resolveProps.resolveProps(sep16 ?? [], {
4289
4289
  flow: fcName,
4290
4290
  indicator: "map-value-ind",
4291
4291
  next: value,
@@ -4296,8 +4296,8 @@ var require_resolve_flow_collection = __commonJS({
4296
4296
  });
4297
4297
  if (valueProps.found) {
4298
4298
  if (!isMap && !props.found && ctx.options.strict) {
4299
- if (sep15)
4300
- for (const st of sep15) {
4299
+ if (sep16)
4300
+ for (const st of sep16) {
4301
4301
  if (st === valueProps.found)
4302
4302
  break;
4303
4303
  if (st.type === "newline") {
@@ -4314,7 +4314,7 @@ var require_resolve_flow_collection = __commonJS({
4314
4314
  else
4315
4315
  onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
4316
4316
  }
4317
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep15, null, valueProps, onError) : null;
4317
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep16, null, valueProps, onError) : null;
4318
4318
  if (valueNode) {
4319
4319
  if (isBlock(value))
4320
4320
  onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
@@ -4494,7 +4494,7 @@ var require_resolve_block_scalar = __commonJS({
4494
4494
  chompStart = i + 1;
4495
4495
  }
4496
4496
  let value = "";
4497
- let sep15 = "";
4497
+ let sep16 = "";
4498
4498
  let prevMoreIndented = false;
4499
4499
  for (let i = 0; i < contentStart; ++i)
4500
4500
  value += lines[i][0].slice(trimIndent) + "\n";
@@ -4511,24 +4511,24 @@ var require_resolve_block_scalar = __commonJS({
4511
4511
  indent = "";
4512
4512
  }
4513
4513
  if (type === Scalar.Scalar.BLOCK_LITERAL) {
4514
- value += sep15 + indent.slice(trimIndent) + content;
4515
- sep15 = "\n";
4514
+ value += sep16 + indent.slice(trimIndent) + content;
4515
+ sep16 = "\n";
4516
4516
  } else if (indent.length > trimIndent || content[0] === " ") {
4517
- if (sep15 === " ")
4518
- sep15 = "\n";
4519
- else if (!prevMoreIndented && sep15 === "\n")
4520
- sep15 = "\n\n";
4521
- value += sep15 + indent.slice(trimIndent) + content;
4522
- sep15 = "\n";
4517
+ if (sep16 === " ")
4518
+ sep16 = "\n";
4519
+ else if (!prevMoreIndented && sep16 === "\n")
4520
+ sep16 = "\n\n";
4521
+ value += sep16 + indent.slice(trimIndent) + content;
4522
+ sep16 = "\n";
4523
4523
  prevMoreIndented = true;
4524
4524
  } else if (content === "") {
4525
- if (sep15 === "\n")
4525
+ if (sep16 === "\n")
4526
4526
  value += "\n";
4527
4527
  else
4528
- sep15 = "\n";
4528
+ sep16 = "\n";
4529
4529
  } else {
4530
- value += sep15 + content;
4531
- sep15 = " ";
4530
+ value += sep16 + content;
4531
+ sep16 = " ";
4532
4532
  prevMoreIndented = false;
4533
4533
  }
4534
4534
  }
@@ -4631,7 +4631,7 @@ var require_resolve_flow_scalar = __commonJS({
4631
4631
  const { offset, type, source, end } = scalar;
4632
4632
  let _type;
4633
4633
  let value;
4634
- const _onError = (rel, code, msg) => onError(offset + rel, code, msg);
4634
+ const _onError = (rel2, code, msg) => onError(offset + rel2, code, msg);
4635
4635
  switch (type) {
4636
4636
  case "scalar":
4637
4637
  _type = Scalar.Scalar.PLAIN;
@@ -4710,25 +4710,25 @@ var require_resolve_flow_scalar = __commonJS({
4710
4710
  if (!match)
4711
4711
  return source;
4712
4712
  let res = match[1];
4713
- let sep15 = " ";
4713
+ let sep16 = " ";
4714
4714
  let pos = first.lastIndex;
4715
4715
  line.lastIndex = pos;
4716
4716
  while (match = line.exec(source)) {
4717
4717
  if (match[1] === "") {
4718
- if (sep15 === "\n")
4719
- res += sep15;
4718
+ if (sep16 === "\n")
4719
+ res += sep16;
4720
4720
  else
4721
- sep15 = "\n";
4721
+ sep16 = "\n";
4722
4722
  } else {
4723
- res += sep15 + match[1];
4724
- sep15 = " ";
4723
+ res += sep16 + match[1];
4724
+ sep16 = " ";
4725
4725
  }
4726
4726
  pos = line.lastIndex;
4727
4727
  }
4728
4728
  const last = /[ \t]*(.*)/sy;
4729
4729
  last.lastIndex = pos;
4730
4730
  match = last.exec(source);
4731
- return res + sep15 + (match?.[1] ?? "");
4731
+ return res + sep16 + (match?.[1] ?? "");
4732
4732
  }
4733
4733
  function doubleQuotedValue(source, onError) {
4734
4734
  let res = "";
@@ -5538,14 +5538,14 @@ var require_cst_stringify = __commonJS({
5538
5538
  }
5539
5539
  }
5540
5540
  }
5541
- function stringifyItem({ start, key, sep: sep15, value }) {
5541
+ function stringifyItem({ start, key, sep: sep16, value }) {
5542
5542
  let res = "";
5543
5543
  for (const st of start)
5544
5544
  res += st.source;
5545
5545
  if (key)
5546
5546
  res += stringifyToken(key);
5547
- if (sep15)
5548
- for (const st of sep15)
5547
+ if (sep16)
5548
+ for (const st of sep16)
5549
5549
  res += st.source;
5550
5550
  if (value)
5551
5551
  res += stringifyToken(value);
@@ -5570,9 +5570,9 @@ var require_cst_visit = __commonJS({
5570
5570
  visit.BREAK = BREAK;
5571
5571
  visit.SKIP = SKIP;
5572
5572
  visit.REMOVE = REMOVE;
5573
- visit.itemAtPath = (cst, path133) => {
5573
+ visit.itemAtPath = (cst, path135) => {
5574
5574
  let item = cst;
5575
- for (const [field, index] of path133) {
5575
+ for (const [field, index] of path135) {
5576
5576
  const tok = item?.[field];
5577
5577
  if (tok && "items" in tok) {
5578
5578
  item = tok.items[index];
@@ -5581,23 +5581,23 @@ var require_cst_visit = __commonJS({
5581
5581
  }
5582
5582
  return item;
5583
5583
  };
5584
- visit.parentCollection = (cst, path133) => {
5585
- const parent = visit.itemAtPath(cst, path133.slice(0, -1));
5586
- const field = path133[path133.length - 1][0];
5584
+ visit.parentCollection = (cst, path135) => {
5585
+ const parent = visit.itemAtPath(cst, path135.slice(0, -1));
5586
+ const field = path135[path135.length - 1][0];
5587
5587
  const coll = parent?.[field];
5588
5588
  if (coll && "items" in coll)
5589
5589
  return coll;
5590
5590
  throw new Error("Parent collection not found");
5591
5591
  };
5592
- function _visit(path133, item, visitor) {
5593
- let ctrl = visitor(item, path133);
5592
+ function _visit(path135, item, visitor) {
5593
+ let ctrl = visitor(item, path135);
5594
5594
  if (typeof ctrl === "symbol")
5595
5595
  return ctrl;
5596
5596
  for (const field of ["key", "value"]) {
5597
5597
  const token = item[field];
5598
5598
  if (token && "items" in token) {
5599
5599
  for (let i = 0; i < token.items.length; ++i) {
5600
- const ci = _visit(Object.freeze(path133.concat([[field, i]])), token.items[i], visitor);
5600
+ const ci = _visit(Object.freeze(path135.concat([[field, i]])), token.items[i], visitor);
5601
5601
  if (typeof ci === "number")
5602
5602
  i = ci - 1;
5603
5603
  else if (ci === BREAK)
@@ -5608,10 +5608,10 @@ var require_cst_visit = __commonJS({
5608
5608
  }
5609
5609
  }
5610
5610
  if (typeof ctrl === "function" && field === "key")
5611
- ctrl = ctrl(item, path133);
5611
+ ctrl = ctrl(item, path135);
5612
5612
  }
5613
5613
  }
5614
- return typeof ctrl === "function" ? ctrl(item, path133) : ctrl;
5614
+ return typeof ctrl === "function" ? ctrl(item, path135) : ctrl;
5615
5615
  }
5616
5616
  exports.visit = visit;
5617
5617
  }
@@ -6712,18 +6712,18 @@ var require_parser = __commonJS({
6712
6712
  if (this.type === "map-value-ind") {
6713
6713
  const prev = getPrevProps(this.peek(2));
6714
6714
  const start = getFirstKeyStartProps(prev);
6715
- let sep15;
6715
+ let sep16;
6716
6716
  if (scalar.end) {
6717
- sep15 = scalar.end;
6718
- sep15.push(this.sourceToken);
6717
+ sep16 = scalar.end;
6718
+ sep16.push(this.sourceToken);
6719
6719
  delete scalar.end;
6720
6720
  } else
6721
- sep15 = [this.sourceToken];
6721
+ sep16 = [this.sourceToken];
6722
6722
  const map = {
6723
6723
  type: "block-map",
6724
6724
  offset: scalar.offset,
6725
6725
  indent: scalar.indent,
6726
- items: [{ start, key: scalar, sep: sep15 }]
6726
+ items: [{ start, key: scalar, sep: sep16 }]
6727
6727
  };
6728
6728
  this.onKeyLine = true;
6729
6729
  this.stack[this.stack.length - 1] = map;
@@ -6876,15 +6876,15 @@ var require_parser = __commonJS({
6876
6876
  } else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
6877
6877
  const start2 = getFirstKeyStartProps(it.start);
6878
6878
  const key = it.key;
6879
- const sep15 = it.sep;
6880
- sep15.push(this.sourceToken);
6879
+ const sep16 = it.sep;
6880
+ sep16.push(this.sourceToken);
6881
6881
  delete it.key;
6882
6882
  delete it.sep;
6883
6883
  this.stack.push({
6884
6884
  type: "block-map",
6885
6885
  offset: this.offset,
6886
6886
  indent: this.indent,
6887
- items: [{ start: start2, key, sep: sep15 }]
6887
+ items: [{ start: start2, key, sep: sep16 }]
6888
6888
  });
6889
6889
  } else if (start.length > 0) {
6890
6890
  it.sep = it.sep.concat(start, this.sourceToken);
@@ -6913,14 +6913,14 @@ var require_parser = __commonJS({
6913
6913
  case "scalar":
6914
6914
  case "single-quoted-scalar":
6915
6915
  case "double-quoted-scalar": {
6916
- const fs126 = this.flowScalar(this.type);
6916
+ const fs127 = this.flowScalar(this.type);
6917
6917
  if (atNextItem || it.value) {
6918
- map.items.push({ start, key: fs126, sep: [] });
6918
+ map.items.push({ start, key: fs127, sep: [] });
6919
6919
  this.onKeyLine = true;
6920
6920
  } else if (it.sep) {
6921
- this.stack.push(fs126);
6921
+ this.stack.push(fs127);
6922
6922
  } else {
6923
- Object.assign(it, { key: fs126, sep: [] });
6923
+ Object.assign(it, { key: fs127, sep: [] });
6924
6924
  this.onKeyLine = true;
6925
6925
  }
6926
6926
  return;
@@ -7048,13 +7048,13 @@ var require_parser = __commonJS({
7048
7048
  case "scalar":
7049
7049
  case "single-quoted-scalar":
7050
7050
  case "double-quoted-scalar": {
7051
- const fs126 = this.flowScalar(this.type);
7051
+ const fs127 = this.flowScalar(this.type);
7052
7052
  if (!it || it.value)
7053
- fc.items.push({ start: [], key: fs126, sep: [] });
7053
+ fc.items.push({ start: [], key: fs127, sep: [] });
7054
7054
  else if (it.sep)
7055
- this.stack.push(fs126);
7055
+ this.stack.push(fs127);
7056
7056
  else
7057
- Object.assign(it, { key: fs126, sep: [] });
7057
+ Object.assign(it, { key: fs127, sep: [] });
7058
7058
  return;
7059
7059
  }
7060
7060
  case "flow-map-end":
@@ -7078,13 +7078,13 @@ var require_parser = __commonJS({
7078
7078
  const prev = getPrevProps(parent);
7079
7079
  const start = getFirstKeyStartProps(prev);
7080
7080
  fixFlowSeqItems(fc);
7081
- const sep15 = fc.end.splice(1, fc.end.length);
7082
- sep15.push(this.sourceToken);
7081
+ const sep16 = fc.end.splice(1, fc.end.length);
7082
+ sep16.push(this.sourceToken);
7083
7083
  const map = {
7084
7084
  type: "block-map",
7085
7085
  offset: fc.offset,
7086
7086
  indent: fc.indent,
7087
- items: [{ start, key: fc, sep: sep15 }]
7087
+ items: [{ start, key: fc, sep: sep16 }]
7088
7088
  };
7089
7089
  this.onKeyLine = true;
7090
7090
  this.stack[this.stack.length - 1] = map;
@@ -7363,16 +7363,16 @@ var require_dist = __commonJS({
7363
7363
  });
7364
7364
 
7365
7365
  // src/scripts/hooks/dispatch_entry.ts
7366
- import * as path132 from "node:path";
7367
- import { fileURLToPath as fileURLToPath75 } from "node:url";
7366
+ import * as path134 from "node:path";
7367
+ import { fileURLToPath as fileURLToPath76 } from "node:url";
7368
7368
 
7369
7369
  // src/scripts/hooks/dispatch_hook.ts
7370
7370
  var import_yaml9 = __toESM(require_dist(), 1);
7371
7371
  import { spawnSync as spawnSync12 } from "node:child_process";
7372
- import fs125 from "node:fs";
7373
- import path131 from "node:path";
7372
+ import fs126 from "node:fs";
7373
+ import path133 from "node:path";
7374
7374
  import * as tty2 from "node:tty";
7375
- import { fileURLToPath as fileURLToPath74, pathToFileURL as pathToFileURL64 } from "node:url";
7375
+ import { fileURLToPath as fileURLToPath75, pathToFileURL as pathToFileURL64 } from "node:url";
7376
7376
 
7377
7377
  // src/scripts/hooks/bundle_integrity.ts
7378
7378
  import { createHash as createHash3 } from "node:crypto";
@@ -8493,13 +8493,13 @@ function recordTurnSpend(workspaceRoot3, session, bytes, opts = {}) {
8493
8493
  }
8494
8494
  }
8495
8495
  function _turnStartBound(packageRoot, platform) {
8496
- for (const rel of [
8496
+ for (const rel2 of [
8497
8497
  ["src", "scripts", "hook_manifest.json"],
8498
8498
  ["src", "scripts", "hook_manifest.yaml"]
8499
8499
  ]) {
8500
8500
  try {
8501
- const raw = fs5.readFileSync(path5.join(packageRoot, ...rel), "utf-8");
8502
- if (rel[2] === "hook_manifest.json") {
8501
+ const raw = fs5.readFileSync(path5.join(packageRoot, ...rel2), "utf-8");
8502
+ if (rel2[2] === "hook_manifest.json") {
8503
8503
  const parsed = JSON.parse(raw);
8504
8504
  const platforms = parsed.manifest?.["platforms"];
8505
8505
  const bound = platforms?.[platform]?.[TURN_START_EVENT];
@@ -8686,9 +8686,9 @@ var PROJECTION_SOURCE_LANES = [
8686
8686
  // fingerprints for exactly that.
8687
8687
  ["guidelines/", "docs/guidelines/"]
8688
8688
  ];
8689
- function source_identity(rel) {
8690
- if (!rel.startsWith(PROJECTION_PREFIX)) return rel;
8691
- const tail = rel.slice(PROJECTION_PREFIX.length);
8689
+ function source_identity(rel2) {
8690
+ if (!rel2.startsWith(PROJECTION_PREFIX)) return rel2;
8691
+ const tail = rel2.slice(PROJECTION_PREFIX.length);
8692
8692
  for (const [lane, sourceRoot] of PROJECTION_SOURCE_LANES) {
8693
8693
  if (tail.startsWith(lane)) return sourceRoot + tail.slice(lane.length);
8694
8694
  }
@@ -8707,9 +8707,9 @@ var ScannedFile = class {
8707
8707
  /** check id → the sha256 fingerprints that pragma accepts. Empty = unbound. */
8708
8708
  pragma_hashes;
8709
8709
  weight;
8710
- constructor(pathArg, rel, lines, in_example_fence, in_any_fence, pragmas, weight, pragma_hashes = {}) {
8710
+ constructor(pathArg, rel2, lines, in_example_fence, in_any_fence, pragmas, weight, pragma_hashes = {}) {
8711
8711
  this.path = pathArg;
8712
- this.rel = rel;
8712
+ this.rel = rel2;
8713
8713
  this.lines = lines;
8714
8714
  this.in_example_fence = in_example_fence;
8715
8715
  this.in_any_fence = in_any_fence;
@@ -8831,17 +8831,17 @@ function _splitlines(text) {
8831
8831
  return out;
8832
8832
  }
8833
8833
  function scan_file(filePath) {
8834
- let rel;
8834
+ let rel2;
8835
8835
  if (path6.isAbsolute(filePath)) {
8836
8836
  const root = path6.resolve(ROOT);
8837
8837
  const resolved = path6.resolve(filePath);
8838
8838
  if (resolved === root || resolved.startsWith(root + path6.sep)) {
8839
- rel = path6.relative(root, resolved).split(path6.sep).join("/");
8839
+ rel2 = path6.relative(root, resolved).split(path6.sep).join("/");
8840
8840
  } else {
8841
- rel = path6.basename(filePath);
8841
+ rel2 = path6.basename(filePath);
8842
8842
  }
8843
8843
  } else {
8844
- rel = filePath.split(path6.sep).join("/");
8844
+ rel2 = filePath.split(path6.sep).join("/");
8845
8845
  }
8846
8846
  const raw = fs6.readFileSync(filePath, "utf-8");
8847
8847
  const lines = _splitlines(raw);
@@ -8892,33 +8892,33 @@ function scan_file(filePath) {
8892
8892
  }
8893
8893
  return new ScannedFile(
8894
8894
  filePath,
8895
- rel,
8895
+ rel2,
8896
8896
  lines,
8897
8897
  in_example,
8898
8898
  in_any,
8899
8899
  pragmas,
8900
- path_weight(rel),
8900
+ path_weight(rel2),
8901
8901
  pragmaHashes
8902
8902
  );
8903
8903
  }
8904
8904
  function scan_path(filePath, base) {
8905
8905
  const sf = scan_file(filePath);
8906
- let rel;
8906
+ let rel2;
8907
8907
  const baseResolved = path6.resolve(base);
8908
8908
  const fileResolved = path6.resolve(filePath);
8909
8909
  if (fileResolved === baseResolved || fileResolved.startsWith(baseResolved + path6.sep)) {
8910
- rel = path6.relative(baseResolved, fileResolved).split(path6.sep).join("/");
8910
+ rel2 = path6.relative(baseResolved, fileResolved).split(path6.sep).join("/");
8911
8911
  } else {
8912
- rel = path6.basename(filePath);
8912
+ rel2 = path6.basename(filePath);
8913
8913
  }
8914
8914
  return new ScannedFile(
8915
8915
  sf.path,
8916
- rel,
8916
+ rel2,
8917
8917
  sf.lines,
8918
8918
  sf.in_example_fence,
8919
8919
  sf.in_any_fence,
8920
8920
  sf.pragmas,
8921
- path_weight(rel),
8921
+ path_weight(rel2),
8922
8922
  sf.pragma_hashes
8923
8923
  );
8924
8924
  }
@@ -9515,15 +9515,15 @@ var _GENERATED_PREFIXES = [
9515
9515
  // is DATA, on the same principle as the captures above.
9516
9516
  "internal/bench/corpora/encoding-channels/"
9517
9517
  ];
9518
- function _isGenerated(rel) {
9519
- return _GENERATED_PREFIXES.some((p) => rel.startsWith(p));
9518
+ function _isGenerated(rel2) {
9519
+ return _GENERATED_PREFIXES.some((p) => rel2.startsWith(p));
9520
9520
  }
9521
9521
  function _isRawControlCodepoint(cp) {
9522
9522
  if (cp === 9 || cp === 10 || cp === 13) return false;
9523
9523
  return cp <= 31 || cp >= 127 && cp <= 159;
9524
9524
  }
9525
- function _extensionOf(rel) {
9526
- const base = rel.slice(rel.lastIndexOf("/") + 1);
9525
+ function _extensionOf(rel2) {
9526
+ const base = rel2.slice(rel2.lastIndexOf("/") + 1);
9527
9527
  const dot = base.lastIndexOf(".");
9528
9528
  return dot <= 0 ? "" : base.slice(dot + 1).toLowerCase();
9529
9529
  }
@@ -9538,18 +9538,18 @@ function _trackedFiles() {
9538
9538
  function _eligibleSourceFiles() {
9539
9539
  const tracked = _trackedFiles();
9540
9540
  if (tracked === null) return null;
9541
- return tracked.filter((rel) => !_isGenerated(rel) && !_BINARY_EXT.has(_extensionOf(rel)));
9541
+ return tracked.filter((rel2) => !_isGenerated(rel2) && !_BINARY_EXT.has(_extensionOf(rel2)));
9542
9542
  }
9543
9543
  function _scanSourceControlBytes(files = null) {
9544
9544
  const tracked = files ?? _eligibleSourceFiles();
9545
9545
  if (tracked === null) return [];
9546
9546
  const out = [];
9547
- for (const rel of tracked) {
9548
- if (_isGenerated(rel)) continue;
9549
- if (_BINARY_EXT.has(_extensionOf(rel))) continue;
9547
+ for (const rel2 of tracked) {
9548
+ if (_isGenerated(rel2)) continue;
9549
+ if (_BINARY_EXT.has(_extensionOf(rel2))) continue;
9550
9550
  let data;
9551
9551
  try {
9552
- data = fs7.readFileSync(path7.join(ROOT, rel));
9552
+ data = fs7.readFileSync(path7.join(ROOT, rel2));
9553
9553
  } catch {
9554
9554
  continue;
9555
9555
  }
@@ -9570,7 +9570,7 @@ function _scanSourceControlBytes(files = null) {
9570
9570
  const hex = cp.toString(16).toUpperCase().padStart(2, "0");
9571
9571
  out.push(
9572
9572
  new Finding(
9573
- rel,
9573
+ rel2,
9574
9574
  line,
9575
9575
  CHECK,
9576
9576
  "HIGH",
@@ -9680,8 +9680,8 @@ function main(argv = null) {
9680
9680
  if (args.fix) {
9681
9681
  for (const p of [...flagged].sort()) {
9682
9682
  const sanitized = _sanitize(p);
9683
- const rel = path7.relative(path7.resolve(ROOT), path7.resolve(sanitized));
9684
- process.stdout.write(` fixed \u2192 ${rel.split(path7.sep).join("/")}
9683
+ const rel2 = path7.relative(path7.resolve(ROOT), path7.resolve(sanitized));
9684
+ process.stdout.write(` fixed \u2192 ${rel2.split(path7.sep).join("/")}
9685
9685
  `);
9686
9686
  }
9687
9687
  }
@@ -15863,6 +15863,8 @@ function segmentVerifies(rawWords) {
15863
15863
  case "node":
15864
15864
  case "deno":
15865
15865
  return rest.some((a) => a === "test" || a.startsWith("--test"));
15866
+ case "agent-config":
15867
+ return false;
15866
15868
  case "scripts-run": {
15867
15869
  const script = bareName(arg1);
15868
15870
  return /^(check|lint|verify|validate)[-_]/.test(script);
@@ -15880,6 +15882,12 @@ var _WIDE_CANDIDATE_RE = /\b(test|tests|vitest|jest|pytest|phpunit|pest|tsc|esli
15880
15882
  function mightBeVerification(command) {
15881
15883
  return _WIDE_CANDIDATE_RE.test(command);
15882
15884
  }
15885
+ function isAssetRenderCommand(command) {
15886
+ return /\bui:render\b/.test(command) && /--profile[= ]\s*asset\b/.test(command);
15887
+ }
15888
+ function isVerificationAttempt(command) {
15889
+ return isVerificationCommand(command) || isAssetRenderCommand(command);
15890
+ }
15883
15891
 
15884
15892
  // src/scripts/_lib/touched_file_quality.ts
15885
15893
  import { spawnSync as spawnSync2 } from "node:child_process";
@@ -18193,8 +18201,8 @@ function _sessionKeyed(session_id, legacy, stem, suffix) {
18193
18201
  if (id === "") {
18194
18202
  return legacy;
18195
18203
  }
18196
- const rel = path25.join(_STATE_REL, `${stem}-${safe_stem(id)}${suffix}`);
18197
- const norm = path25.normalize(rel);
18204
+ const rel2 = path25.join(_STATE_REL, `${stem}-${safe_stem(id)}${suffix}`);
18205
+ const norm = path25.normalize(rel2);
18198
18206
  if (!norm.startsWith(`${_STATE_REL}${path25.sep}`) || norm.includes("..")) {
18199
18207
  return legacy;
18200
18208
  }
@@ -18325,8 +18333,8 @@ function lockfile_path(env) {
18325
18333
  }
18326
18334
  return write_target("installed.lock", { env: env ?? null });
18327
18335
  }
18328
- function read_lockfile(path133) {
18329
- const target = path133 ?? lockfile_path();
18336
+ function read_lockfile(path135) {
18337
+ const target = path135 ?? lockfile_path();
18330
18338
  let text;
18331
18339
  try {
18332
18340
  text = fs27.readFileSync(target, { encoding: "utf-8" });
@@ -18686,8 +18694,8 @@ function roadmap_claim_rel(session_id) {
18686
18694
  if (id === "") {
18687
18695
  return ROADMAP_CLAIM_REL;
18688
18696
  }
18689
- const rel = path28.join(_STATE_REL2, `roadmap-claim-${safe_stem(id)}.json`);
18690
- const norm = path28.normalize(rel);
18697
+ const rel2 = path28.join(_STATE_REL2, `roadmap-claim-${safe_stem(id)}.json`);
18698
+ const norm = path28.normalize(rel2);
18691
18699
  if (!norm.startsWith(`${_STATE_REL2}${path28.sep}`) || norm.includes("..")) {
18692
18700
  return ROADMAP_CLAIM_REL;
18693
18701
  }
@@ -18700,22 +18708,22 @@ function claim_dir(workspace_root) {
18700
18708
  }
18701
18709
  function claim_file(workspace_root, session_id) {
18702
18710
  const dir = claim_dir(workspace_root);
18703
- const rel = roadmap_claim_rel(session_id);
18704
- if (dir === null) return path28.join(workspace_root, rel);
18705
- return path28.join(dir, path28.basename(rel));
18711
+ const rel2 = roadmap_claim_rel(session_id);
18712
+ if (dir === null) return path28.join(workspace_root, rel2);
18713
+ return path28.join(dir, path28.basename(rel2));
18706
18714
  }
18707
18715
  function claim_read_paths(workspace_root, session_id) {
18708
- const rel = roadmap_claim_rel(session_id);
18716
+ const rel2 = roadmap_claim_rel(session_id);
18709
18717
  const dir = claim_dir(workspace_root);
18710
18718
  const out = [];
18711
18719
  if (dir !== null) {
18712
- out.push(path28.join(dir, path28.basename(rel)));
18713
- if (rel !== ROADMAP_CLAIM_REL) {
18720
+ out.push(path28.join(dir, path28.basename(rel2)));
18721
+ if (rel2 !== ROADMAP_CLAIM_REL) {
18714
18722
  out.push(path28.join(dir, path28.basename(ROADMAP_CLAIM_REL)));
18715
18723
  }
18716
18724
  }
18717
- out.push(path28.join(workspace_root, rel));
18718
- if (rel !== ROADMAP_CLAIM_REL) {
18725
+ out.push(path28.join(workspace_root, rel2));
18726
+ if (rel2 !== ROADMAP_CLAIM_REL) {
18719
18727
  out.push(path28.join(workspace_root, ROADMAP_CLAIM_REL));
18720
18728
  }
18721
18729
  return out;
@@ -18792,8 +18800,8 @@ function claim_is_stale(workspace_root, slug, peer_worktree) {
18792
18800
  return false;
18793
18801
  }
18794
18802
  const base = slug.trim().replace(/\.md$/, "");
18795
- const rel = path28.normalize(path28.join("agents", "roadmaps", `${base}.md`));
18796
- const inside = path28.dirname(rel) === path28.join("agents", "roadmaps");
18803
+ const rel2 = path28.normalize(path28.join("agents", "roadmaps", `${base}.md`));
18804
+ const inside = path28.dirname(rel2) === path28.join("agents", "roadmaps");
18797
18805
  if (!inside || path28.isAbsolute(base)) {
18798
18806
  return true;
18799
18807
  }
@@ -18802,7 +18810,7 @@ function claim_is_stale(workspace_root, slug, peer_worktree) {
18802
18810
  );
18803
18811
  for (const root of roots) {
18804
18812
  try {
18805
- if (fs29.existsSync(path28.join(root, rel))) {
18813
+ if (fs29.existsSync(path28.join(root, rel2))) {
18806
18814
  return false;
18807
18815
  }
18808
18816
  } catch {
@@ -20325,8 +20333,8 @@ function _target_root(p, consumer_root) {
20325
20333
  if (idx < 0) {
20326
20334
  return null;
20327
20335
  }
20328
- const rel = norm.slice(idx + 1);
20329
- if (!_is_roadmap_touch(rel)) {
20336
+ const rel2 = norm.slice(idx + 1);
20337
+ if (!_is_roadmap_touch(rel2)) {
20330
20338
  return null;
20331
20339
  }
20332
20340
  return norm.slice(0, idx) || "/";
@@ -20584,8 +20592,8 @@ var SETTINGS_CANDIDATES = [
20584
20592
  SETTINGS_FILE2
20585
20593
  ];
20586
20594
  function resolve_settings_path(consumer_root) {
20587
- for (const rel of SETTINGS_CANDIDATES) {
20588
- const candidate = path32.join(consumer_root, rel);
20595
+ for (const rel2 of SETTINGS_CANDIDATES) {
20596
+ const candidate = path32.join(consumer_root, rel2);
20589
20597
  try {
20590
20598
  if (fs33.statSync(candidate).isFile()) {
20591
20599
  return candidate;
@@ -22119,7 +22127,7 @@ function _agent_config_executable(consumer_root) {
22119
22127
  }
22120
22128
  function _regenerator_present(consumer_root) {
22121
22129
  return REGENERATOR_PATHS.some(
22122
- (rel) => _isFile5(path38.join(consumer_root, rel))
22130
+ (rel2) => _isFile5(path38.join(consumer_root, rel2))
22123
22131
  );
22124
22132
  }
22125
22133
  function _setup_complete(consumer_root) {
@@ -29709,8 +29717,8 @@ var _PATH_KEYS3 = ["file_path", "path", "target_file", "filePath", "notebook_pat
29709
29717
  var CLASS_C_BASENAMES = [".agent-settings.yml", ".agent-settings.yaml", ".git-convention.yml", "settings.json"];
29710
29718
  var SETTINGS_CLASSES_RELATIVE = "docs/contracts/settings-classes.md";
29711
29719
  function classify_target(p) {
29712
- const posix = p.split(path66.sep).join("/");
29713
- const base = posix.split("/").pop() ?? "";
29720
+ const posix2 = p.split(path66.sep).join("/");
29721
+ const base = posix2.split("/").pop() ?? "";
29714
29722
  if (/_allowlist\.(json|txt)$/.test(base) || /^allowlist[-_.]/.test(base)) {
29715
29723
  return "allowlist";
29716
29724
  }
@@ -29721,7 +29729,7 @@ function classify_target(p) {
29721
29729
  return "advisory";
29722
29730
  }
29723
29731
  if (base === "settings.json") {
29724
- return /(^|\/)\.(claude|cursor|augment|windsurf)\/settings\.json$/.test(posix) ? "class-c" : null;
29732
+ return /(^|\/)\.(claude|cursor|augment|windsurf)\/settings\.json$/.test(posix2) ? "class-c" : null;
29725
29733
  }
29726
29734
  if (CLASS_C_BASENAMES.includes(base)) {
29727
29735
  return "class-c";
@@ -29740,8 +29748,8 @@ function leafPaths(value, prefix = "") {
29740
29748
  }
29741
29749
  return out;
29742
29750
  }
29743
- function parseSettingsDoc(text, rel) {
29744
- if (rel.endsWith(".json")) {
29751
+ function parseSettingsDoc(text, rel2) {
29752
+ if (rel2.endsWith(".json")) {
29745
29753
  try {
29746
29754
  return JSON.parse(text) ?? null;
29747
29755
  } catch {
@@ -29977,9 +29985,9 @@ function main37() {
29977
29985
  if (added <= 0) {
29978
29986
  continue;
29979
29987
  }
29980
- const rel = path66.relative(root, abs) || p;
29981
- const total = kind === "allowlist" ? bump_session(root, session, rel, added) : added;
29982
- const d = decide2(kind, rel, total, added);
29988
+ const rel2 = path66.relative(root, abs) || p;
29989
+ const total = kind === "allowlist" ? bump_session(root, session, rel2, added) : added;
29990
+ const d = decide2(kind, rel2, total, added);
29983
29991
  if (d.action === "block") {
29984
29992
  process.stderr.write(`block-config-weakening: BLOCKED \u2014 ${d.reason}
29985
29993
  `);
@@ -30066,10 +30074,14 @@ function isGlobOverAcceptableInboxDir(name) {
30066
30074
  if (!/[*?[\]]/.test(name)) {
30067
30075
  return false;
30068
30076
  }
30069
- const literal = name.replace(/[*?]|\[[^\]]*\]/g, "");
30077
+ const literal = name.replace(/[*?]|\[(?:a-z|0-9|a-f|0-9a-f|a-z0-9)\]/gi, "");
30078
+ if (OPAQUE_FAMILY_WILDCARD_RE.test(name)) {
30079
+ return true;
30080
+ }
30070
30081
  const trimmed = literal.replace(/-+$/, "");
30071
30082
  return trimmed !== "" && isAcceptableInboxDir(trimmed);
30072
30083
  }
30084
+ var OPAQUE_FAMILY_WILDCARD_RE = /^(?:(?:inbox|round|src-set|source-set)(?:-\d{4}(?:-\d{2})?)?|set)-[*?]+$/i;
30073
30085
  function _redirectTargets(segment) {
30074
30086
  const out = [];
30075
30087
  const re = /(?:^|[^0-9<>&])[0-9]*>>?\s*([^\s|&;<>]+)/g;
@@ -30746,8 +30758,8 @@ if (_isCliEntry30()) {
30746
30758
 
30747
30759
  // src/scripts/hooks/design_pass_hook.ts
30748
30760
  import fs72 from "node:fs";
30749
- import path73 from "node:path";
30750
- import { fileURLToPath as fileURLToPath43, pathToFileURL as pathToFileURL35 } from "node:url";
30761
+ import path74 from "node:path";
30762
+ import { fileURLToPath as fileURLToPath44, pathToFileURL as pathToFileURL35 } from "node:url";
30751
30763
 
30752
30764
  // src/scripts/_lib/obligations.ts
30753
30765
  import fs69 from "node:fs";
@@ -31074,16 +31086,16 @@ function digestTree(dir, exclude = [], whenNull = "no path was supplied") {
31074
31086
  if (!dir) return { path: null, kind: "tree", state: "absent", digest: null, reason: whenNull };
31075
31087
  const skip = new Set(exclude);
31076
31088
  const found = [];
31077
- const walk = (rel) => {
31089
+ const walk = (rel2) => {
31078
31090
  let entries;
31079
31091
  try {
31080
- entries = fs70.readdirSync(path71.join(dir, rel), { withFileTypes: true });
31092
+ entries = fs70.readdirSync(path71.join(dir, rel2), { withFileTypes: true });
31081
31093
  } catch (err) {
31082
31094
  return `unreadable: ${why(err)}`;
31083
31095
  }
31084
31096
  for (const e of [...entries].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0)) {
31085
- const child = rel ? `${rel}/${e.name}` : e.name;
31086
- if (rel === "" && skip.has(e.name)) continue;
31097
+ const child = rel2 ? `${rel2}/${e.name}` : e.name;
31098
+ if (rel2 === "" && skip.has(e.name)) continue;
31087
31099
  if (e.isDirectory()) {
31088
31100
  if (SKIP_DIRS.has(e.name)) continue;
31089
31101
  const failed = walk(child);
@@ -31101,14 +31113,14 @@ function digestTree(dir, exclude = [], whenNull = "no path was supplied") {
31101
31113
  const failure = walk("");
31102
31114
  if (failure) return { path: dir, kind: "tree", state: "absent", digest: null, reason: failure };
31103
31115
  const h = createHash12("sha256");
31104
- for (const rel of found.sort()) {
31116
+ for (const rel2 of found.sort()) {
31105
31117
  let body;
31106
31118
  try {
31107
- body = fs70.readFileSync(path71.join(dir, rel));
31119
+ body = fs70.readFileSync(path71.join(dir, rel2));
31108
31120
  } catch (err) {
31109
31121
  return { path: dir, kind: "tree", state: "absent", digest: null, reason: `unreadable: ${why(err)}` };
31110
31122
  }
31111
- h.update(rel).update("\0").update(body).update("\0");
31123
+ h.update(rel2).update("\0").update(body).update("\0");
31112
31124
  }
31113
31125
  return {
31114
31126
  path: dir,
@@ -31193,11 +31205,11 @@ function _fnmatchToRegExp(pat) {
31193
31205
  let k = pat[i] === "!" ? i + 2 : i + 1;
31194
31206
  let start = i;
31195
31207
  while (true) {
31196
- const rel = pat.slice(k, j).indexOf("-");
31197
- if (rel < 0) {
31208
+ const rel2 = pat.slice(k, j).indexOf("-");
31209
+ if (rel2 < 0) {
31198
31210
  break;
31199
31211
  }
31200
- const idx = k + rel;
31212
+ const idx = k + rel2;
31201
31213
  chunks.push(pat.slice(start, idx));
31202
31214
  start = idx + 1;
31203
31215
  k = idx + 3;
@@ -32050,9 +32062,9 @@ function main41() {
32050
32062
  }
32051
32063
  const findings = [];
32052
32064
  for (const fp of files) {
32053
- const rel = path72.relative(process.cwd(), fp);
32065
+ const rel2 = path72.relative(process.cwd(), fp);
32054
32066
  try {
32055
- const fileFindings = scanFile(fs71.readFileSync(fp, "utf-8"), rel, ctx).filter(
32067
+ const fileFindings = scanFile(fs71.readFileSync(fp, "utf-8"), rel2, ctx).filter(
32056
32068
  (f) => !ignoreRules.has(f.rule.toLowerCase())
32057
32069
  );
32058
32070
  findings.push(...fileFindings);
@@ -32087,15 +32099,51 @@ lint_design_slop: ${findings.length} tell(s) flagged (rebuttable \u2014 declare
32087
32099
  var invokedDirectly = process.argv[1] !== void 0 && /lint_design_slop\.ts$/.test(process.argv[1]);
32088
32100
  if (invokedDirectly) main41();
32089
32101
 
32102
+ // src/scripts/hooks/svg_rules_loader.ts
32103
+ import { createRequire as createRequire6 } from "node:module";
32104
+ import * as path73 from "node:path";
32105
+ import { fileURLToPath as fileURLToPath43 } from "node:url";
32106
+ var CHUNK_BASENAME = "svg_rules.chunk.cjs";
32107
+ function isBundled() {
32108
+ return true;
32109
+ }
32110
+ function rulesSpecifier(selfUrl, bundled) {
32111
+ const selfPath = fileURLToPath43(selfUrl);
32112
+ const dir = path73.dirname(selfPath);
32113
+ if (bundled) return path73.join(dir, CHUNK_BASENAME);
32114
+ const ext = selfPath.endsWith(".ts") ? ".ts" : ".js";
32115
+ return path73.join(dir, "..", "_lib", `svg_rules${ext}`);
32116
+ }
32117
+ var cache = /* @__PURE__ */ new Map();
32118
+ function loadSvgScan(selfUrl = import.meta.url) {
32119
+ const hit = cache.get(selfUrl);
32120
+ if (hit !== void 0 || cache.has(selfUrl)) return hit ?? null;
32121
+ const scan = loadSvgScanUncached(selfUrl);
32122
+ cache.set(selfUrl, scan);
32123
+ return scan;
32124
+ }
32125
+ function loadSvgScanUncached(selfUrl = import.meta.url, bundled = isBundled()) {
32126
+ try {
32127
+ const specifier = rulesSpecifier(selfUrl, bundled);
32128
+ if (bundled && verifyBundle(specifier).state === "mismatch") return null;
32129
+ const req = createRequire6(selfUrl);
32130
+ const mod = req(specifier);
32131
+ const scan = mod["scanSvg"];
32132
+ return typeof scan === "function" ? scan : null;
32133
+ } catch {
32134
+ return null;
32135
+ }
32136
+ }
32137
+
32090
32138
  // src/scripts/hooks/design_pass_hook.ts
32091
32139
  var SETTINGS_FILE8 = ".agent-settings.yml";
32092
- var STATE_REL2 = path73.join("agents", "runtime", "state", "design-pass-hook.json");
32093
- var AUDIT_REL = path73.join("agents", "runtime", "state", "ui-audit.json");
32094
- var CONFORMANCE_REL = path73.join("agents", "runtime", "state", "ui-conformance.json");
32140
+ var STATE_REL2 = path74.join("agents", "runtime", "state", "design-pass-hook.json");
32141
+ var AUDIT_REL = path74.join("agents", "runtime", "state", "ui-audit.json");
32142
+ var CONFORMANCE_REL = path74.join("agents", "runtime", "state", "ui-conformance.json");
32095
32143
  function enabled2(root, key = "design_pass") {
32096
32144
  let text;
32097
32145
  try {
32098
- text = fs72.readFileSync(path73.join(root, SETTINGS_FILE8), "utf-8");
32146
+ text = fs72.readFileSync(path74.join(root, SETTINGS_FILE8), "utf-8");
32099
32147
  } catch {
32100
32148
  return false;
32101
32149
  }
@@ -32122,7 +32170,9 @@ function enabled2(root, key = "design_pass") {
32122
32170
  }
32123
32171
  return false;
32124
32172
  }
32173
+ var isSvgAsset = (p) => /\.svg$/i.test(p);
32125
32174
  var isUiSurface = (p) => isUiPath(p) || isUiTreePath(p);
32175
+ var isPassSurface = (p) => isUiSurface(p) || isSvgAsset(p);
32126
32176
  var HANDOVER_TRIGGERS = [
32127
32177
  { file_pattern: "*design.html" },
32128
32178
  { file_pattern: "*.dc.html" },
@@ -32135,7 +32185,7 @@ function handoverTouched(paths) {
32135
32185
  function conformanceVerdict(root, opts = {}) {
32136
32186
  let raw;
32137
32187
  try {
32138
- raw = fs72.readFileSync(path73.join(root, CONFORMANCE_REL), "utf-8");
32188
+ raw = fs72.readFileSync(path74.join(root, CONFORMANCE_REL), "utf-8");
32139
32189
  } catch {
32140
32190
  const base = "ui-conformance: absent \u2014 no probe artefact for this change (run `ui_conformance_probe --target <file> --reference <file>`). Absent is not clean.";
32141
32191
  return opts.handoverDetected ? {
@@ -32145,7 +32195,7 @@ function conformanceVerdict(root, opts = {}) {
32145
32195
  }
32146
32196
  try {
32147
32197
  const a = JSON.parse(raw);
32148
- const inputs = compareInputs(a.inputs, (p) => path73.isAbsolute(p) ? p : path73.join(root, p));
32198
+ const inputs = compareInputs(a.inputs, (p) => path74.isAbsolute(p) ? p : path74.join(root, p));
32149
32199
  if (inputs.verdict === "moved") {
32150
32200
  return {
32151
32201
  noteworthy: true,
@@ -32212,8 +32262,8 @@ function recordAuditDischarge(root, targets, auditMissing) {
32212
32262
  }
32213
32263
  function auditIsFresh(root, target) {
32214
32264
  try {
32215
- const a = fs72.statSync(path73.join(root, AUDIT_REL)).mtimeMs;
32216
- const t = fs72.statSync(path73.isAbsolute(target) ? target : path73.join(root, target)).mtimeMs;
32265
+ const a = fs72.statSync(path74.join(root, AUDIT_REL)).mtimeMs;
32266
+ const t = fs72.statSync(path74.isAbsolute(target) ? target : path74.join(root, target)).mtimeMs;
32217
32267
  return a >= t;
32218
32268
  } catch {
32219
32269
  return false;
@@ -32237,7 +32287,7 @@ function decide3(slot, findings, auditMissing, already, renderAvailable2) {
32237
32287
  }
32238
32288
  function readState(root) {
32239
32289
  try {
32240
- const raw = JSON.parse(fs72.readFileSync(path73.join(root, STATE_REL2), "utf-8"));
32290
+ const raw = JSON.parse(fs72.readFileSync(path74.join(root, STATE_REL2), "utf-8"));
32241
32291
  return { surfaced: raw.surfaced ?? [], touched: raw.touched ?? [] };
32242
32292
  } catch {
32243
32293
  return { surfaced: [], touched: [] };
@@ -32245,8 +32295,8 @@ function readState(root) {
32245
32295
  }
32246
32296
  function writeState(root, s) {
32247
32297
  try {
32248
- const p = path73.join(root, STATE_REL2);
32249
- fs72.mkdirSync(path73.dirname(p), { recursive: true });
32298
+ const p = path74.join(root, STATE_REL2);
32299
+ fs72.mkdirSync(path74.dirname(p), { recursive: true });
32250
32300
  fs72.writeFileSync(p, `${JSON.stringify(s, null, 2)}
32251
32301
  `);
32252
32302
  } catch {
@@ -32254,11 +32304,32 @@ function writeState(root, s) {
32254
32304
  }
32255
32305
  function renderAvailable(root) {
32256
32306
  try {
32257
- return fs72.readdirSync(path73.join(root, "agents", "runtime", "state", "render")).length > 0;
32307
+ return fs72.readdirSync(path74.join(root, "agents", "runtime", "state", "render")).length > 0;
32258
32308
  } catch {
32259
32309
  return false;
32260
32310
  }
32261
32311
  }
32312
+ function svgSeverity(s) {
32313
+ if (s === "error") return "P1";
32314
+ if (s === "warning") return "P2";
32315
+ return null;
32316
+ }
32317
+ function svgFindings(raw, rel2) {
32318
+ const out = [];
32319
+ for (const f of raw) {
32320
+ const severity = svgSeverity(f.severity);
32321
+ if (severity === null) continue;
32322
+ out.push({
32323
+ file: rel2,
32324
+ severity,
32325
+ catalogId: "SVG",
32326
+ rule: f.rule,
32327
+ line: f.line,
32328
+ message: `${f.rule}${f.snippet ? ` \u2014 ${f.snippet}` : ""}`
32329
+ });
32330
+ }
32331
+ return out;
32332
+ }
32262
32333
  function targetPath(payload) {
32263
32334
  if (typeof payload !== "object" || payload === null) return null;
32264
32335
  const o = payload;
@@ -32308,22 +32379,28 @@ function main42() {
32308
32379
  targets = state.touched;
32309
32380
  } else {
32310
32381
  const t = targetPath(payload);
32311
- if (!t || !isUiSurface(t)) return EXIT_ALLOW;
32382
+ if (!t || !isPassSurface(t)) return EXIT_ALLOW;
32312
32383
  targets = [t];
32313
32384
  if (!state.touched.includes(t)) state.touched.push(t);
32314
32385
  }
32315
32386
  if (!targets.length) return EXIT_ALLOW;
32316
32387
  const findings = [];
32317
32388
  let scanFailed = null;
32389
+ let svgRulesUnavailable = false;
32318
32390
  try {
32319
32391
  const ctx = loadDesignContext(root);
32320
- for (const rel of targets) {
32321
- const abs = path73.isAbsolute(rel) ? rel : path73.join(root, rel);
32392
+ for (const rel2 of targets) {
32393
+ const abs = path74.isAbsolute(rel2) ? rel2 : path74.join(root, rel2);
32322
32394
  if (!fs72.existsSync(abs)) continue;
32323
32395
  const content = fs72.readFileSync(abs, "utf-8");
32324
- for (const f of scanFile(content, rel, ctx)) {
32396
+ if (isSvgAsset(rel2)) {
32397
+ const scan = loadSvgScan();
32398
+ if (scan === null) svgRulesUnavailable = true;
32399
+ else findings.push(...svgFindings(scan(content, rel2), rel2));
32400
+ }
32401
+ for (const f of scanFile(content, rel2, ctx)) {
32325
32402
  findings.push({
32326
- file: rel,
32403
+ file: rel2,
32327
32404
  severity: f.severity,
32328
32405
  catalogId: f.catalogId,
32329
32406
  rule: f.rule,
@@ -32335,11 +32412,19 @@ function main42() {
32335
32412
  } catch (err) {
32336
32413
  scanFailed = String(err);
32337
32414
  }
32338
- const auditMissing = targets.filter((t) => !auditIsFresh(root, t));
32339
- recordAuditDischarge(root, targets, auditMissing);
32415
+ const auditTargets = targets.filter((t) => isUiSurface(t));
32416
+ const auditMissing = auditTargets.filter((t) => !auditIsFresh(root, t));
32417
+ recordAuditDischarge(root, auditTargets, auditMissing);
32340
32418
  let result = decide3(slot, findings, auditMissing, new Set(state.surfaced), renderAvailable(root));
32341
32419
  if (scanFailed) {
32342
32420
  result = { ...result, verification: "unverified", degradation_reason: `detector unavailable: ${scanFailed}` };
32421
+ } else if (svgRulesUnavailable) {
32422
+ const svgReason = `the SVG rule set could not be loaded (expected dist/hooks/${CHUNK_BASENAME} beside the dispatch bundle) \u2014 the .svg files in this turn were not checked`;
32423
+ result = {
32424
+ ...result,
32425
+ verification: "degraded",
32426
+ degradation_reason: result.degradation_reason === void 0 || result.degradation_reason === "" ? svgReason : `${result.degradation_reason}; ${svgReason}`
32427
+ };
32343
32428
  }
32344
32429
  for (const f of result.findings) state.surfaced.push(`${f.file}::${f.rule}::${f.line}`);
32345
32430
  if (slot === "stop") state.touched = [];
@@ -32355,19 +32440,19 @@ function main42() {
32355
32440
  if (process.argv[1] && pathToFileURL35(process.argv[1]).href === import.meta.url) {
32356
32441
  process.exit(main42());
32357
32442
  }
32358
- var _HERE9 = fileURLToPath43(import.meta.url);
32443
+ var _HERE9 = fileURLToPath44(import.meta.url);
32359
32444
 
32360
32445
  // src/scripts/hooks/design_slop_hook.ts
32361
32446
  import fs73 from "node:fs";
32362
- import path74 from "node:path";
32363
- import { fileURLToPath as fileURLToPath44, pathToFileURL as pathToFileURL36 } from "node:url";
32447
+ import path75 from "node:path";
32448
+ import { fileURLToPath as fileURLToPath45, pathToFileURL as pathToFileURL36 } from "node:url";
32364
32449
  var SETTINGS_FILE9 = ".agent-settings.yml";
32365
32450
  var DEGRADE_AFTER = 3;
32366
32451
  function isObject5(v) {
32367
32452
  return typeof v === "object" && v !== null && !Array.isArray(v);
32368
32453
  }
32369
32454
  function enabled3(root) {
32370
- const f = path74.join(root, SETTINGS_FILE9);
32455
+ const f = path75.join(root, SETTINGS_FILE9);
32371
32456
  let text;
32372
32457
  try {
32373
32458
  if (!fs73.statSync(f).isFile()) return false;
@@ -32413,7 +32498,7 @@ function extract(outer) {
32413
32498
  return null;
32414
32499
  }
32415
32500
  function stateFile(root) {
32416
- return path74.join(root, "agents", "runtime", "state", "design-slop-hook.json");
32501
+ return path75.join(root, "agents", "runtime", "state", "design-slop-hook.json");
32417
32502
  }
32418
32503
  function readState2(root) {
32419
32504
  try {
@@ -32427,7 +32512,7 @@ function readState2(root) {
32427
32512
  function writeState2(root, state) {
32428
32513
  try {
32429
32514
  const sf = stateFile(root);
32430
- fs73.mkdirSync(path74.dirname(sf), { recursive: true });
32515
+ fs73.mkdirSync(path75.dirname(sf), { recursive: true });
32431
32516
  fs73.writeFileSync(sf, JSON.stringify(state, null, 2) + "\n");
32432
32517
  } catch {
32433
32518
  }
@@ -32451,7 +32536,7 @@ function main43() {
32451
32536
  if (!ex || !ex.file || !UI_EXT.test(ex.file)) return EXIT_ALLOW;
32452
32537
  let ctx;
32453
32538
  try {
32454
- ctx = loadDesignContext(path74.dirname(path74.resolve(root, ex.file)));
32539
+ ctx = loadDesignContext(path75.dirname(path75.resolve(root, ex.file)));
32455
32540
  } catch {
32456
32541
  ctx = { raw: "", has: () => false };
32457
32542
  }
@@ -32486,13 +32571,13 @@ function _isCliEntry31() {
32486
32571
  if (process.argv[1] === void 0) {
32487
32572
  return false;
32488
32573
  }
32489
- const argvUrl = pathToFileURL36(path74.resolve(process.argv[1])).href;
32574
+ const argvUrl = pathToFileURL36(path75.resolve(process.argv[1])).href;
32490
32575
  if (import.meta.url === argvUrl) {
32491
32576
  return true;
32492
32577
  }
32493
32578
  try {
32494
- const here = fs73.realpathSync(fileURLToPath44(import.meta.url));
32495
- const argv = fs73.realpathSync(path74.resolve(process.argv[1]));
32579
+ const here = fs73.realpathSync(fileURLToPath45(import.meta.url));
32580
+ const argv = fs73.realpathSync(path75.resolve(process.argv[1]));
32496
32581
  return here === argv;
32497
32582
  } catch {
32498
32583
  return false;
@@ -32504,13 +32589,13 @@ if (isCliEntry11) process.exit(main43());
32504
32589
  // src/scripts/hooks/code_graph_context_hook.ts
32505
32590
  import { createHash as createHash13 } from "node:crypto";
32506
32591
  import fs75 from "node:fs";
32507
- import path76 from "node:path";
32508
- import { fileURLToPath as fileURLToPath45, pathToFileURL as pathToFileURL37 } from "node:url";
32592
+ import path77 from "node:path";
32593
+ import { fileURLToPath as fileURLToPath46, pathToFileURL as pathToFileURL37 } from "node:url";
32509
32594
 
32510
32595
  // src/scripts/code_graph/detect.ts
32511
32596
  import { execFileSync as execFileSync4 } from "node:child_process";
32512
32597
  import * as fs74 from "node:fs";
32513
- import * as path75 from "node:path";
32598
+ import * as path76 from "node:path";
32514
32599
 
32515
32600
  // src/scripts/code_graph/types.ts
32516
32601
  var GUESS_RESOLVED_VIA = /* @__PURE__ */ new Set([
@@ -32623,7 +32708,7 @@ function consumerCandidates(root) {
32623
32708
  declared = void 0;
32624
32709
  }
32625
32710
  const extra = Array.isArray(declared) ? declared.filter(
32626
- (p) => typeof p === "string" && p !== "" && !path75.isAbsolute(p) && !path75.normalize(p).startsWith("..")
32711
+ (p) => typeof p === "string" && p !== "" && !path76.isAbsolute(p) && !path76.normalize(p).startsWith("..")
32627
32712
  ) : [];
32628
32713
  return [...CONSUMER_CANDIDATES, ...extra.filter((p) => !CONSUMER_CANDIDATES.includes(p))];
32629
32714
  }
@@ -32680,18 +32765,18 @@ function looksLikeGraph(p) {
32680
32765
  }
32681
32766
  }
32682
32767
  function detectSources(root, nativeCache) {
32683
- const abs = path75.resolve(root);
32768
+ const abs = path76.resolve(root);
32684
32769
  const out = [];
32685
- for (const rel of consumerCandidates(abs)) {
32686
- const p = path75.join(abs, rel);
32770
+ for (const rel2 of consumerCandidates(abs)) {
32771
+ const p = path76.join(abs, rel2);
32687
32772
  if (fs74.existsSync(p)) {
32688
32773
  const { ok, sha } = looksLikeGraph(p);
32689
32774
  if (ok) out.push({ kind: "consumer", path: p, present: true, ...freshness(abs, p, sha) });
32690
32775
  }
32691
32776
  }
32692
- const scipCandidates = [path75.join(abs, "index.scip")];
32777
+ const scipCandidates = [path76.join(abs, "index.scip")];
32693
32778
  try {
32694
- for (const e of fs74.readdirSync(abs)) if (e.endsWith(".scip")) scipCandidates.push(path75.join(abs, e));
32779
+ for (const e of fs74.readdirSync(abs)) if (e.endsWith(".scip")) scipCandidates.push(path76.join(abs, e));
32695
32780
  } catch {
32696
32781
  }
32697
32782
  const scip = scipCandidates.find((p) => fs74.existsSync(p));
@@ -32706,7 +32791,7 @@ function pickSource(verdicts) {
32706
32791
  if (native) return native;
32707
32792
  return verdicts.find((v) => v.kind === "consumer") ?? null;
32708
32793
  }
32709
- var NATIVE_CACHE_REL = path75.join("agents", "runtime", "state", "code-graph-v1.json");
32794
+ var NATIVE_CACHE_REL = path76.join("agents", "runtime", "state", "code-graph-v1.json");
32710
32795
  function hasUncommittedIndexedEdit(root) {
32711
32796
  let out;
32712
32797
  try {
@@ -32739,7 +32824,7 @@ function hasUncommittedIndexedEdit(root) {
32739
32824
  return false;
32740
32825
  }
32741
32826
  function graphState(root, nativeCache) {
32742
- const picked = pickSource(detectSources(root, nativeCache ?? path75.join(root, NATIVE_CACHE_REL)));
32827
+ const picked = pickSource(detectSources(root, nativeCache ?? path76.join(root, NATIVE_CACHE_REL)));
32743
32828
  if (!picked) return "absent";
32744
32829
  if (picked.stale === true) {
32745
32830
  const behind = picked.commits_behind;
@@ -32855,7 +32940,7 @@ function sessionId(envelope) {
32855
32940
  return typeof s === "string" && s ? s : "default";
32856
32941
  }
32857
32942
  function latchFile(root) {
32858
- return path76.join(root, "agents", "runtime", "state", "code-graph-context.json");
32943
+ return path77.join(root, "agents", "runtime", "state", "code-graph-context.json");
32859
32944
  }
32860
32945
  var MAX_CONTEXT_LINES_PER_SESSION = 5;
32861
32946
  var MAX_SESSIONS_LATCHED = 200;
@@ -32893,7 +32978,7 @@ function latchTarget(root, session, target) {
32893
32978
  if (old !== session) delete state[old];
32894
32979
  }
32895
32980
  const p = latchFile(root);
32896
- fs75.mkdirSync(path76.dirname(p), { recursive: true });
32981
+ fs75.mkdirSync(path77.dirname(p), { recursive: true });
32897
32982
  fs75.writeFileSync(p, JSON.stringify(state));
32898
32983
  } catch {
32899
32984
  }
@@ -32942,10 +33027,10 @@ function isCliEntry12() {
32942
33027
  return false;
32943
33028
  }
32944
33029
  if (process.argv[1] === void 0) return false;
32945
- const argvUrl = pathToFileURL37(path76.resolve(process.argv[1])).href;
33030
+ const argvUrl = pathToFileURL37(path77.resolve(process.argv[1])).href;
32946
33031
  if (import.meta.url === argvUrl) return true;
32947
33032
  try {
32948
- return fs75.realpathSync(fileURLToPath45(import.meta.url)) === fs75.realpathSync(path76.resolve(process.argv[1]));
33033
+ return fs75.realpathSync(fileURLToPath46(import.meta.url)) === fs75.realpathSync(path77.resolve(process.argv[1]));
32949
33034
  } catch {
32950
33035
  return false;
32951
33036
  }
@@ -32954,8 +33039,8 @@ if (isCliEntry12()) process.exit(main44());
32954
33039
 
32955
33040
  // src/scripts/hooks/chain_nudge_hook.ts
32956
33041
  import fs76 from "node:fs";
32957
- import path77 from "node:path";
32958
- import { fileURLToPath as fileURLToPath46, pathToFileURL as pathToFileURL38 } from "node:url";
33042
+ import path78 from "node:path";
33043
+ import { fileURLToPath as fileURLToPath47, pathToFileURL as pathToFileURL38 } from "node:url";
32959
33044
  var SETTINGS_FILE10 = ".agent-settings.yml";
32960
33045
  function isObject7(v) {
32961
33046
  return typeof v === "object" && v !== null && !Array.isArray(v);
@@ -32963,7 +33048,7 @@ function isObject7(v) {
32963
33048
  function enabled4(root) {
32964
33049
  let text;
32965
33050
  try {
32966
- const f = path77.join(root, SETTINGS_FILE10);
33051
+ const f = path78.join(root, SETTINGS_FILE10);
32967
33052
  if (!fs76.statSync(f).isFile()) return true;
32968
33053
  text = fs76.readFileSync(f, "utf-8");
32969
33054
  } catch {
@@ -33172,7 +33257,7 @@ function sessionId2(envelope) {
33172
33257
  return typeof s === "string" && s ? s : "default";
33173
33258
  }
33174
33259
  function latchFile2(root) {
33175
- return path77.join(root, "agents", "runtime", "state", "chain-nudge.json");
33260
+ return path78.join(root, "agents", "runtime", "state", "chain-nudge.json");
33176
33261
  }
33177
33262
  function classAlreadyNudged(entry, klass) {
33178
33263
  if (entry === true) return klass === "chain";
@@ -33196,7 +33281,7 @@ function latch(root, session, klass, state) {
33196
33281
  try {
33197
33282
  const p = latchFile2(root);
33198
33283
  state[session] = withClassLatched(state[session], klass);
33199
- fs76.mkdirSync(path77.dirname(p), { recursive: true });
33284
+ fs76.mkdirSync(path78.dirname(p), { recursive: true });
33200
33285
  fs76.writeFileSync(p, JSON.stringify(state));
33201
33286
  } catch {
33202
33287
  }
@@ -33240,10 +33325,10 @@ function isCliEntry13() {
33240
33325
  return false;
33241
33326
  }
33242
33327
  if (process.argv[1] === void 0) return false;
33243
- const argvUrl = pathToFileURL38(path77.resolve(process.argv[1])).href;
33328
+ const argvUrl = pathToFileURL38(path78.resolve(process.argv[1])).href;
33244
33329
  if (import.meta.url === argvUrl) return true;
33245
33330
  try {
33246
- return fs76.realpathSync(fileURLToPath46(import.meta.url)) === fs76.realpathSync(path77.resolve(process.argv[1]));
33331
+ return fs76.realpathSync(fileURLToPath47(import.meta.url)) === fs76.realpathSync(path78.resolve(process.argv[1]));
33247
33332
  } catch {
33248
33333
  return false;
33249
33334
  }
@@ -33252,11 +33337,11 @@ if (isCliEntry13()) process.exit(main45());
33252
33337
 
33253
33338
  // src/scripts/hooks/suggestion_capture_hook.ts
33254
33339
  import fs77 from "node:fs";
33255
- import path78 from "node:path";
33256
- import { fileURLToPath as fileURLToPath47, pathToFileURL as pathToFileURL39 } from "node:url";
33340
+ import path79 from "node:path";
33341
+ import { fileURLToPath as fileURLToPath48, pathToFileURL as pathToFileURL39 } from "node:url";
33257
33342
  var SETTINGS_FILE11 = ".agent-settings.yml";
33258
- var SINK_REL = path78.join("agents", "runtime", "state", "audit", "suggestion-capture.jsonl");
33259
- var LATCH_REL = path78.join("agents", "runtime", "state", "suggestion-latch.json");
33343
+ var SINK_REL = path79.join("agents", "runtime", "state", "audit", "suggestion-capture.jsonl");
33344
+ var LATCH_REL = path79.join("agents", "runtime", "state", "suggestion-latch.json");
33260
33345
  var LATCH_TTL_MS = 15 * 60 * 1e3;
33261
33346
  var isObject8 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
33262
33347
  var str3 = (v) => typeof v === "string" ? v : "";
@@ -33287,7 +33372,7 @@ function classify3(prompt, optionsCount) {
33287
33372
  function enabled5(root) {
33288
33373
  let raw;
33289
33374
  try {
33290
- raw = fs77.readFileSync(path78.join(root, SETTINGS_FILE11), "utf8");
33375
+ raw = fs77.readFileSync(path79.join(root, SETTINGS_FILE11), "utf8");
33291
33376
  } catch {
33292
33377
  return false;
33293
33378
  }
@@ -33318,13 +33403,13 @@ function enabled5(root) {
33318
33403
  return false;
33319
33404
  }
33320
33405
  function writeLatch(root, latch2) {
33321
- const p = path78.join(root, LATCH_REL);
33322
- fs77.mkdirSync(path78.dirname(p), { recursive: true });
33406
+ const p = path79.join(root, LATCH_REL);
33407
+ fs77.mkdirSync(path79.dirname(p), { recursive: true });
33323
33408
  fs77.writeFileSync(p, `${JSON.stringify(latch2)}
33324
33409
  `, "utf8");
33325
33410
  }
33326
33411
  function consumeLatch(root) {
33327
- const p = path78.join(root, LATCH_REL);
33412
+ const p = path79.join(root, LATCH_REL);
33328
33413
  let raw;
33329
33414
  try {
33330
33415
  raw = fs77.readFileSync(p, "utf8");
@@ -33348,8 +33433,8 @@ function consumeLatch(root) {
33348
33433
  }
33349
33434
  }
33350
33435
  function appendRecord(root, rec, now2) {
33351
- const p = path78.join(root, SINK_REL);
33352
- fs77.mkdirSync(path78.dirname(p), { recursive: true });
33436
+ const p = path79.join(root, SINK_REL);
33437
+ fs77.mkdirSync(path79.dirname(p), { recursive: true });
33353
33438
  const line = {
33354
33439
  ts: now2.toISOString().replace(/\.\d{3}Z$/, "Z"),
33355
33440
  block_emitted: rec.block_emitted,
@@ -33443,10 +33528,10 @@ function main46(_argv2 = [], now2 = /* @__PURE__ */ new Date()) {
33443
33528
  function isCliEntry14() {
33444
33529
  if (true) return false;
33445
33530
  if (process.argv[1] === void 0) return false;
33446
- const argvUrl = pathToFileURL39(path78.resolve(process.argv[1])).href;
33531
+ const argvUrl = pathToFileURL39(path79.resolve(process.argv[1])).href;
33447
33532
  if (import.meta.url === argvUrl) return true;
33448
33533
  try {
33449
- return fs77.realpathSync(fileURLToPath47(import.meta.url)) === fs77.realpathSync(path78.resolve(process.argv[1]));
33534
+ return fs77.realpathSync(fileURLToPath48(import.meta.url)) === fs77.realpathSync(path79.resolve(process.argv[1]));
33450
33535
  } catch {
33451
33536
  return false;
33452
33537
  }
@@ -33455,8 +33540,8 @@ if (isCliEntry14()) process.exit(main46());
33455
33540
 
33456
33541
  // src/scripts/hooks/ui_route_nudge_hook.ts
33457
33542
  import * as fs78 from "node:fs";
33458
- import * as path79 from "node:path";
33459
- import { fileURLToPath as fileURLToPath48, pathToFileURL as pathToFileURL40 } from "node:url";
33543
+ import * as path80 from "node:path";
33544
+ import { fileURLToPath as fileURLToPath49, pathToFileURL as pathToFileURL40 } from "node:url";
33460
33545
  var MAX_NUDGES = 2;
33461
33546
  var DESIGN_SURFACES = [
33462
33547
  "fe-design",
@@ -33502,7 +33587,7 @@ function isArtifactRead(event) {
33502
33587
  normalized.endsWith(".dc.html") || normalized.includes(".claude/design-system/");
33503
33588
  }
33504
33589
  function stateFile2(root) {
33505
- return path79.join(root, "agents", "runtime", "state", "ui-route-nudge.json");
33590
+ return path80.join(root, "agents", "runtime", "state", "ui-route-nudge.json");
33506
33591
  }
33507
33592
  function readState3(root, session) {
33508
33593
  try {
@@ -33534,7 +33619,7 @@ function writeState3(root, session, state) {
33534
33619
  }
33535
33620
  if (typeof all !== "object" || all === null || Array.isArray(all)) all = {};
33536
33621
  all[session] = state;
33537
- fs78.mkdirSync(path79.dirname(file), { recursive: true });
33622
+ fs78.mkdirSync(path80.dirname(file), { recursive: true });
33538
33623
  fs78.writeFileSync(file, JSON.stringify(pruneSessions(all)));
33539
33624
  } catch {
33540
33625
  }
@@ -33585,16 +33670,16 @@ function main47() {
33585
33670
  function isCliEntry15() {
33586
33671
  const entry = process.argv[1];
33587
33672
  if (!entry) return false;
33588
- return pathToFileURL40(path79.resolve(entry)).href === import.meta.url;
33673
+ return pathToFileURL40(path80.resolve(entry)).href === import.meta.url;
33589
33674
  }
33590
33675
  if (isCliEntry15()) process.exit(main47());
33591
- var _HOOK_FILE = fileURLToPath48(import.meta.url);
33676
+ var _HOOK_FILE = fileURLToPath49(import.meta.url);
33592
33677
 
33593
33678
  // src/scripts/hooks/orchestration_record_hook.ts
33594
33679
  import * as crypto7 from "node:crypto";
33595
33680
  import * as fs80 from "node:fs";
33596
- import * as path81 from "node:path";
33597
- import { fileURLToPath as fileURLToPath49, pathToFileURL as pathToFileURL42 } from "node:url";
33681
+ import * as path82 from "node:path";
33682
+ import { fileURLToPath as fileURLToPath50, pathToFileURL as pathToFileURL42 } from "node:url";
33598
33683
 
33599
33684
  // src/scripts/_lib/audit_field_provenance.ts
33600
33685
  var MAX_APPLIED_IDS = 32;
@@ -33844,7 +33929,7 @@ function buildOrchestrationLine(input) {
33844
33929
  // src/scripts/orchestration_record.ts
33845
33930
  import * as crypto6 from "node:crypto";
33846
33931
  import * as fs79 from "node:fs";
33847
- import * as path80 from "node:path";
33932
+ import * as path81 from "node:path";
33848
33933
  import { pathToFileURL as pathToFileURL41 } from "node:url";
33849
33934
  var DEFAULT_DIR = "agents/runtime/state/audit";
33850
33935
  function parseFlags(argv) {
@@ -33976,14 +34061,14 @@ function main48(argv = process.argv.slice(2)) {
33976
34061
  return 0;
33977
34062
  }
33978
34063
  fs79.mkdirSync(dir, { recursive: true });
33979
- const file = path80.join(dir, `${ts.slice(0, 7)}.jsonl`);
34064
+ const file = path81.join(dir, `${ts.slice(0, 7)}.jsonl`);
33980
34065
  fs79.appendFileSync(file, serialized + "\n", "utf8");
33981
34066
  process.stdout.write(`orchestration telemetry recorded \u2192 ${file} (id ${line.id})
33982
34067
  `);
33983
34068
  return 0;
33984
34069
  }
33985
34070
  if (process.argv[1] !== void 0) {
33986
- const invokedUrl = pathToFileURL41(path80.resolve(process.argv[1])).href;
34071
+ const invokedUrl = pathToFileURL41(path81.resolve(process.argv[1])).href;
33987
34072
  if (import.meta.url === invokedUrl) process.exit(main48());
33988
34073
  }
33989
34074
 
@@ -34078,12 +34163,12 @@ function buildRecordInput(facts, ts, id) {
34078
34163
  return input;
34079
34164
  }
34080
34165
  function auditFileFor(consumerRoot, ts) {
34081
- return path81.join(consumerRoot, DEFAULT_DIR, `${ts.slice(0, 7)}.jsonl`);
34166
+ return path82.join(consumerRoot, DEFAULT_DIR, `${ts.slice(0, 7)}.jsonl`);
34082
34167
  }
34083
34168
  function appendLine(consumerRoot, ts, line) {
34084
34169
  if (is_replay_mode()) return;
34085
34170
  const file = auditFileFor(consumerRoot, ts);
34086
- fs80.mkdirSync(path81.dirname(file), { recursive: true });
34171
+ fs80.mkdirSync(path82.dirname(file), { recursive: true });
34087
34172
  fs80.appendFileSync(file, `${JSON.stringify(line)}
34088
34173
  `, "utf8");
34089
34174
  }
@@ -34129,10 +34214,10 @@ function _isCliEntry32() {
34129
34214
  return false;
34130
34215
  }
34131
34216
  if (process.argv[1] === void 0) return false;
34132
- const argvUrl = pathToFileURL42(path81.resolve(process.argv[1])).href;
34217
+ const argvUrl = pathToFileURL42(path82.resolve(process.argv[1])).href;
34133
34218
  if (import.meta.url === argvUrl) return true;
34134
34219
  try {
34135
- return fs80.realpathSync(fileURLToPath49(import.meta.url)) === fs80.realpathSync(path81.resolve(process.argv[1]));
34220
+ return fs80.realpathSync(fileURLToPath50(import.meta.url)) === fs80.realpathSync(path82.resolve(process.argv[1]));
34136
34221
  } catch {
34137
34222
  return false;
34138
34223
  }
@@ -34140,11 +34225,11 @@ function _isCliEntry32() {
34140
34225
  if (_isCliEntry32()) process.exit(main49());
34141
34226
 
34142
34227
  // src/scripts/hooks/mcp_usage_observation_hook.ts
34143
- import * as path83 from "node:path";
34228
+ import * as path84 from "node:path";
34144
34229
 
34145
34230
  // src/scripts/_lib/neighbour_tool_use.ts
34146
34231
  import * as fs81 from "node:fs";
34147
- import * as path82 from "node:path";
34232
+ import * as path83 from "node:path";
34148
34233
  var MCP_TOOL_PREFIX = "mcp__";
34149
34234
  var FOREIGN_TOOL_USE_REL = "agents/runtime/neighbour-tool-use.json";
34150
34235
  var SETTINGS_FILENAME2 = ".agent-settings.yml";
@@ -34152,14 +34237,14 @@ function usageDay(now2) {
34152
34237
  return now2.toISOString().slice(0, 10);
34153
34238
  }
34154
34239
  function resolveStoreRoot(start) {
34155
- let dir = path82.resolve(start);
34240
+ let dir = path83.resolve(start);
34156
34241
  for (; ; ) {
34157
34242
  try {
34158
- if (fs81.statSync(path82.join(dir, SETTINGS_FILENAME2)).isFile()) return dir;
34243
+ if (fs81.statSync(path83.join(dir, SETTINGS_FILENAME2)).isFile()) return dir;
34159
34244
  } catch {
34160
34245
  }
34161
- const parent = path82.dirname(dir);
34162
- if (parent === dir) return path82.resolve(start);
34246
+ const parent = path83.dirname(dir);
34247
+ if (parent === dir) return path83.resolve(start);
34163
34248
  dir = parent;
34164
34249
  }
34165
34250
  }
@@ -34180,7 +34265,7 @@ function record(envelope, consumer_root) {
34180
34265
  if (tool === null) return EXIT_ALLOW;
34181
34266
  const day = usageDay(/* @__PURE__ */ new Date());
34182
34267
  update_json_under_lock(
34183
- path83.join(resolveStoreRoot(consumer_root), FOREIGN_TOOL_USE_REL),
34268
+ path84.join(resolveStoreRoot(consumer_root), FOREIGN_TOOL_USE_REL),
34184
34269
  (seen) => seen[tool] === day ? null : { ...seen, [tool]: day },
34185
34270
  { blocking: false }
34186
34271
  );
@@ -34212,13 +34297,13 @@ if (false) {
34212
34297
 
34213
34298
  // src/scripts/hooks/telemetry_flush_hook.ts
34214
34299
  import * as fs82 from "node:fs";
34215
- import * as path84 from "node:path";
34216
- import { fileURLToPath as fileURLToPath50, pathToFileURL as pathToFileURL43 } from "node:url";
34300
+ import * as path85 from "node:path";
34301
+ import { fileURLToPath as fileURLToPath51, pathToFileURL as pathToFileURL43 } from "node:url";
34217
34302
  var SENDER_REL = "../../agent-src/templates/scripts/telemetry/flush_sender.mjs";
34218
34303
  function resolveSenderScript() {
34219
34304
  try {
34220
- const here = path84.dirname(fileURLToPath50(import.meta.url));
34221
- const candidate = path84.resolve(here, SENDER_REL);
34305
+ const here = path85.dirname(fileURLToPath51(import.meta.url));
34306
+ const candidate = path85.resolve(here, SENDER_REL);
34222
34307
  return fs82.statSync(candidate).isFile() ? candidate : null;
34223
34308
  } catch {
34224
34309
  return null;
@@ -34230,7 +34315,7 @@ function flushFor(consumer_root, sender = resolveSenderScript()) {
34230
34315
  if (!settings.active) return { result: "inactive" };
34231
34316
  if (settings.flush !== FLUSH_SESSION_END) return { result: "flush-never" };
34232
34317
  if (is_replay_mode()) return { result: "replay" };
34233
- const logPath = path84.isAbsolute(settings.log_path) ? settings.log_path : path84.join(root, settings.log_path);
34318
+ const logPath = path85.isAbsolute(settings.log_path) ? settings.log_path : path85.join(root, settings.log_path);
34234
34319
  const spool = spool_path_for(logPath);
34235
34320
  if (!spool_has_work(spool)) return { result: "empty-spool" };
34236
34321
  if (sender === null) return { result: "no-sender" };
@@ -34261,10 +34346,10 @@ function _isCliEntry33() {
34261
34346
  return false;
34262
34347
  }
34263
34348
  if (process.argv[1] === void 0) return false;
34264
- const argvUrl = pathToFileURL43(path84.resolve(process.argv[1])).href;
34349
+ const argvUrl = pathToFileURL43(path85.resolve(process.argv[1])).href;
34265
34350
  if (import.meta.url === argvUrl) return true;
34266
34351
  try {
34267
- return fs82.realpathSync(fileURLToPath50(import.meta.url)) === fs82.realpathSync(path84.resolve(process.argv[1]));
34352
+ return fs82.realpathSync(fileURLToPath51(import.meta.url)) === fs82.realpathSync(path85.resolve(process.argv[1]));
34268
34353
  } catch {
34269
34354
  return false;
34270
34355
  }
@@ -34273,8 +34358,8 @@ if (_isCliEntry33()) process.exit(main51());
34273
34358
 
34274
34359
  // src/scripts/hooks/delegation_nudge_hook.ts
34275
34360
  import fs83 from "node:fs";
34276
- import path85 from "node:path";
34277
- import { fileURLToPath as fileURLToPath51, pathToFileURL as pathToFileURL44 } from "node:url";
34361
+ import path86 from "node:path";
34362
+ import { fileURLToPath as fileURLToPath52, pathToFileURL as pathToFileURL44 } from "node:url";
34278
34363
 
34279
34364
  // src/scripts/_lib/host_capability.ts
34280
34365
  import process12 from "node:process";
@@ -34840,13 +34925,13 @@ function _isCliEntry34() {
34840
34925
  if (process.argv[1] === void 0) {
34841
34926
  return false;
34842
34927
  }
34843
- const argvUrl = pathToFileURL44(path85.resolve(process.argv[1])).href;
34928
+ const argvUrl = pathToFileURL44(path86.resolve(process.argv[1])).href;
34844
34929
  if (import.meta.url === argvUrl) {
34845
34930
  return true;
34846
34931
  }
34847
34932
  try {
34848
- const here = fs83.realpathSync(fileURLToPath51(import.meta.url));
34849
- const argv = fs83.realpathSync(path85.resolve(process.argv[1]));
34933
+ const here = fs83.realpathSync(fileURLToPath52(import.meta.url));
34934
+ const argv = fs83.realpathSync(path86.resolve(process.argv[1]));
34850
34935
  return here === argv;
34851
34936
  } catch {
34852
34937
  return false;
@@ -34858,13 +34943,13 @@ if (_isCliEntry34()) {
34858
34943
 
34859
34944
  // src/scripts/hooks/skill_route_hook.ts
34860
34945
  import fs87 from "node:fs";
34861
- import path89 from "node:path";
34862
- import { fileURLToPath as fileURLToPath53, pathToFileURL as pathToFileURL46 } from "node:url";
34946
+ import path90 from "node:path";
34947
+ import { fileURLToPath as fileURLToPath54, pathToFileURL as pathToFileURL46 } from "node:url";
34863
34948
 
34864
34949
  // src/scripts/_lib/skill_catalogue.ts
34865
34950
  import * as fs84 from "node:fs";
34866
34951
  import * as os11 from "node:os";
34867
- import * as path86 from "node:path";
34952
+ import * as path87 from "node:path";
34868
34953
  var PROJECT_CATALOGUE_ROOTS = ["src/skills", ".claude/skills"];
34869
34954
  var HOST_CATALOGUE_ROOT = ".claude/skills";
34870
34955
  var DEFAULT_CATALOGUE_ROOTS = [
@@ -34874,8 +34959,8 @@ var DEFAULT_CATALOGUE_ROOTS = [
34874
34959
  function resolveSkillCatalogueRoots(workspaceRoot3, home) {
34875
34960
  const userHome = home ?? process.env["HOME"] ?? os11.homedir();
34876
34961
  const candidates = [
34877
- ...PROJECT_CATALOGUE_ROOTS.map((c) => path86.join(workspaceRoot3, c)),
34878
- path86.join(userHome, HOST_CATALOGUE_ROOT)
34962
+ ...PROJECT_CATALOGUE_ROOTS.map((c) => path87.join(workspaceRoot3, c)),
34963
+ path87.join(userHome, HOST_CATALOGUE_ROOT)
34879
34964
  ];
34880
34965
  const roots = [];
34881
34966
  const seen = /* @__PURE__ */ new Set();
@@ -34891,7 +34976,7 @@ function resolveSkillCatalogueRoots(workspaceRoot3, home) {
34891
34976
  }
34892
34977
  return roots;
34893
34978
  }
34894
- var OBSERVATION_LOG = path86.join(
34979
+ var OBSERVATION_LOG = path87.join(
34895
34980
  "agents",
34896
34981
  "evidence",
34897
34982
  "metrics",
@@ -34945,8 +35030,8 @@ function knownBareNames(records, host) {
34945
35030
 
34946
35031
  // src/scripts/skill_tools/score_skill_relevance.ts
34947
35032
  import * as fs86 from "node:fs";
34948
- import * as path88 from "node:path";
34949
- import { fileURLToPath as fileURLToPath52, pathToFileURL as pathToFileURL45 } from "node:url";
35033
+ import * as path89 from "node:path";
35034
+ import { fileURLToPath as fileURLToPath53, pathToFileURL as pathToFileURL45 } from "node:url";
34950
35035
 
34951
35036
  // src/shared/skillRanking.ts
34952
35037
  var TOKEN_RE2 = /[a-z][a-z0-9]+/g;
@@ -35121,11 +35206,11 @@ var import_yaml8 = __toESM(require_dist(), 1);
35121
35206
  import { createHash as createHash15 } from "node:crypto";
35122
35207
  import * as fs85 from "node:fs";
35123
35208
  import * as os12 from "node:os";
35124
- import * as path87 from "node:path";
35125
- var AUTHORED_SKILL_ROOT = path87.join("src", "skills");
35126
- var SCAN_CACHE_RELATIVE = path87.join("agents", "reports", "neighbour-scan.json");
35209
+ import * as path88 from "node:path";
35210
+ var AUTHORED_SKILL_ROOT = path88.join("src", "skills");
35211
+ var SCAN_CACHE_RELATIVE = path88.join("agents", "reports", "neighbour-scan.json");
35127
35212
  function scanCachePath(projectRoot) {
35128
- return path87.join(projectRoot, SCAN_CACHE_RELATIVE);
35213
+ return path88.join(projectRoot, SCAN_CACHE_RELATIVE);
35129
35214
  }
35130
35215
  function qualifiedSkillName(name, origin) {
35131
35216
  return origin === "package" ? name : `${origin}:${name}`;
@@ -35150,7 +35235,7 @@ function packageClaimedPaths(projectRoot) {
35150
35235
  if (entry === null || typeof entry !== "object" || Array.isArray(entry)) continue;
35151
35236
  const raw = entry["path"];
35152
35237
  if (typeof raw !== "string" || raw === "") continue;
35153
- out.add(path87.resolve(projectRoot, _expanduser3(raw)));
35238
+ out.add(path88.resolve(projectRoot, _expanduser3(raw)));
35154
35239
  }
35155
35240
  }
35156
35241
  return out;
@@ -35158,17 +35243,17 @@ function packageClaimedPaths(projectRoot) {
35158
35243
  function _expanduser3(p) {
35159
35244
  if (p === "~") return os12.homedir();
35160
35245
  if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
35161
- return path87.join(os12.homedir(), p.slice(2));
35246
+ return path88.join(os12.homedir(), p.slice(2));
35162
35247
  }
35163
35248
  return p;
35164
35249
  }
35165
35250
  function makeSkillOriginResolver(projectRoot, opts = {}) {
35166
35251
  const claims = opts.claims !== void 0 ? opts.claims : packageClaimedPaths(projectRoot);
35167
- const root = path87.resolve(projectRoot);
35168
- const authored = path87.join(path87.resolve(opts.packageRoot ?? projectRoot), AUTHORED_SKILL_ROOT);
35169
- const under = (abs, dir) => abs === dir || abs.startsWith(dir + path87.sep);
35252
+ const root = path88.resolve(projectRoot);
35253
+ const authored = path88.join(path88.resolve(opts.packageRoot ?? projectRoot), AUTHORED_SKILL_ROOT);
35254
+ const under = (abs, dir) => abs === dir || abs.startsWith(dir + path88.sep);
35170
35255
  return (skillMdPath) => {
35171
- const abs = path87.resolve(skillMdPath);
35256
+ const abs = path88.resolve(skillMdPath);
35172
35257
  if (under(abs, authored)) return "package";
35173
35258
  if (claims === null) return "package";
35174
35259
  if (claims.has(abs)) return "package";
@@ -35194,9 +35279,9 @@ function fileDigest(file) {
35194
35279
  return null;
35195
35280
  }
35196
35281
  }
35197
- function scanVerdict(cache, qualified, digest2) {
35198
- if (cache === null) return { ok: false, kind: "no-scan-record" };
35199
- const rec = cache.entries.find((e) => e.qualified === qualified);
35282
+ function scanVerdict(cache2, qualified, digest2) {
35283
+ if (cache2 === null) return { ok: false, kind: "no-scan-record" };
35284
+ const rec = cache2.entries.find((e) => e.qualified === qualified);
35200
35285
  if (rec === void 0) return { ok: false, kind: "no-scan-record" };
35201
35286
  if (digest2 === null || rec.digest !== digest2) return { ok: false, kind: "digest-changed" };
35202
35287
  if (rec.unscanned !== null) return { ok: false, kind: rec.unscanned };
@@ -35204,8 +35289,8 @@ function scanVerdict(cache, qualified, digest2) {
35204
35289
  }
35205
35290
 
35206
35291
  // src/scripts/skill_tools/score_skill_relevance.ts
35207
- var _HERE10 = fileURLToPath52(import.meta.url);
35208
- var ROOT2 = path88.resolve(path88.dirname(_HERE10), "..", "..", "..");
35292
+ var _HERE10 = fileURLToPath53(import.meta.url);
35293
+ var ROOT2 = path89.resolve(path89.dirname(_HERE10), "..", "..", "..");
35209
35294
  var DEFAULT_SKILLS_ROOTS = resolveSkillCatalogueRoots(ROOT2);
35210
35295
  var DEFAULT_SKILLS_DIR = DEFAULT_SKILLS_ROOTS[0] ?? null;
35211
35296
  function pyLen2(s) {
@@ -35346,7 +35431,7 @@ function _load_skills(skillsDir, opts = {}, ctx = defaultNeighbourContext()) {
35346
35431
  const text = fs86.readFileSync(skillMd, "utf-8");
35347
35432
  const fm = _parse_frontmatter_text(text);
35348
35433
  const rawName = fm["name"];
35349
- const name = _truthyStr(rawName) ? String(rawName) : path88.basename(path88.dirname(skillMd));
35434
+ const name = _truthyStr(rawName) ? String(rawName) : path89.basename(path89.dirname(skillMd));
35350
35435
  const rawDesc = fm["description"];
35351
35436
  const desc = _truthyStr(rawDesc) ? String(rawDesc) : "";
35352
35437
  let personas = fm["personas"] ?? [];
@@ -35405,8 +35490,8 @@ function _globSkillMd(root) {
35405
35490
  }
35406
35491
  const dirs = [];
35407
35492
  for (const name of names) {
35408
- const dir = path88.join(root, name);
35409
- const skillMd = path88.join(dir, "SKILL.md");
35493
+ const dir = path89.join(root, name);
35494
+ const skillMd = path89.join(dir, "SKILL.md");
35410
35495
  try {
35411
35496
  if (fs86.statSync(dir).isDirectory() && fs86.statSync(skillMd).isFile()) {
35412
35497
  dirs.push(name);
@@ -35415,7 +35500,7 @@ function _globSkillMd(root) {
35415
35500
  }
35416
35501
  }
35417
35502
  dirs.sort();
35418
- return dirs.map((name) => path88.join(root, name, "SKILL.md"));
35503
+ return dirs.map((name) => path89.join(root, name, "SKILL.md"));
35419
35504
  }
35420
35505
  function _rankable(skill) {
35421
35506
  return {
@@ -35677,13 +35762,13 @@ function _isCliEntry35() {
35677
35762
  if (process.argv[1] === void 0) {
35678
35763
  return false;
35679
35764
  }
35680
- const argvUrl = pathToFileURL45(path88.resolve(process.argv[1])).href;
35765
+ const argvUrl = pathToFileURL45(path89.resolve(process.argv[1])).href;
35681
35766
  if (import.meta.url === argvUrl) {
35682
35767
  return true;
35683
35768
  }
35684
35769
  try {
35685
- const here = fs86.realpathSync(fileURLToPath52(import.meta.url));
35686
- const argv = fs86.realpathSync(path88.resolve(process.argv[1]));
35770
+ const here = fs86.realpathSync(fileURLToPath53(import.meta.url));
35771
+ const argv = fs86.realpathSync(path89.resolve(process.argv[1]));
35687
35772
  return here === argv;
35688
35773
  } catch {
35689
35774
  return false;
@@ -35704,7 +35789,7 @@ function _isObject17(v) {
35704
35789
  function knownBareForHost(workspaceRoot3, host) {
35705
35790
  if (host === null || host === "") return null;
35706
35791
  try {
35707
- return knownBareNames(readObservationLog(path89.join(workspaceRoot3, OBSERVATION_LOG)), host);
35792
+ return knownBareNames(readObservationLog(path90.join(workspaceRoot3, OBSERVATION_LOG)), host);
35708
35793
  } catch {
35709
35794
  return null;
35710
35795
  }
@@ -35797,11 +35882,11 @@ function main54() {
35797
35882
  function _isCliEntry36() {
35798
35883
  if (true) return false;
35799
35884
  if (process.argv[1] === void 0) return false;
35800
- const argvUrl = pathToFileURL46(path89.resolve(process.argv[1])).href;
35885
+ const argvUrl = pathToFileURL46(path90.resolve(process.argv[1])).href;
35801
35886
  if (import.meta.url === argvUrl) return true;
35802
35887
  try {
35803
- const here = fs87.realpathSync(fileURLToPath53(import.meta.url));
35804
- const argv = fs87.realpathSync(path89.resolve(process.argv[1]));
35888
+ const here = fs87.realpathSync(fileURLToPath54(import.meta.url));
35889
+ const argv = fs87.realpathSync(path90.resolve(process.argv[1]));
35805
35890
  return here === argv;
35806
35891
  } catch {
35807
35892
  return false;
@@ -35814,12 +35899,12 @@ if (_isCliEntry36()) {
35814
35899
  // src/scripts/hooks/rule_inject_hook.ts
35815
35900
  import { createHash as createHash16 } from "node:crypto";
35816
35901
  import * as fs91 from "node:fs";
35817
- import * as path95 from "node:path";
35902
+ import * as path96 from "node:path";
35818
35903
  import process13 from "node:process";
35819
- import { fileURLToPath as fileURLToPath55, pathToFileURL as pathToFileURL47 } from "node:url";
35904
+ import { fileURLToPath as fileURLToPath56, pathToFileURL as pathToFileURL47 } from "node:url";
35820
35905
 
35821
35906
  // src/scripts/_lib/lean_projection_mode.ts
35822
- import * as path90 from "node:path";
35907
+ import * as path91 from "node:path";
35823
35908
  var DEFAULT_LEAN_PROJECTION_MODE = "eager-all";
35824
35909
  function normalizeLeanProjectionMode(raw) {
35825
35910
  const v = typeof raw === "string" ? raw.trim().toLowerCase() : "";
@@ -35870,8 +35955,8 @@ function thinsHost(mode, hosts, hostId) {
35870
35955
  return writesThinFiles(mode) && hosts.includes(hostId);
35871
35956
  }
35872
35957
  function resolveLeanProjection(opts = {}) {
35873
- const file = opts.settingsPath ?? path90.join(opts.projectRoot ?? process.cwd(), ".agent-settings.yml");
35874
- const tpl = opts.packageRoot == null ? null : path90.join(opts.packageRoot, "src", "config", "agent-settings.template.yml");
35958
+ const file = opts.settingsPath ?? path91.join(opts.projectRoot ?? process.cwd(), ".agent-settings.yml");
35959
+ const tpl = opts.packageRoot == null ? null : path91.join(opts.packageRoot, "src", "config", "agent-settings.template.yml");
35875
35960
  let lean;
35876
35961
  try {
35877
35962
  lean = load_agent_settings(
@@ -35896,9 +35981,9 @@ function resolveLeanProjection(opts = {}) {
35896
35981
  }
35897
35982
  };
35898
35983
  }
35899
- var NO_TEMPLATE_LAYER = path90.join(path90.sep, "dev", "null", "agent-config-absent-template.yml");
35984
+ var NO_TEMPLATE_LAYER = path91.join(path91.sep, "dev", "null", "agent-config-absent-template.yml");
35900
35985
  function rawExplicitLeanProjectionMode(opts = {}) {
35901
- const file = opts.settingsPath ?? path90.join(opts.projectRoot ?? process.cwd(), ".agent-settings.yml");
35986
+ const file = opts.settingsPath ?? path91.join(opts.projectRoot ?? process.cwd(), ".agent-settings.yml");
35902
35987
  let lean;
35903
35988
  try {
35904
35989
  lean = load_agent_settings({ project_path: file, template_path: NO_TEMPLATE_LAYER })["lean_projection"];
@@ -35916,8 +36001,8 @@ function installerThinsHost(hostId, opts = {}) {
35916
36001
  });
35917
36002
  return modeExplicit && thinsHost(mode, hosts.hosts, hostId);
35918
36003
  }
35919
- var NO_PROJECT_LAYER = path90.join(
35920
- path90.sep,
36004
+ var NO_PROJECT_LAYER = path91.join(
36005
+ path91.sep,
35921
36006
  "dev",
35922
36007
  "null",
35923
36008
  "agent-config-absent-project-settings.yml"
@@ -35925,7 +36010,7 @@ var NO_PROJECT_LAYER = path90.join(
35925
36010
 
35926
36011
  // src/scripts/_lib/rule_injection.ts
35927
36012
  import * as fs88 from "node:fs";
35928
- import * as path91 from "node:path";
36013
+ import * as path92 from "node:path";
35929
36014
  var PACKAGE_ROOT_ENV = "AGENT_CONFIG_PACKAGE_ROOT";
35930
36015
  function statKind(p) {
35931
36016
  try {
@@ -35937,18 +36022,18 @@ function statKind(p) {
35937
36022
  }
35938
36023
  function ruleSources(repoRoot) {
35939
36024
  const env = (process.env[PACKAGE_ROOT_ENV] ?? "").trim();
35940
- const pkg = env ? path91.resolve(env) : null;
36025
+ const pkg = env ? path92.resolve(env) : null;
35941
36026
  const dirs = [];
35942
36027
  const add = (d) => {
35943
36028
  if (statKind(d) === "dir" && !dirs.includes(d)) dirs.push(d);
35944
36029
  };
35945
- add(path91.join(repoRoot, "agents", "overrides"));
35946
- add(path91.join(repoRoot, "dist", "agent-src", "rules"));
35947
- if (pkg !== null) add(path91.join(pkg, "dist", "agent-src", "rules"));
35948
- const local = path91.join(repoRoot, "dist", "router.json");
36030
+ add(path92.join(repoRoot, "agents", "overrides"));
36031
+ add(path92.join(repoRoot, "dist", "agent-src", "rules"));
36032
+ if (pkg !== null) add(path92.join(pkg, "dist", "agent-src", "rules"));
36033
+ const local = path92.join(repoRoot, "dist", "router.json");
35949
36034
  let router = statKind(local) === "file" ? local : null;
35950
36035
  if (router === null && pkg !== null) {
35951
- const shipped = path91.join(pkg, "dist", "router.json");
36036
+ const shipped = path92.join(pkg, "dist", "router.json");
35952
36037
  if (statKind(shipped) === "file") router = shipped;
35953
36038
  }
35954
36039
  let gap = null;
@@ -35959,7 +36044,7 @@ function ruleSources(repoRoot) {
35959
36044
  return { dirs, pkg, router, gap };
35960
36045
  }
35961
36046
  function loadRouter(repoRoot) {
35962
- const p = ruleSources(repoRoot).router ?? path91.join(repoRoot, "dist", "router.json");
36047
+ const p = ruleSources(repoRoot).router ?? path92.join(repoRoot, "dist", "router.json");
35963
36048
  return JSON.parse(fs88.readFileSync(p, "utf8"));
35964
36049
  }
35965
36050
  function kernelIds(router) {
@@ -36005,7 +36090,7 @@ function matchTierRules(router, prompt, openFiles, command) {
36005
36090
  }
36006
36091
  function loadRuleBody(repoRoot, id) {
36007
36092
  for (const dir of ruleSources(repoRoot).dirs) {
36008
- const p = path91.join(dir, `${id}.md`);
36093
+ const p = path92.join(dir, `${id}.md`);
36009
36094
  if (statKind(p) === "file") {
36010
36095
  try {
36011
36096
  return fs88.readFileSync(p, "utf8");
@@ -36051,10 +36136,10 @@ function selectForInjection(repoRoot, matches, capBytes, shortlist) {
36051
36136
 
36052
36137
  // src/scripts/_lib/rule_consequence_class.ts
36053
36138
  import * as fs89 from "node:fs";
36054
- import * as path92 from "node:path";
36139
+ import * as path93 from "node:path";
36055
36140
  var CLASS_CONFIG_REL = "src/config/rule-consequence-class.json";
36056
36141
  function readConsequenceClass(repoRoot) {
36057
- const raw = JSON.parse(fs89.readFileSync(path92.join(repoRoot, CLASS_CONFIG_REL), "utf-8"));
36142
+ const raw = JSON.parse(fs89.readFileSync(path93.join(repoRoot, CLASS_CONFIG_REL), "utf-8"));
36058
36143
  return {
36059
36144
  criterion_ref: raw.criterion_ref ?? "",
36060
36145
  members: raw.members ?? {},
@@ -36127,11 +36212,11 @@ function lawText(body) {
36127
36212
  // src/scripts/_lib/rule_layer_overlap.ts
36128
36213
  import * as fs90 from "node:fs";
36129
36214
  import * as os13 from "node:os";
36130
- import * as path93 from "node:path";
36215
+ import * as path94 from "node:path";
36131
36216
  function hostRuleLayerDirs(projectRoot) {
36132
36217
  return [
36133
- path93.join(os13.homedir(), ".claude", "rules"),
36134
- path93.join(projectRoot, ".claude", "rules")
36218
+ path94.join(os13.homedir(), ".claude", "rules"),
36219
+ path94.join(projectRoot, ".claude", "rules")
36135
36220
  ];
36136
36221
  }
36137
36222
  function hostRuleLayerIds(projectRoot) {
@@ -36151,12 +36236,12 @@ function hostRuleLayerIds(projectRoot) {
36151
36236
  }
36152
36237
 
36153
36238
  // src/scripts/_lib/thin_rules.ts
36154
- import * as path94 from "node:path";
36155
- import { fileURLToPath as fileURLToPath54 } from "node:url";
36156
- var _HERE11 = fileURLToPath54(import.meta.url);
36157
- var REPO_ROOT = path94.resolve(path94.dirname(_HERE11), "..", "..", "..");
36158
- var RULES_SOURCE = path94.join(REPO_ROOT, "dist/agent-src", "rules");
36159
- var ROUTER = path94.join(REPO_ROOT, "dist", "router.json");
36239
+ import * as path95 from "node:path";
36240
+ import { fileURLToPath as fileURLToPath55 } from "node:url";
36241
+ var _HERE11 = fileURLToPath55(import.meta.url);
36242
+ var REPO_ROOT = path95.resolve(path95.dirname(_HERE11), "..", "..", "..");
36243
+ var RULES_SOURCE = path95.join(REPO_ROOT, "dist/agent-src", "rules");
36244
+ var ROUTER = path95.join(REPO_ROOT, "dist", "router.json");
36160
36245
  var THIN_ENTRY_MARKER = "> Load the body on a match.";
36161
36246
  function is_thin_entry(text) {
36162
36247
  return text.includes(THIN_ENTRY_MARKER);
@@ -36184,14 +36269,14 @@ function workspaceRoot2(env) {
36184
36269
  return str5(env, "workspace", "cwd", "project_dir") ?? process13.cwd();
36185
36270
  }
36186
36271
  function projectKey(root) {
36187
- const abs = path95.resolve(root);
36188
- const name = (path95.basename(abs) || "root").replace(/[^A-Za-z0-9_-]/g, "_").slice(0, 40);
36272
+ const abs = path96.resolve(root);
36273
+ const name = (path96.basename(abs) || "root").replace(/[^A-Za-z0-9_-]/g, "_").slice(0, 40);
36189
36274
  return `${name}-${createHash16("sha256").update(abs, "utf-8").digest("hex").slice(0, 12)}`;
36190
36275
  }
36191
36276
  function statePath(root, session) {
36192
36277
  const safe = session.replace(/[^A-Za-z0-9_-]/g, "_").slice(0, 80) || "unknown";
36193
- return path95.join(
36194
- write_target(path95.join("state", "rule-inject", projectKey(root))),
36278
+ return path96.join(
36279
+ write_target(path96.join("state", "rule-inject", projectKey(root))),
36195
36280
  `${safe}.json`
36196
36281
  );
36197
36282
  }
@@ -36213,7 +36298,7 @@ function readSeen(root, session) {
36213
36298
  function writeState4(root, session, state) {
36214
36299
  const p = statePath(root, session);
36215
36300
  try {
36216
- fs91.mkdirSync(path95.dirname(p), { recursive: true });
36301
+ fs91.mkdirSync(path96.dirname(p), { recursive: true });
36217
36302
  fs91.writeFileSync(`${p}.tmp`, `${JSON.stringify(state)}
36218
36303
  `, "utf-8");
36219
36304
  fs91.renameSync(`${p}.tmp`, p);
@@ -36346,9 +36431,9 @@ ${text}
36346
36431
  </rule>`;
36347
36432
  const at = partOf.get(id);
36348
36433
  const prev = at === void 0 ? "" : parts[at];
36349
- const sep15 = at === void 0 && parts.length > 0 ? 2 : 0;
36350
- const cost = part.length - prev.length + sep15;
36351
- const costBytes = bytesOf(part) - bytesOf(prev) + sep15;
36434
+ const sep16 = at === void 0 && parts.length > 0 ? 2 : 0;
36435
+ const cost = part.length - prev.length + sep16;
36436
+ const costBytes = bytesOf(part) - bytesOf(prev) + sep16;
36352
36437
  if (cost > left || costBytes > bytesLeft) return false;
36353
36438
  left -= cost;
36354
36439
  bytesLeft -= costBytes;
@@ -36447,7 +36532,7 @@ function installedFullIds(root, ids) {
36447
36532
  for (const id of ids) {
36448
36533
  let text;
36449
36534
  try {
36450
- text = fs91.readFileSync(path95.join(dir, `${id}.md`), "utf-8");
36535
+ text = fs91.readFileSync(path96.join(dir, `${id}.md`), "utf-8");
36451
36536
  } catch {
36452
36537
  continue;
36453
36538
  }
@@ -36532,15 +36617,15 @@ function main55(argv = process13.argv.slice(2)) {
36532
36617
  }
36533
36618
  function arrivalPath(root, session) {
36534
36619
  const safe = session.replace(/[^A-Za-z0-9_-]/g, "_").slice(0, 80) || "unknown";
36535
- return path95.join(
36536
- write_target(path95.join("state", "rule-inject", projectKey(root))),
36620
+ return path96.join(
36621
+ write_target(path96.join("state", "rule-inject", projectKey(root))),
36537
36622
  `${safe}.arrival.jsonl`
36538
36623
  );
36539
36624
  }
36540
36625
  function recordArrival(root, session, record2) {
36541
36626
  try {
36542
36627
  const p = arrivalPath(root, session);
36543
- fs91.mkdirSync(path95.dirname(p), { recursive: true });
36628
+ fs91.mkdirSync(path96.dirname(p), { recursive: true });
36544
36629
  fs91.appendFileSync(p, `${JSON.stringify(record2)}
36545
36630
  `, "utf-8");
36546
36631
  } catch {
@@ -36561,10 +36646,10 @@ function emit(injection, slot, root, session) {
36561
36646
  function _isCliEntry37() {
36562
36647
  if (true) return false;
36563
36648
  if (process13.argv[1] === void 0) return false;
36564
- const argvUrl = pathToFileURL47(path95.resolve(process13.argv[1])).href;
36649
+ const argvUrl = pathToFileURL47(path96.resolve(process13.argv[1])).href;
36565
36650
  if (import.meta.url === argvUrl) return true;
36566
36651
  try {
36567
- return fs91.realpathSync(fileURLToPath55(import.meta.url)) === fs91.realpathSync(path95.resolve(process13.argv[1]));
36652
+ return fs91.realpathSync(fileURLToPath56(import.meta.url)) === fs91.realpathSync(path96.resolve(process13.argv[1]));
36568
36653
  } catch {
36569
36654
  return false;
36570
36655
  }
@@ -36578,13 +36663,13 @@ import { spawnSync as spawnSync8 } from "node:child_process";
36578
36663
  import * as crypto8 from "node:crypto";
36579
36664
  import * as fs93 from "node:fs";
36580
36665
  import * as os14 from "node:os";
36581
- import * as path97 from "node:path";
36582
- import { fileURLToPath as fileURLToPath56, pathToFileURL as pathToFileURL48 } from "node:url";
36666
+ import * as path98 from "node:path";
36667
+ import { fileURLToPath as fileURLToPath57, pathToFileURL as pathToFileURL48 } from "node:url";
36583
36668
 
36584
36669
  // src/scripts/_lib/review_baseline.ts
36585
36670
  import { spawnSync as spawnSync7 } from "node:child_process";
36586
36671
  import * as fs92 from "node:fs";
36587
- import * as path96 from "node:path";
36672
+ import * as path97 from "node:path";
36588
36673
  function currentHeadSha(cwd) {
36589
36674
  try {
36590
36675
  const r = spawnSync7("git", ["rev-parse", "HEAD"], { cwd, encoding: "utf8" });
@@ -36595,12 +36680,12 @@ function currentHeadSha(cwd) {
36595
36680
  return null;
36596
36681
  }
36597
36682
  }
36598
- var BASELINE_STATE_REL = path96.join("agents", "runtime", "state", "review-baseline");
36683
+ var BASELINE_STATE_REL = path97.join("agents", "runtime", "state", "review-baseline");
36599
36684
  function baselineStateDir(workspaceRoot3) {
36600
- return path96.join(workspaceRoot3, BASELINE_STATE_REL);
36685
+ return path97.join(workspaceRoot3, BASELINE_STATE_REL);
36601
36686
  }
36602
36687
  function baselineStateFile(workspaceRoot3, sessionKey) {
36603
- return path96.join(baselineStateDir(workspaceRoot3), `${sessionKey}.json`);
36688
+ return path97.join(baselineStateDir(workspaceRoot3), `${sessionKey}.json`);
36604
36689
  }
36605
36690
  function parseBaseline(raw) {
36606
36691
  let decoded;
@@ -36727,8 +36812,8 @@ function isSafeTranscriptPath(rawPath, opts = {}) {
36727
36812
  try {
36728
36813
  const realHome = fs93.realpathSync(homeDir);
36729
36814
  const realPath = fs93.realpathSync(rawPath);
36730
- const relative17 = path97.relative(realHome, realPath);
36731
- if (relative17 === "" || relative17.startsWith("..") || path97.isAbsolute(relative17)) {
36815
+ const relative18 = path98.relative(realHome, realPath);
36816
+ if (relative18 === "" || relative18.startsWith("..") || path98.isAbsolute(relative18)) {
36732
36817
  return false;
36733
36818
  }
36734
36819
  const { size } = fs93.statSync(realPath);
@@ -36789,7 +36874,7 @@ var BINARY_PROBE_BYTES = 8e3;
36789
36874
  var UNTRACKED_FILE_READ_CAP_BYTES = 8 * 1024 * 1024;
36790
36875
  function untrackedFileLineCount(cwd, relPath) {
36791
36876
  try {
36792
- const abs = path97.resolve(cwd, relPath);
36877
+ const abs = path98.resolve(cwd, relPath);
36793
36878
  const size = fs93.statSync(abs).size;
36794
36879
  if (size === 0) return 0;
36795
36880
  if (size > UNTRACKED_FILE_READ_CAP_BYTES) {
@@ -36886,19 +36971,19 @@ function appendReviewSkippedTelemetry(workspaceRoot3, diffLines, mutationMeasure
36886
36971
  });
36887
36972
  if (errors.length || line === null) return;
36888
36973
  try {
36889
- const dir = path97.join(workspaceRoot3, "agents", "runtime", "state", "audit");
36974
+ const dir = path98.join(workspaceRoot3, "agents", "runtime", "state", "audit");
36890
36975
  fs93.mkdirSync(dir, { recursive: true });
36891
- const file = path97.join(dir, `${ts.slice(0, 7)}.jsonl`);
36976
+ const file = path98.join(dir, `${ts.slice(0, 7)}.jsonl`);
36892
36977
  fs93.appendFileSync(file, `${JSON.stringify(line)}
36893
36978
  `, "utf8");
36894
36979
  } catch {
36895
36980
  }
36896
36981
  }
36897
36982
  function sessionStateDir(workspaceRoot3) {
36898
- return path97.join(workspaceRoot3, "agents", "runtime", "state", "end-review-nudge");
36983
+ return path98.join(workspaceRoot3, "agents", "runtime", "state", "end-review-nudge");
36899
36984
  }
36900
36985
  function sessionStateFile(workspaceRoot3, sessionKey) {
36901
- return path97.join(sessionStateDir(workspaceRoot3), `${sessionKey}.json`);
36986
+ return path98.join(sessionStateDir(workspaceRoot3), `${sessionKey}.json`);
36902
36987
  }
36903
36988
  function deriveSessionKey2(envelope, payload) {
36904
36989
  const raw = str6(envelope["session_id"]) || str6(payload["transcript_path"] ?? payload["transcriptPath"]);
@@ -37004,13 +37089,13 @@ function _isCliEntry38() {
37004
37089
  if (process.argv[1] === void 0) {
37005
37090
  return false;
37006
37091
  }
37007
- const argvUrl = pathToFileURL48(path97.resolve(process.argv[1])).href;
37092
+ const argvUrl = pathToFileURL48(path98.resolve(process.argv[1])).href;
37008
37093
  if (import.meta.url === argvUrl) {
37009
37094
  return true;
37010
37095
  }
37011
37096
  try {
37012
- const here = fs93.realpathSync(fileURLToPath56(import.meta.url));
37013
- const argv = fs93.realpathSync(path97.resolve(process.argv[1]));
37097
+ const here = fs93.realpathSync(fileURLToPath57(import.meta.url));
37098
+ const argv = fs93.realpathSync(path98.resolve(process.argv[1]));
37014
37099
  return here === argv;
37015
37100
  } catch {
37016
37101
  return false;
@@ -37022,8 +37107,8 @@ if (_isCliEntry38()) {
37022
37107
 
37023
37108
  // src/scripts/hooks/review_baseline_hook.ts
37024
37109
  import * as fs94 from "node:fs";
37025
- import * as path98 from "node:path";
37026
- import { fileURLToPath as fileURLToPath57, pathToFileURL as pathToFileURL49 } from "node:url";
37110
+ import * as path99 from "node:path";
37111
+ import { fileURLToPath as fileURLToPath58, pathToFileURL as pathToFileURL49 } from "node:url";
37027
37112
  function buildBaseline(workspaceRoot3, now2 = /* @__PURE__ */ new Date()) {
37028
37113
  const measured = totalNonDocMutatedLinesWithMeasure(workspaceRoot3);
37029
37114
  return {
@@ -37066,11 +37151,11 @@ function main57() {
37066
37151
  function _isCliEntry39() {
37067
37152
  if (true) return false;
37068
37153
  if (process.argv[1] === void 0) return false;
37069
- const argvUrl = pathToFileURL49(path98.resolve(process.argv[1])).href;
37154
+ const argvUrl = pathToFileURL49(path99.resolve(process.argv[1])).href;
37070
37155
  if (import.meta.url === argvUrl) return true;
37071
37156
  try {
37072
- const here = fs94.realpathSync(fileURLToPath57(import.meta.url));
37073
- const argv = fs94.realpathSync(path98.resolve(process.argv[1]));
37157
+ const here = fs94.realpathSync(fileURLToPath58(import.meta.url));
37158
+ const argv = fs94.realpathSync(path99.resolve(process.argv[1]));
37074
37159
  return here === argv;
37075
37160
  } catch {
37076
37161
  return false;
@@ -37081,40 +37166,40 @@ if (_isCliEntry39()) {
37081
37166
  }
37082
37167
 
37083
37168
  // src/scripts/hooks/turn_end_gate_hook.ts
37084
- import * as fs102 from "node:fs";
37085
- import * as path105 from "node:path";
37086
- import { fileURLToPath as fileURLToPath61, pathToFileURL as pathToFileURL52 } from "node:url";
37169
+ import * as fs103 from "node:fs";
37170
+ import * as path107 from "node:path";
37171
+ import { fileURLToPath as fileURLToPath62, pathToFileURL as pathToFileURL52 } from "node:url";
37087
37172
 
37088
37173
  // src/scripts/check_reply_consistency.ts
37089
37174
  import * as fs96 from "node:fs";
37090
- import * as path101 from "node:path";
37091
- import { fileURLToPath as fileURLToPath59, pathToFileURL as pathToFileURL50 } from "node:url";
37175
+ import * as path102 from "node:path";
37176
+ import { fileURLToPath as fileURLToPath60, pathToFileURL as pathToFileURL50 } from "node:url";
37092
37177
 
37093
37178
  // src/scripts/_lib/agent_src.ts
37094
37179
  import * as fs95 from "node:fs";
37095
- import * as path100 from "node:path";
37096
- import { fileURLToPath as fileURLToPath58 } from "node:url";
37180
+ import * as path101 from "node:path";
37181
+ import { fileURLToPath as fileURLToPath59 } from "node:url";
37097
37182
 
37098
37183
  // src/scripts/_lib/guidelines_lane.ts
37099
- import * as path99 from "node:path";
37100
- var GUIDELINES_SOURCE_REL = path99.join("docs", "guidelines");
37184
+ import * as path100 from "node:path";
37185
+ var GUIDELINES_SOURCE_REL = path100.join("docs", "guidelines");
37101
37186
 
37102
37187
  // src/scripts/_lib/agent_src.ts
37103
- var _HERE12 = path100.dirname(fileURLToPath58(import.meta.url));
37104
- var _DEFAULT_ROOT = path100.resolve(_HERE12, "..", "..", "..");
37188
+ var _HERE12 = path101.dirname(fileURLToPath59(import.meta.url));
37189
+ var _DEFAULT_ROOT = path101.resolve(_HERE12, "..", "..", "..");
37105
37190
  function _deriveRoots(root) {
37106
- const packages = path100.join(root, "packages");
37107
- const src = path100.join(root, "src");
37191
+ const packages = path101.join(root, "packages");
37192
+ const src = path101.join(root, "src");
37108
37193
  return {
37109
37194
  ROOT: root,
37110
- LEGACY_SRC: path100.join(root, ".agent-src.uncondensed"),
37195
+ LEGACY_SRC: path101.join(root, ".agent-src.uncondensed"),
37111
37196
  PACKAGES: packages,
37112
- PACKAGE_CORE: path100.join(packages, "core"),
37197
+ PACKAGE_CORE: path101.join(packages, "core"),
37113
37198
  SRC: src,
37114
- SRC_SKILLS: path100.join(src, "skills"),
37115
- SRC_RULES: path100.join(src, "rules"),
37116
- SRC_AGENT: path100.join(src, "agent-src"),
37117
- SRC_DOMAINS: path100.join(src, "domains")
37199
+ SRC_SKILLS: path101.join(src, "skills"),
37200
+ SRC_RULES: path101.join(src, "rules"),
37201
+ SRC_AGENT: path101.join(src, "agent-src"),
37202
+ SRC_DOMAINS: path101.join(src, "domains")
37118
37203
  };
37119
37204
  }
37120
37205
  var _roots = _deriveRoots(_DEFAULT_ROOT);
@@ -37141,7 +37226,7 @@ function _iterdirSorted2(p) {
37141
37226
  return [];
37142
37227
  }
37143
37228
  names.sort();
37144
- return names.map((name) => path100.join(p, name));
37229
+ return names.map((name) => path101.join(p, name));
37145
37230
  }
37146
37231
  function artefact_roots() {
37147
37232
  const roots = [];
@@ -37150,7 +37235,7 @@ function artefact_roots() {
37150
37235
  }
37151
37236
  if (_exists5(_roots.PACKAGES)) {
37152
37237
  for (const pkg of _iterdirSorted2(_roots.PACKAGES)) {
37153
- const sub = path100.join(pkg, ".agent-src.uncondensed");
37238
+ const sub = path101.join(pkg, ".agent-src.uncondensed");
37154
37239
  if (_isDir4(sub)) {
37155
37240
  roots.push(sub);
37156
37241
  }
@@ -37166,8 +37251,8 @@ function artefact_roots() {
37166
37251
  }
37167
37252
 
37168
37253
  // src/scripts/check_reply_consistency.ts
37169
- var _HERE13 = fileURLToPath59(import.meta.url);
37170
- var ROOT3 = path101.resolve(path101.dirname(_HERE13), "..", "..");
37254
+ var _HERE13 = fileURLToPath60(import.meta.url);
37255
+ var ROOT3 = path102.resolve(path102.dirname(_HERE13), "..", "..");
37171
37256
  var QUIET = process.argv.slice(2).includes("--quiet");
37172
37257
  var OPTION_LINE_RE = /^\s*>?\s*(\d+)\.\s+\S/;
37173
37258
  var REC_LINE_RE = /(?:Recommendation|Empfehlung)\s*:\s*(\d+)\b/i;
@@ -37313,7 +37398,7 @@ function _rglobMdSorted(dir) {
37313
37398
  return;
37314
37399
  }
37315
37400
  for (const ent of entries) {
37316
- const full = path101.join(current, ent.name);
37401
+ const full = path102.join(current, ent.name);
37317
37402
  if (ent.isDirectory() || ent.isSymbolicLink() && _isDir5(full)) {
37318
37403
  walk(full);
37319
37404
  } else if (ent.name.endsWith(".md")) {
@@ -37326,17 +37411,17 @@ function _rglobMdSorted(dir) {
37326
37411
  return out;
37327
37412
  }
37328
37413
  function _relToPosixOrAbs(child, root) {
37329
- const rel = path101.relative(root, child);
37330
- if (rel === "" || rel.startsWith("..") || path101.isAbsolute(rel)) {
37331
- return child.split(path101.sep).join("/");
37414
+ const rel2 = path102.relative(root, child);
37415
+ if (rel2 === "" || rel2.startsWith("..") || path102.isAbsolute(rel2)) {
37416
+ return child.split(path102.sep).join("/");
37332
37417
  }
37333
- return rel.split(path101.sep).join("/");
37418
+ return rel2.split(path102.sep).join("/");
37334
37419
  }
37335
37420
  function cmd_scan_dir(root) {
37336
37421
  let roots;
37337
37422
  if (!_isDir5(root)) {
37338
- const legacy = path101.join(ROOT3, ".agent-src.uncondensed");
37339
- if (path101.resolve(root) === path101.resolve(legacy)) {
37423
+ const legacy = path102.join(ROOT3, ".agent-src.uncondensed");
37424
+ if (path102.resolve(root) === path102.resolve(legacy)) {
37340
37425
  roots = artefact_roots();
37341
37426
  if (roots.length === 0) {
37342
37427
  process.stderr.write("error: no artefact roots found (legacy or packages/*)\n");
@@ -37493,13 +37578,13 @@ function _isCliEntry40() {
37493
37578
  if (process.argv[1] === void 0) {
37494
37579
  return false;
37495
37580
  }
37496
- const argvUrl = pathToFileURL50(path101.resolve(process.argv[1])).href;
37581
+ const argvUrl = pathToFileURL50(path102.resolve(process.argv[1])).href;
37497
37582
  if (import.meta.url === argvUrl) {
37498
37583
  return true;
37499
37584
  }
37500
37585
  try {
37501
- const here = fs96.realpathSync(fileURLToPath59(import.meta.url));
37502
- const argv = fs96.realpathSync(path101.resolve(process.argv[1]));
37586
+ const here = fs96.realpathSync(fileURLToPath60(import.meta.url));
37587
+ const argv = fs96.realpathSync(path102.resolve(process.argv[1]));
37503
37588
  return here === argv;
37504
37589
  } catch {
37505
37590
  return false;
@@ -37540,7 +37625,7 @@ function detectDroppedDecision(assistantTurnTexts, closingFromPayload = false) {
37540
37625
 
37541
37626
  // src/scripts/_lib/graph_feeder_record.ts
37542
37627
  import * as fs99 from "node:fs";
37543
- import * as path103 from "node:path";
37628
+ import * as path104 from "node:path";
37544
37629
 
37545
37630
  // src/scripts/code_graph/query.ts
37546
37631
  import * as fs98 from "node:fs";
@@ -37977,7 +38062,7 @@ function resolveSeeds(g, seed, limit = 5) {
37977
38062
  }
37978
38063
 
37979
38064
  // src/scripts/code_graph/verbs.ts
37980
- import * as path102 from "node:path";
38065
+ import * as path103 from "node:path";
37981
38066
  function isAcceptedEdge(e) {
37982
38067
  return isStatedResolution(e.resolved_via);
37983
38068
  }
@@ -38018,7 +38103,7 @@ function seedsForFiles(g, files) {
38018
38103
  continue;
38019
38104
  }
38020
38105
  if (symbols.some((s) => s.startsWith(`${f}#`))) continue;
38021
- if (EXT_LANG[path102.extname(f).toLowerCase()] === void 0) notIndexed.push(f);
38106
+ if (EXT_LANG[path103.extname(f).toLowerCase()] === void 0) notIndexed.push(f);
38022
38107
  else unresolved.push(f);
38023
38108
  }
38024
38109
  return {
@@ -38116,12 +38201,12 @@ var MAX_PATHS = 5;
38116
38201
  var OUTSIDE_WORKSPACE = "<outside-workspace>";
38117
38202
  var MAX_ROWS_PER_SESSION = 200;
38118
38203
  function feederFile(workspaceRoot3, sessionKey) {
38119
- return path103.join(workspaceRoot3, "agents", "state", "graph-feeder", `${sessionKey}.jsonl`);
38204
+ return path104.join(workspaceRoot3, "agents", "state", "graph-feeder", `${sessionKey}.jsonl`);
38120
38205
  }
38121
38206
  function toRepoRelative(root, paths) {
38122
38207
  let realRoot = null;
38123
38208
  return paths.map((p) => {
38124
- if (!path103.isAbsolute(p)) return p;
38209
+ if (!path104.isAbsolute(p)) return p;
38125
38210
  const raw = _relativeInside(root, p);
38126
38211
  if (raw !== null) return raw;
38127
38212
  realRoot ??= _resolveReal(root);
@@ -38129,34 +38214,34 @@ function toRepoRelative(root, paths) {
38129
38214
  });
38130
38215
  }
38131
38216
  function _relativeInside(from, to) {
38132
- let rel;
38217
+ let rel2;
38133
38218
  try {
38134
- rel = path103.relative(from, to);
38219
+ rel2 = path104.relative(from, to);
38135
38220
  } catch {
38136
38221
  return null;
38137
38222
  }
38138
- if (rel === "") return ".";
38139
- if (rel === ".." || rel.startsWith(`..${path103.sep}`) || path103.isAbsolute(rel)) return null;
38140
- return rel.split(path103.sep).join("/");
38223
+ if (rel2 === "") return ".";
38224
+ if (rel2 === ".." || rel2.startsWith(`..${path104.sep}`) || path104.isAbsolute(rel2)) return null;
38225
+ return rel2.split(path104.sep).join("/");
38141
38226
  }
38142
38227
  function _resolveReal(p) {
38143
- const abs = path103.resolve(p);
38228
+ const abs = path104.resolve(p);
38144
38229
  const tail = [];
38145
38230
  let cur = abs;
38146
38231
  for (; ; ) {
38147
38232
  try {
38148
38233
  const real = fs99.realpathSync(cur);
38149
- return tail.length === 0 ? real : path103.join(real, ...[...tail].reverse());
38234
+ return tail.length === 0 ? real : path104.join(real, ...[...tail].reverse());
38150
38235
  } catch {
38151
- const parent = path103.dirname(cur);
38236
+ const parent = path104.dirname(cur);
38152
38237
  if (parent === cur) return abs;
38153
- tail.push(path103.basename(cur));
38238
+ tail.push(path104.basename(cur));
38154
38239
  cur = parent;
38155
38240
  }
38156
38241
  }
38157
38242
  }
38158
38243
  function _escapesWorkspace(p) {
38159
- return path103.isAbsolute(p) || path103.win32.isAbsolute(p) || p === ".." || p.startsWith("../") || p.startsWith(`..${path103.sep}`);
38244
+ return path104.isAbsolute(p) || path104.win32.isAbsolute(p) || p === ".." || p.startsWith("../") || p.startsWith(`..${path104.sep}`);
38160
38245
  }
38161
38246
  function graphUntestedVerdict(root, state, paths) {
38162
38247
  const none = { verdict: null, untested: 0, tested: 0 };
@@ -38164,14 +38249,14 @@ function graphUntestedVerdict(root, state, paths) {
38164
38249
  if (paths.length === 0) return none;
38165
38250
  let picked;
38166
38251
  try {
38167
- picked = pickSource(detectSources(root, path103.join(root, NATIVE_CACHE_REL)));
38252
+ picked = pickSource(detectSources(root, path104.join(root, NATIVE_CACHE_REL)));
38168
38253
  } catch {
38169
38254
  return none;
38170
38255
  }
38171
38256
  if (!picked || picked.kind === "scip") return none;
38172
38257
  let g;
38173
38258
  try {
38174
- g = loadGraph(picked.path, `${picked.kind}:${path103.relative(root, picked.path)}`);
38259
+ g = loadGraph(picked.path, `${picked.kind}:${path104.relative(root, picked.path)}`);
38175
38260
  } catch {
38176
38261
  return none;
38177
38262
  }
@@ -38201,7 +38286,7 @@ function appendFeederRow(workspaceRoot3, sessionKey, row) {
38201
38286
  } catch {
38202
38287
  }
38203
38288
  if (existing >= MAX_ROWS_PER_SESSION) return;
38204
- fs99.mkdirSync(path103.dirname(file), { recursive: true });
38289
+ fs99.mkdirSync(path104.dirname(file), { recursive: true });
38205
38290
  fs99.appendFileSync(file, `${JSON.stringify(row)}
38206
38291
  `);
38207
38292
  } catch {
@@ -38248,11 +38333,190 @@ function buildFeederRow(input) {
38248
38333
  };
38249
38334
  }
38250
38335
 
38251
- // src/scripts/hooks/subagent_ledger_hook.ts
38336
+ // src/scripts/hooks/svg_obligation.ts
38252
38337
  import * as crypto9 from "node:crypto";
38253
38338
  import * as fs100 from "node:fs";
38254
- import * as path104 from "node:path";
38255
- import { fileURLToPath as fileURLToPath60, pathToFileURL as pathToFileURL51 } from "node:url";
38339
+ import * as path105 from "node:path";
38340
+ var EDIT_TOOLS3 = /* @__PURE__ */ new Set(["Edit", "Write", "MultiEdit", "NotebookEdit"]);
38341
+ var RENDER_REL = path105.join("agents", "runtime", "state", "render");
38342
+ var PLANTED_PREFIXES = [
38343
+ "tests/design-artifacts/fixtures/",
38344
+ "tests/design-artifacts/scenarios/"
38345
+ ];
38346
+ function hasErrorFinding(m) {
38347
+ const f = m.asset?.findings;
38348
+ return Array.isArray(f) && f.some((x) => x?.severity === "error");
38349
+ }
38350
+ var rel = (root, p) => {
38351
+ const slashed = p.split(path105.sep).join("/");
38352
+ if (!path105.isAbsolute(p)) return path105.posix.normalize(slashed).replace(/^\.\//, "");
38353
+ const inside = path105.relative(root, p).split(path105.sep).join("/");
38354
+ return inside === "" || inside.startsWith("../") ? slashed : inside;
38355
+ };
38356
+ function isPlantedFixture(relPath, root = "") {
38357
+ const norm = rel(root, relPath);
38358
+ return PLANTED_PREFIXES.some((prefix) => norm.startsWith(prefix));
38359
+ }
38360
+ function readAssetManifests(root) {
38361
+ const dir = path105.join(root, RENDER_REL);
38362
+ let entries;
38363
+ try {
38364
+ entries = fs100.readdirSync(dir);
38365
+ } catch {
38366
+ return [];
38367
+ }
38368
+ const out = [];
38369
+ for (const name of entries) {
38370
+ let raw;
38371
+ try {
38372
+ raw = fs100.readFileSync(path105.join(dir, name, "manifest.json"), "utf8");
38373
+ } catch {
38374
+ continue;
38375
+ }
38376
+ try {
38377
+ const parsed = JSON.parse(raw);
38378
+ if (parsed.profile === "asset") out.push(parsed);
38379
+ } catch {
38380
+ }
38381
+ }
38382
+ return out;
38383
+ }
38384
+ function dischargeFor(manifests, digest2) {
38385
+ let staticOnly = false;
38386
+ for (const m of manifests) {
38387
+ if (m.verification === "verified" && m.asset?.digest === digest2 && !hasErrorFinding(m)) {
38388
+ return "verified";
38389
+ }
38390
+ if (m.reason === "renderer-absent" && m.static?.digest === digest2 && m.static.errors === 0) {
38391
+ staticOnly = true;
38392
+ }
38393
+ }
38394
+ return staticOnly ? "static-only" : null;
38395
+ }
38396
+ function readSvgObligations(root, inputs) {
38397
+ const open = [];
38398
+ const discharged = [];
38399
+ const seen = /* @__PURE__ */ new Set();
38400
+ let manifests = null;
38401
+ for (const { path: raw, rendered } of inputs.edits) {
38402
+ if (!/\.svg$/i.test(raw)) continue;
38403
+ const relPath = rel(root, raw);
38404
+ if (seen.has(relPath)) continue;
38405
+ seen.add(relPath);
38406
+ if (isPlantedFixture(relPath, root)) continue;
38407
+ const abs = path105.isAbsolute(raw) ? raw : path105.join(root, relPath);
38408
+ let bytes;
38409
+ try {
38410
+ bytes = fs100.readFileSync(abs);
38411
+ } catch {
38412
+ continue;
38413
+ }
38414
+ const digest2 = crypto9.createHash("sha256").update(bytes).digest("hex");
38415
+ if (!renderNames(rendered, relPath)) {
38416
+ open.push({
38417
+ file: relPath,
38418
+ reason: "no `ui:render --profile asset` naming this file ran after THIS file's last edit, so no manifest on disk can be attributed to it \u2014 a manifest written by any other route, and a render of some other file, both discharge nothing"
38419
+ });
38420
+ continue;
38421
+ }
38422
+ if (inputs.renderDirTampered) {
38423
+ open.push({
38424
+ file: relPath,
38425
+ reason: "this turn wrote into the render directory by a route other than `ui:render`, so no manifest there is evidence of a render \u2014 re-run the render in a turn that does not touch it"
38426
+ });
38427
+ continue;
38428
+ }
38429
+ manifests ??= readAssetManifests(root);
38430
+ const kind = dischargeFor(manifests, digest2);
38431
+ if (kind === null) {
38432
+ open.push({
38433
+ file: relPath,
38434
+ reason: "no asset manifest matches this file's current digest \u2014 a render that is `verified`, or a `renderer-absent` one whose static witness reports 0 errors on the same digest, discharges it"
38435
+ });
38436
+ continue;
38437
+ }
38438
+ discharged.push({ file: relPath, kind });
38439
+ }
38440
+ return { open, discharged };
38441
+ }
38442
+ function renderNames(commands, relPath) {
38443
+ const base = relPath.split("/").pop() ?? relPath;
38444
+ return commands.some((c) => {
38445
+ const slashed = c.split(path105.sep).join("/");
38446
+ const bounded = (needle) => new RegExp(`(^|[\\s/'"])${escapeRe(needle)}(\\s|$|['"])`).test(slashed);
38447
+ return bounded(relPath) || bounded(base);
38448
+ });
38449
+ }
38450
+ function isPureRender(command) {
38451
+ if (!isAssetRenderCommand(command)) return false;
38452
+ const [head, ...pipes] = command.replace(/^\s*cd\s+[^;&|<>`$\n]+&&\s*/, "").replace(/\s\d?>&\d\b/g, " ").replace(/\s2>\s*\/dev\/null\b/g, " ").split("|");
38453
+ if (/[;&<>`\n]|\$\(/.test(head ?? "")) return false;
38454
+ return pipes.every((p) => /^\s*(tail|head|grep|jq|cat|less|wc)\b[^;&<>`|]*$/.test(p) && !/\$\(/.test(p));
38455
+ }
38456
+ function writesRenderDir(command) {
38457
+ if (isPureRender(command)) return false;
38458
+ const slashed = command.split(path105.sep).join("/");
38459
+ const names = /(^|[\s/'"])(render\/|manifest\.json\b)/.test(slashed) || slashed.includes("state/render");
38460
+ const writes = />(?!&)|\b(tee|sponge)\b|\b(cp|mv|ln|install|rsync|dd)\s|\bsed\s+-i|\bwriteFile|\b(python[\d.]*|perl|ruby|node|deno|bun|php|osascript)\b/.test(
38461
+ slashed.replace(/\s\d?>&\d\b/g, " ").replace(/\s2>\s*\/dev\/null\b/g, " ")
38462
+ );
38463
+ return names && writes;
38464
+ }
38465
+ function escapeRe(s) {
38466
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
38467
+ }
38468
+ function openSvgObligation(workspaceRoot3, toolCalls) {
38469
+ const lastEditOf = /* @__PURE__ */ new Map();
38470
+ for (let i = 0; i < toolCalls.length; i += 1) {
38471
+ const c = toolCalls[i];
38472
+ if (!EDIT_TOOLS3.has(c.name) || c.path === void 0) continue;
38473
+ lastEditOf.set(c.path, i);
38474
+ }
38475
+ if (lastEditOf.size === 0) return null;
38476
+ const edits = [...lastEditOf].map(([p, at]) => {
38477
+ const rendered = [];
38478
+ for (let i = at + 1; i < toolCalls.length; i += 1) {
38479
+ const c = toolCalls[i];
38480
+ if (c.name === "Bash" && c.command !== void 0 && isPureRender(c.command)) {
38481
+ rendered.push(c.command);
38482
+ }
38483
+ }
38484
+ return { path: p, rendered };
38485
+ });
38486
+ const renderDir = RENDER_REL.split(path105.sep).join("/");
38487
+ const renderDirTampered = toolCalls.some((c) => {
38488
+ if (EDIT_TOOLS3.has(c.name) && c.path !== void 0) {
38489
+ return rel(workspaceRoot3, c.path).startsWith(`${renderDir}/`);
38490
+ }
38491
+ return c.name === "Bash" && c.command !== void 0 && writesRenderDir(c.command);
38492
+ });
38493
+ let reading;
38494
+ try {
38495
+ reading = readSvgObligations(workspaceRoot3, { edits, renderDirTampered });
38496
+ } catch {
38497
+ return null;
38498
+ }
38499
+ const first = reading.open[0];
38500
+ if (first === void 0) return null;
38501
+ const more = reading.open.length > 1 ? ` (and ${String(reading.open.length - 1)} more)` : "";
38502
+ return {
38503
+ // Reported under `verification` rather than a seventh detector id: it
38504
+ // IS a verification finding — a file changed and nothing that can fail
38505
+ // ran over it — and a new id would ripple through DETECTOR_IDS, the
38506
+ // per-detector counters and the demotion contract for a distinction the
38507
+ // operator never makes.
38508
+ detector: "verification",
38509
+ mode: "transcript",
38510
+ evidence: first.file,
38511
+ reason: `this turn edited an .svg and no render describes it${more} \u2014 ${first.reason}. A bare \`ui:render --profile asset\` that rendered nothing, and a test or lint run over other files, both discharge nothing: the gate reads the render, never the call.`
38512
+ };
38513
+ }
38514
+
38515
+ // src/scripts/hooks/subagent_ledger_hook.ts
38516
+ import * as crypto10 from "node:crypto";
38517
+ import * as fs101 from "node:fs";
38518
+ import * as path106 from "node:path";
38519
+ import { fileURLToPath as fileURLToPath61, pathToFileURL as pathToFileURL51 } from "node:url";
38256
38520
 
38257
38521
  // src/scripts/_lib/subagent_response.ts
38258
38522
  var MAX_SUMMARY_CHARS = 2e3;
@@ -38357,11 +38621,11 @@ function validateResponse(input) {
38357
38621
  function isObject15(v) {
38358
38622
  return typeof v === "object" && v !== null && !Array.isArray(v);
38359
38623
  }
38360
- var LEDGER_DIR = path104.join("agents", "runtime", "state", "subagent-ledger");
38624
+ var LEDGER_DIR = path106.join("agents", "runtime", "state", "subagent-ledger");
38361
38625
  var OPEN_SUBDIR = "open";
38362
38626
  var OPEN_RECORD_TTL_MS = 24 * 60 * 60 * 1e3;
38363
38627
  function refFor(agentId) {
38364
- return crypto9.createHash("sha256").update(agentId, "utf8").digest("hex").slice(0, 12);
38628
+ return crypto10.createHash("sha256").update(agentId, "utf8").digest("hex").slice(0, 12);
38365
38629
  }
38366
38630
  function unwrapPayload3(envelope) {
38367
38631
  const inner = envelope["payload"];
@@ -38447,10 +38711,10 @@ function _jsonObjectCandidates(message) {
38447
38711
  return out;
38448
38712
  }
38449
38713
  function openDir(root) {
38450
- return path104.join(root, LEDGER_DIR, OPEN_SUBDIR);
38714
+ return path106.join(root, LEDGER_DIR, OPEN_SUBDIR);
38451
38715
  }
38452
38716
  function openFile(root, ref) {
38453
- return path104.join(openDir(root), `${ref}.json`);
38717
+ return path106.join(openDir(root), `${ref}.json`);
38454
38718
  }
38455
38719
  var DEPTH_BASES = /* @__PURE__ */ new Set(["observed", "asserted-parent", "assumed-root"]);
38456
38720
  function _asOpenRecord(value, expectedRef) {
@@ -38477,7 +38741,7 @@ function readOpenRecords(root) {
38477
38741
  const out = /* @__PURE__ */ new Map();
38478
38742
  let names;
38479
38743
  try {
38480
- names = fs100.readdirSync(openDir(root));
38744
+ names = fs101.readdirSync(openDir(root));
38481
38745
  } catch {
38482
38746
  return out;
38483
38747
  }
@@ -38485,7 +38749,7 @@ function readOpenRecords(root) {
38485
38749
  if (!name.endsWith(".json")) continue;
38486
38750
  const expectedRef = name.slice(0, -".json".length);
38487
38751
  try {
38488
- const raw = fs100.readFileSync(path104.join(openDir(root), name), "utf8");
38752
+ const raw = fs101.readFileSync(path106.join(openDir(root), name), "utf8");
38489
38753
  const rec = _asOpenRecord(JSON.parse(raw), expectedRef);
38490
38754
  if (rec) out.set(rec.ref, rec);
38491
38755
  } catch {
@@ -38500,13 +38764,13 @@ function resolveDepth(parentRef, open) {
38500
38764
  return { depth: parent.depth + 1, depth_basis: "observed" };
38501
38765
  }
38502
38766
  function ledgerFileFor2(root, ts) {
38503
- return path104.join(root, LEDGER_DIR, `${ts.slice(0, 7)}.jsonl`);
38767
+ return path106.join(root, LEDGER_DIR, `${ts.slice(0, 7)}.jsonl`);
38504
38768
  }
38505
38769
  function appendLedgerLine(root, ts, line) {
38506
38770
  if (is_replay_mode()) return;
38507
38771
  const file = ledgerFileFor2(root, ts);
38508
- fs100.mkdirSync(path104.dirname(file), { recursive: true });
38509
- fs100.appendFileSync(file, `${JSON.stringify(line)}
38772
+ fs101.mkdirSync(path106.dirname(file), { recursive: true });
38773
+ fs101.appendFileSync(file, `${JSON.stringify(line)}
38510
38774
  `, "utf8");
38511
38775
  }
38512
38776
  var WALL_CLOCK_ARMS_MS = [
@@ -38520,7 +38784,7 @@ function armsExceeded(elapsedMs) {
38520
38784
  return WALL_CLOCK_ARMS_MS.filter((a) => elapsedMs >= a.ms).map((a) => a.label);
38521
38785
  }
38522
38786
  function openRecordStats(root, nowMs = Date.now()) {
38523
- const ledgerPresent = fs100.existsSync(path104.join(root, LEDGER_DIR));
38787
+ const ledgerPresent = fs101.existsSync(path106.join(root, LEDGER_DIR));
38524
38788
  const open = readOpenRecords(root);
38525
38789
  let maxDepth = 0;
38526
38790
  let counted = 0;
@@ -38548,13 +38812,13 @@ function writeOpenRecord(root, rec) {
38548
38812
  function removeOpenRecord(root, ref) {
38549
38813
  if (is_replay_mode()) return;
38550
38814
  try {
38551
- fs100.unlinkSync(openFile(root, ref));
38815
+ fs101.unlinkSync(openFile(root, ref));
38552
38816
  } catch {
38553
38817
  }
38554
38818
  }
38555
38819
  function countOpen(root) {
38556
38820
  try {
38557
- return fs100.readdirSync(openDir(root)).filter((n) => n.endsWith(".json")).length;
38821
+ return fs101.readdirSync(openDir(root)).filter((n) => n.endsWith(".json")).length;
38558
38822
  } catch {
38559
38823
  return 0;
38560
38824
  }
@@ -38720,10 +38984,10 @@ function _isCliEntry41() {
38720
38984
  return false;
38721
38985
  }
38722
38986
  if (process.argv[1] === void 0) return false;
38723
- const argvUrl = pathToFileURL51(path104.resolve(process.argv[1])).href;
38987
+ const argvUrl = pathToFileURL51(path106.resolve(process.argv[1])).href;
38724
38988
  if (import.meta.url === argvUrl) return true;
38725
38989
  try {
38726
- return fs100.realpathSync(fileURLToPath60(import.meta.url)) === fs100.realpathSync(path104.resolve(process.argv[1]));
38990
+ return fs101.realpathSync(fileURLToPath61(import.meta.url)) === fs101.realpathSync(path106.resolve(process.argv[1]));
38727
38991
  } catch {
38728
38992
  return false;
38729
38993
  }
@@ -38731,7 +38995,7 @@ function _isCliEntry41() {
38731
38995
  if (_isCliEntry41()) process.exit(main59());
38732
38996
 
38733
38997
  // src/scripts/_lib/turn_end_transcript.ts
38734
- import * as fs101 from "node:fs";
38998
+ import * as fs102 from "node:fs";
38735
38999
  function readTranscriptTail(transcriptPath, opts = {}) {
38736
39000
  const empty = {
38737
39001
  lastAssistant: "",
@@ -38742,10 +39006,10 @@ function readTranscriptTail(transcriptPath, opts = {}) {
38742
39006
  if (!transcriptPath || !isSafeTranscriptPath(transcriptPath, opts)) return empty;
38743
39007
  let lines;
38744
39008
  try {
38745
- if (opts.maxBytes !== void 0 && fs101.statSync(transcriptPath).size > opts.maxBytes) {
39009
+ if (opts.maxBytes !== void 0 && fs102.statSync(transcriptPath).size > opts.maxBytes) {
38746
39010
  return empty;
38747
39011
  }
38748
- lines = fs101.readFileSync(transcriptPath, "utf-8").split("\n");
39012
+ lines = fs102.readFileSync(transcriptPath, "utf-8").split("\n");
38749
39013
  } catch {
38750
39014
  return empty;
38751
39015
  }
@@ -38932,7 +39196,7 @@ function detectPromissory(reply) {
38932
39196
  function readCiSettled(workspaceRoot3, session_id) {
38933
39197
  if (!hasStableSessionId(session_id)) return { seen: false, settled: false };
38934
39198
  try {
38935
- const raw = fs102.readFileSync(path105.join(workspaceRoot3, statePathFor(session_id)), "utf-8");
39199
+ const raw = fs103.readFileSync(path107.join(workspaceRoot3, statePathFor(session_id)), "utf-8");
38936
39200
  const decoded = JSON.parse(raw);
38937
39201
  if (!owns_session_state(decoded, session_id)) return { seen: false, settled: false };
38938
39202
  if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
@@ -38968,8 +39232,8 @@ function detectCompletionClaim(reply, ci) {
38968
39232
  function readLanguagePin(workspaceRoot3, session_id) {
38969
39233
  if (!hasStableSessionId(session_id)) return "und";
38970
39234
  try {
38971
- const raw = fs102.readFileSync(
38972
- path105.join(workspaceRoot3, statePathFor2(session_id)),
39235
+ const raw = fs103.readFileSync(
39236
+ path107.join(workspaceRoot3, statePathFor2(session_id)),
38973
39237
  "utf-8"
38974
39238
  );
38975
39239
  const decoded = JSON.parse(raw);
@@ -39016,7 +39280,7 @@ function detectUnverifiedEdit(toolCalls, runState = null) {
39016
39280
  }
39017
39281
  for (let i = lastEdit + 1; i < toolCalls.length; i += 1) {
39018
39282
  const c = toolCalls[i];
39019
- if (c.name === "Bash" && c.command !== void 0 && isVerificationCommand(c.command)) {
39283
+ if (c.name === "Bash" && c.command !== void 0 && isVerificationAttempt(c.command)) {
39020
39284
  return null;
39021
39285
  }
39022
39286
  }
@@ -39025,7 +39289,7 @@ function detectUnverifiedEdit(toolCalls, runState = null) {
39025
39289
  // The path, never the diff: the evidence span is quoted into a refusal,
39026
39290
  // and `ToolCall` is shaped so a file body cannot reach it.
39027
39291
  evidence: edited,
39028
- 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)",
39292
+ reason: "this turn changed a file and then ran no verification command \u2014 no test, type-check, lint, build or asset render follows the last edit (verify-before-complete: a claim without a fresh run is unverified)",
39029
39293
  mode: "transcript"
39030
39294
  };
39031
39295
  }
@@ -39078,7 +39342,7 @@ function sessionStateFile2(workspaceRoot3, sessionKey) {
39078
39342
  }
39079
39343
  function alreadyRefusedTurn(workspaceRoot3, sessionKey, turnOrdinal) {
39080
39344
  try {
39081
- const raw = fs102.readFileSync(sessionStateFile2(workspaceRoot3, sessionKey), "utf-8");
39345
+ const raw = fs103.readFileSync(sessionStateFile2(workspaceRoot3, sessionKey), "utf-8");
39082
39346
  const decoded = JSON.parse(raw);
39083
39347
  if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
39084
39348
  return decoded["refused_turn"] === turnOrdinal;
@@ -39092,7 +39356,7 @@ function markRefusedTurn(workspaceRoot3, sessionKey, turnOrdinal, detectors, pro
39092
39356
  const file = sessionStateFile2(workspaceRoot3, sessionKey);
39093
39357
  let prev = null;
39094
39358
  try {
39095
- prev = parseRecord(fs102.readFileSync(file, "utf-8"));
39359
+ prev = parseRecord(fs103.readFileSync(file, "utf-8"));
39096
39360
  } catch {
39097
39361
  }
39098
39362
  let version;
@@ -39189,6 +39453,7 @@ function runDetectors2(inputs) {
39189
39453
  // on a completion CLAIM, and a turn waiting on a subagent has not
39190
39454
  // finished — so its closing is not the claim F is about. Same slot,
39191
39455
  // opposite trigger, opposite treatment of `dispatchOpen`.
39456
+ openSvgObligation(workspaceRoot3, toolCalls),
39192
39457
  dispatchOpen ? null : detectUntestedChange(lastAssistant, toolCalls, runState)
39193
39458
  ]) {
39194
39459
  if (f) findings.push(f);
@@ -39233,7 +39498,7 @@ function recordShadow(inputs, layer) {
39233
39498
  const file = sessionShadowFile(inputs.workspaceRoot, inputs.sessionKey);
39234
39499
  let prev = null;
39235
39500
  try {
39236
- prev = parseShadowRecord(fs102.readFileSync(file, "utf-8"));
39501
+ prev = parseShadowRecord(fs103.readFileSync(file, "utf-8"));
39237
39502
  } catch {
39238
39503
  }
39239
39504
  atomic_write_json(
@@ -39301,13 +39566,13 @@ function _isCliEntry42() {
39301
39566
  if (process.argv[1] === void 0) {
39302
39567
  return false;
39303
39568
  }
39304
- const argvUrl = pathToFileURL52(path105.resolve(process.argv[1])).href;
39569
+ const argvUrl = pathToFileURL52(path107.resolve(process.argv[1])).href;
39305
39570
  if (import.meta.url === argvUrl) {
39306
39571
  return true;
39307
39572
  }
39308
39573
  try {
39309
- const here = fs102.realpathSync(fileURLToPath61(import.meta.url));
39310
- const argv = fs102.realpathSync(path105.resolve(process.argv[1]));
39574
+ const here = fs103.realpathSync(fileURLToPath62(import.meta.url));
39575
+ const argv = fs103.realpathSync(path107.resolve(process.argv[1]));
39311
39576
  return here === argv;
39312
39577
  } catch {
39313
39578
  return false;
@@ -39319,10 +39584,10 @@ if (_isCliEntry42()) {
39319
39584
 
39320
39585
  // src/scripts/hooks/edit_shape_hook.ts
39321
39586
  import { spawnSync as spawnSync9 } from "node:child_process";
39322
- import * as crypto10 from "node:crypto";
39323
- import * as fs103 from "node:fs";
39324
- import * as path106 from "node:path";
39325
- import { fileURLToPath as fileURLToPath62, pathToFileURL as pathToFileURL53 } from "node:url";
39587
+ import * as crypto11 from "node:crypto";
39588
+ import * as fs104 from "node:fs";
39589
+ import * as path108 from "node:path";
39590
+ import { fileURLToPath as fileURLToPath63, pathToFileURL as pathToFileURL53 } from "node:url";
39326
39591
  var MIN_FILE_LINES = 50;
39327
39592
  var MAX_DIFF_RATIO = 0.2;
39328
39593
  var EXEMPT_PATH_PATTERNS = [
@@ -39373,7 +39638,7 @@ function effectiveDiffLines(cwd, relPath) {
39373
39638
  }
39374
39639
  function fileLineCount(absPath) {
39375
39640
  try {
39376
- const text = fs103.readFileSync(absPath, "utf8");
39641
+ const text = fs104.readFileSync(absPath, "utf8");
39377
39642
  if (text.length === 0) return 0;
39378
39643
  return text.split("\n").length - (text.endsWith("\n") ? 1 : 0);
39379
39644
  } catch {
@@ -39387,14 +39652,14 @@ function buildAdvisoryLine2(fileLines, diffLines) {
39387
39652
  function deriveSessionKey3(envelope, payload) {
39388
39653
  const raw = str9(envelope["session_id"]) || str9(payload["session_id"] ?? payload["sessionId"]);
39389
39654
  const material = raw || "unknown-session";
39390
- return crypto10.createHash("sha256").update(material).digest("hex");
39655
+ return crypto11.createHash("sha256").update(material).digest("hex");
39391
39656
  }
39392
39657
  function sessionStateFile3(workspaceRoot3, sessionKey) {
39393
- return path106.join(workspaceRoot3, "agents", "runtime", "state", "edit-shape", `${sessionKey}.json`);
39658
+ return path108.join(workspaceRoot3, "agents", "runtime", "state", "edit-shape", `${sessionKey}.json`);
39394
39659
  }
39395
39660
  function hasFiredThisSession2(workspaceRoot3, sessionKey) {
39396
39661
  try {
39397
- return fs103.existsSync(sessionStateFile3(workspaceRoot3, sessionKey));
39662
+ return fs104.existsSync(sessionStateFile3(workspaceRoot3, sessionKey));
39398
39663
  } catch {
39399
39664
  return false;
39400
39665
  }
@@ -39425,8 +39690,8 @@ function main61() {
39425
39690
  const filePath = extractFilePath2(payload);
39426
39691
  if (!filePath) return EXIT_ALLOW;
39427
39692
  const workspaceRoot3 = str9(envelope["workspace_root"]).trim() || process.cwd();
39428
- const absPath = path106.isAbsolute(filePath) ? filePath : path106.resolve(workspaceRoot3, filePath);
39429
- const relPath = path106.relative(workspaceRoot3, absPath);
39693
+ const absPath = path108.isAbsolute(filePath) ? filePath : path108.resolve(workspaceRoot3, filePath);
39694
+ const relPath = path108.relative(workspaceRoot3, absPath);
39430
39695
  if (isExemptPath(relPath) || isExemptPath(absPath)) return EXIT_ALLOW;
39431
39696
  const fileLines = fileLineCount(absPath);
39432
39697
  if (fileLines < MIN_FILE_LINES) return EXIT_ALLOW;
@@ -39456,13 +39721,13 @@ function _isCliEntry43() {
39456
39721
  if (process.argv[1] === void 0) {
39457
39722
  return false;
39458
39723
  }
39459
- const argvUrl = pathToFileURL53(path106.resolve(process.argv[1])).href;
39724
+ const argvUrl = pathToFileURL53(path108.resolve(process.argv[1])).href;
39460
39725
  if (import.meta.url === argvUrl) {
39461
39726
  return true;
39462
39727
  }
39463
39728
  try {
39464
- const here = fs103.realpathSync(fileURLToPath62(import.meta.url));
39465
- const argv = fs103.realpathSync(path106.resolve(process.argv[1]));
39729
+ const here = fs104.realpathSync(fileURLToPath63(import.meta.url));
39730
+ const argv = fs104.realpathSync(path108.resolve(process.argv[1]));
39466
39731
  return here === argv;
39467
39732
  } catch {
39468
39733
  return false;
@@ -39473,30 +39738,30 @@ if (_isCliEntry43()) {
39473
39738
  }
39474
39739
 
39475
39740
  // src/scripts/hooks/comment_discipline_hook.ts
39476
- import * as fs105 from "node:fs";
39477
- import * as path109 from "node:path";
39478
- import { fileURLToPath as fileURLToPath64, pathToFileURL as pathToFileURL54 } from "node:url";
39741
+ import * as fs106 from "node:fs";
39742
+ import * as path111 from "node:path";
39743
+ import { fileURLToPath as fileURLToPath65, pathToFileURL as pathToFileURL54 } from "node:url";
39479
39744
 
39480
39745
  // src/scripts/lint_code_comments.ts
39481
39746
  import { spawnSync as spawnSync11 } from "node:child_process";
39482
- import * as fs104 from "node:fs";
39747
+ import * as fs105 from "node:fs";
39483
39748
  import * as os15 from "node:os";
39484
- import * as path108 from "node:path";
39749
+ import * as path110 from "node:path";
39485
39750
  import process15 from "node:process";
39486
- import { fileURLToPath as fileURLToPath63 } from "node:url";
39751
+ import { fileURLToPath as fileURLToPath64 } from "node:url";
39487
39752
 
39488
39753
  // src/scripts/_lib/gate_self_test.ts
39489
39754
  import { spawnSync as spawnSync10 } from "node:child_process";
39490
- import * as path107 from "node:path";
39755
+ import * as path109 from "node:path";
39491
39756
  import process14 from "node:process";
39492
39757
  function runGateCli(repoRoot, scriptRelPath, args, cwd) {
39493
- const tsx = path107.join(
39758
+ const tsx = path109.join(
39494
39759
  repoRoot,
39495
39760
  "node_modules",
39496
39761
  ".bin",
39497
39762
  process14.platform === "win32" ? "tsx.cmd" : "tsx"
39498
39763
  );
39499
- const res = spawnSync10(tsx, [path107.join(repoRoot, scriptRelPath), ...args], {
39764
+ const res = spawnSync10(tsx, [path109.join(repoRoot, scriptRelPath), ...args], {
39500
39765
  cwd,
39501
39766
  encoding: "utf-8",
39502
39767
  maxBuffer: 64 * 1024 * 1024,
@@ -39548,7 +39813,7 @@ ${opts.gate} --self-test: ${String(opts.cases.length - failed)}/${String(opts.ca
39548
39813
  }
39549
39814
 
39550
39815
  // src/scripts/lint_code_comments.ts
39551
- var _HERE14 = fileURLToPath63(import.meta.url);
39816
+ var _HERE14 = fileURLToPath64(import.meta.url);
39552
39817
  var SCANNED_EXTENSIONS = /* @__PURE__ */ new Set([
39553
39818
  ".ts",
39554
39819
  ".tsx",
@@ -39805,10 +40070,10 @@ function scanText2(file, text) {
39805
40070
  }
39806
40071
  return out;
39807
40072
  }
39808
- function isScannable(rel) {
39809
- if (SKIP_SEGMENTS.some((s) => rel.includes(s))) return false;
39810
- if (rel.endsWith(".d.ts")) return false;
39811
- return SCANNED_EXTENSIONS.has(path108.extname(rel));
40073
+ function isScannable(rel2) {
40074
+ if (SKIP_SEGMENTS.some((s) => rel2.includes(s))) return false;
40075
+ if (rel2.endsWith(".d.ts")) return false;
40076
+ return SCANNED_EXTENSIONS.has(path110.extname(rel2));
39812
40077
  }
39813
40078
  function changedFiles(root, base) {
39814
40079
  const r = spawnSync11("git", ["diff", "--name-only", "--diff-filter=ACMR", `${base}...HEAD`], {
@@ -39986,11 +40251,11 @@ var COMMENT_CASES = [
39986
40251
  }
39987
40252
  ];
39988
40253
  function selfTest2() {
39989
- const repoRoot = path108.resolve(path108.dirname(_HERE14), "..", "..");
39990
- const dir = fs104.mkdtempSync(path108.join(os15.tmpdir(), "lcc-selftest-"));
40254
+ const repoRoot = path110.resolve(path110.dirname(_HERE14), "..", "..");
40255
+ const dir = fs105.mkdtempSync(path110.join(os15.tmpdir(), "lcc-selftest-"));
39991
40256
  const exercise = (testCase, index) => {
39992
- const file = path108.join(dir, `case-${String(index)}.ts`);
39993
- fs104.writeFileSync(file, testCase.source, "utf-8");
40257
+ const file = path110.join(dir, `case-${String(index)}.ts`);
40258
+ fs105.writeFileSync(file, testCase.source, "utf-8");
39994
40259
  return runGateCli(repoRoot, "src/scripts/lint_code_comments.ts", ["--paths", file], dir);
39995
40260
  };
39996
40261
  try {
@@ -40005,7 +40270,7 @@ function selfTest2() {
40005
40270
  }))
40006
40271
  });
40007
40272
  } finally {
40008
- fs104.rmSync(dir, { recursive: true, force: true });
40273
+ fs105.rmSync(dir, { recursive: true, force: true });
40009
40274
  }
40010
40275
  }
40011
40276
  var HELP = `usage: lint_code_comments [--base <ref>] [--root <dir>] [--paths <f> \u2026] [--report]
@@ -40033,7 +40298,7 @@ function main62(argv) {
40033
40298
  return selfTest2();
40034
40299
  }
40035
40300
  let base = "origin/main";
40036
- let root = path108.resolve(path108.dirname(_HERE14), "..", "..");
40301
+ let root = path110.resolve(path110.dirname(_HERE14), "..", "..");
40037
40302
  let reportOnly = false;
40038
40303
  const explicit = [];
40039
40304
  for (let i = 0; i < argv.length; i++) {
@@ -40044,7 +40309,7 @@ function main62(argv) {
40044
40309
  } else if (a === "--base") {
40045
40310
  base = argv[++i] ?? "";
40046
40311
  } else if (a === "--root") {
40047
- root = path108.resolve(argv[++i] ?? ".");
40312
+ root = path110.resolve(argv[++i] ?? ".");
40048
40313
  } else if (a === "--report") {
40049
40314
  reportOnly = true;
40050
40315
  } else if (a === "--paths") {
@@ -40062,16 +40327,16 @@ ${HELP}`);
40062
40327
  const candidates = (explicit.length > 0 ? explicit : changedFiles(root, base)).filter(isScannable);
40063
40328
  const added = explicit.length > 0 ? null : addedLineMap(root, base);
40064
40329
  const findings = [];
40065
- for (const rel of candidates) {
40066
- const abs = path108.isAbsolute(rel) ? rel : path108.join(root, rel);
40330
+ for (const rel2 of candidates) {
40331
+ const abs = path110.isAbsolute(rel2) ? rel2 : path110.join(root, rel2);
40067
40332
  let text;
40068
40333
  try {
40069
- text = fs104.readFileSync(abs, "utf-8");
40334
+ text = fs105.readFileSync(abs, "utf-8");
40070
40335
  } catch {
40071
40336
  continue;
40072
40337
  }
40073
- const all = scanText2(rel, text);
40074
- findings.push(...added ? findingsOnAddedLines(all, added.get(rel)) : all);
40338
+ const all = scanText2(rel2, text);
40339
+ findings.push(...added ? findingsOnAddedLines(all, added.get(rel2)) : all);
40075
40340
  }
40076
40341
  try {
40077
40342
  reportScanned({
@@ -40127,7 +40392,7 @@ var _isMain6 = (() => {
40127
40392
  const entry = process15.argv[1];
40128
40393
  if (!entry) return false;
40129
40394
  try {
40130
- return fs104.realpathSync(entry) === fs104.realpathSync(_HERE14);
40395
+ return fs105.realpathSync(entry) === fs105.realpathSync(_HERE14);
40131
40396
  } catch {
40132
40397
  return false;
40133
40398
  }
@@ -40173,9 +40438,9 @@ function main63() {
40173
40438
  const text = writtenText(toolName2, ti);
40174
40439
  if (!text) return EXIT_ALLOW;
40175
40440
  const workspaceRoot3 = str10(envelope["workspace_root"]).trim() || process.cwd();
40176
- const abs = path109.isAbsolute(filePath) ? filePath : path109.resolve(workspaceRoot3, filePath);
40177
- const rel = path109.relative(workspaceRoot3, abs);
40178
- const shown = rel.startsWith("..") ? path109.basename(abs) : rel;
40441
+ const abs = path111.isAbsolute(filePath) ? filePath : path111.resolve(workspaceRoot3, filePath);
40442
+ const rel2 = path111.relative(workspaceRoot3, abs);
40443
+ const shown = rel2.startsWith("..") ? path111.basename(abs) : rel2;
40179
40444
  const findings = scanText2(shown, text);
40180
40445
  if (findings.length === 0) return EXIT_ALLOW;
40181
40446
  process.stdout.write(
@@ -40194,10 +40459,10 @@ function main63() {
40194
40459
  function _isCliEntry44() {
40195
40460
  if (true) return false;
40196
40461
  if (process.argv[1] === void 0) return false;
40197
- const argvUrl = pathToFileURL54(path109.resolve(process.argv[1])).href;
40462
+ const argvUrl = pathToFileURL54(path111.resolve(process.argv[1])).href;
40198
40463
  if (import.meta.url === argvUrl) return true;
40199
40464
  try {
40200
- return fs105.realpathSync(fileURLToPath64(import.meta.url)) === fs105.realpathSync(path109.resolve(process.argv[1]));
40465
+ return fs106.realpathSync(fileURLToPath65(import.meta.url)) === fs106.realpathSync(path111.resolve(process.argv[1]));
40201
40466
  } catch {
40202
40467
  return false;
40203
40468
  }
@@ -40205,10 +40470,10 @@ function _isCliEntry44() {
40205
40470
  if (_isCliEntry44()) process.exit(main63());
40206
40471
 
40207
40472
  // src/scripts/hooks/reread_guard_hook.ts
40208
- import * as crypto11 from "node:crypto";
40209
- import * as fs106 from "node:fs";
40210
- import * as path110 from "node:path";
40211
- import { fileURLToPath as fileURLToPath65, pathToFileURL as pathToFileURL55 } from "node:url";
40473
+ import * as crypto12 from "node:crypto";
40474
+ import * as fs107 from "node:fs";
40475
+ import * as path112 from "node:path";
40476
+ import { fileURLToPath as fileURLToPath66, pathToFileURL as pathToFileURL55 } from "node:url";
40212
40477
  var EXEMPT_PATH_PATTERNS2 = [
40213
40478
  /(^|\/)dist\//i,
40214
40479
  // dist/**
@@ -40239,14 +40504,14 @@ function emptyLedger() {
40239
40504
  function deriveSessionKey4(envelope, payload) {
40240
40505
  const raw = str11(envelope["session_id"]) || str11(payload["session_id"] ?? payload["sessionId"]);
40241
40506
  const material = raw || "unknown-session";
40242
- return crypto11.createHash("sha256").update(material).digest("hex");
40507
+ return crypto12.createHash("sha256").update(material).digest("hex");
40243
40508
  }
40244
40509
  function ledgerFile(workspaceRoot3, sessionKey) {
40245
- return path110.join(workspaceRoot3, "agents", "runtime", "state", "reread-guard", `${sessionKey}.json`);
40510
+ return path112.join(workspaceRoot3, "agents", "runtime", "state", "reread-guard", `${sessionKey}.json`);
40246
40511
  }
40247
40512
  function readLedger(workspaceRoot3, sessionKey) {
40248
40513
  try {
40249
- const parsed = JSON.parse(fs106.readFileSync(ledgerFile(workspaceRoot3, sessionKey), "utf8"));
40514
+ const parsed = JSON.parse(fs107.readFileSync(ledgerFile(workspaceRoot3, sessionKey), "utf8"));
40250
40515
  if (!isObject18(parsed)) return emptyLedger();
40251
40516
  return {
40252
40517
  reads: isObject18(parsed["reads"]) ? parsed["reads"] : {},
@@ -40300,8 +40565,8 @@ function main64() {
40300
40565
  const filePath = extractFilePath3(toolInput);
40301
40566
  if (!filePath) return EXIT_ALLOW;
40302
40567
  const workspaceRoot3 = str11(envelope["workspace_root"]).trim() || process.cwd();
40303
- const absPath = path110.isAbsolute(filePath) ? filePath : path110.resolve(workspaceRoot3, filePath);
40304
- const relPath = path110.relative(workspaceRoot3, absPath);
40568
+ const absPath = path112.isAbsolute(filePath) ? filePath : path112.resolve(workspaceRoot3, filePath);
40569
+ const relPath = path112.relative(workspaceRoot3, absPath);
40305
40570
  if (isExemptPath2(relPath) || isExemptPath2(absPath)) return EXIT_ALLOW;
40306
40571
  const sessionKey = deriveSessionKey4(envelope, payload);
40307
40572
  const ledger = readLedger(workspaceRoot3, sessionKey);
@@ -40317,7 +40582,7 @@ function main64() {
40317
40582
  let mtime;
40318
40583
  let size;
40319
40584
  try {
40320
- const st = fs106.statSync(absPath);
40585
+ const st = fs107.statSync(absPath);
40321
40586
  mtime = st.mtimeMs;
40322
40587
  size = st.size;
40323
40588
  } catch {
@@ -40357,13 +40622,13 @@ function _isCliEntry45() {
40357
40622
  if (process.argv[1] === void 0) {
40358
40623
  return false;
40359
40624
  }
40360
- const argvUrl = pathToFileURL55(path110.resolve(process.argv[1])).href;
40625
+ const argvUrl = pathToFileURL55(path112.resolve(process.argv[1])).href;
40361
40626
  if (import.meta.url === argvUrl) {
40362
40627
  return true;
40363
40628
  }
40364
40629
  try {
40365
- const here = fs106.realpathSync(fileURLToPath65(import.meta.url));
40366
- const argv = fs106.realpathSync(path110.resolve(process.argv[1]));
40630
+ const here = fs107.realpathSync(fileURLToPath66(import.meta.url));
40631
+ const argv = fs107.realpathSync(path112.resolve(process.argv[1]));
40367
40632
  return here === argv;
40368
40633
  } catch {
40369
40634
  return false;
@@ -40374,15 +40639,15 @@ if (_isCliEntry45()) {
40374
40639
  }
40375
40640
 
40376
40641
  // src/scripts/hooks/memory_recall_hook.ts
40377
- import * as crypto12 from "node:crypto";
40378
- import * as fs107 from "node:fs";
40379
- import * as path112 from "node:path";
40380
- import { fileURLToPath as fileURLToPath66, pathToFileURL as pathToFileURL56 } from "node:url";
40642
+ import * as crypto13 from "node:crypto";
40643
+ import * as fs108 from "node:fs";
40644
+ import * as path114 from "node:path";
40645
+ import { fileURLToPath as fileURLToPath67, pathToFileURL as pathToFileURL56 } from "node:url";
40381
40646
 
40382
40647
  // src/scripts/_lib/cc_transcript.ts
40383
- import * as path111 from "node:path";
40648
+ import * as path113 from "node:path";
40384
40649
  import { homedir as homedir11 } from "node:os";
40385
- var DEFAULT_PROJECTS_ROOT = path111.join(homedir11(), ".claude", "projects");
40650
+ var DEFAULT_PROJECTS_ROOT = path113.join(homedir11(), ".claude", "projects");
40386
40651
  function projectStoreSlug(cwd) {
40387
40652
  return cwd.replace(/[^A-Za-z0-9-]/g, "-");
40388
40653
  }
@@ -40400,7 +40665,7 @@ var LATENCY_BENCH_RE = /bench_hook_latency|hook-latency-budget/;
40400
40665
  function nodeModulesIsSymlink(root) {
40401
40666
  if (root === "") return false;
40402
40667
  try {
40403
- return fs107.lstatSync(path112.join(root, "node_modules")).isSymbolicLink();
40668
+ return fs108.lstatSync(path114.join(root, "node_modules")).isSymbolicLink();
40404
40669
  } catch {
40405
40670
  return false;
40406
40671
  }
@@ -40498,14 +40763,14 @@ function resolveMemoryDir(startDir, projectsRoot = DEFAULT_PROJECTS_ROOT, env =
40498
40763
  return { dir: isDirectory(override) ? override : null, tried: [override] };
40499
40764
  }
40500
40765
  const tried = [];
40501
- let cur = path112.resolve(startDir);
40766
+ let cur = path114.resolve(startDir);
40502
40767
  for (let i = 0; i < MAX_ANCESTOR_WALK; i += 1) {
40503
- const candidate = path112.join(projectsRoot, projectStoreSlug(cur), "memory");
40768
+ const candidate = path114.join(projectsRoot, projectStoreSlug(cur), "memory");
40504
40769
  tried.push(candidate);
40505
40770
  if (isDirectory(candidate)) {
40506
40771
  return { dir: candidate, tried };
40507
40772
  }
40508
- const parent = path112.dirname(cur);
40773
+ const parent = path114.dirname(cur);
40509
40774
  if (parent === cur) break;
40510
40775
  cur = parent;
40511
40776
  }
@@ -40513,7 +40778,7 @@ function resolveMemoryDir(startDir, projectsRoot = DEFAULT_PROJECTS_ROOT, env =
40513
40778
  }
40514
40779
  function isDirectory(p) {
40515
40780
  try {
40516
- return fs107.statSync(p).isDirectory();
40781
+ return fs108.statSync(p).isDirectory();
40517
40782
  } catch {
40518
40783
  return false;
40519
40784
  }
@@ -40521,13 +40786,13 @@ function isDirectory(p) {
40521
40786
  function readMemoryDescription(memoryDir, slug) {
40522
40787
  let head;
40523
40788
  try {
40524
- const fd = fs107.openSync(path112.join(memoryDir, `${slug}.md`), "r");
40789
+ const fd = fs108.openSync(path114.join(memoryDir, `${slug}.md`), "r");
40525
40790
  try {
40526
40791
  const buf = Buffer.alloc(4096);
40527
- const n = fs107.readSync(fd, buf, 0, buf.length, 0);
40792
+ const n = fs108.readSync(fd, buf, 0, buf.length, 0);
40528
40793
  head = buf.subarray(0, n).toString("utf8");
40529
40794
  } finally {
40530
- fs107.closeSync(fd);
40795
+ fs108.closeSync(fd);
40531
40796
  }
40532
40797
  } catch {
40533
40798
  return null;
@@ -40556,7 +40821,7 @@ function truncateBytes(text, max) {
40556
40821
  }
40557
40822
  function buildEmission(rule, store, description, cap = CAP_BYTES2) {
40558
40823
  const reason = `memory-recall: ${rule.slug}`;
40559
- const pointer = store.dir === null ? `memory store not resolvable here \u2014 the slug is still the key: grep the store for ${rule.slug}` : `read: ${path112.join(store.dir, `${rule.slug}.md`)}`;
40824
+ const pointer = store.dir === null ? `memory store not resolvable here \u2014 the slug is still the key: grep the store for ${rule.slug}` : `read: ${path114.join(store.dir, `${rule.slug}.md`)}`;
40560
40825
  const head = `memory-recall \u2014 you have a memory for this, written before today: ${rule.slug}. Why now: ${rule.why}. ${pointer}`;
40561
40826
  const budget = cap - Buffer.byteLength(reason, "utf8");
40562
40827
  if (description === null) {
@@ -40570,10 +40835,10 @@ function buildEmission(rule, store, description, cap = CAP_BYTES2) {
40570
40835
  }
40571
40836
  function deriveSessionKey5(envelope, payload) {
40572
40837
  const raw = str12(envelope["session_id"]) || str12(payload["session_id"] ?? payload["sessionId"]);
40573
- return crypto12.createHash("sha256").update(raw || "unknown-session").digest("hex");
40838
+ return crypto13.createHash("sha256").update(raw || "unknown-session").digest("hex");
40574
40839
  }
40575
40840
  function latchFile3(workspaceRoot3, sessionKey) {
40576
- return path112.join(
40841
+ return path114.join(
40577
40842
  workspaceRoot3,
40578
40843
  "agents",
40579
40844
  "runtime",
@@ -40584,7 +40849,7 @@ function latchFile3(workspaceRoot3, sessionKey) {
40584
40849
  }
40585
40850
  function readLatch3(workspaceRoot3, sessionKey) {
40586
40851
  try {
40587
- const parsed = JSON.parse(fs107.readFileSync(latchFile3(workspaceRoot3, sessionKey), "utf8"));
40852
+ const parsed = JSON.parse(fs108.readFileSync(latchFile3(workspaceRoot3, sessionKey), "utf8"));
40588
40853
  return isObject19(parsed) ? parsed : {};
40589
40854
  } catch {
40590
40855
  return {};
@@ -40642,13 +40907,13 @@ function _isCliEntry46() {
40642
40907
  if (process.argv[1] === void 0) {
40643
40908
  return false;
40644
40909
  }
40645
- const argvUrl = pathToFileURL56(path112.resolve(process.argv[1])).href;
40910
+ const argvUrl = pathToFileURL56(path114.resolve(process.argv[1])).href;
40646
40911
  if (import.meta.url === argvUrl) {
40647
40912
  return true;
40648
40913
  }
40649
40914
  try {
40650
- const here = fs107.realpathSync(fileURLToPath66(import.meta.url));
40651
- const argv = fs107.realpathSync(path112.resolve(process.argv[1]));
40915
+ const here = fs108.realpathSync(fileURLToPath67(import.meta.url));
40916
+ const argv = fs108.realpathSync(path114.resolve(process.argv[1]));
40652
40917
  return here === argv;
40653
40918
  } catch {
40654
40919
  return false;
@@ -40659,10 +40924,10 @@ if (_isCliEntry46()) {
40659
40924
  }
40660
40925
 
40661
40926
  // src/scripts/hooks/session_eol_hook.ts
40662
- import * as fs114 from "node:fs";
40663
- import * as path118 from "node:path";
40927
+ import * as fs115 from "node:fs";
40928
+ import * as path120 from "node:path";
40664
40929
  import process16 from "node:process";
40665
- import { fileURLToPath as fileURLToPath67, pathToFileURL as pathToFileURL57 } from "node:url";
40930
+ import { fileURLToPath as fileURLToPath68, pathToFileURL as pathToFileURL57 } from "node:url";
40666
40931
 
40667
40932
  // src/config/recycle-threshold-budget.json
40668
40933
  var recycle_threshold_budget_default = {
@@ -40679,9 +40944,9 @@ var recycle_threshold_budget_default = {
40679
40944
  };
40680
40945
 
40681
40946
  // src/scripts/_lib/session_eol.ts
40682
- import * as crypto13 from "node:crypto";
40683
- import * as fs108 from "node:fs";
40684
- import * as path113 from "node:path";
40947
+ import * as crypto14 from "node:crypto";
40948
+ import * as fs109 from "node:fs";
40949
+ import * as path115 from "node:path";
40685
40950
  var COMPACT_BOUNDARY_SUBTYPE = "compact_boundary";
40686
40951
  function emptyCounters() {
40687
40952
  return {
@@ -40785,13 +41050,13 @@ function scanEolSlice(text, prior) {
40785
41050
  return next;
40786
41051
  }
40787
41052
  function eolStateDir(workspaceRoot3) {
40788
- return path113.join(workspaceRoot3, "agents", "runtime", "state", "session-eol");
41053
+ return path115.join(workspaceRoot3, "agents", "runtime", "state", "session-eol");
40789
41054
  }
40790
41055
  function eolStateFile(workspaceRoot3, sessionKey) {
40791
- return path113.join(eolStateDir(workspaceRoot3), `${sessionKey}.json`);
41056
+ return path115.join(eolStateDir(workspaceRoot3), `${sessionKey}.json`);
40792
41057
  }
40793
41058
  function eolSessionKey(raw) {
40794
- return crypto13.createHash("sha256").update(raw || "unknown-session").digest("hex");
41059
+ return crypto14.createHash("sha256").update(raw || "unknown-session").digest("hex");
40795
41060
  }
40796
41061
  var SUBSTANTIVE_TOKEN_FLOOR = 1e4;
40797
41062
  function is_substantive(counters) {
@@ -40805,7 +41070,7 @@ function is_substantive(counters) {
40805
41070
  }
40806
41071
  function readNewCompleteLines(filePath, fromByte) {
40807
41072
  try {
40808
- const { size } = fs108.statSync(filePath);
41073
+ const { size } = fs109.statSync(filePath);
40809
41074
  if (size < fromByte) {
40810
41075
  return { text: "", nextOffset: 0, truncated: true };
40811
41076
  }
@@ -40814,11 +41079,11 @@ function readNewCompleteLines(filePath, fromByte) {
40814
41079
  }
40815
41080
  const length = size - fromByte;
40816
41081
  const buffer = Buffer.alloc(length);
40817
- const fd = fs108.openSync(filePath, "r");
41082
+ const fd = fs109.openSync(filePath, "r");
40818
41083
  try {
40819
- fs108.readSync(fd, buffer, 0, length, fromByte);
41084
+ fs109.readSync(fd, buffer, 0, length, fromByte);
40820
41085
  } finally {
40821
- fs108.closeSync(fd);
41086
+ fs109.closeSync(fd);
40822
41087
  }
40823
41088
  const lastNewline = buffer.lastIndexOf(10);
40824
41089
  if (lastNewline === -1) {
@@ -40835,23 +41100,23 @@ function readNewCompleteLines(filePath, fromByte) {
40835
41100
  }
40836
41101
 
40837
41102
  // src/scripts/_lib/context_observation.ts
40838
- import * as fs110 from "node:fs";
40839
- import * as path115 from "node:path";
41103
+ import * as fs111 from "node:fs";
41104
+ import * as path117 from "node:path";
40840
41105
 
40841
41106
  // src/scripts/_lib/loop_guards.ts
40842
- import * as fs109 from "node:fs";
40843
- import * as path114 from "node:path";
41107
+ import * as fs110 from "node:fs";
41108
+ import * as path116 from "node:path";
40844
41109
  function atomicWriteJson(file, value) {
40845
41110
  const tmp = `${file}.${String(process.pid)}.tmp`;
40846
41111
  try {
40847
- fs109.mkdirSync(path114.dirname(file), { recursive: true });
40848
- fs109.writeFileSync(tmp, `${JSON.stringify(value)}
41112
+ fs110.mkdirSync(path116.dirname(file), { recursive: true });
41113
+ fs110.writeFileSync(tmp, `${JSON.stringify(value)}
40849
41114
  `, "utf8");
40850
- fs109.renameSync(tmp, file);
41115
+ fs110.renameSync(tmp, file);
40851
41116
  return true;
40852
41117
  } catch {
40853
41118
  try {
40854
- fs109.unlinkSync(tmp);
41119
+ fs110.unlinkSync(tmp);
40855
41120
  } catch {
40856
41121
  }
40857
41122
  return false;
@@ -40897,7 +41162,7 @@ function stallSignal(history, window = 3) {
40897
41162
  }
40898
41163
  function readUnavailableDependency(transcriptPath) {
40899
41164
  try {
40900
- const raw = fs109.readFileSync(transcriptPath, "utf8");
41165
+ const raw = fs110.readFileSync(transcriptPath, "utf8");
40901
41166
  return detectUnavailableDependency(raw.slice(-DEPENDENCY_SCAN_BYTES));
40902
41167
  } catch {
40903
41168
  return null;
@@ -40905,18 +41170,18 @@ function readUnavailableDependency(transcriptPath) {
40905
41170
  }
40906
41171
 
40907
41172
  // src/scripts/_lib/context_observation.ts
40908
- var CONTEXT_OBSERVATION_REL = path115.join(
41173
+ var CONTEXT_OBSERVATION_REL = path117.join(
40909
41174
  "agents",
40910
41175
  "runtime",
40911
41176
  "state",
40912
41177
  "context-observation.json"
40913
41178
  );
40914
41179
  function observationFile(repoRoot) {
40915
- return path115.join(repoRoot, CONTEXT_OBSERVATION_REL);
41180
+ return path117.join(repoRoot, CONTEXT_OBSERVATION_REL);
40916
41181
  }
40917
41182
  function readContextObservation(repoRoot) {
40918
41183
  try {
40919
- const parsed = JSON.parse(fs110.readFileSync(observationFile(repoRoot), "utf-8"));
41184
+ const parsed = JSON.parse(fs111.readFileSync(observationFile(repoRoot), "utf-8"));
40920
41185
  if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return null;
40921
41186
  const o = parsed;
40922
41187
  if (typeof o["fingerprint"] !== "string" || o["fingerprint"] === "") return null;
@@ -40938,8 +41203,8 @@ function premiseMoved(claimed, observed) {
40938
41203
  }
40939
41204
 
40940
41205
  // src/scripts/_lib/run_checkpoint.ts
40941
- import * as fs111 from "node:fs";
40942
- import * as path116 from "node:path";
41206
+ import * as fs112 from "node:fs";
41207
+ import * as path118 from "node:path";
40943
41208
 
40944
41209
  // src/scripts/_lib/roadmap_checkboxes.ts
40945
41210
  var CHECKBOX_LINE = /^[ \t]*[-*][ \t]+\[([ xX~-])\][ \t]+(.*)$/;
@@ -40969,7 +41234,7 @@ function phaseLines(text) {
40969
41234
  }
40970
41235
 
40971
41236
  // src/scripts/_lib/run_checkpoint.ts
40972
- var CHECKPOINT_DIR_REL = path116.join("agents", "runtime", "state", "checkpoints");
41237
+ var CHECKPOINT_DIR_REL = path118.join("agents", "runtime", "state", "checkpoints");
40973
41238
  function countRoadmap(text) {
40974
41239
  const counts = { open: 0, done: 0, parked: 0, next: null };
40975
41240
  for (const raw of phaseLines(text)) {
@@ -40990,34 +41255,34 @@ function countRoadmap(text) {
40990
41255
  return counts;
40991
41256
  }
40992
41257
  function checkpointFile(repoRoot, runId) {
40993
- return path116.join(repoRoot, CHECKPOINT_DIR_REL, `${runId.replace(/[^A-Za-z0-9_-]/g, "_")}.json`);
41258
+ return path118.join(repoRoot, CHECKPOINT_DIR_REL, `${runId.replace(/[^A-Za-z0-9_-]/g, "_")}.json`);
40994
41259
  }
40995
41260
  function roadmapPath(repoRoot, slug) {
40996
- return path116.join(repoRoot, "agents", "roadmaps", `${slug}.md`);
41261
+ return path118.join(repoRoot, "agents", "roadmaps", `${slug}.md`);
40997
41262
  }
40998
41263
  function readHead(repoRoot) {
40999
41264
  try {
41000
- let gitDir = path116.join(repoRoot, ".git");
41001
- if (fs111.statSync(gitDir).isFile()) {
41002
- const m = /^gitdir:\s*(.+)$/m.exec(fs111.readFileSync(gitDir, "utf-8").trim());
41265
+ let gitDir = path118.join(repoRoot, ".git");
41266
+ if (fs112.statSync(gitDir).isFile()) {
41267
+ const m = /^gitdir:\s*(.+)$/m.exec(fs112.readFileSync(gitDir, "utf-8").trim());
41003
41268
  if (m === null) return null;
41004
- gitDir = path116.resolve(repoRoot, m[1]);
41269
+ gitDir = path118.resolve(repoRoot, m[1]);
41005
41270
  }
41006
41271
  let refRoot = gitDir;
41007
41272
  try {
41008
- const common = fs111.readFileSync(path116.join(gitDir, "commondir"), "utf-8").trim();
41009
- if (common !== "") refRoot = path116.resolve(gitDir, common);
41273
+ const common = fs112.readFileSync(path118.join(gitDir, "commondir"), "utf-8").trim();
41274
+ if (common !== "") refRoot = path118.resolve(gitDir, common);
41010
41275
  } catch {
41011
41276
  }
41012
- const head = fs111.readFileSync(path116.join(gitDir, "HEAD"), "utf-8").trim();
41277
+ const head = fs112.readFileSync(path118.join(gitDir, "HEAD"), "utf-8").trim();
41013
41278
  if (/^[0-9a-f]{40}$/.test(head)) return head;
41014
41279
  const ref = /^ref:\s*(.+)$/.exec(head);
41015
41280
  if (ref === null) return null;
41016
41281
  const refName = ref[1];
41017
41282
  try {
41018
- return fs111.readFileSync(path116.join(refRoot, refName), "utf-8").trim() || null;
41283
+ return fs112.readFileSync(path118.join(refRoot, refName), "utf-8").trim() || null;
41019
41284
  } catch {
41020
- const packed = fs111.readFileSync(path116.join(refRoot, "packed-refs"), "utf-8");
41285
+ const packed = fs112.readFileSync(path118.join(refRoot, "packed-refs"), "utf-8");
41021
41286
  for (const line of packed.split("\n")) {
41022
41287
  const pm = /^([0-9a-f]{40})\s+(.+)$/.exec(line.trim());
41023
41288
  if (pm !== null && pm[2] === refName) return pm[1];
@@ -41031,7 +41296,7 @@ function readHead(repoRoot) {
41031
41296
  function buildCheckpoint(repoRoot, runId, slug, opts = {}) {
41032
41297
  let text;
41033
41298
  try {
41034
- text = fs111.readFileSync(roadmapPath(repoRoot, slug), "utf-8");
41299
+ text = fs112.readFileSync(roadmapPath(repoRoot, slug), "utf-8");
41035
41300
  } catch {
41036
41301
  return null;
41037
41302
  }
@@ -41055,8 +41320,8 @@ function buildCheckpoint(repoRoot, runId, slug, opts = {}) {
41055
41320
  function writeCheckpoint(repoRoot, cp) {
41056
41321
  const file = checkpointFile(repoRoot, cp.run_id);
41057
41322
  try {
41058
- fs111.mkdirSync(path116.dirname(file), { recursive: true });
41059
- fs111.writeFileSync(file, `${JSON.stringify(cp, null, 2)}
41323
+ fs112.mkdirSync(path118.dirname(file), { recursive: true });
41324
+ fs112.writeFileSync(file, `${JSON.stringify(cp, null, 2)}
41060
41325
  `, "utf-8");
41061
41326
  return file;
41062
41327
  } catch {
@@ -41065,7 +41330,7 @@ function writeCheckpoint(repoRoot, cp) {
41065
41330
  }
41066
41331
 
41067
41332
  // src/scripts/_lib/continuity_writer.ts
41068
- import * as fs112 from "node:fs";
41333
+ import * as fs113 from "node:fs";
41069
41334
  var AUTO_RECORD_KEY = "continuity.auto_record";
41070
41335
  function auto_record_enabled(root) {
41071
41336
  try {
@@ -41163,7 +41428,7 @@ function buildContinuityRecord(input) {
41163
41428
  }
41164
41429
  let text;
41165
41430
  try {
41166
- text = fs112.readFileSync(roadmapPath(root, slug), "utf-8");
41431
+ text = fs113.readFileSync(roadmapPath(root, slug), "utf-8");
41167
41432
  } catch {
41168
41433
  return { record: null, reason: `no record \u2014 the claimed roadmap ${slug} is not readable` };
41169
41434
  }
@@ -41202,12 +41467,12 @@ function buildContinuityRecord(input) {
41202
41467
  }
41203
41468
 
41204
41469
  // src/scripts/_lib/continuity_slot.ts
41205
- import * as fs113 from "node:fs";
41206
- import * as path117 from "node:path";
41470
+ import * as fs114 from "node:fs";
41471
+ import * as path119 from "node:path";
41207
41472
  var MAX_AGE_MS = RECYCLE_MAX_AGE_HOURS * 3600 * 1e3;
41208
41473
  function _parse2(file) {
41209
41474
  try {
41210
- const decoded = JSON.parse(fs113.readFileSync(file, "utf-8"));
41475
+ const decoded = JSON.parse(fs114.readFileSync(file, "utf-8"));
41211
41476
  if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
41212
41477
  return decoded;
41213
41478
  }
@@ -41224,14 +41489,14 @@ function _ageMs(record2, now2) {
41224
41489
  return now2.getTime() - at;
41225
41490
  }
41226
41491
  function inspectSlot(workspace_root, session_id, now2 = /* @__PURE__ */ new Date()) {
41227
- const target = path117.join(workspace_root, recycle_envelope_rel(session_id));
41228
- if (!fs113.existsSync(target)) {
41229
- const consumed = path117.join(workspace_root, recycle_consumed_rel(session_id));
41230
- if (fs113.existsSync(consumed)) {
41492
+ const target = path119.join(workspace_root, recycle_envelope_rel(session_id));
41493
+ if (!fs114.existsSync(target)) {
41494
+ const consumed = path119.join(workspace_root, recycle_consumed_rel(session_id));
41495
+ if (fs114.existsSync(consumed)) {
41231
41496
  return { state: "consumed", reason: "the record for this session was consumed", target };
41232
41497
  }
41233
- const quarantined = path117.join(workspace_root, recycle_quarantine_rel(session_id));
41234
- if (fs113.existsSync(quarantined)) {
41498
+ const quarantined = path119.join(workspace_root, recycle_quarantine_rel(session_id));
41499
+ if (fs114.existsSync(quarantined)) {
41235
41500
  return {
41236
41501
  state: "quarantined",
41237
41502
  reason: "the slot is free; an unusable record sits in quarantine",
@@ -41291,7 +41556,7 @@ function publishContinuityRecord(workspace_root, session_id, record2, now2 = /*
41291
41556
  reason: `refused \u2014 ${bytes} bytes exceeds the ${RECYCLE_ENVELOPE_MAX_BYTES} byte slot cap`
41292
41557
  };
41293
41558
  }
41294
- const target = path117.join(workspace_root, recycle_envelope_rel(session_id));
41559
+ const target = path119.join(workspace_root, recycle_envelope_rel(session_id));
41295
41560
  const before = inspectSlot(workspace_root, session_id, now2);
41296
41561
  if (before.state === "conflicting") {
41297
41562
  return { state: "conflicting", wrote: false, reason: `refused \u2014 ${before.reason}` };
@@ -41308,11 +41573,11 @@ function publishContinuityRecord(workspace_root, session_id, record2, now2 = /*
41308
41573
  }
41309
41574
  }
41310
41575
  let quarantined;
41311
- if (before.state === "quarantined" && fs113.existsSync(target)) {
41312
- const dest = path117.join(workspace_root, recycle_quarantine_rel(session_id));
41576
+ if (before.state === "quarantined" && fs114.existsSync(target)) {
41577
+ const dest = path119.join(workspace_root, recycle_quarantine_rel(session_id));
41313
41578
  try {
41314
- fs113.mkdirSync(path117.dirname(dest), { recursive: true });
41315
- fs113.renameSync(target, dest);
41579
+ fs114.mkdirSync(path119.dirname(dest), { recursive: true });
41580
+ fs114.renameSync(target, dest);
41316
41581
  quarantined = dest;
41317
41582
  } catch (exc) {
41318
41583
  return {
@@ -41341,7 +41606,7 @@ function publishContinuityRecord(workspace_root, session_id, record2, now2 = /*
41341
41606
 
41342
41607
  // src/scripts/hooks/session_eol_hook.ts
41343
41608
  var THRESHOLD_OVERRIDE_ENV = "AGENT_RECYCLE_THRESHOLD_TOKENS";
41344
- var CONTEXT_FILL_REL = path118.join("agents", "runtime", "state", "context-fill.json");
41609
+ var CONTEXT_FILL_REL = path120.join("agents", "runtime", "state", "context-fill.json");
41345
41610
  function str13(value) {
41346
41611
  return typeof value === "string" ? value : "";
41347
41612
  }
@@ -41356,7 +41621,7 @@ function payloadSessionId(payload, envelope) {
41356
41621
  }
41357
41622
  function readState5(file) {
41358
41623
  try {
41359
- const parsed = JSON.parse(fs114.readFileSync(file, "utf-8"));
41624
+ const parsed = JSON.parse(fs115.readFileSync(file, "utf-8"));
41360
41625
  if (parsed && typeof parsed === "object" && parsed.schema_version === 1 && parsed.counters && typeof parsed.counters.scanned_bytes === "number") {
41361
41626
  return {
41362
41627
  schema_version: 1,
@@ -41387,7 +41652,7 @@ function readThresholdTokens() {
41387
41652
  }
41388
41653
  function writeContextFill(workspaceRoot3, tokens, threshold, ts) {
41389
41654
  try {
41390
- atomic_write_json(path118.join(workspaceRoot3, CONTEXT_FILL_REL), {
41655
+ atomic_write_json(path120.join(workspaceRoot3, CONTEXT_FILL_REL), {
41391
41656
  schema_version: 1,
41392
41657
  final_context_tokens: tokens,
41393
41658
  recycle_threshold_tokens: threshold,
@@ -41487,13 +41752,13 @@ function _isCliEntry47() {
41487
41752
  if (process16.argv[1] === void 0) {
41488
41753
  return false;
41489
41754
  }
41490
- const argvUrl = pathToFileURL57(path118.resolve(process16.argv[1])).href;
41755
+ const argvUrl = pathToFileURL57(path120.resolve(process16.argv[1])).href;
41491
41756
  if (import.meta.url === argvUrl) {
41492
41757
  return true;
41493
41758
  }
41494
41759
  try {
41495
- const here = fs114.realpathSync(fileURLToPath67(import.meta.url));
41496
- const argv = fs114.realpathSync(path118.resolve(process16.argv[1]));
41760
+ const here = fs115.realpathSync(fileURLToPath68(import.meta.url));
41761
+ const argv = fs115.realpathSync(path120.resolve(process16.argv[1]));
41497
41762
  return here === argv;
41498
41763
  } catch {
41499
41764
  return false;
@@ -41504,13 +41769,13 @@ if (_isCliEntry47()) {
41504
41769
  }
41505
41770
 
41506
41771
  // src/scripts/hooks/tool_result_bytes_hook.ts
41507
- import * as fs115 from "node:fs";
41508
- import * as path119 from "node:path";
41509
- import { fileURLToPath as fileURLToPath68, pathToFileURL as pathToFileURL58 } from "node:url";
41772
+ import * as fs116 from "node:fs";
41773
+ import * as path121 from "node:path";
41774
+ import { fileURLToPath as fileURLToPath69, pathToFileURL as pathToFileURL58 } from "node:url";
41510
41775
  function isObject20(v) {
41511
41776
  return typeof v === "object" && v !== null && !Array.isArray(v);
41512
41777
  }
41513
- var CENSUS_FILE = path119.join("agents", "runtime", "state", "tool-result-census.jsonl");
41778
+ var CENSUS_FILE = path121.join("agents", "runtime", "state", "tool-result-census.jsonl");
41514
41779
  var RESULT_KEYS = ["tool_response", "toolResponse", "tool_result", "toolUseResult"];
41515
41780
  function _resultBytes(payload) {
41516
41781
  for (const key of RESULT_KEYS) {
@@ -41545,7 +41810,7 @@ function unwrapPayload4(envelope) {
41545
41810
  return isObject20(inner) ? inner : envelope;
41546
41811
  }
41547
41812
  function censusFile(consumerRoot) {
41548
- return path119.join(consumerRoot, CENSUS_FILE);
41813
+ return path121.join(consumerRoot, CENSUS_FILE);
41549
41814
  }
41550
41815
  var MAINTAINER_PACKAGE_NAME = "@event4u/agent-config";
41551
41816
  var CENSUS_OPT_IN_ENV = "AGENT_CONFIG_TOOL_BYTE_CENSUS";
@@ -41556,7 +41821,7 @@ function resolvesMaintainerWorkspace(consumerRoot) {
41556
41821
  if (cached !== void 0) return cached;
41557
41822
  let verdict2 = false;
41558
41823
  try {
41559
- const raw = fs115.readFileSync(path119.join(consumerRoot, "package.json"), "utf8");
41824
+ const raw = fs116.readFileSync(path121.join(consumerRoot, "package.json"), "utf8");
41560
41825
  const parsed = JSON.parse(raw);
41561
41826
  verdict2 = isObject20(parsed) && parsed["name"] === MAINTAINER_PACKAGE_NAME;
41562
41827
  } catch {
@@ -41569,8 +41834,8 @@ function _appendCensusLine(consumerRoot, line) {
41569
41834
  if (is_replay_mode()) return;
41570
41835
  if (!resolvesMaintainerWorkspace(consumerRoot)) return;
41571
41836
  const file = censusFile(consumerRoot);
41572
- fs115.mkdirSync(path119.dirname(file), { recursive: true });
41573
- fs115.appendFileSync(file, `${JSON.stringify(line)}
41837
+ fs116.mkdirSync(path121.dirname(file), { recursive: true });
41838
+ fs116.appendFileSync(file, `${JSON.stringify(line)}
41574
41839
  `, "utf8");
41575
41840
  }
41576
41841
  function processEnvelope4(envelope, consumerRoot) {
@@ -41621,10 +41886,10 @@ function _isCliEntry48() {
41621
41886
  return false;
41622
41887
  }
41623
41888
  if (process.argv[1] === void 0) return false;
41624
- const argvUrl = pathToFileURL58(path119.resolve(process.argv[1])).href;
41889
+ const argvUrl = pathToFileURL58(path121.resolve(process.argv[1])).href;
41625
41890
  if (import.meta.url === argvUrl) return true;
41626
41891
  try {
41627
- return fs115.realpathSync(fileURLToPath68(import.meta.url)) === fs115.realpathSync(path119.resolve(process.argv[1]));
41892
+ return fs116.realpathSync(fileURLToPath69(import.meta.url)) === fs116.realpathSync(path121.resolve(process.argv[1]));
41628
41893
  } catch {
41629
41894
  return false;
41630
41895
  }
@@ -41632,9 +41897,9 @@ function _isCliEntry48() {
41632
41897
  if (_isCliEntry48()) process.exit(main67());
41633
41898
 
41634
41899
  // src/scripts/hooks/spawn_guard_shadow_hook.ts
41635
- import * as fs116 from "node:fs";
41636
- import * as path120 from "node:path";
41637
- import { fileURLToPath as fileURLToPath69, pathToFileURL as pathToFileURL59 } from "node:url";
41900
+ import * as fs117 from "node:fs";
41901
+ import * as path122 from "node:path";
41902
+ import { fileURLToPath as fileURLToPath70, pathToFileURL as pathToFileURL59 } from "node:url";
41638
41903
  function isObject21(v) {
41639
41904
  return typeof v === "object" && v !== null && !Array.isArray(v);
41640
41905
  }
@@ -41710,10 +41975,10 @@ function main68() {
41710
41975
  function _isCliEntry49() {
41711
41976
  if (true) return false;
41712
41977
  if (process.argv[1] === void 0) return false;
41713
- const argvUrl = pathToFileURL59(path120.resolve(process.argv[1])).href;
41978
+ const argvUrl = pathToFileURL59(path122.resolve(process.argv[1])).href;
41714
41979
  if (import.meta.url === argvUrl) return true;
41715
41980
  try {
41716
- return fs116.realpathSync(fileURLToPath69(import.meta.url)) === fs116.realpathSync(path120.resolve(process.argv[1]));
41981
+ return fs117.realpathSync(fileURLToPath70(import.meta.url)) === fs117.realpathSync(path122.resolve(process.argv[1]));
41717
41982
  } catch {
41718
41983
  return false;
41719
41984
  }
@@ -41721,12 +41986,12 @@ function _isCliEntry49() {
41721
41986
  if (_isCliEntry49()) process.exit(main68());
41722
41987
 
41723
41988
  // src/scripts/hooks/source_first_gate_hook.ts
41724
- import * as fs117 from "node:fs";
41725
- import * as path121 from "node:path";
41726
- import { fileURLToPath as fileURLToPath70, pathToFileURL as pathToFileURL60 } from "node:url";
41989
+ import * as fs118 from "node:fs";
41990
+ import * as path123 from "node:path";
41991
+ import { fileURLToPath as fileURLToPath71, pathToFileURL as pathToFileURL60 } from "node:url";
41727
41992
  var MAX_SHADOW_WARNS = 2;
41728
- var SHADOW_LOG = path121.join("agents", "runtime", "state", "source-first-gate.jsonl");
41729
- var STATE_FILE9 = path121.join("agents", "runtime", "state", "source-first-gate.json");
41993
+ var SHADOW_LOG = path123.join("agents", "runtime", "state", "source-first-gate.jsonl");
41994
+ var STATE_FILE9 = path123.join("agents", "runtime", "state", "source-first-gate.json");
41730
41995
  function isObject22(v) {
41731
41996
  return typeof v === "object" && v !== null && !Array.isArray(v);
41732
41997
  }
@@ -41800,7 +42065,7 @@ var EMPTY_STATE = { handoverSeen: false, sourceRead: false, wouldWarn: 0 };
41800
42065
  var MAX_SESSIONS2 = 50;
41801
42066
  function readState6(root, session) {
41802
42067
  try {
41803
- const all = JSON.parse(fs117.readFileSync(path121.join(root, STATE_FILE9), "utf-8"));
42068
+ const all = JSON.parse(fs118.readFileSync(path123.join(root, STATE_FILE9), "utf-8"));
41804
42069
  const entry = all[session];
41805
42070
  if (entry && typeof entry.handoverSeen === "boolean" && typeof entry.sourceRead === "boolean" && typeof entry.wouldWarn === "number") {
41806
42071
  return entry;
@@ -41812,10 +42077,10 @@ function readState6(root, session) {
41812
42077
  function writeState5(root, session, state) {
41813
42078
  if (is_replay_mode()) return;
41814
42079
  try {
41815
- const file = path121.join(root, STATE_FILE9);
42080
+ const file = path123.join(root, STATE_FILE9);
41816
42081
  let all = {};
41817
42082
  try {
41818
- all = JSON.parse(fs117.readFileSync(file, "utf-8"));
42083
+ all = JSON.parse(fs118.readFileSync(file, "utf-8"));
41819
42084
  } catch {
41820
42085
  }
41821
42086
  if (!isObject22(all)) all = {};
@@ -41826,8 +42091,8 @@ function writeState5(root, session, state) {
41826
42091
  for (const key of keys.slice(keys.length - MAX_SESSIONS2)) pruned[key] = all[key];
41827
42092
  all = pruned;
41828
42093
  }
41829
- fs117.mkdirSync(path121.dirname(file), { recursive: true });
41830
- fs117.writeFileSync(file, JSON.stringify(all));
42094
+ fs118.mkdirSync(path123.dirname(file), { recursive: true });
42095
+ fs118.writeFileSync(file, JSON.stringify(all));
41831
42096
  } catch {
41832
42097
  }
41833
42098
  }
@@ -41848,7 +42113,7 @@ function evaluateCandidates2(handoverSeen, handoverOnDisk, sourceRead) {
41848
42113
  }
41849
42114
  function handoverPresentOnDisk(root) {
41850
42115
  try {
41851
- return fs117.statSync(path121.join(root, ".claude", "design-system")).isDirectory();
42116
+ return fs118.statSync(path123.join(root, ".claude", "design-system")).isDirectory();
41852
42117
  } catch {
41853
42118
  return false;
41854
42119
  }
@@ -41856,9 +42121,9 @@ function handoverPresentOnDisk(root) {
41856
42121
  function appendShadowLine(root, line) {
41857
42122
  if (is_replay_mode()) return;
41858
42123
  try {
41859
- const file = path121.join(root, SHADOW_LOG);
41860
- fs117.mkdirSync(path121.dirname(file), { recursive: true });
41861
- fs117.appendFileSync(file, `${JSON.stringify(line)}
42124
+ const file = path123.join(root, SHADOW_LOG);
42125
+ fs118.mkdirSync(path123.dirname(file), { recursive: true });
42126
+ fs118.appendFileSync(file, `${JSON.stringify(line)}
41862
42127
  `, "utf8");
41863
42128
  } catch {
41864
42129
  }
@@ -41934,10 +42199,10 @@ function main69() {
41934
42199
  function _isCliEntry50() {
41935
42200
  if (true) return false;
41936
42201
  if (process.argv[1] === void 0) return false;
41937
- const argvUrl = pathToFileURL60(path121.resolve(process.argv[1])).href;
42202
+ const argvUrl = pathToFileURL60(path123.resolve(process.argv[1])).href;
41938
42203
  if (import.meta.url === argvUrl) return true;
41939
42204
  try {
41940
- return fs117.realpathSync(fileURLToPath70(import.meta.url)) === fs117.realpathSync(path121.resolve(process.argv[1]));
42205
+ return fs118.realpathSync(fileURLToPath71(import.meta.url)) === fs118.realpathSync(path123.resolve(process.argv[1]));
41941
42206
  } catch {
41942
42207
  return false;
41943
42208
  }
@@ -41945,11 +42210,11 @@ function _isCliEntry50() {
41945
42210
  if (_isCliEntry50()) process.exit(main69());
41946
42211
 
41947
42212
  // src/scripts/hooks/interruption_ledger_hook.ts
41948
- import * as fs118 from "node:fs";
41949
- import * as path122 from "node:path";
41950
- import { fileURLToPath as fileURLToPath71, pathToFileURL as pathToFileURL61 } from "node:url";
42213
+ import * as fs119 from "node:fs";
42214
+ import * as path124 from "node:path";
42215
+ import { fileURLToPath as fileURLToPath72, pathToFileURL as pathToFileURL61 } from "node:url";
41951
42216
  var TRANSCRIPT_READ_MAX_BYTES2 = 2 * 1024 * 1024;
41952
- var LEDGER_RELPATH = path122.join("agents", "runtime", "state", "interruptions.jsonl");
42217
+ var LEDGER_RELPATH = path124.join("agents", "runtime", "state", "interruptions.jsonl");
41953
42218
  function hasNumberedOptions(reply) {
41954
42219
  let count = 0;
41955
42220
  for (const line of reply.split("\n")) {
@@ -41973,14 +42238,14 @@ function classifyReply(reply) {
41973
42238
  function readClaimedRoadmap(workspaceRoot3, sessionId3) {
41974
42239
  if (!sessionId3) return null;
41975
42240
  try {
41976
- const file = path122.join(
42241
+ const file = path124.join(
41977
42242
  workspaceRoot3,
41978
42243
  "agents",
41979
42244
  "runtime",
41980
42245
  "state",
41981
42246
  `roadmap-claim-${sessionId3}.json`
41982
42247
  );
41983
- const parsed = JSON.parse(fs118.readFileSync(file, "utf8"));
42248
+ const parsed = JSON.parse(fs119.readFileSync(file, "utf8"));
41984
42249
  if (parsed === null || typeof parsed !== "object") return null;
41985
42250
  const slug = parsed["slug"];
41986
42251
  return typeof slug === "string" && slug.length > 0 ? slug : null;
@@ -41991,7 +42256,7 @@ function readClaimedRoadmap(workspaceRoot3, sessionId3) {
41991
42256
  function alreadyRecorded(ledgerPath, runId, turn) {
41992
42257
  let raw;
41993
42258
  try {
41994
- raw = fs118.readFileSync(ledgerPath, "utf8");
42259
+ raw = fs119.readFileSync(ledgerPath, "utf8");
41995
42260
  } catch {
41996
42261
  return false;
41997
42262
  }
@@ -42035,7 +42300,7 @@ function main70() {
42035
42300
  if (!lastAssistant) return EXIT_ALLOW;
42036
42301
  const sessionId3 = str15(payload["session_id"]) || str15(envelope["session_id"]);
42037
42302
  const runId = sessionId3 ? derive_session_tag(sessionId3) : "unknown";
42038
- const ledgerPath = path122.join(workspaceRoot3, LEDGER_RELPATH);
42303
+ const ledgerPath = path124.join(workspaceRoot3, LEDGER_RELPATH);
42039
42304
  if (alreadyRecorded(ledgerPath, runId, turnOrdinal)) return EXIT_ALLOW;
42040
42305
  const verdict2 = classifyReply(lastAssistant);
42041
42306
  const record2 = {
@@ -42047,8 +42312,8 @@ function main70() {
42047
42312
  at: (/* @__PURE__ */ new Date()).toISOString()
42048
42313
  };
42049
42314
  try {
42050
- fs118.mkdirSync(path122.dirname(ledgerPath), { recursive: true });
42051
- fs118.appendFileSync(ledgerPath, `${JSON.stringify(record2)}
42315
+ fs119.mkdirSync(path124.dirname(ledgerPath), { recursive: true });
42316
+ fs119.appendFileSync(ledgerPath, `${JSON.stringify(record2)}
42052
42317
  `, "utf8");
42053
42318
  } catch {
42054
42319
  }
@@ -42058,13 +42323,13 @@ function _isCliEntry51() {
42058
42323
  if (process.argv[1] === void 0) {
42059
42324
  return false;
42060
42325
  }
42061
- const argvUrl = pathToFileURL61(path122.resolve(process.argv[1])).href;
42326
+ const argvUrl = pathToFileURL61(path124.resolve(process.argv[1])).href;
42062
42327
  if (import.meta.url === argvUrl) {
42063
42328
  return true;
42064
42329
  }
42065
42330
  try {
42066
- const here = fs118.realpathSync(fileURLToPath71(import.meta.url));
42067
- const argv = fs118.realpathSync(path122.resolve(process.argv[1]));
42331
+ const here = fs119.realpathSync(fileURLToPath72(import.meta.url));
42332
+ const argv = fs119.realpathSync(path124.resolve(process.argv[1]));
42068
42333
  return here === argv;
42069
42334
  } catch {
42070
42335
  return false;
@@ -42075,15 +42340,15 @@ if (_isCliEntry51()) {
42075
42340
  }
42076
42341
 
42077
42342
  // src/scripts/hooks/run_continuation_hook.ts
42078
- import * as fs120 from "node:fs";
42343
+ import * as fs121 from "node:fs";
42079
42344
 
42080
42345
  // src/scripts/_lib/billing_grant.ts
42081
- import * as fs119 from "node:fs";
42082
- import * as path123 from "node:path";
42083
- var BILLING_GRANT_DIR_REL = path123.join("agents", "runtime", "billing-grants");
42346
+ import * as fs120 from "node:fs";
42347
+ import * as path125 from "node:path";
42348
+ var BILLING_GRANT_DIR_REL = path125.join("agents", "runtime", "billing-grants");
42084
42349
  var BILLING_GRANT_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
42085
42350
  function grantFile(repoRoot, runId) {
42086
- return path123.join(
42351
+ return path125.join(
42087
42352
  repoRoot,
42088
42353
  BILLING_GRANT_DIR_REL,
42089
42354
  `${runId.replace(/[^A-Za-z0-9_-]/g, "_")}.json`
@@ -42091,14 +42356,14 @@ function grantFile(repoRoot, runId) {
42091
42356
  }
42092
42357
  function revokeBillingGrant(repoRoot, runId) {
42093
42358
  try {
42094
- fs119.unlinkSync(grantFile(repoRoot, runId));
42359
+ fs120.unlinkSync(grantFile(repoRoot, runId));
42095
42360
  } catch {
42096
42361
  }
42097
42362
  }
42098
42363
 
42099
42364
  // src/scripts/hooks/run_continuation_hook.ts
42100
- import * as path124 from "node:path";
42101
- import { fileURLToPath as fileURLToPath72, pathToFileURL as pathToFileURL62 } from "node:url";
42365
+ import * as path126 from "node:path";
42366
+ import { fileURLToPath as fileURLToPath73, pathToFileURL as pathToFileURL62 } from "node:url";
42102
42367
 
42103
42368
  // src/scripts/_lib/verify_clause.ts
42104
42369
  var VERIFY_ARROW_SOURCE = "(?:->|\u2192)[ \\t]*(\\d+|\\/.+\\/)[ \\t]*$";
@@ -42116,7 +42381,7 @@ function lastMatch(re, text) {
42116
42381
  }
42117
42382
  return found;
42118
42383
  }
42119
- var BACKTICKED_RE = /(?:`verify:`|verify:(?!`))\s*`([^`]+)`[ \t]*((?:->|→)[ \t]*\S+)?/g;
42384
+ var BACKTICKED_RE = /(?:`verify:`|verify:(?!`))\s*`([^`]+)`[ \t]*((?:->|→)[ \t]*(?:\/(?:[^\\/]|\\.)*\/(?=\s|$)|\S+))?/g;
42120
42385
  var PROSE_RE = /(?:`verify:`|verify:(?!`))[ \t]*/g;
42121
42386
  function proseBody(rest) {
42122
42387
  const end = rest.search(/\n[ \t]*(?:\r?\n|$)/);
@@ -42309,13 +42574,13 @@ function parseHaltStamp(v) {
42309
42574
  // src/scripts/hooks/run_continuation_hook.ts
42310
42575
  var BLOCKED_BY_MARKER = /<!--\s*blocked-by:\s*\S[^>]*-->/;
42311
42576
  var LEDGER_TAIL_MAX_BYTES = 512 * 1024;
42312
- var EVENTS_RELPATH = path124.join(
42577
+ var EVENTS_RELPATH = path126.join(
42313
42578
  "agents",
42314
42579
  "runtime",
42315
42580
  "state",
42316
42581
  "run-continuation.jsonl"
42317
42582
  );
42318
- var STATE_DIR_REL = path124.join("agents", "runtime", "state");
42583
+ var STATE_DIR_REL = path126.join("agents", "runtime", "state");
42319
42584
  var ABSENT_CONFIRM_FIRES = 2;
42320
42585
  var DUPLICATE_WINDOW_MS = 60 * 1e3;
42321
42586
  function isDuplicateFire(state, turnOrdinal, openCount, nowMs, roadmapSource) {
@@ -42383,20 +42648,20 @@ function extractVerify(stepText) {
42383
42648
  function stateRelPath(runId, slug) {
42384
42649
  const safeRun = runId.replace(/[^A-Za-z0-9_-]/g, "_");
42385
42650
  const safeSlug = slug.replace(/[^A-Za-z0-9_-]/g, "_");
42386
- return path124.join(STATE_DIR_REL, `run-continuation-${safeRun}-${safeSlug}.json`);
42651
+ return path126.join(STATE_DIR_REL, `run-continuation-${safeRun}-${safeSlug}.json`);
42387
42652
  }
42388
42653
  function legacyStateRelPath(runId) {
42389
42654
  const safe = runId.replace(/[^A-Za-z0-9_-]/g, "_");
42390
- return path124.join(STATE_DIR_REL, `run-continuation-${safe}.json`);
42655
+ return path126.join(STATE_DIR_REL, `run-continuation-${safe}.json`);
42391
42656
  }
42392
42657
  function readRunState(workspaceRoot3, runId, slug) {
42393
- const keyedFile = path124.join(workspaceRoot3, stateRelPath(runId, slug));
42658
+ const keyedFile = path126.join(workspaceRoot3, stateRelPath(runId, slug));
42394
42659
  const keyed = readState7(keyedFile);
42395
42660
  if (keyed !== null) return { state: keyed, from: "keyed", keyedFile };
42396
42661
  if (fileExists(keyedFile)) {
42397
42662
  return { state: null, from: "keyed", keyedFile };
42398
42663
  }
42399
- const legacy = readState7(path124.join(workspaceRoot3, legacyStateRelPath(runId)));
42664
+ const legacy = readState7(path126.join(workspaceRoot3, legacyStateRelPath(runId)));
42400
42665
  if (legacy === null) return { state: null, from: "none", keyedFile };
42401
42666
  if (legacy.roadmap !== void 0 && legacy.roadmap !== slug) {
42402
42667
  return { state: null, from: "none", keyedFile };
@@ -42409,25 +42674,25 @@ function writeState6(file, state) {
42409
42674
  function clearRunState(workspaceRoot3, runId, keyedFile, adoptedLegacy) {
42410
42675
  revokeBillingGrant(workspaceRoot3, runId);
42411
42676
  try {
42412
- fs120.rmSync(keyedFile, { force: true });
42677
+ fs121.rmSync(keyedFile, { force: true });
42413
42678
  } catch {
42414
42679
  }
42415
42680
  if (!adoptedLegacy) return;
42416
42681
  try {
42417
- fs120.rmSync(path124.join(workspaceRoot3, legacyStateRelPath(runId)), { force: true });
42682
+ fs121.rmSync(path126.join(workspaceRoot3, legacyStateRelPath(runId)), { force: true });
42418
42683
  } catch {
42419
42684
  }
42420
42685
  }
42421
42686
  function fileExists(p) {
42422
42687
  try {
42423
- return fs120.statSync(p).isFile();
42688
+ return fs121.statSync(p).isFile();
42424
42689
  } catch {
42425
42690
  return false;
42426
42691
  }
42427
42692
  }
42428
42693
  function readState7(file) {
42429
42694
  try {
42430
- const parsed = JSON.parse(fs120.readFileSync(file, "utf8"));
42695
+ const parsed = JSON.parse(fs121.readFileSync(file, "utf8"));
42431
42696
  if (parsed === null || typeof parsed !== "object") return null;
42432
42697
  const o = parsed;
42433
42698
  if (typeof o["started_at"] !== "string") return null;
@@ -42470,16 +42735,16 @@ function readState7(file) {
42470
42735
  }
42471
42736
  }
42472
42737
  function normalizeDir(p) {
42473
- const abs = path124.resolve(p);
42738
+ const abs = path126.resolve(p);
42474
42739
  try {
42475
- return fs120.realpathSync(abs);
42740
+ return fs121.realpathSync(abs);
42476
42741
  } catch {
42477
42742
  return abs;
42478
42743
  }
42479
42744
  }
42480
42745
  function normalizeFile(p) {
42481
- const abs = path124.resolve(p);
42482
- return path124.join(normalizeDir(path124.dirname(abs)), path124.basename(abs));
42746
+ const abs = path126.resolve(p);
42747
+ return path126.join(normalizeDir(path126.dirname(abs)), path126.basename(abs));
42483
42748
  }
42484
42749
  function provenance(workspaceRoot3, claimPath, sessionRoot, sessionCwd) {
42485
42750
  const reader = normalizeDir(workspaceRoot3);
@@ -42506,36 +42771,36 @@ function provenance(workspaceRoot3, claimPath, sessionRoot, sessionCwd) {
42506
42771
  };
42507
42772
  }
42508
42773
  function resolveRoadmap(sessionRoot, workspaceRoot3, slug) {
42509
- const dirRel = path124.join("agents", "roadmaps");
42774
+ const dirRel = path126.join("agents", "roadmaps");
42510
42775
  const stem = slug.trim().replace(/\.md$/, "");
42511
- const rel = path124.join(dirRel, `${stem}.md`);
42512
- const norm = path124.normalize(rel);
42513
- if (path124.dirname(norm) !== dirRel) return null;
42514
- if (sessionRoot !== workspaceRoot3 && isDirectory2(path124.join(sessionRoot, dirRel))) {
42515
- return path124.join(sessionRoot, norm);
42776
+ const rel2 = path126.join(dirRel, `${stem}.md`);
42777
+ const norm = path126.normalize(rel2);
42778
+ if (path126.dirname(norm) !== dirRel) return null;
42779
+ if (sessionRoot !== workspaceRoot3 && isDirectory2(path126.join(sessionRoot, dirRel))) {
42780
+ return path126.join(sessionRoot, norm);
42516
42781
  }
42517
- return path124.join(normalizeDir(workspaceRoot3), norm);
42782
+ return path126.join(normalizeDir(workspaceRoot3), norm);
42518
42783
  }
42519
42784
  function isDirectory2(p) {
42520
42785
  try {
42521
- return fs120.statSync(p).isDirectory();
42786
+ return fs121.statSync(p).isDirectory();
42522
42787
  } catch {
42523
42788
  return false;
42524
42789
  }
42525
42790
  }
42526
42791
  function eventAlreadyLogged(workspaceRoot3, runId, slug, event) {
42527
42792
  try {
42528
- const file = path124.join(workspaceRoot3, EVENTS_RELPATH);
42529
- const size = fs120.statSync(file).size;
42793
+ const file = path126.join(workspaceRoot3, EVENTS_RELPATH);
42794
+ const size = fs121.statSync(file).size;
42530
42795
  const start = Math.max(0, size - LEDGER_TAIL_MAX_BYTES);
42531
- const fd = fs120.openSync(file, "r");
42796
+ const fd = fs121.openSync(file, "r");
42532
42797
  let text;
42533
42798
  try {
42534
42799
  const buf = Buffer.alloc(size - start);
42535
- const read = fs120.readSync(fd, buf, 0, buf.length, start);
42800
+ const read = fs121.readSync(fd, buf, 0, buf.length, start);
42536
42801
  text = buf.subarray(0, read).toString("utf8");
42537
42802
  } finally {
42538
- fs120.closeSync(fd);
42803
+ fs121.closeSync(fd);
42539
42804
  }
42540
42805
  for (const line of text.split("\n")) {
42541
42806
  if (line === "") continue;
@@ -42558,9 +42823,9 @@ function eventAlreadyLogged(workspaceRoot3, runId, slug, event) {
42558
42823
  }
42559
42824
  function appendEvent(workspaceRoot3, record2) {
42560
42825
  try {
42561
- const file = path124.join(workspaceRoot3, EVENTS_RELPATH);
42562
- fs120.mkdirSync(path124.dirname(file), { recursive: true });
42563
- fs120.appendFileSync(file, `${JSON.stringify(record2)}
42826
+ const file = path126.join(workspaceRoot3, EVENTS_RELPATH);
42827
+ fs121.mkdirSync(path126.dirname(file), { recursive: true });
42828
+ fs121.appendFileSync(file, `${JSON.stringify(record2)}
42564
42829
  `, "utf8");
42565
42830
  } catch {
42566
42831
  }
@@ -42568,7 +42833,7 @@ function appendEvent(workspaceRoot3, record2) {
42568
42833
  function refusedThisTurn(workspaceRoot3, sessionId3, turnOrdinal) {
42569
42834
  try {
42570
42835
  const file = sessionRefusalFile(workspaceRoot3, deriveSessionKey(sessionId3 || "unknown-session"));
42571
- const rec = parseRecord(fs120.readFileSync(file, "utf-8"));
42836
+ const rec = parseRecord(fs121.readFileSync(file, "utf-8"));
42572
42837
  return rec !== null && rec.refused_turn === turnOrdinal;
42573
42838
  } catch {
42574
42839
  return false;
@@ -42602,7 +42867,7 @@ function main71() {
42602
42867
  let roadmapText = null;
42603
42868
  if (roadmapPath2 !== null) {
42604
42869
  try {
42605
- roadmapText = fs120.readFileSync(roadmapPath2, "utf8");
42870
+ roadmapText = fs121.readFileSync(roadmapPath2, "utf8");
42606
42871
  roadmapFile = roadmapPath2;
42607
42872
  } catch {
42608
42873
  roadmapText = null;
@@ -42651,7 +42916,7 @@ function main71() {
42651
42916
  );
42652
42917
  if (!transcriptPath) return EXIT_ALLOW;
42653
42918
  try {
42654
- if (fs120.statSync(transcriptPath).size > TRANSCRIPT_READ_MAX_BYTES) {
42919
+ if (fs121.statSync(transcriptPath).size > TRANSCRIPT_READ_MAX_BYTES) {
42655
42920
  const inert = readRunState(workspaceRoot3, runId, slug);
42656
42921
  if (inert.state !== null && inert.state.inert_reported !== true) {
42657
42922
  const inertRoots = provenance(
@@ -42809,11 +43074,11 @@ function _isCliEntry52() {
42809
43074
  return false;
42810
43075
  }
42811
43076
  if (process.argv[1] === void 0) return false;
42812
- const argvUrl = pathToFileURL62(path124.resolve(process.argv[1])).href;
43077
+ const argvUrl = pathToFileURL62(path126.resolve(process.argv[1])).href;
42813
43078
  if (import.meta.url === argvUrl) return true;
42814
43079
  try {
42815
- const here = fs120.realpathSync(fileURLToPath72(import.meta.url));
42816
- const argv = fs120.realpathSync(path124.resolve(process.argv[1]));
43080
+ const here = fs121.realpathSync(fileURLToPath73(import.meta.url));
43081
+ const argv = fs121.realpathSync(path126.resolve(process.argv[1]));
42817
43082
  return here === argv;
42818
43083
  } catch {
42819
43084
  return false;
@@ -42824,9 +43089,9 @@ if (_isCliEntry52()) {
42824
43089
  }
42825
43090
 
42826
43091
  // src/scripts/hooks/journal_record_hook.ts
42827
- import * as fs122 from "node:fs";
42828
- import * as path126 from "node:path";
42829
- import { fileURLToPath as fileURLToPath73, pathToFileURL as pathToFileURL63 } from "node:url";
43092
+ import * as fs123 from "node:fs";
43093
+ import * as path128 from "node:path";
43094
+ import { fileURLToPath as fileURLToPath74, pathToFileURL as pathToFileURL63 } from "node:url";
42830
43095
 
42831
43096
  // src/scripts/_lib/surface.ts
42832
43097
  var SURFACES = ["ide", "cli", "cloud", "unknown"];
@@ -42855,9 +43120,9 @@ function readSurface(v) {
42855
43120
  }
42856
43121
 
42857
43122
  // src/scripts/_lib/runtime_journal.ts
42858
- import * as crypto14 from "node:crypto";
42859
- import * as fs121 from "node:fs";
42860
- import * as path125 from "node:path";
43123
+ import * as crypto15 from "node:crypto";
43124
+ import * as fs122 from "node:fs";
43125
+ import * as path127 from "node:path";
42861
43126
 
42862
43127
  // src/scripts/_lib/sqlite_schema.ts
42863
43128
  function addColumnIfMissing(db, table, column, decl) {
@@ -42959,9 +43224,9 @@ function requireId(name, id, optional) {
42959
43224
  }
42960
43225
  var JOURNAL_DIR_NAME = "agent-journal";
42961
43226
  var JOURNAL_FILE_NAME = "journal.sqlite";
42962
- var JOURNAL_FALLBACK_REL = path125.join("agents", "runtime", "state", JOURNAL_FILE_NAME);
43227
+ var JOURNAL_FALLBACK_REL = path127.join("agents", "runtime", "state", JOURNAL_FILE_NAME);
42963
43228
  function digest(domain, input) {
42964
- return crypto14.createHash("sha256").update(`${domain}\0${input}`).digest("hex").slice(0, 12);
43229
+ return crypto15.createHash("sha256").update(`${domain}\0${input}`).digest("hex").slice(0, 12);
42965
43230
  }
42966
43231
  var REPO_DOMAIN = "agent-journal/repository";
42967
43232
  var WORKTREE_DOMAIN = "agent-journal/worktree";
@@ -42970,20 +43235,20 @@ function resolveJournal(root) {
42970
43235
  if (common !== null) {
42971
43236
  const own = git_dir(root) ?? common;
42972
43237
  return {
42973
- path: path125.join(common, JOURNAL_DIR_NAME, JOURNAL_FILE_NAME),
43238
+ path: path127.join(common, JOURNAL_DIR_NAME, JOURNAL_FILE_NAME),
42974
43239
  scope: "repo-shared",
42975
43240
  reason: "common git dir resolved \u2014 every worktree of this repo writes one database",
42976
43241
  repository_id: digest(REPO_DOMAIN, common),
42977
43242
  worktree_id: digest(WORKTREE_DOMAIN, own)
42978
43243
  };
42979
43244
  }
42980
- let real = path125.resolve(root);
43245
+ let real = path127.resolve(root);
42981
43246
  try {
42982
- real = fs121.realpathSync(real);
43247
+ real = fs122.realpathSync(real);
42983
43248
  } catch {
42984
43249
  }
42985
43250
  return {
42986
- path: path125.join(real, JOURNAL_FALLBACK_REL),
43251
+ path: path127.join(real, JOURNAL_FALLBACK_REL),
42987
43252
  scope: "worktree-local",
42988
43253
  reason: "no common git dir \u2014 not inside a git repository; falling back to the tree-local path",
42989
43254
  repository_id: digest(REPO_DOMAIN, real),
@@ -43071,7 +43336,7 @@ function ensureWal(db) {
43071
43336
  function discard(dbPath) {
43072
43337
  for (const p of [dbPath, `${dbPath}-wal`, `${dbPath}-shm`]) {
43073
43338
  try {
43074
- fs121.rmSync(p, { force: true });
43339
+ fs122.rmSync(p, { force: true });
43075
43340
  } catch {
43076
43341
  }
43077
43342
  }
@@ -43083,9 +43348,9 @@ function openJournal(root) {
43083
43348
  );
43084
43349
  }
43085
43350
  const location = resolveJournal(root);
43086
- fs121.mkdirSync(path125.dirname(location.path), { recursive: true });
43351
+ fs122.mkdirSync(path127.dirname(location.path), { recursive: true });
43087
43352
  const { DatabaseSync } = loadSqliteSync("runtime_journal");
43088
- if (fs121.existsSync(location.path)) {
43353
+ if (fs122.existsSync(location.path)) {
43089
43354
  let drift = false;
43090
43355
  let probe = null;
43091
43356
  try {
@@ -43338,10 +43603,10 @@ function _isCliEntry53() {
43338
43603
  return false;
43339
43604
  }
43340
43605
  if (process.argv[1] === void 0) return false;
43341
- const argvUrl = pathToFileURL63(path126.resolve(process.argv[1])).href;
43606
+ const argvUrl = pathToFileURL63(path128.resolve(process.argv[1])).href;
43342
43607
  if (import.meta.url === argvUrl) return true;
43343
43608
  try {
43344
- return fs122.realpathSync(fileURLToPath73(import.meta.url)) === fs122.realpathSync(path126.resolve(process.argv[1]));
43609
+ return fs123.realpathSync(fileURLToPath74(import.meta.url)) === fs123.realpathSync(path128.resolve(process.argv[1]));
43345
43610
  } catch {
43346
43611
  return false;
43347
43612
  }
@@ -43349,7 +43614,7 @@ function _isCliEntry53() {
43349
43614
  if (_isCliEntry53()) process.exit(main72());
43350
43615
 
43351
43616
  // src/scripts/hooks/obligation_settle_hook.ts
43352
- import path127 from "node:path";
43617
+ import path129 from "node:path";
43353
43618
  import process17 from "node:process";
43354
43619
  function touchedPaths(cwd) {
43355
43620
  const tracked = gitNumstatRows(cwd).map((r) => r.path).filter((p) => p !== "" && !isDocPath(p));
@@ -43455,7 +43720,7 @@ function runSettle(resolve61 = resolveSettleContext) {
43455
43720
  function main73(_argv2 = process17.argv.slice(2)) {
43456
43721
  return runSettle();
43457
43722
  }
43458
- if (process17.argv[1] !== void 0 && path127.basename(process17.argv[1]).startsWith("obligation_settle")) {
43723
+ if (process17.argv[1] !== void 0 && path129.basename(process17.argv[1]).startsWith("obligation_settle")) {
43459
43724
  process17.exit(main73());
43460
43725
  }
43461
43726
 
@@ -43526,7 +43791,7 @@ var CONCERN_REGISTRY = {
43526
43791
  };
43527
43792
 
43528
43793
  // src/scripts/hooks/category_a.ts
43529
- import * as path128 from "node:path";
43794
+ import * as path130 from "node:path";
43530
43795
  var READ_ONLY_TOOLS = /* @__PURE__ */ new Set([
43531
43796
  "Read",
43532
43797
  "Glob",
@@ -43705,10 +43970,10 @@ var SCRIPT_TAKING_SUBCOMMANDS = /* @__PURE__ */ new Set([
43705
43970
  ]);
43706
43971
  function isInsideWorkingTree(candidate, root) {
43707
43972
  if (!candidate.trim() || !root.trim()) return false;
43708
- const abs = path128.resolve(root, candidate);
43709
- const rel = path128.relative(path128.resolve(root), abs);
43710
- if (rel === "") return true;
43711
- return !rel.startsWith("..") && !path128.isAbsolute(rel);
43973
+ const abs = path130.resolve(root, candidate);
43974
+ const rel2 = path130.relative(path130.resolve(root), abs);
43975
+ if (rel2 === "") return true;
43976
+ return !rel2.startsWith("..") && !path130.isAbsolute(rel2);
43712
43977
  }
43713
43978
  function _argv(command) {
43714
43979
  return command.trim().split(/\s+/).filter((t) => t.length > 0);
@@ -43736,7 +44001,7 @@ function _gitSubcommand(argv) {
43736
44001
  if (!_isFlag(token)) return token;
43737
44002
  const [flag, inlineValue] = token.includes("=") ? [token.slice(0, token.indexOf("=")), token.slice(token.indexOf("=") + 1)] : [token, null];
43738
44003
  const value = inlineValue ?? (GIT_VALUE_FLAGS.has(flag) ? argv[++i] : void 0);
43739
- if (value !== void 0 && (path128.isAbsolute(value) || value.split("/").includes(".."))) {
44004
+ if (value !== void 0 && (path130.isAbsolute(value) || value.split("/").includes(".."))) {
43740
44005
  return "";
43741
44006
  }
43742
44007
  }
@@ -43984,9 +44249,9 @@ function _py_json_dumps2(value, indent) {
43984
44249
  }
43985
44250
 
43986
44251
  // src/scripts/_lib/collector_denominator.ts
43987
- import crypto15 from "node:crypto";
43988
- import fs124 from "node:fs";
43989
- import path130 from "node:path";
44252
+ import crypto16 from "node:crypto";
44253
+ import fs125 from "node:fs";
44254
+ import path132 from "node:path";
43990
44255
 
43991
44256
  // src/scripts/_lib/collector_record.ts
43992
44257
  var COLLECTOR_EVENTS = [
@@ -44063,30 +44328,30 @@ var FIELD_PURPOSE = {
44063
44328
  var ALLOWED_FIELDS = new Set(Object.keys(FIELD_PURPOSE));
44064
44329
 
44065
44330
  // src/scripts/_lib/collector_store.ts
44066
- import * as fs123 from "node:fs";
44331
+ import * as fs124 from "node:fs";
44067
44332
  import * as os16 from "node:os";
44068
- import * as path129 from "node:path";
44333
+ import * as path131 from "node:path";
44069
44334
  var COLLECTOR_DIR_NAME = "agent-collector";
44070
44335
  var COLLECTOR_FILE_NAME = "collector.sqlite";
44071
44336
  var OPT_OUT_MARKER_NAME = "OPT-OUT";
44072
44337
  var MIGRATION_MARKER_NAME = "MIGRATION-IN-FLIGHT";
44073
44338
  var QUARANTINE_DIR_NAME = "quarantine";
44074
44339
  function defaultUserRoot() {
44075
- return path129.join(os16.homedir(), ".event4u", "agent-config");
44340
+ return path131.join(os16.homedir(), ".event4u", "agent-config");
44076
44341
  }
44077
44342
  function resolveCollectorStore(userRoot = defaultUserRoot()) {
44078
- const dir = path129.join(userRoot, COLLECTOR_DIR_NAME);
44343
+ const dir = path131.join(userRoot, COLLECTOR_DIR_NAME);
44079
44344
  return {
44080
44345
  userRoot,
44081
44346
  root: dir,
44082
- path: path129.join(dir, COLLECTOR_FILE_NAME),
44083
- optOutMarker: path129.join(dir, OPT_OUT_MARKER_NAME),
44084
- migrationMarker: path129.join(dir, MIGRATION_MARKER_NAME),
44085
- quarantineDir: path129.join(dir, QUARANTINE_DIR_NAME)
44347
+ path: path131.join(dir, COLLECTOR_FILE_NAME),
44348
+ optOutMarker: path131.join(dir, OPT_OUT_MARKER_NAME),
44349
+ migrationMarker: path131.join(dir, MIGRATION_MARKER_NAME),
44350
+ quarantineDir: path131.join(dir, QUARANTINE_DIR_NAME)
44086
44351
  };
44087
44352
  }
44088
44353
  function isOptedOut(userRoot = defaultUserRoot()) {
44089
- return fs123.existsSync(resolveCollectorStore(userRoot).optOutMarker);
44354
+ return fs124.existsSync(resolveCollectorStore(userRoot).optOutMarker);
44090
44355
  }
44091
44356
  var MIGRATIONS = Object.freeze({
44092
44357
  // 0 → 1. No DDL: `user_version` 0 is the default SQLite assigns, and a
@@ -44103,24 +44368,24 @@ var SPOOL_DIR_NAME = "spool";
44103
44368
  var SPOOL_PENDING_NAME = "pending.jsonl";
44104
44369
  var ENABLED_MARKER_NAME = "ENABLED";
44105
44370
  function denominatorPath(userRoot) {
44106
- return path130.join(resolveCollectorStore(userRoot).root, DENOMINATOR_FILE_NAME);
44371
+ return path132.join(resolveCollectorStore(userRoot).root, DENOMINATOR_FILE_NAME);
44107
44372
  }
44108
44373
  function spoolDir(userRoot) {
44109
- return path130.join(resolveCollectorStore(userRoot).root, SPOOL_DIR_NAME);
44374
+ return path132.join(resolveCollectorStore(userRoot).root, SPOOL_DIR_NAME);
44110
44375
  }
44111
44376
  function spoolPendingPath(userRoot) {
44112
- return path130.join(spoolDir(userRoot), SPOOL_PENDING_NAME);
44377
+ return path132.join(spoolDir(userRoot), SPOOL_PENDING_NAME);
44113
44378
  }
44114
44379
  function enabledMarkerPath(userRoot) {
44115
- return path130.join(resolveCollectorStore(userRoot).root, ENABLED_MARKER_NAME);
44380
+ return path132.join(resolveCollectorStore(userRoot).root, ENABLED_MARKER_NAME);
44116
44381
  }
44117
44382
  function isCollectorEnabled(userRoot) {
44118
44383
  if (isOptedOut(userRoot)) return false;
44119
- if (fs124.existsSync(killSwitchPathLocal(userRoot))) return false;
44120
- return fs124.existsSync(enabledMarkerPath(userRoot));
44384
+ if (fs125.existsSync(killSwitchPathLocal(userRoot))) return false;
44385
+ return fs125.existsSync(enabledMarkerPath(userRoot));
44121
44386
  }
44122
44387
  function killSwitchPathLocal(userRoot) {
44123
- return path130.join(resolveCollectorStore(userRoot).root, "STOP");
44388
+ return path132.join(resolveCollectorStore(userRoot).root, "STOP");
44124
44389
  }
44125
44390
  function utcDate(at = Date.now()) {
44126
44391
  return new Date(at).toISOString().slice(0, 10);
@@ -44132,8 +44397,8 @@ function recordOpportunity(event, platform, userRoot, at = Date.now(), opts = {}
44132
44397
  if (!COLLECTOR_EVENTS.includes(event)) return false;
44133
44398
  if (!COLLECTOR_PLATFORMS.includes(platform)) return false;
44134
44399
  const target = denominatorPath(userRoot);
44135
- fs124.mkdirSync(path130.dirname(target), { recursive: true });
44136
- fs124.appendFileSync(target, `${utcDate(at)} ${event} ${platform}
44400
+ fs125.mkdirSync(path132.dirname(target), { recursive: true });
44401
+ fs125.appendFileSync(target, `${utcDate(at)} ${event} ${platform}
44137
44402
  `);
44138
44403
  return true;
44139
44404
  } catch {
@@ -44147,19 +44412,19 @@ var MACHINE_ID_NAME = "machine-id";
44147
44412
  var EPISODE_DIR_NAME = "episodes";
44148
44413
  var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
44149
44414
  function machineIdPath(userRoot) {
44150
- return path130.join(resolveCollectorStore(userRoot).root, MACHINE_ID_NAME);
44415
+ return path132.join(resolveCollectorStore(userRoot).root, MACHINE_ID_NAME);
44151
44416
  }
44152
44417
  function machineId(userRoot) {
44153
44418
  const target = machineIdPath(userRoot);
44154
44419
  try {
44155
- const existing = fs124.readFileSync(target, "utf8").trim();
44420
+ const existing = fs125.readFileSync(target, "utf8").trim();
44156
44421
  if (UUID_RE.test(existing)) return existing;
44157
44422
  } catch {
44158
44423
  }
44159
44424
  try {
44160
- const minted = crypto15.randomUUID();
44161
- fs124.mkdirSync(path130.dirname(target), { recursive: true });
44162
- fs124.writeFileSync(target, `${minted}
44425
+ const minted = crypto16.randomUUID();
44426
+ fs125.mkdirSync(path132.dirname(target), { recursive: true });
44427
+ fs125.writeFileSync(target, `${minted}
44163
44428
  `);
44164
44429
  return minted;
44165
44430
  } catch {
@@ -44170,10 +44435,10 @@ var fallbackEpisode = null;
44170
44435
  function episodeId(env = process.env) {
44171
44436
  const hostSession = env.CLAUDE_CODE_SESSION_ID ?? env.AGENT_CONFIG_SESSION_ID ?? "";
44172
44437
  if (hostSession === "") {
44173
- fallbackEpisode ??= crypto15.randomUUID();
44438
+ fallbackEpisode ??= crypto16.randomUUID();
44174
44439
  return fallbackEpisode;
44175
44440
  }
44176
- const digest2 = crypto15.createHash("sha256").update(hostSession).digest("hex");
44441
+ const digest2 = crypto16.createHash("sha256").update(hostSession).digest("hex");
44177
44442
  return [
44178
44443
  digest2.slice(0, 8),
44179
44444
  digest2.slice(8, 12),
@@ -44183,17 +44448,17 @@ function episodeId(env = process.env) {
44183
44448
  ].join("-");
44184
44449
  }
44185
44450
  function nextSequence(episode, userRoot) {
44186
- const dir = path130.join(resolveCollectorStore(userRoot).root, EPISODE_DIR_NAME);
44187
- const target = path130.join(dir, `${episode}.seq`);
44451
+ const dir = path132.join(resolveCollectorStore(userRoot).root, EPISODE_DIR_NAME);
44452
+ const target = path132.join(dir, `${episode}.seq`);
44188
44453
  try {
44189
- fs124.mkdirSync(dir, { recursive: true });
44454
+ fs125.mkdirSync(dir, { recursive: true });
44190
44455
  let current = 0;
44191
44456
  try {
44192
- const raw = Number.parseInt(fs124.readFileSync(target, "utf8").trim(), 10);
44457
+ const raw = Number.parseInt(fs125.readFileSync(target, "utf8").trim(), 10);
44193
44458
  if (Number.isInteger(raw) && raw >= 0) current = raw + 1;
44194
44459
  } catch {
44195
44460
  }
44196
- fs124.writeFileSync(target, `${current}
44461
+ fs125.writeFileSync(target, `${current}
44197
44462
  `);
44198
44463
  return current;
44199
44464
  } catch {
@@ -44232,12 +44497,12 @@ function spoolRecord(record2, userRoot) {
44232
44497
  try {
44233
44498
  if (!isCollectorEnabled(userRoot)) return false;
44234
44499
  const target = spoolPendingPath(userRoot);
44235
- fs124.mkdirSync(path130.dirname(target), { recursive: true });
44500
+ fs125.mkdirSync(path132.dirname(target), { recursive: true });
44236
44501
  try {
44237
- if (fs124.statSync(target).size >= SPOOL_MAX_BYTES) return false;
44502
+ if (fs125.statSync(target).size >= SPOOL_MAX_BYTES) return false;
44238
44503
  } catch {
44239
44504
  }
44240
- fs124.appendFileSync(target, `${JSON.stringify(record2)}
44505
+ fs125.appendFileSync(target, `${JSON.stringify(record2)}
44241
44506
  `);
44242
44507
  return true;
44243
44508
  } catch {
@@ -44247,11 +44512,11 @@ function spoolRecord(record2, userRoot) {
44247
44512
 
44248
44513
  // src/scripts/hooks/dispatch_hook.ts
44249
44514
  var _IN_BUNDLE3 = true;
44250
- var REPO_ROOT2 = path131.resolve(
44251
- path131.dirname(fileURLToPath74(import.meta.url)),
44515
+ var REPO_ROOT2 = path133.resolve(
44516
+ path133.dirname(fileURLToPath75(import.meta.url)),
44252
44517
  ..._IN_BUNDLE3 ? ["..", ".."] : ["..", "..", ".."]
44253
44518
  );
44254
- var MANIFEST_PATH = path131.join(REPO_ROOT2, "src", "scripts", "hook_manifest.yaml");
44519
+ var MANIFEST_PATH = path133.join(REPO_ROOT2, "src", "scripts", "hook_manifest.yaml");
44255
44520
  var EVENT_VOCABULARY = /* @__PURE__ */ new Set([
44256
44521
  "session_start",
44257
44522
  "session_end",
@@ -44302,11 +44567,11 @@ function _manifest_fingerprint(text) {
44302
44567
  return tableFingerprint(text);
44303
44568
  }
44304
44569
  function _load_yaml3(p) {
44305
- const text = fs125.readFileSync(p, "utf-8");
44570
+ const text = fs126.readFileSync(p, "utf-8");
44306
44571
  const compiled = p.replace(/\.ya?ml$/u, ".json");
44307
44572
  if (compiled !== p) {
44308
44573
  try {
44309
- const raw = JSON.parse(fs125.readFileSync(compiled, "utf-8"));
44574
+ const raw = JSON.parse(fs126.readFileSync(compiled, "utf-8"));
44310
44575
  if (_isObject19(raw) && raw["fingerprint"] === _manifest_fingerprint(text) && _isObject19(raw["manifest"]) && // road-to-blocking-severities 2.3, the manifest twin of the check in
44311
44576
  // `host_lowering.resolveTable`, which carries the full reasoning. In
44312
44577
  // one line: the label above binds this file to the YAML SOURCE and says
@@ -44410,7 +44675,7 @@ function _maybe_capture_payload(args, payload_text) {
44410
44675
  }
44411
44676
  try {
44412
44677
  const target = _expanduser4(capture_dir);
44413
- fs125.mkdirSync(target, { recursive: true });
44678
+ fs126.mkdirSync(target, { recursive: true });
44414
44679
  let payload;
44415
44680
  try {
44416
44681
  payload = payload_text.trim() ? JSON.parse(payload_text) : {};
@@ -44427,8 +44692,8 @@ function _maybe_capture_payload(args, payload_text) {
44427
44692
  const ts = Date.now();
44428
44693
  const native = (args.native_event || args.event).replace(/\//g, "_");
44429
44694
  const fname = `${args.platform}__${native}__${ts}__${process.pid}.json`;
44430
- fs125.writeFileSync(
44431
- path131.join(target, fname),
44695
+ fs126.writeFileSync(
44696
+ path133.join(target, fname),
44432
44697
  _py_json_dumps2(record2, 2) + "\n",
44433
44698
  { encoding: "utf-8" }
44434
44699
  );
@@ -44439,7 +44704,7 @@ function _maybe_capture_payload(args, payload_text) {
44439
44704
  function _expanduser4(p) {
44440
44705
  if (p === "~" || p.startsWith("~/")) {
44441
44706
  const home = process.env["HOME"] || process.env["USERPROFILE"] || "";
44442
- return path131.join(home, p.slice(1));
44707
+ return path133.join(home, p.slice(1));
44443
44708
  }
44444
44709
  return p;
44445
44710
  }
@@ -44472,25 +44737,25 @@ function _resolve_tsx_invocation2(scriptPath, scriptArgs) {
44472
44737
  const walkUp = (start) => {
44473
44738
  let dir = start;
44474
44739
  for (; ; ) {
44475
- const candidate = path131.join(dir, "node_modules", ".bin", binName);
44740
+ const candidate = path133.join(dir, "node_modules", ".bin", binName);
44476
44741
  if (_isFile8(candidate)) {
44477
44742
  return candidate;
44478
44743
  }
44479
- const parent = path131.dirname(dir);
44744
+ const parent = path133.dirname(dir);
44480
44745
  if (parent === dir) {
44481
44746
  return null;
44482
44747
  }
44483
44748
  dir = parent;
44484
44749
  }
44485
44750
  };
44486
- const tsx = walkUp(path131.dirname(scriptPath)) ?? walkUp(path131.dirname(fileURLToPath74(import.meta.url)));
44751
+ const tsx = walkUp(path133.dirname(scriptPath)) ?? walkUp(path133.dirname(fileURLToPath75(import.meta.url)));
44487
44752
  if (tsx !== null) {
44488
44753
  return { command: tsx, args: [scriptPath, ...scriptArgs] };
44489
44754
  }
44490
44755
  return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
44491
44756
  }
44492
44757
  function _run_concern_inproc(main_fn, concern, envelope) {
44493
- const scriptAbs = path131.join(REPO_ROOT2, String(concern["script"]));
44758
+ const scriptAbs = path133.join(REPO_ROOT2, String(concern["script"]));
44494
44759
  const argsList = Array.isArray(concern["args"]) ? concern["args"].map((a) => String(a)) : [];
44495
44760
  argsList.push("--platform", String(envelope["platform"] || "generic"));
44496
44761
  const workspace = String(envelope["workspace_root"] || process.cwd());
@@ -44566,7 +44831,7 @@ function _run_concern(concern, envelope) {
44566
44831
  return _run_concern_inproc(inproc, concern, envelope);
44567
44832
  }
44568
44833
  }
44569
- const script = path131.join(REPO_ROOT2, String(concern["script"]));
44834
+ const script = path133.join(REPO_ROOT2, String(concern["script"]));
44570
44835
  const argsList = Array.isArray(concern["args"]) ? concern["args"].map((a) => String(a)) : [];
44571
44836
  const cmd = [script, ...argsList];
44572
44837
  cmd.push("--platform", String(envelope["platform"] || "generic"));
@@ -44626,7 +44891,7 @@ ${proc.stderr || ""}`,
44626
44891
  }
44627
44892
  function _isFile8(p) {
44628
44893
  try {
44629
- return fs125.statSync(p).isFile();
44894
+ return fs126.statSync(p).isFile();
44630
44895
  } catch {
44631
44896
  return false;
44632
44897
  }
@@ -44648,10 +44913,10 @@ function _write_feedback(envelope, session_id, entries, final_rc, started_at) {
44648
44913
  return;
44649
44914
  }
44650
44915
  const workspace = String(envelope["workspace_root"] || process.cwd());
44651
- const state_root = path131.join(workspace, "agents", "runtime", "state");
44916
+ const state_root = path133.join(workspace, "agents", "runtime", "state");
44652
44917
  const fb_dir = feedback_dir(state_root, session_id);
44653
44918
  try {
44654
- fs125.mkdirSync(fb_dir, { recursive: true });
44919
+ fs126.mkdirSync(fb_dir, { recursive: true });
44655
44920
  } catch (exc) {
44656
44921
  const msg = exc instanceof Error ? exc.message : String(exc);
44657
44922
  process.stderr.write(`dispatch_hook: feedback dir unavailable: ${msg}
@@ -44659,7 +44924,7 @@ function _write_feedback(envelope, session_id, entries, final_rc, started_at) {
44659
44924
  return;
44660
44925
  }
44661
44926
  for (const entry of entries) {
44662
- const target = path131.join(fb_dir, `${entry["concern"]}.json`);
44927
+ const target = path133.join(fb_dir, `${entry["concern"]}.json`);
44663
44928
  try {
44664
44929
  atomic_write_json(target, entry);
44665
44930
  } catch (exc) {
@@ -44708,7 +44973,7 @@ function _write_feedback(envelope, session_id, entries, final_rc, started_at) {
44708
44973
  };
44709
44974
  try {
44710
44975
  const invocation = `${String(process.pid)}-${process.hrtime.bigint().toString()}`;
44711
- update_json_under_lock(path131.join(fb_dir, "summary.json"), (loaded) => {
44976
+ update_json_under_lock(path133.join(fb_dir, "summary.json"), (loaded) => {
44712
44977
  const priorRaw = loaded["invocations"];
44713
44978
  const prior = Array.isArray(priorRaw) ? priorRaw : [];
44714
44979
  const next = [...prior, { invocation, ...summary }];
@@ -44735,8 +45000,8 @@ function _record_rule_trips(envelope, entries) {
44735
45000
  if (tripped.length === 0) return;
44736
45001
  try {
44737
45002
  const workspace = String(envelope["workspace_root"] || process.cwd());
44738
- const state_dir = path131.join(workspace, "agents", "runtime", "state");
44739
- const target = path131.join(state_dir, "rule-trips.json");
45003
+ const state_dir = path133.join(workspace, "agents", "runtime", "state");
45004
+ const target = path133.join(state_dir, "rule-trips.json");
44740
45005
  const today = _now_iso3().slice(0, 10);
44741
45006
  update_json_under_lock(target, (loaded) => {
44742
45007
  const doc = { schema_version: 1, concerns: {}, ...loaded };
@@ -44878,7 +45143,7 @@ function main74(argv) {
44878
45143
  recordOpportunity(args.event, args.platform);
44879
45144
  recordCapture(args.event, args.platform);
44880
45145
  const manifest_path2 = args.manifest;
44881
- if (!fs125.existsSync(manifest_path2)) {
45146
+ if (!fs126.existsSync(manifest_path2)) {
44882
45147
  process.stderr.write(`dispatch_hook: manifest missing at ${manifest_path2}
44883
45148
  `);
44884
45149
  return EXIT_ALLOW;
@@ -44943,7 +45208,7 @@ function main74(argv) {
44943
45208
  }
44944
45209
  if (_IN_BUNDLE3) {
44945
45210
  const stop = runBundleIntegrityGate(
44946
- fileURLToPath74(import.meta.url),
45211
+ fileURLToPath75(import.meta.url),
44947
45212
  args.platform,
44948
45213
  args.event,
44949
45214
  concerns.some((c) => !_is_advisory(c))
@@ -45059,7 +45324,7 @@ function main74(argv) {
45059
45324
  }
45060
45325
  function _isDir6(p) {
45061
45326
  try {
45062
- return fs125.statSync(p).isDirectory();
45327
+ return fs126.statSync(p).isDirectory();
45063
45328
  } catch {
45064
45329
  return false;
45065
45330
  }
@@ -45076,13 +45341,13 @@ function _isCliEntry54() {
45076
45341
  if (process.argv[1] === void 0) {
45077
45342
  return false;
45078
45343
  }
45079
- const argvUrl = pathToFileURL64(path131.resolve(process.argv[1])).href;
45344
+ const argvUrl = pathToFileURL64(path133.resolve(process.argv[1])).href;
45080
45345
  if (import.meta.url === argvUrl) {
45081
45346
  return true;
45082
45347
  }
45083
45348
  try {
45084
- const here = fs125.realpathSync(fileURLToPath74(import.meta.url));
45085
- const argv = fs125.realpathSync(path131.resolve(process.argv[1]));
45349
+ const here = fs126.realpathSync(fileURLToPath75(import.meta.url));
45350
+ const argv = fs126.realpathSync(path133.resolve(process.argv[1]));
45086
45351
  return here === argv;
45087
45352
  } catch {
45088
45353
  return false;
@@ -45094,8 +45359,8 @@ if (isCliEntry16) {
45094
45359
  }
45095
45360
 
45096
45361
  // src/scripts/hooks/dispatch_entry.ts
45097
- var _selfPath = fileURLToPath75(import.meta.url);
45098
- var _invokedDirectly2 = globalThis.__AC_HOOKS_BUNDLE_DIRECT === true || process.argv[1] !== void 0 && path132.resolve(process.argv[1]) === path132.resolve(_selfPath);
45362
+ var _selfPath = fileURLToPath76(import.meta.url);
45363
+ var _invokedDirectly2 = globalThis.__AC_HOOKS_BUNDLE_DIRECT === true || process.argv[1] !== void 0 && path134.resolve(process.argv[1]) === path134.resolve(_selfPath);
45099
45364
  if (_invokedDirectly2) {
45100
45365
  process.exitCode = main74(process.argv.slice(2));
45101
45366
  }