@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.
- package/.augment-plugin/marketplace.json +3 -3
- package/.augment-plugin/plugin.json +1 -1
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +40 -191
- package/README.md +1 -1
- package/dist/agent-src/commands/design.md +1 -1
- package/dist/agent-src/guidelines/design-antipatterns.md +1 -1
- package/dist/agent-src/rules/token-budget-discipline.md +2 -2
- package/dist/agent-src/skills/accessibility-auditor/data/aria-patterns.csv +2 -0
- package/dist/agent-src/skills/accessibility-auditor/data/manifest.json +3 -3
- package/dist/agent-src/skills/canvas-design/SKILL.md +4 -2
- package/dist/agent-src/skills/design-intelligence/references/integration-mapping.md +13 -10
- package/dist/agent-src/skills/fe-design/references/design-patterns.md +49 -2
- package/dist/agent-src/skills/frontend-render-security/SKILL.md +9 -0
- package/dist/agent-src/skills/iconography/SKILL.md +4 -2
- package/dist/agent-src/skills/image-provider-routing/SKILL.md +16 -5
- package/dist/agent-src/skills/logo-generation/SKILL.md +12 -8
- package/dist/agent-src/skills/svg-authoring/SKILL.md +318 -0
- package/dist/agent-src/skills/wireframe/SKILL.md +5 -2
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/cli/commands/uiRender.js +201 -4
- package/dist/cli/commands/uiRenderAsset.js +1308 -0
- package/dist/cli/commands/uiRenderAssetCompare.js +752 -0
- package/dist/cli/commands/uiRenderAssetGrid.js +265 -0
- package/dist/cli/commands/uiRenderAssetGrounds.js +323 -0
- package/dist/cli/commands/uiRenderAssetIsolation.js +85 -0
- package/dist/cli/commands/uiRenderAssetTypes.js +145 -0
- package/dist/cli/main.js +47 -1
- package/dist/cli/registry.js +1 -1
- package/dist/cli-delegate/{chunk-MSUL5NYP.js → chunk-4DBG5K7M.js} +1 -1
- package/dist/cli-delegate/{chunk-AED2VQGM.js → chunk-TMWYUOK4.js} +10 -1
- package/dist/cli-delegate/cmd_conformance.js +395 -214
- package/dist/cli-delegate/cmd_handoff.js +2 -2
- package/dist/cli-delegate/cmd_session_recycle.js +2 -2
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +47 -22
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +6 -6
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +19 -15
- package/dist/discovery/trust-report.md +2 -2
- package/dist/discovery/workspaces.json +13 -9
- package/dist/hooks/dispatch.js +1073 -808
- package/dist/hooks/dispatch.sha256 +1 -1
- package/dist/hooks/svg_rules.chunk.cjs +1626 -0
- package/dist/hooks/svg_rules.chunk.cjs.sha256 +1 -0
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +931 -735
- package/dist/scripts/_lib/scan_scope.js +105 -0
- package/dist/scripts/_lib/svg_dom.js +284 -0
- package/dist/scripts/_lib/svg_geometry.js +477 -0
- package/dist/scripts/_lib/svg_motion.js +179 -0
- package/dist/scripts/_lib/svg_rules.js +1337 -0
- package/dist/scripts/_lib/svg_urls.js +67 -0
- package/dist/scripts/lint_svg_asset.js +324 -0
- package/docs/guidelines/design-antipatterns.md +1 -1
- package/package.json +4 -3
- package/src/config/gate-violation-baselines.json +3 -3
- package/src/config/routing-coverage-seed.json +9 -2
- package/src/scripts/_lib/svg_dom.ts +318 -0
- package/src/scripts/_lib/svg_geometry.ts +480 -0
- package/src/scripts/_lib/svg_motion.ts +208 -0
- package/src/scripts/_lib/svg_rules.ts +1453 -0
- package/src/scripts/_lib/svg_urls.ts +72 -0
- package/src/scripts/_lib/verification_command.ts +59 -0
- package/src/scripts/_lib/verify_clause.ts +27 -17
- package/src/scripts/hooks/block_speaking_inbox_dir.ts +16 -1
- package/src/scripts/hooks/design_pass_hook.ts +157 -3
- package/src/scripts/hooks/svg_obligation.ts +497 -0
- package/src/scripts/hooks/svg_rules_loader.ts +133 -0
- package/src/scripts/hooks/turn_end_gate_hook.ts +5 -3
- package/src/scripts/lint_consolidation_lineage.ts +6 -3
- package/src/scripts/lint_design_quality.ts +60 -12
- package/src/scripts/lint_motion_authority_drift.ts +27 -0
- 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
|
-
|
|
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-
|
|
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
|
|
123
|
+
import * as fs21 from "node:fs";
|
|
123
124
|
import * as os7 from "node:os";
|
|
124
|
-
import * as
|
|
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
|
|
141
|
-
if (
|
|
142
|
-
const kind = target.slice(0,
|
|
143
|
-
const id = target.slice(
|
|
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
|
|
156
|
+
import * as fs20 from "node:fs";
|
|
156
157
|
import * as os6 from "node:os";
|
|
157
|
-
import * as
|
|
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
|
|
163
|
-
import
|
|
163
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
164
|
+
import fs16 from "node:fs";
|
|
164
165
|
import os2 from "node:os";
|
|
165
|
-
import
|
|
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
|
|
1951
|
-
import * as
|
|
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
|
|
2119
|
-
if (
|
|
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
|
|
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
|
|
2510
|
-
const p = path4.join(abs,
|
|
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
|
|
3163
|
+
let rel2;
|
|
3163
3164
|
try {
|
|
3164
|
-
|
|
3165
|
+
rel2 = path6.relative(from, to);
|
|
3165
3166
|
} catch {
|
|
3166
3167
|
return null;
|
|
3167
3168
|
}
|
|
3168
|
-
if (
|
|
3169
|
-
if (
|
|
3170
|
-
return
|
|
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
|
|
3337
|
-
import * as
|
|
3338
|
-
import * as
|
|
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 =
|
|
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
|
|
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
|
|
3750
|
+
return path8.join(root, LEDGER_DIR, OPEN_SUBDIR);
|
|
3571
3751
|
}
|
|
3572
3752
|
function openFile(root, ref) {
|
|
3573
|
-
return
|
|
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 =
|
|
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 =
|
|
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
|
|
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
|
-
|
|
3629
|
-
|
|
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 =
|
|
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
|
-
|
|
3851
|
+
fs9.unlinkSync(openFile(root, ref));
|
|
3672
3852
|
} catch {
|
|
3673
3853
|
}
|
|
3674
3854
|
}
|
|
3675
3855
|
function countOpen(root) {
|
|
3676
3856
|
try {
|
|
3677
|
-
return
|
|
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(
|
|
4023
|
+
const argvUrl = pathToFileURL4(path8.resolve(process.argv[1])).href;
|
|
3844
4024
|
if (import.meta.url === argvUrl) return true;
|
|
3845
4025
|
try {
|
|
3846
|
-
return
|
|
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
|
|
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
|
|
3859
|
-
import * as
|
|
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
|
|
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
|
|
3867
|
-
import * as
|
|
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 =
|
|
4058
|
+
var BASELINE_STATE_REL = path9.join("agents", "runtime", "state", "review-baseline");
|
|
3879
4059
|
function baselineStateDir(workspaceRoot) {
|
|
3880
|
-
return
|
|
4060
|
+
return path9.join(workspaceRoot, BASELINE_STATE_REL);
|
|
3881
4061
|
}
|
|
3882
4062
|
function baselineStateFile(workspaceRoot, sessionKey) {
|
|
3883
|
-
return
|
|
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 =
|
|
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 =
|
|
4022
|
-
const realPath =
|
|
4023
|
-
const
|
|
4024
|
-
if (
|
|
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 } =
|
|
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 =
|
|
4086
|
-
const 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 =
|
|
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:
|
|
4357
|
+
id: crypto3.randomUUID(),
|
|
4178
4358
|
baseline
|
|
4179
4359
|
});
|
|
4180
4360
|
if (errors.length || line === null) return;
|
|
4181
4361
|
try {
|
|
4182
|
-
const dir =
|
|
4183
|
-
|
|
4184
|
-
const file =
|
|
4185
|
-
|
|
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
|
|
4371
|
+
return path10.join(workspaceRoot, "agents", "runtime", "state", "end-review-nudge");
|
|
4192
4372
|
}
|
|
4193
4373
|
function sessionStateFile(workspaceRoot, sessionKey) {
|
|
4194
|
-
return
|
|
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
|
|
4379
|
+
return crypto3.createHash("sha256").update(material).digest("hex");
|
|
4200
4380
|
}
|
|
4201
4381
|
function hasFiredThisSession(workspaceRoot, sessionKey) {
|
|
4202
4382
|
try {
|
|
4203
|
-
return
|
|
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(
|
|
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(
|
|
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 =
|
|
4306
|
-
const argv =
|
|
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 &&
|
|
4507
|
+
if (opts.maxBytes !== void 0 && fs12.statSync(transcriptPath).size > opts.maxBytes) {
|
|
4328
4508
|
return empty;
|
|
4329
4509
|
}
|
|
4330
|
-
lines =
|
|
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 =
|
|
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 =
|
|
4554
|
-
|
|
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 &&
|
|
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
|
|
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 =
|
|
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(
|
|
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(
|
|
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(
|
|
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 =
|
|
4892
|
-
const argv =
|
|
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
|
|
4905
|
-
import
|
|
4906
|
-
import
|
|
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 =
|
|
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 =
|
|
4994
|
-
|
|
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(
|
|
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 =
|
|
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:
|
|
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(
|
|
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 =
|
|
5163
|
-
const argv =
|
|
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
|
|
5175
|
-
import
|
|
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(
|
|
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 =
|
|
5680
|
-
const argv =
|
|
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 =
|
|
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 =
|
|
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
|
|
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:
|
|
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:
|
|
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
|
|
6272
|
+
return createHash5("sha256").update(path14.resolve(store)).digest("hex").slice(0, 12);
|
|
6092
6273
|
}
|
|
6093
6274
|
function scanStore(store, limit) {
|
|
6094
|
-
const files =
|
|
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 =
|
|
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
|
-
|
|
6126
|
-
|
|
6306
|
+
path14.join(REPO_ROOT, ".claude", "rules"),
|
|
6307
|
+
path14.join(process.env["HOME"] ?? os2.homedir(), ".claude", "rules")
|
|
6127
6308
|
);
|
|
6128
|
-
const ownStore =
|
|
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
|
-
|
|
6159
|
-
|
|
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 (!
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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 =
|
|
6343
|
-
const argv =
|
|
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
|
|
6535
|
+
import * as fs17 from "node:fs";
|
|
6355
6536
|
import * as os3 from "node:os";
|
|
6356
|
-
import * as
|
|
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 =
|
|
6361
|
-
var PROJECT_RULES =
|
|
6362
|
-
var PROJECTION_SOURCE =
|
|
6363
|
-
var GLOBAL_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
|
|
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 =
|
|
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:
|
|
6386
|
-
projectPresent:
|
|
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(
|
|
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 =
|
|
6420
|
-
globalCopy =
|
|
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 =
|
|
6568
|
-
let globalDir =
|
|
6569
|
-
let sourceDir =
|
|
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 =
|
|
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(
|
|
6786
|
+
if (import.meta.url === pathToFileURL10(path15.resolve(process2.argv[1])).href) return true;
|
|
6606
6787
|
try {
|
|
6607
|
-
return
|
|
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
|
|
6798
|
+
import * as fs18 from "node:fs";
|
|
6618
6799
|
import * as os4 from "node:os";
|
|
6619
|
-
import * as
|
|
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 =
|
|
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 (!
|
|
6814
|
+
if (!fs18.existsSync(root)) {
|
|
6634
6815
|
return out;
|
|
6635
6816
|
}
|
|
6636
|
-
for (const entry of
|
|
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 =
|
|
6641
|
-
if (!
|
|
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 =
|
|
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 (
|
|
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
|
|
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 (!
|
|
6847
|
+
if (!fs18.existsSync(store)) {
|
|
6667
6848
|
return rep;
|
|
6668
6849
|
}
|
|
6669
|
-
const files =
|
|
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
|
|
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) =>
|
|
6926
|
+
stores: usage.map((u) => path16.basename(u.store))
|
|
6746
6927
|
};
|
|
6747
6928
|
}
|
|
6748
6929
|
function readRecord(repoRoot) {
|
|
6749
|
-
const file =
|
|
6750
|
-
if (!
|
|
6930
|
+
const file = path16.join(repoRoot, RECORD_PATH);
|
|
6931
|
+
if (!fs18.existsSync(file)) {
|
|
6751
6932
|
return null;
|
|
6752
6933
|
}
|
|
6753
|
-
return JSON.parse(
|
|
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
|
-
` ${
|
|
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(
|
|
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 =
|
|
6914
|
-
|
|
6915
|
-
|
|
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(
|
|
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
|
|
7108
|
+
import * as fs19 from "node:fs";
|
|
6928
7109
|
import * as os5 from "node:os";
|
|
6929
|
-
import * as
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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
|
|
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 =
|
|
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 =
|
|
7121
|
-
const id =
|
|
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(
|
|
7427
|
+
if (import.meta.url === pathToFileURL12(path17.resolve(process3.argv[1])).href) return true;
|
|
7247
7428
|
try {
|
|
7248
|
-
return
|
|
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 =
|
|
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 ??
|
|
7263
|
-
const globalRulesDir = opts.globalRulesDir ??
|
|
7264
|
-
const sourceDir = opts.sourceDir ??
|
|
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(
|
|
7451
|
+
skills: censusSkills(path18.join(repoRoot, SKILLS_ROOT)),
|
|
7271
7452
|
usage: measureUsage(store, limit),
|
|
7272
|
-
storePresent:
|
|
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 =
|
|
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(
|
|
7626
|
+
if (import.meta.url === pathToFileURL13(path18.resolve(process4.argv[1])).href) return true;
|
|
7446
7627
|
try {
|
|
7447
|
-
return
|
|
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
|
|
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
|
|
7672
|
+
return path19.join(os7.homedir(), ".event4u", "agent-config", "install-log.jsonl");
|
|
7492
7673
|
}
|
|
7493
7674
|
function _installLogExpected(projectRoot) {
|
|
7494
|
-
return
|
|
7675
|
+
return fs21.existsSync(manifest_path(projectRoot));
|
|
7495
7676
|
}
|
|
7496
7677
|
function _check_txlog_clean(logPath = installLogPath(), projectRoot = null) {
|
|
7497
|
-
const entries =
|
|
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((
|
|
7712
|
+
return routeTargetPathsPosix(target).map((rel2) => path19.join(...rel2.split("/")));
|
|
7532
7713
|
}
|
|
7533
7714
|
function _check_router_pointers(packageRoot = PACKAGE_ROOT) {
|
|
7534
|
-
const routerPath =
|
|
7535
|
-
if (!
|
|
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(
|
|
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 =
|
|
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 (!
|
|
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 (!
|
|
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((
|
|
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 =
|
|
7611
|
-
const script =
|
|
7612
|
-
if (
|
|
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 =
|
|
7663
|
-
if (!
|
|
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(
|
|
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
|
-
|
|
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 ??
|
|
7696
|
-
if (!
|
|
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 =
|
|
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 =
|
|
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 =
|
|
7751
|
-
if (!
|
|
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(
|
|
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(
|
|
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 =
|
|
7941
|
-
const argv =
|
|
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;
|