@iowarp/clio-coder 0.3.7 → 0.3.8
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/CHANGELOG.md +31 -0
- package/README.md +7 -2
- package/dist/{acp-SK4MD6MM.js → acp-U67UHUK2.js} +13 -13
- package/dist/{agents-2FN2K6ME.js → agents-YU6SGALZ.js} +35 -33
- package/dist/assets/codewiki.json +1 -1
- package/dist/{auth-QIYZWM5I.js → auth-5ZPJOIVG.js} +32 -24
- package/dist/builtins-C6JMZVV6.js +17 -0
- package/dist/{chunk-YD734TPH.js → chunk-26LEYJZH.js} +2 -2
- package/dist/{chunk-TSHXZTOQ.js → chunk-2HEJ2F35.js} +5 -5
- package/dist/{chunk-WJHBC77E.js → chunk-2HFZQUHL.js} +5 -5
- package/dist/{chunk-FO5ZOVUY.js → chunk-3BINW3FP.js} +5 -5
- package/dist/{chunk-EOOQZZDE.js → chunk-4SPRNWDE.js} +18 -18
- package/dist/{chunk-EBEFWSGL.js → chunk-5DHKRSMQ.js} +7 -7
- package/dist/{chunk-OBMAI2DP.js → chunk-5H3GB5BO.js} +11 -9
- package/dist/{chunk-JTSEDYVQ.js → chunk-5Q2VVUKB.js} +7 -7
- package/dist/{chunk-VQNODYQ4.js → chunk-7RFXX52T.js} +294 -3704
- package/dist/{chunk-XEGB6BCN.js → chunk-7RGZWPB6.js} +5 -5
- package/dist/{chunk-GH5622CP.js → chunk-A2NJGIB3.js} +2 -2
- package/dist/{chunk-CEYBNUGC.js → chunk-A3WNZD3P.js} +323 -27
- package/dist/{chunk-D4MDIG46.js → chunk-B5CSFE7B.js} +7 -7
- package/dist/{chunk-2SFS6XQE.js → chunk-DGSYXYMX.js} +3 -2
- package/dist/{chunk-ZWLZP4ZT.js → chunk-DYIM5TJT.js} +98 -12
- package/dist/{chunk-KCMKRQX4.js → chunk-E77JEWSD.js} +42 -49
- package/dist/{chunk-J7PIKKWC.js → chunk-EMYUUSFG.js} +7 -7
- package/dist/{chunk-JRIO5UD2.js → chunk-EQ63NRB7.js} +5 -5
- package/dist/{chunk-UVDSQ6LW.js → chunk-FBVTI2TJ.js} +74 -28
- package/dist/{chunk-BMWK7ZIZ.js → chunk-FHJEP5SW.js} +13 -13
- package/dist/{chunk-FOT2FX5J.js → chunk-GN57SG4G.js} +7 -7
- package/dist/{chunk-SROCI7ZU.js → chunk-GPIEI3LY.js} +5 -5
- package/dist/{chunk-UFQ3F4FW.js → chunk-GU2UIAFZ.js} +4 -4
- package/dist/{chunk-UND3GU2L.js → chunk-H7IXIC72.js} +2 -2
- package/dist/{chunk-VREKEFLL.js → chunk-HLE42MG7.js} +3 -3
- package/dist/{chunk-465YSENW.js → chunk-IFBNV6H6.js} +3 -3
- package/dist/{chunk-LADCF22A.js → chunk-IGWKHNIQ.js} +113 -54
- package/dist/chunk-IIZWH4XA.js +172 -0
- package/dist/{chunk-UHXRNZ2J.js → chunk-IJ7RPIYJ.js} +4 -4
- package/dist/{chunk-M4AKACEO.js → chunk-J3YUBZWY.js} +2 -2
- package/dist/{chunk-AB4XIIVB.js → chunk-JOZYP4GM.js} +6 -6
- package/dist/{chunk-ZGH7FGS5.js → chunk-K4XHGFR5.js} +742 -12
- package/dist/{chunk-EELBMBT6.js → chunk-KTYTFRMB.js} +62 -5
- package/dist/chunk-LU7P4LHA.js +33 -0
- package/dist/{chunk-DQA7QLMD.js → chunk-ME6CCNFO.js} +9 -24
- package/dist/{chunk-KZ2H5X4G.js → chunk-MXKJU4JB.js} +88 -14
- package/dist/{chunk-DMD2AGVS.js → chunk-N22QMJKY.js} +20 -18
- package/dist/chunk-NMPKI6XL.js +3006 -0
- package/dist/chunk-NUGM5KR6.js +165 -0
- package/dist/{chunk-5C77SEEY.js → chunk-P43ETTHK.js} +2 -2
- package/dist/{chunk-JNXPYBB4.js → chunk-PMDBGQSJ.js} +2 -2
- package/dist/chunk-PT7HYKEM.js +165 -0
- package/dist/{chunk-GEYXPTRF.js → chunk-RWSI4YD7.js} +2 -2
- package/dist/{chunk-C4JBQ5SR.js → chunk-TANS5ZJS.js} +6 -6
- package/dist/{chunk-YTYFXUI3.js → chunk-TB5666IT.js} +9 -9
- package/dist/{chunk-UUANF5CR.js → chunk-TLQJPP24.js} +375 -687
- package/dist/{chunk-OB5HIGJY.js → chunk-TT36MB5S.js} +2 -1
- package/dist/{chunk-DJNLUABN.js → chunk-TTHACPOM.js} +135 -17
- package/dist/{chunk-6M7VS3J3.js → chunk-TYPGUK6W.js} +4 -4
- package/dist/{chunk-THKY7CD7.js → chunk-U6MBIEMB.js} +108 -24
- package/dist/{chunk-PD3MESLB.js → chunk-VAWNZU7Z.js} +4 -4
- package/dist/{chunk-IR4CFBFN.js → chunk-VCBR6CU7.js} +12 -12
- package/dist/{chunk-WHJYKASB.js → chunk-VHN4MY6O.js} +2 -2
- package/dist/{chunk-MXI6J5JF.js → chunk-VWZOAB7K.js} +10 -10
- package/dist/{chunk-QCTRSGHQ.js → chunk-WLFILSD5.js} +36 -36
- package/dist/{chunk-5UJ6ECTS.js → chunk-WNIJTQQK.js} +6 -6
- package/dist/{chunk-4DWFMQDR.js → chunk-WSB3FPX7.js} +68 -20
- package/dist/{chunk-3HAPLH5M.js → chunk-WWCZ5F23.js} +112 -10
- package/dist/{chunk-X2KV5FXT.js → chunk-WXY7KU3G.js} +2 -2
- package/dist/{chunk-PPAMZ32Z.js → chunk-XK56QHLX.js} +6 -1
- package/dist/{chunk-DOOEX22V.js → chunk-XWSF374K.js} +4 -4
- package/dist/{chunk-6TUKSZVF.js → chunk-YS5VLNH5.js} +8 -8
- package/dist/{chunk-ZZMN5OM4.js → chunk-ZNLWCMVZ.js} +2 -2
- package/dist/{chunk-WHGPSPT5.js → chunk-ZVJ5BLO2.js} +2 -2
- package/dist/cli/index.js +31 -31
- package/dist/{clio-WBVQEBKO.js → clio-QVTYJ57A.js} +8 -8
- package/dist/code-nav-FGGFIE7L.js +2 -2
- package/dist/codewiki/build-worker.js +4 -4
- package/dist/{components-F7OEATSO.js → components-ZFA3SAER.js} +8 -8
- package/dist/{config-TRBL3RCF.js → config-LW5IJFQN.js} +58 -53
- package/dist/{configure-OLCVPHNM.js → configure-7XIZCOU4.js} +26 -21
- package/dist/{context-XEWE3MOJ.js → context-L3WL3X7K.js} +47 -41
- package/dist/{context-WFPKQSM6.js → context-N52ZA626.js} +22 -22
- package/dist/{context-MJIJ6GOX.js → context-Y6Y7QPR6.js} +12 -12
- package/dist/{context-clear-KNOS2JPB.js → context-clear-MBQRLSDQ.js} +47 -41
- package/dist/{context-index-SSR5ECNE.js → context-index-HVMFQHK3.js} +5 -5
- package/dist/{context-working-set-EUXAZI6N.js → context-working-set-GS6DSO7F.js} +14 -14
- package/dist/{dispatch-runner-B7MTOVKL.js → dispatch-runner-22ZCNOM3.js} +83 -55
- package/dist/{docs-FLJTIDSE.js → docs-7LQ23DLM.js} +8 -8
- package/dist/{doctor-RN4YKO2X.js → doctor-M7YEDGAE.js} +24 -20
- package/dist/{eval-RUBJVSNQ.js → eval-BEC2WHDA.js} +71 -19
- package/dist/{evidence-JZNBUOQZ.js → evidence-REJUMSKM.js} +62 -56
- package/dist/{evolve-FJVC4KKI.js → evolve-PY5ZBA5K.js} +41 -35
- package/dist/{extensions-IQL36S7K.js → extensions-HVKU65YU.js} +6 -6
- package/dist/{fleet-BDKYJFCP.js → fleet-7WZEWRFA.js} +72 -67
- package/dist/{fleet-commands-ZFIWZSB3.js → fleet-commands-UVHWM76J.js} +10 -10
- package/dist/{fleet-graph-Y6HPXIVF.js → fleet-graph-6ULH7PES.js} +13 -13
- package/dist/{fleet-preflight-BHSNPBMH.js → fleet-preflight-J53T6CCE.js} +5 -5
- package/dist/{fleet-validate-BIYREGIK.js → fleet-validate-72PC4SLA.js} +17 -17
- package/dist/{init-LQUB5COQ.js → init-OG3TPGQG.js} +61 -56
- package/dist/{library-NJAHIGG4.js → library-CNTMPLRF.js} +18 -18
- package/dist/{memory-OG6HOYKM.js → memory-6IS7F275.js} +43 -37
- package/dist/{models-5ZG5XY7J.js → models-ENRJDA5W.js} +33 -28
- package/dist/{monitor-TJ7AMTGB.js → monitor-XLDVO7TN.js} +56 -38
- package/dist/{orchestrator-WZYB54DM.js → orchestrator-6KSPYRHA.js} +421 -303
- package/dist/{paths-XUC7GS6E.js → paths-DBXMZMDU.js} +5 -5
- package/dist/registry-LG64LTF4.js +11 -0
- package/dist/{reset-PXQT45IY.js → reset-RZ4ER727.js} +10 -10
- package/dist/{run-FQ74YF62.js → run-Y2CNK5RU.js} +79 -74
- package/dist/{share-FW7SVCL3.js → share-A55GYP6Z.js} +16 -16
- package/dist/{skills-7E7IRB3R.js → skills-ALC5J6AT.js} +19 -19
- package/dist/{skills-eval-LI75W6OK.js → skills-eval-JPBEBYQU.js} +52 -47
- package/dist/support-MIETYA5E.js +38 -0
- package/dist/{targets-4CIFKCTW.js → targets-VGNXIR3S.js} +42 -33
- package/dist/{terminal-lease-WUZY7ZV5.js → terminal-lease-WOBR64YA.js} +3 -3
- package/dist/{uninstall-7FV7IP4E.js → uninstall-ZJF5H5ZN.js} +8 -8
- package/dist/{upgrade-K2HVIVMQ.js → upgrade-FUSUAGHR.js} +27 -25
- package/dist/{usage-GTZELZQX.js → usage-N4MKVHKD.js} +51 -46
- package/dist/{verifiers-RLAHT27O.js → verifiers-YAWOJ3H2.js} +13 -13
- package/dist/{verify-BX3BRKH5.js → verify-LTDHYBGY.js} +9 -9
- package/dist/{wiki-generate-ASIFASCN.js → wiki-generate-6M7GHTBJ.js} +66 -61
- package/dist/worker/entry.js +68 -61
- package/docs/alcf-provider.md +1 -1
- package/docs/architecture.md +1 -1
- package/docs/artifact-versions.md +6 -5
- package/docs/built-in-agents.md +1 -1
- package/docs/commands-and-modes.md +2 -2
- package/docs/configuration-and-targets.md +8 -3
- package/docs/context-engine.md +1 -1
- package/docs/documentation-guide.md +1 -1
- package/docs/eval-runner.md +1 -1
- package/docs/evals-internal.md +1 -1
- package/docs/evidence-and-memory.md +70 -6
- package/docs/evolution.md +1 -1
- package/docs/extensions-and-sharing.md +1 -1
- package/docs/fleet-dispatch.md +34 -9
- package/docs/glossary.md +21 -1
- package/docs/installation-and-lifecycle.md +1 -1
- package/docs/middleware-and-components.md +1 -1
- package/docs/model-catalog.md +1 -1
- package/docs/observability.md +2 -2
- package/docs/proactive-memory.md +1 -1
- package/docs/prompt-envelope-and-tools.md +4 -2
- package/docs/provider-adapter-cookbook.md +1 -1
- package/docs/release-cut-checklist.md +41 -38
- package/docs/safety-model.md +1 -1
- package/docs/scientific-validation.md +1 -1
- package/docs/skills-marketplace.md +1 -1
- package/docs/tool-usage.md +1 -1
- package/docs/trace-store.md +1 -1
- package/docs/tui-design.md +1 -1
- package/docs/worker-dispatch-mechanics.md +1 -1
- package/package.json +1 -2
- package/src/cli/argv.ts +5 -0
- package/src/cli/configure.ts +107 -23
- package/src/cli/doctor.ts +5 -1
- package/src/cli/evidence.ts +30 -25
- package/src/cli/fleet-preflight.ts +2 -12
- package/src/cli/shared.ts +1 -0
- package/src/cli/targets.ts +4 -1
- package/src/cli/validate-model.ts +60 -5
- package/src/core/bus-events.ts +25 -0
- package/src/core/commit-attribution.ts +4 -4
- package/src/core/path-boundary.ts +100 -0
- package/src/domains/agents/extension.ts +2 -11
- package/src/domains/agents/fleet-contract.ts +30 -12
- package/src/domains/agents/recipe.ts +7 -1
- package/src/domains/agents/registry.ts +73 -5
- package/src/domains/agents/result-contract.ts +128 -17
- package/src/domains/agents/write-boundary.ts +15 -50
- package/src/domains/context/project-rules.ts +51 -1
- package/src/domains/dispatch/assignment-reconcile.ts +22 -5
- package/src/domains/dispatch/assignment-store.ts +151 -14
- package/src/domains/dispatch/contract.ts +15 -1
- package/src/domains/dispatch/delegation-plan.ts +2 -5
- package/src/domains/dispatch/execution-role.ts +9 -1
- package/src/domains/dispatch/extension.ts +156 -67
- package/src/domains/dispatch/fleet-run.ts +57 -3
- package/src/domains/dispatch/gate-role-prompts.ts +38 -0
- package/src/domains/dispatch/index.ts +3 -1
- package/src/domains/dispatch/intent-requirements.ts +40 -0
- package/src/domains/dispatch/intent.ts +84 -8
- package/src/domains/dispatch/path-scope.ts +370 -0
- package/src/domains/dispatch/receipt-integrity.ts +2 -1
- package/src/domains/dispatch/types.ts +14 -7
- package/src/domains/dispatch/validation.ts +6 -3
- package/src/domains/dispatch/write-boundary-enforcer.ts +45 -0
- package/src/domains/dispatch/write-boundary.ts +201 -22
- package/src/domains/eval/metrics/evidence.ts +79 -2
- package/src/domains/eval/runners/clio-run.ts +12 -2
- package/src/domains/evidence/build.ts +69 -11
- package/src/domains/evidence/index.ts +21 -0
- package/src/domains/evidence/provenance.ts +46 -11
- package/src/domains/evidence/trust-projection.ts +274 -0
- package/src/domains/evidence/trust-status.ts +145 -17
- package/src/domains/evidence/types.ts +4 -0
- package/src/domains/extensions/discovery.ts +88 -1
- package/src/domains/extensions/resources.ts +20 -8
- package/src/domains/extensions/state.ts +6 -2
- package/src/domains/extensions/types.ts +4 -1
- package/src/domains/lifecycle/doctor.ts +140 -1
- package/src/domains/prompts/contract.ts +3 -5
- package/src/domains/providers/extension.ts +30 -2
- package/src/domains/resources/common-loader.ts +3 -0
- package/src/domains/resources/prompts/loader.ts +119 -14
- package/src/domains/safety/policy-engine.ts +5 -5
- package/src/domains/safety/run-effects.ts +64 -1
- package/src/domains/safety/scope.ts +7 -12
- package/src/engine/acp/server.ts +4 -1
- package/src/engine/prompt-templates.ts +18 -1
- package/src/engine/worker-runtime.ts +6 -3
- package/src/interactive/dispatch-board.ts +53 -3
- package/src/interactive/interactive-event-projection.ts +14 -0
- package/src/interactive/overlays/settings.ts +141 -47
- package/src/interactive/slash-commands.ts +7 -2
- package/src/interactive/view/artifacts.ts +42 -9
- package/src/interactive/view/view-overlay.ts +15 -3
- package/src/interactive/worker-receipts.ts +14 -2
- package/src/interactive/worker-stream.ts +8 -0
- package/src/tools/dispatch-admission.ts +12 -13
- package/src/tools/dispatch-arguments.ts +27 -0
- package/src/tools/dispatch-plan.ts +29 -0
- package/src/tools/dispatch-runner.ts +48 -13
- package/src/tools/monitor.ts +13 -0
- package/src/tools/worker-evidence.ts +19 -13
- package/src/worker/spec-contract.ts +2 -1
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
// src/domains/extensions/discovery.ts
|
|
17
17
|
init_esm_shims();
|
|
18
18
|
var import_yaml = __toESM(require_dist(), 1);
|
|
19
|
-
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
19
|
+
import { existsSync, lstatSync, readdirSync, readFileSync, realpathSync, statSync } from "node:fs";
|
|
20
20
|
import path from "node:path";
|
|
21
21
|
var MANIFEST_NAMES = ["clio-coder-extension.yaml", "clio-coder-extension.yml", "clio-coder-extension.json"];
|
|
22
22
|
function isRecord(value) {
|
|
@@ -44,12 +44,85 @@ function normalizeResources(value) {
|
|
|
44
44
|
const out = {};
|
|
45
45
|
const skills = trimString(value.skills);
|
|
46
46
|
const prompts = trimString(value.prompts);
|
|
47
|
+
const agents = trimString(value.agents);
|
|
48
|
+
const fleets = trimString(value.fleets);
|
|
47
49
|
const themes = trimString(value.themes);
|
|
48
50
|
if (skills) out.skills = skills;
|
|
49
51
|
if (prompts) out.prompts = prompts;
|
|
52
|
+
if (agents) out.agents = agents;
|
|
53
|
+
if (fleets) out.fleets = fleets;
|
|
50
54
|
if (themes) out.themes = themes;
|
|
51
55
|
return out;
|
|
52
56
|
}
|
|
57
|
+
function contained(root, candidate) {
|
|
58
|
+
const relative = path.relative(root, candidate);
|
|
59
|
+
return relative === "" || !relative.startsWith(`..${path.sep}`) && relative !== ".." && !path.isAbsolute(relative);
|
|
60
|
+
}
|
|
61
|
+
function validateResourceTree(root, resourcePath, kind, diagnostics) {
|
|
62
|
+
if (path.isAbsolute(resourcePath)) {
|
|
63
|
+
diagnostics.push({ type: "error", message: `resources.${kind} must be relative`, path: resourcePath });
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const resolvedRoot = path.resolve(root);
|
|
67
|
+
const resolved = path.resolve(resolvedRoot, resourcePath);
|
|
68
|
+
if (!contained(resolvedRoot, resolved) || resolved === resolvedRoot) {
|
|
69
|
+
diagnostics.push({ type: "error", message: `resources.${kind} escapes the extension root`, path: resourcePath });
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
let canonicalRoot;
|
|
73
|
+
let canonicalResource;
|
|
74
|
+
try {
|
|
75
|
+
canonicalRoot = realpathSync(resolvedRoot);
|
|
76
|
+
canonicalResource = realpathSync(resolved);
|
|
77
|
+
if (!lstatSync(resolved).isDirectory()) {
|
|
78
|
+
diagnostics.push({ type: "error", message: `resources.${kind} is not a directory`, path: resolved });
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
} catch (error) {
|
|
82
|
+
diagnostics.push({
|
|
83
|
+
type: "error",
|
|
84
|
+
message: `resources.${kind} cannot be resolved: ${error instanceof Error ? error.message : String(error)}`,
|
|
85
|
+
path: resolved
|
|
86
|
+
});
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (!contained(canonicalRoot, canonicalResource)) {
|
|
90
|
+
diagnostics.push({ type: "error", message: `resources.${kind} escapes through a symbolic link`, path: resolved });
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const pending = [resolved];
|
|
94
|
+
while (pending.length > 0) {
|
|
95
|
+
const directory = pending.pop();
|
|
96
|
+
if (!directory) continue;
|
|
97
|
+
for (const entry of readdirSync(directory, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
98
|
+
const candidate = path.join(directory, entry.name);
|
|
99
|
+
if (entry.isSymbolicLink()) {
|
|
100
|
+
try {
|
|
101
|
+
if (!contained(canonicalRoot, realpathSync(candidate))) {
|
|
102
|
+
diagnostics.push({
|
|
103
|
+
type: "error",
|
|
104
|
+
message: `resources.${kind} contains an escaping symbolic link`,
|
|
105
|
+
path: candidate
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
} catch (error) {
|
|
109
|
+
diagnostics.push({
|
|
110
|
+
type: "error",
|
|
111
|
+
message: `resources.${kind} contains an unresolved symbolic link: ${error instanceof Error ? error.message : String(error)}`,
|
|
112
|
+
path: candidate
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
} else if (entry.isDirectory()) {
|
|
116
|
+
pending.push(candidate);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function validateResourceRoots(root, resources, diagnostics) {
|
|
122
|
+
for (const [kind, resourcePath] of Object.entries(resources)) {
|
|
123
|
+
if (resourcePath) validateResourceTree(root, resourcePath, kind, diagnostics);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
53
126
|
function stringArray(value) {
|
|
54
127
|
if (!Array.isArray(value)) return void 0;
|
|
55
128
|
const out = value.map((entry) => trimString(entry)).filter((entry) => entry !== void 0);
|
|
@@ -115,6 +188,7 @@ function loadManifestFromRoot(root) {
|
|
|
115
188
|
}
|
|
116
189
|
try {
|
|
117
190
|
const parsed = parseExtensionManifest(readJsonOrYaml(manifestPath), manifestPath);
|
|
191
|
+
if (parsed.manifest) validateResourceRoots(root, parsed.manifest.resources, parsed.diagnostics);
|
|
118
192
|
return {
|
|
119
193
|
path: root,
|
|
120
194
|
manifestPath,
|
|
@@ -284,7 +358,7 @@ function installExtension(sourcePath, options = {}) {
|
|
|
284
358
|
const cwd = options.cwd ?? process.cwd();
|
|
285
359
|
const source = path2.resolve(sourcePath);
|
|
286
360
|
const candidate = loadManifestFromRoot(source);
|
|
287
|
-
if (!candidate.manifest) return { diagnostics: candidate.diagnostics };
|
|
361
|
+
if (!candidate.manifest || !candidate.valid) return { diagnostics: candidate.diagnostics };
|
|
288
362
|
const targetRoot = path2.join(extensionBaseDir(scope, cwd), candidate.manifest.id);
|
|
289
363
|
if (existsSync2(targetRoot)) {
|
|
290
364
|
if (!options.force) {
|
|
@@ -307,7 +381,11 @@ function installExtension(sourcePath, options = {}) {
|
|
|
307
381
|
rmSync(backupRoot, { recursive: true, force: true });
|
|
308
382
|
cpSync(source, stagingRoot, {
|
|
309
383
|
recursive: true,
|
|
310
|
-
|
|
384
|
+
// `state.json` beside the installed extension directories belongs to
|
|
385
|
+
// Clio's extension manager. An extension may legitimately ship nested
|
|
386
|
+
// resources with the same basename (for example a project-state JSON
|
|
387
|
+
// template), so exclude only a bookkeeping file at the package root.
|
|
388
|
+
filter: (src) => path2.relative(source, src) !== "state.json"
|
|
311
389
|
});
|
|
312
390
|
if (existsSync2(targetRoot)) {
|
|
313
391
|
renameSync(targetRoot, backupRoot);
|
|
@@ -379,14 +457,26 @@ init_esm_shims();
|
|
|
379
457
|
|
|
380
458
|
// src/domains/extensions/resources.ts
|
|
381
459
|
init_esm_shims();
|
|
382
|
-
import {
|
|
460
|
+
import { lstatSync as lstatSync2, realpathSync as realpathSync2 } from "node:fs";
|
|
383
461
|
import path3 from "node:path";
|
|
384
462
|
function extensionResourcePath(rootPath, resourcePath) {
|
|
385
463
|
const root = path3.resolve(rootPath);
|
|
386
464
|
const full = path3.resolve(root, resourcePath);
|
|
387
465
|
const relative = path3.relative(root, full);
|
|
388
|
-
if (relative === "" ||
|
|
389
|
-
|
|
466
|
+
if (relative === "" || relative === ".." || relative.startsWith(`..${path3.sep}`) || path3.isAbsolute(relative))
|
|
467
|
+
return null;
|
|
468
|
+
try {
|
|
469
|
+
const rootReal = realpathSync2(root);
|
|
470
|
+
const fullReal = realpathSync2(full);
|
|
471
|
+
const canonicalRelative = path3.relative(rootReal, fullReal);
|
|
472
|
+
if (canonicalRelative === ".." || canonicalRelative.startsWith(`..${path3.sep}`) || path3.isAbsolute(canonicalRelative)) {
|
|
473
|
+
return null;
|
|
474
|
+
}
|
|
475
|
+
if (!lstatSync2(full).isDirectory()) return null;
|
|
476
|
+
return full;
|
|
477
|
+
} catch {
|
|
478
|
+
return null;
|
|
479
|
+
}
|
|
390
480
|
}
|
|
391
481
|
function enabledExtensionResourceRoots(kind, cwd = process.cwd()) {
|
|
392
482
|
const roots = [];
|
|
@@ -396,15 +486,11 @@ function enabledExtensionResourceRoots(kind, cwd = process.cwd()) {
|
|
|
396
486
|
if (!rel) continue;
|
|
397
487
|
const full = extensionResourcePath(entry.rootPath, rel);
|
|
398
488
|
if (!full) continue;
|
|
399
|
-
try {
|
|
400
|
-
if (!statSync2(full).isDirectory()) continue;
|
|
401
|
-
} catch {
|
|
402
|
-
continue;
|
|
403
|
-
}
|
|
404
489
|
roots.push({
|
|
405
490
|
id: entry.id,
|
|
406
491
|
scope: entry.scope,
|
|
407
492
|
path: full,
|
|
493
|
+
rootPath: entry.rootPath,
|
|
408
494
|
source: `extension:${entry.scope}:${entry.id}`
|
|
409
495
|
});
|
|
410
496
|
}
|
|
@@ -474,4 +560,4 @@ export {
|
|
|
474
560
|
enabledExtensionResourceRoots,
|
|
475
561
|
ExtensionsDomainModule
|
|
476
562
|
};
|
|
477
|
-
//# sourceMappingURL=chunk-
|
|
563
|
+
//# sourceMappingURL=chunk-DYIM5TJT.js.map
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
enabledExtensionResourceRoots
|
|
4
|
+
} from "./chunk-DYIM5TJT.js";
|
|
5
|
+
import {
|
|
6
|
+
PATH_BOUNDARY_MAX_ENTRIES,
|
|
7
|
+
normalizePathBoundary,
|
|
8
|
+
normalizePathBoundaryEntry,
|
|
9
|
+
pathBoundaryCovers
|
|
10
|
+
} from "./chunk-TTHACPOM.js";
|
|
2
11
|
import {
|
|
3
12
|
ArrayOptions,
|
|
4
13
|
Clone,
|
|
@@ -62,15 +71,15 @@ import {
|
|
|
62
71
|
settings_exports,
|
|
63
72
|
typebox_exports
|
|
64
73
|
} from "./chunk-5B2AEOW5.js";
|
|
74
|
+
import {
|
|
75
|
+
resolvePackageRoot
|
|
76
|
+
} from "./chunk-IWHMRKLL.js";
|
|
65
77
|
import {
|
|
66
78
|
require_dist
|
|
67
79
|
} from "./chunk-APJ265NV.js";
|
|
68
80
|
import {
|
|
69
81
|
clioConfigDir
|
|
70
82
|
} from "./chunk-BNAZZHFG.js";
|
|
71
|
-
import {
|
|
72
|
-
resolvePackageRoot
|
|
73
|
-
} from "./chunk-IWHMRKLL.js";
|
|
74
83
|
import {
|
|
75
84
|
__export,
|
|
76
85
|
__toESM,
|
|
@@ -4407,45 +4416,15 @@ function parseFrontmatter(raw, sourcePath) {
|
|
|
4407
4416
|
|
|
4408
4417
|
// src/domains/agents/write-boundary.ts
|
|
4409
4418
|
init_esm_shims();
|
|
4410
|
-
var WRITE_BOUNDARY_MAX_ENTRIES =
|
|
4411
|
-
var GLOB_CHARACTERS = /[*?[\]{}]/u;
|
|
4419
|
+
var WRITE_BOUNDARY_MAX_ENTRIES = PATH_BOUNDARY_MAX_ENTRIES;
|
|
4412
4420
|
function normalizeWriteBoundaryEntry(entry) {
|
|
4413
|
-
|
|
4414
|
-
if (raw.length === 0) throw new Error("write boundary: entry must be a non-empty path");
|
|
4415
|
-
if (raw.includes("\\")) {
|
|
4416
|
-
throw new Error(`write boundary: entry '${entry}' must use '/' separators`);
|
|
4417
|
-
}
|
|
4418
|
-
if (GLOB_CHARACTERS.test(raw)) {
|
|
4419
|
-
throw new Error(`write boundary: entry '${entry}' looks like a glob, which v1 does not support`);
|
|
4420
|
-
}
|
|
4421
|
-
if (raw.startsWith("/") || /^[A-Za-z]:/u.test(raw)) {
|
|
4422
|
-
throw new Error(`write boundary: entry '${entry}' must be repository-relative, not absolute`);
|
|
4423
|
-
}
|
|
4424
|
-
const subtree = raw.endsWith("/");
|
|
4425
|
-
const segments = raw.split("/").filter((segment) => segment.length > 0);
|
|
4426
|
-
if (segments.length === 0) {
|
|
4427
|
-
throw new Error(`write boundary: entry '${entry}' must name a path inside the repository`);
|
|
4428
|
-
}
|
|
4429
|
-
for (const segment of segments) {
|
|
4430
|
-
if (segment === "..") throw new Error(`write boundary: entry '${entry}' must not contain '..'`);
|
|
4431
|
-
if (segment === ".") throw new Error(`write boundary: entry '${entry}' must not contain '.' segments`);
|
|
4432
|
-
}
|
|
4433
|
-
const joined = segments.join("/");
|
|
4434
|
-
return subtree ? `${joined}/` : joined;
|
|
4421
|
+
return normalizePathBoundaryEntry(entry);
|
|
4435
4422
|
}
|
|
4436
4423
|
function normalizeWriteBoundary(entries) {
|
|
4437
|
-
|
|
4438
|
-
throw new Error(`write boundary: at most ${WRITE_BOUNDARY_MAX_ENTRIES} entries may be declared`);
|
|
4439
|
-
}
|
|
4440
|
-
const normalized = new Set(entries.map(normalizeWriteBoundaryEntry));
|
|
4441
|
-
return [...normalized].sort();
|
|
4442
|
-
}
|
|
4443
|
-
function toRepoRelativePosix(path) {
|
|
4444
|
-
return path.split("\\").join("/");
|
|
4424
|
+
return normalizePathBoundary(entries);
|
|
4445
4425
|
}
|
|
4446
4426
|
function writeBoundaryCovers(boundary, path) {
|
|
4447
|
-
|
|
4448
|
-
return boundary.some((entry) => entry.endsWith("/") ? candidate.startsWith(entry) : candidate === entry);
|
|
4427
|
+
return pathBoundaryCovers(boundary, path);
|
|
4449
4428
|
}
|
|
4450
4429
|
function describeWriteBoundary(boundary) {
|
|
4451
4430
|
return boundary.length === 0 ? "(nothing: readonly)" : boundary.join(", ");
|
|
@@ -4863,6 +4842,7 @@ function parseFleetContract(raw, sourcePath) {
|
|
|
4863
4842
|
}
|
|
4864
4843
|
if (version < FLEET_WRITE_BOUNDARY_VERSION) assertNoWritesBefore(frontmatter, sourcePath, version);
|
|
4865
4844
|
if (version < FLEET_DYNAMIC_STEP_VERSION) assertNoV5FieldsBefore(frontmatter, sourcePath, version);
|
|
4845
|
+
if (version >= FLEET_DYNAMIC_STEP_VERSION) assertNoGateWrites(frontmatter, sourcePath);
|
|
4866
4846
|
const schemaError = firstSchemaError2(frontmatter, version);
|
|
4867
4847
|
if (schemaError !== null) {
|
|
4868
4848
|
throw new Error(`fleet contract ${sourcePath}: ${schemaError}`);
|
|
@@ -4936,6 +4916,16 @@ function assertNoWritesBefore(frontmatter, sourcePath, version) {
|
|
|
4936
4916
|
}
|
|
4937
4917
|
}
|
|
4938
4918
|
}
|
|
4919
|
+
function assertNoGateWrites(frontmatter, sourcePath) {
|
|
4920
|
+
for (const value of Array.isArray(frontmatter.steps) ? frontmatter.steps : []) {
|
|
4921
|
+
if (typeof value !== "object" || value === null) continue;
|
|
4922
|
+
const step = value;
|
|
4923
|
+
if (step.kind !== "gate" || typeof step.id !== "string" || step.id.length === 0 || !("writes" in step)) continue;
|
|
4924
|
+
throw new Error(
|
|
4925
|
+
`fleet contract ${sourcePath}: gate step '${step.id}' must not declare 'writes'; its write boundary is derived from 'path'`
|
|
4926
|
+
);
|
|
4927
|
+
}
|
|
4928
|
+
}
|
|
4939
4929
|
function assertNoV5FieldsBefore(frontmatter, sourcePath, version) {
|
|
4940
4930
|
const forbidden = ["target", "profile"];
|
|
4941
4931
|
if ("writers" in frontmatter) {
|
|
@@ -5006,13 +4996,19 @@ function validateFleetCommands(contract, registry) {
|
|
|
5006
4996
|
function builtinFleetsDir() {
|
|
5007
4997
|
return join2(resolvePackageRoot(), "src", "domains", "agents", "fleets");
|
|
5008
4998
|
}
|
|
4999
|
+
function fleetSources(cwd) {
|
|
5000
|
+
return [
|
|
5001
|
+
{ dir: builtinFleetsDir(), source: "builtin" },
|
|
5002
|
+
...enabledExtensionResourceRoots("fleets", cwd).sort((left, right) => left.source.localeCompare(right.source)).map((root) => ({ dir: root.path, source: "extension" })),
|
|
5003
|
+
{ dir: join2(clioConfigDir(), "fleets"), source: "user" },
|
|
5004
|
+
{ dir: fleetsDir(cwd), source: "project" }
|
|
5005
|
+
];
|
|
5006
|
+
}
|
|
5009
5007
|
function fleetContractPath(cwd, name) {
|
|
5010
|
-
const
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
const builtinPath = join2(builtinFleetsDir(), `${name}.md`);
|
|
5015
|
-
if (existsSync2(builtinPath)) return { path: builtinPath, source: "builtin" };
|
|
5008
|
+
for (const source of [...fleetSources(cwd)].reverse()) {
|
|
5009
|
+
const candidate = join2(source.dir, `${name}.md`);
|
|
5010
|
+
if (existsSync2(candidate)) return { path: candidate, source: source.source };
|
|
5011
|
+
}
|
|
5016
5012
|
return null;
|
|
5017
5013
|
}
|
|
5018
5014
|
function loadFleetContract(cwd, name) {
|
|
@@ -5041,11 +5037,7 @@ function listFleetContracts(cwd) {
|
|
|
5041
5037
|
registryError = err instanceof Error ? err.message : String(err);
|
|
5042
5038
|
}
|
|
5043
5039
|
const listings = /* @__PURE__ */ new Map();
|
|
5044
|
-
const sources =
|
|
5045
|
-
{ dir: builtinFleetsDir(), source: "builtin" },
|
|
5046
|
-
{ dir: join2(clioConfigDir(), "fleets"), source: "user" },
|
|
5047
|
-
{ dir: fleetsDir(cwd), source: "project" }
|
|
5048
|
-
];
|
|
5040
|
+
const sources = fleetSources(cwd);
|
|
5049
5041
|
for (const { dir, source } of sources) {
|
|
5050
5042
|
for (const file of listDirectory(dir)) {
|
|
5051
5043
|
const path = join2(dir, file);
|
|
@@ -5093,6 +5085,7 @@ export {
|
|
|
5093
5085
|
parseFrontmatter,
|
|
5094
5086
|
FLEET_COMMAND_BASE_ENV,
|
|
5095
5087
|
loadFleetCommands,
|
|
5088
|
+
normalizeWriteBoundaryEntry,
|
|
5096
5089
|
normalizeWriteBoundary,
|
|
5097
5090
|
writeBoundaryCovers,
|
|
5098
5091
|
describeWriteBoundary,
|
|
@@ -5110,4 +5103,4 @@ export {
|
|
|
5110
5103
|
listFleetContracts,
|
|
5111
5104
|
renderFleetPrompt
|
|
5112
5105
|
};
|
|
5113
|
-
//# sourceMappingURL=chunk-
|
|
5106
|
+
//# sourceMappingURL=chunk-E77JEWSD.js.map
|
|
@@ -4,25 +4,25 @@ import {
|
|
|
4
4
|
READONLY_SCOPE,
|
|
5
5
|
WORKSPACE_SCOPE,
|
|
6
6
|
isSubset
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-VCBR6CU7.js";
|
|
8
8
|
import {
|
|
9
9
|
createLoopState,
|
|
10
10
|
observe
|
|
11
11
|
} from "./chunk-UOV2BYIW.js";
|
|
12
12
|
import {
|
|
13
13
|
createSafetyPolicyEngine
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-5H3GB5BO.js";
|
|
15
15
|
import {
|
|
16
16
|
classify
|
|
17
17
|
} from "./chunk-AOCYTWAV.js";
|
|
18
|
+
import {
|
|
19
|
+
BusChannels,
|
|
20
|
+
isRunAbortedPayload
|
|
21
|
+
} from "./chunk-TT36MB5S.js";
|
|
18
22
|
import {
|
|
19
23
|
clioStateDir,
|
|
20
24
|
stateRootRemoved
|
|
21
25
|
} from "./chunk-BNAZZHFG.js";
|
|
22
|
-
import {
|
|
23
|
-
BusChannels,
|
|
24
|
-
isRunAbortedPayload
|
|
25
|
-
} from "./chunk-OB5HIGJY.js";
|
|
26
26
|
import {
|
|
27
27
|
init_esm_shims
|
|
28
28
|
} from "./chunk-3R73A4XB.js";
|
|
@@ -608,4 +608,4 @@ var SafetyDomainModule = {
|
|
|
608
608
|
export {
|
|
609
609
|
SafetyDomainModule
|
|
610
610
|
};
|
|
611
|
-
//# sourceMappingURL=chunk-
|
|
611
|
+
//# sourceMappingURL=chunk-EMYUUSFG.js.map
|
|
@@ -9,16 +9,16 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
require_dist
|
|
11
11
|
} from "./chunk-APJ265NV.js";
|
|
12
|
-
import {
|
|
13
|
-
findEngineEnvKeys,
|
|
14
|
-
getEngineEnvApiKey
|
|
15
|
-
} from "./chunk-YXLYO42X.js";
|
|
16
12
|
import {
|
|
17
13
|
clioConfigDir
|
|
18
14
|
} from "./chunk-BNAZZHFG.js";
|
|
19
15
|
import {
|
|
20
16
|
safeResourceWrite
|
|
21
17
|
} from "./chunk-WEPFGWHJ.js";
|
|
18
|
+
import {
|
|
19
|
+
findEngineEnvKeys,
|
|
20
|
+
getEngineEnvApiKey
|
|
21
|
+
} from "./chunk-YXLYO42X.js";
|
|
22
22
|
import {
|
|
23
23
|
__toESM,
|
|
24
24
|
init_esm_shims
|
|
@@ -959,4 +959,4 @@ export {
|
|
|
959
959
|
authNotRequiredStatus,
|
|
960
960
|
openAuthStorage
|
|
961
961
|
};
|
|
962
|
-
//# sourceMappingURL=chunk-
|
|
962
|
+
//# sourceMappingURL=chunk-EQ63NRB7.js.map
|
|
@@ -4,13 +4,16 @@ import {
|
|
|
4
4
|
} from "./chunk-DR52UMZW.js";
|
|
5
5
|
import {
|
|
6
6
|
loadSkills
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-TANS5ZJS.js";
|
|
8
8
|
import {
|
|
9
9
|
parseFrontmatter
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-E77JEWSD.js";
|
|
11
|
+
import {
|
|
12
|
+
enabledExtensionResourceRoots
|
|
13
|
+
} from "./chunk-DYIM5TJT.js";
|
|
11
14
|
import {
|
|
12
15
|
parseResultContract
|
|
13
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-TTHACPOM.js";
|
|
14
17
|
import {
|
|
15
18
|
assertAgentSpecPolicy,
|
|
16
19
|
isAgentAudience,
|
|
@@ -22,12 +25,12 @@ import {
|
|
|
22
25
|
isShadowAgent,
|
|
23
26
|
normalizeAgentSpec
|
|
24
27
|
} from "./chunk-AOCYTWAV.js";
|
|
25
|
-
import {
|
|
26
|
-
clioConfigDir
|
|
27
|
-
} from "./chunk-BNAZZHFG.js";
|
|
28
28
|
import {
|
|
29
29
|
resolvePackageRoot
|
|
30
30
|
} from "./chunk-IWHMRKLL.js";
|
|
31
|
+
import {
|
|
32
|
+
clioConfigDir
|
|
33
|
+
} from "./chunk-BNAZZHFG.js";
|
|
31
34
|
import {
|
|
32
35
|
init_esm_shims
|
|
33
36
|
} from "./chunk-3R73A4XB.js";
|
|
@@ -37,11 +40,10 @@ init_esm_shims();
|
|
|
37
40
|
|
|
38
41
|
// src/domains/agents/extension.ts
|
|
39
42
|
init_esm_shims();
|
|
40
|
-
import path3 from "node:path";
|
|
41
43
|
|
|
42
44
|
// src/domains/agents/registry.ts
|
|
43
45
|
init_esm_shims();
|
|
44
|
-
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
46
|
+
import { existsSync, readdirSync, readFileSync, realpathSync } from "node:fs";
|
|
45
47
|
import path2 from "node:path";
|
|
46
48
|
|
|
47
49
|
// src/domains/agents/recipe.ts
|
|
@@ -144,19 +146,19 @@ var RECIPE_KEYS = [
|
|
|
144
146
|
];
|
|
145
147
|
var OPTIONAL_RECIPE_KEYS = ["product"];
|
|
146
148
|
var ALL_RECIPE_KEYS = [...RECIPE_KEYS, ...OPTIONAL_RECIPE_KEYS];
|
|
147
|
-
function requiredString(value,
|
|
149
|
+
function requiredString(value, path3) {
|
|
148
150
|
if (typeof value !== "string" || value.trim().length === 0)
|
|
149
|
-
throw new Error(`agent recipe: ${
|
|
151
|
+
throw new Error(`agent recipe: ${path3} must be a non-empty string`);
|
|
150
152
|
return value;
|
|
151
153
|
}
|
|
152
|
-
function requiredStringArray(value,
|
|
153
|
-
if (!Array.isArray(value)) throw new Error(`agent recipe: ${
|
|
154
|
-
const entries = value.map((entry, index) => requiredString(entry, `${
|
|
155
|
-
if (new Set(entries).size !== entries.length) throw new Error(`agent recipe: ${
|
|
154
|
+
function requiredStringArray(value, path3) {
|
|
155
|
+
if (!Array.isArray(value)) throw new Error(`agent recipe: ${path3} must be an array of strings`);
|
|
156
|
+
const entries = value.map((entry, index) => requiredString(entry, `${path3}[${index}]`));
|
|
157
|
+
if (new Set(entries).size !== entries.length) throw new Error(`agent recipe: ${path3} must not contain duplicates`);
|
|
156
158
|
return entries;
|
|
157
159
|
}
|
|
158
|
-
function enumValue(value,
|
|
159
|
-
if (!predicate(value)) throw new Error(`agent recipe: ${
|
|
160
|
+
function enumValue(value, path3, predicate) {
|
|
161
|
+
if (!predicate(value)) throw new Error(`agent recipe: ${path3} has an unsupported value`);
|
|
160
162
|
return value;
|
|
161
163
|
}
|
|
162
164
|
function parseAudience(value, source, filepath) {
|
|
@@ -270,10 +272,26 @@ var RESERVED_CUSTOM_AGENT_IDS = /* @__PURE__ */ new Set(["worker", "delegate", "
|
|
|
270
272
|
function resolveBoundSkills(recipe, source) {
|
|
271
273
|
if (recipe.skills.length === 0) return { ...recipe, boundSkillPaths: [] };
|
|
272
274
|
const packageSkills = path2.resolve(source.dir, "..", "..", "..", "..", "skills");
|
|
273
|
-
|
|
274
|
-
|
|
275
|
+
if (source.source === "extension" && source.skillRoot === void 0) {
|
|
276
|
+
throw new Error(`agent recipe: ${recipe.filepath}: extension declares bound skills but no skills resource root`);
|
|
277
|
+
}
|
|
278
|
+
const skills = source.source === "extension" ? loadSkills({
|
|
279
|
+
cwd: source.cwd ?? process.cwd(),
|
|
280
|
+
disableDiscovery: true,
|
|
281
|
+
explicitSkillPaths: source.skillRoot === void 0 ? [] : [source.skillRoot]
|
|
282
|
+
}) : loadSkills({
|
|
283
|
+
cwd: source.cwd ?? process.cwd(),
|
|
275
284
|
...source.source === "builtin" && existsSync(packageSkills) ? { explicitSkillPaths: [packageSkills] } : {}
|
|
276
285
|
});
|
|
286
|
+
if (source.source === "extension" && source.skillRoot !== void 0) {
|
|
287
|
+
const canonicalRoot = realpathSync(source.skillRoot);
|
|
288
|
+
for (const skill of skills.items) {
|
|
289
|
+
const relative = path2.relative(canonicalRoot, realpathSync(skill.filePath));
|
|
290
|
+
if (relative === ".." || relative.startsWith(`..${path2.sep}`) || path2.isAbsolute(relative)) {
|
|
291
|
+
throw new Error(`agent recipe: ${recipe.filepath}: bound skill escapes its extension: ${skill.filePath}`);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
277
295
|
const byName = new Map(skills.items.map((skill) => [skill.name, skill.filePath]));
|
|
278
296
|
const missing = recipe.skills.filter((skill) => !byName.has(skill));
|
|
279
297
|
if (missing.length > 0) {
|
|
@@ -334,6 +352,11 @@ function mergeRecipes(...sources) {
|
|
|
334
352
|
continue;
|
|
335
353
|
}
|
|
336
354
|
const builtin = builtinById.get(recipe.id);
|
|
355
|
+
if (recipe.source === "extension" && builtin) {
|
|
356
|
+
process.stderr.write(`[clio:agents] ignore override id=${recipe.id} by=extension reason=reserved-builtin
|
|
357
|
+
`);
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
337
360
|
if (recipe.source === "user" && builtin && isShadowAgent(normalizeAgentSpec(builtin))) {
|
|
338
361
|
process.stderr.write(`[clio:agents] ignore override id=${recipe.id} by=user reason=reserved-shadow
|
|
339
362
|
`);
|
|
@@ -351,6 +374,36 @@ function mergeRecipes(...sources) {
|
|
|
351
374
|
}
|
|
352
375
|
return Array.from(byId.values()).sort((left, right) => left.id.localeCompare(right.id));
|
|
353
376
|
}
|
|
377
|
+
function discoverAgentRecipes(cwd = process.cwd(), diagnostics = []) {
|
|
378
|
+
const builtin = loadRecipesFromDir(
|
|
379
|
+
{
|
|
380
|
+
dir: path2.join(resolvePackageRoot(), "src", "domains", "agents", "builtins"),
|
|
381
|
+
source: "builtin",
|
|
382
|
+
cwd
|
|
383
|
+
},
|
|
384
|
+
diagnostics
|
|
385
|
+
);
|
|
386
|
+
const skillRoots = new Map(enabledExtensionResourceRoots("skills", cwd).map((root) => [root.source, root.path]));
|
|
387
|
+
const extensionRecipes = enabledExtensionResourceRoots("agents", cwd).sort((left, right) => left.source.localeCompare(right.source)).map((root) => {
|
|
388
|
+
const skillRoot = skillRoots.get(root.source);
|
|
389
|
+
return loadRecipesFromDir(
|
|
390
|
+
{
|
|
391
|
+
dir: root.path,
|
|
392
|
+
source: "extension",
|
|
393
|
+
cwd,
|
|
394
|
+
origin: root.source,
|
|
395
|
+
...skillRoot === void 0 ? {} : { skillRoot }
|
|
396
|
+
},
|
|
397
|
+
diagnostics
|
|
398
|
+
);
|
|
399
|
+
});
|
|
400
|
+
const user = loadRecipesFromDir({ dir: path2.join(clioConfigDir(), "agents"), source: "user", cwd }, diagnostics);
|
|
401
|
+
const project = loadRecipesFromDir(
|
|
402
|
+
{ dir: path2.join(cwd, ".clio-coder", "agents"), source: "project", cwd },
|
|
403
|
+
diagnostics
|
|
404
|
+
);
|
|
405
|
+
return mergeRecipes(builtin, ...extensionRecipes, user, project);
|
|
406
|
+
}
|
|
354
407
|
|
|
355
408
|
// src/domains/agents/extension.ts
|
|
356
409
|
function createAgentsBundle(_context) {
|
|
@@ -358,14 +411,8 @@ function createAgentsBundle(_context) {
|
|
|
358
411
|
let specs = [];
|
|
359
412
|
let diagnostics = [];
|
|
360
413
|
function discover() {
|
|
361
|
-
const builtinDir = path3.join(resolvePackageRoot(), "src", "domains", "agents", "builtins");
|
|
362
|
-
const userDir = path3.join(clioConfigDir(), "agents");
|
|
363
|
-
const projectDir = path3.join(process.cwd(), ".clio-coder", "agents");
|
|
364
414
|
const nextDiagnostics = [];
|
|
365
|
-
const
|
|
366
|
-
const user = loadRecipesFromDir({ dir: userDir, source: "user" }, nextDiagnostics);
|
|
367
|
-
const project = loadRecipesFromDir({ dir: projectDir, source: "project" }, nextDiagnostics);
|
|
368
|
-
const merged = mergeRecipes(builtin, user, project);
|
|
415
|
+
const merged = discoverAgentRecipes(process.cwd(), nextDiagnostics);
|
|
369
416
|
const config = _context.getContract("config");
|
|
370
417
|
assertAgentIdNamespace(merged, config?.get()?.delegation?.agents ?? []);
|
|
371
418
|
recipes = merged;
|
|
@@ -465,8 +512,7 @@ var AgentsDomainModule = {
|
|
|
465
512
|
|
|
466
513
|
export {
|
|
467
514
|
parseAgentRecipeSchema,
|
|
468
|
-
|
|
469
|
-
mergeRecipes,
|
|
515
|
+
discoverAgentRecipes,
|
|
470
516
|
AgentsDomainModule
|
|
471
517
|
};
|
|
472
|
-
//# sourceMappingURL=chunk-
|
|
518
|
+
//# sourceMappingURL=chunk-FBVTI2TJ.js.map
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
readStrictLayeredSettings,
|
|
4
|
-
updateLayeredSettings
|
|
5
|
-
} from "./chunk-YD734TPH.js";
|
|
6
2
|
import {
|
|
7
3
|
assertAgentIdNamespace
|
|
8
4
|
} from "./chunk-DR52UMZW.js";
|
|
9
5
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import {
|
|
14
|
-
setGitCommitAttributionEnabled
|
|
15
|
-
} from "./chunk-D4MDIG46.js";
|
|
6
|
+
readStrictLayeredSettings,
|
|
7
|
+
updateLayeredSettings
|
|
8
|
+
} from "./chunk-26LEYJZH.js";
|
|
16
9
|
import {
|
|
17
10
|
resolveShutdownHookBudgetMs,
|
|
18
11
|
runWithBudget,
|
|
19
12
|
writeShutdownNotice
|
|
20
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-WXY7KU3G.js";
|
|
14
|
+
import {
|
|
15
|
+
setGitCommitAttributionEnabled
|
|
16
|
+
} from "./chunk-B5CSFE7B.js";
|
|
17
|
+
import {
|
|
18
|
+
formatSettingsFailure,
|
|
19
|
+
settingsPath
|
|
20
|
+
} from "./chunk-IJ7RPIYJ.js";
|
|
21
21
|
import {
|
|
22
22
|
getSharedBus
|
|
23
23
|
} from "./chunk-ZGVHUX3M.js";
|
|
24
24
|
import {
|
|
25
25
|
BusChannels
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-TT36MB5S.js";
|
|
27
27
|
import {
|
|
28
28
|
init_esm_shims
|
|
29
29
|
} from "./chunk-3R73A4XB.js";
|
|
@@ -378,4 +378,4 @@ export {
|
|
|
378
378
|
ConfigDomainModule,
|
|
379
379
|
createConfigDomainModule
|
|
380
380
|
};
|
|
381
|
-
//# sourceMappingURL=chunk-
|
|
381
|
+
//# sourceMappingURL=chunk-FHJEP5SW.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
parseAgentRecipeSchema
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FBVTI2TJ.js";
|
|
5
5
|
import {
|
|
6
6
|
parseFleetContract,
|
|
7
7
|
parseFrontmatter
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-E77JEWSD.js";
|
|
9
9
|
import {
|
|
10
10
|
assertAgentSpecPolicy,
|
|
11
11
|
normalizeAgentSpec
|
|
@@ -14,7 +14,10 @@ import {
|
|
|
14
14
|
readSettings,
|
|
15
15
|
settingsPath,
|
|
16
16
|
updateSettings
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-IJ7RPIYJ.js";
|
|
18
|
+
import {
|
|
19
|
+
readClioVersion
|
|
20
|
+
} from "./chunk-IWHMRKLL.js";
|
|
18
21
|
import {
|
|
19
22
|
DEFAULT_SETTINGS
|
|
20
23
|
} from "./chunk-4DGYLA73.js";
|
|
@@ -29,9 +32,6 @@ import {
|
|
|
29
32
|
safeResourceBackupPath,
|
|
30
33
|
safeResourceWrite
|
|
31
34
|
} from "./chunk-WEPFGWHJ.js";
|
|
32
|
-
import {
|
|
33
|
-
readClioVersion
|
|
34
|
-
} from "./chunk-IWHMRKLL.js";
|
|
35
35
|
import {
|
|
36
36
|
__toESM,
|
|
37
37
|
init_esm_shims
|
|
@@ -610,4 +610,4 @@ export {
|
|
|
610
610
|
importShareArchive,
|
|
611
611
|
ShareDomainModule
|
|
612
612
|
};
|
|
613
|
-
//# sourceMappingURL=chunk-
|
|
613
|
+
//# sourceMappingURL=chunk-GN57SG4G.js.map
|