@event4u/agent-config 13.0.0 → 14.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +160 -333
- package/README.md +1 -1
- package/dist/agent-src/commands/evals/roadmap.json +8 -0
- package/dist/agent-src/commands/fix/ci.md +39 -1
- package/dist/agent-src/commands/pr/create.md +65 -4
- package/dist/agent-src/commands/roadmap/next.md +28 -5
- package/dist/agent-src/commands/work.md +16 -0
- package/dist/agent-src/contexts/contracts/command-suggestion-flow.md +47 -0
- package/dist/agent-src/contexts/execution/contract-decision-sheet.md +94 -0
- package/dist/agent-src/contexts/execution/plan-confidence-gate.md +30 -0
- package/dist/agent-src/contexts/execution/roadmap-execution-contract.md +21 -8
- package/dist/agent-src/contexts/execution/roadmap-process-loop.md +55 -8
- package/dist/agent-src/contexts/execution/subagent-response-contract.md +42 -0
- package/dist/agent-src/contexts/execution/subagent-spawn-contract.md +29 -0
- package/dist/agent-src/rules/command-suggestion-policy.md +33 -0
- package/dist/agent-src/rules/design-review-after-ui-write.md +25 -8
- package/dist/agent-src/rules/ui-audit-gate.md +25 -8
- package/dist/agent-src/scripts/gate_execute.ts +395 -0
- package/dist/agent-src/scripts/resume_probe.ts +422 -0
- package/dist/agent-src/scripts/roadmap_gates.ts +138 -4
- package/dist/agent-src/scripts/update_roadmap_progress.ts +53 -2
- package/dist/agent-src/skills/ai-council/SKILL.md +61 -0
- package/dist/agent-src/skills/experiment-loop/SKILL.md +116 -0
- package/dist/agent-src/skills/experiment-loop/evals/output-schema.yml +27 -0
- package/dist/agent-src/skills/experiment-loop/evals/triggers.json +17 -0
- package/dist/agent-src/skills/experiment-loop/references/pivot-ladder.md +54 -0
- package/dist/agent-src/skills/experiment-loop/references/protocol.md +61 -0
- package/dist/agent-src/skills/experiment-loop/references/register-format.md +66 -0
- package/dist/agent-src/skills/roadmap-management/SKILL.md +2 -2
- package/dist/agent-src/skills/roadmap-writing/SKILL.md +1 -1
- package/dist/agent-src/skills/subagent-orchestration/schemas/team-review-status.json +8 -3
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/roadmaps.md +43 -3
- package/dist/cli/registry.js +1 -0
- package/dist/cli/registry.js.map +1 -1
- package/dist/cli-delegate/{chunk-N7FEST6D.js → chunk-7PZ4FSZB.js} +351 -174
- package/dist/cli-delegate/{chunk-3B72LSZL.js → chunk-F3YUF7SA.js} +1 -1
- package/dist/cli-delegate/cmd_conformance.js +224 -104
- package/dist/cli-delegate/cmd_doctor.js +2 -2
- package/dist/cli-delegate/cmd_handoff.js +1 -1
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +40 -18
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +3 -3
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +6 -5
- package/dist/discovery/trust-report.md +2 -2
- package/dist/discovery/workspaces.json +5 -4
- package/dist/hooks/dispatch.js +2018 -1320
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +1652 -892
- package/dist/router.json +1 -1
- package/dist/scripts/condense.js +1 -1
- package/dist/scripts/condense.js.map +1 -1
- package/dist/ui/assets/{index-B0aMJnuz.js → index-C1pBRm1f.js} +2 -2
- package/dist/ui/assets/index-C1pBRm1f.js.map +1 -0
- package/dist/ui/index.html +1 -1
- package/package.json +1 -1
- package/src/agent-src/scripts/gate_execute.ts +395 -0
- package/src/agent-src/scripts/resume_probe.ts +422 -0
- package/src/agent-src/scripts/roadmap_gates.ts +138 -4
- package/src/agent-src/scripts/update_roadmap_progress.ts +53 -2
- package/src/config/ci-local-parity.yml +13 -0
- package/src/config/evaluator-budgets.json +4 -4
- package/src/config/gate-coverage.yml +111 -5
- package/src/config/gate-violation-baselines.json +2 -2
- package/src/config/rule-activation-census.json +41 -0
- package/src/config/rule-stub-ceilings.json +52 -0
- package/src/scripts/_dispatch.bash +4 -0
- package/src/scripts/_lib/evaluator_contract.ts +159 -0
- package/src/scripts/_lib/gh_transient.ts +80 -0
- package/src/scripts/_lib/release_material.ts +16 -5
- package/src/scripts/_lib/review_independence.ts +111 -0
- package/src/scripts/_lib/session_register.ts +14 -0
- package/src/scripts/_lib/skill_catalogue.ts +20 -0
- package/src/scripts/_lib/skill_catalogue_series.ts +411 -0
- package/src/scripts/_lib/turn_end_refusals.ts +482 -0
- package/src/scripts/ai_council/_py_json.ts +96 -0
- package/src/scripts/ai_council/cli_call_budget.ts +357 -0
- package/src/scripts/ai_council/clients.ts +80 -143
- package/src/scripts/ai_council/config.ts +25 -11
- package/src/scripts/ai_council/probe_store.ts +196 -0
- package/src/scripts/ai_council/qualification.ts +425 -0
- package/src/scripts/ai_council/qualification_wiring.ts +243 -0
- package/src/scripts/ai_council/quorum_wiring.ts +211 -0
- package/src/scripts/ai_team/team_dispatch.ts +40 -6
- package/src/scripts/capture_skill_catalogue.ts +264 -4
- package/src/scripts/check_evaluator_schema.ts +249 -0
- package/src/scripts/check_pr_ci_current.ts +409 -0
- package/src/scripts/check_review_schema.ts +195 -0
- package/src/scripts/check_rule_activation_census.ts +451 -0
- package/src/scripts/check_rule_stub_ceiling.ts +1128 -0
- package/src/scripts/condense.ts +1 -1
- package/src/scripts/council_cli.ts +141 -191
- package/src/scripts/dispatch_r2_reviewer.ts +8 -1
- package/src/scripts/hook_manifest.yaml +72 -5
- package/src/scripts/hooks/concern_registry.ts +4 -0
- package/src/scripts/hooks/dispatch_hook.ts +43 -1
- package/src/scripts/hooks/interruption_ledger_hook.ts +256 -0
- package/src/scripts/hooks/ship_diff_volume_hook.ts +180 -0
- package/src/scripts/hooks/turn_end_gate_hook.ts +119 -26
- package/src/scripts/hooks_doctor.ts +112 -0
- package/src/scripts/interruption_report.ts +443 -0
- package/src/scripts/lint_evidence_artifacts.ts +359 -0
- package/src/scripts/lint_roadmap_blockers.ts +65 -0
- package/src/scripts/lint_roadmap_complexity.ts +7 -1
- package/src/scripts/release.ts +38 -53
- package/src/scripts/rule_activation_census.ts +292 -0
- package/src/scripts/schemas/evaluator-output.schema.json +60 -0
- package/src/scripts/schemas/review-findings.schema.json +31 -0
- package/src/scripts/self_review_gate.ts +6 -0
- package/src/scripts/session_register_hook.ts +30 -1
- package/src/scripts/sync_pr_branch.ts +271 -0
- package/src/scripts/test_council_qualification.ts +213 -0
- package/dist/ui/assets/index-B0aMJnuz.js.map +0 -1
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
frontmatterPaths,
|
|
23
23
|
proseEqual,
|
|
24
24
|
splitFrontmatter
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-F3YUF7SA.js";
|
|
26
26
|
import "./chunk-FTAISGDQ.js";
|
|
27
27
|
import {
|
|
28
28
|
atomic_write_json,
|
|
@@ -33,7 +33,7 @@ import "./chunk-Q26HT4QT.js";
|
|
|
33
33
|
import {
|
|
34
34
|
projectStoreSlug,
|
|
35
35
|
resolveSessionRole
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-7PZ4FSZB.js";
|
|
37
37
|
import "./chunk-PZWRPRWP.js";
|
|
38
38
|
import "./chunk-M2DPGFZ4.js";
|
|
39
39
|
import {
|
|
@@ -41,7 +41,9 @@ import {
|
|
|
41
41
|
manifest_path,
|
|
42
42
|
read_manifest
|
|
43
43
|
} from "./chunk-63WSP6YZ.js";
|
|
44
|
-
import
|
|
44
|
+
import {
|
|
45
|
+
read_lockfile
|
|
46
|
+
} from "./chunk-GRRPEPRN.js";
|
|
45
47
|
import "./chunk-NXFWFAYV.js";
|
|
46
48
|
import {
|
|
47
49
|
load_agent_settings
|
|
@@ -64,7 +66,7 @@ import {
|
|
|
64
66
|
var YAML = __toESM(require_dist(), 1);
|
|
65
67
|
import * as fs15 from "node:fs";
|
|
66
68
|
import * as os7 from "node:os";
|
|
67
|
-
import * as
|
|
69
|
+
import * as path16 from "node:path";
|
|
68
70
|
import process6 from "node:process";
|
|
69
71
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
70
72
|
import { fileURLToPath as fileURLToPath15, pathToFileURL as pathToFileURL15 } from "node:url";
|
|
@@ -130,7 +132,7 @@ function routeTargetPathsPosix(target) {
|
|
|
130
132
|
// src/scripts/report_conformance_funnel.ts
|
|
131
133
|
import * as fs14 from "node:fs";
|
|
132
134
|
import * as os6 from "node:os";
|
|
133
|
-
import * as
|
|
135
|
+
import * as path15 from "node:path";
|
|
134
136
|
import process5 from "node:process";
|
|
135
137
|
import { fileURLToPath as fileURLToPath14, pathToFileURL as pathToFileURL14 } from "node:url";
|
|
136
138
|
|
|
@@ -138,7 +140,7 @@ import { fileURLToPath as fileURLToPath14, pathToFileURL as pathToFileURL14 } fr
|
|
|
138
140
|
import { createHash as createHash4 } from "node:crypto";
|
|
139
141
|
import fs10 from "node:fs";
|
|
140
142
|
import os2 from "node:os";
|
|
141
|
-
import
|
|
143
|
+
import path11 from "node:path";
|
|
142
144
|
import { fileURLToPath as fileURLToPath10, pathToFileURL as pathToFileURL10 } from "node:url";
|
|
143
145
|
|
|
144
146
|
// src/scripts/_lib/transcript_entry.ts
|
|
@@ -1342,9 +1344,8 @@ if (isCliEntry) {
|
|
|
1342
1344
|
}
|
|
1343
1345
|
|
|
1344
1346
|
// src/scripts/hooks/turn_end_gate_hook.ts
|
|
1345
|
-
import * as crypto3 from "node:crypto";
|
|
1346
1347
|
import * as fs7 from "node:fs";
|
|
1347
|
-
import * as
|
|
1348
|
+
import * as path8 from "node:path";
|
|
1348
1349
|
import { fileURLToPath as fileURLToPath7, pathToFileURL as pathToFileURL7 } from "node:url";
|
|
1349
1350
|
|
|
1350
1351
|
// src/scripts/hooks/end_review_nudge_hook.ts
|
|
@@ -2172,6 +2173,110 @@ function _isCliEntry6() {
|
|
|
2172
2173
|
}
|
|
2173
2174
|
if (_isCliEntry6()) process.exit(main6());
|
|
2174
2175
|
|
|
2176
|
+
// src/scripts/_lib/turn_end_refusals.ts
|
|
2177
|
+
import * as crypto3 from "node:crypto";
|
|
2178
|
+
import * as path7 from "node:path";
|
|
2179
|
+
var DETECTOR_IDS = [
|
|
2180
|
+
"promissory",
|
|
2181
|
+
"language",
|
|
2182
|
+
"verification",
|
|
2183
|
+
"completion"
|
|
2184
|
+
];
|
|
2185
|
+
var REFUSAL_STATE_REL = path7.join("agents", "runtime", "state", "turn-end-gate");
|
|
2186
|
+
function refusalStateDir(workspaceRoot) {
|
|
2187
|
+
return path7.join(workspaceRoot, REFUSAL_STATE_REL);
|
|
2188
|
+
}
|
|
2189
|
+
function deriveSessionKey2(sessionId) {
|
|
2190
|
+
return crypto3.createHash("sha256").update(sessionId).digest("hex").slice(0, 32);
|
|
2191
|
+
}
|
|
2192
|
+
function sessionRefusalFile(workspaceRoot, sessionKey) {
|
|
2193
|
+
return path7.join(refusalStateDir(workspaceRoot), `${sessionKey}.json`);
|
|
2194
|
+
}
|
|
2195
|
+
function emptyCounts() {
|
|
2196
|
+
return { promissory: 0, language: 0, verification: 0, completion: 0 };
|
|
2197
|
+
}
|
|
2198
|
+
function isDetector(v) {
|
|
2199
|
+
return typeof v === "string" && DETECTOR_IDS.includes(v);
|
|
2200
|
+
}
|
|
2201
|
+
function parseRecord(raw) {
|
|
2202
|
+
let decoded;
|
|
2203
|
+
try {
|
|
2204
|
+
decoded = JSON.parse(raw);
|
|
2205
|
+
} catch {
|
|
2206
|
+
return null;
|
|
2207
|
+
}
|
|
2208
|
+
if (typeof decoded !== "object" || decoded === null || Array.isArray(decoded)) return null;
|
|
2209
|
+
const o = decoded;
|
|
2210
|
+
if (typeof o["refused_at"] !== "string") return null;
|
|
2211
|
+
if (typeof o["refused_turn"] !== "number") return null;
|
|
2212
|
+
if (!isDetector(o["detector"])) return null;
|
|
2213
|
+
const rec = {
|
|
2214
|
+
refused_at: o["refused_at"],
|
|
2215
|
+
refused_turn: o["refused_turn"],
|
|
2216
|
+
detector: o["detector"]
|
|
2217
|
+
};
|
|
2218
|
+
if (typeof o["first_refused_at"] === "string") rec.first_refused_at = o["first_refused_at"];
|
|
2219
|
+
if (typeof o["agent_config_version"] === "string") {
|
|
2220
|
+
rec.agent_config_version = o["agent_config_version"];
|
|
2221
|
+
}
|
|
2222
|
+
const counts = o["counts"];
|
|
2223
|
+
if (typeof counts === "object" && counts !== null && !Array.isArray(counts)) {
|
|
2224
|
+
const parsed = {};
|
|
2225
|
+
for (const id of DETECTOR_IDS) {
|
|
2226
|
+
const n = counts[id];
|
|
2227
|
+
if (typeof n === "number" && Number.isFinite(n) && n >= 0) parsed[id] = n;
|
|
2228
|
+
}
|
|
2229
|
+
rec.counts = parsed;
|
|
2230
|
+
}
|
|
2231
|
+
return rec;
|
|
2232
|
+
}
|
|
2233
|
+
function countsOf(rec) {
|
|
2234
|
+
const out = emptyCounts();
|
|
2235
|
+
if (rec.counts === void 0) {
|
|
2236
|
+
out[rec.detector] = 1;
|
|
2237
|
+
return out;
|
|
2238
|
+
}
|
|
2239
|
+
let any = false;
|
|
2240
|
+
for (const id of DETECTOR_IDS) {
|
|
2241
|
+
const n = rec.counts[id];
|
|
2242
|
+
if (typeof n === "number" && n > 0) {
|
|
2243
|
+
out[id] = n;
|
|
2244
|
+
any = true;
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2247
|
+
if (!any) out[rec.detector] = 1;
|
|
2248
|
+
return out;
|
|
2249
|
+
}
|
|
2250
|
+
function foldRefusal(prev, input) {
|
|
2251
|
+
const counts = prev === null ? emptyCounts() : countsOf(prev);
|
|
2252
|
+
for (const d of input.detectors) counts[d] += 1;
|
|
2253
|
+
const primary = input.detectors[0] ?? prev?.detector ?? "verification";
|
|
2254
|
+
const rec = {
|
|
2255
|
+
refused_at: input.at,
|
|
2256
|
+
refused_turn: input.turnOrdinal,
|
|
2257
|
+
detector: primary,
|
|
2258
|
+
first_refused_at: prev?.first_refused_at ?? prev?.refused_at ?? input.at,
|
|
2259
|
+
counts
|
|
2260
|
+
};
|
|
2261
|
+
if (input.version !== void 0) rec.agent_config_version = input.version;
|
|
2262
|
+
else if (prev?.agent_config_version !== void 0) {
|
|
2263
|
+
rec.agent_config_version = prev.agent_config_version;
|
|
2264
|
+
}
|
|
2265
|
+
return rec;
|
|
2266
|
+
}
|
|
2267
|
+
function readInstallBoundary() {
|
|
2268
|
+
try {
|
|
2269
|
+
const lock = read_lockfile();
|
|
2270
|
+
if (lock === null) return { version: null, installed_at: null };
|
|
2271
|
+
return {
|
|
2272
|
+
version: lock.agent_config_version ?? null,
|
|
2273
|
+
installed_at: lock.installed_at ?? null
|
|
2274
|
+
};
|
|
2275
|
+
} catch {
|
|
2276
|
+
return { version: null, installed_at: null };
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
|
|
2175
2280
|
// src/scripts/hooks/turn_end_gate_hook.ts
|
|
2176
2281
|
var EXIT_BLOCK2 = 1;
|
|
2177
2282
|
var EXIT_ALLOW5 = 0;
|
|
@@ -2278,7 +2383,7 @@ function detectPromissory(reply) {
|
|
|
2278
2383
|
}
|
|
2279
2384
|
function readCiSettled(workspaceRoot) {
|
|
2280
2385
|
try {
|
|
2281
|
-
const raw = fs7.readFileSync(
|
|
2386
|
+
const raw = fs7.readFileSync(path8.join(workspaceRoot, STATE_FILE3), "utf-8");
|
|
2282
2387
|
const decoded = JSON.parse(raw);
|
|
2283
2388
|
if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
|
|
2284
2389
|
const ci = decoded["ci_last"];
|
|
@@ -2312,7 +2417,7 @@ function detectCompletionClaim(reply, ci) {
|
|
|
2312
2417
|
}
|
|
2313
2418
|
function readLanguagePin(workspaceRoot) {
|
|
2314
2419
|
try {
|
|
2315
|
-
const raw = fs7.readFileSync(
|
|
2420
|
+
const raw = fs7.readFileSync(path8.join(workspaceRoot, STATE_FILE), "utf-8");
|
|
2316
2421
|
const decoded = JSON.parse(raw);
|
|
2317
2422
|
if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
|
|
2318
2423
|
const lang = decoded["language"];
|
|
@@ -2335,7 +2440,7 @@ function detectLanguage(reply, pinned) {
|
|
|
2335
2440
|
};
|
|
2336
2441
|
}
|
|
2337
2442
|
var _EDIT_TOOLS = /* @__PURE__ */ new Set(["Edit", "Write", "MultiEdit", "NotebookEdit"]);
|
|
2338
|
-
var _VERIFY_RE = /\b(test|tests|vitest|jest|pytest|phpunit|pest|tsc|eslint|ruff|mypy|pyright|clippy|typecheck|lint
|
|
2443
|
+
var _VERIFY_RE = /\b(test|tests|vitest|jest|pytest|phpunit|pest|tsc|eslint|ruff|mypy|pyright|clippy|phpstan|typecheck|lint[-_:a-z]*|build|ci|preflight|smoke[-_:a-z]*|check[-_:a-z]*|validate[-_:a-z]*)\b|\b(task|npm|pnpm|yarn|composer|cargo|go|make|php artisan|bun)\s+(run\s+)?\S*(test|check|lint|build|ci|typecheck)/i;
|
|
2339
2444
|
function isVerificationCommand(command) {
|
|
2340
2445
|
return _VERIFY_RE.test(command);
|
|
2341
2446
|
}
|
|
@@ -2360,14 +2465,8 @@ function detectUnverifiedEdit(toolCalls) {
|
|
|
2360
2465
|
reason: "this turn changed a file and then ran no verification command \u2014 no test, type-check, lint or build call follows the last edit (verify-before-complete: a claim without a fresh run is unverified)"
|
|
2361
2466
|
};
|
|
2362
2467
|
}
|
|
2363
|
-
function stateDir(workspaceRoot) {
|
|
2364
|
-
return path7.join(workspaceRoot, "agents", "runtime", "state", "turn-end-gate");
|
|
2365
|
-
}
|
|
2366
2468
|
function sessionStateFile2(workspaceRoot, sessionKey) {
|
|
2367
|
-
return
|
|
2368
|
-
}
|
|
2369
|
-
function deriveSessionKey2(sessionId) {
|
|
2370
|
-
return crypto3.createHash("sha256").update(sessionId).digest("hex").slice(0, 32);
|
|
2469
|
+
return sessionRefusalFile(workspaceRoot, sessionKey);
|
|
2371
2470
|
}
|
|
2372
2471
|
function alreadyRefusedTurn(workspaceRoot, sessionKey, turnOrdinal) {
|
|
2373
2472
|
try {
|
|
@@ -2380,14 +2479,30 @@ function alreadyRefusedTurn(workspaceRoot, sessionKey, turnOrdinal) {
|
|
|
2380
2479
|
}
|
|
2381
2480
|
return false;
|
|
2382
2481
|
}
|
|
2383
|
-
function markRefusedTurn(workspaceRoot, sessionKey, turnOrdinal,
|
|
2482
|
+
function markRefusedTurn(workspaceRoot, sessionKey, turnOrdinal, detectors) {
|
|
2384
2483
|
if (is_replay_mode()) return;
|
|
2484
|
+
const file = sessionStateFile2(workspaceRoot, sessionKey);
|
|
2485
|
+
let prev = null;
|
|
2385
2486
|
try {
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2487
|
+
prev = parseRecord(fs7.readFileSync(file, "utf-8"));
|
|
2488
|
+
} catch {
|
|
2489
|
+
}
|
|
2490
|
+
let version;
|
|
2491
|
+
try {
|
|
2492
|
+
version = readInstallBoundary().version ?? void 0;
|
|
2493
|
+
} catch {
|
|
2494
|
+
version = void 0;
|
|
2495
|
+
}
|
|
2496
|
+
try {
|
|
2497
|
+
atomic_write_json(
|
|
2498
|
+
file,
|
|
2499
|
+
foldRefusal(prev, {
|
|
2500
|
+
detectors,
|
|
2501
|
+
turnOrdinal,
|
|
2502
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2503
|
+
version
|
|
2504
|
+
})
|
|
2505
|
+
);
|
|
2391
2506
|
} catch {
|
|
2392
2507
|
}
|
|
2393
2508
|
}
|
|
@@ -2521,7 +2636,12 @@ function main7() {
|
|
|
2521
2636
|
if (f) findings.push(f);
|
|
2522
2637
|
}
|
|
2523
2638
|
if (findings.length === 0) return EXIT_ALLOW5;
|
|
2524
|
-
markRefusedTurn(
|
|
2639
|
+
markRefusedTurn(
|
|
2640
|
+
workspaceRoot,
|
|
2641
|
+
sessionKey,
|
|
2642
|
+
turnOrdinal,
|
|
2643
|
+
findings.map((f) => f.detector)
|
|
2644
|
+
);
|
|
2525
2645
|
const lines = findings.map(
|
|
2526
2646
|
(f) => ` \xB7 ${f.detector}: ${f.reason}
|
|
2527
2647
|
evidence: ${JSON.stringify(f.evidence)}`
|
|
@@ -2542,13 +2662,13 @@ function _isCliEntry7() {
|
|
|
2542
2662
|
if (process.argv[1] === void 0) {
|
|
2543
2663
|
return false;
|
|
2544
2664
|
}
|
|
2545
|
-
const argvUrl = pathToFileURL7(
|
|
2665
|
+
const argvUrl = pathToFileURL7(path8.resolve(process.argv[1])).href;
|
|
2546
2666
|
if (import.meta.url === argvUrl) {
|
|
2547
2667
|
return true;
|
|
2548
2668
|
}
|
|
2549
2669
|
try {
|
|
2550
2670
|
const here = fs7.realpathSync(fileURLToPath7(import.meta.url));
|
|
2551
|
-
const argv = fs7.realpathSync(
|
|
2671
|
+
const argv = fs7.realpathSync(path8.resolve(process.argv[1]));
|
|
2552
2672
|
return here === argv;
|
|
2553
2673
|
} catch {
|
|
2554
2674
|
return false;
|
|
@@ -2561,11 +2681,11 @@ if (_isCliEntry7()) {
|
|
|
2561
2681
|
// src/scripts/hooks/evidence_independence.ts
|
|
2562
2682
|
import crypto4 from "node:crypto";
|
|
2563
2683
|
import fs8 from "node:fs";
|
|
2564
|
-
import
|
|
2684
|
+
import path9 from "node:path";
|
|
2565
2685
|
import { fileURLToPath as fileURLToPath8, pathToFileURL as pathToFileURL8 } from "node:url";
|
|
2566
2686
|
var EXIT_ALLOW6 = 0;
|
|
2567
2687
|
var EXIT_BLOCK3 = 1;
|
|
2568
|
-
var STATE_FILE4 =
|
|
2688
|
+
var STATE_FILE4 = path9.join("agents", "state", "evidence-dispatch.json");
|
|
2569
2689
|
function _isObject6(v) {
|
|
2570
2690
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
2571
2691
|
}
|
|
@@ -2634,7 +2754,7 @@ function extractDispatch(envelope) {
|
|
|
2634
2754
|
function _ledgerStamp(consumer_root) {
|
|
2635
2755
|
try {
|
|
2636
2756
|
const raw = fs8.readFileSync(
|
|
2637
|
-
|
|
2757
|
+
path9.join(consumer_root, "agents", "state", "git-authorization.json"),
|
|
2638
2758
|
"utf8"
|
|
2639
2759
|
);
|
|
2640
2760
|
const d = JSON.parse(raw);
|
|
@@ -2703,7 +2823,7 @@ function run5(stdin_text, options) {
|
|
|
2703
2823
|
return EXIT_ALLOW6;
|
|
2704
2824
|
}
|
|
2705
2825
|
}
|
|
2706
|
-
const target =
|
|
2826
|
+
const target = path9.join(options.consumer_root, STATE_FILE4);
|
|
2707
2827
|
const state = _load(target);
|
|
2708
2828
|
const session_id = typeof envelope["session_id"] === "string" ? envelope["session_id"] : "";
|
|
2709
2829
|
const turnMarker = `${session_id}:${_ledgerStamp(options.consumer_root)}`;
|
|
@@ -2754,13 +2874,13 @@ function _isCliEntry8() {
|
|
|
2754
2874
|
if (process.argv[1] === void 0) {
|
|
2755
2875
|
return false;
|
|
2756
2876
|
}
|
|
2757
|
-
const argvUrl = pathToFileURL8(
|
|
2877
|
+
const argvUrl = pathToFileURL8(path9.resolve(process.argv[1])).href;
|
|
2758
2878
|
if (import.meta.url === argvUrl) {
|
|
2759
2879
|
return true;
|
|
2760
2880
|
}
|
|
2761
2881
|
try {
|
|
2762
2882
|
const here = fs8.realpathSync(fileURLToPath8(import.meta.url));
|
|
2763
|
-
const argv = fs8.realpathSync(
|
|
2883
|
+
const argv = fs8.realpathSync(path9.resolve(process.argv[1]));
|
|
2764
2884
|
return here === argv;
|
|
2765
2885
|
} catch {
|
|
2766
2886
|
return false;
|
|
@@ -2772,7 +2892,7 @@ if (_isCliEntry8()) {
|
|
|
2772
2892
|
|
|
2773
2893
|
// src/scripts/hooks/delegation_nudge_hook.ts
|
|
2774
2894
|
import fs9 from "node:fs";
|
|
2775
|
-
import
|
|
2895
|
+
import path10 from "node:path";
|
|
2776
2896
|
import { fileURLToPath as fileURLToPath9, pathToFileURL as pathToFileURL9 } from "node:url";
|
|
2777
2897
|
|
|
2778
2898
|
// src/scripts/_lib/host_capability.ts
|
|
@@ -3307,13 +3427,13 @@ function _isCliEntry9() {
|
|
|
3307
3427
|
if (process.argv[1] === void 0) {
|
|
3308
3428
|
return false;
|
|
3309
3429
|
}
|
|
3310
|
-
const argvUrl = pathToFileURL9(
|
|
3430
|
+
const argvUrl = pathToFileURL9(path10.resolve(process.argv[1])).href;
|
|
3311
3431
|
if (import.meta.url === argvUrl) {
|
|
3312
3432
|
return true;
|
|
3313
3433
|
}
|
|
3314
3434
|
try {
|
|
3315
3435
|
const here = fs9.realpathSync(fileURLToPath9(import.meta.url));
|
|
3316
|
-
const argv = fs9.realpathSync(
|
|
3436
|
+
const argv = fs9.realpathSync(path10.resolve(process.argv[1]));
|
|
3317
3437
|
return here === argv;
|
|
3318
3438
|
} catch {
|
|
3319
3439
|
return false;
|
|
@@ -3324,7 +3444,7 @@ if (_isCliEntry9()) {
|
|
|
3324
3444
|
}
|
|
3325
3445
|
|
|
3326
3446
|
// src/scripts/conformance_scan.ts
|
|
3327
|
-
var REPO_ROOT =
|
|
3447
|
+
var REPO_ROOT = path11.resolve(path11.dirname(fileURLToPath10(import.meta.url)), "..", "..");
|
|
3328
3448
|
var OBSERVED_BAND = { low: 9.1, high: 39.2 };
|
|
3329
3449
|
var BAND_MIN_TURNS = 1978;
|
|
3330
3450
|
var CARRIER_CHANGES = [
|
|
@@ -3674,7 +3794,7 @@ function scanSession(sessionId, lines) {
|
|
|
3674
3794
|
closeWindow();
|
|
3675
3795
|
return report;
|
|
3676
3796
|
}
|
|
3677
|
-
var DEFAULT_RATE_SERIES =
|
|
3797
|
+
var DEFAULT_RATE_SERIES = path11.join(
|
|
3678
3798
|
REPO_ROOT,
|
|
3679
3799
|
"agents",
|
|
3680
3800
|
"runtime",
|
|
@@ -3683,7 +3803,7 @@ var DEFAULT_RATE_SERIES = path10.join(
|
|
|
3683
3803
|
);
|
|
3684
3804
|
function defaultStore(projectDir) {
|
|
3685
3805
|
const slug = projectStoreSlug(projectDir);
|
|
3686
|
-
return
|
|
3806
|
+
return path11.join(process.env["HOME"] ?? "", ".claude", "projects", slug);
|
|
3687
3807
|
}
|
|
3688
3808
|
function _tokens(chars) {
|
|
3689
3809
|
return Math.round(chars / 4);
|
|
@@ -3708,13 +3828,13 @@ function measureDelivered(projectRulesDir, globalRulesDir) {
|
|
|
3708
3828
|
};
|
|
3709
3829
|
}
|
|
3710
3830
|
function storeKey(store) {
|
|
3711
|
-
return createHash4("sha256").update(
|
|
3831
|
+
return createHash4("sha256").update(path11.resolve(store)).digest("hex").slice(0, 12);
|
|
3712
3832
|
}
|
|
3713
3833
|
function scanStore(store, limit) {
|
|
3714
|
-
const files = fs10.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ f, m: fs10.statSync(
|
|
3834
|
+
const files = fs10.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ f, m: fs10.statSync(path11.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.f);
|
|
3715
3835
|
const per_session = [];
|
|
3716
3836
|
for (const f of files) {
|
|
3717
|
-
const lines = fs10.readFileSync(
|
|
3837
|
+
const lines = fs10.readFileSync(path11.join(store, f), "utf8").split("\n");
|
|
3718
3838
|
const r = scanSession(f.replace(/\.jsonl$/, "").slice(0, 8), lines);
|
|
3719
3839
|
if (r.assistant_turns > 0) {
|
|
3720
3840
|
per_session.push(r);
|
|
@@ -3742,10 +3862,10 @@ function scanStore(store, limit) {
|
|
|
3742
3862
|
const task_completeness_rate_pct = completeness_windows === 0 ? 0 : Number((100 * task_completeness / completeness_windows).toFixed(1));
|
|
3743
3863
|
const era = spansCarrierChange(per_session.map((s) => s.first_at));
|
|
3744
3864
|
const delivered = measureDelivered(
|
|
3745
|
-
|
|
3746
|
-
|
|
3865
|
+
path11.join(REPO_ROOT, ".claude", "rules"),
|
|
3866
|
+
path11.join(process.env["HOME"] ?? os2.homedir(), ".claude", "rules")
|
|
3747
3867
|
);
|
|
3748
|
-
const ownStore =
|
|
3868
|
+
const ownStore = path11.resolve(store) === path11.resolve(defaultStore(REPO_ROOT));
|
|
3749
3869
|
return {
|
|
3750
3870
|
scanned_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3751
3871
|
store,
|
|
@@ -3775,7 +3895,7 @@ function scanStore(store, limit) {
|
|
|
3775
3895
|
};
|
|
3776
3896
|
}
|
|
3777
3897
|
function recordRate(file, scanned_at, rate) {
|
|
3778
|
-
fs10.mkdirSync(
|
|
3898
|
+
fs10.mkdirSync(path11.dirname(file), { recursive: true });
|
|
3779
3899
|
fs10.appendFileSync(file, `${JSON.stringify({ measured_at: scanned_at, ...rate })}
|
|
3780
3900
|
`, "utf8");
|
|
3781
3901
|
}
|
|
@@ -3954,13 +4074,13 @@ function _isCliEntry10() {
|
|
|
3954
4074
|
if (process.argv[1] === void 0) {
|
|
3955
4075
|
return false;
|
|
3956
4076
|
}
|
|
3957
|
-
const argvUrl = pathToFileURL10(
|
|
4077
|
+
const argvUrl = pathToFileURL10(path11.resolve(process.argv[1])).href;
|
|
3958
4078
|
if (import.meta.url === argvUrl) {
|
|
3959
4079
|
return true;
|
|
3960
4080
|
}
|
|
3961
4081
|
try {
|
|
3962
4082
|
const here = fs10.realpathSync(fileURLToPath10(import.meta.url));
|
|
3963
|
-
const argv = fs10.realpathSync(
|
|
4083
|
+
const argv = fs10.realpathSync(path11.resolve(process.argv[1]));
|
|
3964
4084
|
return here === argv;
|
|
3965
4085
|
} catch {
|
|
3966
4086
|
return false;
|
|
@@ -3973,14 +4093,14 @@ if (_isCliEntry10()) {
|
|
|
3973
4093
|
// src/scripts/report_carrier_divergence.ts
|
|
3974
4094
|
import * as fs11 from "node:fs";
|
|
3975
4095
|
import * as os3 from "node:os";
|
|
3976
|
-
import * as
|
|
4096
|
+
import * as path12 from "node:path";
|
|
3977
4097
|
import process3 from "node:process";
|
|
3978
4098
|
import { fileURLToPath as fileURLToPath11, pathToFileURL as pathToFileURL11 } from "node:url";
|
|
3979
4099
|
var _HERE = fileURLToPath11(import.meta.url);
|
|
3980
|
-
var REPO_ROOT2 =
|
|
3981
|
-
var PROJECT_RULES =
|
|
3982
|
-
var PROJECTION_SOURCE =
|
|
3983
|
-
var GLOBAL_RULES =
|
|
4100
|
+
var REPO_ROOT2 = path12.resolve(path12.dirname(_HERE), "..", "..");
|
|
4101
|
+
var PROJECT_RULES = path12.join(".claude", "rules");
|
|
4102
|
+
var PROJECTION_SOURCE = path12.join("dist", "agent-src", "rules");
|
|
4103
|
+
var GLOBAL_RULES = path12.join(".claude", "rules");
|
|
3984
4104
|
function _listRules(dir) {
|
|
3985
4105
|
try {
|
|
3986
4106
|
return fs11.readdirSync(dir).filter((f) => f.endsWith(".md")).sort();
|
|
@@ -4026,7 +4146,7 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
|
|
|
4026
4146
|
}
|
|
4027
4147
|
if (!inP && inG) {
|
|
4028
4148
|
out.globalOnly.push(rule);
|
|
4029
|
-
if (sourceDir !== void 0 && _ruleType(
|
|
4149
|
+
if (sourceDir !== void 0 && _ruleType(path12.join(sourceDir, rule)) === "manual") {
|
|
4030
4150
|
out.manualOnlyGlobal.push(rule);
|
|
4031
4151
|
}
|
|
4032
4152
|
continue;
|
|
@@ -4036,8 +4156,8 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
|
|
|
4036
4156
|
let projectCopy;
|
|
4037
4157
|
let globalCopy;
|
|
4038
4158
|
try {
|
|
4039
|
-
projectCopy = fs11.readFileSync(
|
|
4040
|
-
globalCopy = fs11.readFileSync(
|
|
4159
|
+
projectCopy = fs11.readFileSync(path12.join(projectDir, rule));
|
|
4160
|
+
globalCopy = fs11.readFileSync(path12.join(globalDir, rule));
|
|
4041
4161
|
verdict = comparePair(projectCopy, globalCopy);
|
|
4042
4162
|
} catch {
|
|
4043
4163
|
out.shared -= 1;
|
|
@@ -4184,9 +4304,9 @@ function render2(d) {
|
|
|
4184
4304
|
}
|
|
4185
4305
|
function main11(argv) {
|
|
4186
4306
|
const args = argv ?? process3.argv.slice(2);
|
|
4187
|
-
let projectDir =
|
|
4188
|
-
let globalDir =
|
|
4189
|
-
let sourceDir =
|
|
4307
|
+
let projectDir = path12.join(REPO_ROOT2, PROJECT_RULES);
|
|
4308
|
+
let globalDir = path12.join(os3.homedir(), GLOBAL_RULES);
|
|
4309
|
+
let sourceDir = path12.join(REPO_ROOT2, PROJECTION_SOURCE);
|
|
4190
4310
|
const value = (i) => {
|
|
4191
4311
|
const v = args[i + 1];
|
|
4192
4312
|
return v === void 0 || v.startsWith("-") ? null : v;
|
|
@@ -4200,7 +4320,7 @@ function main11(argv) {
|
|
|
4200
4320
|
`);
|
|
4201
4321
|
return 1;
|
|
4202
4322
|
}
|
|
4203
|
-
const resolved =
|
|
4323
|
+
const resolved = path12.resolve(v);
|
|
4204
4324
|
if (a === "--project") projectDir = resolved;
|
|
4205
4325
|
else if (a === "--global") globalDir = resolved;
|
|
4206
4326
|
else sourceDir = resolved;
|
|
@@ -4222,9 +4342,9 @@ function main11(argv) {
|
|
|
4222
4342
|
}
|
|
4223
4343
|
function _isCliEntry11() {
|
|
4224
4344
|
if (process3.argv[1] === void 0) return false;
|
|
4225
|
-
if (import.meta.url === pathToFileURL11(
|
|
4345
|
+
if (import.meta.url === pathToFileURL11(path12.resolve(process3.argv[1])).href) return true;
|
|
4226
4346
|
try {
|
|
4227
|
-
return fs11.realpathSync(_HERE) === fs11.realpathSync(
|
|
4347
|
+
return fs11.realpathSync(_HERE) === fs11.realpathSync(path12.resolve(process3.argv[1]));
|
|
4228
4348
|
} catch {
|
|
4229
4349
|
return false;
|
|
4230
4350
|
}
|
|
@@ -4236,10 +4356,10 @@ if (_isCliEntry11()) {
|
|
|
4236
4356
|
// src/scripts/report_skill_activation.ts
|
|
4237
4357
|
import * as fs12 from "node:fs";
|
|
4238
4358
|
import * as os4 from "node:os";
|
|
4239
|
-
import * as
|
|
4359
|
+
import * as path13 from "node:path";
|
|
4240
4360
|
import { fileURLToPath as fileURLToPath12, pathToFileURL as pathToFileURL12 } from "node:url";
|
|
4241
4361
|
var _HERE2 = fileURLToPath12(import.meta.url);
|
|
4242
|
-
var REPO_ROOT3 =
|
|
4362
|
+
var REPO_ROOT3 = path13.resolve(path13.dirname(_HERE2), "..", "..");
|
|
4243
4363
|
var SKILLS_ROOT = "src/skills";
|
|
4244
4364
|
var TRIGGER_KEYS = ["triggers:", "trigger_description:", "file_pattern:", "path_prefix:"];
|
|
4245
4365
|
var DETERMINISTIC_RE = /^\s*(?:[-*]\s*)?(?:\*\*)?(MUST|NEVER|ALWAYS)\b/m;
|
|
@@ -4252,7 +4372,7 @@ function censusSkills(root) {
|
|
|
4252
4372
|
if (!entry.isDirectory()) {
|
|
4253
4373
|
continue;
|
|
4254
4374
|
}
|
|
4255
|
-
const file =
|
|
4375
|
+
const file = path13.join(root, entry.name, "SKILL.md");
|
|
4256
4376
|
if (!fs12.existsSync(file)) {
|
|
4257
4377
|
continue;
|
|
4258
4378
|
}
|
|
@@ -4271,14 +4391,14 @@ function censusSkills(root) {
|
|
|
4271
4391
|
return out;
|
|
4272
4392
|
}
|
|
4273
4393
|
function defaultStore2(cwd) {
|
|
4274
|
-
return
|
|
4394
|
+
return path13.join(os4.homedir(), ".claude", "projects", projectStoreSlug(cwd));
|
|
4275
4395
|
}
|
|
4276
4396
|
function measureUsage(store, limit) {
|
|
4277
4397
|
const rep = { store, sessions: 0, assistantTurns: 0, invocations: 0, bySkill: {} };
|
|
4278
4398
|
if (!fs12.existsSync(store)) {
|
|
4279
4399
|
return rep;
|
|
4280
4400
|
}
|
|
4281
|
-
const files = fs12.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) =>
|
|
4401
|
+
const files = fs12.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => path13.join(store, f)).sort((a, b) => fs12.statSync(b).mtimeMs - fs12.statSync(a).mtimeMs).slice(0, limit);
|
|
4282
4402
|
rep.sessions = files.length;
|
|
4283
4403
|
for (const file of files) {
|
|
4284
4404
|
for (const line of fs12.readFileSync(file, "utf8").split("\n")) {
|
|
@@ -4344,7 +4464,7 @@ function render3(census, usage) {
|
|
|
4344
4464
|
}
|
|
4345
4465
|
totalInv += u.invocations;
|
|
4346
4466
|
lines.push(
|
|
4347
|
-
` ${
|
|
4467
|
+
` ${path13.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)}`
|
|
4348
4468
|
);
|
|
4349
4469
|
}
|
|
4350
4470
|
lines.push("");
|
|
@@ -4392,24 +4512,24 @@ function main12(argv) {
|
|
|
4392
4512
|
if (stores.length === 0) {
|
|
4393
4513
|
stores.push(defaultStore2(REPO_ROOT3));
|
|
4394
4514
|
}
|
|
4395
|
-
const census = censusSkills(
|
|
4515
|
+
const census = censusSkills(path13.join(REPO_ROOT3, SKILLS_ROOT));
|
|
4396
4516
|
const usage = stores.map((s) => measureUsage(s, limit));
|
|
4397
4517
|
process.stdout.write(`${render3(census, usage)}
|
|
4398
4518
|
`);
|
|
4399
4519
|
return 0;
|
|
4400
4520
|
}
|
|
4401
|
-
if (process.argv[1] !== void 0 && import.meta.url === pathToFileURL12(
|
|
4521
|
+
if (process.argv[1] !== void 0 && import.meta.url === pathToFileURL12(path13.resolve(process.argv[1])).href) {
|
|
4402
4522
|
process.exit(main12(process.argv.slice(2)));
|
|
4403
4523
|
}
|
|
4404
4524
|
|
|
4405
4525
|
// src/scripts/report_skill_obligation_violations.ts
|
|
4406
4526
|
import * as fs13 from "node:fs";
|
|
4407
4527
|
import * as os5 from "node:os";
|
|
4408
|
-
import * as
|
|
4528
|
+
import * as path14 from "node:path";
|
|
4409
4529
|
import process4 from "node:process";
|
|
4410
4530
|
import { fileURLToPath as fileURLToPath13, pathToFileURL as pathToFileURL13 } from "node:url";
|
|
4411
4531
|
var _HERE3 = fileURLToPath13(import.meta.url);
|
|
4412
|
-
var REPO_ROOT4 =
|
|
4532
|
+
var REPO_ROOT4 = path14.resolve(path14.dirname(_HERE3), "..", "..");
|
|
4413
4533
|
var OBLIGATION_LINE_RE = new RegExp(`${DETERMINISTIC_RE.source}.*`, "gm");
|
|
4414
4534
|
var PATH_RE = /`([A-Za-z0-9_./-]*\/[A-Za-z0-9_.-]+\.[a-z]{2,6})`/g;
|
|
4415
4535
|
var CMD_RE = /`([a-z][a-z0-9-]*(?: [a-z][a-z0-9:._-]*){1,3})`/g;
|
|
@@ -4447,7 +4567,7 @@ function _artefacts(line) {
|
|
|
4447
4567
|
return out;
|
|
4448
4568
|
}
|
|
4449
4569
|
function extractObligations(repoRoot) {
|
|
4450
|
-
const skillsRoot =
|
|
4570
|
+
const skillsRoot = path14.join(repoRoot, SKILLS_ROOT);
|
|
4451
4571
|
const census = censusSkills(skillsRoot);
|
|
4452
4572
|
const out = {
|
|
4453
4573
|
skills: census.withDeterministicObligation,
|
|
@@ -4461,7 +4581,7 @@ function extractObligations(repoRoot) {
|
|
|
4461
4581
|
for (const skill of census.withDeterministicObligation) {
|
|
4462
4582
|
let text;
|
|
4463
4583
|
try {
|
|
4464
|
-
text = fs13.readFileSync(
|
|
4584
|
+
text = fs13.readFileSync(path14.join(skillsRoot, skill, "SKILL.md"), "utf-8");
|
|
4465
4585
|
} catch {
|
|
4466
4586
|
continue;
|
|
4467
4587
|
}
|
|
@@ -4577,7 +4697,7 @@ function scanSessionForViolations(session, lines, forbidden, parsed) {
|
|
|
4577
4697
|
return flags;
|
|
4578
4698
|
}
|
|
4579
4699
|
function defaultStore3(cwd) {
|
|
4580
|
-
return
|
|
4700
|
+
return path14.join(os5.homedir(), ".claude", "projects", projectStoreSlug(cwd));
|
|
4581
4701
|
}
|
|
4582
4702
|
function scanStore2(repoRoot, store, limit) {
|
|
4583
4703
|
const census = extractObligations(repoRoot);
|
|
@@ -4590,14 +4710,14 @@ function scanStore2(repoRoot, store, limit) {
|
|
|
4590
4710
|
};
|
|
4591
4711
|
let files;
|
|
4592
4712
|
try {
|
|
4593
|
-
files = fs13.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ p:
|
|
4713
|
+
files = fs13.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ p: path14.join(store, f), m: fs13.statSync(path14.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.p);
|
|
4594
4714
|
} catch {
|
|
4595
4715
|
return report;
|
|
4596
4716
|
}
|
|
4597
4717
|
report.sessions = files.length;
|
|
4598
4718
|
for (const file of files) {
|
|
4599
4719
|
const lines = fs13.readFileSync(file, "utf-8").split("\n");
|
|
4600
|
-
const id =
|
|
4720
|
+
const id = path14.basename(file).replace(/\.jsonl$/, "").slice(0, 8);
|
|
4601
4721
|
const entries = _parseSession(lines);
|
|
4602
4722
|
if (loadedSkillsFrom(entries).size > 0) report.sessionsWithASkill += 1;
|
|
4603
4723
|
report.flags.push(...scanSessionForViolations(id, lines, census.forbidden, entries));
|
|
@@ -4722,9 +4842,9 @@ function main13(argv) {
|
|
|
4722
4842
|
}
|
|
4723
4843
|
function _isCliEntry12() {
|
|
4724
4844
|
if (process4.argv[1] === void 0) return false;
|
|
4725
|
-
if (import.meta.url === pathToFileURL13(
|
|
4845
|
+
if (import.meta.url === pathToFileURL13(path14.resolve(process4.argv[1])).href) return true;
|
|
4726
4846
|
try {
|
|
4727
|
-
return fs13.realpathSync(_HERE3) === fs13.realpathSync(
|
|
4847
|
+
return fs13.realpathSync(_HERE3) === fs13.realpathSync(path14.resolve(process4.argv[1]));
|
|
4728
4848
|
} catch {
|
|
4729
4849
|
return false;
|
|
4730
4850
|
}
|
|
@@ -4735,18 +4855,18 @@ if (_isCliEntry12()) {
|
|
|
4735
4855
|
|
|
4736
4856
|
// src/scripts/report_conformance_funnel.ts
|
|
4737
4857
|
var _HERE4 = fileURLToPath14(import.meta.url);
|
|
4738
|
-
var REPO_ROOT5 =
|
|
4858
|
+
var REPO_ROOT5 = path15.resolve(path15.dirname(_HERE4), "..", "..");
|
|
4739
4859
|
function buildFunnel(opts = {}) {
|
|
4740
4860
|
const repoRoot = opts.repoRoot ?? REPO_ROOT5;
|
|
4741
|
-
const projectRulesDir = opts.projectRulesDir ??
|
|
4742
|
-
const globalRulesDir = opts.globalRulesDir ??
|
|
4743
|
-
const sourceDir = opts.sourceDir ??
|
|
4861
|
+
const projectRulesDir = opts.projectRulesDir ?? path15.join(repoRoot, PROJECT_RULES);
|
|
4862
|
+
const globalRulesDir = opts.globalRulesDir ?? path15.join(os6.homedir(), GLOBAL_RULES);
|
|
4863
|
+
const sourceDir = opts.sourceDir ?? path15.join(repoRoot, PROJECTION_SOURCE);
|
|
4744
4864
|
const store = opts.store ?? defaultStore(repoRoot);
|
|
4745
4865
|
const limit = opts.limit ?? 30;
|
|
4746
4866
|
return {
|
|
4747
4867
|
delivered: measureDelivered(projectRulesDir, globalRulesDir),
|
|
4748
4868
|
divergence: compareCarriers(projectRulesDir, globalRulesDir, sourceDir),
|
|
4749
|
-
skills: censusSkills(
|
|
4869
|
+
skills: censusSkills(path15.join(repoRoot, SKILLS_ROOT)),
|
|
4750
4870
|
usage: measureUsage(store, limit),
|
|
4751
4871
|
storePresent: fs14.existsSync(store),
|
|
4752
4872
|
sk2: scanStore2(repoRoot, store, limit)
|
|
@@ -4889,7 +5009,7 @@ function main14(argv) {
|
|
|
4889
5009
|
`);
|
|
4890
5010
|
return 1;
|
|
4891
5011
|
}
|
|
4892
|
-
const resolved =
|
|
5012
|
+
const resolved = path15.resolve(v);
|
|
4893
5013
|
if (a === "--store") opts.store = resolved;
|
|
4894
5014
|
else if (a === "--project") opts.projectRulesDir = resolved;
|
|
4895
5015
|
else if (a === "--global") opts.globalRulesDir = resolved;
|
|
@@ -4921,9 +5041,9 @@ function main14(argv) {
|
|
|
4921
5041
|
}
|
|
4922
5042
|
function _isCliEntry13() {
|
|
4923
5043
|
if (process5.argv[1] === void 0) return false;
|
|
4924
|
-
if (import.meta.url === pathToFileURL14(
|
|
5044
|
+
if (import.meta.url === pathToFileURL14(path15.resolve(process5.argv[1])).href) return true;
|
|
4925
5045
|
try {
|
|
4926
|
-
return fs14.realpathSync(_HERE4) === fs14.realpathSync(
|
|
5046
|
+
return fs14.realpathSync(_HERE4) === fs14.realpathSync(path15.resolve(process5.argv[1]));
|
|
4927
5047
|
} catch {
|
|
4928
5048
|
return false;
|
|
4929
5049
|
}
|
|
@@ -4956,14 +5076,14 @@ function conformanceLogPath() {
|
|
|
4956
5076
|
if (override && override.trim().length > 0) {
|
|
4957
5077
|
return override;
|
|
4958
5078
|
}
|
|
4959
|
-
return
|
|
5079
|
+
return path16.join(os7.homedir(), ".event4u", "agent-config", "conformance-log.jsonl");
|
|
4960
5080
|
}
|
|
4961
5081
|
function installLogPath() {
|
|
4962
5082
|
const override = process6.env["AGENT_CONFIG_INSTALL_LOG"];
|
|
4963
5083
|
if (override && override.trim().length > 0) {
|
|
4964
5084
|
return override;
|
|
4965
5085
|
}
|
|
4966
|
-
return
|
|
5086
|
+
return path16.join(os7.homedir(), ".event4u", "agent-config", "install-log.jsonl");
|
|
4967
5087
|
}
|
|
4968
5088
|
function _check_txlog_clean(logPath = installLogPath()) {
|
|
4969
5089
|
if (!fs15.existsSync(logPath)) {
|
|
@@ -5000,10 +5120,10 @@ function _check_txlog_clean(logPath = installLogPath()) {
|
|
|
5000
5120
|
};
|
|
5001
5121
|
}
|
|
5002
5122
|
function routeTargetPaths(target) {
|
|
5003
|
-
return routeTargetPathsPosix(target).map((rel) =>
|
|
5123
|
+
return routeTargetPathsPosix(target).map((rel) => path16.join(...rel.split("/")));
|
|
5004
5124
|
}
|
|
5005
5125
|
function _check_router_pointers(packageRoot = PACKAGE_ROOT) {
|
|
5006
|
-
const routerPath =
|
|
5126
|
+
const routerPath = path16.join(packageRoot, "dist", "router.json");
|
|
5007
5127
|
if (!fs15.existsSync(routerPath)) {
|
|
5008
5128
|
return {
|
|
5009
5129
|
id: "router-pointers",
|
|
@@ -5023,13 +5143,13 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT) {
|
|
|
5023
5143
|
remedy: "reinstall the package \u2014 dist/router.json is corrupt"
|
|
5024
5144
|
};
|
|
5025
5145
|
}
|
|
5026
|
-
const rulesDir =
|
|
5146
|
+
const rulesDir = path16.join(packageRoot, "dist", "agent-src", "rules");
|
|
5027
5147
|
const broken = [];
|
|
5028
5148
|
let ids = 0;
|
|
5029
5149
|
let targets = 0;
|
|
5030
5150
|
for (const kernelId of router["kernel"] ?? []) {
|
|
5031
5151
|
ids += 1;
|
|
5032
|
-
if (!fs15.existsSync(
|
|
5152
|
+
if (!fs15.existsSync(path16.join(rulesDir, `${kernelId}.md`))) {
|
|
5033
5153
|
broken.push(`kernel:${kernelId} \u2192 rules/${kernelId}.md missing`);
|
|
5034
5154
|
}
|
|
5035
5155
|
}
|
|
@@ -5037,7 +5157,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT) {
|
|
|
5037
5157
|
for (const entry of router[tier] ?? []) {
|
|
5038
5158
|
const ruleId = String(entry["id"] ?? "");
|
|
5039
5159
|
ids += 1;
|
|
5040
|
-
if (!fs15.existsSync(
|
|
5160
|
+
if (!fs15.existsSync(path16.join(rulesDir, `${ruleId}.md`))) {
|
|
5041
5161
|
broken.push(`${tier}:${ruleId} \u2192 rules/${ruleId}.md missing`);
|
|
5042
5162
|
}
|
|
5043
5163
|
for (const target of entry["routes_to"] ?? []) {
|
|
@@ -5047,7 +5167,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT) {
|
|
|
5047
5167
|
broken.push(`${ruleId} \u2192 unparseable routes_to ${JSON.stringify(target)}`);
|
|
5048
5168
|
continue;
|
|
5049
5169
|
}
|
|
5050
|
-
if (!candidates.some((rel) => fs15.existsSync(
|
|
5170
|
+
if (!candidates.some((rel) => fs15.existsSync(path16.join(packageRoot, rel)))) {
|
|
5051
5171
|
broken.push(`${ruleId} \u2192 ${target} (${candidates[0]} missing)`);
|
|
5052
5172
|
}
|
|
5053
5173
|
}
|
|
@@ -5079,8 +5199,8 @@ function detectSmokePlatform(projectRoot) {
|
|
|
5079
5199
|
return "claude";
|
|
5080
5200
|
}
|
|
5081
5201
|
function dispatcherRunner(packageRoot) {
|
|
5082
|
-
const localTsx =
|
|
5083
|
-
const script =
|
|
5202
|
+
const localTsx = path16.join(packageRoot, "node_modules", ".bin", "tsx");
|
|
5203
|
+
const script = path16.join(packageRoot, "src", "scripts", "hooks", "dispatch_hook.ts");
|
|
5084
5204
|
if (fs15.existsSync(localTsx)) {
|
|
5085
5205
|
return [localTsx, script];
|
|
5086
5206
|
}
|
|
@@ -5131,7 +5251,7 @@ function _check_hook_dispatcher(projectRoot, packageRoot = PACKAGE_ROOT, opts =
|
|
|
5131
5251
|
};
|
|
5132
5252
|
}
|
|
5133
5253
|
function readSettingsMode(projectRoot) {
|
|
5134
|
-
const settingsPath =
|
|
5254
|
+
const settingsPath = path16.join(projectRoot, ".agent-settings.yml");
|
|
5135
5255
|
if (!fs15.existsSync(settingsPath)) {
|
|
5136
5256
|
return "eager-all";
|
|
5137
5257
|
}
|
|
@@ -5147,7 +5267,7 @@ function readSettingsMode(projectRoot) {
|
|
|
5147
5267
|
function kernelIdsFromRouter(packageRoot) {
|
|
5148
5268
|
try {
|
|
5149
5269
|
const router = JSON.parse(
|
|
5150
|
-
fs15.readFileSync(
|
|
5270
|
+
fs15.readFileSync(path16.join(packageRoot, "dist", "router.json"), "utf8")
|
|
5151
5271
|
);
|
|
5152
5272
|
return new Set((router["kernel"] ?? []).map(String));
|
|
5153
5273
|
} catch {
|
|
@@ -5164,7 +5284,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT, project
|
|
|
5164
5284
|
remedy: "set lean_projection.mode to 'eager-all' or 'thin' in .agent-settings.yml"
|
|
5165
5285
|
};
|
|
5166
5286
|
}
|
|
5167
|
-
const rulesDir = projectedRulesDir ??
|
|
5287
|
+
const rulesDir = projectedRulesDir ?? path16.join(projectRoot, ".augment", "rules");
|
|
5168
5288
|
if (!fs15.existsSync(rulesDir)) {
|
|
5169
5289
|
return {
|
|
5170
5290
|
id: "lean-projection",
|
|
@@ -5188,7 +5308,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT, project
|
|
|
5188
5308
|
for (const f of nonKernel) {
|
|
5189
5309
|
let text = "";
|
|
5190
5310
|
try {
|
|
5191
|
-
text = fs15.readFileSync(
|
|
5311
|
+
text = fs15.readFileSync(path16.join(rulesDir, f), "utf8");
|
|
5192
5312
|
} catch {
|
|
5193
5313
|
continue;
|
|
5194
5314
|
}
|
|
@@ -5219,7 +5339,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT, project
|
|
|
5219
5339
|
function _check_host_manifest(projectRoot) {
|
|
5220
5340
|
const detected = Object.entries(detectToolPresence(projectRoot)).filter(([, v]) => v === true).map(([k]) => k);
|
|
5221
5341
|
const detectedNote = detected.length > 0 ? `detected surfaces: ${detected.join(", ")}` : "no surfaces detected";
|
|
5222
|
-
const settingsPath =
|
|
5342
|
+
const settingsPath = path16.join(projectRoot, ".agent-settings.yml");
|
|
5223
5343
|
if (!fs15.existsSync(settingsPath)) {
|
|
5224
5344
|
return {
|
|
5225
5345
|
id: "host-manifest",
|
|
@@ -5404,13 +5524,13 @@ function _isCliEntry14() {
|
|
|
5404
5524
|
if (process6.argv[1] === void 0) {
|
|
5405
5525
|
return false;
|
|
5406
5526
|
}
|
|
5407
|
-
const argvUrl = pathToFileURL15(
|
|
5527
|
+
const argvUrl = pathToFileURL15(path16.resolve(process6.argv[1])).href;
|
|
5408
5528
|
if (import.meta.url === argvUrl) {
|
|
5409
5529
|
return true;
|
|
5410
5530
|
}
|
|
5411
5531
|
try {
|
|
5412
5532
|
const here = fs15.realpathSync(fileURLToPath15(import.meta.url));
|
|
5413
|
-
const argv = fs15.realpathSync(
|
|
5533
|
+
const argv = fs15.realpathSync(path16.resolve(process6.argv[1]));
|
|
5414
5534
|
return here === argv;
|
|
5415
5535
|
} catch {
|
|
5416
5536
|
return false;
|