@agentxm/registry-protocol 0.30.2 → 0.31.1
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.
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* @experimental This API is unstable and may change without notice.
|
|
5
5
|
*/
|
|
6
6
|
export { type DiscoverPackagesResponse, DiscoverPackagesResponseSchema, type DiscoveryExtensionResult, DiscoveryExtensionResultSchema, type DiscoveryPackageResult, DiscoveryPackageResultSchema, type DiscoveryResolvedExtension, DiscoveryResolvedExtensionSchema, } from "./discover-schema.js";
|
|
7
|
-
export { MAX_PUBLICATION_SET_CANDIDATES, PUBLICATION_SET_CONTRACT, type PackDependencyDescriptor, type PackDependencyFinding, PackDependencyFindingSchema, type PreviewPublicationSetRequest, PreviewPublicationSetRequestSchema, type PreviewPublicationSetResponse, PreviewPublicationSetResponseSchema, type
|
|
7
|
+
export { MAX_PUBLICATION_SET_CANDIDATES, PUBLICATION_SET_CONTRACT, type PackDependencyDescriptor, type PackDependencyFinding, PackDependencyFindingSchema, type PreviewPublicationSetRequest, PreviewPublicationSetRequestSchema, type PreviewPublicationSetResponse, PreviewPublicationSetResponseSchema, type PublicationCandidateResult, type PublicationDescriptor, type PublicationPackResult, type PublicationTarget, type PublicationVisibilityInput, PublicationVisibilityInputSchema, type Sha256Hex, Sha256HexSchema, archiveSha256Hex, formatPackDependencyFinding, comparePublicationTargets, normalizePublicationDescriptor, normalizePublicationSet, publicationDescriptorDigest, publicationSetDigest, publicationTargetKey, validatePublicationDescriptors, validatePublicationSetResponse, } from "./publication-set.js";
|
|
8
8
|
export { type DeprecationManagementView, DeprecationManagementViewSchema, type DeprecationReplacementIntent, DeprecationReplacementIntentSchema, DeprecationRevisionSchema, type DeprecationTransition, DeprecationTransitionSchema, type ExtensionIndex, ExtensionIndexSchema, type VersionEntry, VersionEntrySchema, packagesToPackageUrlParts, } from "./schema.js";
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* @experimental This API is unstable and may change without notice.
|
|
5
5
|
*/
|
|
6
6
|
export { DiscoverPackagesResponseSchema, DiscoveryExtensionResultSchema, DiscoveryPackageResultSchema, DiscoveryResolvedExtensionSchema, } from "./discover-schema.js";
|
|
7
|
-
export { MAX_PUBLICATION_SET_CANDIDATES, PUBLICATION_SET_CONTRACT, PackDependencyFindingSchema, PreviewPublicationSetRequestSchema, PreviewPublicationSetResponseSchema, PublicationVisibilityInputSchema, Sha256HexSchema, archiveSha256Hex,
|
|
7
|
+
export { MAX_PUBLICATION_SET_CANDIDATES, PUBLICATION_SET_CONTRACT, PackDependencyFindingSchema, PreviewPublicationSetRequestSchema, PreviewPublicationSetResponseSchema, PublicationVisibilityInputSchema, Sha256HexSchema, archiveSha256Hex, formatPackDependencyFinding, comparePublicationTargets, normalizePublicationDescriptor, normalizePublicationSet, publicationDescriptorDigest, publicationSetDigest, publicationTargetKey, validatePublicationDescriptors, validatePublicationSetResponse, } from "./publication-set.js";
|
|
8
8
|
export { DeprecationManagementViewSchema, DeprecationReplacementIntentSchema, DeprecationRevisionSchema, DeprecationTransitionSchema, ExtensionIndexSchema, VersionEntrySchema, packagesToPackageUrlParts, } from "./schema.js";
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as Schema from "effect/Schema";
|
|
2
|
-
import
|
|
2
|
+
import type { PackDependencyPolicyFinding } from "@agentxm/extension-model/unstable/packs/dependency-policy";
|
|
3
|
+
import { type ExtensionName, type ExtensionType } from "@agentxm/extension-model/unstable/extensions/common";
|
|
3
4
|
import { type Handle } from "@agentxm/extension-model/unstable/extensions/handle";
|
|
4
|
-
import { VisibilityEvaluationSchema, VisibilityEvaluationUnavailableSchema } from "../publish/visibility.js";
|
|
5
5
|
import { type Version, type VersionRange } from "@agentxm/extension-model/unstable/version-constraints";
|
|
6
|
-
import { type DeprecationView } from "@agentxm/extension-model/unstable/extensions/deprecation";
|
|
7
6
|
export declare const PUBLICATION_SET_CONTRACT: "publication-set-v2";
|
|
8
7
|
export declare const MAX_PUBLICATION_SET_CANDIDATES = 100;
|
|
9
8
|
export declare const Sha256HexSchema: Schema.String;
|
|
@@ -117,6 +116,8 @@ export declare const PackDependencyFindingSchema: Schema.Struct<{
|
|
|
117
116
|
}>>;
|
|
118
117
|
}>;
|
|
119
118
|
export type PackDependencyFinding = typeof PackDependencyFindingSchema.Type;
|
|
119
|
+
/** Encode domain findings without deciding pack admission or version selection. */
|
|
120
|
+
export declare const formatPackDependencyFinding: (finding: PackDependencyPolicyFinding) => PackDependencyFinding;
|
|
120
121
|
export declare const PreviewPublicationSetResponseSchema: Schema.Struct<{
|
|
121
122
|
readonly contract: Schema.Literal<"publication-set-v2">;
|
|
122
123
|
readonly publicationSetDigest: Schema.String;
|
|
@@ -248,29 +249,6 @@ export declare const PreviewPublicationSetResponseSchema: Schema.Struct<{
|
|
|
248
249
|
export type PreviewPublicationSetResponse = typeof PreviewPublicationSetResponseSchema.Type;
|
|
249
250
|
export type PublicationCandidateResult = PreviewPublicationSetResponse["candidates"][number];
|
|
250
251
|
export type PublicationPackResult = PreviewPublicationSetResponse["packs"][number];
|
|
251
|
-
export interface PublicationDependencyVersionSnapshot {
|
|
252
|
-
readonly version: string;
|
|
253
|
-
readonly status: string;
|
|
254
|
-
readonly yanked: boolean;
|
|
255
|
-
readonly purged: boolean;
|
|
256
|
-
}
|
|
257
|
-
export interface PublicationDependencySnapshot {
|
|
258
|
-
readonly dependency: PackDependencyDescriptor;
|
|
259
|
-
readonly exists: boolean;
|
|
260
|
-
readonly visibility: string | null;
|
|
261
|
-
readonly lifecycleState: string | null;
|
|
262
|
-
readonly deprecation: DeprecationView | null;
|
|
263
|
-
readonly versions: ReadonlyArray<PublicationDependencyVersionSnapshot>;
|
|
264
|
-
}
|
|
265
|
-
export type ProspectivePublicationCandidate = {
|
|
266
|
-
readonly descriptor: PublicationDescriptor;
|
|
267
|
-
readonly kind: "resolved";
|
|
268
|
-
readonly visibility: typeof VisibilityEvaluationSchema.Type;
|
|
269
|
-
} | {
|
|
270
|
-
readonly descriptor: PublicationDescriptor;
|
|
271
|
-
readonly kind: "unavailable";
|
|
272
|
-
readonly visibility: typeof VisibilityEvaluationUnavailableSchema.Type;
|
|
273
|
-
};
|
|
274
252
|
export declare const comparePublicationTargets: (left: PublicationTarget, right: PublicationTarget) => number;
|
|
275
253
|
export declare const normalizePublicationDescriptor: (descriptor: PublicationDescriptor) => PublicationDescriptor;
|
|
276
254
|
export declare const normalizePublicationSet: (descriptors: ReadonlyArray<PublicationDescriptor>) => ReadonlyArray<PublicationDescriptor>;
|
|
@@ -279,25 +257,5 @@ export declare const publicationSetDigest: (descriptors: ReadonlyArray<Publicati
|
|
|
279
257
|
export declare const archiveSha256Hex: (archive: Uint8Array) => Sha256Hex;
|
|
280
258
|
export declare const publicationTargetKey: (target: PublicationTarget) => string;
|
|
281
259
|
export declare const validatePublicationDescriptors: (descriptors: ReadonlyArray<PublicationDescriptor>) => ReadonlyArray<PublicationDescriptor>;
|
|
282
|
-
export declare const evaluateProspectivePackDependencies: (input: {
|
|
283
|
-
readonly packVisibility: ExtensionVisibility;
|
|
284
|
-
readonly dependencies: ReadonlyArray<PackDependencyDescriptor>;
|
|
285
|
-
readonly snapshots: ReadonlyArray<PublicationDependencySnapshot>;
|
|
286
|
-
readonly candidates: ReadonlyArray<ProspectivePublicationCandidate>;
|
|
287
|
-
}) => ReadonlyArray<PackDependencyFinding>;
|
|
288
|
-
export interface ProspectivePackDependencyState {
|
|
289
|
-
readonly findings: ReadonlyArray<PackDependencyFinding>;
|
|
290
|
-
readonly resolutions: PublicationPackResult["resolutions"];
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Evaluate dependency admission and expose the exact version an ordinary
|
|
294
|
-
* Registry consumer would resolve from the same prospective snapshot.
|
|
295
|
-
*/
|
|
296
|
-
export declare const evaluateProspectivePackDependencyState: (input: {
|
|
297
|
-
readonly packVisibility: ExtensionVisibility;
|
|
298
|
-
readonly dependencies: ReadonlyArray<PackDependencyDescriptor>;
|
|
299
|
-
readonly snapshots: ReadonlyArray<PublicationDependencySnapshot>;
|
|
300
|
-
readonly candidates: ReadonlyArray<ProspectivePublicationCandidate>;
|
|
301
|
-
}) => ProspectivePackDependencyState;
|
|
302
260
|
export declare const validatePublicationSetResponse: (descriptors: ReadonlyArray<PublicationDescriptor>, response: PreviewPublicationSetResponse) => PreviewPublicationSetResponse;
|
|
303
261
|
//# sourceMappingURL=publication-set.d.ts.map
|
|
@@ -7,7 +7,7 @@ import { formatFqn } from "@agentxm/extension-model/unstable/extensions/fqn";
|
|
|
7
7
|
import { HandleSchema } from "@agentxm/extension-model/unstable/extensions/handle";
|
|
8
8
|
import { VisibilityEvaluationSchema, VisibilityEvaluationUnavailableSchema, VisibilityIntentSchema, } from "../publish/visibility.js";
|
|
9
9
|
import { VersionRangeSchema, VersionSchema, } from "@agentxm/extension-model/unstable/version-constraints";
|
|
10
|
-
import { DeprecationViewSchema
|
|
10
|
+
import { DeprecationViewSchema } from "@agentxm/extension-model/unstable/extensions/deprecation";
|
|
11
11
|
export const PUBLICATION_SET_CONTRACT = "publication-set-v2";
|
|
12
12
|
export const MAX_PUBLICATION_SET_CANDIDATES = 100;
|
|
13
13
|
export const Sha256HexSchema = Schema.String.check(Schema.isPattern(/^[a-f0-9]{64}$/)).annotate({
|
|
@@ -67,6 +67,104 @@ export const PackDependencyFindingSchema = Schema.Struct({
|
|
|
67
67
|
message: Schema.String,
|
|
68
68
|
suggestions: Schema.Array(SuggestedActionSchema),
|
|
69
69
|
}).annotate({ identifier: "PackDependencyFinding" });
|
|
70
|
+
const packDependencyGuidance = (finding) => {
|
|
71
|
+
const fqn = formatFqn(finding.dependency);
|
|
72
|
+
switch (finding.reason) {
|
|
73
|
+
case "missing":
|
|
74
|
+
return {
|
|
75
|
+
explanation: "that extension does not exist in the registry",
|
|
76
|
+
suggestions: [
|
|
77
|
+
{
|
|
78
|
+
description: `Publish ${fqn} or correct the dependency identity`,
|
|
79
|
+
cmd: `axm publish ${fqn}`,
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
};
|
|
83
|
+
case "not-public":
|
|
84
|
+
return {
|
|
85
|
+
explanation: "that extension is not public",
|
|
86
|
+
suggestions: [{ description: `Make ${fqn} public or depend on a public extension` }],
|
|
87
|
+
};
|
|
88
|
+
case "selected-unavailable":
|
|
89
|
+
return {
|
|
90
|
+
explanation: "that selected target is unavailable",
|
|
91
|
+
suggestions: [
|
|
92
|
+
{
|
|
93
|
+
description: `Verify authority and availability for ${fqn}, then preview the complete set again`,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
};
|
|
97
|
+
case "selected-new-private":
|
|
98
|
+
return {
|
|
99
|
+
explanation: "the selected dependency will remain private",
|
|
100
|
+
suggestions: [
|
|
101
|
+
{
|
|
102
|
+
description: `Publish ${fqn} as public, then preview the complete set again`,
|
|
103
|
+
cmd: `axm publish ${fqn} --visibility public`,
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
};
|
|
107
|
+
case "selected-existing-private":
|
|
108
|
+
return {
|
|
109
|
+
explanation: "the selected dependency will remain private",
|
|
110
|
+
suggestions: [
|
|
111
|
+
{ description: `Make ${fqn} public explicitly, then preview the complete set again` },
|
|
112
|
+
],
|
|
113
|
+
};
|
|
114
|
+
case "lifecycle-unavailable":
|
|
115
|
+
return {
|
|
116
|
+
explanation: "that extension is not active",
|
|
117
|
+
suggestions: [{ description: `Restore ${fqn} to active state or remove it from the pack` }],
|
|
118
|
+
};
|
|
119
|
+
case "no-installable-version":
|
|
120
|
+
return {
|
|
121
|
+
explanation: "it has no installable versions",
|
|
122
|
+
suggestions: [
|
|
123
|
+
{
|
|
124
|
+
description: `Publish an installable version of ${fqn} or remove it from the pack`,
|
|
125
|
+
cmd: `axm publish ${fqn}`,
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
};
|
|
129
|
+
case "range-unsatisfied":
|
|
130
|
+
return {
|
|
131
|
+
explanation: "no installable version satisfies the requested range",
|
|
132
|
+
suggestions: [
|
|
133
|
+
{
|
|
134
|
+
description: `Publish a version of ${fqn} satisfying "${finding.dependency.range}" or correct the requested range`,
|
|
135
|
+
cmd: `axm publish ${fqn}`,
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
};
|
|
139
|
+
case "deprecated":
|
|
140
|
+
return {
|
|
141
|
+
explanation: "resolves to a deprecated extension",
|
|
142
|
+
suggestions: [
|
|
143
|
+
{ description: `Prefer a supported replacement for ${fqn} when one is available` },
|
|
144
|
+
],
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
/** Encode domain findings without deciding pack admission or version selection. */
|
|
149
|
+
export const formatPackDependencyFinding = (finding) => {
|
|
150
|
+
const { reason, ...facts } = finding;
|
|
151
|
+
const guidance = packDependencyGuidance(finding);
|
|
152
|
+
const subject = `Dependency ${formatFqn(finding.dependency)} requests range "${finding.dependency.range}"`;
|
|
153
|
+
return {
|
|
154
|
+
...facts,
|
|
155
|
+
kind: "advisory",
|
|
156
|
+
ruleId: reason === "deprecated" ? "pack/dependency-deprecated" : "pack/dependency-version-resolvable",
|
|
157
|
+
reason: reason === "missing" || reason === "not-public" || reason === "selected-unavailable"
|
|
158
|
+
? "target-unavailable"
|
|
159
|
+
: reason,
|
|
160
|
+
location: { file: "pack.json" },
|
|
161
|
+
path: "./pack.json",
|
|
162
|
+
message: reason === "deprecated"
|
|
163
|
+
? `${subject} and ${guidance.explanation}.`
|
|
164
|
+
: `${subject}, but ${guidance.explanation}.`,
|
|
165
|
+
suggestions: guidance.suggestions,
|
|
166
|
+
};
|
|
167
|
+
};
|
|
70
168
|
const ResolvedPublicationCandidateSchema = Schema.Struct({
|
|
71
169
|
kind: Schema.Literal("resolved"),
|
|
72
170
|
target: PublicationTargetSchema,
|
|
@@ -163,267 +261,7 @@ export const validatePublicationDescriptors = (descriptors) => {
|
|
|
163
261
|
}
|
|
164
262
|
return normalizePublicationSet(descriptors);
|
|
165
263
|
};
|
|
166
|
-
const findingBase = (finding) => ({
|
|
167
|
-
kind: "advisory",
|
|
168
|
-
location: { file: "pack.json" },
|
|
169
|
-
path: "./pack.json",
|
|
170
|
-
...finding,
|
|
171
|
-
});
|
|
172
|
-
const dependencyError = (input) => {
|
|
173
|
-
const fqn = formatFqn(input.snapshot.dependency);
|
|
174
|
-
return findingBase({
|
|
175
|
-
ruleId: "pack/dependency-version-resolvable",
|
|
176
|
-
severity: "error",
|
|
177
|
-
reason: input.reason,
|
|
178
|
-
dependency: input.snapshot.dependency,
|
|
179
|
-
...(input.discloseState !== true
|
|
180
|
-
? {}
|
|
181
|
-
: {
|
|
182
|
-
...(input.snapshot.visibility === "public" || input.snapshot.visibility === "private"
|
|
183
|
-
? { effectiveVisibility: input.snapshot.visibility }
|
|
184
|
-
: {}),
|
|
185
|
-
...(input.snapshot.lifecycleState === null
|
|
186
|
-
? {}
|
|
187
|
-
: { lifecycle: input.snapshot.lifecycleState === "active" ? "active" : "unavailable" }),
|
|
188
|
-
}),
|
|
189
|
-
message: `Dependency ${fqn} requests range "${input.snapshot.dependency.range}", but ${input.explanation}.`,
|
|
190
|
-
suggestions: input.suggestions,
|
|
191
|
-
});
|
|
192
|
-
};
|
|
193
|
-
const evaluateDependencySnapshot = (snapshot, packVisibility) => {
|
|
194
|
-
const fqn = formatFqn(snapshot.dependency);
|
|
195
|
-
if (!snapshot.exists) {
|
|
196
|
-
return [
|
|
197
|
-
dependencyError({
|
|
198
|
-
snapshot,
|
|
199
|
-
reason: "target-unavailable",
|
|
200
|
-
explanation: "that extension does not exist in the registry",
|
|
201
|
-
suggestions: [
|
|
202
|
-
{
|
|
203
|
-
description: `Publish ${fqn} or correct the dependency identity`,
|
|
204
|
-
cmd: `axm publish ${fqn}`,
|
|
205
|
-
},
|
|
206
|
-
],
|
|
207
|
-
}),
|
|
208
|
-
];
|
|
209
|
-
}
|
|
210
|
-
if (packVisibility === "public" && snapshot.visibility !== "public") {
|
|
211
|
-
return [
|
|
212
|
-
dependencyError({
|
|
213
|
-
snapshot,
|
|
214
|
-
reason: "target-unavailable",
|
|
215
|
-
explanation: "that extension is not public",
|
|
216
|
-
suggestions: [{ description: `Make ${fqn} public or depend on a public extension` }],
|
|
217
|
-
}),
|
|
218
|
-
];
|
|
219
|
-
}
|
|
220
|
-
if (snapshot.lifecycleState !== "active") {
|
|
221
|
-
return [
|
|
222
|
-
dependencyError({
|
|
223
|
-
snapshot,
|
|
224
|
-
reason: "lifecycle-unavailable",
|
|
225
|
-
explanation: "that extension is not active",
|
|
226
|
-
discloseState: true,
|
|
227
|
-
suggestions: [{ description: `Restore ${fqn} to active state or remove it from the pack` }],
|
|
228
|
-
}),
|
|
229
|
-
];
|
|
230
|
-
}
|
|
231
|
-
const installable = snapshot.versions.filter((version) => version.status === "available" && !version.yanked && !version.purged);
|
|
232
|
-
if (installable.length === 0) {
|
|
233
|
-
return [
|
|
234
|
-
dependencyError({
|
|
235
|
-
snapshot,
|
|
236
|
-
reason: "no-installable-version",
|
|
237
|
-
explanation: "it has no installable versions",
|
|
238
|
-
discloseState: true,
|
|
239
|
-
suggestions: [
|
|
240
|
-
{
|
|
241
|
-
description: `Publish an installable version of ${fqn} or remove it from the pack`,
|
|
242
|
-
cmd: `axm publish ${fqn}`,
|
|
243
|
-
},
|
|
244
|
-
],
|
|
245
|
-
}),
|
|
246
|
-
];
|
|
247
|
-
}
|
|
248
|
-
if (!installable.some((candidate) => semver.satisfies(candidate.version, snapshot.dependency.range))) {
|
|
249
|
-
return [
|
|
250
|
-
dependencyError({
|
|
251
|
-
snapshot,
|
|
252
|
-
reason: "range-unsatisfied",
|
|
253
|
-
explanation: "no installable version satisfies the requested range",
|
|
254
|
-
discloseState: true,
|
|
255
|
-
suggestions: [
|
|
256
|
-
{
|
|
257
|
-
description: `Publish a version of ${fqn} satisfying "${snapshot.dependency.range}" or correct the requested range`,
|
|
258
|
-
cmd: `axm publish ${fqn}`,
|
|
259
|
-
},
|
|
260
|
-
],
|
|
261
|
-
}),
|
|
262
|
-
];
|
|
263
|
-
}
|
|
264
|
-
return snapshot.deprecation !== null
|
|
265
|
-
? [
|
|
266
|
-
findingBase({
|
|
267
|
-
ruleId: "pack/dependency-deprecated",
|
|
268
|
-
severity: "warning",
|
|
269
|
-
reason: "deprecated",
|
|
270
|
-
dependency: snapshot.dependency,
|
|
271
|
-
effectiveVisibility: snapshot.visibility === "private" ? "private" : "public",
|
|
272
|
-
lifecycle: "active",
|
|
273
|
-
deprecation: snapshot.deprecation,
|
|
274
|
-
message: `Dependency ${fqn} requests range "${snapshot.dependency.range}" and resolves to a deprecated extension.`,
|
|
275
|
-
suggestions: [
|
|
276
|
-
{ description: `Prefer a supported replacement for ${fqn} when one is available` },
|
|
277
|
-
],
|
|
278
|
-
}),
|
|
279
|
-
]
|
|
280
|
-
: [];
|
|
281
|
-
};
|
|
282
264
|
const dependencyIdentityKey = (dependency) => `${dependency.owner}\u0000${dependency.type}\u0000${dependency.name}`;
|
|
283
|
-
export const evaluateProspectivePackDependencies = (input) => {
|
|
284
|
-
const snapshots = new Map(input.snapshots.map((snapshot) => [dependencyIdentityKey(snapshot.dependency), snapshot]));
|
|
285
|
-
const candidates = new Map(input.candidates.map((candidate) => [
|
|
286
|
-
publicationIdentityKey(candidate.descriptor.target),
|
|
287
|
-
candidate,
|
|
288
|
-
]));
|
|
289
|
-
return input.dependencies
|
|
290
|
-
.flatMap((dependency) => {
|
|
291
|
-
const current = snapshots.get(dependencyIdentityKey(dependency)) ??
|
|
292
|
-
{
|
|
293
|
-
dependency,
|
|
294
|
-
exists: false,
|
|
295
|
-
visibility: null,
|
|
296
|
-
lifecycleState: null,
|
|
297
|
-
deprecation: null,
|
|
298
|
-
versions: [],
|
|
299
|
-
};
|
|
300
|
-
const selected = candidates.get(dependencyIdentityKey(dependency));
|
|
301
|
-
if (selected === undefined)
|
|
302
|
-
return evaluateDependencySnapshot(current, input.packVisibility);
|
|
303
|
-
if (selected.kind === "unavailable") {
|
|
304
|
-
return [
|
|
305
|
-
dependencyError({
|
|
306
|
-
snapshot: current,
|
|
307
|
-
reason: "target-unavailable",
|
|
308
|
-
explanation: "that selected target is unavailable",
|
|
309
|
-
suggestions: [
|
|
310
|
-
{
|
|
311
|
-
description: `Verify authority and availability for ${formatFqn(dependency)}, then preview the complete set again`,
|
|
312
|
-
},
|
|
313
|
-
],
|
|
314
|
-
}),
|
|
315
|
-
];
|
|
316
|
-
}
|
|
317
|
-
if (input.packVisibility === "public" && selected.visibility.resolved?.value === "private") {
|
|
318
|
-
return [
|
|
319
|
-
dependencyError({
|
|
320
|
-
snapshot: { ...current, exists: true, visibility: "private" },
|
|
321
|
-
reason: current.exists ? "selected-existing-private" : "selected-new-private",
|
|
322
|
-
explanation: "the selected dependency will remain private",
|
|
323
|
-
discloseState: true,
|
|
324
|
-
suggestions: current.exists
|
|
325
|
-
? [
|
|
326
|
-
{
|
|
327
|
-
description: `Make ${formatFqn(dependency)} public explicitly, then preview the complete set again`,
|
|
328
|
-
},
|
|
329
|
-
]
|
|
330
|
-
: [
|
|
331
|
-
{
|
|
332
|
-
description: `Publish ${formatFqn(dependency)} as public, then preview the complete set again`,
|
|
333
|
-
cmd: `axm publish ${formatFqn(dependency)} --visibility public`,
|
|
334
|
-
},
|
|
335
|
-
],
|
|
336
|
-
}),
|
|
337
|
-
];
|
|
338
|
-
}
|
|
339
|
-
return evaluateDependencySnapshot({
|
|
340
|
-
...current,
|
|
341
|
-
exists: true,
|
|
342
|
-
visibility: selected.visibility.resolved?.value ?? current.visibility,
|
|
343
|
-
lifecycleState: current.exists ? current.lifecycleState : "active",
|
|
344
|
-
versions: selected.descriptor.participation === "publish"
|
|
345
|
-
? [
|
|
346
|
-
...current.versions,
|
|
347
|
-
{
|
|
348
|
-
version: selected.descriptor.target.version,
|
|
349
|
-
status: "available",
|
|
350
|
-
yanked: false,
|
|
351
|
-
purged: false,
|
|
352
|
-
},
|
|
353
|
-
]
|
|
354
|
-
: current.versions,
|
|
355
|
-
}, input.packVisibility);
|
|
356
|
-
})
|
|
357
|
-
.sort((left, right) => compareText(formatFqn(left.dependency), formatFqn(right.dependency)) ||
|
|
358
|
-
compareText(left.dependency.range, right.dependency.range));
|
|
359
|
-
};
|
|
360
|
-
/**
|
|
361
|
-
* Evaluate dependency admission and expose the exact version an ordinary
|
|
362
|
-
* Registry consumer would resolve from the same prospective snapshot.
|
|
363
|
-
*/
|
|
364
|
-
export const evaluateProspectivePackDependencyState = (input) => {
|
|
365
|
-
const findings = evaluateProspectivePackDependencies(input);
|
|
366
|
-
const snapshots = new Map(input.snapshots.map((snapshot) => [dependencyIdentityKey(snapshot.dependency), snapshot]));
|
|
367
|
-
const candidates = new Map(input.candidates.map((candidate) => [
|
|
368
|
-
publicationIdentityKey(candidate.descriptor.target),
|
|
369
|
-
candidate,
|
|
370
|
-
]));
|
|
371
|
-
const resolutions = input.dependencies.flatMap((dependency) => {
|
|
372
|
-
const current = snapshots.get(dependencyIdentityKey(dependency)) ??
|
|
373
|
-
{
|
|
374
|
-
dependency,
|
|
375
|
-
exists: false,
|
|
376
|
-
visibility: null,
|
|
377
|
-
lifecycleState: null,
|
|
378
|
-
deprecation: null,
|
|
379
|
-
versions: [],
|
|
380
|
-
};
|
|
381
|
-
const selected = candidates.get(dependencyIdentityKey(dependency));
|
|
382
|
-
if (selected?.kind === "unavailable" ||
|
|
383
|
-
(input.packVisibility === "public" && selected?.visibility.resolved?.value === "private")) {
|
|
384
|
-
return [];
|
|
385
|
-
}
|
|
386
|
-
const prospective = selected === undefined
|
|
387
|
-
? current
|
|
388
|
-
: {
|
|
389
|
-
...current,
|
|
390
|
-
exists: true,
|
|
391
|
-
visibility: selected.visibility.resolved?.value ?? current.visibility,
|
|
392
|
-
lifecycleState: current.exists ? current.lifecycleState : "active",
|
|
393
|
-
versions: selected.descriptor.participation === "publish"
|
|
394
|
-
? [
|
|
395
|
-
...current.versions,
|
|
396
|
-
{
|
|
397
|
-
version: selected.descriptor.target.version,
|
|
398
|
-
status: "available",
|
|
399
|
-
yanked: false,
|
|
400
|
-
purged: false,
|
|
401
|
-
},
|
|
402
|
-
]
|
|
403
|
-
: current.versions,
|
|
404
|
-
};
|
|
405
|
-
if (!prospective.exists ||
|
|
406
|
-
(input.packVisibility === "public" && prospective.visibility !== "public") ||
|
|
407
|
-
prospective.lifecycleState !== "active") {
|
|
408
|
-
return [];
|
|
409
|
-
}
|
|
410
|
-
const effectiveVersion = semver.maxSatisfying(prospective.versions
|
|
411
|
-
.filter((version) => version.status === "available" && !version.yanked && !version.purged)
|
|
412
|
-
.map((version) => version.version), dependency.range);
|
|
413
|
-
return effectiveVersion === null
|
|
414
|
-
? []
|
|
415
|
-
: [
|
|
416
|
-
{
|
|
417
|
-
dependency,
|
|
418
|
-
effectiveVersion: Schema.decodeUnknownSync(VersionSchema)(effectiveVersion),
|
|
419
|
-
},
|
|
420
|
-
];
|
|
421
|
-
});
|
|
422
|
-
return {
|
|
423
|
-
findings,
|
|
424
|
-
resolutions: [...resolutions].sort((left, right) => compareDependencies(left.dependency, right.dependency)),
|
|
425
|
-
};
|
|
426
|
-
};
|
|
427
265
|
export const validatePublicationSetResponse = (descriptors, response) => {
|
|
428
266
|
const normalized = validatePublicationDescriptors(descriptors);
|
|
429
267
|
const expectedDigest = publicationSetDigest(normalized);
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"url": "https://github.com/agentxm/axm/issues"
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@agentxm/extension-model": "^0.
|
|
7
|
+
"@agentxm/extension-model": "^0.31.1",
|
|
8
8
|
"effect": "4.0.0-rc.115",
|
|
9
9
|
"semver": "^7.8.5"
|
|
10
10
|
},
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"url": "https://github.com/agentxm/axm.git"
|
|
73
73
|
},
|
|
74
74
|
"type": "module",
|
|
75
|
-
"version": "0.
|
|
75
|
+
"version": "0.31.1"
|
|
76
76
|
}
|