@event4u/agent-config 17.3.0 → 17.4.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 +164 -342
- package/CREDITS.md +2 -2
- package/README.md +1 -1
- package/dist/agent-src/skills/code-intelligence/SKILL.md +3 -0
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/cli/registry.js +2 -2
- package/dist/cli-delegate/{chunk-DHSSP7V3.js → chunk-5AYJGUA3.js} +0 -2
- package/dist/cli-delegate/chunk-DIFZBP4G.js +1336 -0
- package/dist/cli-delegate/{chunk-MT2WOOCY.js → chunk-WY5ZZPGL.js} +2 -2
- package/dist/cli-delegate/{chunk-ORJPBER2.js → chunk-X6LZ7W5A.js} +73 -10
- package/dist/cli-delegate/cmd_conformance.js +175 -183
- package/dist/cli-delegate/cmd_doctor.js +5 -5
- package/dist/cli-delegate/cmd_doctor_neighbours.js +3 -3
- package/dist/cli-delegate/cmd_explain.js +1 -1
- package/dist/cli-delegate/cmd_handoff.js +2 -2
- package/dist/cli-delegate/cmd_memory_get.js +1 -1
- package/dist/cli-delegate/cmd_route_audit.js +1 -1
- package/dist/cli-delegate/cmd_session_recycle.js +2 -2
- package/dist/cli-delegate/cmd_update.js +24 -13
- package/dist/cli-delegate/cmd_upgrade.js +2 -2
- package/dist/cli-delegate/dist-25AZAHOP.js +3240 -0
- package/dist/cli-delegate/dist-P7MFPMF3.js +411 -0
- package/dist/cli-delegate/dist-XAS5ZLQB.js +6 -0
- package/dist/cli-delegate/{upgrade_unattended-VVL6JLSX.js → upgrade_unattended-QCWOKTUN.js} +178 -163
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +3 -3
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +1 -1
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +2 -2
- package/dist/discovery/trust-report.md +1 -1
- package/dist/discovery/workspaces.json +2 -2
- package/dist/hooks/code_graph_refresh.chunk.cjs +56 -27
- package/dist/hooks/code_graph_refresh.chunk.cjs.sha256 +1 -1
- package/dist/hooks/dispatch.js +982 -929
- package/dist/hooks/dispatch.sha256 +1 -1
- package/dist/hooks/egress_engine.chunk.cjs +56 -6
- package/dist/hooks/egress_engine.chunk.cjs.sha256 +1 -1
- package/dist/hooks/update_notice.chunk.cjs +914 -0
- package/dist/hooks/update_notice.chunk.cjs.sha256 +1 -0
- package/dist/mcp/registry-manifest.json +1 -1
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +71259 -66437
- package/dist/scripts/condense.js +9 -6
- package/package.json +4 -1
- package/src/config/evaluator-budgets.json +9 -8
- package/src/config/gate-violation-baselines.json +2 -2
- package/src/config/hook-bundle-budget.json +31 -6
- package/src/config/packed-binary-manifest.json +9 -0
- package/src/config/sigstore/npm_keys.json +50 -0
- package/src/config/sigstore/trust-material.json +9 -0
- package/src/config/sigstore/trusted_root.json +126 -0
- package/src/config/skill-body-budget.json +7 -1
- package/src/scripts/_cli/cmd_update.ts +48 -20
- package/src/scripts/_cli/cmd_upgrade.ts +7 -1
- package/src/scripts/_cli/upgrade_unattended.ts +90 -76
- package/src/scripts/_dispatch.bash +3 -2
- package/src/scripts/_lib/confusables.ts +0 -19
- package/src/scripts/_lib/egress_normalize.ts +53 -23
- package/src/scripts/_lib/egress_text.ts +5 -3
- package/src/scripts/_lib/egress_token.ts +7 -5
- package/src/scripts/_lib/gate_collector_experimental.ts +633 -0
- package/src/scripts/_lib/git_common_dir.ts +10 -0
- package/src/scripts/_lib/graph_feeder_record.ts +3 -2
- package/src/scripts/_lib/install_reach_checks.ts +32 -2
- package/src/scripts/_lib/lineage_backfill.ts +136 -0
- package/src/scripts/_lib/lineage_ledger.ts +211 -0
- package/src/scripts/_lib/lineage_map.ts +55 -0
- package/src/scripts/_lib/lineage_query.ts +140 -0
- package/src/scripts/_lib/lineage_seed.ts +116 -0
- package/src/scripts/_lib/lineage_watch.ts +249 -0
- package/src/scripts/_lib/link_crypto.ts +8 -4
- package/src/scripts/_lib/production_reach.ts +3 -3
- package/src/scripts/_lib/project_registry.ts +227 -0
- package/src/scripts/_lib/provenance_verify.ts +14 -242
- package/src/scripts/_lib/sigstore_provenance.ts +177 -0
- package/src/scripts/_lib/source_id.ts +48 -0
- package/src/scripts/_lib/source_shape.ts +4 -0
- package/src/scripts/_lib/unattended_gates.ts +6 -1
- package/src/scripts/advisories.ts +26 -10
- package/src/scripts/ai_council/council_egress.ts +5 -6
- package/src/scripts/bench_graph_feeder_latency.ts +10 -3
- package/src/scripts/check_dependency_floors.ts +7 -0
- package/src/scripts/check_egress_mutations.ts +1 -0
- package/src/scripts/code_graph/build.ts +67 -3
- package/src/scripts/code_graph/cli.ts +131 -28
- package/src/scripts/code_graph/conventions_default.ts +20 -1
- package/src/scripts/code_graph/detect.ts +5 -5
- package/src/scripts/code_graph/estate_cli.ts +135 -0
- package/src/scripts/code_graph/estate_index.ts +394 -0
- package/src/scripts/code_graph/estate_manifests.ts +223 -0
- package/src/scripts/code_graph/estate_map.ts +141 -0
- package/src/scripts/code_graph/extract.ts +4 -1
- package/src/scripts/code_graph/extract_more.ts +137 -2
- package/src/scripts/code_graph/graph_budget.ts +158 -0
- package/src/scripts/code_graph/graph_home.ts +80 -0
- package/src/scripts/code_graph/lineage_cli.ts +315 -0
- package/src/scripts/code_graph/map.ts +22 -13
- package/src/scripts/code_graph/map_model.ts +67 -12
- package/src/scripts/code_graph/map_verify.ts +68 -5
- package/src/scripts/code_graph/map_viewer/viewer.css +12 -0
- package/src/scripts/code_graph/map_viewer/viewer.js +45 -15
- package/src/scripts/code_graph/project_ref.ts +25 -0
- package/src/scripts/code_graph/projects_cli.ts +254 -0
- package/src/scripts/code_graph/providers/catalog.ts +14 -5
- package/src/scripts/code_graph/providers/django.ts +52 -9
- package/src/scripts/code_graph/providers/index.ts +2 -0
- package/src/scripts/code_graph/providers/rails.ts +204 -0
- package/src/scripts/code_graph/providers/spring.ts +38 -1
- package/src/scripts/code_graph/query.ts +9 -9
- package/src/scripts/code_graph/refresh_lock.ts +12 -8
- package/src/scripts/code_graph/repo_identity.ts +169 -0
- package/src/scripts/code_graph/sqlite_store.ts +22 -25
- package/src/scripts/code_graph/types.ts +6 -2
- package/src/scripts/condense.ts +6 -6
- package/src/scripts/hook_chunks.mjs +7 -0
- package/src/scripts/hook_manifest.json +1 -1
- package/src/scripts/hook_manifest.yaml +20 -17
- package/src/scripts/hooks/code_graph_refresh_hook.ts +10 -7
- package/src/scripts/hooks/dispatch_hook.ts +6 -7
- package/src/scripts/hooks/host_semantics.ts +72 -0
- package/src/scripts/hooks/lazy_concern.ts +4 -0
- package/src/scripts/hooks/user_notice.ts +105 -0
- package/src/scripts/lint_harvest_provenance.ts +137 -11
- package/src/scripts/mcp_server/consumer_tool_catalog.json +69 -15
- package/src/scripts/mcp_server/graph_tools.ts +161 -41
- package/src/scripts/network_sources.ts +24 -6
- package/src/scripts/schemas/provenance-mechanism.schema.json +46 -0
- package/src/scripts/update_notice_hook.ts +75 -7
- package/src/vendor/grammars/README.md +7 -6
- package/src/vendor/grammars/tree-sitter-ruby.wasm +0 -0
- /package/dist/cli-delegate/{chunk-FKYZOWVD.js → chunk-QBAFP67O.js} +0 -0
- /package/dist/cli-delegate/{chunk-BMGUGSY6.js → chunk-TQG6UMPC.js} +0 -0
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
proseEqual,
|
|
62
62
|
resolveSessionRole,
|
|
63
63
|
splitFrontmatter
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-X6LZ7W5A.js";
|
|
65
65
|
import {
|
|
66
66
|
_is_global_only_consumer
|
|
67
67
|
} from "./chunk-2Y5AMLMY.js";
|
|
@@ -86,7 +86,7 @@ import {
|
|
|
86
86
|
EXIT_BLOCK,
|
|
87
87
|
EXIT_WARN,
|
|
88
88
|
projectStoreSlug
|
|
89
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-QBAFP67O.js";
|
|
90
90
|
import "./chunk-IAYTIIQW.js";
|
|
91
91
|
import "./chunk-PV7S5DPJ.js";
|
|
92
92
|
import "./chunk-LQOCRFWT.js";
|
|
@@ -103,9 +103,9 @@ import {
|
|
|
103
103
|
import {
|
|
104
104
|
load_agent_settings
|
|
105
105
|
} from "./chunk-XLY5G3CM.js";
|
|
106
|
-
import "./chunk-
|
|
106
|
+
import "./chunk-WY5ZZPGL.js";
|
|
107
107
|
import "./chunk-FIEEOH5C.js";
|
|
108
|
-
import "./chunk-
|
|
108
|
+
import "./chunk-5AYJGUA3.js";
|
|
109
109
|
import {
|
|
110
110
|
artefact_roots
|
|
111
111
|
} from "./chunk-YCU3TIXH.js";
|
|
@@ -120,7 +120,7 @@ import {
|
|
|
120
120
|
resolveRouteTransport
|
|
121
121
|
} from "./chunk-M6CRG5O6.js";
|
|
122
122
|
import "./chunk-MWRD5YOH.js";
|
|
123
|
-
import "./chunk-
|
|
123
|
+
import "./chunk-TQG6UMPC.js";
|
|
124
124
|
import {
|
|
125
125
|
readHookStdin
|
|
126
126
|
} from "./chunk-RAXQOETZ.js";
|
|
@@ -147,7 +147,7 @@ import {
|
|
|
147
147
|
var YAML = __toESM(require_dist(), 1);
|
|
148
148
|
import * as fs22 from "node:fs";
|
|
149
149
|
import * as os7 from "node:os";
|
|
150
|
-
import * as
|
|
150
|
+
import * as path20 from "node:path";
|
|
151
151
|
import process5 from "node:process";
|
|
152
152
|
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
153
153
|
import { fileURLToPath as fileURLToPath13, pathToFileURL as pathToFileURL13 } from "node:url";
|
|
@@ -180,7 +180,7 @@ function routeTargetPathsPosix(target) {
|
|
|
180
180
|
// src/scripts/report_conformance_funnel.ts
|
|
181
181
|
import * as fs21 from "node:fs";
|
|
182
182
|
import * as os6 from "node:os";
|
|
183
|
-
import * as
|
|
183
|
+
import * as path19 from "node:path";
|
|
184
184
|
import process4 from "node:process";
|
|
185
185
|
import { fileURLToPath as fileURLToPath12, pathToFileURL as pathToFileURL12 } from "node:url";
|
|
186
186
|
|
|
@@ -188,7 +188,7 @@ import { fileURLToPath as fileURLToPath12, pathToFileURL as pathToFileURL12 } fr
|
|
|
188
188
|
import { createHash as createHash4 } from "node:crypto";
|
|
189
189
|
import fs17 from "node:fs";
|
|
190
190
|
import os2 from "node:os";
|
|
191
|
-
import
|
|
191
|
+
import path15 from "node:path";
|
|
192
192
|
import { fileURLToPath as fileURLToPath8, pathToFileURL as pathToFileURL8 } from "node:url";
|
|
193
193
|
|
|
194
194
|
// src/scripts/_lib/transcript_entry.ts
|
|
@@ -1975,7 +1975,7 @@ var COMMAND_OBJECTS = {
|
|
|
1975
1975
|
|
|
1976
1976
|
// src/scripts/hooks/turn_end_gate_hook.ts
|
|
1977
1977
|
import * as fs12 from "node:fs";
|
|
1978
|
-
import * as
|
|
1978
|
+
import * as path11 from "node:path";
|
|
1979
1979
|
import { fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL5 } from "node:url";
|
|
1980
1980
|
|
|
1981
1981
|
// src/scripts/check_reply_consistency.ts
|
|
@@ -2356,15 +2356,37 @@ function detectDroppedDecision(assistantTurnTexts, closingFromPayload = false) {
|
|
|
2356
2356
|
|
|
2357
2357
|
// src/scripts/_lib/graph_feeder_record.ts
|
|
2358
2358
|
import * as fs7 from "node:fs";
|
|
2359
|
-
import * as
|
|
2359
|
+
import * as path7 from "node:path";
|
|
2360
2360
|
|
|
2361
2361
|
// src/scripts/code_graph/detect.ts
|
|
2362
2362
|
import { execFileSync } from "node:child_process";
|
|
2363
2363
|
import * as fs4 from "node:fs";
|
|
2364
|
+
import * as path5 from "node:path";
|
|
2365
|
+
|
|
2366
|
+
// src/scripts/code_graph/graph_home.ts
|
|
2364
2367
|
import * as path4 from "node:path";
|
|
2368
|
+
var STATE_DIR_REL = path4.join("agents", "runtime", "state");
|
|
2369
|
+
var NATIVE_CACHE_REL = path4.join(STATE_DIR_REL, "code-graph-v1.json");
|
|
2370
|
+
var MAP_DIR_REL = path4.join("agents", "map");
|
|
2371
|
+
var LOCK_REL = path4.join(STATE_DIR_REL, "code-graph-refresh.lock");
|
|
2372
|
+
var AUTO_REFRESH_REL = path4.join(STATE_DIR_REL, "code-graph-auto-refresh.json");
|
|
2373
|
+
function projectHome(root) {
|
|
2374
|
+
return {
|
|
2375
|
+
kind: "project",
|
|
2376
|
+
root,
|
|
2377
|
+
dir: path4.join(root, "agents"),
|
|
2378
|
+
stateDir: path4.join(root, STATE_DIR_REL),
|
|
2379
|
+
cachePath: path4.join(root, NATIVE_CACHE_REL),
|
|
2380
|
+
mapDir: path4.join(root, MAP_DIR_REL),
|
|
2381
|
+
lockPath: path4.join(root, LOCK_REL),
|
|
2382
|
+
autoRefreshPath: path4.join(root, AUTO_REFRESH_REL),
|
|
2383
|
+
repoId: null,
|
|
2384
|
+
instance: null
|
|
2385
|
+
};
|
|
2386
|
+
}
|
|
2365
2387
|
|
|
2366
2388
|
// src/scripts/code_graph/types.ts
|
|
2367
|
-
var STATED_WORDS = "same-file import-specifier path-alias psr4 route-table directive-scan schema-call orm-relation di-binding compiler-index test-import literal-path literal-dotted fs-route";
|
|
2389
|
+
var STATED_WORDS = "same-file import-specifier path-alias psr4 route-table directive-scan schema-call orm-relation di-binding compiler-index namespace-scope test-import literal-path literal-dotted fs-route";
|
|
2368
2390
|
var GUESS_WORDS = "name-lookup dynamic foreign";
|
|
2369
2391
|
var STATED_RESOLVED_VIA = new Set(STATED_WORDS.split(" "));
|
|
2370
2392
|
var GUESS_RESOLVED_VIA = new Set(GUESS_WORDS.split(" "));
|
|
@@ -2386,6 +2408,7 @@ var EXT_LANG = {
|
|
|
2386
2408
|
".go": "go",
|
|
2387
2409
|
".java": "java",
|
|
2388
2410
|
".cs": "csharp",
|
|
2411
|
+
".rb": "ruby",
|
|
2389
2412
|
".vue": "typescript"
|
|
2390
2413
|
};
|
|
2391
2414
|
|
|
@@ -2458,7 +2481,7 @@ function consumerCandidates(root) {
|
|
|
2458
2481
|
declared = void 0;
|
|
2459
2482
|
}
|
|
2460
2483
|
const extra = Array.isArray(declared) ? declared.filter(
|
|
2461
|
-
(p) => typeof p === "string" && p !== "" && !
|
|
2484
|
+
(p) => typeof p === "string" && p !== "" && !path5.isAbsolute(p) && !path5.normalize(p).startsWith("..")
|
|
2462
2485
|
) : [];
|
|
2463
2486
|
return [...CONSUMER_CANDIDATES, ...extra.filter((p) => !CONSUMER_CANDIDATES.includes(p))];
|
|
2464
2487
|
}
|
|
@@ -2515,18 +2538,18 @@ function looksLikeGraph(p) {
|
|
|
2515
2538
|
}
|
|
2516
2539
|
}
|
|
2517
2540
|
function detectSources(root, nativeCache) {
|
|
2518
|
-
const abs =
|
|
2541
|
+
const abs = path5.resolve(root);
|
|
2519
2542
|
const out = [];
|
|
2520
2543
|
for (const rel2 of consumerCandidates(abs)) {
|
|
2521
|
-
const p =
|
|
2544
|
+
const p = path5.join(abs, rel2);
|
|
2522
2545
|
if (fs4.existsSync(p)) {
|
|
2523
2546
|
const { ok, sha } = looksLikeGraph(p);
|
|
2524
2547
|
if (ok) out.push({ kind: "consumer", path: p, present: true, ...freshness(abs, p, sha) });
|
|
2525
2548
|
}
|
|
2526
2549
|
}
|
|
2527
|
-
const scipCandidates = [
|
|
2550
|
+
const scipCandidates = [path5.join(abs, "index.scip")];
|
|
2528
2551
|
try {
|
|
2529
|
-
for (const e of fs4.readdirSync(abs)) if (e.endsWith(".scip")) scipCandidates.push(
|
|
2552
|
+
for (const e of fs4.readdirSync(abs)) if (e.endsWith(".scip")) scipCandidates.push(path5.join(abs, e));
|
|
2530
2553
|
} catch {
|
|
2531
2554
|
}
|
|
2532
2555
|
const scip = scipCandidates.find((p) => fs4.existsSync(p));
|
|
@@ -2541,7 +2564,6 @@ function pickSource(verdicts) {
|
|
|
2541
2564
|
if (native) return native;
|
|
2542
2565
|
return verdicts.find((v) => v.kind === "consumer") ?? null;
|
|
2543
2566
|
}
|
|
2544
|
-
var NATIVE_CACHE_REL = path4.join("agents", "runtime", "state", "code-graph-v1.json");
|
|
2545
2567
|
function hasUncommittedIndexedEdit(root) {
|
|
2546
2568
|
let out;
|
|
2547
2569
|
try {
|
|
@@ -2574,7 +2596,7 @@ function hasUncommittedIndexedEdit(root) {
|
|
|
2574
2596
|
return false;
|
|
2575
2597
|
}
|
|
2576
2598
|
function graphState(root, nativeCache) {
|
|
2577
|
-
const picked = pickSource(detectSources(root, nativeCache ??
|
|
2599
|
+
const picked = pickSource(detectSources(root, nativeCache ?? projectHome(root).cachePath));
|
|
2578
2600
|
if (!picked) return "absent";
|
|
2579
2601
|
if (picked.stale === true) {
|
|
2580
2602
|
const behind = picked.commits_behind;
|
|
@@ -2588,12 +2610,12 @@ import * as fs6 from "node:fs";
|
|
|
2588
2610
|
|
|
2589
2611
|
// src/scripts/code_graph/sqlite_store.ts
|
|
2590
2612
|
import * as fs5 from "node:fs";
|
|
2591
|
-
var GRAPH_STORE_VERSION =
|
|
2613
|
+
var GRAPH_STORE_VERSION = 6;
|
|
2592
2614
|
var INDEXED_READ_MIN_EDGES = 5e4;
|
|
2593
2615
|
function sqliteTwinPath(jsonPath) {
|
|
2594
2616
|
return jsonPath.endsWith(".json") ? `${jsonPath.slice(0, -5)}.sqlite3` : `${jsonPath}.sqlite3`;
|
|
2595
2617
|
}
|
|
2596
|
-
function emitSqliteTwin(graph,
|
|
2618
|
+
function emitSqliteTwin(graph, jsonPath) {
|
|
2597
2619
|
if (!isSqliteAvailableSync()) return false;
|
|
2598
2620
|
const twin = sqliteTwinPath(jsonPath);
|
|
2599
2621
|
const tmp = `${twin}.tmp-${process.pid}`;
|
|
@@ -2617,7 +2639,6 @@ function emitSqliteTwin(graph, serialized, jsonPath) {
|
|
|
2617
2639
|
meta.run("source_checksum", graph.source_checksum);
|
|
2618
2640
|
meta.run("json_size", String(stat.size));
|
|
2619
2641
|
meta.run("json_mtime_ms", String(stat.mtimeMs));
|
|
2620
|
-
meta.run("graph_json", serialized);
|
|
2621
2642
|
meta.run("node_count", String(graph.nodes.length));
|
|
2622
2643
|
meta.run("edge_count", String(graph.edges.length));
|
|
2623
2644
|
const insNode = db.prepare(
|
|
@@ -2666,35 +2687,6 @@ function emitSqliteTwin(graph, serialized, jsonPath) {
|
|
|
2666
2687
|
return false;
|
|
2667
2688
|
}
|
|
2668
2689
|
}
|
|
2669
|
-
function loadSerializedFromTwin(jsonPath) {
|
|
2670
|
-
if (!isSqliteAvailableSync()) return null;
|
|
2671
|
-
const twin = sqliteTwinPath(jsonPath);
|
|
2672
|
-
if (!fs5.existsSync(twin)) return null;
|
|
2673
|
-
let stat;
|
|
2674
|
-
try {
|
|
2675
|
-
stat = fs5.statSync(jsonPath);
|
|
2676
|
-
} catch {
|
|
2677
|
-
return null;
|
|
2678
|
-
}
|
|
2679
|
-
try {
|
|
2680
|
-
const { DatabaseSync } = loadSqliteSync("code_graph.sqlite_store");
|
|
2681
|
-
const db = new DatabaseSync(twin, { readOnly: true });
|
|
2682
|
-
try {
|
|
2683
|
-
if (readUserVersion(db) !== GRAPH_STORE_VERSION) return null;
|
|
2684
|
-
const rows = db.prepare("SELECT key, value FROM meta").all();
|
|
2685
|
-
const meta = new Map(rows.map((r) => [r.key, r.value]));
|
|
2686
|
-
if (meta.get("json_size") !== String(stat.size)) return null;
|
|
2687
|
-
if (meta.get("json_mtime_ms") !== String(stat.mtimeMs)) return null;
|
|
2688
|
-
const serialized = meta.get("graph_json");
|
|
2689
|
-
return serialized && serialized.length > 0 ? serialized : null;
|
|
2690
|
-
} finally {
|
|
2691
|
-
db.close();
|
|
2692
|
-
}
|
|
2693
|
-
} catch {
|
|
2694
|
-
fs5.rmSync(twin, { force: true });
|
|
2695
|
-
return null;
|
|
2696
|
-
}
|
|
2697
|
-
}
|
|
2698
2690
|
function toNode(r) {
|
|
2699
2691
|
const loc = [r.l0, r.l1, r.l2, r.l3].filter((v) => typeof v === "number");
|
|
2700
2692
|
return {
|
|
@@ -2959,12 +2951,12 @@ function indexBackedGraph(index, source, answeredBy) {
|
|
|
2959
2951
|
}
|
|
2960
2952
|
function loadGraph(graphPath, source = graphPath) {
|
|
2961
2953
|
const index = openGraphIndex(graphPath);
|
|
2954
|
+
const twinCurrent = index !== null;
|
|
2962
2955
|
if (index) {
|
|
2963
2956
|
if (index.edgeCount >= INDEXED_READ_MIN_EDGES) return indexBackedGraph(index, source, graphPath);
|
|
2964
2957
|
index.close();
|
|
2965
2958
|
}
|
|
2966
|
-
const
|
|
2967
|
-
const raw = fromTwin ?? fs6.readFileSync(graphPath, "utf-8");
|
|
2959
|
+
const raw = fs6.readFileSync(graphPath, "utf-8");
|
|
2968
2960
|
const parsed = JSON.parse(raw);
|
|
2969
2961
|
let foreignAdapted = false;
|
|
2970
2962
|
let candidate = parsed;
|
|
@@ -2978,8 +2970,8 @@ function loadGraph(graphPath, source = graphPath) {
|
|
|
2978
2970
|
const v = validateGraph(candidate);
|
|
2979
2971
|
if (!v.ok) throw new Error(`invalid graph at ${graphPath}: ${v.errors.slice(0, 3).join("; ")}`);
|
|
2980
2972
|
const graph = candidate;
|
|
2981
|
-
if (
|
|
2982
|
-
emitSqliteTwin(graph,
|
|
2973
|
+
if (!twinCurrent && !foreignAdapted) {
|
|
2974
|
+
emitSqliteTwin(graph, graphPath);
|
|
2983
2975
|
}
|
|
2984
2976
|
const byId = new Map(graph.nodes.map((n) => [n.id, n]));
|
|
2985
2977
|
const outM = /* @__PURE__ */ new Map();
|
|
@@ -3024,7 +3016,7 @@ function resolveSeeds(g, seed, limit = 5) {
|
|
|
3024
3016
|
}
|
|
3025
3017
|
|
|
3026
3018
|
// src/scripts/code_graph/verbs.ts
|
|
3027
|
-
import * as
|
|
3019
|
+
import * as path6 from "node:path";
|
|
3028
3020
|
function isAcceptedEdge(e) {
|
|
3029
3021
|
return isStatedResolution(e.resolved_via);
|
|
3030
3022
|
}
|
|
@@ -3065,7 +3057,7 @@ function seedsForFiles(g, files) {
|
|
|
3065
3057
|
continue;
|
|
3066
3058
|
}
|
|
3067
3059
|
if (symbols.some((s) => s.startsWith(`${f}#`))) continue;
|
|
3068
|
-
if (EXT_LANG[
|
|
3060
|
+
if (EXT_LANG[path6.extname(f).toLowerCase()] === void 0) notIndexed.push(f);
|
|
3069
3061
|
else unresolved.push(f);
|
|
3070
3062
|
}
|
|
3071
3063
|
return {
|
|
@@ -3163,12 +3155,12 @@ var MAX_PATHS = 5;
|
|
|
3163
3155
|
var OUTSIDE_WORKSPACE = "<outside-workspace>";
|
|
3164
3156
|
var MAX_ROWS_PER_SESSION = 200;
|
|
3165
3157
|
function feederFile(workspaceRoot, sessionKey) {
|
|
3166
|
-
return
|
|
3158
|
+
return path7.join(workspaceRoot, "agents", "state", "graph-feeder", `${sessionKey}.jsonl`);
|
|
3167
3159
|
}
|
|
3168
3160
|
function toRepoRelative(root, paths) {
|
|
3169
3161
|
let realRoot = null;
|
|
3170
3162
|
return paths.map((p) => {
|
|
3171
|
-
if (!
|
|
3163
|
+
if (!path7.isAbsolute(p)) return p;
|
|
3172
3164
|
const raw = _relativeInside(root, p);
|
|
3173
3165
|
if (raw !== null) return raw;
|
|
3174
3166
|
realRoot ??= _resolveReal(root);
|
|
@@ -3178,32 +3170,32 @@ function toRepoRelative(root, paths) {
|
|
|
3178
3170
|
function _relativeInside(from, to) {
|
|
3179
3171
|
let rel2;
|
|
3180
3172
|
try {
|
|
3181
|
-
rel2 =
|
|
3173
|
+
rel2 = path7.relative(from, to);
|
|
3182
3174
|
} catch {
|
|
3183
3175
|
return null;
|
|
3184
3176
|
}
|
|
3185
3177
|
if (rel2 === "") return ".";
|
|
3186
|
-
if (rel2 === ".." || rel2.startsWith(`..${
|
|
3187
|
-
return rel2.split(
|
|
3178
|
+
if (rel2 === ".." || rel2.startsWith(`..${path7.sep}`) || path7.isAbsolute(rel2)) return null;
|
|
3179
|
+
return rel2.split(path7.sep).join("/");
|
|
3188
3180
|
}
|
|
3189
3181
|
function _resolveReal(p) {
|
|
3190
|
-
const abs =
|
|
3182
|
+
const abs = path7.resolve(p);
|
|
3191
3183
|
const tail = [];
|
|
3192
3184
|
let cur = abs;
|
|
3193
3185
|
for (; ; ) {
|
|
3194
3186
|
try {
|
|
3195
3187
|
const real = fs7.realpathSync(cur);
|
|
3196
|
-
return tail.length === 0 ? real :
|
|
3188
|
+
return tail.length === 0 ? real : path7.join(real, ...[...tail].reverse());
|
|
3197
3189
|
} catch {
|
|
3198
|
-
const parent =
|
|
3190
|
+
const parent = path7.dirname(cur);
|
|
3199
3191
|
if (parent === cur) return abs;
|
|
3200
|
-
tail.push(
|
|
3192
|
+
tail.push(path7.basename(cur));
|
|
3201
3193
|
cur = parent;
|
|
3202
3194
|
}
|
|
3203
3195
|
}
|
|
3204
3196
|
}
|
|
3205
3197
|
function _escapesWorkspace(p) {
|
|
3206
|
-
return
|
|
3198
|
+
return path7.isAbsolute(p) || path7.win32.isAbsolute(p) || p === ".." || p.startsWith("../") || p.startsWith(`..${path7.sep}`);
|
|
3207
3199
|
}
|
|
3208
3200
|
function graphUntestedVerdict(root, state, paths) {
|
|
3209
3201
|
const none = { verdict: null, untested: 0, tested: 0 };
|
|
@@ -3211,14 +3203,14 @@ function graphUntestedVerdict(root, state, paths) {
|
|
|
3211
3203
|
if (paths.length === 0) return none;
|
|
3212
3204
|
let picked;
|
|
3213
3205
|
try {
|
|
3214
|
-
picked = pickSource(detectSources(root,
|
|
3206
|
+
picked = pickSource(detectSources(root, projectHome(root).cachePath));
|
|
3215
3207
|
} catch {
|
|
3216
3208
|
return none;
|
|
3217
3209
|
}
|
|
3218
3210
|
if (!picked || picked.kind === "scip") return none;
|
|
3219
3211
|
let g;
|
|
3220
3212
|
try {
|
|
3221
|
-
g = loadGraph(picked.path, `${picked.kind}:${
|
|
3213
|
+
g = loadGraph(picked.path, `${picked.kind}:${path7.relative(root, picked.path)}`);
|
|
3222
3214
|
} catch {
|
|
3223
3215
|
return none;
|
|
3224
3216
|
}
|
|
@@ -3248,7 +3240,7 @@ function appendFeederRow(workspaceRoot, sessionKey, row) {
|
|
|
3248
3240
|
} catch {
|
|
3249
3241
|
}
|
|
3250
3242
|
if (existing >= MAX_ROWS_PER_SESSION) return;
|
|
3251
|
-
fs7.mkdirSync(
|
|
3243
|
+
fs7.mkdirSync(path7.dirname(file), { recursive: true });
|
|
3252
3244
|
fs7.appendFileSync(file, `${JSON.stringify(row)}
|
|
3253
3245
|
`);
|
|
3254
3246
|
} catch {
|
|
@@ -3298,7 +3290,7 @@ function buildFeederRow(input) {
|
|
|
3298
3290
|
// src/scripts/hooks/svg_obligation.ts
|
|
3299
3291
|
import * as crypto from "node:crypto";
|
|
3300
3292
|
import * as fs8 from "node:fs";
|
|
3301
|
-
import * as
|
|
3293
|
+
import * as path8 from "node:path";
|
|
3302
3294
|
var EDIT_TOOLS = /* @__PURE__ */ new Set(["Edit", "Write", "MultiEdit", "NotebookEdit"]);
|
|
3303
3295
|
var PLANTED_PREFIXES = [
|
|
3304
3296
|
"tests/design-artifacts/fixtures/",
|
|
@@ -3309,9 +3301,9 @@ function hasErrorFinding(m) {
|
|
|
3309
3301
|
return Array.isArray(f) && f.some((x) => x?.severity === "error");
|
|
3310
3302
|
}
|
|
3311
3303
|
var rel = (root, p) => {
|
|
3312
|
-
const slashed = p.split(
|
|
3313
|
-
if (!
|
|
3314
|
-
const inside =
|
|
3304
|
+
const slashed = p.split(path8.sep).join("/");
|
|
3305
|
+
if (!path8.isAbsolute(p)) return path8.posix.normalize(slashed).replace(/^\.\//, "");
|
|
3306
|
+
const inside = path8.relative(root, p).split(path8.sep).join("/");
|
|
3315
3307
|
return inside === "" || inside.startsWith("../") ? slashed : inside;
|
|
3316
3308
|
};
|
|
3317
3309
|
function isPlantedFixture(relPath, root = "") {
|
|
@@ -3319,7 +3311,7 @@ function isPlantedFixture(relPath, root = "") {
|
|
|
3319
3311
|
return PLANTED_PREFIXES.some((prefix) => norm.startsWith(prefix));
|
|
3320
3312
|
}
|
|
3321
3313
|
function readAssetManifests(root) {
|
|
3322
|
-
const dir =
|
|
3314
|
+
const dir = path8.join(root, RENDER_REL);
|
|
3323
3315
|
let entries;
|
|
3324
3316
|
try {
|
|
3325
3317
|
entries = fs8.readdirSync(dir);
|
|
@@ -3330,7 +3322,7 @@ function readAssetManifests(root) {
|
|
|
3330
3322
|
for (const name of entries) {
|
|
3331
3323
|
let raw;
|
|
3332
3324
|
try {
|
|
3333
|
-
raw = fs8.readFileSync(
|
|
3325
|
+
raw = fs8.readFileSync(path8.join(dir, name, "manifest.json"), "utf8");
|
|
3334
3326
|
} catch {
|
|
3335
3327
|
continue;
|
|
3336
3328
|
}
|
|
@@ -3358,7 +3350,7 @@ var TRANSCRIPT_FALLBACK_REASON = "transcript fallback: no readable `post_tool_us
|
|
|
3358
3350
|
function recordVerdict(root, abs, digest, records) {
|
|
3359
3351
|
let changed = false;
|
|
3360
3352
|
for (const r of records) {
|
|
3361
|
-
if (
|
|
3353
|
+
if (path8.resolve(root, r.file) !== abs || r.file_digest !== digest) continue;
|
|
3362
3354
|
const read = recordedManifest(root, r);
|
|
3363
3355
|
if (read === null) continue;
|
|
3364
3356
|
if ("changed" in read) {
|
|
@@ -3381,7 +3373,7 @@ function readSvgObligations(root, inputs) {
|
|
|
3381
3373
|
if (seen.has(relPath)) continue;
|
|
3382
3374
|
seen.add(relPath);
|
|
3383
3375
|
if (isPlantedFixture(relPath, root)) continue;
|
|
3384
|
-
const abs =
|
|
3376
|
+
const abs = path8.isAbsolute(raw) ? raw : path8.join(root, relPath);
|
|
3385
3377
|
let bytes;
|
|
3386
3378
|
try {
|
|
3387
3379
|
bytes = fs8.readFileSync(abs);
|
|
@@ -3390,7 +3382,7 @@ function readSvgObligations(root, inputs) {
|
|
|
3390
3382
|
}
|
|
3391
3383
|
const digest = crypto.createHash("sha256").update(bytes).digest("hex");
|
|
3392
3384
|
if (Array.isArray(inputs.recorded)) {
|
|
3393
|
-
const verdict = recordVerdict(root,
|
|
3385
|
+
const verdict = recordVerdict(root, path8.resolve(root, abs), digest, inputs.recorded);
|
|
3394
3386
|
if (verdict === "verified" || verdict === "static-only") discharged.push({ file: relPath, kind: verdict });
|
|
3395
3387
|
else open.push({ file: relPath, reason: verdict });
|
|
3396
3388
|
continue;
|
|
@@ -3425,14 +3417,14 @@ function readSvgObligations(root, inputs) {
|
|
|
3425
3417
|
function renderNames(commands, relPath) {
|
|
3426
3418
|
const base = relPath.split("/").pop() ?? relPath;
|
|
3427
3419
|
return commands.some((c) => {
|
|
3428
|
-
const slashed = c.split(
|
|
3420
|
+
const slashed = c.split(path8.sep).join("/");
|
|
3429
3421
|
const bounded = (needle) => new RegExp(`(^|[\\s/'"])${escapeRe(needle)}(\\s|$|['"])`).test(slashed);
|
|
3430
3422
|
return bounded(relPath) || bounded(base);
|
|
3431
3423
|
});
|
|
3432
3424
|
}
|
|
3433
3425
|
function writesRenderDir(command) {
|
|
3434
3426
|
if (isPureRender(command)) return false;
|
|
3435
|
-
const slashed = command.split(
|
|
3427
|
+
const slashed = command.split(path8.sep).join("/");
|
|
3436
3428
|
const names = /(^|[\s/'"])(render\/|manifest\.json\b)/.test(slashed) || slashed.includes("state/render");
|
|
3437
3429
|
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(
|
|
3438
3430
|
slashed.replace(/\s\d?>&\d\b/g, " ").replace(/\s2>\s*\/dev\/null\b/g, " ")
|
|
@@ -3461,7 +3453,7 @@ function openSvgObligation(workspaceRoot, toolCalls, recordedRaw = null) {
|
|
|
3461
3453
|
}
|
|
3462
3454
|
return { path: p, rendered };
|
|
3463
3455
|
});
|
|
3464
|
-
const renderDir = RENDER_REL.split(
|
|
3456
|
+
const renderDir = RENDER_REL.split(path8.sep).join("/");
|
|
3465
3457
|
const renderDirTampered = toolCalls.some((c) => {
|
|
3466
3458
|
if (EDIT_TOOLS.has(c.name) && c.path !== void 0) {
|
|
3467
3459
|
return rel(workspaceRoot, c.path).startsWith(`${renderDir}/`);
|
|
@@ -3556,13 +3548,13 @@ import { spawnSync as spawnSync2 } from "node:child_process";
|
|
|
3556
3548
|
import * as crypto2 from "node:crypto";
|
|
3557
3549
|
import * as fs10 from "node:fs";
|
|
3558
3550
|
import * as os from "node:os";
|
|
3559
|
-
import * as
|
|
3551
|
+
import * as path10 from "node:path";
|
|
3560
3552
|
import { fileURLToPath as fileURLToPath4, pathToFileURL as pathToFileURL4 } from "node:url";
|
|
3561
3553
|
|
|
3562
3554
|
// src/scripts/_lib/review_baseline.ts
|
|
3563
3555
|
import { spawnSync } from "node:child_process";
|
|
3564
3556
|
import * as fs9 from "node:fs";
|
|
3565
|
-
import * as
|
|
3557
|
+
import * as path9 from "node:path";
|
|
3566
3558
|
function currentHeadSha(cwd) {
|
|
3567
3559
|
try {
|
|
3568
3560
|
const r = spawnSync("git", ["rev-parse", "HEAD"], { cwd, encoding: "utf8" });
|
|
@@ -3573,12 +3565,12 @@ function currentHeadSha(cwd) {
|
|
|
3573
3565
|
return null;
|
|
3574
3566
|
}
|
|
3575
3567
|
}
|
|
3576
|
-
var BASELINE_STATE_REL =
|
|
3568
|
+
var BASELINE_STATE_REL = path9.join("agents", "runtime", "state", "review-baseline");
|
|
3577
3569
|
function baselineStateDir(workspaceRoot) {
|
|
3578
|
-
return
|
|
3570
|
+
return path9.join(workspaceRoot, BASELINE_STATE_REL);
|
|
3579
3571
|
}
|
|
3580
3572
|
function baselineStateFile(workspaceRoot, sessionKey) {
|
|
3581
|
-
return
|
|
3573
|
+
return path9.join(baselineStateDir(workspaceRoot), `${sessionKey}.json`);
|
|
3582
3574
|
}
|
|
3583
3575
|
function parseBaseline(raw) {
|
|
3584
3576
|
let decoded;
|
|
@@ -3718,8 +3710,8 @@ function isSafeTranscriptPath(rawPath, opts = {}) {
|
|
|
3718
3710
|
try {
|
|
3719
3711
|
const realHome = fs10.realpathSync(homeDir);
|
|
3720
3712
|
const realPath = fs10.realpathSync(rawPath);
|
|
3721
|
-
const relative6 =
|
|
3722
|
-
if (relative6 === "" || relative6.startsWith("..") ||
|
|
3713
|
+
const relative6 = path10.relative(realHome, realPath);
|
|
3714
|
+
if (relative6 === "" || relative6.startsWith("..") || path10.isAbsolute(relative6)) {
|
|
3723
3715
|
return false;
|
|
3724
3716
|
}
|
|
3725
3717
|
const { size } = fs10.statSync(realPath);
|
|
@@ -3780,7 +3772,7 @@ var BINARY_PROBE_BYTES = 8e3;
|
|
|
3780
3772
|
var UNTRACKED_FILE_READ_CAP_BYTES = 8 * 1024 * 1024;
|
|
3781
3773
|
function untrackedFileLineCount(cwd, relPath) {
|
|
3782
3774
|
try {
|
|
3783
|
-
const abs =
|
|
3775
|
+
const abs = path10.resolve(cwd, relPath);
|
|
3784
3776
|
const size = fs10.statSync(abs).size;
|
|
3785
3777
|
if (size === 0) return 0;
|
|
3786
3778
|
if (size > UNTRACKED_FILE_READ_CAP_BYTES) {
|
|
@@ -3877,19 +3869,19 @@ function appendReviewSkippedTelemetry(workspaceRoot, diffLines, mutationMeasure,
|
|
|
3877
3869
|
});
|
|
3878
3870
|
if (errors.length || line === null) return;
|
|
3879
3871
|
try {
|
|
3880
|
-
const dir =
|
|
3872
|
+
const dir = path10.join(workspaceRoot, "agents", "runtime", "state", "audit");
|
|
3881
3873
|
fs10.mkdirSync(dir, { recursive: true });
|
|
3882
|
-
const file =
|
|
3874
|
+
const file = path10.join(dir, `${ts.slice(0, 7)}.jsonl`);
|
|
3883
3875
|
fs10.appendFileSync(file, `${JSON.stringify(line)}
|
|
3884
3876
|
`, "utf8");
|
|
3885
3877
|
} catch {
|
|
3886
3878
|
}
|
|
3887
3879
|
}
|
|
3888
3880
|
function sessionStateDir(workspaceRoot) {
|
|
3889
|
-
return
|
|
3881
|
+
return path10.join(workspaceRoot, "agents", "runtime", "state", "end-review-nudge");
|
|
3890
3882
|
}
|
|
3891
3883
|
function sessionStateFile(workspaceRoot, sessionKey) {
|
|
3892
|
-
return
|
|
3884
|
+
return path10.join(sessionStateDir(workspaceRoot), `${sessionKey}.json`);
|
|
3893
3885
|
}
|
|
3894
3886
|
function deriveSessionKey2(envelope, payload) {
|
|
3895
3887
|
const raw = str(envelope["session_id"]) || str(payload["transcript_path"] ?? payload["transcriptPath"]);
|
|
@@ -3995,13 +3987,13 @@ function _isCliEntry4() {
|
|
|
3995
3987
|
if (process.argv[1] === void 0) {
|
|
3996
3988
|
return false;
|
|
3997
3989
|
}
|
|
3998
|
-
const argvUrl = pathToFileURL4(
|
|
3990
|
+
const argvUrl = pathToFileURL4(path10.resolve(process.argv[1])).href;
|
|
3999
3991
|
if (import.meta.url === argvUrl) {
|
|
4000
3992
|
return true;
|
|
4001
3993
|
}
|
|
4002
3994
|
try {
|
|
4003
3995
|
const here = fs10.realpathSync(fileURLToPath4(import.meta.url));
|
|
4004
|
-
const argv = fs10.realpathSync(
|
|
3996
|
+
const argv = fs10.realpathSync(path10.resolve(process.argv[1]));
|
|
4005
3997
|
return here === argv;
|
|
4006
3998
|
} catch {
|
|
4007
3999
|
return false;
|
|
@@ -4212,7 +4204,7 @@ function detectPromissory(reply) {
|
|
|
4212
4204
|
function readCiSettled(workspaceRoot, session_id) {
|
|
4213
4205
|
if (!hasStableSessionId(session_id)) return { seen: false, settled: false };
|
|
4214
4206
|
try {
|
|
4215
|
-
const raw = fs12.readFileSync(
|
|
4207
|
+
const raw = fs12.readFileSync(path11.join(workspaceRoot, statePathFor(session_id)), "utf-8");
|
|
4216
4208
|
const decoded = JSON.parse(raw);
|
|
4217
4209
|
if (!owns_session_state(decoded, session_id)) return { seen: false, settled: false };
|
|
4218
4210
|
if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
|
|
@@ -4249,7 +4241,7 @@ function readLanguagePin(workspaceRoot, session_id) {
|
|
|
4249
4241
|
if (!hasStableSessionId(session_id)) return "und";
|
|
4250
4242
|
try {
|
|
4251
4243
|
const raw = fs12.readFileSync(
|
|
4252
|
-
|
|
4244
|
+
path11.join(workspaceRoot, statePathFor2(session_id)),
|
|
4253
4245
|
"utf-8"
|
|
4254
4246
|
);
|
|
4255
4247
|
const decoded = JSON.parse(raw);
|
|
@@ -4582,13 +4574,13 @@ function _isCliEntry5() {
|
|
|
4582
4574
|
if (process.argv[1] === void 0) {
|
|
4583
4575
|
return false;
|
|
4584
4576
|
}
|
|
4585
|
-
const argvUrl = pathToFileURL5(
|
|
4577
|
+
const argvUrl = pathToFileURL5(path11.resolve(process.argv[1])).href;
|
|
4586
4578
|
if (import.meta.url === argvUrl) {
|
|
4587
4579
|
return true;
|
|
4588
4580
|
}
|
|
4589
4581
|
try {
|
|
4590
4582
|
const here = fs12.realpathSync(fileURLToPath5(import.meta.url));
|
|
4591
|
-
const argv = fs12.realpathSync(
|
|
4583
|
+
const argv = fs12.realpathSync(path11.resolve(process.argv[1]));
|
|
4592
4584
|
return here === argv;
|
|
4593
4585
|
} catch {
|
|
4594
4586
|
return false;
|
|
@@ -4602,7 +4594,7 @@ if (_isCliEntry5()) {
|
|
|
4602
4594
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
4603
4595
|
import crypto3 from "node:crypto";
|
|
4604
4596
|
import fs13 from "node:fs";
|
|
4605
|
-
import
|
|
4597
|
+
import path12 from "node:path";
|
|
4606
4598
|
import { fileURLToPath as fileURLToPath6, pathToFileURL as pathToFileURL6 } from "node:url";
|
|
4607
4599
|
|
|
4608
4600
|
// src/scripts/_lib/test_delta.ts
|
|
@@ -4621,7 +4613,7 @@ function isTestPath(p) {
|
|
|
4621
4613
|
}
|
|
4622
4614
|
|
|
4623
4615
|
// src/scripts/hooks/evidence_independence.ts
|
|
4624
|
-
var STATE_FILE3 =
|
|
4616
|
+
var STATE_FILE3 = path12.join("agents", "state", "evidence-dispatch.json");
|
|
4625
4617
|
function _isObject5(v) {
|
|
4626
4618
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
4627
4619
|
}
|
|
@@ -4690,7 +4682,7 @@ function extractDispatch(envelope) {
|
|
|
4690
4682
|
function _ledgerStamp(consumer_root, session_id) {
|
|
4691
4683
|
try {
|
|
4692
4684
|
const raw = fs13.readFileSync(
|
|
4693
|
-
|
|
4685
|
+
path12.join(consumer_root, ledgerFileFor(session_id)),
|
|
4694
4686
|
"utf8"
|
|
4695
4687
|
);
|
|
4696
4688
|
const d = JSON.parse(raw);
|
|
@@ -4785,7 +4777,7 @@ function run3(stdin_text, options) {
|
|
|
4785
4777
|
return EXIT_ALLOW;
|
|
4786
4778
|
}
|
|
4787
4779
|
}
|
|
4788
|
-
const target =
|
|
4780
|
+
const target = path12.join(options.consumer_root, STATE_FILE3);
|
|
4789
4781
|
const state = _load(target);
|
|
4790
4782
|
const session_id = typeof envelope["session_id"] === "string" ? envelope["session_id"] : "";
|
|
4791
4783
|
const turnMarker = `${session_id}:${_ledgerStamp(options.consumer_root, session_id)}`;
|
|
@@ -4853,13 +4845,13 @@ function _isCliEntry6() {
|
|
|
4853
4845
|
if (process.argv[1] === void 0) {
|
|
4854
4846
|
return false;
|
|
4855
4847
|
}
|
|
4856
|
-
const argvUrl = pathToFileURL6(
|
|
4848
|
+
const argvUrl = pathToFileURL6(path12.resolve(process.argv[1])).href;
|
|
4857
4849
|
if (import.meta.url === argvUrl) {
|
|
4858
4850
|
return true;
|
|
4859
4851
|
}
|
|
4860
4852
|
try {
|
|
4861
4853
|
const here = fs13.realpathSync(fileURLToPath6(import.meta.url));
|
|
4862
|
-
const argv = fs13.realpathSync(
|
|
4854
|
+
const argv = fs13.realpathSync(path12.resolve(process.argv[1]));
|
|
4863
4855
|
return here === argv;
|
|
4864
4856
|
} catch {
|
|
4865
4857
|
return false;
|
|
@@ -4871,7 +4863,7 @@ if (_isCliEntry6()) {
|
|
|
4871
4863
|
|
|
4872
4864
|
// src/scripts/hooks/delegation_nudge_hook.ts
|
|
4873
4865
|
import fs16 from "node:fs";
|
|
4874
|
-
import
|
|
4866
|
+
import path14 from "node:path";
|
|
4875
4867
|
import { fileURLToPath as fileURLToPath7, pathToFileURL as pathToFileURL7 } from "node:url";
|
|
4876
4868
|
|
|
4877
4869
|
// src/scripts/_lib/auto_dispatch.ts
|
|
@@ -5205,11 +5197,11 @@ import * as fs15 from "node:fs";
|
|
|
5205
5197
|
|
|
5206
5198
|
// src/scripts/ai_council/kind_flip_state.ts
|
|
5207
5199
|
import * as fs14 from "node:fs";
|
|
5208
|
-
import * as
|
|
5209
|
-
var KIND_FLIPS_RELPATH =
|
|
5200
|
+
import * as path13 from "node:path";
|
|
5201
|
+
var KIND_FLIPS_RELPATH = path13.join("agents", "runtime", "state", "hand-kind-flips.json");
|
|
5210
5202
|
function isKindFlipped(stateRoot, kind) {
|
|
5211
5203
|
try {
|
|
5212
|
-
const raw = JSON.parse(fs14.readFileSync(
|
|
5204
|
+
const raw = JSON.parse(fs14.readFileSync(path13.join(stateRoot, KIND_FLIPS_RELPATH), "utf8"));
|
|
5213
5205
|
return raw.kinds?.[kind]?.route === "free";
|
|
5214
5206
|
} catch {
|
|
5215
5207
|
return false;
|
|
@@ -5509,13 +5501,13 @@ function _isCliEntry7() {
|
|
|
5509
5501
|
if (process.argv[1] === void 0) {
|
|
5510
5502
|
return false;
|
|
5511
5503
|
}
|
|
5512
|
-
const argvUrl = pathToFileURL7(
|
|
5504
|
+
const argvUrl = pathToFileURL7(path14.resolve(process.argv[1])).href;
|
|
5513
5505
|
if (import.meta.url === argvUrl) {
|
|
5514
5506
|
return true;
|
|
5515
5507
|
}
|
|
5516
5508
|
try {
|
|
5517
5509
|
const here = fs16.realpathSync(fileURLToPath7(import.meta.url));
|
|
5518
|
-
const argv = fs16.realpathSync(
|
|
5510
|
+
const argv = fs16.realpathSync(path14.resolve(process.argv[1]));
|
|
5519
5511
|
return here === argv;
|
|
5520
5512
|
} catch {
|
|
5521
5513
|
return false;
|
|
@@ -5526,7 +5518,7 @@ if (_isCliEntry7()) {
|
|
|
5526
5518
|
}
|
|
5527
5519
|
|
|
5528
5520
|
// src/scripts/conformance_scan.ts
|
|
5529
|
-
var REPO_ROOT =
|
|
5521
|
+
var REPO_ROOT = path15.resolve(path15.dirname(fileURLToPath8(import.meta.url)), "..", "..");
|
|
5530
5522
|
var OBSERVED_BAND = { low: 9.1, high: 39.2 };
|
|
5531
5523
|
var BAND_MIN_TURNS = 1978;
|
|
5532
5524
|
var CARRIER_CHANGES = [
|
|
@@ -5892,7 +5884,7 @@ function scanSession(sessionId, lines) {
|
|
|
5892
5884
|
closeWindow();
|
|
5893
5885
|
return report;
|
|
5894
5886
|
}
|
|
5895
|
-
var DEFAULT_RATE_SERIES =
|
|
5887
|
+
var DEFAULT_RATE_SERIES = path15.join(
|
|
5896
5888
|
REPO_ROOT,
|
|
5897
5889
|
"agents",
|
|
5898
5890
|
"runtime",
|
|
@@ -5901,7 +5893,7 @@ var DEFAULT_RATE_SERIES = path14.join(
|
|
|
5901
5893
|
);
|
|
5902
5894
|
function defaultStore(projectDir) {
|
|
5903
5895
|
const slug = projectStoreSlug(projectDir);
|
|
5904
|
-
return
|
|
5896
|
+
return path15.join(process.env["HOME"] ?? "", ".claude", "projects", slug);
|
|
5905
5897
|
}
|
|
5906
5898
|
function _tokens(chars) {
|
|
5907
5899
|
return Math.round(chars / 4);
|
|
@@ -5926,13 +5918,13 @@ function measureDelivered(projectRulesDir, globalRulesDir) {
|
|
|
5926
5918
|
};
|
|
5927
5919
|
}
|
|
5928
5920
|
function storeKey(store) {
|
|
5929
|
-
return createHash4("sha256").update(
|
|
5921
|
+
return createHash4("sha256").update(path15.resolve(store)).digest("hex").slice(0, 12);
|
|
5930
5922
|
}
|
|
5931
5923
|
function scanStore(store, limit) {
|
|
5932
|
-
const files = fs17.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ f, m: fs17.statSync(
|
|
5924
|
+
const files = fs17.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ f, m: fs17.statSync(path15.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.f);
|
|
5933
5925
|
const per_session = [];
|
|
5934
5926
|
for (const f of files) {
|
|
5935
|
-
const lines = fs17.readFileSync(
|
|
5927
|
+
const lines = fs17.readFileSync(path15.join(store, f), "utf8").split("\n");
|
|
5936
5928
|
const r = scanSession(f.replace(/\.jsonl$/, "").slice(0, 8), lines);
|
|
5937
5929
|
if (r.assistant_turns > 0) {
|
|
5938
5930
|
per_session.push(r);
|
|
@@ -5960,10 +5952,10 @@ function scanStore(store, limit) {
|
|
|
5960
5952
|
const task_completeness_rate_pct = completeness_windows === 0 ? 0 : Number((100 * task_completeness / completeness_windows).toFixed(1));
|
|
5961
5953
|
const era = spansCarrierChange(per_session.map((s) => s.first_at));
|
|
5962
5954
|
const delivered = measureDelivered(
|
|
5963
|
-
|
|
5964
|
-
|
|
5955
|
+
path15.join(REPO_ROOT, ".claude", "rules"),
|
|
5956
|
+
path15.join(process.env["HOME"] ?? os2.homedir(), ".claude", "rules")
|
|
5965
5957
|
);
|
|
5966
|
-
const ownStore =
|
|
5958
|
+
const ownStore = path15.resolve(store) === path15.resolve(defaultStore(REPO_ROOT));
|
|
5967
5959
|
return {
|
|
5968
5960
|
scanned_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5969
5961
|
store,
|
|
@@ -5993,7 +5985,7 @@ function scanStore(store, limit) {
|
|
|
5993
5985
|
};
|
|
5994
5986
|
}
|
|
5995
5987
|
function recordRate(file, scanned_at, rate) {
|
|
5996
|
-
fs17.mkdirSync(
|
|
5988
|
+
fs17.mkdirSync(path15.dirname(file), { recursive: true });
|
|
5997
5989
|
fs17.appendFileSync(file, `${JSON.stringify({ measured_at: scanned_at, ...rate })}
|
|
5998
5990
|
`, "utf8");
|
|
5999
5991
|
}
|
|
@@ -6172,13 +6164,13 @@ function _isCliEntry8() {
|
|
|
6172
6164
|
if (process.argv[1] === void 0) {
|
|
6173
6165
|
return false;
|
|
6174
6166
|
}
|
|
6175
|
-
const argvUrl = pathToFileURL8(
|
|
6167
|
+
const argvUrl = pathToFileURL8(path15.resolve(process.argv[1])).href;
|
|
6176
6168
|
if (import.meta.url === argvUrl) {
|
|
6177
6169
|
return true;
|
|
6178
6170
|
}
|
|
6179
6171
|
try {
|
|
6180
6172
|
const here = fs17.realpathSync(fileURLToPath8(import.meta.url));
|
|
6181
|
-
const argv = fs17.realpathSync(
|
|
6173
|
+
const argv = fs17.realpathSync(path15.resolve(process.argv[1]));
|
|
6182
6174
|
return here === argv;
|
|
6183
6175
|
} catch {
|
|
6184
6176
|
return false;
|
|
@@ -6191,14 +6183,14 @@ if (_isCliEntry8()) {
|
|
|
6191
6183
|
// src/scripts/report_carrier_divergence.ts
|
|
6192
6184
|
import * as fs18 from "node:fs";
|
|
6193
6185
|
import * as os3 from "node:os";
|
|
6194
|
-
import * as
|
|
6186
|
+
import * as path16 from "node:path";
|
|
6195
6187
|
import process2 from "node:process";
|
|
6196
6188
|
import { fileURLToPath as fileURLToPath9, pathToFileURL as pathToFileURL9 } from "node:url";
|
|
6197
6189
|
var _HERE2 = fileURLToPath9(import.meta.url);
|
|
6198
|
-
var REPO_ROOT2 =
|
|
6199
|
-
var PROJECT_RULES =
|
|
6200
|
-
var PROJECTION_SOURCE =
|
|
6201
|
-
var GLOBAL_RULES =
|
|
6190
|
+
var REPO_ROOT2 = path16.resolve(path16.dirname(_HERE2), "..", "..");
|
|
6191
|
+
var PROJECT_RULES = path16.join(".claude", "rules");
|
|
6192
|
+
var PROJECTION_SOURCE = path16.join("dist", "agent-src", "rules");
|
|
6193
|
+
var GLOBAL_RULES = path16.join(".claude", "rules");
|
|
6202
6194
|
function _listRules(dir) {
|
|
6203
6195
|
try {
|
|
6204
6196
|
return fs18.readdirSync(dir).filter((f) => f.endsWith(".md")).sort();
|
|
@@ -6244,7 +6236,7 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
|
|
|
6244
6236
|
}
|
|
6245
6237
|
if (!inP && inG) {
|
|
6246
6238
|
out.globalOnly.push(rule);
|
|
6247
|
-
if (sourceDir !== void 0 && _ruleType(
|
|
6239
|
+
if (sourceDir !== void 0 && _ruleType(path16.join(sourceDir, rule)) === "manual") {
|
|
6248
6240
|
out.manualOnlyGlobal.push(rule);
|
|
6249
6241
|
}
|
|
6250
6242
|
continue;
|
|
@@ -6254,8 +6246,8 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
|
|
|
6254
6246
|
let projectCopy;
|
|
6255
6247
|
let globalCopy;
|
|
6256
6248
|
try {
|
|
6257
|
-
projectCopy = fs18.readFileSync(
|
|
6258
|
-
globalCopy = fs18.readFileSync(
|
|
6249
|
+
projectCopy = fs18.readFileSync(path16.join(projectDir, rule));
|
|
6250
|
+
globalCopy = fs18.readFileSync(path16.join(globalDir, rule));
|
|
6259
6251
|
verdict = comparePair(projectCopy, globalCopy);
|
|
6260
6252
|
} catch {
|
|
6261
6253
|
out.shared -= 1;
|
|
@@ -6402,9 +6394,9 @@ function render2(d) {
|
|
|
6402
6394
|
}
|
|
6403
6395
|
function main9(argv) {
|
|
6404
6396
|
const args = argv ?? process2.argv.slice(2);
|
|
6405
|
-
let projectDir =
|
|
6406
|
-
let globalDir =
|
|
6407
|
-
let sourceDir =
|
|
6397
|
+
let projectDir = path16.join(REPO_ROOT2, PROJECT_RULES);
|
|
6398
|
+
let globalDir = path16.join(os3.homedir(), GLOBAL_RULES);
|
|
6399
|
+
let sourceDir = path16.join(REPO_ROOT2, PROJECTION_SOURCE);
|
|
6408
6400
|
const value = (i) => {
|
|
6409
6401
|
const v = args[i + 1];
|
|
6410
6402
|
return v === void 0 || v.startsWith("-") ? null : v;
|
|
@@ -6418,7 +6410,7 @@ function main9(argv) {
|
|
|
6418
6410
|
`);
|
|
6419
6411
|
return 1;
|
|
6420
6412
|
}
|
|
6421
|
-
const resolved =
|
|
6413
|
+
const resolved = path16.resolve(v);
|
|
6422
6414
|
if (a === "--project") projectDir = resolved;
|
|
6423
6415
|
else if (a === "--global") globalDir = resolved;
|
|
6424
6416
|
else sourceDir = resolved;
|
|
@@ -6440,9 +6432,9 @@ function main9(argv) {
|
|
|
6440
6432
|
}
|
|
6441
6433
|
function _isCliEntry9() {
|
|
6442
6434
|
if (process2.argv[1] === void 0) return false;
|
|
6443
|
-
if (import.meta.url === pathToFileURL9(
|
|
6435
|
+
if (import.meta.url === pathToFileURL9(path16.resolve(process2.argv[1])).href) return true;
|
|
6444
6436
|
try {
|
|
6445
|
-
return fs18.realpathSync(_HERE2) === fs18.realpathSync(
|
|
6437
|
+
return fs18.realpathSync(_HERE2) === fs18.realpathSync(path16.resolve(process2.argv[1]));
|
|
6446
6438
|
} catch {
|
|
6447
6439
|
return false;
|
|
6448
6440
|
}
|
|
@@ -6454,10 +6446,10 @@ if (_isCliEntry9()) {
|
|
|
6454
6446
|
// src/scripts/report_skill_activation.ts
|
|
6455
6447
|
import * as fs19 from "node:fs";
|
|
6456
6448
|
import * as os4 from "node:os";
|
|
6457
|
-
import * as
|
|
6449
|
+
import * as path17 from "node:path";
|
|
6458
6450
|
import { fileURLToPath as fileURLToPath10, pathToFileURL as pathToFileURL10 } from "node:url";
|
|
6459
6451
|
var _HERE3 = fileURLToPath10(import.meta.url);
|
|
6460
|
-
var REPO_ROOT3 =
|
|
6452
|
+
var REPO_ROOT3 = path17.resolve(path17.dirname(_HERE3), "..", "..");
|
|
6461
6453
|
var SKILLS_ROOT = "src/skills";
|
|
6462
6454
|
var TRIGGER_KEYS = ["triggers:", "trigger_description:", "file_pattern:", "path_prefix:"];
|
|
6463
6455
|
var DETERMINISTIC_RE = /^\s*(?:[-*]\s*)?(?:\*\*)?(MUST|NEVER|ALWAYS)\b/m;
|
|
@@ -6475,7 +6467,7 @@ function censusSkills(root) {
|
|
|
6475
6467
|
if (!entry.isDirectory()) {
|
|
6476
6468
|
continue;
|
|
6477
6469
|
}
|
|
6478
|
-
const file =
|
|
6470
|
+
const file = path17.join(root, entry.name, "SKILL.md");
|
|
6479
6471
|
if (!fs19.existsSync(file)) {
|
|
6480
6472
|
continue;
|
|
6481
6473
|
}
|
|
@@ -6486,7 +6478,7 @@ function censusSkills(root) {
|
|
|
6486
6478
|
if (TRIGGER_KEYS.some((k) => new RegExp(`^${k}`, "m").test(fm))) {
|
|
6487
6479
|
out.withTriggerKey.push(entry.name);
|
|
6488
6480
|
}
|
|
6489
|
-
if (fs19.existsSync(
|
|
6481
|
+
if (fs19.existsSync(path17.join(root, entry.name, "evals", "triggers.json"))) {
|
|
6490
6482
|
out.withTriggerCorpus.push(entry.name);
|
|
6491
6483
|
}
|
|
6492
6484
|
const body = fmEnd === -1 ? text : text.slice(fmEnd + 4);
|
|
@@ -6497,14 +6489,14 @@ function censusSkills(root) {
|
|
|
6497
6489
|
return out;
|
|
6498
6490
|
}
|
|
6499
6491
|
function defaultStore2(cwd) {
|
|
6500
|
-
return
|
|
6492
|
+
return path17.join(os4.homedir(), ".claude", "projects", projectStoreSlug(cwd));
|
|
6501
6493
|
}
|
|
6502
6494
|
function measureUsage(store, limit) {
|
|
6503
6495
|
const rep = { store, sessions: 0, assistantTurns: 0, invocations: 0, bySkill: {} };
|
|
6504
6496
|
if (!fs19.existsSync(store)) {
|
|
6505
6497
|
return rep;
|
|
6506
6498
|
}
|
|
6507
|
-
const files = fs19.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) =>
|
|
6499
|
+
const files = fs19.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => path17.join(store, f)).sort((a, b) => fs19.statSync(b).mtimeMs - fs19.statSync(a).mtimeMs).slice(0, limit);
|
|
6508
6500
|
rep.sessions = files.length;
|
|
6509
6501
|
for (const file of files) {
|
|
6510
6502
|
for (const line of fs19.readFileSync(file, "utf8").split("\n")) {
|
|
@@ -6580,11 +6572,11 @@ function buildRecord(census, usage, today) {
|
|
|
6580
6572
|
assistant_turns: usage.reduce((a, u) => a + u.assistantTurns, 0),
|
|
6581
6573
|
invocations: usage.reduce((a, u) => a + u.invocations, 0),
|
|
6582
6574
|
distinct_skills_invoked: distinct.size,
|
|
6583
|
-
stores: usage.map((u) =>
|
|
6575
|
+
stores: usage.map((u) => path17.basename(u.store))
|
|
6584
6576
|
};
|
|
6585
6577
|
}
|
|
6586
6578
|
function readRecord(repoRoot) {
|
|
6587
|
-
const file =
|
|
6579
|
+
const file = path17.join(repoRoot, RECORD_PATH);
|
|
6588
6580
|
if (!fs19.existsSync(file)) {
|
|
6589
6581
|
return null;
|
|
6590
6582
|
}
|
|
@@ -6623,7 +6615,7 @@ function render3(census, usage, published = null) {
|
|
|
6623
6615
|
}
|
|
6624
6616
|
totalInv += u.invocations;
|
|
6625
6617
|
lines.push(
|
|
6626
|
-
` ${
|
|
6618
|
+
` ${path17.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)}`
|
|
6627
6619
|
);
|
|
6628
6620
|
}
|
|
6629
6621
|
lines.push("");
|
|
@@ -6727,7 +6719,7 @@ function main10(argv) {
|
|
|
6727
6719
|
if (stores.length === 0) {
|
|
6728
6720
|
stores.push(defaultStore2(REPO_ROOT3));
|
|
6729
6721
|
}
|
|
6730
|
-
const census = censusSkills(
|
|
6722
|
+
const census = censusSkills(path17.join(root, SKILLS_ROOT));
|
|
6731
6723
|
const usage = stores.map((s) => measureUsage(s, limit));
|
|
6732
6724
|
process.stdout.write(`${render3(census, usage, readRecord(root))}
|
|
6733
6725
|
`);
|
|
@@ -6748,8 +6740,8 @@ function main10(argv) {
|
|
|
6748
6740
|
return 1;
|
|
6749
6741
|
}
|
|
6750
6742
|
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
6751
|
-
const file =
|
|
6752
|
-
fs19.mkdirSync(
|
|
6743
|
+
const file = path17.join(root, RECORD_PATH);
|
|
6744
|
+
fs19.mkdirSync(path17.dirname(file), { recursive: true });
|
|
6753
6745
|
fs19.writeFileSync(file, `${JSON.stringify(buildRecord(census, usage, today), null, 2)}
|
|
6754
6746
|
`);
|
|
6755
6747
|
process.stdout.write(`
|
|
@@ -6757,18 +6749,18 @@ wrote ${RECORD_PATH} (measured ${today})
|
|
|
6757
6749
|
`);
|
|
6758
6750
|
return 0;
|
|
6759
6751
|
}
|
|
6760
|
-
if (process.argv[1] !== void 0 && import.meta.url === pathToFileURL10(
|
|
6752
|
+
if (process.argv[1] !== void 0 && import.meta.url === pathToFileURL10(path17.resolve(process.argv[1])).href) {
|
|
6761
6753
|
process.exit(main10(process.argv.slice(2)));
|
|
6762
6754
|
}
|
|
6763
6755
|
|
|
6764
6756
|
// src/scripts/report_skill_obligation_violations.ts
|
|
6765
6757
|
import * as fs20 from "node:fs";
|
|
6766
6758
|
import * as os5 from "node:os";
|
|
6767
|
-
import * as
|
|
6759
|
+
import * as path18 from "node:path";
|
|
6768
6760
|
import process3 from "node:process";
|
|
6769
6761
|
import { fileURLToPath as fileURLToPath11, pathToFileURL as pathToFileURL11 } from "node:url";
|
|
6770
6762
|
var _HERE4 = fileURLToPath11(import.meta.url);
|
|
6771
|
-
var REPO_ROOT4 =
|
|
6763
|
+
var REPO_ROOT4 = path18.resolve(path18.dirname(_HERE4), "..", "..");
|
|
6772
6764
|
var OBLIGATION_LINE_RE = new RegExp(`${DETERMINISTIC_RE.source}.*`, "gm");
|
|
6773
6765
|
var PATH_RE = /`([A-Za-z0-9_./-]*\/[A-Za-z0-9_.-]+\.[a-z]{2,6})`/g;
|
|
6774
6766
|
var CMD_RE = /`([a-z][a-z0-9-]*(?: [a-z][a-z0-9:._-]*){1,3})`/g;
|
|
@@ -6806,7 +6798,7 @@ function _artefacts(line) {
|
|
|
6806
6798
|
return out;
|
|
6807
6799
|
}
|
|
6808
6800
|
function extractObligations(repoRoot) {
|
|
6809
|
-
const skillsRoot =
|
|
6801
|
+
const skillsRoot = path18.join(repoRoot, SKILLS_ROOT);
|
|
6810
6802
|
const census = censusSkills(skillsRoot);
|
|
6811
6803
|
const out = {
|
|
6812
6804
|
skills: census.withDeterministicObligation,
|
|
@@ -6820,7 +6812,7 @@ function extractObligations(repoRoot) {
|
|
|
6820
6812
|
for (const skill of census.withDeterministicObligation) {
|
|
6821
6813
|
let text;
|
|
6822
6814
|
try {
|
|
6823
|
-
text = fs20.readFileSync(
|
|
6815
|
+
text = fs20.readFileSync(path18.join(skillsRoot, skill, "SKILL.md"), "utf-8");
|
|
6824
6816
|
} catch {
|
|
6825
6817
|
continue;
|
|
6826
6818
|
}
|
|
@@ -6936,7 +6928,7 @@ function scanSessionForViolations(session, lines, forbidden, parsed) {
|
|
|
6936
6928
|
return flags;
|
|
6937
6929
|
}
|
|
6938
6930
|
function defaultStore3(cwd) {
|
|
6939
|
-
return
|
|
6931
|
+
return path18.join(os5.homedir(), ".claude", "projects", projectStoreSlug(cwd));
|
|
6940
6932
|
}
|
|
6941
6933
|
function scanStore2(repoRoot, store, limit) {
|
|
6942
6934
|
const census = extractObligations(repoRoot);
|
|
@@ -6949,14 +6941,14 @@ function scanStore2(repoRoot, store, limit) {
|
|
|
6949
6941
|
};
|
|
6950
6942
|
let files;
|
|
6951
6943
|
try {
|
|
6952
|
-
files = fs20.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ p:
|
|
6944
|
+
files = fs20.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ p: path18.join(store, f), m: fs20.statSync(path18.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.p);
|
|
6953
6945
|
} catch {
|
|
6954
6946
|
return report;
|
|
6955
6947
|
}
|
|
6956
6948
|
report.sessions = files.length;
|
|
6957
6949
|
for (const file of files) {
|
|
6958
6950
|
const lines = fs20.readFileSync(file, "utf-8").split("\n");
|
|
6959
|
-
const id =
|
|
6951
|
+
const id = path18.basename(file).replace(/\.jsonl$/, "").slice(0, 8);
|
|
6960
6952
|
const entries = _parseSession(lines);
|
|
6961
6953
|
if (loadedSkillsFrom(entries).size > 0) report.sessionsWithASkill += 1;
|
|
6962
6954
|
report.flags.push(...scanSessionForViolations(id, lines, census.forbidden, entries));
|
|
@@ -7081,9 +7073,9 @@ function main11(argv) {
|
|
|
7081
7073
|
}
|
|
7082
7074
|
function _isCliEntry10() {
|
|
7083
7075
|
if (process3.argv[1] === void 0) return false;
|
|
7084
|
-
if (import.meta.url === pathToFileURL11(
|
|
7076
|
+
if (import.meta.url === pathToFileURL11(path18.resolve(process3.argv[1])).href) return true;
|
|
7085
7077
|
try {
|
|
7086
|
-
return fs20.realpathSync(_HERE4) === fs20.realpathSync(
|
|
7078
|
+
return fs20.realpathSync(_HERE4) === fs20.realpathSync(path18.resolve(process3.argv[1]));
|
|
7087
7079
|
} catch {
|
|
7088
7080
|
return false;
|
|
7089
7081
|
}
|
|
@@ -7094,18 +7086,18 @@ if (_isCliEntry10()) {
|
|
|
7094
7086
|
|
|
7095
7087
|
// src/scripts/report_conformance_funnel.ts
|
|
7096
7088
|
var _HERE5 = fileURLToPath12(import.meta.url);
|
|
7097
|
-
var REPO_ROOT5 =
|
|
7089
|
+
var REPO_ROOT5 = path19.resolve(path19.dirname(_HERE5), "..", "..");
|
|
7098
7090
|
function buildFunnel(opts = {}) {
|
|
7099
7091
|
const repoRoot = opts.repoRoot ?? REPO_ROOT5;
|
|
7100
|
-
const projectRulesDir = opts.projectRulesDir ??
|
|
7101
|
-
const globalRulesDir = opts.globalRulesDir ??
|
|
7102
|
-
const sourceDir = opts.sourceDir ??
|
|
7092
|
+
const projectRulesDir = opts.projectRulesDir ?? path19.join(repoRoot, PROJECT_RULES);
|
|
7093
|
+
const globalRulesDir = opts.globalRulesDir ?? path19.join(os6.homedir(), GLOBAL_RULES);
|
|
7094
|
+
const sourceDir = opts.sourceDir ?? path19.join(repoRoot, PROJECTION_SOURCE);
|
|
7103
7095
|
const store = opts.store ?? defaultStore(repoRoot);
|
|
7104
7096
|
const limit = opts.limit ?? 30;
|
|
7105
7097
|
return {
|
|
7106
7098
|
delivered: measureDelivered(projectRulesDir, globalRulesDir),
|
|
7107
7099
|
divergence: compareCarriers(projectRulesDir, globalRulesDir, sourceDir),
|
|
7108
|
-
skills: censusSkills(
|
|
7100
|
+
skills: censusSkills(path19.join(repoRoot, SKILLS_ROOT)),
|
|
7109
7101
|
usage: measureUsage(store, limit),
|
|
7110
7102
|
storePresent: fs21.existsSync(store),
|
|
7111
7103
|
sk2: scanStore2(repoRoot, store, limit)
|
|
@@ -7248,7 +7240,7 @@ function main12(argv) {
|
|
|
7248
7240
|
`);
|
|
7249
7241
|
return 1;
|
|
7250
7242
|
}
|
|
7251
|
-
const resolved =
|
|
7243
|
+
const resolved = path19.resolve(v);
|
|
7252
7244
|
if (a === "--store") opts.store = resolved;
|
|
7253
7245
|
else if (a === "--project") opts.projectRulesDir = resolved;
|
|
7254
7246
|
else if (a === "--global") opts.globalRulesDir = resolved;
|
|
@@ -7280,9 +7272,9 @@ function main12(argv) {
|
|
|
7280
7272
|
}
|
|
7281
7273
|
function _isCliEntry11() {
|
|
7282
7274
|
if (process4.argv[1] === void 0) return false;
|
|
7283
|
-
if (import.meta.url === pathToFileURL12(
|
|
7275
|
+
if (import.meta.url === pathToFileURL12(path19.resolve(process4.argv[1])).href) return true;
|
|
7284
7276
|
try {
|
|
7285
|
-
return fs21.realpathSync(_HERE5) === fs21.realpathSync(
|
|
7277
|
+
return fs21.realpathSync(_HERE5) === fs21.realpathSync(path19.resolve(process4.argv[1]));
|
|
7286
7278
|
} catch {
|
|
7287
7279
|
return false;
|
|
7288
7280
|
}
|
|
@@ -7319,7 +7311,7 @@ function conformanceLogPath() {
|
|
|
7319
7311
|
if (override && override.trim().length > 0) {
|
|
7320
7312
|
return override;
|
|
7321
7313
|
}
|
|
7322
|
-
return
|
|
7314
|
+
return path20.join(os7.homedir(), ".event4u", "agent-config", "conformance-log.jsonl");
|
|
7323
7315
|
}
|
|
7324
7316
|
function installLogPath() {
|
|
7325
7317
|
const override = process5.env["AGENT_CONFIG_INSTALL_LOG"];
|
|
@@ -7366,10 +7358,10 @@ function _check_txlog_clean(logPath = installLogPath(), projectRoot = null) {
|
|
|
7366
7358
|
};
|
|
7367
7359
|
}
|
|
7368
7360
|
function routeTargetPaths(target) {
|
|
7369
|
-
return routeTargetPathsPosix(target).map((rel2) =>
|
|
7361
|
+
return routeTargetPathsPosix(target).map((rel2) => path20.join(...rel2.split("/")));
|
|
7370
7362
|
}
|
|
7371
7363
|
function _check_router_pointers(packageRoot = PACKAGE_ROOT) {
|
|
7372
|
-
const routerPath =
|
|
7364
|
+
const routerPath = path20.join(packageRoot, "dist", "router.json");
|
|
7373
7365
|
if (!fs22.existsSync(routerPath)) {
|
|
7374
7366
|
return {
|
|
7375
7367
|
id: "router-pointers",
|
|
@@ -7389,13 +7381,13 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT) {
|
|
|
7389
7381
|
remedy: "reinstall the package \u2014 dist/router.json is corrupt"
|
|
7390
7382
|
};
|
|
7391
7383
|
}
|
|
7392
|
-
const rulesDir =
|
|
7384
|
+
const rulesDir = path20.join(packageRoot, "dist", "agent-src", "rules");
|
|
7393
7385
|
const broken = [];
|
|
7394
7386
|
let ids = 0;
|
|
7395
7387
|
let targets = 0;
|
|
7396
7388
|
for (const kernelId of router["kernel"] ?? []) {
|
|
7397
7389
|
ids += 1;
|
|
7398
|
-
if (!fs22.existsSync(
|
|
7390
|
+
if (!fs22.existsSync(path20.join(rulesDir, `${kernelId}.md`))) {
|
|
7399
7391
|
broken.push(`kernel:${kernelId} \u2192 rules/${kernelId}.md missing`);
|
|
7400
7392
|
}
|
|
7401
7393
|
}
|
|
@@ -7403,7 +7395,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT) {
|
|
|
7403
7395
|
for (const entry of router[tier] ?? []) {
|
|
7404
7396
|
const ruleId = String(entry["id"] ?? "");
|
|
7405
7397
|
ids += 1;
|
|
7406
|
-
if (!fs22.existsSync(
|
|
7398
|
+
if (!fs22.existsSync(path20.join(rulesDir, `${ruleId}.md`))) {
|
|
7407
7399
|
broken.push(`${tier}:${ruleId} \u2192 rules/${ruleId}.md missing`);
|
|
7408
7400
|
}
|
|
7409
7401
|
for (const target of entry["routes_to"] ?? []) {
|
|
@@ -7413,7 +7405,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT) {
|
|
|
7413
7405
|
broken.push(`${ruleId} \u2192 unparseable routes_to ${JSON.stringify(target)}`);
|
|
7414
7406
|
continue;
|
|
7415
7407
|
}
|
|
7416
|
-
if (!candidates.some((rel2) => fs22.existsSync(
|
|
7408
|
+
if (!candidates.some((rel2) => fs22.existsSync(path20.join(packageRoot, rel2)))) {
|
|
7417
7409
|
broken.push(`${ruleId} \u2192 ${target} (${candidates[0]} missing)`);
|
|
7418
7410
|
}
|
|
7419
7411
|
}
|
|
@@ -7445,8 +7437,8 @@ function detectSmokePlatform(projectRoot) {
|
|
|
7445
7437
|
return "claude";
|
|
7446
7438
|
}
|
|
7447
7439
|
function dispatcherRunner(packageRoot) {
|
|
7448
|
-
const localTsx =
|
|
7449
|
-
const script =
|
|
7440
|
+
const localTsx = path20.join(packageRoot, "node_modules", ".bin", "tsx");
|
|
7441
|
+
const script = path20.join(packageRoot, "src", "scripts", "hooks", "dispatch_hook.ts");
|
|
7450
7442
|
if (fs22.existsSync(localTsx)) {
|
|
7451
7443
|
return [localTsx, script];
|
|
7452
7444
|
}
|
|
@@ -7497,7 +7489,7 @@ function _check_hook_dispatcher(projectRoot, packageRoot = PACKAGE_ROOT, opts =
|
|
|
7497
7489
|
};
|
|
7498
7490
|
}
|
|
7499
7491
|
function readSettingsMode(projectRoot) {
|
|
7500
|
-
const settingsPath =
|
|
7492
|
+
const settingsPath = path20.join(projectRoot, ".agent-settings.yml");
|
|
7501
7493
|
if (!fs22.existsSync(settingsPath)) {
|
|
7502
7494
|
return "eager-all";
|
|
7503
7495
|
}
|
|
@@ -7513,7 +7505,7 @@ function readSettingsMode(projectRoot) {
|
|
|
7513
7505
|
function kernelIdsFromRouter(packageRoot) {
|
|
7514
7506
|
try {
|
|
7515
7507
|
const router = JSON.parse(
|
|
7516
|
-
fs22.readFileSync(
|
|
7508
|
+
fs22.readFileSync(path20.join(packageRoot, "dist", "router.json"), "utf8")
|
|
7517
7509
|
);
|
|
7518
7510
|
return new Set((router["kernel"] ?? []).map(String));
|
|
7519
7511
|
} catch {
|
|
@@ -7530,7 +7522,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT, project
|
|
|
7530
7522
|
remedy: "set lean_projection.mode to 'eager-all' or 'thin' in .agent-settings.yml"
|
|
7531
7523
|
};
|
|
7532
7524
|
}
|
|
7533
|
-
const rulesDir = projectedRulesDir ??
|
|
7525
|
+
const rulesDir = projectedRulesDir ?? path20.join(projectRoot, ".augment", "rules");
|
|
7534
7526
|
if (!fs22.existsSync(rulesDir)) {
|
|
7535
7527
|
return {
|
|
7536
7528
|
id: "lean-projection",
|
|
@@ -7554,7 +7546,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT, project
|
|
|
7554
7546
|
for (const f of nonKernel) {
|
|
7555
7547
|
let text = "";
|
|
7556
7548
|
try {
|
|
7557
|
-
text = fs22.readFileSync(
|
|
7549
|
+
text = fs22.readFileSync(path20.join(rulesDir, f), "utf8");
|
|
7558
7550
|
} catch {
|
|
7559
7551
|
continue;
|
|
7560
7552
|
}
|
|
@@ -7585,7 +7577,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT, project
|
|
|
7585
7577
|
function _check_host_manifest(projectRoot) {
|
|
7586
7578
|
const detected = Object.entries(detectToolPresence(projectRoot)).filter(([, v]) => v === true).map(([k]) => k);
|
|
7587
7579
|
const detectedNote = detected.length > 0 ? `detected surfaces: ${detected.join(", ")}` : "no surfaces detected";
|
|
7588
|
-
const settingsPath =
|
|
7580
|
+
const settingsPath = path20.join(projectRoot, ".agent-settings.yml");
|
|
7589
7581
|
if (!fs22.existsSync(settingsPath)) {
|
|
7590
7582
|
return {
|
|
7591
7583
|
id: "host-manifest",
|
|
@@ -7770,13 +7762,13 @@ function _isCliEntry12() {
|
|
|
7770
7762
|
if (process5.argv[1] === void 0) {
|
|
7771
7763
|
return false;
|
|
7772
7764
|
}
|
|
7773
|
-
const argvUrl = pathToFileURL13(
|
|
7765
|
+
const argvUrl = pathToFileURL13(path20.resolve(process5.argv[1])).href;
|
|
7774
7766
|
if (import.meta.url === argvUrl) {
|
|
7775
7767
|
return true;
|
|
7776
7768
|
}
|
|
7777
7769
|
try {
|
|
7778
7770
|
const here = fs22.realpathSync(fileURLToPath13(import.meta.url));
|
|
7779
|
-
const argv = fs22.realpathSync(
|
|
7771
|
+
const argv = fs22.realpathSync(path20.resolve(process5.argv[1]));
|
|
7780
7772
|
return here === argv;
|
|
7781
7773
|
} catch {
|
|
7782
7774
|
return false;
|