@event4u/agent-config 9.30.0 → 9.32.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 +60 -292
- package/dist/agent-src/contexts/execution/host-capability-manifest.md +32 -1
- package/dist/agent-src/rules/delegation-policy.md +11 -1
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/scripts/work_engine/delivery_state.ts +6 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/backend/_self_fix.ts +332 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/backend/refine.ts +106 -1
- package/dist/agent-src/templates/scripts/work_engine/directives/backend/test.ts +50 -15
- package/dist/agent-src/templates/scripts/work_engine/directives/backend/verify.ts +49 -15
- package/dist/agent-src/templates/scripts/work_engine/state.ts +74 -0
- package/dist/agent-src/templates/scripts/work_engine/state_io.ts +6 -0
- package/dist/cli-delegate/chunk-2WELHO3P.js +582 -0
- package/dist/cli-delegate/{chunk-IYTGIG2Y.js → chunk-542DZR4P.js} +118 -148
- package/dist/cli-delegate/{chunk-66OVWGB5.js → chunk-AG47LAGQ.js} +1 -1
- package/dist/cli-delegate/{chunk-MP3JT3IU.js → chunk-DS6BLDMG.js} +1 -1
- package/dist/cli-delegate/{chunk-O3CO5BFB.js → chunk-EJITJBJX.js} +12 -1
- package/dist/cli-delegate/{chunk-EQY4FLJB.js → chunk-ITIQSGOQ.js} +3 -3
- package/dist/cli-delegate/{chunk-LCFJIQ4J.js → chunk-JEJABGKB.js} +110 -6
- package/dist/cli-delegate/chunk-PZWRPRWP.js +38 -0
- package/dist/cli-delegate/{chunk-BTJNRUX3.js → chunk-QEEB4LHO.js} +1 -1
- package/dist/cli-delegate/{chunk-DDUNNFYX.js → chunk-UVKNIJH2.js} +2 -2
- package/dist/cli-delegate/cmd_analyze_session.js +1 -1
- package/dist/cli-delegate/cmd_brand_status.js +1 -1
- package/dist/cli-delegate/cmd_conformance.js +154 -41
- package/dist/cli-delegate/cmd_doctor.js +4 -3
- package/dist/cli-delegate/cmd_explain.js +2 -2
- package/dist/cli-delegate/cmd_export.js +4 -4
- package/dist/cli-delegate/cmd_handoff.js +168 -59
- package/dist/cli-delegate/cmd_mcp_available.js +1 -1
- package/dist/cli-delegate/cmd_migrate.js +2 -2
- package/dist/cli-delegate/cmd_packs_active.js +2 -2
- package/dist/cli-delegate/cmd_prune.js +4 -4
- package/dist/cli-delegate/cmd_route_audit.js +2 -2
- package/dist/cli-delegate/cmd_route_explain.js +1 -1
- package/dist/cli-delegate/cmd_session_recycle.js +19 -4
- package/dist/cli-delegate/cmd_settings_get.js +2 -55
- package/dist/cli-delegate/cmd_settings_migrate.js +4 -4
- package/dist/cli-delegate/cmd_settings_set.js +1 -1
- package/dist/cli-delegate/cmd_sync.js +4 -4
- package/dist/cli-delegate/cmd_uninstall.js +4 -4
- package/dist/cli-delegate/cmd_update.js +1 -1
- package/dist/cli-delegate/cmd_upgrade.js +1 -1
- package/dist/cli-delegate/cmd_validate.js +4 -4
- package/dist/cli-delegate/cmd_versions.js +1 -1
- 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/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/dispatch.js +1411 -810
- package/dist/install/install.mjs +121 -16
- package/dist/mcp/registry-manifest.json +1 -1
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +365 -143
- package/dist/scripts/_lib/agent_settings.js +111 -2
- package/dist/scripts/_lib/agent_settings.js.map +1 -1
- package/dist/server/schemas/settings.js +2 -2
- package/dist/server/schemas/settings.js.map +1 -1
- package/package.json +1 -1
- package/src/agent-src/templates/scripts/work_engine/delivery_state.ts +6 -0
- package/src/agent-src/templates/scripts/work_engine/directives/backend/_self_fix.ts +332 -0
- package/src/agent-src/templates/scripts/work_engine/directives/backend/refine.ts +106 -1
- package/src/agent-src/templates/scripts/work_engine/directives/backend/test.ts +50 -15
- package/src/agent-src/templates/scripts/work_engine/directives/backend/verify.ts +49 -15
- package/src/agent-src/templates/scripts/work_engine/state.ts +74 -0
- package/src/agent-src/templates/scripts/work_engine/state_io.ts +6 -0
- package/src/config/pack-size-budget.json +3 -2
- package/src/scripts/_cli/cmd_session_recycle.ts +25 -0
- package/src/scripts/_cli/explain_last/inputs.ts +13 -0
- package/src/scripts/_cli/handoff_generate.ts +36 -1
- package/src/scripts/_cli/handoff_sessions.ts +140 -9
- package/src/scripts/_lib/agent_settings.ts +119 -2
- package/src/scripts/_lib/carrier_divergence.ts +120 -2
- package/src/scripts/_lib/envelope_grounding.ts +206 -0
- package/src/scripts/_lib/host_capability.ts +79 -0
- package/src/scripts/_lib/session_eol.ts +85 -0
- package/src/scripts/_lib/subagent_capsule.ts +256 -1
- package/src/scripts/check_secret_leak.test.ts +43 -0
- package/src/scripts/check_secret_leak.ts +12 -0
- package/src/scripts/handoff_context_hook.ts +66 -18
- package/src/scripts/hooks/session_eol_hook.ts +12 -12
- package/src/scripts/hooks/turn_end_gate_hook.ts +296 -88
- package/src/scripts/language_mirror_hook.ts +69 -16
- package/src/scripts/measure_turn_end_gate.ts +129 -51
- package/src/scripts/report_carrier_divergence.ts +143 -30
- package/src/scripts/report_conformance_funnel.ts +18 -4
- package/src/scripts/routing_doctor.ts +25 -2
- package/src/scripts/schemas/dod.schema.json +45 -0
- package/src/server/schemas/settings.ts +2 -2
- package/dist/cli-delegate/chunk-RVGBH4XK.js +0 -142
|
@@ -14,6 +14,9 @@ import {
|
|
|
14
14
|
config_exports,
|
|
15
15
|
hardenedSpawnEnv
|
|
16
16
|
} from "./chunk-LVRYBKTI.js";
|
|
17
|
+
import {
|
|
18
|
+
git_common_dir
|
|
19
|
+
} from "./chunk-PZWRPRWP.js";
|
|
17
20
|
import {
|
|
18
21
|
DEFAULT_GITATTRIBUTES,
|
|
19
22
|
SECTION_HEADER,
|
|
@@ -44,7 +47,7 @@ import {
|
|
|
44
47
|
load_agent_settings,
|
|
45
48
|
project_settings_path,
|
|
46
49
|
resolve_project_root
|
|
47
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-JEJABGKB.js";
|
|
48
51
|
import {
|
|
49
52
|
event4u_root,
|
|
50
53
|
resolve_with_fallback,
|
|
@@ -64,9 +67,9 @@ import {
|
|
|
64
67
|
// src/scripts/_cli/cmd_doctor.ts
|
|
65
68
|
var YAML = __toESM(require_dist(), 1);
|
|
66
69
|
import * as crypto3 from "node:crypto";
|
|
67
|
-
import * as
|
|
70
|
+
import * as fs6 from "node:fs";
|
|
68
71
|
import * as os3 from "node:os";
|
|
69
|
-
import * as
|
|
72
|
+
import * as path7 from "node:path";
|
|
70
73
|
import process2 from "node:process";
|
|
71
74
|
import { fileURLToPath as fileURLToPath2, pathToFileURL } from "node:url";
|
|
72
75
|
|
|
@@ -109,39 +112,6 @@ function censusDuplicateScope(userRulesDir, projectRulesDir) {
|
|
|
109
112
|
};
|
|
110
113
|
}
|
|
111
114
|
|
|
112
|
-
// src/scripts/_lib/git_common_dir.ts
|
|
113
|
-
import fs2 from "node:fs";
|
|
114
|
-
import path2 from "node:path";
|
|
115
|
-
function realpath_or_self(p) {
|
|
116
|
-
try {
|
|
117
|
-
return fs2.realpathSync(p);
|
|
118
|
-
} catch {
|
|
119
|
-
return p;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
function git_common_dir(project_root) {
|
|
123
|
-
const dot_git = path2.join(project_root, ".git");
|
|
124
|
-
try {
|
|
125
|
-
const st = fs2.statSync(dot_git);
|
|
126
|
-
if (st.isDirectory()) {
|
|
127
|
-
return realpath_or_self(dot_git);
|
|
128
|
-
}
|
|
129
|
-
const m = fs2.readFileSync(dot_git, "utf-8").match(/^gitdir:\s*(.+)\s*$/m);
|
|
130
|
-
if (m === null) {
|
|
131
|
-
return null;
|
|
132
|
-
}
|
|
133
|
-
const gitdir = path2.resolve(project_root, m[1].trim());
|
|
134
|
-
const commondir_file = path2.join(gitdir, "commondir");
|
|
135
|
-
if (fs2.existsSync(commondir_file)) {
|
|
136
|
-
const common = path2.resolve(gitdir, fs2.readFileSync(commondir_file, "utf-8").trim());
|
|
137
|
-
return realpath_or_self(common);
|
|
138
|
-
}
|
|
139
|
-
return realpath_or_self(gitdir);
|
|
140
|
-
} catch {
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
115
|
// src/scripts/ai_council/clients.ts
|
|
146
116
|
var clients_exports = {};
|
|
147
117
|
__export(clients_exports, {
|
|
@@ -200,16 +170,16 @@ __export(clients_exports, {
|
|
|
200
170
|
reset_cli_call_counts: () => reset_cli_call_counts
|
|
201
171
|
});
|
|
202
172
|
import { spawnSync } from "node:child_process";
|
|
203
|
-
import * as
|
|
204
|
-
import * as
|
|
173
|
+
import * as fs3 from "node:fs";
|
|
174
|
+
import * as path3 from "node:path";
|
|
205
175
|
|
|
206
176
|
// src/scripts/_lib/session_role.ts
|
|
207
177
|
var SESSION_ROLE_ENV = "AGENT_CONFIG_SESSION_ROLE";
|
|
208
178
|
|
|
209
179
|
// src/scripts/ai_council/events_log.ts
|
|
210
180
|
import * as crypto from "node:crypto";
|
|
211
|
-
import * as
|
|
212
|
-
import * as
|
|
181
|
+
import * as fs2 from "node:fs";
|
|
182
|
+
import * as path2 from "node:path";
|
|
213
183
|
import { fileURLToPath } from "node:url";
|
|
214
184
|
var SCHEMA_VERSION = 1;
|
|
215
185
|
var _VALID_ACTIONS = /* @__PURE__ */ new Set([
|
|
@@ -219,8 +189,8 @@ var _VALID_ACTIONS = /* @__PURE__ */ new Set([
|
|
|
219
189
|
]);
|
|
220
190
|
var _KILL_SWITCH_ENV = "AGENT_CONFIG_NO_EVENTS_LOG";
|
|
221
191
|
var _HERE = fileURLToPath(import.meta.url);
|
|
222
|
-
var _REPO_ROOT =
|
|
223
|
-
var _DEFAULT_LOG_PATH =
|
|
192
|
+
var _REPO_ROOT = path2.resolve(path2.dirname(_HERE), "..", "..", "..");
|
|
193
|
+
var _DEFAULT_LOG_PATH = path2.join(
|
|
224
194
|
_REPO_ROOT,
|
|
225
195
|
"agents",
|
|
226
196
|
"runtime",
|
|
@@ -321,9 +291,9 @@ function appendEvent(event, opts = {}) {
|
|
|
321
291
|
}
|
|
322
292
|
}
|
|
323
293
|
const target = opts.logPath != null ? opts.logPath : _DEFAULT_LOG_PATH;
|
|
324
|
-
|
|
294
|
+
fs2.mkdirSync(path2.dirname(target), { recursive: true });
|
|
325
295
|
const line = _pyJsonDumpsCompact(record);
|
|
326
|
-
|
|
296
|
+
fs2.appendFileSync(target, line + "\n", { encoding: "utf-8" });
|
|
327
297
|
return true;
|
|
328
298
|
}
|
|
329
299
|
function _isoSecondsZ(d) {
|
|
@@ -526,13 +496,13 @@ function _setMonotonicSource(fn) {
|
|
|
526
496
|
return prev;
|
|
527
497
|
}
|
|
528
498
|
function _loadKey(p, prefix, installScript) {
|
|
529
|
-
if (!
|
|
499
|
+
if (!fs3.existsSync(p)) {
|
|
530
500
|
throw new KeyGateError(
|
|
531
501
|
`Key not found at ${p}.
|
|
532
502
|
Install it with: bash ${installScript}`
|
|
533
503
|
);
|
|
534
504
|
}
|
|
535
|
-
const st =
|
|
505
|
+
const st = fs3.statSync(p);
|
|
536
506
|
const mode = st.mode & 511;
|
|
537
507
|
if (mode !== 384) {
|
|
538
508
|
throw new KeyGateError(
|
|
@@ -540,7 +510,7 @@ function _loadKey(p, prefix, installScript) {
|
|
|
540
510
|
Fix: chmod 600 ${p}`
|
|
541
511
|
);
|
|
542
512
|
}
|
|
543
|
-
const key =
|
|
513
|
+
const key = fs3.readFileSync(p, { encoding: "utf-8" }).trim();
|
|
544
514
|
if (!key) {
|
|
545
515
|
throw new KeyGateError(`${p} is empty.`);
|
|
546
516
|
}
|
|
@@ -998,12 +968,12 @@ function _today_utc_iso() {
|
|
|
998
968
|
}
|
|
999
969
|
function load_cli_call_counts(p = null) {
|
|
1000
970
|
const target = p !== null ? p : _cliCallsStatePath();
|
|
1001
|
-
if (!
|
|
971
|
+
if (!fs3.existsSync(target)) {
|
|
1002
972
|
return {};
|
|
1003
973
|
}
|
|
1004
974
|
let data;
|
|
1005
975
|
try {
|
|
1006
|
-
data = JSON.parse(
|
|
976
|
+
data = JSON.parse(fs3.readFileSync(target, { encoding: "utf-8" }));
|
|
1007
977
|
} catch {
|
|
1008
978
|
return {};
|
|
1009
979
|
}
|
|
@@ -1030,8 +1000,8 @@ function record_cli_call(provider, p = null) {
|
|
|
1030
1000
|
const target = p !== null ? p : _cliCallsStatePath();
|
|
1031
1001
|
const counts = load_cli_call_counts(target);
|
|
1032
1002
|
counts[provider] = (counts[provider] ?? 0) + 1;
|
|
1033
|
-
|
|
1034
|
-
|
|
1003
|
+
fs3.mkdirSync(path3.dirname(target), { recursive: true });
|
|
1004
|
+
fs3.writeFileSync(
|
|
1035
1005
|
target,
|
|
1036
1006
|
_jsonDumpsIndent2({ date: _today_utc_iso(), counts }),
|
|
1037
1007
|
{ encoding: "utf-8" }
|
|
@@ -1046,8 +1016,8 @@ function reset_cli_call_counts(provider = null, p = null) {
|
|
|
1046
1016
|
} else {
|
|
1047
1017
|
delete counts[provider];
|
|
1048
1018
|
}
|
|
1049
|
-
|
|
1050
|
-
|
|
1019
|
+
fs3.mkdirSync(path3.dirname(target), { recursive: true });
|
|
1020
|
+
fs3.writeFileSync(
|
|
1051
1021
|
target,
|
|
1052
1022
|
_jsonDumpsIndent2({ date: _today_utc_iso(), counts }),
|
|
1053
1023
|
{ encoding: "utf-8" }
|
|
@@ -2115,7 +2085,7 @@ function _pyJsonStringAscii(s) {
|
|
|
2115
2085
|
return out + '"';
|
|
2116
2086
|
}
|
|
2117
2087
|
function _which(name) {
|
|
2118
|
-
if (name.includes(
|
|
2088
|
+
if (name.includes(path3.sep) || path3.sep !== "/" && name.includes("/")) {
|
|
2119
2089
|
return _isExecutable(name) ? name : null;
|
|
2120
2090
|
}
|
|
2121
2091
|
const pathEnv = process.env.PATH ?? "";
|
|
@@ -2123,12 +2093,12 @@ function _which(name) {
|
|
|
2123
2093
|
return null;
|
|
2124
2094
|
}
|
|
2125
2095
|
const exts = process.platform === "win32" ? (process.env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean) : [""];
|
|
2126
|
-
for (const dir of pathEnv.split(
|
|
2096
|
+
for (const dir of pathEnv.split(path3.delimiter)) {
|
|
2127
2097
|
if (!dir) {
|
|
2128
2098
|
continue;
|
|
2129
2099
|
}
|
|
2130
2100
|
for (const ext of exts) {
|
|
2131
|
-
const candidate =
|
|
2101
|
+
const candidate = path3.join(dir, name + ext);
|
|
2132
2102
|
if (_isExecutable(candidate)) {
|
|
2133
2103
|
return candidate;
|
|
2134
2104
|
}
|
|
@@ -2138,7 +2108,7 @@ function _which(name) {
|
|
|
2138
2108
|
}
|
|
2139
2109
|
function _isExecutable(p) {
|
|
2140
2110
|
try {
|
|
2141
|
-
const st =
|
|
2111
|
+
const st = fs3.statSync(p);
|
|
2142
2112
|
if (!st.isFile()) {
|
|
2143
2113
|
return false;
|
|
2144
2114
|
}
|
|
@@ -2165,7 +2135,7 @@ function _defaultStdin() {
|
|
|
2165
2135
|
function ensure() {
|
|
2166
2136
|
if (buffer === null) {
|
|
2167
2137
|
try {
|
|
2168
|
-
buffer =
|
|
2138
|
+
buffer = fs3.readFileSync(0, { encoding: "utf-8" });
|
|
2169
2139
|
} catch {
|
|
2170
2140
|
buffer = "";
|
|
2171
2141
|
}
|
|
@@ -2207,9 +2177,9 @@ function _defaultStdin() {
|
|
|
2207
2177
|
|
|
2208
2178
|
// src/scripts/_lib/environment_detector.ts
|
|
2209
2179
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
2210
|
-
import * as
|
|
2180
|
+
import * as fs4 from "node:fs";
|
|
2211
2181
|
import * as os from "node:os";
|
|
2212
|
-
import * as
|
|
2182
|
+
import * as path4 from "node:path";
|
|
2213
2183
|
|
|
2214
2184
|
// src/install/toolDetection.ts
|
|
2215
2185
|
import { existsSync as existsSync3 } from "node:fs";
|
|
@@ -2332,7 +2302,7 @@ function classifyBilling(provider, source) {
|
|
|
2332
2302
|
function codexHome(env) {
|
|
2333
2303
|
const map = env ?? process.env;
|
|
2334
2304
|
const override = (map["CODEX_HOME"] ?? "").trim();
|
|
2335
|
-
return override !== "" ? override :
|
|
2305
|
+
return override !== "" ? override : path4.join(homeOf(env), ".codex");
|
|
2336
2306
|
}
|
|
2337
2307
|
function homeOf(env) {
|
|
2338
2308
|
const map = env ?? process.env;
|
|
@@ -2357,14 +2327,14 @@ ${res.stderr ?? ""}`;
|
|
|
2357
2327
|
}
|
|
2358
2328
|
function isFile(p) {
|
|
2359
2329
|
try {
|
|
2360
|
-
return
|
|
2330
|
+
return fs4.statSync(p).isFile();
|
|
2361
2331
|
} catch {
|
|
2362
2332
|
return false;
|
|
2363
2333
|
}
|
|
2364
2334
|
}
|
|
2365
2335
|
function exists(p) {
|
|
2366
2336
|
try {
|
|
2367
|
-
return
|
|
2337
|
+
return fs4.existsSync(p);
|
|
2368
2338
|
} catch {
|
|
2369
2339
|
return false;
|
|
2370
2340
|
}
|
|
@@ -2372,7 +2342,7 @@ function exists(p) {
|
|
|
2372
2342
|
function classifyCodexAuth(authPath) {
|
|
2373
2343
|
let data;
|
|
2374
2344
|
try {
|
|
2375
|
-
data = JSON.parse(
|
|
2345
|
+
data = JSON.parse(fs4.readFileSync(authPath, "utf-8"));
|
|
2376
2346
|
} catch {
|
|
2377
2347
|
return "cli-api-key";
|
|
2378
2348
|
}
|
|
@@ -2389,18 +2359,18 @@ function cliSubscriptionEvidence(provider, home, env, claudeConfigDir) {
|
|
|
2389
2359
|
if (provider === "anthropic") {
|
|
2390
2360
|
const configDir = claudeConfigDir;
|
|
2391
2361
|
for (const rel of [".credentials.json", "credentials.json"]) {
|
|
2392
|
-
const p =
|
|
2362
|
+
const p = path4.join(configDir, rel);
|
|
2393
2363
|
if (isFile(p)) return { source: "cli-subscription", evidence: p };
|
|
2394
2364
|
}
|
|
2395
2365
|
return null;
|
|
2396
2366
|
}
|
|
2397
2367
|
if (provider === "openai") {
|
|
2398
|
-
const p =
|
|
2368
|
+
const p = path4.join(codexHome(env), "auth.json");
|
|
2399
2369
|
if (isFile(p)) return { source: classifyCodexAuth(p), evidence: p };
|
|
2400
2370
|
return null;
|
|
2401
2371
|
}
|
|
2402
2372
|
if (provider === "gemini") {
|
|
2403
|
-
const p =
|
|
2373
|
+
const p = path4.join(home, ".gemini", "oauth_creds.json");
|
|
2404
2374
|
if (isFile(p)) return { source: "cli-subscription", evidence: p };
|
|
2405
2375
|
return null;
|
|
2406
2376
|
}
|
|
@@ -2432,7 +2402,7 @@ function detectHosts(opts) {
|
|
|
2432
2402
|
function detectAuth(opts) {
|
|
2433
2403
|
const env = opts.env ?? process.env;
|
|
2434
2404
|
const home = opts.home ?? homeOf(opts.env);
|
|
2435
|
-
const claudeConfigDir = opts.home === void 0 && opts.env === void 0 ? claude_config_dir() : (env["CLAUDE_CONFIG_DIR"] ?? "").trim() ||
|
|
2405
|
+
const claudeConfigDir = opts.home === void 0 && opts.env === void 0 ? claude_config_dir() : (env["CLAUDE_CONFIG_DIR"] ?? "").trim() || path4.join(home, ".claude");
|
|
2436
2406
|
const auth = [];
|
|
2437
2407
|
const keys = [];
|
|
2438
2408
|
for (const provider of knownProviders()) {
|
|
@@ -2486,7 +2456,7 @@ function detectEnvironment(opts = {}) {
|
|
|
2486
2456
|
}
|
|
2487
2457
|
|
|
2488
2458
|
// src/scripts/_cli/detection_report.ts
|
|
2489
|
-
import * as
|
|
2459
|
+
import * as path5 from "node:path";
|
|
2490
2460
|
|
|
2491
2461
|
// src/scripts/ai_council/transport_resolver.ts
|
|
2492
2462
|
var VALID_TRANSPORT_MODES = /* @__PURE__ */ new Set([
|
|
@@ -2688,7 +2658,7 @@ function cliBinaryPresent(environment, provider, binaryOverride) {
|
|
|
2688
2658
|
const expected = PROVIDER_CLI_META[provider]?.[0];
|
|
2689
2659
|
if (expected === void 0) return false;
|
|
2690
2660
|
return environment.hosts.some(
|
|
2691
|
-
(h) => h.binary !== null && stripExe(
|
|
2661
|
+
(h) => h.binary !== null && stripExe(path5.basename(h.binary)) === expected
|
|
2692
2662
|
);
|
|
2693
2663
|
}
|
|
2694
2664
|
function stripExe(name) {
|
|
@@ -2849,9 +2819,9 @@ function absentCouncilFacts(configPath) {
|
|
|
2849
2819
|
|
|
2850
2820
|
// src/scripts/ai_team/review_gate.ts
|
|
2851
2821
|
import * as crypto2 from "node:crypto";
|
|
2852
|
-
import * as
|
|
2822
|
+
import * as fs5 from "node:fs";
|
|
2853
2823
|
import * as os2 from "node:os";
|
|
2854
|
-
import * as
|
|
2824
|
+
import * as path6 from "node:path";
|
|
2855
2825
|
|
|
2856
2826
|
// src/scripts/ai_team/config.ts
|
|
2857
2827
|
var AI_TEAM_REVIEW_GATE_DEFAULTS = Object.freeze({
|
|
@@ -2867,16 +2837,16 @@ var AI_TEAM_DEFAULTS = Object.freeze({
|
|
|
2867
2837
|
});
|
|
2868
2838
|
|
|
2869
2839
|
// src/scripts/ai_team/review_gate.ts
|
|
2870
|
-
var GATE_LEDGER_RELPATH =
|
|
2840
|
+
var GATE_LEDGER_RELPATH = path6.join("agents", "runtime", "team", "events.log");
|
|
2871
2841
|
var _CODEX_PLUGIN_DATA_DIRNAME = `${CODEX_PLUGIN_ID}-${CODEX_MARKETPLACE_NAME}`;
|
|
2872
2842
|
function _workspace_state_segment(workspace_root) {
|
|
2873
2843
|
let canonical = workspace_root;
|
|
2874
2844
|
try {
|
|
2875
|
-
canonical =
|
|
2845
|
+
canonical = fs5.realpathSync.native(workspace_root);
|
|
2876
2846
|
} catch {
|
|
2877
2847
|
canonical = workspace_root;
|
|
2878
2848
|
}
|
|
2879
|
-
const slug_source =
|
|
2849
|
+
const slug_source = path6.basename(workspace_root) || "workspace";
|
|
2880
2850
|
const slug = slug_source.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "workspace";
|
|
2881
2851
|
const hash = crypto2.createHash("sha256").update(canonical).digest("hex").slice(0, 16);
|
|
2882
2852
|
return `${slug}-${hash}`;
|
|
@@ -2886,19 +2856,19 @@ function upstream_state_dir_candidates(workspace_root) {
|
|
|
2886
2856
|
const candidates = [];
|
|
2887
2857
|
const env = (process.env["CLAUDE_PLUGIN_DATA"] ?? "").trim();
|
|
2888
2858
|
if (env !== "") {
|
|
2889
|
-
candidates.push(
|
|
2859
|
+
candidates.push(path6.join(env, "state", segment));
|
|
2890
2860
|
}
|
|
2891
2861
|
candidates.push(
|
|
2892
|
-
|
|
2862
|
+
path6.join(claude_config_dir(), "plugins", "data", _CODEX_PLUGIN_DATA_DIRNAME, "state", segment)
|
|
2893
2863
|
);
|
|
2894
|
-
candidates.push(
|
|
2864
|
+
candidates.push(path6.join(os2.tmpdir(), "codex-companion", segment));
|
|
2895
2865
|
return candidates;
|
|
2896
2866
|
}
|
|
2897
2867
|
function upstream_gate_enabled(workspace_root) {
|
|
2898
2868
|
for (const dir of upstream_state_dir_candidates(workspace_root)) {
|
|
2899
2869
|
let parsed;
|
|
2900
2870
|
try {
|
|
2901
|
-
parsed = JSON.parse(
|
|
2871
|
+
parsed = JSON.parse(fs5.readFileSync(path6.join(dir, "state.json"), "utf-8"));
|
|
2902
2872
|
} catch {
|
|
2903
2873
|
continue;
|
|
2904
2874
|
}
|
|
@@ -2958,13 +2928,13 @@ var ArgparseExit = class extends Error {
|
|
|
2958
2928
|
function expanduser(p) {
|
|
2959
2929
|
if (p === "~") return os3.homedir();
|
|
2960
2930
|
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
2961
|
-
return
|
|
2931
|
+
return path7.join(os3.homedir(), p.slice(2));
|
|
2962
2932
|
}
|
|
2963
2933
|
return p;
|
|
2964
2934
|
}
|
|
2965
2935
|
function pathExists(p) {
|
|
2966
2936
|
try {
|
|
2967
|
-
|
|
2937
|
+
fs6.statSync(p);
|
|
2968
2938
|
return true;
|
|
2969
2939
|
} catch {
|
|
2970
2940
|
return false;
|
|
@@ -2972,27 +2942,27 @@ function pathExists(p) {
|
|
|
2972
2942
|
}
|
|
2973
2943
|
function isFile2(p) {
|
|
2974
2944
|
try {
|
|
2975
|
-
return
|
|
2945
|
+
return fs6.statSync(p).isFile();
|
|
2976
2946
|
} catch {
|
|
2977
2947
|
return false;
|
|
2978
2948
|
}
|
|
2979
2949
|
}
|
|
2980
2950
|
function isDir(p) {
|
|
2981
2951
|
try {
|
|
2982
|
-
return
|
|
2952
|
+
return fs6.statSync(p).isDirectory();
|
|
2983
2953
|
} catch {
|
|
2984
2954
|
return false;
|
|
2985
2955
|
}
|
|
2986
2956
|
}
|
|
2987
2957
|
function resolvePath(p) {
|
|
2988
2958
|
try {
|
|
2989
|
-
return
|
|
2959
|
+
return fs6.realpathSync(path7.resolve(p));
|
|
2990
2960
|
} catch {
|
|
2991
|
-
return
|
|
2961
|
+
return path7.resolve(p);
|
|
2992
2962
|
}
|
|
2993
2963
|
}
|
|
2994
2964
|
function readText(p) {
|
|
2995
|
-
return
|
|
2965
|
+
return fs6.readFileSync(p, "utf-8");
|
|
2996
2966
|
}
|
|
2997
2967
|
function _jsonStrAscii(s) {
|
|
2998
2968
|
let out = '"';
|
|
@@ -3103,7 +3073,7 @@ function _resolve_project_root(arg) {
|
|
|
3103
3073
|
}
|
|
3104
3074
|
var _INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
|
|
3105
3075
|
function _detect_install_mode(project_root) {
|
|
3106
|
-
const marker =
|
|
3076
|
+
const marker = path7.join(project_root, _INSTALL_MODE_MARKER_REL);
|
|
3107
3077
|
if (isFile2(marker)) {
|
|
3108
3078
|
let value;
|
|
3109
3079
|
try {
|
|
@@ -3115,9 +3085,9 @@ function _detect_install_mode(project_root) {
|
|
|
3115
3085
|
return [value, "marker-file"];
|
|
3116
3086
|
}
|
|
3117
3087
|
}
|
|
3118
|
-
const has_agents_md = pathExists(
|
|
3088
|
+
const has_agents_md = pathExists(path7.join(project_root, "AGENTS.md"));
|
|
3119
3089
|
const has_copilot = pathExists(
|
|
3120
|
-
|
|
3090
|
+
path7.join(project_root, ".github", "copilot-instructions.md")
|
|
3121
3091
|
);
|
|
3122
3092
|
if (has_agents_md && has_copilot) {
|
|
3123
3093
|
return ["full", "heuristic"];
|
|
@@ -3137,7 +3107,7 @@ function _settings_layer_chain(project_root) {
|
|
|
3137
3107
|
return layers;
|
|
3138
3108
|
}
|
|
3139
3109
|
function _detect_wrapper(project_root) {
|
|
3140
|
-
const wrapper =
|
|
3110
|
+
const wrapper = path7.join(project_root, "agent-config");
|
|
3141
3111
|
if (!pathExists(wrapper)) {
|
|
3142
3112
|
return { path: String(wrapper), exists: false, embedded_root: null };
|
|
3143
3113
|
}
|
|
@@ -3204,14 +3174,14 @@ function _emit_context_text(ctx) {
|
|
|
3204
3174
|
}
|
|
3205
3175
|
function _resolve_path(project_root, raw) {
|
|
3206
3176
|
let p = expanduser(raw);
|
|
3207
|
-
if (!
|
|
3208
|
-
p =
|
|
3177
|
+
if (!path7.isAbsolute(p)) {
|
|
3178
|
+
p = path7.join(project_root, p);
|
|
3209
3179
|
}
|
|
3210
3180
|
return p;
|
|
3211
3181
|
}
|
|
3212
3182
|
function _sha256(p) {
|
|
3213
3183
|
try {
|
|
3214
|
-
const data =
|
|
3184
|
+
const data = fs6.readFileSync(p);
|
|
3215
3185
|
return crypto3.createHash("sha256").update(data).digest("hex");
|
|
3216
3186
|
} catch {
|
|
3217
3187
|
return null;
|
|
@@ -3220,7 +3190,7 @@ function _sha256(p) {
|
|
|
3220
3190
|
var PACKAGE_TAG_ID = "event4u/agent-config";
|
|
3221
3191
|
var _FRONTMATTER_PACKAGE_RE = /^package:\s*(.+?)\s*$/m;
|
|
3222
3192
|
function _read_inline_package_tag(p) {
|
|
3223
|
-
if (
|
|
3193
|
+
if (path7.extname(p) !== ".md") {
|
|
3224
3194
|
return NO_FRONTMATTER;
|
|
3225
3195
|
}
|
|
3226
3196
|
let text;
|
|
@@ -3349,13 +3319,13 @@ function rglob(root) {
|
|
|
3349
3319
|
const walk = (dir) => {
|
|
3350
3320
|
let entries;
|
|
3351
3321
|
try {
|
|
3352
|
-
entries =
|
|
3322
|
+
entries = fs6.readdirSync(dir, { withFileTypes: true });
|
|
3353
3323
|
} catch {
|
|
3354
3324
|
return;
|
|
3355
3325
|
}
|
|
3356
3326
|
entries.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
3357
3327
|
for (const ent of entries) {
|
|
3358
|
-
const full =
|
|
3328
|
+
const full = path7.join(dir, ent.name);
|
|
3359
3329
|
out.push(full);
|
|
3360
3330
|
let dirLike = ent.isDirectory();
|
|
3361
3331
|
if (ent.isSymbolicLink()) {
|
|
@@ -3430,9 +3400,9 @@ function _foreign_records(project_root, foreign) {
|
|
|
3430
3400
|
return out;
|
|
3431
3401
|
}
|
|
3432
3402
|
function relativeTo(p, base) {
|
|
3433
|
-
const rel =
|
|
3403
|
+
const rel = path7.relative(base, p);
|
|
3434
3404
|
if (rel === "") return rel;
|
|
3435
|
-
if (rel.startsWith("..") ||
|
|
3405
|
+
if (rel.startsWith("..") || path7.isAbsolute(rel)) {
|
|
3436
3406
|
return null;
|
|
3437
3407
|
}
|
|
3438
3408
|
return rel;
|
|
@@ -3496,7 +3466,7 @@ var MANIFEST_REQUIRED_CHECK_IDS = /* @__PURE__ */ new Set([
|
|
|
3496
3466
|
]);
|
|
3497
3467
|
var INSTALL_MODE_MARKER_RELATIVE = "agents/.agent-state/install-mode.txt";
|
|
3498
3468
|
function _is_global_only_consumer(project_root) {
|
|
3499
|
-
return isFile2(
|
|
3469
|
+
return isFile2(path7.join(project_root, INSTALL_MODE_MARKER_RELATIVE)) || isDir(path7.join(project_root, "agents", "overrides"));
|
|
3500
3470
|
}
|
|
3501
3471
|
var REPAIR_IDS = ["wizard-state"];
|
|
3502
3472
|
var MCP_BETA_GATES = [
|
|
@@ -3516,7 +3486,7 @@ var STATUS_SYMBOLS = {
|
|
|
3516
3486
|
var MIN_PYTHON = [3, 10];
|
|
3517
3487
|
function _check_scope(project_root) {
|
|
3518
3488
|
for (const marker of ["pnpm-workspace.yaml", "lerna.json"]) {
|
|
3519
|
-
if (pathExists(
|
|
3489
|
+
if (pathExists(path7.join(project_root, marker))) {
|
|
3520
3490
|
return {
|
|
3521
3491
|
id: "scope",
|
|
3522
3492
|
status: "warn",
|
|
@@ -3525,7 +3495,7 @@ function _check_scope(project_root) {
|
|
|
3525
3495
|
};
|
|
3526
3496
|
}
|
|
3527
3497
|
}
|
|
3528
|
-
const pkg =
|
|
3498
|
+
const pkg = path7.join(project_root, "package.json");
|
|
3529
3499
|
if (pathExists(pkg)) {
|
|
3530
3500
|
try {
|
|
3531
3501
|
const data = JSON.parse(readText(pkg));
|
|
@@ -3551,7 +3521,7 @@ var _PLACEHOLDER_EMAIL_RE = /^(t@t\.t|.*@example\.(com|org)|.*@localhost)$/i;
|
|
|
3551
3521
|
var _PLACEHOLDER_NAME_RE = /^(t|test|user|nobody|x)$/i;
|
|
3552
3522
|
function _git_config_path(project_root) {
|
|
3553
3523
|
const common = git_common_dir(project_root);
|
|
3554
|
-
return common === null ? null :
|
|
3524
|
+
return common === null ? null : path7.join(common, "config");
|
|
3555
3525
|
}
|
|
3556
3526
|
function _parse_git_user(configText) {
|
|
3557
3527
|
let inUser = false;
|
|
@@ -3581,7 +3551,7 @@ function _check_git_identity(project_root) {
|
|
|
3581
3551
|
}
|
|
3582
3552
|
let ident = _parse_git_user(readText(cfgPath));
|
|
3583
3553
|
if (ident.name === null && ident.email === null) {
|
|
3584
|
-
const globalCfg =
|
|
3554
|
+
const globalCfg = path7.join(os3.homedir(), ".gitconfig");
|
|
3585
3555
|
if (pathExists(globalCfg)) {
|
|
3586
3556
|
ident = _parse_git_user(readText(globalCfg));
|
|
3587
3557
|
}
|
|
@@ -3642,7 +3612,7 @@ function _package_root() {
|
|
|
3642
3612
|
}
|
|
3643
3613
|
function _current_package_version() {
|
|
3644
3614
|
try {
|
|
3645
|
-
const data = JSON.parse(readText(
|
|
3615
|
+
const data = JSON.parse(readText(path7.join(_package_root(), "package.json")));
|
|
3646
3616
|
const v = data["version"];
|
|
3647
3617
|
if (typeof v === "string" && v.trim()) {
|
|
3648
3618
|
return v.trim();
|
|
@@ -3686,7 +3656,7 @@ function _check_lockfile_freshness(manifest) {
|
|
|
3686
3656
|
};
|
|
3687
3657
|
}
|
|
3688
3658
|
function shutilWhich(name) {
|
|
3689
|
-
if (
|
|
3659
|
+
if (path7.dirname(name) !== "." && (name.includes("/") || name.includes("\\"))) {
|
|
3690
3660
|
return isExecutableFile(name) ? name : null;
|
|
3691
3661
|
}
|
|
3692
3662
|
const pathEnv = process2.env["PATH"] || "";
|
|
@@ -3699,12 +3669,12 @@ function shutilWhich(name) {
|
|
|
3699
3669
|
if (seenDirs.has(d)) continue;
|
|
3700
3670
|
seenDirs.add(d);
|
|
3701
3671
|
for (const ext of exts) {
|
|
3702
|
-
const candidate =
|
|
3672
|
+
const candidate = path7.join(d, name + (ext === "" ? "" : ext.toLowerCase() === ext ? ext : ext));
|
|
3703
3673
|
if (isExecutableFile(candidate)) {
|
|
3704
3674
|
return candidate;
|
|
3705
3675
|
}
|
|
3706
3676
|
if (ext !== "") {
|
|
3707
|
-
const upper =
|
|
3677
|
+
const upper = path7.join(d, name + ext);
|
|
3708
3678
|
if (isExecutableFile(upper)) return upper;
|
|
3709
3679
|
}
|
|
3710
3680
|
}
|
|
@@ -3713,10 +3683,10 @@ function shutilWhich(name) {
|
|
|
3713
3683
|
}
|
|
3714
3684
|
function isExecutableFile(p) {
|
|
3715
3685
|
try {
|
|
3716
|
-
const st =
|
|
3686
|
+
const st = fs6.statSync(p);
|
|
3717
3687
|
if (!st.isFile()) return false;
|
|
3718
3688
|
if (process2.platform === "win32") return true;
|
|
3719
|
-
|
|
3689
|
+
fs6.accessSync(p, fs6.constants.X_OK);
|
|
3720
3690
|
return true;
|
|
3721
3691
|
} catch {
|
|
3722
3692
|
return false;
|
|
@@ -3780,7 +3750,7 @@ function _check_claude_plugin() {
|
|
|
3780
3750
|
remedy: ""
|
|
3781
3751
|
};
|
|
3782
3752
|
}
|
|
3783
|
-
const projection =
|
|
3753
|
+
const projection = path7.join(os3.homedir(), ".claude", "skills");
|
|
3784
3754
|
const projection_present = isDir(projection);
|
|
3785
3755
|
if (projection_present) {
|
|
3786
3756
|
return {
|
|
@@ -3817,8 +3787,8 @@ function _check_claude_command_wrappers() {
|
|
|
3817
3787
|
remedy: ""
|
|
3818
3788
|
};
|
|
3819
3789
|
}
|
|
3820
|
-
const anchor =
|
|
3821
|
-
const commands_dir =
|
|
3790
|
+
const anchor = path7.join(os3.homedir(), ".claude");
|
|
3791
|
+
const commands_dir = path7.join(anchor, "commands");
|
|
3822
3792
|
if (!isDir(commands_dir)) {
|
|
3823
3793
|
return {
|
|
3824
3794
|
id: "claude-command-wrappers",
|
|
@@ -3827,8 +3797,8 @@ function _check_claude_command_wrappers() {
|
|
|
3827
3797
|
remedy: ""
|
|
3828
3798
|
};
|
|
3829
3799
|
}
|
|
3830
|
-
const flat_probe =
|
|
3831
|
-
const wrapper_probe =
|
|
3800
|
+
const flat_probe = fs6.existsSync(path7.join(commands_dir, "commit.md"));
|
|
3801
|
+
const wrapper_probe = fs6.existsSync(path7.join(anchor, "skills", "commit", "SKILL.md"));
|
|
3832
3802
|
if (wrapper_probe) {
|
|
3833
3803
|
return {
|
|
3834
3804
|
id: "claude-command-wrappers",
|
|
@@ -3853,7 +3823,7 @@ function _check_claude_command_wrappers() {
|
|
|
3853
3823
|
};
|
|
3854
3824
|
}
|
|
3855
3825
|
function _check_surface_state() {
|
|
3856
|
-
const matrix_path =
|
|
3826
|
+
const matrix_path = path7.join(_package_root(), "src", "config", "surface-matrix.yml");
|
|
3857
3827
|
if (!isFile2(matrix_path)) {
|
|
3858
3828
|
return {
|
|
3859
3829
|
id: "surface-state",
|
|
@@ -3877,7 +3847,7 @@ function _check_surface_state() {
|
|
|
3877
3847
|
remedy: "agent-config upgrade (reinstalls the package data files)"
|
|
3878
3848
|
};
|
|
3879
3849
|
}
|
|
3880
|
-
const _expand = (p) => p.startsWith("~/") ?
|
|
3850
|
+
const _expand = (p) => p.startsWith("~/") ? path7.join(os3.homedir(), p.slice(2)) : path7.join(_package_root(), p);
|
|
3881
3851
|
const violations = [];
|
|
3882
3852
|
const remedies = [];
|
|
3883
3853
|
let checked = 0;
|
|
@@ -3919,7 +3889,7 @@ function _check_surface_state() {
|
|
|
3919
3889
|
}
|
|
3920
3890
|
function pathExistsAny(p) {
|
|
3921
3891
|
try {
|
|
3922
|
-
|
|
3892
|
+
fs6.statSync(p);
|
|
3923
3893
|
return true;
|
|
3924
3894
|
} catch {
|
|
3925
3895
|
return false;
|
|
@@ -3935,13 +3905,13 @@ function _check_hook_wiring() {
|
|
|
3935
3905
|
remedy: ""
|
|
3936
3906
|
};
|
|
3937
3907
|
}
|
|
3938
|
-
const settings_path =
|
|
3908
|
+
const settings_path = path7.join(os3.homedir(), ".claude", "settings.json");
|
|
3939
3909
|
let missing;
|
|
3940
3910
|
try {
|
|
3941
3911
|
const matrix = build_claude_hook_matrix(
|
|
3942
|
-
|
|
3912
|
+
path7.join(_package_root(), "src", "scripts", "hook_manifest.yaml")
|
|
3943
3913
|
);
|
|
3944
|
-
const settings = pathExists(settings_path) ? JSON.parse(
|
|
3914
|
+
const settings = pathExists(settings_path) ? JSON.parse(fs6.readFileSync(settings_path, "utf8")) : {};
|
|
3945
3915
|
const hooks = (settings["hooks"] ?? {}) || {};
|
|
3946
3916
|
missing = Object.keys(matrix).filter((ev) => {
|
|
3947
3917
|
const groups = hooks[ev];
|
|
@@ -4016,7 +3986,7 @@ function _check_mcp_mode(project_root) {
|
|
|
4016
3986
|
];
|
|
4017
3987
|
const found = [];
|
|
4018
3988
|
for (const [rel, label] of candidates) {
|
|
4019
|
-
const p =
|
|
3989
|
+
const p = path7.join(project_root, rel);
|
|
4020
3990
|
if (!pathExists(p)) {
|
|
4021
3991
|
continue;
|
|
4022
3992
|
}
|
|
@@ -4048,7 +4018,7 @@ function _check_mcp_mode(project_root) {
|
|
|
4048
4018
|
};
|
|
4049
4019
|
}
|
|
4050
4020
|
function _check_offline_readiness() {
|
|
4051
|
-
const script =
|
|
4021
|
+
const script = path7.join(_package_root(), "src", "scripts", "hermetic-install.sh");
|
|
4052
4022
|
if (!pathExists(script)) {
|
|
4053
4023
|
return {
|
|
4054
4024
|
id: "offline-readiness",
|
|
@@ -4106,7 +4076,7 @@ function _check_stale_orphans() {
|
|
|
4106
4076
|
(a, b) => a < b ? -1 : a > b ? 1 : 0
|
|
4107
4077
|
);
|
|
4108
4078
|
for (const root_name of ownedSorted) {
|
|
4109
|
-
const root =
|
|
4079
|
+
const root = path7.join(anchor, root_name);
|
|
4110
4080
|
if (!isDir(root)) {
|
|
4111
4081
|
continue;
|
|
4112
4082
|
}
|
|
@@ -4121,7 +4091,7 @@ function _check_stale_orphans() {
|
|
|
4121
4091
|
if (rel === null) {
|
|
4122
4092
|
continue;
|
|
4123
4093
|
}
|
|
4124
|
-
const relPosix = rel.split(
|
|
4094
|
+
const relPosix = rel.split(path7.sep).join("/");
|
|
4125
4095
|
if (recorded_set.has(relPosix)) {
|
|
4126
4096
|
continue;
|
|
4127
4097
|
}
|
|
@@ -4176,14 +4146,14 @@ function _check_rule_scope_drift(project_root) {
|
|
|
4176
4146
|
let rules_dir = null;
|
|
4177
4147
|
let found = 0;
|
|
4178
4148
|
for (const rel of _RULE_PROJECTION_DIRS) {
|
|
4179
|
-
const cand =
|
|
4149
|
+
const cand = path7.join(project_root, rel);
|
|
4180
4150
|
if (!isDir(cand)) {
|
|
4181
4151
|
continue;
|
|
4182
4152
|
}
|
|
4183
4153
|
let count = 0;
|
|
4184
4154
|
try {
|
|
4185
|
-
for (const name of
|
|
4186
|
-
if (name.endsWith(".md") && isFile2(
|
|
4155
|
+
for (const name of fs6.readdirSync(cand)) {
|
|
4156
|
+
if (name.endsWith(".md") && isFile2(path7.join(cand, name))) {
|
|
4187
4157
|
count += 1;
|
|
4188
4158
|
}
|
|
4189
4159
|
}
|
|
@@ -4237,14 +4207,14 @@ function _check_rule_scope_drift(project_root) {
|
|
|
4237
4207
|
};
|
|
4238
4208
|
}
|
|
4239
4209
|
function _check_duplicate_scope_rules(project_root, userRulesDirOverride) {
|
|
4240
|
-
const user_rules_dir = userRulesDirOverride ??
|
|
4210
|
+
const user_rules_dir = userRulesDirOverride ?? path7.join(os3.homedir(), ".claude", "rules");
|
|
4241
4211
|
let project_rules_dir = null;
|
|
4242
4212
|
if (_is_source_repo(project_root)) {
|
|
4243
|
-
const cand =
|
|
4213
|
+
const cand = path7.join(project_root, "dist", "agent-src", "rules");
|
|
4244
4214
|
if (isDir(cand)) project_rules_dir = cand;
|
|
4245
4215
|
} else {
|
|
4246
4216
|
for (const rel of _RULE_PROJECTION_DIRS) {
|
|
4247
|
-
const cand =
|
|
4217
|
+
const cand = path7.join(project_root, rel);
|
|
4248
4218
|
if (isDir(cand)) {
|
|
4249
4219
|
project_rules_dir = cand;
|
|
4250
4220
|
break;
|
|
@@ -4313,7 +4283,7 @@ function _check_mcp_beta_readiness(project_root) {
|
|
|
4313
4283
|
}
|
|
4314
4284
|
const pending = [];
|
|
4315
4285
|
for (const [gate_id, rel] of MCP_BETA_GATES) {
|
|
4316
|
-
if (!pathExists(
|
|
4286
|
+
if (!pathExists(path7.join(project_root, rel))) {
|
|
4317
4287
|
pending.push(`${gate_id} (${rel})`);
|
|
4318
4288
|
}
|
|
4319
4289
|
}
|
|
@@ -4334,7 +4304,7 @@ function _check_mcp_beta_readiness(project_root) {
|
|
|
4334
4304
|
}
|
|
4335
4305
|
function _check_tier_usage_readiness(project_root) {
|
|
4336
4306
|
const settings_file = project_settings_path(project_root);
|
|
4337
|
-
let log_path =
|
|
4307
|
+
let log_path = path7.join(project_root, ".agent-tier-usage.jsonl");
|
|
4338
4308
|
let enabled = false;
|
|
4339
4309
|
if (isFile2(settings_file)) {
|
|
4340
4310
|
let raw;
|
|
@@ -4353,7 +4323,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
4353
4323
|
const outputRaw = tu["output"];
|
|
4354
4324
|
const output = typeof outputRaw === "object" && outputRaw !== null && !Array.isArray(outputRaw) ? outputRaw : {};
|
|
4355
4325
|
if (typeof output["path"] === "string" && output["path"].trim()) {
|
|
4356
|
-
log_path =
|
|
4326
|
+
log_path = path7.join(project_root, output["path"].trim());
|
|
4357
4327
|
}
|
|
4358
4328
|
const val = tu["enabled"];
|
|
4359
4329
|
if (typeof val === "boolean") {
|
|
@@ -4378,7 +4348,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
4378
4348
|
return {
|
|
4379
4349
|
id: "tier-usage-readiness",
|
|
4380
4350
|
status: "warn",
|
|
4381
|
-
message: `tier-usage telemetry on but ${
|
|
4351
|
+
message: `tier-usage telemetry on but ${path7.basename(log_path)} not yet written \u2014 no signal accumulated`,
|
|
4382
4352
|
remedy: "run any tracked command to seed the log; the dispatcher writes one record per invocation"
|
|
4383
4353
|
};
|
|
4384
4354
|
}
|
|
@@ -4393,7 +4363,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
4393
4363
|
return {
|
|
4394
4364
|
id: "tier-usage-readiness",
|
|
4395
4365
|
status: "fail",
|
|
4396
|
-
message: `cannot read ${
|
|
4366
|
+
message: `cannot read ${path7.basename(log_path)}: ${osErrorStr(exc)}`,
|
|
4397
4367
|
remedy: "fix permissions on the tier-usage log"
|
|
4398
4368
|
};
|
|
4399
4369
|
}
|
|
@@ -4424,7 +4394,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
4424
4394
|
return {
|
|
4425
4395
|
id: "tier-usage-readiness",
|
|
4426
4396
|
status: "fail",
|
|
4427
|
-
message: `${total} record(s) in ${
|
|
4397
|
+
message: `${total} record(s) in ${path7.basename(log_path)} but 0 passed the privacy floor \u2014 report would refuse to render`,
|
|
4428
4398
|
remedy: "inspect the log; the dispatcher is writing records the contract forbids (paths, argv, message bodies)"
|
|
4429
4399
|
};
|
|
4430
4400
|
}
|
|
@@ -4432,19 +4402,19 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
4432
4402
|
return {
|
|
4433
4403
|
id: "tier-usage-readiness",
|
|
4434
4404
|
status: "warn",
|
|
4435
|
-
message: `${
|
|
4405
|
+
message: `${path7.basename(log_path)} present but empty \u2014 no signal yet`,
|
|
4436
4406
|
remedy: "run any tracked command to seed the log"
|
|
4437
4407
|
};
|
|
4438
4408
|
}
|
|
4439
4409
|
return {
|
|
4440
4410
|
id: "tier-usage-readiness",
|
|
4441
4411
|
status: "ok",
|
|
4442
|
-
message: `${valid} record(s) past the privacy floor in ${
|
|
4412
|
+
message: `${valid} record(s) past the privacy floor in ${path7.basename(log_path)} \u2014 retiering signal available`,
|
|
4443
4413
|
remedy: ""
|
|
4444
4414
|
};
|
|
4445
4415
|
}
|
|
4446
4416
|
function readText0(p) {
|
|
4447
|
-
return
|
|
4417
|
+
return fs6.readFileSync(p, "utf-8");
|
|
4448
4418
|
}
|
|
4449
4419
|
function osErrorStr(exc) {
|
|
4450
4420
|
if (exc && typeof exc === "object" && "message" in exc) {
|
|
@@ -4617,7 +4587,7 @@ function _epoch_seconds(value) {
|
|
|
4617
4587
|
function _codex_auth_expiry(auth_path) {
|
|
4618
4588
|
let data;
|
|
4619
4589
|
try {
|
|
4620
|
-
data = JSON.parse(
|
|
4590
|
+
data = JSON.parse(fs6.readFileSync(auth_path, "utf-8"));
|
|
4621
4591
|
} catch {
|
|
4622
4592
|
return null;
|
|
4623
4593
|
}
|
|
@@ -4763,7 +4733,7 @@ function _check_team(project_root) {
|
|
|
4763
4733
|
if (binary_missing) {
|
|
4764
4734
|
remedies.push("install the codex CLI: `npm install -g @openai/codex`");
|
|
4765
4735
|
}
|
|
4766
|
-
const auth_path =
|
|
4736
|
+
const auth_path = path7.join(_codex_home(), "auth.json");
|
|
4767
4737
|
const authed = pathExists(auth_path);
|
|
4768
4738
|
let auth_str;
|
|
4769
4739
|
if (!authed) {
|
|
@@ -4851,7 +4821,7 @@ function _check_unsupported_combos(manifest) {
|
|
|
4851
4821
|
};
|
|
4852
4822
|
}
|
|
4853
4823
|
function _wizard_state_path() {
|
|
4854
|
-
return
|
|
4824
|
+
return path7.join(event4u_root(), "state", "wizard-state.json");
|
|
4855
4825
|
}
|
|
4856
4826
|
function _check_wizard_state() {
|
|
4857
4827
|
const state_pth = _wizard_state_path();
|
|
@@ -4931,7 +4901,7 @@ function _check_wizard_state() {
|
|
|
4931
4901
|
};
|
|
4932
4902
|
}
|
|
4933
4903
|
function _check_settings_review_pending() {
|
|
4934
|
-
const delta_pth =
|
|
4904
|
+
const delta_pth = path7.join(event4u_root(), "state", "settings-delta.json");
|
|
4935
4905
|
if (!pathExists(delta_pth)) {
|
|
4936
4906
|
return {
|
|
4937
4907
|
id: "settings-review-pending",
|
|
@@ -4957,7 +4927,7 @@ function _check_settings_review_pending() {
|
|
|
4957
4927
|
}
|
|
4958
4928
|
function _check_memory_merge_union(project_root) {
|
|
4959
4929
|
const remedy = "run: npx tsx src/scripts/sync_gitattributes.ts (or `agent-config refresh --project`)";
|
|
4960
|
-
const target =
|
|
4930
|
+
const target = path7.join(project_root, DEFAULT_GITATTRIBUTES);
|
|
4961
4931
|
if (!pathExists(target)) {
|
|
4962
4932
|
return {
|
|
4963
4933
|
id: "memory-merge-union",
|
|
@@ -5439,7 +5409,7 @@ function _run_repair(opts) {
|
|
|
5439
5409
|
};
|
|
5440
5410
|
if (exists2) {
|
|
5441
5411
|
try {
|
|
5442
|
-
|
|
5412
|
+
fs6.unlinkSync(state_pth);
|
|
5443
5413
|
} catch (exc) {
|
|
5444
5414
|
payload["action"] = "error";
|
|
5445
5415
|
payload["error"] = osErrorStr(exc);
|
|
@@ -5534,13 +5504,13 @@ function _isCliEntry() {
|
|
|
5534
5504
|
if (process2.argv[1] === void 0) {
|
|
5535
5505
|
return false;
|
|
5536
5506
|
}
|
|
5537
|
-
const argvUrl = pathToFileURL(
|
|
5507
|
+
const argvUrl = pathToFileURL(path7.resolve(process2.argv[1])).href;
|
|
5538
5508
|
if (import.meta.url === argvUrl) {
|
|
5539
5509
|
return true;
|
|
5540
5510
|
}
|
|
5541
5511
|
try {
|
|
5542
|
-
const here =
|
|
5543
|
-
const argv =
|
|
5512
|
+
const here = fs6.realpathSync(fileURLToPath2(import.meta.url));
|
|
5513
|
+
const argv = fs6.realpathSync(path7.resolve(process2.argv[1]));
|
|
5544
5514
|
return here === argv;
|
|
5545
5515
|
} catch {
|
|
5546
5516
|
return false;
|