@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
@@ -13,9 +13,10 @@ import {
13
13
  foldRefusal,
14
14
  foldShadow,
15
15
  hasRedThenGreen,
16
+ isAssetRenderCommand,
16
17
  isCiPoll,
17
18
  isVacuousOutput,
18
- isVerificationCommand,
19
+ isVerificationAttempt,
19
20
  parseRecord,
20
21
  parseShadowRecord,
21
22
  pendingCount,
@@ -27,7 +28,7 @@ import {
27
28
  shadowSetBy,
28
29
  statePathFor,
29
30
  validateAssumption
30
- } from "./chunk-AED2VQGM.js";
31
+ } from "./chunk-TMWYUOK4.js";
31
32
  import {
32
33
  LexicalIndex,
33
34
  isSqliteAvailableSync,
@@ -119,9 +120,9 @@ import {
119
120
 
120
121
  // src/scripts/_cli/cmd_conformance.ts
121
122
  var YAML = __toESM(require_dist(), 1);
122
- import * as fs20 from "node:fs";
123
+ import * as fs21 from "node:fs";
123
124
  import * as os7 from "node:os";
124
- import * as path18 from "node:path";
125
+ import * as path19 from "node:path";
125
126
  import process5 from "node:process";
126
127
  import { spawnSync as spawnSync4 } from "node:child_process";
127
128
  import { fileURLToPath as fileURLToPath14, pathToFileURL as pathToFileURL14 } from "node:url";
@@ -137,10 +138,10 @@ var ROUTE_TARGET_TEMPLATES = Object.freeze({
137
138
  ])
138
139
  });
