@event4u/agent-config 9.27.0 → 9.28.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 +12 -11
- package/CHANGELOG.md +99 -0
- package/README.md +1 -1
- package/dist/agent-src/commands/analyze/conformance.md +24 -0
- package/dist/agent-src/contexts/execution/orchestration-telemetry.md +10 -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 +29 -5
- 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/strategy-safety-floor.md +1 -1
- package/dist/agent-src/rules/token-budget-discipline.md +3 -1
- 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/performance-analysis/SKILL.md +1 -1
- package/dist/agent-src/skills/persona-improvement/SKILL.md +1 -1
- package/dist/agent-src/skills/project-analyzer/SKILL.md +1 -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/universal-project-analysis/SKILL.md +1 -1
- package/dist/agent-src/templates/AGENTS.md +6 -10
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/cli/registry.js +7 -0
- package/dist/cli/registry.js.map +1 -1
- package/dist/cli-delegate/chunk-22GCIJ2O.js +270 -0
- package/dist/cli-delegate/{chunk-BCPIOAGV.js → chunk-2BE5I2MN.js} +8 -8
- package/dist/cli-delegate/{chunk-AIIUU73N.js → chunk-7OMQCH4V.js} +1 -1
- package/dist/cli-delegate/{chunk-HJ6DAJHR.js → chunk-GB2FSUEE.js} +57 -7
- package/dist/cli-delegate/{chunk-WR6GTRHJ.js → chunk-JXARCGVN.js} +3 -3
- package/dist/cli-delegate/{chunk-3KJIMFTB.js → chunk-PQSAQKHW.js} +466 -304
- 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 +7 -7
- package/dist/cli-delegate/cmd_converge.js +3 -3
- package/dist/cli-delegate/cmd_doctor.js +4 -4
- package/dist/cli-delegate/cmd_explain.js +80 -330
- package/dist/cli-delegate/cmd_export.js +5 -5
- package/dist/cli-delegate/cmd_fleet.js +3 -3
- package/dist/cli-delegate/cmd_handoff.js +2 -2
- 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 +5 -5
- 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 +272 -0
- package/dist/cli-delegate/cmd_settings_migrate.js +5 -5
- package/dist/cli-delegate/cmd_settings_set.js +7 -2967
- package/dist/cli-delegate/cmd_sync.js +5 -5
- package/dist/cli-delegate/cmd_uninstall.js +5 -5
- 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 +5 -5
- package/dist/cli-delegate/cmd_versions.js +4 -4
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +100 -40
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +3 -3
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +7 -5
- package/dist/discovery/trust-report.md +11 -11
- package/dist/discovery/workspaces.json +6 -4
- package/dist/hooks/dispatch.js +9004 -6132
- package/dist/install/install.mjs +697 -507
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +127 -20
- package/dist/router.json +1 -1
- package/dist/scripts/_lib/agent_settings.js +80 -15
- package/dist/scripts/_lib/agent_settings.js.map +1 -1
- package/docs/contracts/settings-classes.md +29 -8
- package/docs/guidelines/agent-infra/memory-access.md +14 -3
- package/package.json +1 -1
- package/src/agent-src/templates/AGENTS.md +6 -10
- package/src/config/budgets.yml +29 -0
- package/src/config/evaluator-budgets.json +4 -4
- package/src/config/gate-coverage.yml +26 -0
- package/src/scripts/_cli/cmd_brand_status.ts +174 -0
- 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 +82 -16
- package/src/scripts/_lib/carrier_divergence.ts +135 -0
- package/src/scripts/_lib/host_capability.ts +84 -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 +342 -0
- package/src/scripts/_lib/self_repair_store.ts +100 -0
- package/src/scripts/_lib/transcript_entry.ts +80 -0
- package/src/scripts/check_branch_freshness.ts +255 -0
- package/src/scripts/check_council_config_location.ts +125 -1
- package/src/scripts/check_standing_rule_delivery.ts +314 -0
- 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 +126 -7
- 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 +450 -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/measure_scope_dedup.ts +19 -13
- package/src/scripts/onboarding_gate_hook.ts +40 -1
- package/src/scripts/orchestration_record.ts +4 -1
- package/src/scripts/preamble_byte_census.ts +9 -20
- 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 +77 -6
- package/src/scripts/self_repair_cli.ts +240 -0
- package/src/scripts/self_repair_hook.ts +241 -0
|
@@ -9,20 +9,20 @@ import {
|
|
|
9
9
|
KIRO_MARKER,
|
|
10
10
|
ROOCODE_MARKER,
|
|
11
11
|
ZED_MARKER
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-PQSAQKHW.js";
|
|
13
13
|
import "./chunk-DVRS2KVR.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-JXARCGVN.js";
|
|
15
15
|
import "./chunk-BKO2AZ7Z.js";
|
|
16
16
|
import "./chunk-63WSP6YZ.js";
|
|
17
17
|
import "./chunk-GRRPEPRN.js";
|
|
18
18
|
import "./chunk-NXFWFAYV.js";
|
|
19
|
+
import "./chunk-GB2FSUEE.js";
|
|
20
|
+
import "./chunk-NDJLNC6Q.js";
|
|
19
21
|
import "./chunk-523HCFYO.js";
|
|
22
|
+
import "./chunk-OY53J6II.js";
|
|
20
23
|
import {
|
|
21
24
|
resolvePackageRoot
|
|
22
25
|
} from "./chunk-MCJYCQPF.js";
|
|
23
|
-
import "./chunk-HJ6DAJHR.js";
|
|
24
|
-
import "./chunk-NDJLNC6Q.js";
|
|
25
|
-
import "./chunk-OY53J6II.js";
|
|
26
26
|
import "./chunk-J55WI3RR.js";
|
|
27
27
|
|
|
28
28
|
// src/scripts/_cli/cmd_export.ts
|
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
} from "./chunk-HYWSRNUX.js";
|
|
6
6
|
import "./chunk-OMIVVCG2.js";
|
|
7
7
|
import "./chunk-523HCFYO.js";
|
|
8
|
-
import {
|
|
9
|
-
resolvePackageRoot
|
|
10
|
-
} from "./chunk-MCJYCQPF.js";
|
|
11
8
|
import {
|
|
12
9
|
require_dist
|
|
13
10
|
} from "./chunk-OY53J6II.js";
|
|
11
|
+
import {
|
|
12
|
+
resolvePackageRoot
|
|
13
|
+
} from "./chunk-MCJYCQPF.js";
|
|
14
14
|
import {
|
|
15
15
|
__toESM
|
|
16
16
|
} from "./chunk-J55WI3RR.js";
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
list_sessions,
|
|
6
6
|
readHookStdin,
|
|
7
7
|
read_entries
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-7OMQCH4V.js";
|
|
9
9
|
import "./chunk-3EWYC3YK.js";
|
|
10
10
|
import {
|
|
11
11
|
_RAW_KEY_PREFIXES,
|
|
12
12
|
hardenedSpawnEnv
|
|
13
13
|
} from "./chunk-VSYT7OHO.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-GB2FSUEE.js";
|
|
15
15
|
import "./chunk-NDJLNC6Q.js";
|
|
16
16
|
import "./chunk-OY53J6II.js";
|
|
17
17
|
import "./chunk-J55WI3RR.js";
|
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
resolve_project_root
|
|
4
|
+
} from "./chunk-GB2FSUEE.js";
|
|
5
|
+
import "./chunk-NDJLNC6Q.js";
|
|
6
|
+
import "./chunk-J55WI3RR.js";
|
|
7
|
+
|
|
8
|
+
// src/scripts/_cli/cmd_mcp_available.ts
|
|
9
|
+
import * as fs2 from "node:fs";
|
|
10
|
+
import * as path2 from "node:path";
|
|
11
|
+
import process2 from "node:process";
|
|
12
|
+
import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "node:url";
|
|
13
|
+
|
|
14
|
+
// src/scripts/tool_registry.ts
|
|
15
|
+
import * as path from "node:path";
|
|
16
|
+
import * as fs from "node:fs";
|
|
17
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
18
|
+
var TOOL_REGISTRY = {
|
|
19
|
+
github: {
|
|
20
|
+
name: "github",
|
|
21
|
+
description: "GitHub API \u2014 PRs, issues, files, commits",
|
|
22
|
+
supported_actions: /* @__PURE__ */ new Set([
|
|
23
|
+
"read_pr",
|
|
24
|
+
"read_issue",
|
|
25
|
+
"create_pr",
|
|
26
|
+
"list_files",
|
|
27
|
+
"read_commit"
|
|
28
|
+
]),
|
|
29
|
+
default_mode: "read-only",
|
|
30
|
+
requires_auth: true
|
|
31
|
+
},
|
|
32
|
+
jira: {
|
|
33
|
+
name: "jira",
|
|
34
|
+
description: "Jira API \u2014 tickets, search, comments",
|
|
35
|
+
supported_actions: /* @__PURE__ */ new Set([
|
|
36
|
+
"read_ticket",
|
|
37
|
+
"search_tickets",
|
|
38
|
+
"add_comment",
|
|
39
|
+
"transition_ticket"
|
|
40
|
+
]),
|
|
41
|
+
default_mode: "read-only",
|
|
42
|
+
requires_auth: true
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
function get_tool(name) {
|
|
46
|
+
return TOOL_REGISTRY[name] ?? null;
|
|
47
|
+
}
|
|
48
|
+
function list_tools() {
|
|
49
|
+
return Object.values(TOOL_REGISTRY);
|
|
50
|
+
}
|
|
51
|
+
function validate_tool_declarations(allowed_tools, tool_permissions) {
|
|
52
|
+
const errors = [];
|
|
53
|
+
const warnings = [];
|
|
54
|
+
for (const tool_name of allowed_tools) {
|
|
55
|
+
const tool_def = get_tool(tool_name);
|
|
56
|
+
if (tool_def === null) {
|
|
57
|
+
errors.push(`Tool '${tool_name}' is not registered in the tool registry`);
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (tool_permissions && tool_name in tool_permissions) {
|
|
61
|
+
const perms = tool_permissions[tool_name];
|
|
62
|
+
const actions = perms?.actions ?? [];
|
|
63
|
+
for (const action of actions) {
|
|
64
|
+
if (!tool_def.supported_actions.has(action)) {
|
|
65
|
+
errors.push(`Tool '${tool_name}' does not support action '${action}'`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (tool_permissions) {
|
|
71
|
+
for (const tool_name of Object.keys(tool_permissions)) {
|
|
72
|
+
if (!allowed_tools.includes(tool_name)) {
|
|
73
|
+
warnings.push(`Tool '${tool_name}' has permissions but is not in allowed_tools`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
valid: errors.length === 0,
|
|
79
|
+
errors,
|
|
80
|
+
warnings
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function _jsonDumpsIndent2(obj) {
|
|
84
|
+
const pad = " ";
|
|
85
|
+
function enc(value, depth) {
|
|
86
|
+
if (value === null) {
|
|
87
|
+
return "null";
|
|
88
|
+
}
|
|
89
|
+
if (typeof value === "boolean") {
|
|
90
|
+
return value ? "true" : "false";
|
|
91
|
+
}
|
|
92
|
+
if (typeof value === "number") {
|
|
93
|
+
return String(value);
|
|
94
|
+
}
|
|
95
|
+
if (typeof value === "string") {
|
|
96
|
+
return encStr(value);
|
|
97
|
+
}
|
|
98
|
+
if (Array.isArray(value)) {
|
|
99
|
+
if (value.length === 0) {
|
|
100
|
+
return "[]";
|
|
101
|
+
}
|
|
102
|
+
const inner2 = value.map((v) => pad.repeat(depth + 1) + enc(v, depth + 1));
|
|
103
|
+
return "[\n" + inner2.join(",\n") + "\n" + pad.repeat(depth) + "]";
|
|
104
|
+
}
|
|
105
|
+
const o = value;
|
|
106
|
+
const keys = Object.keys(o);
|
|
107
|
+
if (keys.length === 0) {
|
|
108
|
+
return "{}";
|
|
109
|
+
}
|
|
110
|
+
const inner = keys.map(
|
|
111
|
+
(k) => pad.repeat(depth + 1) + encStr(k) + ": " + enc(o[k], depth + 1)
|
|
112
|
+
);
|
|
113
|
+
return "{\n" + inner.join(",\n") + "\n" + pad.repeat(depth) + "}";
|
|
114
|
+
}
|
|
115
|
+
function encStr(s) {
|
|
116
|
+
let out = '"';
|
|
117
|
+
for (const ch of s) {
|
|
118
|
+
const cp = ch.codePointAt(0);
|
|
119
|
+
if (ch === '"') out += '\\"';
|
|
120
|
+
else if (ch === "\\") out += "\\\\";
|
|
121
|
+
else if (ch === "\n") out += "\\n";
|
|
122
|
+
else if (ch === "\r") out += "\\r";
|
|
123
|
+
else if (ch === " ") out += "\\t";
|
|
124
|
+
else if (ch === "\b") out += "\\b";
|
|
125
|
+
else if (ch === "\f") out += "\\f";
|
|
126
|
+
else if (cp < 32) out += "\\u" + cp.toString(16).padStart(4, "0");
|
|
127
|
+
else if (cp < 127) out += ch;
|
|
128
|
+
else if (cp > 65535) {
|
|
129
|
+
const v = cp - 65536;
|
|
130
|
+
const hi = 55296 + (v >> 10);
|
|
131
|
+
const lo = 56320 + (v & 1023);
|
|
132
|
+
out += "\\u" + hi.toString(16).padStart(4, "0");
|
|
133
|
+
out += "\\u" + lo.toString(16).padStart(4, "0");
|
|
134
|
+
} else {
|
|
135
|
+
out += "\\u" + cp.toString(16).padStart(4, "0");
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return out + '"';
|
|
139
|
+
}
|
|
140
|
+
return enc(obj, 0);
|
|
141
|
+
}
|
|
142
|
+
function _sorted(values) {
|
|
143
|
+
return [...values].sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
144
|
+
}
|
|
145
|
+
function parse_args(argv) {
|
|
146
|
+
let format = "text";
|
|
147
|
+
let validate_tools = null;
|
|
148
|
+
let i = 0;
|
|
149
|
+
while (i < argv.length) {
|
|
150
|
+
const arg = argv[i];
|
|
151
|
+
if (arg === "--format") {
|
|
152
|
+
const value = argv[i + 1];
|
|
153
|
+
if (value === void 0) {
|
|
154
|
+
_argError("argument --format: expected one argument");
|
|
155
|
+
}
|
|
156
|
+
if (value !== "text" && value !== "json") {
|
|
157
|
+
_argError(
|
|
158
|
+
`argument --format: invalid choice: '${value}' (choose from 'text', 'json')`
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
format = value;
|
|
162
|
+
i += 2;
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
if (arg.startsWith("--format=")) {
|
|
166
|
+
const value = arg.slice("--format=".length);
|
|
167
|
+
if (value !== "text" && value !== "json") {
|
|
168
|
+
_argError(
|
|
169
|
+
`argument --format: invalid choice: '${value}' (choose from 'text', 'json')`
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
format = value;
|
|
173
|
+
i += 1;
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
if (arg === "--validate-tools") {
|
|
177
|
+
validate_tools = [];
|
|
178
|
+
i += 1;
|
|
179
|
+
while (i < argv.length && !argv[i].startsWith("-")) {
|
|
180
|
+
validate_tools.push(argv[i]);
|
|
181
|
+
i += 1;
|
|
182
|
+
}
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
_argError(`unrecognized arguments: ${arg}`);
|
|
186
|
+
}
|
|
187
|
+
return { format, validate_tools };
|
|
188
|
+
}
|
|
189
|
+
function _argError(message) {
|
|
190
|
+
process.stderr.write(
|
|
191
|
+
`usage: tool_registry [-h] [--format {text,json}] [--validate-tools [VALIDATE_TOOLS ...]]
|
|
192
|
+
`
|
|
193
|
+
);
|
|
194
|
+
process.stderr.write(`tool_registry: error: ${message}
|
|
195
|
+
`);
|
|
196
|
+
process.exit(2);
|
|
197
|
+
}
|
|
198
|
+
function main(argv = process.argv.slice(2)) {
|
|
199
|
+
const args = parse_args(argv);
|
|
200
|
+
if (args.validate_tools !== null) {
|
|
201
|
+
const result = validate_tool_declarations(args.validate_tools);
|
|
202
|
+
if (args.format === "json") {
|
|
203
|
+
process.stdout.write(
|
|
204
|
+
_jsonDumpsIndent2({
|
|
205
|
+
valid: result.valid,
|
|
206
|
+
errors: result.errors,
|
|
207
|
+
warnings: result.warnings
|
|
208
|
+
}) + "\n"
|
|
209
|
+
);
|
|
210
|
+
} else {
|
|
211
|
+
if (result.valid) {
|
|
212
|
+
process.stdout.write(
|
|
213
|
+
`\u2705 All ${args.validate_tools.length} tool declarations are valid
|
|
214
|
+
`
|
|
215
|
+
);
|
|
216
|
+
} else {
|
|
217
|
+
for (const e of result.errors) {
|
|
218
|
+
process.stdout.write(`\u274C ${e}
|
|
219
|
+
`);
|
|
220
|
+
}
|
|
221
|
+
for (const w of result.warnings) {
|
|
222
|
+
process.stdout.write(`\u26A0\uFE0F ${w}
|
|
223
|
+
`);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return result.valid ? 0 : 1;
|
|
228
|
+
}
|
|
229
|
+
const tools = list_tools();
|
|
230
|
+
if (args.format === "json") {
|
|
231
|
+
process.stdout.write(
|
|
232
|
+
_jsonDumpsIndent2(
|
|
233
|
+
tools.map((t) => ({
|
|
234
|
+
name: t.name,
|
|
235
|
+
description: t.description,
|
|
236
|
+
actions: _sorted(t.supported_actions),
|
|
237
|
+
default_mode: t.default_mode,
|
|
238
|
+
requires_auth: t.requires_auth
|
|
239
|
+
}))
|
|
240
|
+
) + "\n"
|
|
241
|
+
);
|
|
242
|
+
} else {
|
|
243
|
+
process.stdout.write(`Registered tools: ${tools.length}
|
|
244
|
+
|
|
245
|
+
`);
|
|
246
|
+
for (const t of tools) {
|
|
247
|
+
const actions = _sorted(t.supported_actions).join(", ");
|
|
248
|
+
process.stdout.write(` ${t.name} (${t.default_mode})
|
|
249
|
+
`);
|
|
250
|
+
process.stdout.write(` ${t.description}
|
|
251
|
+
`);
|
|
252
|
+
process.stdout.write(` Actions: ${actions}
|
|
253
|
+
`);
|
|
254
|
+
process.stdout.write(`
|
|
255
|
+
`);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return 0;
|
|
259
|
+
}
|
|
260
|
+
var _HERE = fileURLToPath(import.meta.url);
|
|
261
|
+
function _isCliEntry() {
|
|
262
|
+
if (process.argv[1] === void 0) {
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
const argvUrl = pathToFileURL(path.resolve(process.argv[1])).href;
|
|
266
|
+
if (import.meta.url === argvUrl) {
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
269
|
+
try {
|
|
270
|
+
const here = fs.realpathSync(fileURLToPath(import.meta.url));
|
|
271
|
+
const argv = fs.realpathSync(path.resolve(process.argv[1]));
|
|
272
|
+
return here === argv;
|
|
273
|
+
} catch {
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
if (_isCliEntry() || process.argv[1] === _HERE) {
|
|
278
|
+
process.exit(main());
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// src/scripts/_cli/cmd_mcp_available.ts
|
|
282
|
+
function resolveOnPath(command, pathEnv, cwd) {
|
|
283
|
+
if (command === "") return null;
|
|
284
|
+
const candidates = command.includes(path2.sep) ? [path2.resolve(cwd, command)] : pathEnv.split(path2.delimiter).filter((p) => p !== "").map((dir) => path2.join(dir, command));
|
|
285
|
+
for (const candidate of candidates) {
|
|
286
|
+
try {
|
|
287
|
+
const stat = fs2.statSync(candidate);
|
|
288
|
+
if (stat.isFile() && (stat.mode & 73) !== 0) return candidate;
|
|
289
|
+
} catch {
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
295
|
+
function classifyServer(name, entry, pathEnv, cwd) {
|
|
296
|
+
if (typeof entry.command === "string" && entry.command !== "") {
|
|
297
|
+
const resolved = resolveOnPath(entry.command, pathEnv, cwd);
|
|
298
|
+
return {
|
|
299
|
+
name,
|
|
300
|
+
transport: "command",
|
|
301
|
+
target: entry.command,
|
|
302
|
+
launch: resolved === null ? "not-on-path" : "launchable",
|
|
303
|
+
resolved
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
if (typeof entry.url === "string" && entry.url !== "") {
|
|
307
|
+
return { name, transport: "url", target: entry.url, launch: "not-probed", resolved: null };
|
|
308
|
+
}
|
|
309
|
+
return { name, transport: "unknown", target: null, launch: "not-probed", resolved: null };
|
|
310
|
+
}
|
|
311
|
+
function runMcpAvailable(opts) {
|
|
312
|
+
const out = [];
|
|
313
|
+
const err = [];
|
|
314
|
+
const [projectRoot] = resolve_project_root(null, { cwd: opts.cwd });
|
|
315
|
+
const configPath = path2.join(projectRoot, "mcp.json");
|
|
316
|
+
let declared = [];
|
|
317
|
+
let configExists = true;
|
|
318
|
+
let rawText;
|
|
319
|
+
try {
|
|
320
|
+
rawText = fs2.readFileSync(configPath, "utf-8");
|
|
321
|
+
} catch {
|
|
322
|
+
configExists = false;
|
|
323
|
+
rawText = "";
|
|
324
|
+
}
|
|
325
|
+
if (configExists) {
|
|
326
|
+
let parsed;
|
|
327
|
+
try {
|
|
328
|
+
parsed = JSON.parse(rawText);
|
|
329
|
+
} catch (exc) {
|
|
330
|
+
err.push(
|
|
331
|
+
`\u274C mcp:available \u2014 ${configPath} exists but is not valid JSON.`,
|
|
332
|
+
` ${exc instanceof Error ? exc.message : String(exc)}`,
|
|
333
|
+
' Refusing to report "no servers": an unparseable declaration file is a',
|
|
334
|
+
" failure to answer, not an answer."
|
|
335
|
+
);
|
|
336
|
+
return { code: 1, out, err };
|
|
337
|
+
}
|
|
338
|
+
const servers = typeof parsed === "object" && parsed !== null ? parsed.servers ?? {} : {};
|
|
339
|
+
if (typeof servers === "object" && servers !== null && !Array.isArray(servers)) {
|
|
340
|
+
declared = Object.keys(servers).sort().map(
|
|
341
|
+
(name) => classifyServer(
|
|
342
|
+
name,
|
|
343
|
+
servers[name] ?? {},
|
|
344
|
+
opts.pathEnv,
|
|
345
|
+
projectRoot
|
|
346
|
+
)
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
const registryTools = list_tools().map((t) => t.name).sort();
|
|
351
|
+
if (opts.json) {
|
|
352
|
+
out.push(
|
|
353
|
+
JSON.stringify(
|
|
354
|
+
{
|
|
355
|
+
config: configExists ? configPath : null,
|
|
356
|
+
declared_servers: declared,
|
|
357
|
+
tool_registry: registryTools,
|
|
358
|
+
handshake_performed: false
|
|
359
|
+
},
|
|
360
|
+
null,
|
|
361
|
+
2
|
|
362
|
+
)
|
|
363
|
+
);
|
|
364
|
+
return { code: 0, out, err };
|
|
365
|
+
}
|
|
366
|
+
out.push(`declared servers ${configExists ? configPath : "\u2014 no mcp.json in this project"}`);
|
|
367
|
+
if (declared.length === 0) {
|
|
368
|
+
out.push(" none");
|
|
369
|
+
}
|
|
370
|
+
for (const s of declared) {
|
|
371
|
+
const state = s.launch === "launchable" ? `launchable \u2014 ${s.resolved ?? ""}` : s.launch === "not-on-path" ? `NOT on PATH \u2014 \`${s.target ?? ""}\` does not resolve to an executable` : s.transport === "url" ? "remote \u2014 declared, deliberately not probed" : "malformed entry \u2014 declares neither command nor url";
|
|
372
|
+
out.push(` ${s.name} ${state}`);
|
|
373
|
+
}
|
|
374
|
+
out.push("");
|
|
375
|
+
out.push("tool registry static allowlist for skill `allowed_tools` \u2014 NOT MCP, not probed");
|
|
376
|
+
out.push(` ${registryTools.length > 0 ? registryTools.join(", ") : "none"}`);
|
|
377
|
+
out.push("");
|
|
378
|
+
out.push('\u26A0\uFE0F No MCP handshake was performed. "launchable" means the command resolves to an');
|
|
379
|
+
out.push(' executable on PATH \u2014 strictly weaker than "the server responds". Any list of');
|
|
380
|
+
out.push(" TOOLS a server exposes can only come from a live session, never from here.");
|
|
381
|
+
return { code: 0, out, err };
|
|
382
|
+
}
|
|
383
|
+
function parseArgv(argv) {
|
|
384
|
+
let json = false;
|
|
385
|
+
for (const a of argv) {
|
|
386
|
+
if (a === "--json") {
|
|
387
|
+
json = true;
|
|
388
|
+
} else if (a === "-h" || a === "--help") {
|
|
389
|
+
return { ok: false, message: "usage: agent-config mcp:available [--json]" };
|
|
390
|
+
} else {
|
|
391
|
+
return { ok: false, message: `unknown argument: ${a}` };
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return { ok: true, json };
|
|
395
|
+
}
|
|
396
|
+
function main2(argv = process2.argv.slice(2)) {
|
|
397
|
+
const parsed = parseArgv(argv);
|
|
398
|
+
if (!parsed.ok) {
|
|
399
|
+
process2.stderr.write(`${parsed.message ?? "usage error"}
|
|
400
|
+
`);
|
|
401
|
+
return 2;
|
|
402
|
+
}
|
|
403
|
+
const result = runMcpAvailable({
|
|
404
|
+
cwd: process2.cwd(),
|
|
405
|
+
json: parsed.json === true,
|
|
406
|
+
pathEnv: process2.env["PATH"] ?? ""
|
|
407
|
+
});
|
|
408
|
+
for (const line of result.out) process2.stdout.write(`${line}
|
|
409
|
+
`);
|
|
410
|
+
for (const line of result.err) process2.stderr.write(`${line}
|
|
411
|
+
`);
|
|
412
|
+
return result.code;
|
|
413
|
+
}
|
|
414
|
+
function _isCliEntry2() {
|
|
415
|
+
if (process2.argv[1] === void 0) return false;
|
|
416
|
+
const argvUrl = pathToFileURL2(path2.resolve(process2.argv[1])).href;
|
|
417
|
+
if (import.meta.url === argvUrl) return true;
|
|
418
|
+
try {
|
|
419
|
+
return fs2.realpathSync(fileURLToPath2(import.meta.url)) === fs2.realpathSync(path2.resolve(process2.argv[1]));
|
|
420
|
+
} catch {
|
|
421
|
+
return false;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
if (_isCliEntry2()) {
|
|
425
|
+
process2.exitCode = main2();
|
|
426
|
+
}
|
|
427
|
+
export {
|
|
428
|
+
classifyServer,
|
|
429
|
+
main2 as main,
|
|
430
|
+
parseArgv,
|
|
431
|
+
resolveOnPath,
|
|
432
|
+
runMcpAvailable
|
|
433
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
main
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-HJ6DAJHR.js";
|
|
4
|
+
} from "./chunk-JXARCGVN.js";
|
|
5
|
+
import "./chunk-GB2FSUEE.js";
|
|
7
6
|
import "./chunk-NDJLNC6Q.js";
|
|
7
|
+
import "./chunk-MCJYCQPF.js";
|
|
8
8
|
import "./chunk-J55WI3RR.js";
|
|
9
9
|
export {
|
|
10
10
|
main
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
ProfileError,
|
|
4
|
+
SOURCE_MISSING,
|
|
5
|
+
profile_file,
|
|
6
|
+
resolve_profile
|
|
7
|
+
} from "./chunk-22GCIJ2O.js";
|
|
8
|
+
import {
|
|
9
|
+
DEFAULT_PROJECT_FILE,
|
|
10
|
+
load_agent_settings,
|
|
11
|
+
resolve_project_root
|
|
12
|
+
} from "./chunk-GB2FSUEE.js";
|
|
13
|
+
import "./chunk-NDJLNC6Q.js";
|
|
14
|
+
import "./chunk-J55WI3RR.js";
|
|
15
|
+
|
|
16
|
+
// src/scripts/_cli/cmd_packs_active.ts
|
|
17
|
+
import * as fs from "node:fs";
|
|
18
|
+
import * as path from "node:path";
|
|
19
|
+
import process from "node:process";
|
|
20
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
21
|
+
var SOURCE_GLOSS = {
|
|
22
|
+
runtime: "set for this run (runtime override)",
|
|
23
|
+
env: "AGENT_CONFIG_PROFILE_ID environment variable",
|
|
24
|
+
"user-settings": `profile.id in ${DEFAULT_PROJECT_FILE}`,
|
|
25
|
+
pack: "declared by an installed pack",
|
|
26
|
+
default: "no settings file \u2014 package default",
|
|
27
|
+
[SOURCE_MISSING]: `settings file present but it declares no profile.id`
|
|
28
|
+
};
|
|
29
|
+
function profileFileFor(projectRoot, profile) {
|
|
30
|
+
if (profile.source === SOURCE_MISSING) return null;
|
|
31
|
+
const resolved = profile_file(projectRoot, profile.id);
|
|
32
|
+
return _isFile(resolved) ? resolved : null;
|
|
33
|
+
}
|
|
34
|
+
function _isFile(p) {
|
|
35
|
+
try {
|
|
36
|
+
return fs.statSync(p).isFile();
|
|
37
|
+
} catch {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function runPacksActive(opts) {
|
|
42
|
+
const out = [];
|
|
43
|
+
const err = [];
|
|
44
|
+
const [projectRoot] = resolve_project_root(null, { cwd: opts.cwd });
|
|
45
|
+
const settings = load_agent_settings({ cwd: opts.cwd });
|
|
46
|
+
let profile;
|
|
47
|
+
try {
|
|
48
|
+
profile = resolve_profile({ project_root: projectRoot, user_settings: settings });
|
|
49
|
+
} catch (exc) {
|
|
50
|
+
if (exc instanceof ProfileError) {
|
|
51
|
+
err.push(
|
|
52
|
+
`\u274C packs:active \u2014 ${exc.message}`,
|
|
53
|
+
" The profile id resolves but its file does not exist, so no pack set can be",
|
|
54
|
+
" named. This is a broken install or a hand-edited profile.id, not an empty one."
|
|
55
|
+
);
|
|
56
|
+
return { code: 1, out, err };
|
|
57
|
+
}
|
|
58
|
+
throw exc;
|
|
59
|
+
}
|
|
60
|
+
const degraded = profile.source === SOURCE_MISSING;
|
|
61
|
+
const file = profileFileFor(projectRoot, profile);
|
|
62
|
+
const gloss = SOURCE_GLOSS[profile.source] ?? profile.source;
|
|
63
|
+
if (opts.json) {
|
|
64
|
+
out.push(
|
|
65
|
+
JSON.stringify(
|
|
66
|
+
{
|
|
67
|
+
profile_id: profile.id,
|
|
68
|
+
source: profile.source,
|
|
69
|
+
degraded,
|
|
70
|
+
packs: [...profile.packs],
|
|
71
|
+
personas: [...profile.personas],
|
|
72
|
+
profile_file: file,
|
|
73
|
+
project_root: projectRoot
|
|
74
|
+
},
|
|
75
|
+
null,
|
|
76
|
+
2
|
|
77
|
+
)
|
|
78
|
+
);
|
|
79
|
+
return { code: 0, out, err };
|
|
80
|
+
}
|
|
81
|
+
out.push(`profile ${profile.id} (${gloss})`);
|
|
82
|
+
out.push(
|
|
83
|
+
profile.packs.length > 0 ? `packs ${profile.packs.join(", ")} (${String(profile.packs.length)})` : "packs none"
|
|
84
|
+
);
|
|
85
|
+
out.push(`file ${file ?? "\u2014 the profile body was never loaded"}`);
|
|
86
|
+
out.push(`root ${projectRoot}`);
|
|
87
|
+
if (degraded) {
|
|
88
|
+
out.push(
|
|
89
|
+
"",
|
|
90
|
+
"\u26A0\uFE0F Degraded resolution \u2014 this is the answer, not a warning about it.",
|
|
91
|
+
` A ${DEFAULT_PROJECT_FILE} exists here but declares no profile.id, so the id fell`,
|
|
92
|
+
" back to the package default while the profile BODY was never read: zero packs,",
|
|
93
|
+
' zero personas. Any rule that says "auto-activates when pack X is installed"',
|
|
94
|
+
" cannot activate in this project, and nothing else reports that.",
|
|
95
|
+
" Fix: set profile.id in the settings file, or run `agent-config use <id>`."
|
|
96
|
+
);
|
|
97
|
+
} else if (profile.packs.length === 0) {
|
|
98
|
+
out.push(
|
|
99
|
+
"",
|
|
100
|
+
`\u2139\uFE0F The ${profile.id} profile declares no packs. Pack-gated rules stay inert here.`
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
if (profile.warning !== null && !degraded) {
|
|
104
|
+
out.push("", `\u26A0\uFE0F ${profile.warning}`);
|
|
105
|
+
}
|
|
106
|
+
return { code: 0, out, err };
|
|
107
|
+
}
|
|
108
|
+
function parseArgv(argv) {
|
|
109
|
+
let json = false;
|
|
110
|
+
for (const a of argv) {
|
|
111
|
+
if (a === "--json") {
|
|
112
|
+
json = true;
|
|
113
|
+
} else if (a === "-h" || a === "--help") {
|
|
114
|
+
return { ok: false, message: "usage: agent-config packs:active [--json]" };
|
|
115
|
+
} else {
|
|
116
|
+
return { ok: false, message: `unknown argument: ${a}` };
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return { ok: true, json };
|
|
120
|
+
}
|
|
121
|
+
function main(argv = process.argv.slice(2)) {
|
|
122
|
+
const parsed = parseArgv(argv);
|
|
123
|
+
if (!parsed.ok) {
|
|
124
|
+
process.stderr.write(`${parsed.message ?? "usage error"}
|
|
125
|
+
`);
|
|
126
|
+
return 2;
|
|
127
|
+
}
|
|
128
|
+
const result = runPacksActive({ cwd: process.cwd(), json: parsed.json === true });
|
|
129
|
+
for (const line of result.out) process.stdout.write(`${line}
|
|
130
|
+
`);
|
|
131
|
+
for (const line of result.err) process.stderr.write(`${line}
|
|
132
|
+
`);
|
|
133
|
+
return result.code;
|
|
134
|
+
}
|
|
135
|
+
function _isCliEntry() {
|
|
136
|
+
if (process.argv[1] === void 0) return false;
|
|
137
|
+
const argvUrl = pathToFileURL(path.resolve(process.argv[1])).href;
|
|
138
|
+
if (import.meta.url === argvUrl) return true;
|
|
139
|
+
try {
|
|
140
|
+
return fs.realpathSync(fileURLToPath(import.meta.url)) === fs.realpathSync(path.resolve(process.argv[1]));
|
|
141
|
+
} catch {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (_isCliEntry()) {
|
|
146
|
+
process.exitCode = main();
|
|
147
|
+
}
|
|
148
|
+
export {
|
|
149
|
+
main,
|
|
150
|
+
parseArgv,
|
|
151
|
+
profileFileFor,
|
|
152
|
+
runPacksActive
|
|
153
|
+
};
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
} from "./chunk-HYWSRNUX.js";
|
|
11
11
|
import "./chunk-OMIVVCG2.js";
|
|
12
12
|
import "./chunk-523HCFYO.js";
|
|
13
|
+
import "./chunk-OY53J6II.js";
|
|
13
14
|
import {
|
|
14
15
|
resolvePackageRoot
|
|
15
16
|
} from "./chunk-MCJYCQPF.js";
|
|
16
|
-
import "./chunk-OY53J6II.js";
|
|
17
17
|
import "./chunk-J55WI3RR.js";
|
|
18
18
|
|
|
19
19
|
// src/scripts/_cli/cmd_preflight.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
PROJECT_BRIDGE_MARKERS
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-PQSAQKHW.js";
|
|
5
5
|
import "./chunk-DVRS2KVR.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-JXARCGVN.js";
|
|
7
7
|
import "./chunk-BKO2AZ7Z.js";
|
|
8
8
|
import {
|
|
9
9
|
manifest_path,
|
|
@@ -11,13 +11,13 @@ import {
|
|
|
11
11
|
} from "./chunk-63WSP6YZ.js";
|
|
12
12
|
import "./chunk-GRRPEPRN.js";
|
|
13
13
|
import "./chunk-NXFWFAYV.js";
|
|
14
|
-
import "./chunk-523HCFYO.js";
|
|
15
|
-
import "./chunk-MCJYCQPF.js";
|
|
16
14
|
import {
|
|
17
15
|
resolve_project_root
|
|
18
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-GB2FSUEE.js";
|
|
19
17
|
import "./chunk-NDJLNC6Q.js";
|
|
18
|
+
import "./chunk-523HCFYO.js";
|
|
20
19
|
import "./chunk-OY53J6II.js";
|
|
20
|
+
import "./chunk-MCJYCQPF.js";
|
|
21
21
|
import "./chunk-J55WI3RR.js";
|
|
22
22
|
|
|
23
23
|
// src/scripts/_cli/cmd_prune.ts
|