@agentxm/extension-resolution 0.28.14-preview.1789139351.5cd4595aa
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/LICENSE +110 -0
- package/README.md +56 -0
- package/dist/src/accepted-pack-dependency-resolver.d.ts +23 -0
- package/dist/src/accepted-pack-dependency-resolver.js +31 -0
- package/dist/src/accepted-pack-hydration.d.ts +33 -0
- package/dist/src/accepted-pack-hydration.js +93 -0
- package/dist/src/axm-skill-candidate.d.ts +16 -0
- package/dist/src/axm-skill-candidate.js +80 -0
- package/dist/src/axm-skill-compatibility.d.ts +87 -0
- package/dist/src/axm-skill-compatibility.js +248 -0
- package/dist/src/axm-skill-workspace-compatibility.d.ts +23 -0
- package/dist/src/axm-skill-workspace-compatibility.js +110 -0
- package/dist/src/configured-entry-resolution.d.ts +118 -0
- package/dist/src/configured-entry-resolution.js +735 -0
- package/dist/src/configured-entry.d.ts +38 -0
- package/dist/src/configured-entry.js +8 -0
- package/dist/src/errors.d.ts +113 -0
- package/dist/src/errors.js +71 -0
- package/dist/src/index.d.ts +34 -0
- package/dist/src/index.js +45 -0
- package/dist/src/live.d.ts +25 -0
- package/dist/src/live.js +47 -0
- package/dist/src/named-registry-resolution.d.ts +26 -0
- package/dist/src/named-registry-resolution.js +110 -0
- package/dist/src/pack-dependency-resolution.d.ts +73 -0
- package/dist/src/pack-dependency-resolution.js +422 -0
- package/dist/src/publisher-binding.d.ts +66 -0
- package/dist/src/publisher-binding.js +75 -0
- package/dist/src/release-age-policy.d.ts +55 -0
- package/dist/src/release-age-policy.js +115 -0
- package/dist/src/release-age-posture.d.ts +23 -0
- package/dist/src/release-age-posture.js +15 -0
- package/dist/src/resolution-timeout.d.ts +11 -0
- package/dist/src/resolution-timeout.js +17 -0
- package/dist/src/resolved-pack-dependency.d.ts +32 -0
- package/dist/src/resolved-pack-dependency.js +28 -0
- package/dist/src/source-authority.d.ts +60 -0
- package/dist/src/source-authority.js +70 -0
- package/dist/src/testing.d.ts +40 -0
- package/dist/src/testing.js +40 -0
- package/dist/src/update/constraint-precedence.d.ts +75 -0
- package/dist/src/update/constraint-precedence.js +99 -0
- package/dist/src/update/targeted-update-context.d.ts +101 -0
- package/dist/src/update/targeted-update-context.js +217 -0
- package/dist/src/version-resolution.d.ts +39 -0
- package/dist/src/version-resolution.js +76 -0
- package/package.json +66 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import * as Layer from "effect/Layer";
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
import * as ServiceMap from "effect/Context";
|
|
4
|
+
import * as semver from "semver";
|
|
5
|
+
export const AXM_SKILL_FQN = "@agentxm/skills/axm";
|
|
6
|
+
const AXM_SKILL_AGENTXM_SOURCE = `agentxm:${AXM_SKILL_FQN}`;
|
|
7
|
+
export const AXM_SKILL_CLI_VERSION_METADATA_KEY = "axm.sh/cli-version";
|
|
8
|
+
export const AXM_SKILL_CLI_VERSION_RANGE_METADATA_KEY = "axm.sh/cli-version-range";
|
|
9
|
+
export const AXM_SKILL_BUNDLED_PREVIEW_COMMAND = "axm skills install @agentxm/skills/axm --bundled --preview";
|
|
10
|
+
export const AXM_SKILL_BUNDLED_APPLY_COMMAND = "axm skills install @agentxm/skills/axm --bundled";
|
|
11
|
+
export const AXM_SKILL_REGISTRY_PREVIEW_COMMAND = "axm skills update --name axm --preview";
|
|
12
|
+
export const AXM_SKILL_REGISTRY_APPLY_COMMAND = "axm skills update --name axm";
|
|
13
|
+
export const AxmSkillCompatibilityReasonSchema = Schema.Literals([
|
|
14
|
+
"cli-version-unavailable",
|
|
15
|
+
"axm-skill-missing",
|
|
16
|
+
"axm-skill-manifest-invalid",
|
|
17
|
+
"compatibility-metadata-missing",
|
|
18
|
+
"compatibility-metadata-malformed",
|
|
19
|
+
"skill-release-mismatch",
|
|
20
|
+
"skill-release-range-mismatch",
|
|
21
|
+
"cli-version-incompatible",
|
|
22
|
+
]);
|
|
23
|
+
export const AxmSkillCompatibilityRecoveryActionSchema = Schema.Literals([
|
|
24
|
+
"none",
|
|
25
|
+
"inspect-cli",
|
|
26
|
+
"upgrade-cli",
|
|
27
|
+
"update-registry-skill",
|
|
28
|
+
"install-bundled-skill",
|
|
29
|
+
"preserve-authored-skill",
|
|
30
|
+
]);
|
|
31
|
+
export const AxmSkillCompatibilityRecoveryStepSchema = Schema.Struct({
|
|
32
|
+
boundary: Schema.Literals(["executable", "workspace", "verification"]),
|
|
33
|
+
command: Schema.String,
|
|
34
|
+
preview: Schema.Boolean,
|
|
35
|
+
});
|
|
36
|
+
export const AxmSkillCompatibilityRecoverySchema = Schema.Struct({
|
|
37
|
+
action: AxmSkillCompatibilityRecoveryActionSchema,
|
|
38
|
+
targetCliVersion: Schema.NullOr(Schema.String),
|
|
39
|
+
targetSkillVersion: Schema.NullOr(Schema.String),
|
|
40
|
+
nextAction: Schema.NullOr(Schema.String),
|
|
41
|
+
steps: Schema.Array(AxmSkillCompatibilityRecoveryStepSchema),
|
|
42
|
+
});
|
|
43
|
+
export const formatAxmSkillCompatibilityTarget = (target) => `AXM CLI ${target.targetCliVersion ?? "unknown"} + official AXM skill ${target.targetSkillVersion ?? "unknown"}`;
|
|
44
|
+
export const AxmSkillCompatibilitySchema = Schema.Struct({
|
|
45
|
+
status: Schema.Literals(["compatible", "incompatible"]),
|
|
46
|
+
cliVersion: Schema.NullOr(Schema.String),
|
|
47
|
+
skillVersion: Schema.NullOr(Schema.String),
|
|
48
|
+
source: Schema.NullOr(Schema.String),
|
|
49
|
+
declaredCliVersion: Schema.NullOr(Schema.String),
|
|
50
|
+
declaredCliVersionRange: Schema.NullOr(Schema.String),
|
|
51
|
+
reasonCode: Schema.NullOr(AxmSkillCompatibilityReasonSchema),
|
|
52
|
+
detail: Schema.NullOr(Schema.String),
|
|
53
|
+
recovery: AxmSkillCompatibilityRecoverySchema,
|
|
54
|
+
});
|
|
55
|
+
export class AxmSkillCompatibilityPolicy extends ServiceMap.Service()("@agentxm/extension-resolution/axm-skill-compatibility/AxmSkillCompatibilityPolicy") {
|
|
56
|
+
}
|
|
57
|
+
const wildcardRangePattern = /(?:^|[.\s])(?:[xX*])(?:$|[.\s])/u;
|
|
58
|
+
const compatibilitySatisfies = (version, range) => semver.satisfies(version, range, { includePrerelease: true });
|
|
59
|
+
const comparatorSetIsBounded = (comparators) => {
|
|
60
|
+
let hasLowerBound = false;
|
|
61
|
+
let hasUpperBound = false;
|
|
62
|
+
for (const comparator of comparators) {
|
|
63
|
+
if (comparator.value.length === 0)
|
|
64
|
+
continue;
|
|
65
|
+
switch (comparator.operator) {
|
|
66
|
+
case "":
|
|
67
|
+
hasLowerBound = true;
|
|
68
|
+
hasUpperBound = true;
|
|
69
|
+
break;
|
|
70
|
+
case ">":
|
|
71
|
+
case ">=":
|
|
72
|
+
hasLowerBound = true;
|
|
73
|
+
break;
|
|
74
|
+
case "<":
|
|
75
|
+
case "<=":
|
|
76
|
+
hasUpperBound = true;
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return hasLowerBound && hasUpperBound;
|
|
81
|
+
};
|
|
82
|
+
export const validateAxmSkillCliVersionRange = (value) => {
|
|
83
|
+
if (value.length === 0 || value.trim() !== value || wildcardRangePattern.test(value)) {
|
|
84
|
+
return { valid: false };
|
|
85
|
+
}
|
|
86
|
+
if (semver.validRange(value) === null)
|
|
87
|
+
return { valid: false };
|
|
88
|
+
try {
|
|
89
|
+
const range = new semver.Range(value);
|
|
90
|
+
return range.set.length > 0 && range.set.every(comparatorSetIsBounded)
|
|
91
|
+
? { valid: true }
|
|
92
|
+
: { valid: false };
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return { valid: false };
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const recoveryStep = (boundary, command, preview) => ({ boundary, command, preview });
|
|
99
|
+
const bundledSkillRecovery = (cliVersion) => ({
|
|
100
|
+
action: "install-bundled-skill",
|
|
101
|
+
targetCliVersion: cliVersion,
|
|
102
|
+
targetSkillVersion: cliVersion,
|
|
103
|
+
nextAction: AXM_SKILL_BUNDLED_PREVIEW_COMMAND,
|
|
104
|
+
steps: [
|
|
105
|
+
recoveryStep("workspace", AXM_SKILL_BUNDLED_PREVIEW_COMMAND, true),
|
|
106
|
+
recoveryStep("workspace", AXM_SKILL_BUNDLED_APPLY_COMMAND, false),
|
|
107
|
+
recoveryStep("verification", "axm lint", false),
|
|
108
|
+
],
|
|
109
|
+
});
|
|
110
|
+
const isAuthoredSource = (source) => source === "workspace";
|
|
111
|
+
const isRegistrySource = (source) => source === AXM_SKILL_FQN ||
|
|
112
|
+
source?.startsWith(`${AXM_SKILL_FQN}@`) === true ||
|
|
113
|
+
source === AXM_SKILL_AGENTXM_SOURCE ||
|
|
114
|
+
source?.startsWith(`${AXM_SKILL_AGENTXM_SOURCE}@`) === true;
|
|
115
|
+
const registrySkillRecovery = (cliVersion) => ({
|
|
116
|
+
action: "update-registry-skill",
|
|
117
|
+
targetCliVersion: cliVersion,
|
|
118
|
+
targetSkillVersion: cliVersion,
|
|
119
|
+
nextAction: AXM_SKILL_REGISTRY_PREVIEW_COMMAND,
|
|
120
|
+
steps: [
|
|
121
|
+
recoveryStep("workspace", AXM_SKILL_REGISTRY_PREVIEW_COMMAND, true),
|
|
122
|
+
recoveryStep("workspace", AXM_SKILL_REGISTRY_APPLY_COMMAND, false),
|
|
123
|
+
recoveryStep("verification", "axm lint", false),
|
|
124
|
+
],
|
|
125
|
+
});
|
|
126
|
+
const deriveRecovery = (compatibility) => {
|
|
127
|
+
if (compatibility.status === "compatible") {
|
|
128
|
+
return {
|
|
129
|
+
action: "none",
|
|
130
|
+
targetCliVersion: compatibility.cliVersion,
|
|
131
|
+
targetSkillVersion: compatibility.skillVersion,
|
|
132
|
+
nextAction: null,
|
|
133
|
+
steps: [],
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
if (compatibility.reasonCode === "cli-version-unavailable") {
|
|
137
|
+
return {
|
|
138
|
+
action: "inspect-cli",
|
|
139
|
+
targetCliVersion: null,
|
|
140
|
+
targetSkillVersion: compatibility.skillVersion,
|
|
141
|
+
nextAction: "axm --version",
|
|
142
|
+
steps: [
|
|
143
|
+
recoveryStep("verification", "axm --version", false),
|
|
144
|
+
recoveryStep("verification", "axm lint", false),
|
|
145
|
+
],
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
if (compatibility.reasonCode === "cli-version-incompatible" &&
|
|
149
|
+
compatibility.cliVersion !== null &&
|
|
150
|
+
compatibility.declaredCliVersionRange !== null) {
|
|
151
|
+
const minimum = semver.minVersion(compatibility.declaredCliVersionRange);
|
|
152
|
+
if (minimum !== null && semver.lt(compatibility.cliVersion, minimum)) {
|
|
153
|
+
return {
|
|
154
|
+
action: "upgrade-cli",
|
|
155
|
+
targetCliVersion: compatibility.declaredCliVersion ?? minimum.version,
|
|
156
|
+
targetSkillVersion: compatibility.skillVersion,
|
|
157
|
+
nextAction: "axm upgrade",
|
|
158
|
+
steps: [
|
|
159
|
+
recoveryStep("executable", "axm upgrade", false),
|
|
160
|
+
recoveryStep("verification", "axm lint", false),
|
|
161
|
+
],
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (isAuthoredSource(compatibility.source)) {
|
|
166
|
+
return {
|
|
167
|
+
action: "preserve-authored-skill",
|
|
168
|
+
targetCliVersion: compatibility.cliVersion,
|
|
169
|
+
targetSkillVersion: compatibility.cliVersion,
|
|
170
|
+
nextAction: "axm help upgrade",
|
|
171
|
+
steps: [recoveryStep("verification", "axm help upgrade", false)],
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
if (isRegistrySource(compatibility.source) && compatibility.cliVersion !== null) {
|
|
175
|
+
return registrySkillRecovery(compatibility.cliVersion);
|
|
176
|
+
}
|
|
177
|
+
return compatibility.cliVersion === null
|
|
178
|
+
? {
|
|
179
|
+
action: "inspect-cli",
|
|
180
|
+
targetCliVersion: null,
|
|
181
|
+
targetSkillVersion: compatibility.skillVersion,
|
|
182
|
+
nextAction: "axm --version",
|
|
183
|
+
steps: [recoveryStep("verification", "axm --version", false)],
|
|
184
|
+
}
|
|
185
|
+
: bundledSkillRecovery(compatibility.cliVersion);
|
|
186
|
+
};
|
|
187
|
+
const withRecovery = (compatibility) => ({
|
|
188
|
+
...compatibility,
|
|
189
|
+
recovery: deriveRecovery(compatibility),
|
|
190
|
+
});
|
|
191
|
+
const incompatible = (fields, reasonCode, detail) => withRecovery({
|
|
192
|
+
status: "incompatible",
|
|
193
|
+
...fields,
|
|
194
|
+
reasonCode,
|
|
195
|
+
detail,
|
|
196
|
+
});
|
|
197
|
+
export const evaluateAxmSkillCompatibility = (input) => {
|
|
198
|
+
const cliVersion = input.cliVersion === null ? null : semver.valid(input.cliVersion);
|
|
199
|
+
const skillVersion = input.skill?.manifestVersion ?? null;
|
|
200
|
+
const source = input.skill?.source ?? null;
|
|
201
|
+
const declaredCliVersion = input.skill?.metadata?.[AXM_SKILL_CLI_VERSION_METADATA_KEY] ?? null;
|
|
202
|
+
const declaredCliVersionRange = input.skill?.metadata?.[AXM_SKILL_CLI_VERSION_RANGE_METADATA_KEY] ?? null;
|
|
203
|
+
const fields = {
|
|
204
|
+
cliVersion,
|
|
205
|
+
skillVersion,
|
|
206
|
+
source,
|
|
207
|
+
declaredCliVersion,
|
|
208
|
+
declaredCliVersionRange,
|
|
209
|
+
};
|
|
210
|
+
if (cliVersion === null) {
|
|
211
|
+
return incompatible(fields, "cli-version-unavailable", "The running AXM CLI version is unavailable or invalid.");
|
|
212
|
+
}
|
|
213
|
+
if (input.skill === null) {
|
|
214
|
+
return incompatible(fields, "axm-skill-missing", "The official @agentxm/skills/axm skill is not installed.");
|
|
215
|
+
}
|
|
216
|
+
const validSkillVersion = input.skill.manifestVersion === null ? null : semver.valid(input.skill.manifestVersion);
|
|
217
|
+
if (validSkillVersion === null) {
|
|
218
|
+
return incompatible(fields, "axm-skill-manifest-invalid", "The official AXM skill manifest has a missing or invalid version.");
|
|
219
|
+
}
|
|
220
|
+
if (declaredCliVersion === null || declaredCliVersionRange === null) {
|
|
221
|
+
return incompatible(fields, "compatibility-metadata-missing", `The official AXM skill must declare ${AXM_SKILL_CLI_VERSION_METADATA_KEY} and ${AXM_SKILL_CLI_VERSION_RANGE_METADATA_KEY}.`);
|
|
222
|
+
}
|
|
223
|
+
if (semver.valid(declaredCliVersion) === null ||
|
|
224
|
+
!validateAxmSkillCliVersionRange(declaredCliVersionRange).valid) {
|
|
225
|
+
return incompatible(fields, "compatibility-metadata-malformed", "The official AXM skill compatibility metadata must contain an exact release and a bounded, wildcard-free semver range.");
|
|
226
|
+
}
|
|
227
|
+
if (validSkillVersion !== declaredCliVersion) {
|
|
228
|
+
return incompatible(fields, "skill-release-mismatch", `The AXM skill manifest reports ${validSkillVersion}, but ${AXM_SKILL_CLI_VERSION_METADATA_KEY} reports ${declaredCliVersion}.`);
|
|
229
|
+
}
|
|
230
|
+
if (!compatibilitySatisfies(declaredCliVersion, declaredCliVersionRange)) {
|
|
231
|
+
return incompatible(fields, "skill-release-range-mismatch", `The AXM skill release ${declaredCliVersion} is outside its declared CLI range ${declaredCliVersionRange}.`);
|
|
232
|
+
}
|
|
233
|
+
if (!compatibilitySatisfies(cliVersion, declaredCliVersionRange)) {
|
|
234
|
+
return incompatible(fields, "cli-version-incompatible", `AXM CLI ${cliVersion} is outside the official AXM skill range ${declaredCliVersionRange}.`);
|
|
235
|
+
}
|
|
236
|
+
return withRecovery({
|
|
237
|
+
status: "compatible",
|
|
238
|
+
...fields,
|
|
239
|
+
reasonCode: null,
|
|
240
|
+
detail: null,
|
|
241
|
+
});
|
|
242
|
+
};
|
|
243
|
+
export const makeAxmSkillCompatibilityPolicyLayer = (cliVersion) => Layer.succeed(AxmSkillCompatibilityPolicy, {
|
|
244
|
+
evaluate: (input) => input.fqn === AXM_SKILL_FQN
|
|
245
|
+
? evaluateAxmSkillCompatibility({ cliVersion, skill: input.candidate })
|
|
246
|
+
: null,
|
|
247
|
+
});
|
|
248
|
+
//# sourceMappingURL=axm-skill-compatibility.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import type * as FileSystem from "effect/FileSystem";
|
|
3
|
+
import * as Option from "effect/Option";
|
|
4
|
+
import type * as Path from "effect/Path";
|
|
5
|
+
import type { InstalledSkill, WorkspaceReadModel } from "@agentxm/workspace-state";
|
|
6
|
+
import { type LockfileReadError, type SettingsReadError } from "@agentxm/workspace-state";
|
|
7
|
+
import { type AxmSkillCompatibility, type AxmSkillCompatibilityPolicyService } from "./axm-skill-compatibility.js";
|
|
8
|
+
/** Whether desired workspace state directly or transitively declares the official AXM skill. */
|
|
9
|
+
export declare const declaresOfficialAxmSkill: (args: {
|
|
10
|
+
readonly declaredSource: string | null;
|
|
11
|
+
readonly installed: Option.Option<InstalledSkill>;
|
|
12
|
+
}) => boolean;
|
|
13
|
+
export interface ReadAxmSkillWorkspaceCompatibilityArgs {
|
|
14
|
+
readonly platform: {
|
|
15
|
+
readonly fs: FileSystem.FileSystem;
|
|
16
|
+
readonly path: Path.Path;
|
|
17
|
+
};
|
|
18
|
+
readonly workspace: Pick<WorkspaceReadModel, "scope" | "skills">;
|
|
19
|
+
readonly policy: AxmSkillCompatibilityPolicyService;
|
|
20
|
+
}
|
|
21
|
+
/** Read and evaluate the authoritative installed AXM skill without mutating the workspace. */
|
|
22
|
+
export declare const readAxmSkillWorkspaceCompatibility: (args: ReadAxmSkillWorkspaceCompatibilityArgs) => Effect.Effect<Option.Option<AxmSkillCompatibility>, SettingsReadError | LockfileReadError>;
|
|
23
|
+
//# sourceMappingURL=axm-skill-workspace-compatibility.d.ts.map
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Option from "effect/Option";
|
|
3
|
+
import { printSkillLockSourceLocator, } from "@agentxm/workspace-state";
|
|
4
|
+
import { parseSkillMd } from "@agentxm/extension-content";
|
|
5
|
+
import { AXM_SKILL_FQN, } from "./axm-skill-compatibility.js";
|
|
6
|
+
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7
|
+
const manifestVersion = (content) => {
|
|
8
|
+
try {
|
|
9
|
+
const parsed = JSON.parse(content);
|
|
10
|
+
if (!isRecord(parsed))
|
|
11
|
+
return null;
|
|
12
|
+
const version = parsed["version"];
|
|
13
|
+
return typeof version === "string" ? version : null;
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const isOfficialSource = (source) => {
|
|
20
|
+
const registrySource = `agentxm:${AXM_SKILL_FQN}`;
|
|
21
|
+
return (source === AXM_SKILL_FQN ||
|
|
22
|
+
source.startsWith(`${AXM_SKILL_FQN}@`) ||
|
|
23
|
+
source === registrySource ||
|
|
24
|
+
source.startsWith(`${registrySource}@`) ||
|
|
25
|
+
source === "workspace");
|
|
26
|
+
};
|
|
27
|
+
const resolvesToOfficialAxmSkill = (installed) => Option.exists(installed.resolved, ({ lockEntry }) => lockEntry.type === "registry"
|
|
28
|
+
? lockEntry.owner === "@agentxm" && lockEntry.name === "axm"
|
|
29
|
+
: lockEntry.packageOwner === "@agentxm" && lockEntry.packageName === "axm");
|
|
30
|
+
/** Whether desired workspace state directly or transitively declares the official AXM skill. */
|
|
31
|
+
export const declaresOfficialAxmSkill = (args) => (args.declaredSource !== null && isOfficialSource(args.declaredSource)) ||
|
|
32
|
+
Option.exists(args.installed, (installed) => installed.installationOrigin._tag === "pack-member" && resolvesToOfficialAxmSkill(installed));
|
|
33
|
+
/** Read and evaluate the authoritative installed AXM skill without mutating the workspace. */
|
|
34
|
+
export const readAxmSkillWorkspaceCompatibility = (args) => Effect.gen(function* () {
|
|
35
|
+
const declared = yield* args.workspace.skills.declaredByName("axm");
|
|
36
|
+
const installed = yield* args.workspace.skills.byName("axm");
|
|
37
|
+
const declaredSource = Option.match(declared, {
|
|
38
|
+
onNone: () => null,
|
|
39
|
+
onSome: ({ entry }) => entry.source,
|
|
40
|
+
});
|
|
41
|
+
if (!declaresOfficialAxmSkill({ declaredSource, installed })) {
|
|
42
|
+
return Option.none();
|
|
43
|
+
}
|
|
44
|
+
if (Option.isNone(installed)) {
|
|
45
|
+
const result = args.policy.evaluate({ fqn: AXM_SKILL_FQN, candidate: null });
|
|
46
|
+
if (result === null) {
|
|
47
|
+
return yield* Effect.die("AXM compatibility policy did not evaluate the official AXM skill");
|
|
48
|
+
}
|
|
49
|
+
return Option.some(result);
|
|
50
|
+
}
|
|
51
|
+
const installedSkill = installed.value;
|
|
52
|
+
const declaredEntry = installedSkill.installationOrigin._tag === "direct"
|
|
53
|
+
? installedSkill.installationOrigin.declared.entry
|
|
54
|
+
: null;
|
|
55
|
+
const source = declaredEntry?.source ??
|
|
56
|
+
Option.match(installedSkill.resolved, {
|
|
57
|
+
onNone: () => null,
|
|
58
|
+
onSome: ({ lockEntry }) => printSkillLockSourceLocator("axm", lockEntry),
|
|
59
|
+
});
|
|
60
|
+
const actual = installedSkill.actual.find((occurrence) => {
|
|
61
|
+
if (occurrence.origin._tag !== "canonical-axm-skill")
|
|
62
|
+
return false;
|
|
63
|
+
if (occurrence.packageRoot === null)
|
|
64
|
+
return false;
|
|
65
|
+
const skillDirectory = occurrence.packageRoot;
|
|
66
|
+
const skillsDirectory = args.platform.path.dirname(skillDirectory);
|
|
67
|
+
const ownerDirectory = args.platform.path.dirname(skillsDirectory);
|
|
68
|
+
const projectAuthored = args.platform.path.basename(skillDirectory) === "axm" &&
|
|
69
|
+
args.platform.path.basename(skillsDirectory) === "skills";
|
|
70
|
+
return args.workspace.scope === "project"
|
|
71
|
+
? projectAuthored
|
|
72
|
+
: projectAuthored && args.platform.path.basename(ownerDirectory) === "@agentxm";
|
|
73
|
+
});
|
|
74
|
+
if (actual === undefined) {
|
|
75
|
+
const result = args.policy.evaluate({ fqn: AXM_SKILL_FQN, candidate: null });
|
|
76
|
+
if (result === null) {
|
|
77
|
+
return yield* Effect.die("AXM compatibility policy did not evaluate the official AXM skill");
|
|
78
|
+
}
|
|
79
|
+
return Option.some(result);
|
|
80
|
+
}
|
|
81
|
+
const manifestContent = actual.packageRoot === null
|
|
82
|
+
? Option.none()
|
|
83
|
+
: yield* args.platform.fs
|
|
84
|
+
.readFileString(args.platform.path.join(actual.packageRoot, "skill.json"))
|
|
85
|
+
.pipe(Effect.option);
|
|
86
|
+
const skillContent = actual.sourcePath === null
|
|
87
|
+
? Option.none()
|
|
88
|
+
: yield* args.platform.fs.readFileString(actual.sourcePath).pipe(Effect.option);
|
|
89
|
+
const skill = Option.flatMap(skillContent, (content) => parseSkillMd(content, "axm"));
|
|
90
|
+
const installedManifestVersion = Option.match(manifestContent, {
|
|
91
|
+
onNone: () => null,
|
|
92
|
+
onSome: manifestVersion,
|
|
93
|
+
});
|
|
94
|
+
const candidate = {
|
|
95
|
+
manifestVersion: installedManifestVersion,
|
|
96
|
+
metadata: Option.match(skill, {
|
|
97
|
+
onNone: () => null,
|
|
98
|
+
onSome: (parsed) => Option.getOrNull(parsed.metadata),
|
|
99
|
+
}),
|
|
100
|
+
source: declaredEntry?.origin === "bundled"
|
|
101
|
+
? `bundled:${AXM_SKILL_FQN}${installedManifestVersion === null ? "" : `@${installedManifestVersion}`}`
|
|
102
|
+
: source,
|
|
103
|
+
};
|
|
104
|
+
const result = args.policy.evaluate({ fqn: AXM_SKILL_FQN, candidate });
|
|
105
|
+
if (result === null) {
|
|
106
|
+
return yield* Effect.die("AXM compatibility policy did not evaluate the official AXM skill");
|
|
107
|
+
}
|
|
108
|
+
return Option.some(result);
|
|
109
|
+
});
|
|
110
|
+
//# sourceMappingURL=axm-skill-workspace-compatibility.js.map
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configured-entry resolution: the requested source of every configured
|
|
3
|
+
* extension resolved to one accepted ref under the minimum-release-age
|
|
4
|
+
* policy, with the holdback and bypass evidence the operation records.
|
|
5
|
+
*
|
|
6
|
+
* @experimental This API is unstable and may change without notice.
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import type * as FileSystem from "effect/FileSystem";
|
|
10
|
+
import type * as HttpClient from "effect/unstable/http/HttpClient";
|
|
11
|
+
import type * as Path from "effect/Path";
|
|
12
|
+
import type * as Scope from "effect/Scope";
|
|
13
|
+
import * as DateTime from "effect/DateTime";
|
|
14
|
+
import * as Effect from "effect/Effect";
|
|
15
|
+
import * as Option from "effect/Option";
|
|
16
|
+
import type { ExtensionType } from "@agentxm/extension-model/unstable/extensions";
|
|
17
|
+
import type { HookExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/hook";
|
|
18
|
+
import type { KnowledgeExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/knowledge";
|
|
19
|
+
import type { McpServerExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/mcp-server";
|
|
20
|
+
import type { PackRef } from "@agentxm/extension-model/unstable/extensions/refs/pack";
|
|
21
|
+
import type { RuleExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/rule";
|
|
22
|
+
import type { SkillExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/skill";
|
|
23
|
+
import type { SubagentExtensionRef } from "@agentxm/extension-model/unstable/extensions/refs/subagent";
|
|
24
|
+
import type { ReleaseAgeEvaluation } from "@agentxm/extension-model/unstable/extensions/release-age";
|
|
25
|
+
import type { VersionRange } from "@agentxm/extension-model/unstable/version-constraints";
|
|
26
|
+
import { SourceHostProviders, WorkspaceCatalog } from "@agentxm/extension-sources";
|
|
27
|
+
import type { SourceResolutionFailure } from "@agentxm/extension-sources";
|
|
28
|
+
import { WorkspaceMutations } from "@agentxm/workspace-state";
|
|
29
|
+
import type { AcceptedCanonicalRefError } from "@agentxm/workspace-state";
|
|
30
|
+
import type { ConfiguredRegistryResolution } from "./configured-entry.js";
|
|
31
|
+
import { ExtensionResolutionFailed } from "./errors.js";
|
|
32
|
+
import type { ReleaseAgeBypassRecord, ReleaseAgeHoldbackRecord } from "./release-age-policy.js";
|
|
33
|
+
import { ReleaseAgePosture } from "./release-age-posture.js";
|
|
34
|
+
export declare const makeConfiguredReleaseAgeEvaluation: () => Effect.Effect<{
|
|
35
|
+
minimumReleaseAge: import("effect/Duration").Duration;
|
|
36
|
+
evaluatedAt: DateTime.Utc;
|
|
37
|
+
mode: import("./release-age-posture.js").ReleaseAgePostureValue;
|
|
38
|
+
exclude: readonly import("@agentxm/extension-model/unstable/extensions/release-age").ScopedReleaseAgeExcludePattern[];
|
|
39
|
+
}, ExtensionResolutionFailed | import("@agentxm/workspace-state").WorkspaceSettingsReadFailure, WorkspaceMutations | ReleaseAgePosture>;
|
|
40
|
+
export declare const resolveConfiguredRegistryEntry: (name: string, source: string, expectedType: ExtensionType, releaseAgeEvaluation: ReleaseAgeEvaluation) => Effect.Effect<Option.Option<ConfiguredRegistryResolution>, ExtensionResolutionFailed | SourceResolutionFailure | AcceptedCanonicalRefError, SourceHostProviders | WorkspaceCatalog | WorkspaceMutations | FileSystem.FileSystem | HttpClient.HttpClient | Path.Path | Scope.Scope>;
|
|
41
|
+
export declare const resolveConfiguredSkill: (name: string, source: string, releaseAgeEvaluation: ReleaseAgeEvaluation) => Effect.Effect<{
|
|
42
|
+
ref: import("@agentxm/extension-model/unstable/extensions/refs/skill").RegistrySkillRef;
|
|
43
|
+
versionRange: Option.Option<VersionRange>;
|
|
44
|
+
releaseAge?: {
|
|
45
|
+
readonly holdbacks: ReadonlyArray<ReleaseAgeHoldbackRecord>;
|
|
46
|
+
readonly bypasses: ReadonlyArray<ReleaseAgeBypassRecord>;
|
|
47
|
+
};
|
|
48
|
+
} | {
|
|
49
|
+
ref: SkillExtensionRef;
|
|
50
|
+
versionRange: Option.None<string & import("effect/Brand").Brand<"VersionRange">> | Option.Some<string & import("effect/Brand").Brand<"VersionRange">>;
|
|
51
|
+
}, ExtensionResolutionFailed | SourceResolutionFailure | AcceptedCanonicalRefError, Scope.Scope | WorkspaceMutations | FileSystem.FileSystem | Path.Path | SourceHostProviders | WorkspaceCatalog | HttpClient.HttpClient>;
|
|
52
|
+
export declare const resolveConfiguredSubagent: (name: string, source: string, releaseAgeEvaluation: ReleaseAgeEvaluation) => Effect.Effect<{
|
|
53
|
+
ref: import("@agentxm/extension-model/unstable/extensions/refs/subagent").RegistrySubagentRef;
|
|
54
|
+
versionRange: Option.Option<VersionRange>;
|
|
55
|
+
releaseAge?: {
|
|
56
|
+
readonly holdbacks: ReadonlyArray<ReleaseAgeHoldbackRecord>;
|
|
57
|
+
readonly bypasses: ReadonlyArray<ReleaseAgeBypassRecord>;
|
|
58
|
+
};
|
|
59
|
+
} | {
|
|
60
|
+
ref: SubagentExtensionRef;
|
|
61
|
+
versionRange: Option.None<string & import("effect/Brand").Brand<"VersionRange">> | Option.Some<string & import("effect/Brand").Brand<"VersionRange">>;
|
|
62
|
+
}, ExtensionResolutionFailed | SourceResolutionFailure | AcceptedCanonicalRefError, Scope.Scope | WorkspaceMutations | FileSystem.FileSystem | Path.Path | SourceHostProviders | WorkspaceCatalog | HttpClient.HttpClient>;
|
|
63
|
+
export declare const resolveConfiguredRule: (name: string, source: string, releaseAgeEvaluation: ReleaseAgeEvaluation) => Effect.Effect<{
|
|
64
|
+
ref: import("@agentxm/extension-model/unstable/extensions/refs/rule").RegistryRuleRef;
|
|
65
|
+
versionRange: Option.Option<VersionRange>;
|
|
66
|
+
releaseAge?: {
|
|
67
|
+
readonly holdbacks: ReadonlyArray<ReleaseAgeHoldbackRecord>;
|
|
68
|
+
readonly bypasses: ReadonlyArray<ReleaseAgeBypassRecord>;
|
|
69
|
+
};
|
|
70
|
+
} | {
|
|
71
|
+
ref: RuleExtensionRef;
|
|
72
|
+
versionRange: Option.None<string & import("effect/Brand").Brand<"VersionRange">> | Option.Some<string & import("effect/Brand").Brand<"VersionRange">>;
|
|
73
|
+
}, ExtensionResolutionFailed | SourceResolutionFailure | AcceptedCanonicalRefError, Scope.Scope | WorkspaceMutations | FileSystem.FileSystem | Path.Path | SourceHostProviders | WorkspaceCatalog | HttpClient.HttpClient>;
|
|
74
|
+
export declare const resolveConfiguredHook: (name: string, source: string, releaseAgeEvaluation: ReleaseAgeEvaluation) => Effect.Effect<{
|
|
75
|
+
ref: import("@agentxm/extension-model/unstable/extensions/refs/hook").RegistryHookRef;
|
|
76
|
+
versionRange: Option.Option<VersionRange>;
|
|
77
|
+
releaseAge?: {
|
|
78
|
+
readonly holdbacks: ReadonlyArray<ReleaseAgeHoldbackRecord>;
|
|
79
|
+
readonly bypasses: ReadonlyArray<ReleaseAgeBypassRecord>;
|
|
80
|
+
};
|
|
81
|
+
} | {
|
|
82
|
+
ref: HookExtensionRef;
|
|
83
|
+
versionRange: Option.None<string & import("effect/Brand").Brand<"VersionRange">> | Option.Some<string & import("effect/Brand").Brand<"VersionRange">>;
|
|
84
|
+
}, ExtensionResolutionFailed | SourceResolutionFailure | AcceptedCanonicalRefError, Scope.Scope | WorkspaceMutations | FileSystem.FileSystem | Path.Path | SourceHostProviders | WorkspaceCatalog | HttpClient.HttpClient>;
|
|
85
|
+
export declare const resolveConfiguredKnowledge: (name: string, source: string, releaseAgeEvaluation: ReleaseAgeEvaluation) => Effect.Effect<{
|
|
86
|
+
ref: import("@agentxm/extension-model/unstable/extensions/refs/knowledge").RegistryKnowledgeRef;
|
|
87
|
+
versionRange: Option.Option<VersionRange>;
|
|
88
|
+
releaseAge?: {
|
|
89
|
+
readonly holdbacks: ReadonlyArray<ReleaseAgeHoldbackRecord>;
|
|
90
|
+
readonly bypasses: ReadonlyArray<ReleaseAgeBypassRecord>;
|
|
91
|
+
};
|
|
92
|
+
} | {
|
|
93
|
+
ref: KnowledgeExtensionRef;
|
|
94
|
+
versionRange: Option.None<string & import("effect/Brand").Brand<"VersionRange">> | Option.Some<string & import("effect/Brand").Brand<"VersionRange">>;
|
|
95
|
+
}, ExtensionResolutionFailed | SourceResolutionFailure | AcceptedCanonicalRefError, Scope.Scope | WorkspaceMutations | FileSystem.FileSystem | Path.Path | SourceHostProviders | WorkspaceCatalog | HttpClient.HttpClient>;
|
|
96
|
+
export declare const resolveConfiguredMcpServer: (name: string, source: string, releaseAgeEvaluation: ReleaseAgeEvaluation) => Effect.Effect<{
|
|
97
|
+
ref: import("@agentxm/extension-model/unstable/extensions/refs/mcp-server").RegistryMcpServerRef;
|
|
98
|
+
versionRange: Option.Option<VersionRange>;
|
|
99
|
+
releaseAge?: {
|
|
100
|
+
readonly holdbacks: ReadonlyArray<ReleaseAgeHoldbackRecord>;
|
|
101
|
+
readonly bypasses: ReadonlyArray<ReleaseAgeBypassRecord>;
|
|
102
|
+
};
|
|
103
|
+
} | {
|
|
104
|
+
ref: McpServerExtensionRef;
|
|
105
|
+
versionRange: Option.Option<string & import("effect/Brand").Brand<"VersionRange">>;
|
|
106
|
+
}, ExtensionResolutionFailed | SourceResolutionFailure | AcceptedCanonicalRefError, Scope.Scope | WorkspaceMutations | FileSystem.FileSystem | Path.Path | SourceHostProviders | WorkspaceCatalog | HttpClient.HttpClient>;
|
|
107
|
+
export declare const resolveConfiguredPack: (name: string, source: string, releaseAgeEvaluation: ReleaseAgeEvaluation) => Effect.Effect<{
|
|
108
|
+
ref: import("@agentxm/extension-model/unstable/extensions/refs/pack").RegistryPackRef;
|
|
109
|
+
versionRange: Option.Option<VersionRange>;
|
|
110
|
+
releaseAge?: {
|
|
111
|
+
readonly holdbacks: ReadonlyArray<ReleaseAgeHoldbackRecord>;
|
|
112
|
+
readonly bypasses: ReadonlyArray<ReleaseAgeBypassRecord>;
|
|
113
|
+
};
|
|
114
|
+
} | {
|
|
115
|
+
ref: PackRef;
|
|
116
|
+
versionRange: Option.Option<string & import("effect/Brand").Brand<"VersionRange">>;
|
|
117
|
+
}, ExtensionResolutionFailed | SourceResolutionFailure | AcceptedCanonicalRefError, Scope.Scope | WorkspaceMutations | FileSystem.FileSystem | Path.Path | SourceHostProviders | WorkspaceCatalog | HttpClient.HttpClient>;
|
|
118
|
+
//# sourceMappingURL=configured-entry-resolution.d.ts.map
|