139
140
  function parseRouteTarget(target) {
140
- const sep4 = target.indexOf(":");
141
- if (sep4 <= 0) return null;
142
- const kind = target.slice(0, sep4);
143
- const id = target.slice(sep4 + 1);
141
+ const sep5 = target.indexOf(":");
142
+ if (sep5 <= 0) return null;
143
+ const kind = target.slice(0, sep5);
144
+ const id = target.slice(sep5 + 1);
144
145
  if (!id) return null;
145
146
  if (!Object.prototype.hasOwnProperty.call(ROUTE_TARGET_TEMPLATES, kind)) return null;
146
147
  return { kind, id };
@@ -152,17 +153,17 @@ function routeTargetPathsPosix(target) {
152
153
  }
153
154
 
154
155
  // src/scripts/report_conformance_funnel.ts
155
- import * as fs19 from "node:fs";
156
+ import * as fs20 from "node:fs";
156
157
  import * as os6 from "node:os";
157
- import * as path17 from "node:path";
158
+ import * as path18 from "node:path";
158
159
  import process4 from "node:process";
159
160
  import { fileURLToPath as fileURLToPath13, pathToFileURL as pathToFileURL13 } from "node:url";
160
161
 
161
162
  // src/scripts/conformance_scan.ts
162
- import { createHash as createHash4 } from "node:crypto";
163
- import fs15 from "node:fs";
163
+ import { createHash as createHash5 } from "node:crypto";
164
+ import fs16 from "node:fs";
164
165
  import os2 from "node:os";
165
- import path13 from "node:path";
166
+ import path14 from "node:path";
166
167
  import { fileURLToPath as fileURLToPath9, pathToFileURL as pathToFileURL9 } from "node:url";
167
168
 
168
169
  // src/scripts/_lib/transcript_entry.ts
@@ -1947,8 +1948,8 @@ var COMMAND_OBJECTS = {
1947
1948
  };
1948
1949
 
1949
1950
  // src/scripts/hooks/turn_end_gate_hook.ts
1950
- import * as fs12 from "node:fs";
1951
- import * as path10 from "node:path";
1951
+ import * as fs13 from "node:fs";
1952
+ import * as path11 from "node:path";
1952
1953
  import { fileURLToPath as fileURLToPath6, pathToFileURL as pathToFileURL6 } from "node:url";
1953
1954
 
1954
1955
  // src/scripts/check_reply_consistency.ts
@@ -2115,11 +2116,11 @@ function _rglobMdSorted(dir) {
2115
2116
  return out;
2116
2117
  }
2117
2118
  function _relToPosixOrAbs(child, root) {
2118
- const rel = path3.relative(root, child);
2119
- if (rel === "" || rel.startsWith("..") || path3.isAbsolute(rel)) {
2119
+ const rel2 = path3.relative(root, child);
2120
+ if (rel2 === "" || rel2.startsWith("..") || path3.isAbsolute(rel2)) {
2120
2121
  return child.split(path3.sep).join("/");
2121
2122
  }
2122
- return rel.split(path3.sep).join("/");
2123
+ return rel2.split(path3.sep).join("/");
2123
2124
  }
2124
2125
  function cmd_scan_dir(root) {
2125
2126
  let roots;
@@ -2506,8 +2507,8 @@ function looksLikeGraph(p) {
2506
2507
  function detectSources(root, nativeCache) {
2507
2508
  const abs = path4.resolve(root);
2508
2509
  const out = [];
2509
- for (const rel of consumerCandidates(abs)) {
2510
- const p = path4.join(abs, rel);
2510
+ for (const rel2 of consumerCandidates(abs)) {
2511
+ const p = path4.join(abs, rel2);
2511
2512
  if (fs4.existsSync(p)) {
2512
2513
  const { ok, sha } = looksLikeGraph(p);
2513
2514
  if (ok) out.push({ kind: "consumer", path: p, present: true, ...freshness(abs, p, sha) });
@@ -3159,15 +3160,15 @@ function toRepoRelative(root, paths) {
3159
3160
  });
3160
3161
  }
3161
3162
  function _relativeInside(from, to) {
3162
- let rel;
3163
+ let rel2;
3163
3164
  try {
3164
- rel = path6.relative(from, to);
3165
+ rel2 = path6.relative(from, to);
3165
3166
  } catch {
3166
3167
  return null;
3167
3168
  }
3168
- if (rel === "") return ".";
3169
- if (rel === ".." || rel.startsWith(`..${path6.sep}`) || path6.isAbsolute(rel)) return null;
3170
- return rel.split(path6.sep).join("/");
3169
+ if (rel2 === "") return ".";
3170
+ if (rel2 === ".." || rel2.startsWith(`..${path6.sep}`) || path6.isAbsolute(rel2)) return null;
3171
+ return rel2.split(path6.sep).join("/");
3171
3172
  }
3172
3173
  function _resolveReal(p) {
3173
3174
  const abs = path6.resolve(p);
@@ -3278,6 +3279,185 @@ function buildFeederRow(input) {
3278
3279
  };
3279
3280
  }
3280
3281
 
3282
+ // src/scripts/hooks/svg_obligation.ts
3283
+ import * as crypto from "node:crypto";
3284
+ import * as fs8 from "node:fs";
3285
+ import * as path7 from "node:path";
3286
+ var EDIT_TOOLS = /* @__PURE__ */ new Set(["Edit", "Write", "MultiEdit", "NotebookEdit"]);
3287
+ var RENDER_REL = path7.join("agents", "runtime", "state", "render");
3288
+ var PLANTED_PREFIXES = [
3289
+ "tests/design-artifacts/fixtures/",
3290
+ "tests/design-artifacts/scenarios/"
3291
+ ];
3292
+ function hasErrorFinding(m) {
3293
+ const f = m.asset?.findings;
3294
+ return Array.isArray(f) && f.some((x) => x?.severity === "error");
3295
+ }
3296
+ var rel = (root, p) => {
3297
+ const slashed = p.split(path7.sep).join("/");
3298
+ if (!path7.isAbsolute(p)) return path7.posix.normalize(slashed).replace(/^\.\//, "");
3299
+ const inside = path7.relative(root, p).split(path7.sep).join("/");
3300
+ return inside === "" || inside.startsWith("../") ? slashed : inside;
3301
+ };
3302
+ function isPlantedFixture(relPath, root = "") {
3303
+ const norm = rel(root, relPath);
3304
+ return PLANTED_PREFIXES.some((prefix) => norm.startsWith(prefix));
3305
+ }
3306
+ function readAssetManifests(root) {
3307
+ const dir = path7.join(root, RENDER_REL);
3308
+ let entries;
3309
+ try {
3310
+ entries = fs8.readdirSync(dir);
3311
+ } catch {
3312
+ return [];
3313
+ }
3314
+ const out = [];
3315
+ for (const name of entries) {
3316
+ let raw;
3317
+ try {
3318
+ raw = fs8.readFileSync(path7.join(dir, name, "manifest.json"), "utf8");
3319
+ } catch {
3320
+ continue;
3321
+ }
3322
+ try {
3323
+ const parsed = JSON.parse(raw);
3324
+ if (parsed.profile === "asset") out.push(parsed);
3325
+ } catch {
3326
+ }
3327
+ }
3328
+ return out;
3329
+ }
3330
+ function dischargeFor(manifests, digest) {
3331
+ let staticOnly = false;
3332
+ for (const m of manifests) {
3333
+ if (m.verification === "verified" && m.asset?.digest === digest && !hasErrorFinding(m)) {
3334
+ return "verified";
3335
+ }
3336
+ if (m.reason === "renderer-absent" && m.static?.digest === digest && m.static.errors === 0) {
3337
+ staticOnly = true;
3338
+ }
3339
+ }
3340
+ return staticOnly ? "static-only" : null;
3341
+ }
3342
+ function readSvgObligations(root, inputs) {
3343
+ const open = [];
3344
+ const discharged = [];
3345
+ const seen = /* @__PURE__ */ new Set();
3346
+ let manifests = null;
3347
+ for (const { path: raw, rendered } of inputs.edits) {
3348
+ if (!/\.svg$/i.test(raw)) continue;
3349
+ const relPath = rel(root, raw);
3350
+ if (seen.has(relPath)) continue;
3351
+ seen.add(relPath);
3352
+ if (isPlantedFixture(relPath, root)) continue;
3353
+ const abs = path7.isAbsolute(raw) ? raw : path7.join(root, relPath);
3354
+ let bytes;
3355
+ try {
3356
+ bytes = fs8.readFileSync(abs);
3357
+ } catch {
3358
+ continue;
3359
+ }
3360
+ const digest = crypto.createHash("sha256").update(bytes).digest("hex");
3361
+ if (!renderNames(rendered, relPath)) {
3362
+ open.push({
3363
+ file: relPath,
3364
+ 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"
3365
+ });
3366
+ continue;
3367
+ }
3368
+ if (inputs.renderDirTampered) {
3369
+ open.push({
3370
+ file: relPath,
3371
+ 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"
3372
+ });
3373
+ continue;
3374
+ }
3375
+ manifests ??= readAssetManifests(root);
3376
+ const kind = dischargeFor(manifests, digest);
3377
+ if (kind === null) {
3378
+ open.push({
3379
+ file: relPath,
3380
+ 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"
3381
+ });
3382
+ continue;
3383
+ }
3384
+ discharged.push({ file: relPath, kind });
3385
+ }
3386
+ return { open, discharged };
3387
+ }
3388
+ function renderNames(commands, relPath) {
3389
+ const base = relPath.split("/").pop() ?? relPath;
3390
+ return commands.some((c) => {
3391
+ const slashed = c.split(path7.sep).join("/");
3392
+ const bounded = (needle) => new RegExp(`(^|[\\s/'"])${escapeRe(needle)}(\\s|$|['"])`).test(slashed);
3393
+ return bounded(relPath) || bounded(base);
3394
+ });
3395
+ }
3396
+ function isPureRender(command) {
3397
+ if (!isAssetRenderCommand(command)) return false;
3398
+ const [head, ...pipes] = command.replace(/^\s*cd\s+[^;&|<>`$\n]+&&\s*/, "").replace(/\s\d?>&\d\b/g, " ").replace(/\s2>\s*\/dev\/null\b/g, " ").split("|");
3399
+ if (/[;&<>`\n]|\$\(/.test(head ?? "")) return false;
3400
+ return pipes.every((p) => /^\s*(tail|head|grep|jq|cat|less|wc)\b[^;&<>`|]*$/.test(p) && !/\$\(/.test(p));
3401
+ }
3402
+ function writesRenderDir(command) {
3403
+ if (isPureRender(command)) return false;
3404
+ const slashed = command.split(path7.sep).join("/");
3405
+ const names = /(^|[\s/'"])(render\/|manifest\.json\b)/.test(slashed) || slashed.includes("state/render");
3406
+ 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(
3407
+ slashed.replace(/\s\d?>&\d\b/g, " ").replace(/\s2>\s*\/dev\/null\b/g, " ")
3408
+ );
3409
+ return names && writes;
3410
+ }
3411
+ function escapeRe(s) {
3412
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3413
+ }
3414
+ function openSvgObligation(workspaceRoot, toolCalls) {
3415
+ const lastEditOf = /* @__PURE__ */ new Map();
3416
+ for (let i = 0; i < toolCalls.length; i += 1) {
3417
+ const c = toolCalls[i];
3418
+ if (!EDIT_TOOLS.has(c.name) || c.path === void 0) continue;
3419
+ lastEditOf.set(c.path, i);
3420
+ }
3421
+ if (lastEditOf.size === 0) return null;
3422
+ const edits = [...lastEditOf].map(([p, at]) => {
3423
+ const rendered = [];
3424
+ for (let i = at + 1; i < toolCalls.length; i += 1) {
3425
+ const c = toolCalls[i];
3426
+ if (c.name === "Bash" && c.command !== void 0 && isPureRender(c.command)) {
3427
+ rendered.push(c.command);
3428
+ }
3429
+ }
3430
+ return { path: p, rendered };
3431
+ });
3432
+ const renderDir = RENDER_REL.split(path7.sep).join("/");
3433
+ const renderDirTampered = toolCalls.some((c) => {
3434
+ if (EDIT_TOOLS.has(c.name) && c.path !== void 0) {
3435
+ return rel(workspaceRoot, c.path).startsWith(`${renderDir}/`);
3436
+ }
3437
+ return c.name === "Bash" && c.command !== void 0 && writesRenderDir(c.command);
3438
+ });
3439
+ let reading;
3440
+ try {
3441
+ reading = readSvgObligations(workspaceRoot, { edits, renderDirTampered });
3442
+ } catch {
3443
+ return null;
3444
+ }
3445
+ const first = reading.open[0];
3446
+ if (first === void 0) return null;
3447
+ const more = reading.open.length > 1 ? ` (and ${String(reading.open.length - 1)} more)` : "";
3448
+ return {
3449
+ // Reported under `verification` rather than a seventh detector id: it
3450
+ // IS a verification finding — a file changed and nothing that can fail
3451
+ // ran over it — and a new id would ripple through DETECTOR_IDS, the
3452
+ // per-detector counters and the demotion contract for a distinction the
3453
+ // operator never makes.
3454
+ detector: "verification",
3455
+ mode: "transcript",
3456
+ evidence: first.file,
3457
+ 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.`
3458
+ };
3459
+ }
3460
+
3281
3461
  // src/scripts/hooks/envelope.ts
3282
3462
  var ENVELOPE_KEYS = [
3283
3463
  "schema_version",
@@ -3333,9 +3513,9 @@ function unwrap(stdin_text, default_platform = "generic") {
3333
3513
  }
3334
3514
 
3335
3515
  // src/scripts/hooks/subagent_ledger_hook.ts
3336
- import * as crypto from "node:crypto";
3337
- import * as fs8 from "node:fs";
3338
- import * as path7 from "node:path";
3516
+ import * as crypto2 from "node:crypto";
3517
+ import * as fs9 from "node:fs";
3518
+ import * as path8 from "node:path";
3339
3519
  import { fileURLToPath as fileURLToPath4, pathToFileURL as pathToFileURL4 } from "node:url";
3340
3520
 
3341
3521
  // src/scripts/_lib/subagent_response.ts
@@ -3477,11 +3657,11 @@ var EXIT_CODES = Object.freeze([
3477
3657
  function isObject2(v) {
3478
3658
  return typeof v === "object" && v !== null && !Array.isArray(v);
3479
3659
  }
3480
- var LEDGER_DIR = path7.join("agents", "runtime", "state", "subagent-ledger");
3660
+ var LEDGER_DIR = path8.join("agents", "runtime", "state", "subagent-ledger");
3481
3661
  var OPEN_SUBDIR = "open";
3482
3662
  var OPEN_RECORD_TTL_MS = 24 * 60 * 60 * 1e3;
3483
3663
  function refFor(agentId) {
3484
- return crypto.createHash("sha256").update(agentId, "utf8").digest("hex").slice(0, 12);
3664
+ return crypto2.createHash("sha256").update(agentId, "utf8").digest("hex").slice(0, 12);
3485
3665
  }
3486
3666
  function unwrapPayload(envelope) {
3487
3667
  const inner = envelope["payload"];
@@ -3567,10 +3747,10 @@ function _jsonObjectCandidates(message) {
3567
3747
  return out;
3568
3748
  }
3569
3749
  function openDir(root) {
3570
- return path7.join(root, LEDGER_DIR, OPEN_SUBDIR);
3750
+ return path8.join(root, LEDGER_DIR, OPEN_SUBDIR);
3571
3751
  }
3572
3752
  function openFile(root, ref) {
3573
- return path7.join(openDir(root), `${ref}.json`);
3753
+ return path8.join(openDir(root), `${ref}.json`);
3574
3754
  }
3575
3755
  var DEPTH_BASES = /* @__PURE__ */ new Set(["observed", "asserted-parent", "assumed-root"]);
3576
3756
  function _asOpenRecord(value, expectedRef) {
@@ -3597,7 +3777,7 @@ function readOpenRecords(root) {
3597
3777
  const out = /* @__PURE__ */ new Map();
3598
3778
  let names;
3599
3779
  try {
3600
- names = fs8.readdirSync(openDir(root));
3780
+ names = fs9.readdirSync(openDir(root));
3601
3781
  } catch {
3602
3782
  return out;
3603
3783
  }
@@ -3605,7 +3785,7 @@ function readOpenRecords(root) {
3605
3785
  if (!name.endsWith(".json")) continue;
3606
3786
  const expectedRef = name.slice(0, -".json".length);
3607
3787
  try {
3608
- const raw = fs8.readFileSync(path7.join(openDir(root), name), "utf8");
3788
+ const raw = fs9.readFileSync(path8.join(openDir(root), name), "utf8");
3609
3789
  const rec = _asOpenRecord(JSON.parse(raw), expectedRef);
3610
3790
  if (rec) out.set(rec.ref, rec);
3611
3791
  } catch {
@@ -3620,13 +3800,13 @@ function resolveDepth(parentRef, open) {
3620
3800
  return { depth: parent.depth + 1, depth_basis: "observed" };
3621
3801
  }
3622
3802
  function ledgerFileFor2(root, ts) {
3623
- return path7.join(root, LEDGER_DIR, `${ts.slice(0, 7)}.jsonl`);
3803
+ return path8.join(root, LEDGER_DIR, `${ts.slice(0, 7)}.jsonl`);
3624
3804
  }
3625
3805
  function appendLedgerLine(root, ts, line) {
3626
3806
  if (is_replay_mode()) return;
3627
3807
  const file = ledgerFileFor2(root, ts);
3628
- fs8.mkdirSync(path7.dirname(file), { recursive: true });
3629
- fs8.appendFileSync(file, `${JSON.stringify(line)}
3808
+ fs9.mkdirSync(path8.dirname(file), { recursive: true });
3809
+ fs9.appendFileSync(file, `${JSON.stringify(line)}
3630
3810
  `, "utf8");
3631
3811
  }
3632
3812
  var WALL_CLOCK_ARMS_MS = [
@@ -3640,7 +3820,7 @@ function armsExceeded(elapsedMs) {
3640
3820
  return WALL_CLOCK_ARMS_MS.filter((a) => elapsedMs >= a.ms).map((a) => a.label);
3641
3821
  }
3642
3822
  function openRecordStats(root, nowMs = Date.now()) {
3643
- const ledgerPresent = fs8.existsSync(path7.join(root, LEDGER_DIR));
3823
+ const ledgerPresent = fs9.existsSync(path8.join(root, LEDGER_DIR));
3644
3824
  const open = readOpenRecords(root);
3645
3825
  let maxDepth = 0;
3646
3826
  let counted = 0;
@@ -3668,13 +3848,13 @@ function writeOpenRecord(root, rec) {
3668
3848
  function removeOpenRecord(root, ref) {
3669
3849
  if (is_replay_mode()) return;
3670
3850
  try {
3671
- fs8.unlinkSync(openFile(root, ref));
3851
+ fs9.unlinkSync(openFile(root, ref));
3672
3852
  } catch {
3673
3853
  }
3674
3854
  }
3675
3855
  function countOpen(root) {
3676
3856
  try {
3677
- return fs8.readdirSync(openDir(root)).filter((n) => n.endsWith(".json")).length;
3857
+ return fs9.readdirSync(openDir(root)).filter((n) => n.endsWith(".json")).length;
3678
3858
  } catch {
3679
3859
  return 0;
3680
3860
  }
@@ -3840,10 +4020,10 @@ function _isCliEntry4() {
3840
4020
  return false;
3841
4021
  }
3842
4022
  if (process.argv[1] === void 0) return false;
3843
- const argvUrl = pathToFileURL4(path7.resolve(process.argv[1])).href;
4023
+ const argvUrl = pathToFileURL4(path8.resolve(process.argv[1])).href;
3844
4024
  if (import.meta.url === argvUrl) return true;
3845
4025
  try {
3846
- return fs8.realpathSync(fileURLToPath4(import.meta.url)) === fs8.realpathSync(path7.resolve(process.argv[1]));
4026
+ return fs9.realpathSync(fileURLToPath4(import.meta.url)) === fs9.realpathSync(path8.resolve(process.argv[1]));
3847
4027
  } catch {
3848
4028
  return false;
3849
4029
  }
@@ -3851,20 +4031,20 @@ function _isCliEntry4() {
3851
4031
  if (_isCliEntry4()) process.exit(main4());
3852
4032
 
3853
4033
  // src/scripts/_lib/turn_end_transcript.ts
3854
- import * as fs11 from "node:fs";
4034
+ import * as fs12 from "node:fs";
3855
4035
 
3856
4036
  // src/scripts/hooks/end_review_nudge_hook.ts
3857
4037
  import { spawnSync as spawnSync2 } from "node:child_process";
3858
- import * as crypto2 from "node:crypto";
3859
- import * as fs10 from "node:fs";
4038
+ import * as crypto3 from "node:crypto";
4039
+ import * as fs11 from "node:fs";
3860
4040
  import * as os from "node:os";
3861
- import * as path9 from "node:path";
4041
+ import * as path10 from "node:path";
3862
4042
  import { fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL5 } from "node:url";
3863
4043
 
3864
4044
  // src/scripts/_lib/review_baseline.ts
3865
4045
  import { spawnSync } from "node:child_process";
3866
- import * as fs9 from "node:fs";
3867
- import * as path8 from "node:path";
4046
+ import * as fs10 from "node:fs";
4047
+ import * as path9 from "node:path";
3868
4048
  function currentHeadSha(cwd) {
3869
4049
  try {
3870
4050
  const r = spawnSync("git", ["rev-parse", "HEAD"], { cwd, encoding: "utf8" });
@@ -3875,12 +4055,12 @@ function currentHeadSha(cwd) {
3875
4055
  return null;
3876
4056
  }
3877
4057
  }
3878
- var BASELINE_STATE_REL = path8.join("agents", "runtime", "state", "review-baseline");
4058
+ var BASELINE_STATE_REL = path9.join("agents", "runtime", "state", "review-baseline");
3879
4059
  function baselineStateDir(workspaceRoot) {
3880
- return path8.join(workspaceRoot, BASELINE_STATE_REL);
4060
+ return path9.join(workspaceRoot, BASELINE_STATE_REL);
3881
4061
  }
3882
4062
  function baselineStateFile(workspaceRoot, sessionKey) {
3883
- return path8.join(baselineStateDir(workspaceRoot), `${sessionKey}.json`);
4063
+ return path9.join(baselineStateDir(workspaceRoot), `${sessionKey}.json`);
3884
4064
  }
3885
4065
  function parseBaseline(raw) {
3886
4066
  let decoded;
@@ -3908,7 +4088,7 @@ function readBaseline(workspaceRoot, sessionKey) {
3908
4088
  const file = baselineStateFile(workspaceRoot, sessionKey);
3909
4089
  let raw;
3910
4090
  try {
3911
- raw = fs9.readFileSync(file, "utf-8");
4091
+ raw = fs10.readFileSync(file, "utf-8");
3912
4092
  } catch (exc) {
3913
4093
  const code = exc?.code;
3914
4094
  return code === "ENOENT" ? "absent" : "unreadable";
@@ -4018,13 +4198,13 @@ function isSafeTranscriptPath(rawPath, opts = {}) {
4018
4198
  const homeDir = opts.homeDir ?? os.homedir();
4019
4199
  const maxBytes = opts.maxBytes ?? TRANSCRIPT_SCAN_MAX_BYTES;
4020
4200
  try {
4021
- const realHome = fs10.realpathSync(homeDir);
4022
- const realPath = fs10.realpathSync(rawPath);
4023
- const relative5 = path9.relative(realHome, realPath);
4024
- if (relative5 === "" || relative5.startsWith("..") || path9.isAbsolute(relative5)) {
4201
+ const realHome = fs11.realpathSync(homeDir);
4202
+ const realPath = fs11.realpathSync(rawPath);
4203
+ const relative6 = path10.relative(realHome, realPath);
4204
+ if (relative6 === "" || relative6.startsWith("..") || path10.isAbsolute(relative6)) {
4025
4205
  return false;
4026
4206
  }
4027
- const { size } = fs10.statSync(realPath);
4207
+ const { size } = fs11.statSync(realPath);
4028
4208
  return size <= maxBytes;
4029
4209
  } catch {
4030
4210
  return false;
@@ -4082,13 +4262,13 @@ var BINARY_PROBE_BYTES = 8e3;
4082
4262
  var UNTRACKED_FILE_READ_CAP_BYTES = 8 * 1024 * 1024;
4083
4263
  function untrackedFileLineCount(cwd, relPath) {
4084
4264
  try {
4085
- const abs = path9.resolve(cwd, relPath);
4086
- const size = fs10.statSync(abs).size;
4265
+ const abs = path10.resolve(cwd, relPath);
4266
+ const size = fs11.statSync(abs).size;
4087
4267
  if (size === 0) return 0;
4088
4268
  if (size > UNTRACKED_FILE_READ_CAP_BYTES) {
4089
4269
  return MUTATION_LINE_THRESHOLD + 1;
4090
4270
  }
4091
- const buf = fs10.readFileSync(abs);
4271
+ const buf = fs11.readFileSync(abs);
4092
4272
  if (buf.length === 0) return 0;
4093
4273
  const probe = buf.subarray(0, Math.min(buf.length, BINARY_PROBE_BYTES));
4094
4274
  if (probe.includes(0)) return 0;
@@ -4174,33 +4354,33 @@ function appendReviewSkippedTelemetry(workspaceRoot, diffLines, mutationMeasure,
4174
4354
  diff_lines: diffLines,
4175
4355
  mutation_measure: mutationMeasure,
4176
4356
  ts,
4177
- id: crypto2.randomUUID(),
4357
+ id: crypto3.randomUUID(),
4178
4358
  baseline
4179
4359
  });
4180
4360
  if (errors.length || line === null) return;
4181
4361
  try {
4182
- const dir = path9.join(workspaceRoot, "agents", "runtime", "state", "audit");
4183
- fs10.mkdirSync(dir, { recursive: true });
4184
- const file = path9.join(dir, `${ts.slice(0, 7)}.jsonl`);
4185
- fs10.appendFileSync(file, `${JSON.stringify(line)}
4362
+ const dir = path10.join(workspaceRoot, "agents", "runtime", "state", "audit");
4363
+ fs11.mkdirSync(dir, { recursive: true });
4364
+ const file = path10.join(dir, `${ts.slice(0, 7)}.jsonl`);
4365
+ fs11.appendFileSync(file, `${JSON.stringify(line)}
4186
4366
  `, "utf8");
4187
4367
  } catch {
4188
4368
  }
4189
4369
  }
4190
4370
  function sessionStateDir(workspaceRoot) {
4191
- return path9.join(workspaceRoot, "agents", "runtime", "state", "end-review-nudge");
4371
+ return path10.join(workspaceRoot, "agents", "runtime", "state", "end-review-nudge");
4192
4372
  }
4193
4373
  function sessionStateFile(workspaceRoot, sessionKey) {
4194
- return path9.join(sessionStateDir(workspaceRoot), `${sessionKey}.json`);
4374
+ return path10.join(sessionStateDir(workspaceRoot), `${sessionKey}.json`);
4195
4375
  }
4196
4376
  function deriveSessionKey2(envelope, payload) {
4197
4377
  const raw = str2(envelope["session_id"]) || str2(payload["transcript_path"] ?? payload["transcriptPath"]);
4198
4378
  const material = raw || "unknown-session";
4199
- return crypto2.createHash("sha256").update(material).digest("hex");
4379
+ return crypto3.createHash("sha256").update(material).digest("hex");
4200
4380
  }
4201
4381
  function hasFiredThisSession(workspaceRoot, sessionKey) {
4202
4382
  try {
4203
- return fs10.existsSync(sessionStateFile(workspaceRoot, sessionKey));
4383
+ return fs11.existsSync(sessionStateFile(workspaceRoot, sessionKey));
4204
4384
  } catch {
4205
4385
  return false;
4206
4386
  }
@@ -4262,7 +4442,7 @@ function main5() {
4262
4442
  let reviewerRan = false;
4263
4443
  if (transcriptPath && isSafeTranscriptPath(transcriptPath)) {
4264
4444
  try {
4265
- reviewerRan = scanTranscriptForReviewer(fs10.readFileSync(transcriptPath, "utf-8"));
4445
+ reviewerRan = scanTranscriptForReviewer(fs11.readFileSync(transcriptPath, "utf-8"));
4266
4446
  } catch {
4267
4447
  reviewerRan = false;
4268
4448
  }
@@ -4297,13 +4477,13 @@ function _isCliEntry5() {
4297
4477
  if (process.argv[1] === void 0) {
4298
4478
  return false;
4299
4479
  }
4300
- const argvUrl = pathToFileURL5(path9.resolve(process.argv[1])).href;
4480
+ const argvUrl = pathToFileURL5(path10.resolve(process.argv[1])).href;
4301
4481
  if (import.meta.url === argvUrl) {
4302
4482
  return true;
4303
4483
  }
4304
4484
  try {
4305
- const here = fs10.realpathSync(fileURLToPath5(import.meta.url));
4306
- const argv = fs10.realpathSync(path9.resolve(process.argv[1]));
4485
+ const here = fs11.realpathSync(fileURLToPath5(import.meta.url));
4486
+ const argv = fs11.realpathSync(path10.resolve(process.argv[1]));
4307
4487
  return here === argv;
4308
4488
  } catch {
4309
4489
  return false;
@@ -4324,10 +4504,10 @@ function readTranscriptTail(transcriptPath, opts = {}) {
4324
4504
  if (!transcriptPath || !isSafeTranscriptPath(transcriptPath, opts)) return empty;
4325
4505
  let lines;
4326
4506
  try {
4327
- if (opts.maxBytes !== void 0 && fs11.statSync(transcriptPath).size > opts.maxBytes) {
4507
+ if (opts.maxBytes !== void 0 && fs12.statSync(transcriptPath).size > opts.maxBytes) {
4328
4508
  return empty;
4329
4509
  }
4330
- lines = fs11.readFileSync(transcriptPath, "utf-8").split("\n");
4510
+ lines = fs12.readFileSync(transcriptPath, "utf-8").split("\n");
4331
4511
  } catch {
4332
4512
  return empty;
4333
4513
  }
@@ -4514,7 +4694,7 @@ function detectPromissory(reply) {
4514
4694
  function readCiSettled(workspaceRoot, session_id) {
4515
4695
  if (!hasStableSessionId(session_id)) return { seen: false, settled: false };
4516
4696
  try {
4517
- const raw = fs12.readFileSync(path10.join(workspaceRoot, statePathFor(session_id)), "utf-8");
4697
+ const raw = fs13.readFileSync(path11.join(workspaceRoot, statePathFor(session_id)), "utf-8");
4518
4698
  const decoded = JSON.parse(raw);
4519
4699
  if (!owns_session_state(decoded, session_id)) return { seen: false, settled: false };
4520
4700
  if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
@@ -4550,8 +4730,8 @@ function detectCompletionClaim(reply, ci) {
4550
4730
  function readLanguagePin(workspaceRoot, session_id) {
4551
4731
  if (!hasStableSessionId(session_id)) return "und";
4552
4732
  try {
4553
- const raw = fs12.readFileSync(
4554
- path10.join(workspaceRoot, statePathFor2(session_id)),
4733
+ const raw = fs13.readFileSync(
4734
+ path11.join(workspaceRoot, statePathFor2(session_id)),
4555
4735
  "utf-8"
4556
4736
  );
4557
4737
  const decoded = JSON.parse(raw);
@@ -4598,7 +4778,7 @@ function detectUnverifiedEdit(toolCalls, runState = null) {
4598
4778
  }
4599
4779
  for (let i = lastEdit + 1; i < toolCalls.length; i += 1) {
4600
4780
  const c = toolCalls[i];
4601
- if (c.name === "Bash" && c.command !== void 0 && isVerificationCommand(c.command)) {
4781
+ if (c.name === "Bash" && c.command !== void 0 && isVerificationAttempt(c.command)) {
4602
4782
  return null;
4603
4783
  }
4604
4784
  }
@@ -4607,7 +4787,7 @@ function detectUnverifiedEdit(toolCalls, runState = null) {
4607
4787
  // The path, never the diff: the evidence span is quoted into a refusal,
4608
4788
  // and `ToolCall` is shaped so a file body cannot reach it.
4609
4789
  evidence: edited,
4610
- 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)",
4790
+ 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)",
4611
4791
  mode: "transcript"
4612
4792
  };
4613
4793
  }
@@ -4660,7 +4840,7 @@ function sessionStateFile2(workspaceRoot, sessionKey) {
4660
4840
  }
4661
4841
  function alreadyRefusedTurn(workspaceRoot, sessionKey, turnOrdinal) {
4662
4842
  try {
4663
- const raw = fs12.readFileSync(sessionStateFile2(workspaceRoot, sessionKey), "utf-8");
4843
+ const raw = fs13.readFileSync(sessionStateFile2(workspaceRoot, sessionKey), "utf-8");
4664
4844
  const decoded = JSON.parse(raw);
4665
4845
  if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
4666
4846
  return decoded["refused_turn"] === turnOrdinal;
@@ -4674,7 +4854,7 @@ function markRefusedTurn(workspaceRoot, sessionKey, turnOrdinal, detectors, prom
4674
4854
  const file = sessionStateFile2(workspaceRoot, sessionKey);
4675
4855
  let prev = null;
4676
4856
  try {
4677
- prev = parseRecord(fs12.readFileSync(file, "utf-8"));
4857
+ prev = parseRecord(fs13.readFileSync(file, "utf-8"));
4678
4858
  } catch {
4679
4859
  }
4680
4860
  let version;
@@ -4771,6 +4951,7 @@ function runDetectors(inputs) {
4771
4951
  // on a completion CLAIM, and a turn waiting on a subagent has not
4772
4952
  // finished — so its closing is not the claim F is about. Same slot,
4773
4953
  // opposite trigger, opposite treatment of `dispatchOpen`.
4954
+ openSvgObligation(workspaceRoot, toolCalls),
4774
4955
  dispatchOpen ? null : detectUntestedChange(lastAssistant, toolCalls, runState)
4775
4956
  ]) {
4776
4957
  if (f) findings.push(f);
@@ -4815,7 +4996,7 @@ function recordShadow(inputs, layer) {
4815
4996
  const file = sessionShadowFile(inputs.workspaceRoot, inputs.sessionKey);
4816
4997
  let prev = null;
4817
4998
  try {
4818
- prev = parseShadowRecord(fs12.readFileSync(file, "utf-8"));
4999
+ prev = parseShadowRecord(fs13.readFileSync(file, "utf-8"));
4819
5000
  } catch {
4820
5001
  }
4821
5002
  atomic_write_json(
@@ -4883,13 +5064,13 @@ function _isCliEntry6() {
4883
5064
  if (process.argv[1] === void 0) {
4884
5065
  return false;
4885
5066
  }
4886
- const argvUrl = pathToFileURL6(path10.resolve(process.argv[1])).href;
5067
+ const argvUrl = pathToFileURL6(path11.resolve(process.argv[1])).href;
4887
5068
  if (import.meta.url === argvUrl) {
4888
5069
  return true;
4889
5070
  }
4890
5071
  try {
4891
- const here = fs12.realpathSync(fileURLToPath6(import.meta.url));
4892
- const argv = fs12.realpathSync(path10.resolve(process.argv[1]));
5072
+ const here = fs13.realpathSync(fileURLToPath6(import.meta.url));
5073
+ const argv = fs13.realpathSync(path11.resolve(process.argv[1]));
4893
5074
  return here === argv;
4894
5075
  } catch {
4895
5076
  return false;
@@ -4901,9 +5082,9 @@ if (_isCliEntry6()) {
4901
5082
 
4902
5083
  // src/scripts/hooks/evidence_independence.ts
4903
5084
  import { spawnSync as spawnSync3 } from "node:child_process";
4904
- import crypto3 from "node:crypto";
4905
- import fs13 from "node:fs";
4906
- import path11 from "node:path";
5085
+ import crypto4 from "node:crypto";
5086
+ import fs14 from "node:fs";
5087
+ import path12 from "node:path";
4907
5088
  import { fileURLToPath as fileURLToPath7, pathToFileURL as pathToFileURL7 } from "node:url";
4908
5089
 
4909
5090
  // src/scripts/_lib/test_delta.ts
@@ -4922,7 +5103,7 @@ function isTestPath(p) {
4922
5103
  }
4923
5104
 
4924
5105
  // src/scripts/hooks/evidence_independence.ts
4925
- var STATE_FILE3 = path11.join("agents", "state", "evidence-dispatch.json");
5106
+ var STATE_FILE3 = path12.join("agents", "state", "evidence-dispatch.json");
4926
5107
  function _isObject5(v) {
4927
5108
  return typeof v === "object" && v !== null && !Array.isArray(v);
4928
5109
  }
@@ -4990,8 +5171,8 @@ function extractDispatch(envelope) {
4990
5171
  }
4991
5172
  function _ledgerStamp(consumer_root, session_id) {
4992
5173
  try {
4993
- const raw = fs13.readFileSync(
4994
- path11.join(consumer_root, ledgerFileFor(session_id)),
5174
+ const raw = fs14.readFileSync(
5175
+ path12.join(consumer_root, ledgerFileFor(session_id)),
4995
5176
  "utf8"
4996
5177
  );
4997
5178
  const d = JSON.parse(raw);
@@ -5002,7 +5183,7 @@ function _ledgerStamp(consumer_root, session_id) {
5002
5183
  }
5003
5184
  function _load(target) {
5004
5185
  try {
5005
- const decoded = JSON.parse(fs13.readFileSync(target, "utf8"));
5186
+ const decoded = JSON.parse(fs14.readFileSync(target, "utf8"));
5006
5187
  if (_isObject5(decoded) && Array.isArray(decoded["evaluations"])) {
5007
5188
  return decoded;
5008
5189
  }
@@ -5086,7 +5267,7 @@ function run3(stdin_text, options) {
5086
5267
  return EXIT_ALLOW3;
5087
5268
  }
5088
5269
  }
5089
- const target = path11.join(options.consumer_root, STATE_FILE3);
5270
+ const target = path12.join(options.consumer_root, STATE_FILE3);
5090
5271
  const state = _load(target);
5091
5272
  const session_id = typeof envelope["session_id"] === "string" ? envelope["session_id"] : "";
5092
5273
  const turnMarker = `${session_id}:${_ledgerStamp(options.consumer_root, session_id)}`;
@@ -5109,7 +5290,7 @@ function run3(stdin_text, options) {
5109
5290
  if (decision.evaluations > state.evaluations.length) {
5110
5291
  state.evaluations.push({
5111
5292
  at: (/* @__PURE__ */ new Date()).toISOString(),
5112
- digest: crypto3.createHash("sha256").update(prompt).digest("hex").slice(0, 16),
5293
+ digest: crypto4.createHash("sha256").update(prompt).digest("hex").slice(0, 16),
5113
5294
  prompt_chars: prompt.length
5114
5295
  });
5115
5296
  try {
@@ -5154,13 +5335,13 @@ function _isCliEntry7() {
5154
5335
  if (process.argv[1] === void 0) {
5155
5336
  return false;
5156
5337
  }
5157
- const argvUrl = pathToFileURL7(path11.resolve(process.argv[1])).href;
5338
+ const argvUrl = pathToFileURL7(path12.resolve(process.argv[1])).href;
5158
5339
  if (import.meta.url === argvUrl) {
5159
5340
  return true;
5160
5341
  }
5161
5342
  try {
5162
- const here = fs13.realpathSync(fileURLToPath7(import.meta.url));
5163
- const argv = fs13.realpathSync(path11.resolve(process.argv[1]));
5343
+ const here = fs14.realpathSync(fileURLToPath7(import.meta.url));
5344
+ const argv = fs14.realpathSync(path12.resolve(process.argv[1]));
5164
5345
  return here === argv;
5165
5346
  } catch {
5166
5347
  return false;
@@ -5171,8 +5352,8 @@ if (_isCliEntry7()) {
5171
5352
  }
5172
5353
 
5173
5354
  // src/scripts/hooks/delegation_nudge_hook.ts
5174
- import fs14 from "node:fs";
5175
- import path12 from "node:path";
5355
+ import fs15 from "node:fs";
5356
+ import path13 from "node:path";
5176
5357
  import { fileURLToPath as fileURLToPath8, pathToFileURL as pathToFileURL8 } from "node:url";
5177
5358
 
5178
5359
  // src/scripts/_lib/auto_dispatch.ts
@@ -5671,13 +5852,13 @@ function _isCliEntry8() {
5671
5852
  if (process.argv[1] === void 0) {
5672
5853
  return false;
5673
5854
  }
5674
- const argvUrl = pathToFileURL8(path12.resolve(process.argv[1])).href;
5855
+ const argvUrl = pathToFileURL8(path13.resolve(process.argv[1])).href;
5675
5856
  if (import.meta.url === argvUrl) {
5676
5857
  return true;
5677
5858
  }
5678
5859
  try {
5679
- const here = fs14.realpathSync(fileURLToPath8(import.meta.url));
5680
- const argv = fs14.realpathSync(path12.resolve(process.argv[1]));
5860
+ const here = fs15.realpathSync(fileURLToPath8(import.meta.url));
5861
+ const argv = fs15.realpathSync(path13.resolve(process.argv[1]));
5681
5862
  return here === argv;
5682
5863
  } catch {
5683
5864
  return false;
@@ -5688,7 +5869,7 @@ if (_isCliEntry8()) {
5688
5869
  }
5689
5870
 
5690
5871
  // src/scripts/conformance_scan.ts
5691
- var REPO_ROOT = path13.resolve(path13.dirname(fileURLToPath9(import.meta.url)), "..", "..");
5872
+ var REPO_ROOT = path14.resolve(path14.dirname(fileURLToPath9(import.meta.url)), "..", "..");
5692
5873
  var OBSERVED_BAND = { low: 9.1, high: 39.2 };
5693
5874
  var BAND_MIN_TURNS = 1978;
5694
5875
  var CARRIER_CHANGES = [
@@ -6054,7 +6235,7 @@ function scanSession(sessionId, lines) {
6054
6235
  closeWindow();
6055
6236
  return report;
6056
6237
  }
6057
- var DEFAULT_RATE_SERIES = path13.join(
6238
+ var DEFAULT_RATE_SERIES = path14.join(
6058
6239
  REPO_ROOT,
6059
6240
  "agents",
6060
6241
  "runtime",
@@ -6063,7 +6244,7 @@ var DEFAULT_RATE_SERIES = path13.join(
6063
6244
  );
6064
6245
  function defaultStore(projectDir) {
6065
6246
  const slug = projectStoreSlug(projectDir);
6066
- return path13.join(process.env["HOME"] ?? "", ".claude", "projects", slug);
6247
+ return path14.join(process.env["HOME"] ?? "", ".claude", "projects", slug);
6067
6248
  }
6068
6249
  function _tokens(chars) {
6069
6250
  return Math.round(chars / 4);
@@ -6074,13 +6255,13 @@ function measureDelivered(projectRulesDir, globalRulesDir) {
6074
6255
  return {
6075
6256
  project: {
6076
6257
  dir: projectRulesDir,
6077
- present: fs15.existsSync(projectRulesDir),
6258
+ present: fs16.existsSync(projectRulesDir),
6078
6259
  files: p.files,
6079
6260
  tokens: _tokens(p.chars)
6080
6261
  },
6081
6262
  global: {
6082
6263
  dir: globalRulesDir,
6083
- present: fs15.existsSync(globalRulesDir),
6264
+ present: fs16.existsSync(globalRulesDir),
6084
6265
  files: g.files,
6085
6266
  tokens: _tokens(g.chars)
6086
6267
  },
@@ -6088,13 +6269,13 @@ function measureDelivered(projectRulesDir, globalRulesDir) {
6088
6269
  };
6089
6270
  }
6090
6271
  function storeKey(store) {
6091
- return createHash4("sha256").update(path13.resolve(store)).digest("hex").slice(0, 12);
6272
+ return createHash5("sha256").update(path14.resolve(store)).digest("hex").slice(0, 12);
6092
6273
  }
6093
6274
  function scanStore(store, limit) {
6094
- const files = fs15.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ f, m: fs15.statSync(path13.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.f);
6275
+ const files = fs16.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ f, m: fs16.statSync(path14.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.f);
6095
6276
  const per_session = [];
6096
6277
  for (const f of files) {
6097
- const lines = fs15.readFileSync(path13.join(store, f), "utf8").split("\n");
6278
+ const lines = fs16.readFileSync(path14.join(store, f), "utf8").split("\n");
6098
6279
  const r = scanSession(f.replace(/\.jsonl$/, "").slice(0, 8), lines);
6099
6280
  if (r.assistant_turns > 0) {
6100
6281
  per_session.push(r);
@@ -6122,10 +6303,10 @@ function scanStore(store, limit) {
6122
6303
  const task_completeness_rate_pct = completeness_windows === 0 ? 0 : Number((100 * task_completeness / completeness_windows).toFixed(1));
6123
6304
  const era = spansCarrierChange(per_session.map((s) => s.first_at));
6124
6305
  const delivered = measureDelivered(
6125
- path13.join(REPO_ROOT, ".claude", "rules"),
6126
- path13.join(process.env["HOME"] ?? os2.homedir(), ".claude", "rules")
6306
+ path14.join(REPO_ROOT, ".claude", "rules"),
6307
+ path14.join(process.env["HOME"] ?? os2.homedir(), ".claude", "rules")
6127
6308
  );
6128
- const ownStore = path13.resolve(store) === path13.resolve(defaultStore(REPO_ROOT));
6309
+ const ownStore = path14.resolve(store) === path14.resolve(defaultStore(REPO_ROOT));
6129
6310
  return {
6130
6311
  scanned_at: (/* @__PURE__ */ new Date()).toISOString(),
6131
6312
  store,
@@ -6155,8 +6336,8 @@ function scanStore(store, limit) {
6155
6336
  };
6156
6337
  }
6157
6338
  function recordRate(file, scanned_at, rate) {
6158
- fs15.mkdirSync(path13.dirname(file), { recursive: true });
6159
- fs15.appendFileSync(file, `${JSON.stringify({ measured_at: scanned_at, ...rate })}
6339
+ fs16.mkdirSync(path14.dirname(file), { recursive: true });
6340
+ fs16.appendFileSync(file, `${JSON.stringify({ measured_at: scanned_at, ...rate })}
6160
6341
  `, "utf8");
6161
6342
  }
6162
6343
  function render(report) {
@@ -6287,14 +6468,14 @@ function main9(argv) {
6287
6468
  return 2;
6288
6469
  }
6289
6470
  const resolved = store ?? defaultStore(process.cwd());
6290
- if (!fs15.existsSync(resolved)) {
6471
+ if (!fs16.existsSync(resolved)) {
6291
6472
  process.stderr.write(`conformance:behavior: no transcript store at ${resolved}
6292
6473
  `);
6293
6474
  return 1;
6294
6475
  }
6295
6476
  const report = scanStore(resolved, Number.isFinite(limit) && limit > 0 ? limit : 30);
6296
6477
  if (out) {
6297
- fs15.writeFileSync(out, `${JSON.stringify(report, null, 2)}
6478
+ fs16.writeFileSync(out, `${JSON.stringify(report, null, 2)}
6298
6479
  `, "utf8");
6299
6480
  }
6300
6481
  if (record) {
@@ -6302,7 +6483,7 @@ function main9(argv) {
6302
6483
  }
6303
6484
  if (why !== null) {
6304
6485
  const id = why;
6305
- fs15.writeSync(
6486
+ fs16.writeSync(
6306
6487
  1,
6307
6488
  json ? `${JSON.stringify(
6308
6489
  {
@@ -6322,7 +6503,7 @@ function main9(argv) {
6322
6503
  );
6323
6504
  return 0;
6324
6505
  }
6325
- fs15.writeSync(1, json ? `${JSON.stringify(report, null, 2)}
6506
+ fs16.writeSync(1, json ? `${JSON.stringify(report, null, 2)}
6326
6507
  ` : `${render(report)}
6327
6508
  `);
6328
6509
  return 0;
@@ -6334,13 +6515,13 @@ function _isCliEntry9() {
6334
6515
  if (process.argv[1] === void 0) {
6335
6516
  return false;
6336
6517
  }
6337
- const argvUrl = pathToFileURL9(path13.resolve(process.argv[1])).href;
6518
+ const argvUrl = pathToFileURL9(path14.resolve(process.argv[1])).href;
6338
6519
  if (import.meta.url === argvUrl) {
6339
6520
  return true;
6340
6521
  }
6341
6522
  try {
6342
- const here = fs15.realpathSync(fileURLToPath9(import.meta.url));
6343
- const argv = fs15.realpathSync(path13.resolve(process.argv[1]));
6523
+ const here = fs16.realpathSync(fileURLToPath9(import.meta.url));
6524
+ const argv = fs16.realpathSync(path14.resolve(process.argv[1]));
6344
6525
  return here === argv;
6345
6526
  } catch {
6346
6527
  return false;
@@ -6351,19 +6532,19 @@ if (_isCliEntry9()) {
6351
6532
  }
6352
6533
 
6353
6534
  // src/scripts/report_carrier_divergence.ts
6354
- import * as fs16 from "node:fs";
6535
+ import * as fs17 from "node:fs";
6355
6536
  import * as os3 from "node:os";
6356
- import * as path14 from "node:path";
6537
+ import * as path15 from "node:path";
6357
6538
  import process2 from "node:process";
6358
6539
  import { fileURLToPath as fileURLToPath10, pathToFileURL as pathToFileURL10 } from "node:url";
6359
6540
  var _HERE2 = fileURLToPath10(import.meta.url);
6360
- var REPO_ROOT2 = path14.resolve(path14.dirname(_HERE2), "..", "..");
6361
- var PROJECT_RULES = path14.join(".claude", "rules");
6362
- var PROJECTION_SOURCE = path14.join("dist", "agent-src", "rules");
6363
- var GLOBAL_RULES = path14.join(".claude", "rules");
6541
+ var REPO_ROOT2 = path15.resolve(path15.dirname(_HERE2), "..", "..");
6542
+ var PROJECT_RULES = path15.join(".claude", "rules");
6543
+ var PROJECTION_SOURCE = path15.join("dist", "agent-src", "rules");
6544
+ var GLOBAL_RULES = path15.join(".claude", "rules");
6364
6545
  function _listRules(dir) {
6365
6546
  try {
6366
- return fs16.readdirSync(dir).filter((f) => f.endsWith(".md")).sort();
6547
+ return fs17.readdirSync(dir).filter((f) => f.endsWith(".md")).sort();
6367
6548
  } catch {
6368
6549
  return [];
6369
6550
  }
@@ -6371,7 +6552,7 @@ function _listRules(dir) {
6371
6552
  function _ruleType(file) {
6372
6553
  let text;
6373
6554
  try {
6374
- text = fs16.readFileSync(file, "utf-8");
6555
+ text = fs17.readFileSync(file, "utf-8");
6375
6556
  } catch {
6376
6557
  return "";
6377
6558
  }
@@ -6382,8 +6563,8 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
6382
6563
  const out = {
6383
6564
  projectDir,
6384
6565
  globalDir,
6385
- globalPresent: fs16.existsSync(globalDir),
6386
- projectPresent: fs16.existsSync(projectDir),
6566
+ globalPresent: fs17.existsSync(globalDir),
6567
+ projectPresent: fs17.existsSync(projectDir),
6387
6568
  shared: 0,
6388
6569
  identical: [],
6389
6570
  provenanceOnly: [],
@@ -6406,7 +6587,7 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
6406
6587
  }
6407
6588
  if (!inP && inG) {
6408
6589
  out.globalOnly.push(rule);
6409
- if (sourceDir !== void 0 && _ruleType(path14.join(sourceDir, rule)) === "manual") {
6590
+ if (sourceDir !== void 0 && _ruleType(path15.join(sourceDir, rule)) === "manual") {
6410
6591
  out.manualOnlyGlobal.push(rule);
6411
6592
  }
6412
6593
  continue;
@@ -6416,8 +6597,8 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
6416
6597
  let projectCopy;
6417
6598
  let globalCopy;
6418
6599
  try {
6419
- projectCopy = fs16.readFileSync(path14.join(projectDir, rule));
6420
- globalCopy = fs16.readFileSync(path14.join(globalDir, rule));
6600
+ projectCopy = fs17.readFileSync(path15.join(projectDir, rule));
6601
+ globalCopy = fs17.readFileSync(path15.join(globalDir, rule));
6421
6602
  verdict = comparePair(projectCopy, globalCopy);
6422
6603
  } catch {
6423
6604
  out.shared -= 1;
@@ -6564,9 +6745,9 @@ function render2(d) {
6564
6745
  }
6565
6746
  function main10(argv) {
6566
6747
  const args = argv ?? process2.argv.slice(2);
6567
- let projectDir = path14.join(REPO_ROOT2, PROJECT_RULES);
6568
- let globalDir = path14.join(os3.homedir(), GLOBAL_RULES);
6569
- let sourceDir = path14.join(REPO_ROOT2, PROJECTION_SOURCE);
6748
+ let projectDir = path15.join(REPO_ROOT2, PROJECT_RULES);
6749
+ let globalDir = path15.join(os3.homedir(), GLOBAL_RULES);
6750
+ let sourceDir = path15.join(REPO_ROOT2, PROJECTION_SOURCE);
6570
6751
  const value = (i) => {
6571
6752
  const v = args[i + 1];
6572
6753
  return v === void 0 || v.startsWith("-") ? null : v;
@@ -6580,7 +6761,7 @@ function main10(argv) {
6580
6761
  `);
6581
6762
  return 1;
6582
6763
  }
6583
- const resolved = path14.resolve(v);
6764
+ const resolved = path15.resolve(v);
6584
6765
  if (a === "--project") projectDir = resolved;
6585
6766
  else if (a === "--global") globalDir = resolved;
6586
6767
  else sourceDir = resolved;
@@ -6602,9 +6783,9 @@ function main10(argv) {
6602
6783
  }
6603
6784
  function _isCliEntry10() {
6604
6785
  if (process2.argv[1] === void 0) return false;
6605
- if (import.meta.url === pathToFileURL10(path14.resolve(process2.argv[1])).href) return true;
6786
+ if (import.meta.url === pathToFileURL10(path15.resolve(process2.argv[1])).href) return true;
6606
6787
  try {
6607
- return fs16.realpathSync(_HERE2) === fs16.realpathSync(path14.resolve(process2.argv[1]));
6788
+ return fs17.realpathSync(_HERE2) === fs17.realpathSync(path15.resolve(process2.argv[1]));
6608
6789
  } catch {
6609
6790
  return false;
6610
6791
  }
@@ -6614,12 +6795,12 @@ if (_isCliEntry10()) {
6614
6795
  }
6615
6796
 
6616
6797
  // src/scripts/report_skill_activation.ts
6617
- import * as fs17 from "node:fs";
6798
+ import * as fs18 from "node:fs";
6618
6799
  import * as os4 from "node:os";
6619
- import * as path15 from "node:path";
6800
+ import * as path16 from "node:path";
6620
6801
  import { fileURLToPath as fileURLToPath11, pathToFileURL as pathToFileURL11 } from "node:url";
6621
6802
  var _HERE3 = fileURLToPath11(import.meta.url);
6622
- var REPO_ROOT3 = path15.resolve(path15.dirname(_HERE3), "..", "..");
6803
+ var REPO_ROOT3 = path16.resolve(path16.dirname(_HERE3), "..", "..");
6623
6804
  var SKILLS_ROOT = "src/skills";
6624
6805
  var TRIGGER_KEYS = ["triggers:", "trigger_description:", "file_pattern:", "path_prefix:"];
6625
6806
  var DETERMINISTIC_RE = /^\s*(?:[-*]\s*)?(?:\*\*)?(MUST|NEVER|ALWAYS)\b/m;
@@ -6630,25 +6811,25 @@ function censusSkills(root) {
6630
6811
  withTriggerCorpus: [],
6631
6812
  withDeterministicObligation: []
6632
6813
  };
6633
- if (!fs17.existsSync(root)) {
6814
+ if (!fs18.existsSync(root)) {
6634
6815
  return out;
6635
6816
  }
6636
- for (const entry of fs17.readdirSync(root, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
6817
+ for (const entry of fs18.readdirSync(root, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
6637
6818
  if (!entry.isDirectory()) {
6638
6819
  continue;
6639
6820
  }
6640
- const file = path15.join(root, entry.name, "SKILL.md");
6641
- if (!fs17.existsSync(file)) {
6821
+ const file = path16.join(root, entry.name, "SKILL.md");
6822
+ if (!fs18.existsSync(file)) {
6642
6823
  continue;
6643
6824
  }
6644
6825
  out.total += 1;
6645
- const text = fs17.readFileSync(file, "utf8");
6826
+ const text = fs18.readFileSync(file, "utf8");
6646
6827
  const fmEnd = text.startsWith("---") ? text.indexOf("\n---", 3) : -1;
6647
6828
  const fm = fmEnd === -1 ? "" : text.slice(0, fmEnd);
6648
6829
  if (TRIGGER_KEYS.some((k) => new RegExp(`^${k}`, "m").test(fm))) {
6649
6830
  out.withTriggerKey.push(entry.name);
6650
6831
  }
6651
- if (fs17.existsSync(path15.join(root, entry.name, "evals", "triggers.json"))) {
6832
+ if (fs18.existsSync(path16.join(root, entry.name, "evals", "triggers.json"))) {
6652
6833
  out.withTriggerCorpus.push(entry.name);
6653
6834
  }
6654
6835
  const body = fmEnd === -1 ? text : text.slice(fmEnd + 4);
@@ -6659,17 +6840,17 @@ function censusSkills(root) {
6659
6840
  return out;
6660
6841
  }
6661
6842
  function defaultStore2(cwd) {
6662
- return path15.join(os4.homedir(), ".claude", "projects", projectStoreSlug(cwd));
6843
+ return path16.join(os4.homedir(), ".claude", "projects", projectStoreSlug(cwd));
6663
6844
  }
6664
6845
  function measureUsage(store, limit) {
6665
6846
  const rep = { store, sessions: 0, assistantTurns: 0, invocations: 0, bySkill: {} };
6666
- if (!fs17.existsSync(store)) {
6847
+ if (!fs18.existsSync(store)) {
6667
6848
  return rep;
6668
6849
  }
6669
- const files = fs17.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => path15.join(store, f)).sort((a, b) => fs17.statSync(b).mtimeMs - fs17.statSync(a).mtimeMs).slice(0, limit);
6850
+ const files = fs18.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => path16.join(store, f)).sort((a, b) => fs18.statSync(b).mtimeMs - fs18.statSync(a).mtimeMs).slice(0, limit);
6670
6851
  rep.sessions = files.length;
6671
6852
  for (const file of files) {
6672
- for (const line of fs17.readFileSync(file, "utf8").split("\n")) {
6853
+ for (const line of fs18.readFileSync(file, "utf8").split("\n")) {
6673
6854
  if (!line.trim()) {
6674
6855
  continue;
6675
6856
  }
@@ -6742,15 +6923,15 @@ function buildRecord(census, usage, today) {
6742
6923
  assistant_turns: usage.reduce((a, u) => a + u.assistantTurns, 0),
6743
6924
  invocations: usage.reduce((a, u) => a + u.invocations, 0),
6744
6925
  distinct_skills_invoked: distinct.size,
6745
- stores: usage.map((u) => path15.basename(u.store))
6926
+ stores: usage.map((u) => path16.basename(u.store))
6746
6927
  };
6747
6928
  }
6748
6929
  function readRecord(repoRoot) {
6749
- const file = path15.join(repoRoot, RECORD_PATH);
6750
- if (!fs17.existsSync(file)) {
6930
+ const file = path16.join(repoRoot, RECORD_PATH);
6931
+ if (!fs18.existsSync(file)) {
6751
6932
  return null;
6752
6933
  }
6753
- return JSON.parse(fs17.readFileSync(file, "utf8"));
6934
+ return JSON.parse(fs18.readFileSync(file, "utf8"));
6754
6935
  }
6755
6936
  function render3(census, usage, published = null) {
6756
6937
  const lines = [];
@@ -6785,7 +6966,7 @@ function render3(census, usage, published = null) {
6785
6966
  }
6786
6967
  totalInv += u.invocations;
6787
6968
  lines.push(
6788
- ` ${path15.basename(u.store).slice(-38).padEnd(38)} sessions=${String(u.sessions).padStart(3)} asst=${String(u.assistantTurns).padStart(6)} Skill calls=${String(u.invocations).padStart(3)}`
6969
+ ` ${path16.basename(u.store).slice(-38).padEnd(38)} sessions=${String(u.sessions).padStart(3)} asst=${String(u.assistantTurns).padStart(6)} Skill calls=${String(u.invocations).padStart(3)}`
6789
6970
  );
6790
6971
  }
6791
6972
  lines.push("");
@@ -6889,7 +7070,7 @@ function main11(argv) {
6889
7070
  if (stores.length === 0) {
6890
7071
  stores.push(defaultStore2(REPO_ROOT3));
6891
7072
  }
6892
- const census = censusSkills(path15.join(root, SKILLS_ROOT));
7073
+ const census = censusSkills(path16.join(root, SKILLS_ROOT));
6893
7074
  const usage = stores.map((s) => measureUsage(s, limit));
6894
7075
  process.stdout.write(`${render3(census, usage, readRecord(root))}
6895
7076
  `);
@@ -6910,27 +7091,27 @@ function main11(argv) {
6910
7091
  return 1;
6911
7092
  }
6912
7093
  const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
6913
- const file = path15.join(root, RECORD_PATH);
6914
- fs17.mkdirSync(path15.dirname(file), { recursive: true });
6915
- fs17.writeFileSync(file, `${JSON.stringify(buildRecord(census, usage, today), null, 2)}
7094
+ const file = path16.join(root, RECORD_PATH);
7095
+ fs18.mkdirSync(path16.dirname(file), { recursive: true });
7096
+ fs18.writeFileSync(file, `${JSON.stringify(buildRecord(census, usage, today), null, 2)}
6916
7097
  `);
6917
7098
  process.stdout.write(`
6918
7099
  wrote ${RECORD_PATH} (measured ${today})
6919
7100
  `);
6920
7101
  return 0;
6921
7102
  }
6922
- if (process.argv[1] !== void 0 && import.meta.url === pathToFileURL11(path15.resolve(process.argv[1])).href) {
7103
+ if (process.argv[1] !== void 0 && import.meta.url === pathToFileURL11(path16.resolve(process.argv[1])).href) {
6923
7104
  process.exit(main11(process.argv.slice(2)));
6924
7105
  }
6925
7106
 
6926
7107
  // src/scripts/report_skill_obligation_violations.ts
6927
- import * as fs18 from "node:fs";
7108
+ import * as fs19 from "node:fs";
6928
7109
  import * as os5 from "node:os";
6929
- import * as path16 from "node:path";
7110
+ import * as path17 from "node:path";
6930
7111
  import process3 from "node:process";
6931
7112
  import { fileURLToPath as fileURLToPath12, pathToFileURL as pathToFileURL12 } from "node:url";
6932
7113
  var _HERE4 = fileURLToPath12(import.meta.url);
6933
- var REPO_ROOT4 = path16.resolve(path16.dirname(_HERE4), "..", "..");
7114
+ var REPO_ROOT4 = path17.resolve(path17.dirname(_HERE4), "..", "..");
6934
7115
  var OBLIGATION_LINE_RE = new RegExp(`${DETERMINISTIC_RE.source}.*`, "gm");
6935
7116
  var PATH_RE = /`([A-Za-z0-9_./-]*\/[A-Za-z0-9_.-]+\.[a-z]{2,6})`/g;
6936
7117
  var CMD_RE = /`([a-z][a-z0-9-]*(?: [a-z][a-z0-9:._-]*){1,3})`/g;
@@ -6968,7 +7149,7 @@ function _artefacts(line) {
6968
7149
  return out;
6969
7150
  }
6970
7151
  function extractObligations(repoRoot) {
6971
- const skillsRoot = path16.join(repoRoot, SKILLS_ROOT);
7152
+ const skillsRoot = path17.join(repoRoot, SKILLS_ROOT);
6972
7153
  const census = censusSkills(skillsRoot);
6973
7154
  const out = {
6974
7155
  skills: census.withDeterministicObligation,
@@ -6982,7 +7163,7 @@ function extractObligations(repoRoot) {
6982
7163
  for (const skill of census.withDeterministicObligation) {
6983
7164
  let text;
6984
7165
  try {
6985
- text = fs18.readFileSync(path16.join(skillsRoot, skill, "SKILL.md"), "utf-8");
7166
+ text = fs19.readFileSync(path17.join(skillsRoot, skill, "SKILL.md"), "utf-8");
6986
7167
  } catch {
6987
7168
  continue;
6988
7169
  }
@@ -7098,7 +7279,7 @@ function scanSessionForViolations(session, lines, forbidden, parsed) {
7098
7279
  return flags;
7099
7280
  }
7100
7281
  function defaultStore3(cwd) {
7101
- return path16.join(os5.homedir(), ".claude", "projects", projectStoreSlug(cwd));
7282
+ return path17.join(os5.homedir(), ".claude", "projects", projectStoreSlug(cwd));
7102
7283
  }
7103
7284
  function scanStore2(repoRoot, store, limit) {
7104
7285
  const census = extractObligations(repoRoot);
@@ -7111,14 +7292,14 @@ function scanStore2(repoRoot, store, limit) {
7111
7292
  };
7112
7293
  let files;
7113
7294
  try {
7114
- files = fs18.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ p: path16.join(store, f), m: fs18.statSync(path16.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.p);
7295
+ files = fs19.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ p: path17.join(store, f), m: fs19.statSync(path17.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.p);
7115
7296
  } catch {
7116
7297
  return report;
7117
7298
  }
7118
7299
  report.sessions = files.length;
7119
7300
  for (const file of files) {
7120
- const lines = fs18.readFileSync(file, "utf-8").split("\n");
7121
- const id = path16.basename(file).replace(/\.jsonl$/, "").slice(0, 8);
7301
+ const lines = fs19.readFileSync(file, "utf-8").split("\n");
7302
+ const id = path17.basename(file).replace(/\.jsonl$/, "").slice(0, 8);
7122
7303
  const entries = _parseSession(lines);
7123
7304
  if (loadedSkillsFrom(entries).size > 0) report.sessionsWithASkill += 1;
7124
7305
  report.flags.push(...scanSessionForViolations(id, lines, census.forbidden, entries));
@@ -7243,9 +7424,9 @@ function main12(argv) {
7243
7424
  }
7244
7425
  function _isCliEntry11() {
7245
7426
  if (process3.argv[1] === void 0) return false;
7246
- if (import.meta.url === pathToFileURL12(path16.resolve(process3.argv[1])).href) return true;
7427
+ if (import.meta.url === pathToFileURL12(path17.resolve(process3.argv[1])).href) return true;
7247
7428
  try {
7248
- return fs18.realpathSync(_HERE4) === fs18.realpathSync(path16.resolve(process3.argv[1]));
7429
+ return fs19.realpathSync(_HERE4) === fs19.realpathSync(path17.resolve(process3.argv[1]));
7249
7430
  } catch {
7250
7431
  return false;
7251
7432
  }
@@ -7256,20 +7437,20 @@ if (_isCliEntry11()) {
7256
7437
 
7257
7438
  // src/scripts/report_conformance_funnel.ts
7258
7439
  var _HERE5 = fileURLToPath13(import.meta.url);
7259
- var REPO_ROOT5 = path17.resolve(path17.dirname(_HERE5), "..", "..");
7440
+ var REPO_ROOT5 = path18.resolve(path18.dirname(_HERE5), "..", "..");
7260
7441
  function buildFunnel(opts = {}) {
7261
7442
  const repoRoot = opts.repoRoot ?? REPO_ROOT5;
7262
- const projectRulesDir = opts.projectRulesDir ?? path17.join(repoRoot, PROJECT_RULES);
7263
- const globalRulesDir = opts.globalRulesDir ?? path17.join(os6.homedir(), GLOBAL_RULES);
7264
- const sourceDir = opts.sourceDir ?? path17.join(repoRoot, PROJECTION_SOURCE);
7443
+ const projectRulesDir = opts.projectRulesDir ?? path18.join(repoRoot, PROJECT_RULES);
7444
+ const globalRulesDir = opts.globalRulesDir ?? path18.join(os6.homedir(), GLOBAL_RULES);
7445
+ const sourceDir = opts.sourceDir ?? path18.join(repoRoot, PROJECTION_SOURCE);
7265
7446
  const store = opts.store ?? defaultStore(repoRoot);
7266
7447
  const limit = opts.limit ?? 30;
7267
7448
  return {
7268
7449
  delivered: measureDelivered(projectRulesDir, globalRulesDir),
7269
7450
  divergence: compareCarriers(projectRulesDir, globalRulesDir, sourceDir),
7270
- skills: censusSkills(path17.join(repoRoot, SKILLS_ROOT)),
7451
+ skills: censusSkills(path18.join(repoRoot, SKILLS_ROOT)),
7271
7452
  usage: measureUsage(store, limit),
7272
- storePresent: fs19.existsSync(store),
7453
+ storePresent: fs20.existsSync(store),
7273
7454
  sk2: scanStore2(repoRoot, store, limit)
7274
7455
  };
7275
7456
  }
@@ -7410,7 +7591,7 @@ function main13(argv) {
7410
7591
  `);
7411
7592
  return 1;
7412
7593
  }
7413
- const resolved = path17.resolve(v);
7594
+ const resolved = path18.resolve(v);
7414
7595
  if (a === "--store") opts.store = resolved;
7415
7596
  else if (a === "--project") opts.projectRulesDir = resolved;
7416
7597
  else if (a === "--global") opts.globalRulesDir = resolved;
@@ -7442,9 +7623,9 @@ function main13(argv) {
7442
7623
  }
7443
7624
  function _isCliEntry12() {
7444
7625
  if (process4.argv[1] === void 0) return false;
7445
- if (import.meta.url === pathToFileURL13(path17.resolve(process4.argv[1])).href) return true;
7626
+ if (import.meta.url === pathToFileURL13(path18.resolve(process4.argv[1])).href) return true;
7446
7627
  try {
7447
- return fs19.realpathSync(_HERE5) === fs19.realpathSync(path17.resolve(process4.argv[1]));
7628
+ return fs20.realpathSync(_HERE5) === fs20.realpathSync(path18.resolve(process4.argv[1]));
7448
7629
  } catch {
7449
7630
  return false;
7450
7631
  }
@@ -7481,20 +7662,20 @@ function conformanceLogPath() {
7481
7662
  if (override && override.trim().length > 0) {
7482
7663
  return override;
7483
7664
  }
7484
- return path18.join(os7.homedir(), ".event4u", "agent-config", "conformance-log.jsonl");
7665
+ return path19.join(os7.homedir(), ".event4u", "agent-config", "conformance-log.jsonl");
7485
7666
  }
7486
7667
  function installLogPath() {
7487
7668
  const override = process5.env["AGENT_CONFIG_INSTALL_LOG"];
7488
7669
  if (override && override.trim().length > 0) {
7489
7670
  return override;
7490
7671
  }
7491
- return path18.join(os7.homedir(), ".event4u", "agent-config", "install-log.jsonl");
7672
+ return path19.join(os7.homedir(), ".event4u", "agent-config", "install-log.jsonl");
7492
7673
  }
7493
7674
  function _installLogExpected(projectRoot) {
7494
- return fs20.existsSync(manifest_path(projectRoot));
7675
+ return fs21.existsSync(manifest_path(projectRoot));
7495
7676
  }
7496
7677
  function _check_txlog_clean(logPath = installLogPath(), projectRoot = null) {
7497
- const entries = fs20.existsSync(logPath) ? readRecentEntries(logPath) : [];
7678
+ const entries = fs21.existsSync(logPath) ? readRecentEntries(logPath) : [];
7498
7679
  if (entries.length === 0) {
7499
7680
  if (projectRoot !== null && _installLogExpected(projectRoot)) {
7500
7681
  return {
@@ -7528,11 +7709,11 @@ function _check_txlog_clean(logPath = installLogPath(), projectRoot = null) {
7528
7709
  };
7529
7710
  }
7530
7711
  function routeTargetPaths(target) {
7531
- return routeTargetPathsPosix(target).map((rel) => path18.join(...rel.split("/")));
7712
+ return routeTargetPathsPosix(target).map((rel2) => path19.join(...rel2.split("/")));
7532
7713
  }
7533
7714
  function _check_router_pointers(packageRoot = PACKAGE_ROOT) {
7534
- const routerPath = path18.join(packageRoot, "dist", "router.json");
7535
- if (!fs20.existsSync(routerPath)) {
7715
+ const routerPath = path19.join(packageRoot, "dist", "router.json");
7716
+ if (!fs21.existsSync(routerPath)) {
7536
7717
  return {
7537
7718
  id: "router-pointers",
7538
7719
  status: "fail",
@@ -7542,7 +7723,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT) {
7542
7723
  }
7543
7724
  let router;
7544
7725
  try {
7545
- router = JSON.parse(fs20.readFileSync(routerPath, "utf8"));
7726
+ router = JSON.parse(fs21.readFileSync(routerPath, "utf8"));
7546
7727
  } catch (exc) {
7547
7728
  return {
7548
7729
  id: "router-pointers",
@@ -7551,13 +7732,13 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT) {
7551
7732
  remedy: "reinstall the package \u2014 dist/router.json is corrupt"
7552
7733
  };
7553
7734
  }
7554
- const rulesDir = path18.join(packageRoot, "dist", "agent-src", "rules");
7735
+ const rulesDir = path19.join(packageRoot, "dist", "agent-src", "rules");
7555
7736
  const broken = [];
7556
7737
  let ids = 0;
7557
7738
  let targets = 0;
7558
7739
  for (const kernelId of router["kernel"] ?? []) {
7559
7740
  ids += 1;
7560
- if (!fs20.existsSync(path18.join(rulesDir, `${kernelId}.md`))) {
7741
+ if (!fs21.existsSync(path19.join(rulesDir, `${kernelId}.md`))) {
7561
7742
  broken.push(`kernel:${kernelId} \u2192 rules/${kernelId}.md missing`);
7562
7743
  }
7563
7744
  }
@@ -7565,7 +7746,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT) {
7565
7746
  for (const entry of router[tier] ?? []) {
7566
7747
  const ruleId = String(entry["id"] ?? "");
7567
7748
  ids += 1;
7568
- if (!fs20.existsSync(path18.join(rulesDir, `${ruleId}.md`))) {
7749
+ if (!fs21.existsSync(path19.join(rulesDir, `${ruleId}.md`))) {
7569
7750
  broken.push(`${tier}:${ruleId} \u2192 rules/${ruleId}.md missing`);
7570
7751
  }
7571
7752
  for (const target of entry["routes_to"] ?? []) {
@@ -7575,7 +7756,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT) {
7575
7756
  broken.push(`${ruleId} \u2192 unparseable routes_to ${JSON.stringify(target)}`);
7576
7757
  continue;
7577
7758
  }
7578
- if (!candidates.some((rel) => fs20.existsSync(path18.join(packageRoot, rel)))) {
7759
+ if (!candidates.some((rel2) => fs21.existsSync(path19.join(packageRoot, rel2)))) {
7579
7760
  broken.push(`${ruleId} \u2192 ${target} (${candidates[0]} missing)`);
7580
7761
  }
7581
7762
  }
@@ -7607,9 +7788,9 @@ function detectSmokePlatform(projectRoot) {
7607
7788
  return "claude";
7608
7789
  }
7609
7790
  function dispatcherRunner(packageRoot) {
7610
- const localTsx = path18.join(packageRoot, "node_modules", ".bin", "tsx");
7611
- const script = path18.join(packageRoot, "src", "scripts", "hooks", "dispatch_hook.ts");
7612
- if (fs20.existsSync(localTsx)) {
7791
+ const localTsx = path19.join(packageRoot, "node_modules", ".bin", "tsx");
7792
+ const script = path19.join(packageRoot, "src", "scripts", "hooks", "dispatch_hook.ts");
7793
+ if (fs21.existsSync(localTsx)) {
7613
7794
  return [localTsx, script];
7614
7795
  }
7615
7796
  return ["npx", "tsx", script];
@@ -7659,12 +7840,12 @@ function _check_hook_dispatcher(projectRoot, packageRoot = PACKAGE_ROOT, opts =
7659
7840
  };
7660
7841
  }
7661
7842
  function readSettingsMode(projectRoot) {
7662
- const settingsPath = path18.join(projectRoot, ".agent-settings.yml");
7663
- if (!fs20.existsSync(settingsPath)) {
7843
+ const settingsPath = path19.join(projectRoot, ".agent-settings.yml");
7844
+ if (!fs21.existsSync(settingsPath)) {
7664
7845
  return "eager-all";
7665
7846
  }
7666
7847
  try {
7667
- const parsed = YAML.parse(fs20.readFileSync(settingsPath, "utf8"));
7848
+ const parsed = YAML.parse(fs21.readFileSync(settingsPath, "utf8"));
7668
7849
  const lean = parsed?.["lean_projection"] ?? null;
7669
7850
  const mode = lean?.["mode"];
7670
7851
  return typeof mode === "string" && mode.length > 0 ? mode : "eager-all";
@@ -7675,7 +7856,7 @@ function readSettingsMode(projectRoot) {
7675
7856
  function kernelIdsFromRouter(packageRoot) {
7676
7857
  try {
7677
7858
  const router = JSON.parse(
7678
- fs20.readFileSync(path18.join(packageRoot, "dist", "router.json"), "utf8")
7859
+ fs21.readFileSync(path19.join(packageRoot, "dist", "router.json"), "utf8")
7679
7860
  );
7680
7861
  return new Set((router["kernel"] ?? []).map(String));
7681
7862
  } catch {
@@ -7692,8 +7873,8 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT, project
7692
7873
  remedy: "set lean_projection.mode to 'eager-all' or 'thin' in .agent-settings.yml"
7693
7874
  };
7694
7875
  }
7695
- const rulesDir = projectedRulesDir ?? path18.join(projectRoot, ".augment", "rules");
7696
- if (!fs20.existsSync(rulesDir)) {
7876
+ const rulesDir = projectedRulesDir ?? path19.join(projectRoot, ".augment", "rules");
7877
+ if (!fs21.existsSync(rulesDir)) {
7697
7878
  return {
7698
7879
  id: "lean-projection",
7699
7880
  status: "skipped",
@@ -7702,7 +7883,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT, project
7702
7883
  };
7703
7884
  }
7704
7885
  const kernel = kernelIdsFromRouter(packageRoot);
7705
- const files = fs20.readdirSync(rulesDir).filter((f) => f.endsWith(".md") && f !== "INDEX.md").sort();
7886
+ const files = fs21.readdirSync(rulesDir).filter((f) => f.endsWith(".md") && f !== "INDEX.md").sort();
7706
7887
  const nonKernel = files.filter((f) => !kernel.has(f.replace(/\.md$/, "")));
7707
7888
  if (nonKernel.length === 0) {
7708
7889
  return {
@@ -7716,7 +7897,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT, project
7716
7897
  for (const f of nonKernel) {
7717
7898
  let text = "";
7718
7899
  try {
7719
- text = fs20.readFileSync(path18.join(rulesDir, f), "utf8");
7900
+ text = fs21.readFileSync(path19.join(rulesDir, f), "utf8");
7720
7901
  } catch {
7721
7902
  continue;
7722
7903
  }
@@ -7747,8 +7928,8 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT, project
7747
7928
  function _check_host_manifest(projectRoot) {
7748
7929
  const detected = Object.entries(detectToolPresence(projectRoot)).filter(([, v]) => v === true).map(([k]) => k);
7749
7930
  const detectedNote = detected.length > 0 ? `detected surfaces: ${detected.join(", ")}` : "no surfaces detected";
7750
- const settingsPath = path18.join(projectRoot, ".agent-settings.yml");
7751
- if (!fs20.existsSync(settingsPath)) {
7931
+ const settingsPath = path19.join(projectRoot, ".agent-settings.yml");
7932
+ if (!fs21.existsSync(settingsPath)) {
7752
7933
  return {
7753
7934
  id: "host-manifest",
7754
7935
  status: "ok",
@@ -7758,7 +7939,7 @@ function _check_host_manifest(projectRoot) {
7758
7939
  }
7759
7940
  let parsed = null;
7760
7941
  try {
7761
- parsed = YAML.parse(fs20.readFileSync(settingsPath, "utf8"));
7942
+ parsed = YAML.parse(fs21.readFileSync(settingsPath, "utf8"));
7762
7943
  } catch (exc) {
7763
7944
  return {
7764
7945
  id: "host-manifest",
@@ -7932,13 +8113,13 @@ function _isCliEntry13() {
7932
8113
  if (process5.argv[1] === void 0) {
7933
8114
  return false;
7934
8115
  }
7935
- const argvUrl = pathToFileURL14(path18.resolve(process5.argv[1])).href;
8116
+ const argvUrl = pathToFileURL14(path19.resolve(process5.argv[1])).href;
7936
8117
  if (import.meta.url === argvUrl) {
7937
8118
  return true;
7938
8119
  }
7939
8120
  try {
7940
- const here = fs20.realpathSync(fileURLToPath14(import.meta.url));
7941
- const argv = fs20.realpathSync(path18.resolve(process5.argv[1]));
8121
+ const here = fs21.realpathSync(fileURLToPath14(import.meta.url));
8122
+ const argv = fs21.realpathSync(path19.resolve(process5.argv[1]));
7942
8123
  return here === argv;
7943
8124
  } catch {
7944
8125
  return false;