@event4u/agent-config 9.27.0 → 9.29.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/AGENTS.md +13 -12
- package/CHANGELOG.md +165 -0
- package/README.md +1 -1
- package/agents/templates/.ai-council.yml.example +55 -24
- package/dist/agent-src/commands/analyze/conformance.md +24 -0
- package/dist/agent-src/commands/cost/report.md +2 -2
- package/dist/agent-src/commands/team/adversarial.md +8 -7
- package/dist/agent-src/commands/team/delegate.md +13 -12
- package/dist/agent-src/commands/team/review.md +9 -8
- package/dist/agent-src/commands/team/status.md +9 -8
- package/dist/agent-src/commands/team.md +29 -19
- package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +88 -2
- package/dist/agent-src/contexts/execution/auto-orchestration-activation.md +29 -21
- package/dist/agent-src/contexts/execution/host-capability-manifest.md +26 -15
- package/dist/agent-src/contexts/execution/orchestration-telemetry.md +28 -3
- package/dist/agent-src/contexts/execution/subagent-response-contract.md +54 -0
- package/dist/agent-src/contexts/execution/subagent-routing.md +13 -11
- package/dist/agent-src/contexts/execution/subagent-spawn-contract.md +25 -0
- package/dist/agent-src/contexts/execution/subagent-steering.md +6 -3
- package/dist/agent-src/rules/artifact-engagement-recording.md +4 -1
- package/dist/agent-src/rules/autonomous-execution.md +1 -1
- package/dist/agent-src/rules/brand-source-of-truth.md +33 -6
- package/dist/agent-src/rules/context-hygiene.md +3 -1
- package/dist/agent-src/rules/council-availability.md +93 -0
- package/dist/agent-src/rules/cross-source-consistency.md +3 -0
- package/dist/agent-src/rules/delegation-policy.md +38 -10
- package/dist/agent-src/rules/design-fidelity.md +3 -0
- package/dist/agent-src/rules/evaluator-independence.md +2 -1
- package/dist/agent-src/rules/external-code-graph-interop.md +2 -1
- package/dist/agent-src/rules/finance-safety-floor.md +1 -1
- package/dist/agent-src/rules/git-history-discipline.md +1 -1
- package/dist/agent-src/rules/history-discipline.md +3 -1
- package/dist/agent-src/rules/legal-safety-floor.md +1 -1
- package/dist/agent-src/rules/no-pr-progress-comments.md +3 -1
- package/dist/agent-src/rules/onboarding-gate.md +3 -1
- package/dist/agent-src/rules/roadmap-ci-steps-policy.md +4 -1
- package/dist/agent-src/rules/role-mode-adherence.md +1 -1
- package/dist/agent-src/rules/scale-discipline.md +3 -1
- package/dist/agent-src/rules/self-repair-loop.md +103 -0
- package/dist/agent-src/rules/session-canary.md +2 -1
- package/dist/agent-src/rules/settings-ask-protocol.md +8 -7
- package/dist/agent-src/rules/strategy-safety-floor.md +1 -1
- package/dist/agent-src/rules/token-budget-discipline.md +4 -2
- package/dist/agent-src/rules/tool-safety.md +5 -1
- package/dist/agent-src/skills/adversarial-review/SKILL.md +1 -1
- package/dist/agent-src/skills/analysis-autonomous-mode/SKILL.md +1 -1
- package/dist/agent-src/skills/forensics-report/SKILL.md +114 -0
- package/dist/agent-src/skills/forensics-report/evals/triggers.json +17 -0
- package/dist/agent-src/skills/performance-analysis/SKILL.md +1 -1
- package/dist/agent-src/skills/persona-improvement/SKILL.md +1 -1
- package/dist/agent-src/skills/premortem/SKILL.md +30 -1
- package/dist/agent-src/skills/project-analyzer/SKILL.md +1 -1
- package/dist/agent-src/skills/reasoning-orchestrator/SKILL.md +2 -1
- package/dist/agent-src/skills/security-audit/SKILL.md +1 -1
- package/dist/agent-src/skills/sequential-thinking/SKILL.md +1 -1
- package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +1 -1
- package/dist/agent-src/skills/subagent-orchestration/SKILL.md +7 -5
- package/dist/agent-src/skills/subagent-orchestration/schemas/subagent-status.json +61 -3
- package/dist/agent-src/skills/test-case-discovery/SKILL.md +1 -1
- package/dist/agent-src/skills/universal-project-analysis/SKILL.md +1 -1
- package/dist/agent-src/templates/AGENTS.md +8 -12
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/roadmaps.md +23 -0
- package/dist/cli/registry.js +7 -0
- package/dist/cli/registry.js.map +1 -1
- package/dist/cli-delegate/chunk-66OVWGB5.js +270 -0
- package/dist/cli-delegate/{chunk-HJ6DAJHR.js → chunk-LCFJIQ4J.js} +89 -7
- package/dist/cli-delegate/{chunk-VSYT7OHO.js → chunk-LVRYBKTI.js} +31 -2
- package/dist/cli-delegate/{chunk-DVRS2KVR.js → chunk-MMXA5GY7.js} +10 -17
- package/dist/cli-delegate/{chunk-WR6GTRHJ.js → chunk-MP3JT3IU.js} +3 -3
- package/dist/cli-delegate/{chunk-3KJIMFTB.js → chunk-NZ5N2XQL.js} +467 -305
- package/dist/cli-delegate/{chunk-AIIUU73N.js → chunk-OJM3MBJM.js} +1 -1
- package/dist/cli-delegate/{chunk-BCPIOAGV.js → chunk-RCIA67XN.js} +117 -96
- package/dist/cli-delegate/chunk-REKCMYOU.js +2991 -0
- package/dist/cli-delegate/cmd_analyze_session.js +1 -1
- package/dist/cli-delegate/cmd_brand_status.js +134 -0
- package/dist/cli-delegate/cmd_conformance.js +10 -47
- package/dist/cli-delegate/cmd_converge.js +3 -3
- package/dist/cli-delegate/cmd_doctor.js +10 -6
- package/dist/cli-delegate/cmd_explain.js +80 -330
- package/dist/cli-delegate/cmd_export.js +6 -6
- package/dist/cli-delegate/cmd_fleet.js +3 -3
- package/dist/cli-delegate/cmd_handoff.js +3 -3
- package/dist/cli-delegate/cmd_mcp_available.js +433 -0
- package/dist/cli-delegate/cmd_migrate.js +3 -3
- package/dist/cli-delegate/cmd_packs_active.js +153 -0
- package/dist/cli-delegate/cmd_preflight.js +1 -1
- package/dist/cli-delegate/cmd_prune.js +6 -6
- package/dist/cli-delegate/cmd_route_audit.js +8 -8
- package/dist/cli-delegate/cmd_route_explain.js +4 -4
- package/dist/cli-delegate/cmd_settings_get.js +266 -0
- package/dist/cli-delegate/cmd_settings_migrate.js +6 -6
- package/dist/cli-delegate/cmd_settings_set.js +8 -2968
- package/dist/cli-delegate/cmd_sync.js +6 -6
- package/dist/cli-delegate/cmd_uninstall.js +6 -6
- package/dist/cli-delegate/cmd_update.js +4 -4
- package/dist/cli-delegate/cmd_upgrade.js +4 -4
- package/dist/cli-delegate/cmd_validate.js +6 -6
- package/dist/cli-delegate/cmd_versions.js +4 -4
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +164 -55
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +4 -3
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +44 -5
- package/dist/discovery/trust-report.md +11 -11
- package/dist/discovery/workspaces.json +16 -6
- package/dist/hooks/dispatch.js +9341 -6131
- package/dist/install/install.mjs +739 -524
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +777 -281
- package/dist/router.json +1 -1
- package/dist/scripts/_lib/agent_settings.js +134 -15
- package/dist/scripts/_lib/agent_settings.js.map +1 -1
- package/dist/scripts/condense.js +147 -2
- package/dist/scripts/condense.js.map +1 -1
- package/dist/server/schemas/settings.js +6 -7
- package/dist/server/schemas/settings.js.map +1 -1
- package/dist/shared/settingsCarveOut.js +0 -9
- package/dist/shared/settingsCarveOut.js.map +1 -1
- package/dist/shared/settingsClasses.js +11 -9
- package/dist/shared/settingsClasses.js.map +1 -1
- package/dist/ui/assets/{index-DmR0mbk4.js → index-JDAF00bC.js} +2 -2
- package/dist/ui/assets/{index-DmR0mbk4.js.map → index-JDAF00bC.js.map} +1 -1
- package/dist/ui/index.html +1 -1
- package/docs/contracts/settings-classes.md +68 -17
- package/docs/guidelines/agent-infra/memory-access.md +14 -3
- package/package.json +1 -1
- package/src/agent-src/templates/AGENTS.md +8 -12
- package/src/config/agent-settings.template.yml +52 -66
- package/src/config/budgets.yml +29 -0
- package/src/config/discovery/packs.yml +11 -0
- package/src/config/discovery/workspaces.yml +1 -1
- package/src/config/evaluator-budgets.json +4 -4
- package/src/config/gate-coverage.yml +26 -0
- package/src/config/gate-violation-baselines.json +3 -3
- package/src/scripts/_cli/cmd_brand_status.ts +174 -0
- package/src/scripts/_cli/cmd_conformance.ts +14 -42
- package/src/scripts/_cli/cmd_doctor.ts +65 -48
- package/src/scripts/_cli/cmd_mcp_available.ts +266 -0
- package/src/scripts/_cli/cmd_packs_active.ts +225 -0
- package/src/scripts/_cli/cmd_settings_get.ts +324 -0
- package/src/scripts/_dispatch.bash +57 -0
- package/src/scripts/_lib/agent_settings.ts +140 -16
- package/src/scripts/_lib/auto_dispatch.corpus.test.ts +1 -1
- package/src/scripts/_lib/auto_dispatch.ts +23 -18
- package/src/scripts/_lib/capsule_trigger.ts +124 -0
- package/src/scripts/_lib/carrier_divergence.ts +135 -0
- package/src/scripts/_lib/host_capability.ts +144 -4
- package/src/scripts/_lib/judgment_ladder.ts +382 -0
- package/src/scripts/_lib/orchestration_gate.ts +8 -0
- package/src/scripts/_lib/orchestration_record.ts +37 -0
- package/src/scripts/_lib/orchestration_savings.ts +1 -1
- package/src/scripts/_lib/prompt_shape.ts +88 -0
- package/src/scripts/_lib/review_skipped_record.ts +102 -0
- package/src/scripts/_lib/rule_layer_overlap.ts +254 -0
- package/src/scripts/_lib/self_repair.ts +489 -0
- package/src/scripts/_lib/self_repair_store.ts +128 -0
- package/src/scripts/_lib/subagent_capsule.ts +182 -0
- package/src/scripts/_lib/subagent_response.ts +19 -0
- package/src/scripts/_lib/subagent_spawn.ts +13 -0
- package/src/scripts/_lib/subagent_steering.ts +9 -4
- package/src/scripts/_lib/tier_budget_routing.ts +6 -1
- package/src/scripts/_lib/transcript_entry.ts +80 -0
- package/src/scripts/_lib/worker_budget.ts +37 -2
- package/src/scripts/ai_council/clients.ts +76 -54
- package/src/scripts/ai_council/config.ts +94 -6
- package/src/scripts/ai_council/handoff.ts +113 -0
- package/src/scripts/ai_council/modes.ts +19 -4
- package/src/scripts/ai_council/orchestrator.ts +105 -0
- package/src/scripts/ai_council/quorum.ts +84 -0
- package/src/scripts/ai_council/session.ts +44 -0
- package/src/scripts/ai_council/transport_resolver.ts +127 -1
- package/src/scripts/ai_team/availability.ts +110 -0
- package/src/scripts/ai_team/config.ts +34 -14
- package/src/scripts/ai_team/team_dispatch.ts +71 -29
- package/src/scripts/bench_critic_protocol.ts +396 -0
- package/src/scripts/check_branch_freshness.ts +255 -0
- package/src/scripts/check_council_config_location.ts +125 -1
- package/src/scripts/check_detector_corpus.ts +202 -0
- package/src/scripts/check_hook_bundle_freshness.ts +4 -1
- package/src/scripts/check_standing_rule_delivery.ts +314 -0
- package/src/scripts/condense.ts +162 -2
- package/src/scripts/config/profiles.ts +13 -3
- package/src/scripts/conformance_scan.ts +272 -24
- package/src/scripts/council_availability_hook.ts +188 -0
- package/src/scripts/council_cli.ts +527 -32
- package/src/scripts/forensics_report.ts +333 -0
- package/src/scripts/hook_manifest.yaml +107 -26
- package/src/scripts/hooks/block_no_verify.ts +39 -2
- package/src/scripts/hooks/block_unauthorized_git.ts +156 -7
- package/src/scripts/hooks/concern_registry.ts +10 -0
- package/src/scripts/hooks/delegation_nudge_hook.ts +484 -0
- package/src/scripts/hooks/end_review_nudge_hook.ts +726 -0
- package/src/scripts/hooks/orchestration_record_hook.ts +342 -0
- package/src/scripts/install.ts +151 -0
- package/src/scripts/language_mirror_hook.ts +30 -37
- package/src/scripts/lint_discovery_vocabulary.ts +2 -0
- package/src/scripts/lint_never_silent.ts +276 -0
- package/src/scripts/lint_no_activation_gates.ts +271 -0
- package/src/scripts/measure_scope_dedup.ts +19 -13
- package/src/scripts/onboarding_gate_hook.ts +40 -1
- package/src/scripts/orchestration_record.ts +12 -1
- package/src/scripts/preamble_byte_census.ts +9 -20
- package/src/scripts/rebuild_hook_bundle.ts +177 -0
- package/src/scripts/release.ts +74 -2
- package/src/scripts/report_carrier_divergence.ts +364 -0
- package/src/scripts/report_skill_activation.ts +257 -0
- package/src/scripts/report_skill_obligation_violations.ts +579 -0
- package/src/scripts/routing_doctor.ts +95 -39
- package/src/scripts/score_skill_selection.ts +19 -5
- package/src/scripts/self_repair_cli.ts +470 -0
- package/src/scripts/self_repair_hook.ts +241 -0
- package/src/scripts/team_events_spike.ts +271 -0
- package/src/scripts/team_review_gate_hook.ts +31 -9
- package/src/server/schemas/settings.ts +10 -17
- package/src/shared/settingsCarveOut.ts +0 -10
- package/src/shared/settingsClasses.ts +11 -9
|
@@ -3,6 +3,12 @@ import { createRequire as __acCreateRequire } from 'node:module'; const require
|
|
|
3
3
|
import {
|
|
4
4
|
trigger_matches
|
|
5
5
|
} from "./chunk-LF2KKJ4Q.js";
|
|
6
|
+
import {
|
|
7
|
+
PROFILE_ID_ENV,
|
|
8
|
+
ProfileError,
|
|
9
|
+
artefact_roots,
|
|
10
|
+
resolve_profile
|
|
11
|
+
} from "./chunk-66OVWGB5.js";
|
|
6
12
|
import {
|
|
7
13
|
StateLoadError,
|
|
8
14
|
load_state
|
|
@@ -13,93 +19,22 @@ import {
|
|
|
13
19
|
load_agent_settings,
|
|
14
20
|
logger,
|
|
15
21
|
resolve_project_root
|
|
16
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-LCFJIQ4J.js";
|
|
17
23
|
import "./chunk-NDJLNC6Q.js";
|
|
18
24
|
import {
|
|
19
25
|
__export
|
|
20
26
|
} from "./chunk-J55WI3RR.js";
|
|
21
27
|
|
|
22
28
|
// src/scripts/_cli/cmd_explain.ts
|
|
23
|
-
import * as
|
|
24
|
-
import * as
|
|
29
|
+
import * as fs7 from "node:fs";
|
|
30
|
+
import * as path6 from "node:path";
|
|
25
31
|
import process2 from "node:process";
|
|
26
|
-
import { fileURLToPath
|
|
32
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
27
33
|
|
|
28
34
|
// src/scripts/config/presets.ts
|
|
29
|
-
import * as fs2 from "node:fs";
|
|
30
|
-
import { createRequire } from "node:module";
|
|
31
|
-
import * as path2 from "node:path";
|
|
32
|
-
|
|
33
|
-
// src/scripts/_lib/agent_src.ts
|
|
34
35
|
import * as fs from "node:fs";
|
|
36
|
+
import { createRequire } from "node:module";
|
|
35
37
|
import * as path from "node:path";
|
|
36
|
-
import { fileURLToPath } from "node:url";
|
|
37
|
-
var _HERE = path.dirname(fileURLToPath(import.meta.url));
|
|
38
|
-
var _DEFAULT_ROOT = path.resolve(_HERE, "..", "..", "..");
|
|
39
|
-
function _deriveRoots(root) {
|
|
40
|
-
const packages = path.join(root, "packages");
|
|
41
|
-
const src = path.join(root, "src");
|
|
42
|
-
return {
|
|
43
|
-
ROOT: root,
|
|
44
|
-
LEGACY_SRC: path.join(root, ".agent-src.uncondensed"),
|
|
45
|
-
PACKAGES: packages,
|
|
46
|
-
PACKAGE_CORE: path.join(packages, "core"),
|
|
47
|
-
SRC: src,
|
|
48
|
-
SRC_SKILLS: path.join(src, "skills"),
|
|
49
|
-
SRC_RULES: path.join(src, "rules"),
|
|
50
|
-
SRC_AGENT: path.join(src, "agent-src"),
|
|
51
|
-
SRC_DOMAINS: path.join(src, "domains")
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
var _roots = _deriveRoots(_DEFAULT_ROOT);
|
|
55
|
-
function _isDir(p) {
|
|
56
|
-
try {
|
|
57
|
-
return fs.statSync(p).isDirectory();
|
|
58
|
-
} catch {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
function _exists(p) {
|
|
63
|
-
try {
|
|
64
|
-
fs.statSync(p);
|
|
65
|
-
return true;
|
|
66
|
-
} catch {
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
function _iterdirSorted(p) {
|
|
71
|
-
let names;
|
|
72
|
-
try {
|
|
73
|
-
names = fs.readdirSync(p);
|
|
74
|
-
} catch {
|
|
75
|
-
return [];
|
|
76
|
-
}
|
|
77
|
-
names.sort();
|
|
78
|
-
return names.map((name) => path.join(p, name));
|
|
79
|
-
}
|
|
80
|
-
function artefact_roots() {
|
|
81
|
-
const roots = [];
|
|
82
|
-
if (_exists(_roots.LEGACY_SRC)) {
|
|
83
|
-
roots.push(_roots.LEGACY_SRC);
|
|
84
|
-
}
|
|
85
|
-
if (_exists(_roots.PACKAGES)) {
|
|
86
|
-
for (const pkg of _iterdirSorted(_roots.PACKAGES)) {
|
|
87
|
-
const sub = path.join(pkg, ".agent-src.uncondensed");
|
|
88
|
-
if (_isDir(sub)) {
|
|
89
|
-
roots.push(sub);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if (_isDir(_roots.SRC_AGENT)) {
|
|
94
|
-
roots.push(_roots.SRC_AGENT);
|
|
95
|
-
}
|
|
96
|
-
if (_isDir(_roots.SRC_SKILLS) || _isDir(_roots.SRC_RULES)) {
|
|
97
|
-
roots.push(_roots.SRC);
|
|
98
|
-
}
|
|
99
|
-
return roots;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// src/scripts/config/presets.ts
|
|
103
38
|
var _require = createRequire(import.meta.url);
|
|
104
39
|
var PRESET_ID_ENV = "AGENT_CONFIG_PRESET_ID";
|
|
105
40
|
var DEFAULT_PRESET_ID = "balanced";
|
|
@@ -150,7 +85,7 @@ function _load_yaml(p) {
|
|
|
150
85
|
}
|
|
151
86
|
let text;
|
|
152
87
|
try {
|
|
153
|
-
text =
|
|
88
|
+
text = fs.readFileSync(p, "utf-8");
|
|
154
89
|
} catch (exc) {
|
|
155
90
|
logger.warning("preset read failed for %s: %s", p, String(exc));
|
|
156
91
|
return {};
|
|
@@ -168,8 +103,8 @@ function _load_yaml(p) {
|
|
|
168
103
|
return _isPlainDict(data) ? data : {};
|
|
169
104
|
}
|
|
170
105
|
function _preset_file(project_root, preset_id) {
|
|
171
|
-
const legacy =
|
|
172
|
-
if (
|
|
106
|
+
const legacy = path.join(project_root, PRESETS_DIRNAME, `${preset_id}.yml`);
|
|
107
|
+
if (_exists(legacy)) {
|
|
173
108
|
return legacy;
|
|
174
109
|
}
|
|
175
110
|
let roots;
|
|
@@ -179,8 +114,8 @@ function _preset_file(project_root, preset_id) {
|
|
|
179
114
|
return legacy;
|
|
180
115
|
}
|
|
181
116
|
for (const root of roots) {
|
|
182
|
-
const candidate =
|
|
183
|
-
if (
|
|
117
|
+
const candidate = path.join(root, "presets", `${preset_id}.yml`);
|
|
118
|
+
if (_exists(candidate)) {
|
|
184
119
|
return candidate;
|
|
185
120
|
}
|
|
186
121
|
}
|
|
@@ -251,7 +186,7 @@ function resolve_preset(params) {
|
|
|
251
186
|
source = SOURCE_DEFAULT;
|
|
252
187
|
}
|
|
253
188
|
const yaml_path = _preset_file(params.project_root, preset_id);
|
|
254
|
-
if (!
|
|
189
|
+
if (!_exists(yaml_path)) {
|
|
255
190
|
throw new PresetError(
|
|
256
191
|
`preset.id=${_repr(preset_id)} (${source}) but ${yaml_path} not found`
|
|
257
192
|
);
|
|
@@ -313,9 +248,9 @@ function resolve_preset(params) {
|
|
|
313
248
|
overrides
|
|
314
249
|
});
|
|
315
250
|
}
|
|
316
|
-
function
|
|
251
|
+
function _exists(p) {
|
|
317
252
|
try {
|
|
318
|
-
|
|
253
|
+
fs.statSync(p);
|
|
319
254
|
return true;
|
|
320
255
|
} catch {
|
|
321
256
|
return false;
|
|
@@ -367,193 +302,8 @@ function _repr(s) {
|
|
|
367
302
|
return `'${s.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
|
|
368
303
|
}
|
|
369
304
|
|
|
370
|
-
// src/scripts/config/profiles.ts
|
|
371
|
-
import * as fs3 from "node:fs";
|
|
372
|
-
import { createRequire as createRequire2 } from "node:module";
|
|
373
|
-
import * as path3 from "node:path";
|
|
374
|
-
var _require2 = createRequire2(import.meta.url);
|
|
375
|
-
var PROFILE_ID_ENV = "AGENT_CONFIG_PROFILE_ID";
|
|
376
|
-
var DEFAULT_PROFILE_ID = "developer";
|
|
377
|
-
var PROFILES_DIRNAME = ".agent-src.uncondensed/profiles";
|
|
378
|
-
var SOURCE_PACK2 = "pack";
|
|
379
|
-
var SOURCE_USER2 = "user-settings";
|
|
380
|
-
var SOURCE_ENV2 = "env";
|
|
381
|
-
var SOURCE_RUNTIME2 = "runtime";
|
|
382
|
-
var SOURCE_DEFAULT2 = "default";
|
|
383
|
-
var SOURCE_MISSING = "missing";
|
|
384
|
-
var ResolvedProfile = class {
|
|
385
|
-
id;
|
|
386
|
-
audience;
|
|
387
|
-
preset_id;
|
|
388
|
-
packs;
|
|
389
|
-
personas;
|
|
390
|
-
skills_hint;
|
|
391
|
-
commands_hint;
|
|
392
|
-
docs_first_pointer;
|
|
393
|
-
source;
|
|
394
|
-
warning;
|
|
395
|
-
constructor(params) {
|
|
396
|
-
this.id = params.id;
|
|
397
|
-
this.audience = params.audience ?? {};
|
|
398
|
-
this.preset_id = params.preset_id ?? null;
|
|
399
|
-
this.packs = params.packs ?? [];
|
|
400
|
-
this.personas = params.personas ?? [];
|
|
401
|
-
this.skills_hint = params.skills_hint ?? [];
|
|
402
|
-
this.commands_hint = params.commands_hint ?? [];
|
|
403
|
-
this.docs_first_pointer = params.docs_first_pointer ?? null;
|
|
404
|
-
this.source = params.source ?? SOURCE_DEFAULT2;
|
|
405
|
-
this.warning = params.warning ?? null;
|
|
406
|
-
}
|
|
407
|
-
};
|
|
408
|
-
var ProfileError = class extends Error {
|
|
409
|
-
constructor(message) {
|
|
410
|
-
super(message);
|
|
411
|
-
this.name = "ProfileError";
|
|
412
|
-
}
|
|
413
|
-
};
|
|
414
|
-
function _load_yaml2(p) {
|
|
415
|
-
let YAML;
|
|
416
|
-
try {
|
|
417
|
-
YAML = _require2("yaml");
|
|
418
|
-
} catch {
|
|
419
|
-
logger.info("PyYAML unavailable; profile %s returned empty", p);
|
|
420
|
-
return {};
|
|
421
|
-
}
|
|
422
|
-
let text;
|
|
423
|
-
try {
|
|
424
|
-
text = fs3.readFileSync(p, "utf-8");
|
|
425
|
-
} catch (exc) {
|
|
426
|
-
logger.warning("profile read failed for %s: %s", p, String(exc));
|
|
427
|
-
return {};
|
|
428
|
-
}
|
|
429
|
-
let data;
|
|
430
|
-
try {
|
|
431
|
-
data = YAML.parse(text, { version: "1.1" });
|
|
432
|
-
if (data === null || data === void 0) {
|
|
433
|
-
data = {};
|
|
434
|
-
}
|
|
435
|
-
} catch (exc) {
|
|
436
|
-
logger.warning("profile parse failed for %s: %s", p, String(exc));
|
|
437
|
-
return {};
|
|
438
|
-
}
|
|
439
|
-
return _isPlainDict2(data) ? data : {};
|
|
440
|
-
}
|
|
441
|
-
function _profile_file(project_root, profile_id) {
|
|
442
|
-
const legacy = path3.join(project_root, PROFILES_DIRNAME, `${profile_id}.yml`);
|
|
443
|
-
if (_exists3(legacy)) {
|
|
444
|
-
return legacy;
|
|
445
|
-
}
|
|
446
|
-
let roots;
|
|
447
|
-
try {
|
|
448
|
-
roots = artefact_roots();
|
|
449
|
-
} catch {
|
|
450
|
-
return legacy;
|
|
451
|
-
}
|
|
452
|
-
for (const root of roots) {
|
|
453
|
-
const candidate = path3.join(root, "profiles", `${profile_id}.yml`);
|
|
454
|
-
if (_exists3(candidate)) {
|
|
455
|
-
return candidate;
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
return legacy;
|
|
459
|
-
}
|
|
460
|
-
function _build_resolved(profile_id, raw, options) {
|
|
461
|
-
const block = _isPlainDict2(raw["profile"]) ? raw["profile"] : {};
|
|
462
|
-
const audience_raw = _isPlainDict2(block["audience"]) ? block["audience"] : {};
|
|
463
|
-
const defaults = _isPlainDict2(block["defaults"]) ? block["defaults"] : {};
|
|
464
|
-
const surface = _isPlainDict2(block["surface"]) ? block["surface"] : {};
|
|
465
|
-
const audience = {};
|
|
466
|
-
for (const k of Object.keys(audience_raw)) {
|
|
467
|
-
audience[String(k)] = String(audience_raw[k]);
|
|
468
|
-
}
|
|
469
|
-
const packs = _strTuple(block["packs"]);
|
|
470
|
-
const personas = _strTuple(defaults["personas"]);
|
|
471
|
-
const skills_hint = _strTuple(defaults["skills_hint"]);
|
|
472
|
-
const commands_hint = _strTuple(surface["commands_hint"]);
|
|
473
|
-
const docs_pointer = surface["docs_first_pointer"];
|
|
474
|
-
return new ResolvedProfile({
|
|
475
|
-
id: profile_id,
|
|
476
|
-
audience,
|
|
477
|
-
preset_id: defaults["preset_id"] ?? null,
|
|
478
|
-
packs,
|
|
479
|
-
personas,
|
|
480
|
-
skills_hint,
|
|
481
|
-
commands_hint,
|
|
482
|
-
docs_first_pointer: docs_pointer ? String(docs_pointer) : null,
|
|
483
|
-
source: options.source,
|
|
484
|
-
warning: options.warning ?? null
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
function _pick_id2(pack_profile_id, user_settings, runtime_id) {
|
|
488
|
-
if (runtime_id) {
|
|
489
|
-
return [runtime_id, SOURCE_RUNTIME2];
|
|
490
|
-
}
|
|
491
|
-
const env_id = process.env[PROFILE_ID_ENV];
|
|
492
|
-
if (env_id) {
|
|
493
|
-
return [env_id, SOURCE_ENV2];
|
|
494
|
-
}
|
|
495
|
-
const block = _isPlainDict2(user_settings) ? user_settings["profile"] : void 0;
|
|
496
|
-
if (_isPlainDict2(block) && block["id"]) {
|
|
497
|
-
return [String(block["id"]), SOURCE_USER2];
|
|
498
|
-
}
|
|
499
|
-
if (pack_profile_id) {
|
|
500
|
-
return [pack_profile_id, SOURCE_PACK2];
|
|
501
|
-
}
|
|
502
|
-
return [null, SOURCE_MISSING];
|
|
503
|
-
}
|
|
504
|
-
function resolve_profile(params) {
|
|
505
|
-
const settings = params.user_settings ?? {};
|
|
506
|
-
const settings_file = path3.join(params.project_root, DEFAULT_PROJECT_FILE);
|
|
507
|
-
const [profile_id, source] = _pick_id2(
|
|
508
|
-
params.pack_profile_id ?? null,
|
|
509
|
-
settings,
|
|
510
|
-
params.runtime_id ?? null
|
|
511
|
-
);
|
|
512
|
-
if (profile_id === null) {
|
|
513
|
-
if (_exists3(settings_file)) {
|
|
514
|
-
return new ResolvedProfile({
|
|
515
|
-
id: DEFAULT_PROFILE_ID,
|
|
516
|
-
source: SOURCE_MISSING,
|
|
517
|
-
warning: "no profile.id in .agent-settings.yml \u2014 run /onboard to pick an audience deliberately"
|
|
518
|
-
});
|
|
519
|
-
}
|
|
520
|
-
return _build_resolved(
|
|
521
|
-
DEFAULT_PROFILE_ID,
|
|
522
|
-
_load_yaml2(_profile_file(params.project_root, DEFAULT_PROFILE_ID)),
|
|
523
|
-
{ source: SOURCE_DEFAULT2 }
|
|
524
|
-
);
|
|
525
|
-
}
|
|
526
|
-
const yaml_path = _profile_file(params.project_root, profile_id);
|
|
527
|
-
if (!_exists3(yaml_path)) {
|
|
528
|
-
throw new ProfileError(
|
|
529
|
-
`profile.id=${_repr2(profile_id)} (${source}) but ${yaml_path} not found`
|
|
530
|
-
);
|
|
531
|
-
}
|
|
532
|
-
return _build_resolved(profile_id, _load_yaml2(yaml_path), { source });
|
|
533
|
-
}
|
|
534
|
-
function _exists3(p) {
|
|
535
|
-
try {
|
|
536
|
-
fs3.statSync(p);
|
|
537
|
-
return true;
|
|
538
|
-
} catch {
|
|
539
|
-
return false;
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
function _isPlainDict2(value) {
|
|
543
|
-
return typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof Map);
|
|
544
|
-
}
|
|
545
|
-
function _strTuple(value) {
|
|
546
|
-
if (!Array.isArray(value)) {
|
|
547
|
-
return [];
|
|
548
|
-
}
|
|
549
|
-
return value.map((v) => String(v));
|
|
550
|
-
}
|
|
551
|
-
function _repr2(s) {
|
|
552
|
-
return `'${s.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
|
|
553
|
-
}
|
|
554
|
-
|
|
555
305
|
// src/scripts/_cli/explain_last/index.ts
|
|
556
|
-
import * as
|
|
306
|
+
import * as fs6 from "node:fs";
|
|
557
307
|
|
|
558
308
|
// src/scripts/_cli/explain_last/scrubber.ts
|
|
559
309
|
var LONG_STRING_THRESHOLD = 200;
|
|
@@ -709,8 +459,8 @@ function build(state) {
|
|
|
709
459
|
}
|
|
710
460
|
|
|
711
461
|
// src/scripts/_cli/explain_last/council.ts
|
|
712
|
-
import * as
|
|
713
|
-
import * as
|
|
462
|
+
import * as fs2 from "node:fs";
|
|
463
|
+
import * as path2 from "node:path";
|
|
714
464
|
var RUN_WINDOW_SECONDS = 3600;
|
|
715
465
|
function _pySlice200(s) {
|
|
716
466
|
const cps = Array.from(s);
|
|
@@ -721,26 +471,26 @@ function _firstLine(s) {
|
|
|
721
471
|
return m.length > 0 ? m[0] : void 0;
|
|
722
472
|
}
|
|
723
473
|
function _candidate_files(project_root) {
|
|
724
|
-
const sessions_root =
|
|
474
|
+
const sessions_root = path2.join(
|
|
725
475
|
project_root,
|
|
726
476
|
"agents",
|
|
727
477
|
"runtime",
|
|
728
478
|
"council",
|
|
729
479
|
"sessions"
|
|
730
480
|
);
|
|
731
|
-
const tmp_root =
|
|
481
|
+
const tmp_root = path2.join(project_root, "tmp");
|
|
732
482
|
const candidates = [];
|
|
733
|
-
if (
|
|
483
|
+
if (_isDir(sessions_root)) {
|
|
734
484
|
for (const sub of _iterdir(sessions_root)) {
|
|
735
|
-
if (
|
|
736
|
-
const candidate =
|
|
737
|
-
if (
|
|
485
|
+
if (_isDir(sub)) {
|
|
486
|
+
const candidate = path2.join(sub, "council-responses.json");
|
|
487
|
+
if (fs2.existsSync(candidate)) {
|
|
738
488
|
candidates.push(candidate);
|
|
739
489
|
}
|
|
740
490
|
}
|
|
741
491
|
}
|
|
742
492
|
}
|
|
743
|
-
if (
|
|
493
|
+
if (fs2.existsSync(tmp_root)) {
|
|
744
494
|
candidates.push(..._glob(tmp_root, "council-", ".json").sort());
|
|
745
495
|
}
|
|
746
496
|
return candidates;
|
|
@@ -750,7 +500,7 @@ function _pick_recent(candidates, anchor_mtime) {
|
|
|
750
500
|
for (const p of candidates) {
|
|
751
501
|
let mtime;
|
|
752
502
|
try {
|
|
753
|
-
mtime =
|
|
503
|
+
mtime = fs2.statSync(p).mtimeMs / 1e3;
|
|
754
504
|
} catch {
|
|
755
505
|
continue;
|
|
756
506
|
}
|
|
@@ -789,7 +539,7 @@ function _extract_member(entry) {
|
|
|
789
539
|
function build2(project_root, state_file) {
|
|
790
540
|
let anchor;
|
|
791
541
|
try {
|
|
792
|
-
anchor =
|
|
542
|
+
anchor = fs2.statSync(state_file).mtimeMs / 1e3;
|
|
793
543
|
} catch {
|
|
794
544
|
return null;
|
|
795
545
|
}
|
|
@@ -803,7 +553,7 @@ function build2(project_root, state_file) {
|
|
|
803
553
|
}
|
|
804
554
|
let raw;
|
|
805
555
|
try {
|
|
806
|
-
raw = JSON.parse(
|
|
556
|
+
raw = JSON.parse(fs2.readFileSync(picked, "utf-8"));
|
|
807
557
|
} catch {
|
|
808
558
|
return null;
|
|
809
559
|
}
|
|
@@ -822,9 +572,9 @@ function build2(project_root, state_file) {
|
|
|
822
572
|
}
|
|
823
573
|
return members.length > 0 ? members : null;
|
|
824
574
|
}
|
|
825
|
-
function
|
|
575
|
+
function _isDir(p) {
|
|
826
576
|
try {
|
|
827
|
-
return
|
|
577
|
+
return fs2.statSync(p).isDirectory();
|
|
828
578
|
} catch {
|
|
829
579
|
return false;
|
|
830
580
|
}
|
|
@@ -832,20 +582,20 @@ function _isDir2(p) {
|
|
|
832
582
|
function _iterdir(p) {
|
|
833
583
|
let names;
|
|
834
584
|
try {
|
|
835
|
-
names =
|
|
585
|
+
names = fs2.readdirSync(p);
|
|
836
586
|
} catch {
|
|
837
587
|
return [];
|
|
838
588
|
}
|
|
839
|
-
return names.map((n) =>
|
|
589
|
+
return names.map((n) => path2.join(p, n));
|
|
840
590
|
}
|
|
841
591
|
function _glob(dir, prefix, suffix) {
|
|
842
592
|
let names;
|
|
843
593
|
try {
|
|
844
|
-
names =
|
|
594
|
+
names = fs2.readdirSync(dir);
|
|
845
595
|
} catch {
|
|
846
596
|
return [];
|
|
847
597
|
}
|
|
848
|
-
return names.filter((n) => n.startsWith(prefix) && n.endsWith(suffix)).map((n) =>
|
|
598
|
+
return names.filter((n) => n.startsWith(prefix) && n.endsWith(suffix)).map((n) => path2.join(dir, n));
|
|
849
599
|
}
|
|
850
600
|
function _pyTruthy2(value) {
|
|
851
601
|
if (value === null || value === void 0) {
|
|
@@ -923,10 +673,10 @@ function build3(state) {
|
|
|
923
673
|
}
|
|
924
674
|
|
|
925
675
|
// src/scripts/_cli/explain_last/inputs.ts
|
|
926
|
-
import { createRequire as
|
|
927
|
-
import * as
|
|
928
|
-
import * as
|
|
929
|
-
var
|
|
676
|
+
import { createRequire as createRequire2 } from "node:module";
|
|
677
|
+
import * as fs3 from "node:fs";
|
|
678
|
+
import * as path3 from "node:path";
|
|
679
|
+
var _require2 = createRequire2(import.meta.url);
|
|
930
680
|
var _DEFAULT_RULE_LOADING_TIER = "balanced";
|
|
931
681
|
var _SILENCED_LOGGERS = [
|
|
932
682
|
"scripts.config.profiles",
|
|
@@ -938,8 +688,8 @@ function _silence_resolver_warnings(body) {
|
|
|
938
688
|
return body();
|
|
939
689
|
}
|
|
940
690
|
function _load_settings(project_root) {
|
|
941
|
-
const p =
|
|
942
|
-
if (!
|
|
691
|
+
const p = path3.join(project_root, DEFAULT_PROJECT_FILE);
|
|
692
|
+
if (!fs3.existsSync(p)) {
|
|
943
693
|
return {};
|
|
944
694
|
}
|
|
945
695
|
return load_agent_settings({ project_path: p }) ?? {};
|
|
@@ -1018,10 +768,10 @@ function build4(project_root) {
|
|
|
1018
768
|
}
|
|
1019
769
|
function _pack_marker(project_root) {
|
|
1020
770
|
for (const candidate of [
|
|
1021
|
-
|
|
1022
|
-
|
|
771
|
+
path3.join(project_root, ".agent-pack.yml"),
|
|
772
|
+
path3.join(project_root, ".agent-src.uncondensed", ".agent-pack.yml")
|
|
1023
773
|
]) {
|
|
1024
|
-
if (
|
|
774
|
+
if (fs3.existsSync(candidate)) {
|
|
1025
775
|
return candidate;
|
|
1026
776
|
}
|
|
1027
777
|
}
|
|
@@ -1034,13 +784,13 @@ function build_pack(project_root) {
|
|
|
1034
784
|
}
|
|
1035
785
|
let YAML;
|
|
1036
786
|
try {
|
|
1037
|
-
YAML =
|
|
787
|
+
YAML = _require2("yaml");
|
|
1038
788
|
} catch {
|
|
1039
789
|
return null;
|
|
1040
790
|
}
|
|
1041
791
|
let raw;
|
|
1042
792
|
try {
|
|
1043
|
-
const text =
|
|
793
|
+
const text = fs3.readFileSync(marker, "utf-8");
|
|
1044
794
|
raw = YAML.parse(text, { version: "1.1" });
|
|
1045
795
|
if (raw === null || raw === void 0) {
|
|
1046
796
|
raw = {};
|
|
@@ -1056,7 +806,7 @@ function build_pack(project_root) {
|
|
|
1056
806
|
if (typeof pack_id !== "string" || pack_id.trim() === "") {
|
|
1057
807
|
return null;
|
|
1058
808
|
}
|
|
1059
|
-
const reasonRaw = _pyTruthy4(rawDict.reason) ? rawDict.reason : `declared in ${
|
|
809
|
+
const reasonRaw = _pyTruthy4(rawDict.reason) ? rawDict.reason : `declared in ${path3.basename(marker)}`;
|
|
1060
810
|
return {
|
|
1061
811
|
id: scrub_string(pack_id.trim()),
|
|
1062
812
|
reason: scrub_string(String(reasonRaw))
|
|
@@ -1067,15 +817,15 @@ function _isOsError(exc) {
|
|
|
1067
817
|
}
|
|
1068
818
|
|
|
1069
819
|
// src/scripts/_cli/explain_last/memory.ts
|
|
1070
|
-
import * as
|
|
1071
|
-
import * as
|
|
820
|
+
import * as fs4 from "node:fs";
|
|
821
|
+
import * as path4 from "node:path";
|
|
1072
822
|
var PyFloat = class {
|
|
1073
823
|
constructor(value) {
|
|
1074
824
|
this.value = value;
|
|
1075
825
|
}
|
|
1076
826
|
value;
|
|
1077
827
|
};
|
|
1078
|
-
var MEMORY_SIDECAR =
|
|
828
|
+
var MEMORY_SIDECAR = path4.join(".agent-memory", "hits.jsonl");
|
|
1079
829
|
function _pyTruthy5(value) {
|
|
1080
830
|
if (value === null || value === void 0) {
|
|
1081
831
|
return false;
|
|
@@ -1197,14 +947,14 @@ function _splitlines(s) {
|
|
|
1197
947
|
return out;
|
|
1198
948
|
}
|
|
1199
949
|
function _from_sidecar(project_root, run_id) {
|
|
1200
|
-
const p =
|
|
1201
|
-
if (!
|
|
950
|
+
const p = path4.join(project_root, MEMORY_SIDECAR);
|
|
951
|
+
if (!fs4.existsSync(p)) {
|
|
1202
952
|
return [];
|
|
1203
953
|
}
|
|
1204
954
|
const entries = [];
|
|
1205
955
|
let content;
|
|
1206
956
|
try {
|
|
1207
|
-
content =
|
|
957
|
+
content = fs4.readFileSync(p, "utf-8");
|
|
1208
958
|
} catch {
|
|
1209
959
|
return [];
|
|
1210
960
|
}
|
|
@@ -1312,17 +1062,17 @@ function build6(state) {
|
|
|
1312
1062
|
}
|
|
1313
1063
|
|
|
1314
1064
|
// src/scripts/_cli/explain_last/route.ts
|
|
1315
|
-
import * as
|
|
1316
|
-
import * as
|
|
1065
|
+
import * as fs5 from "node:fs";
|
|
1066
|
+
import * as path5 from "node:path";
|
|
1317
1067
|
var ROUTER_FILENAME = "router.json";
|
|
1318
|
-
var ROUTER_RELATIVE =
|
|
1068
|
+
var ROUTER_RELATIVE = path5.join("dist", ROUTER_FILENAME);
|
|
1319
1069
|
function _load_router(project_root) {
|
|
1320
|
-
const p =
|
|
1321
|
-
if (!
|
|
1070
|
+
const p = path5.join(project_root, ROUTER_RELATIVE);
|
|
1071
|
+
if (!fs5.existsSync(p)) {
|
|
1322
1072
|
return null;
|
|
1323
1073
|
}
|
|
1324
1074
|
try {
|
|
1325
|
-
const parsed = JSON.parse(
|
|
1075
|
+
const parsed = JSON.parse(fs5.readFileSync(p, "utf-8"));
|
|
1326
1076
|
return parsed;
|
|
1327
1077
|
} catch {
|
|
1328
1078
|
return null;
|
|
@@ -1425,7 +1175,7 @@ function _derive_run_id(state, state_file) {
|
|
|
1425
1175
|
}
|
|
1426
1176
|
let mtime = 0;
|
|
1427
1177
|
try {
|
|
1428
|
-
mtime =
|
|
1178
|
+
mtime = fs6.statSync(state_file).mtimeMs / 1e3;
|
|
1429
1179
|
} catch {
|
|
1430
1180
|
mtime = 0;
|
|
1431
1181
|
}
|
|
@@ -1972,8 +1722,8 @@ ${TIP_FOOTER}`;
|
|
|
1972
1722
|
|
|
1973
1723
|
// src/scripts/_cli/cmd_explain.ts
|
|
1974
1724
|
var ROUTER_FILENAME2 = "router.json";
|
|
1975
|
-
var ROUTER_RELATIVE2 =
|
|
1976
|
-
var
|
|
1725
|
+
var ROUTER_RELATIVE2 = path6.join("dist", ROUTER_FILENAME2);
|
|
1726
|
+
var _HERE = fileURLToPath(import.meta.url);
|
|
1977
1727
|
var ArgparseExit = class extends Error {
|
|
1978
1728
|
constructor(code) {
|
|
1979
1729
|
super(`argparse-exit-${code}`);
|
|
@@ -2082,9 +1832,9 @@ function _dumpJson(payload) {
|
|
|
2082
1832
|
process2.stdout.write(_jsonDumpsIndentSortedAscii(payload));
|
|
2083
1833
|
process2.stdout.write("\n");
|
|
2084
1834
|
}
|
|
2085
|
-
function
|
|
1835
|
+
function _exists2(p) {
|
|
2086
1836
|
try {
|
|
2087
|
-
|
|
1837
|
+
fs7.statSync(p);
|
|
2088
1838
|
return true;
|
|
2089
1839
|
} catch {
|
|
2090
1840
|
return false;
|
|
@@ -2109,19 +1859,19 @@ function _resolve_root(arg) {
|
|
|
2109
1859
|
}
|
|
2110
1860
|
}
|
|
2111
1861
|
function _load_user_settings(project_root) {
|
|
2112
|
-
const p =
|
|
2113
|
-
if (!
|
|
1862
|
+
const p = path6.join(project_root, DEFAULT_PROJECT_FILE);
|
|
1863
|
+
if (!_exists2(p)) {
|
|
2114
1864
|
return {};
|
|
2115
1865
|
}
|
|
2116
1866
|
return load_agent_settings({ project_path: p }) || {};
|
|
2117
1867
|
}
|
|
2118
1868
|
function _load_router2(project_root) {
|
|
2119
|
-
const p =
|
|
2120
|
-
if (!
|
|
1869
|
+
const p = path6.join(project_root, ROUTER_RELATIVE2);
|
|
1870
|
+
if (!_exists2(p)) {
|
|
2121
1871
|
return {};
|
|
2122
1872
|
}
|
|
2123
1873
|
try {
|
|
2124
|
-
return JSON.parse(
|
|
1874
|
+
return JSON.parse(fs7.readFileSync(p, { encoding: "utf-8" }));
|
|
2125
1875
|
} catch (exc) {
|
|
2126
1876
|
eprint(`\u274C explain: cannot read ${p}: ${osErrorStr(exc)}`);
|
|
2127
1877
|
throw new SystemExitError(2);
|
|
@@ -2338,7 +2088,7 @@ function _explain_last(project_root, state_file, as_json, quiet) {
|
|
|
2338
2088
|
print("explain last disabled by settings (explain.enable_last)");
|
|
2339
2089
|
return 0;
|
|
2340
2090
|
}
|
|
2341
|
-
const target_state = state_file ||
|
|
2091
|
+
const target_state = state_file || path6.join(project_root, ".work-state.json");
|
|
2342
2092
|
let trace;
|
|
2343
2093
|
try {
|
|
2344
2094
|
trace = build_trace(project_root, target_state);
|
|
@@ -2349,7 +2099,7 @@ function _explain_last(project_root, state_file, as_json, quiet) {
|
|
|
2349
2099
|
if (relativeTo !== null) {
|
|
2350
2100
|
rel = relativeTo;
|
|
2351
2101
|
} else {
|
|
2352
|
-
rel =
|
|
2102
|
+
rel = path6.basename(target_state);
|
|
2353
2103
|
}
|
|
2354
2104
|
const msg = exc.message.split(target_state).join(rel);
|
|
2355
2105
|
eprint(`\u274C explain last: ${msg}`);
|
|
@@ -2365,9 +2115,9 @@ function _explain_last(project_root, state_file, as_json, quiet) {
|
|
|
2365
2115
|
return 0;
|
|
2366
2116
|
}
|
|
2367
2117
|
function relativeToOrNull(p, base) {
|
|
2368
|
-
const rel =
|
|
2118
|
+
const rel = path6.relative(base, p);
|
|
2369
2119
|
if (rel === "") return rel;
|
|
2370
|
-
if (rel.startsWith("..") ||
|
|
2120
|
+
if (rel.startsWith("..") || path6.isAbsolute(rel)) {
|
|
2371
2121
|
return null;
|
|
2372
2122
|
}
|
|
2373
2123
|
return rel;
|
|
@@ -2534,19 +2284,19 @@ function _isCliEntry() {
|
|
|
2534
2284
|
if (process2.argv[1] === void 0) {
|
|
2535
2285
|
return false;
|
|
2536
2286
|
}
|
|
2537
|
-
const argvUrl = pathToFileURL(
|
|
2287
|
+
const argvUrl = pathToFileURL(path6.resolve(process2.argv[1])).href;
|
|
2538
2288
|
if (import.meta.url === argvUrl) {
|
|
2539
2289
|
return true;
|
|
2540
2290
|
}
|
|
2541
2291
|
try {
|
|
2542
|
-
const here =
|
|
2543
|
-
const argv =
|
|
2292
|
+
const here = fs7.realpathSync(fileURLToPath(import.meta.url));
|
|
2293
|
+
const argv = fs7.realpathSync(path6.resolve(process2.argv[1]));
|
|
2544
2294
|
return here === argv;
|
|
2545
2295
|
} catch {
|
|
2546
2296
|
return false;
|
|
2547
2297
|
}
|
|
2548
2298
|
}
|
|
2549
|
-
if (_isCliEntry() || process2.argv[1] ===
|
|
2299
|
+
if (_isCliEntry() || process2.argv[1] === _HERE) {
|
|
2550
2300
|
try {
|
|
2551
2301
|
process2.exitCode = main(process2.argv.slice(2));
|
|
2552
2302
|
} catch (e) {
|