@agentxm/registry-protocol 0.30.2 → 0.31.1-preview.35375320215.681db72976f8
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/README.md +2 -3
- package/dist/src/unstable/human-handoff.d.ts +1 -1
- package/dist/src/unstable/human-handoff.js +1 -1
- package/dist/src/unstable/registry/discover-schema.d.ts +4 -4
- package/dist/src/unstable/registry/index.d.ts +1 -1
- package/dist/src/unstable/registry/index.js +1 -1
- package/dist/src/unstable/registry/publication-set.d.ts +4 -46
- package/dist/src/unstable/registry/publication-set.js +99 -261
- package/package.json +2 -6
- package/dist/src/unstable/publish-authorization.d.ts +0 -26
- package/dist/src/unstable/publish-authorization.js +0 -41
package/README.md
CHANGED
|
@@ -5,14 +5,13 @@ implementation must interpret identically: extension index and version entry
|
|
|
5
5
|
schemas (`./unstable/registry/schema`), discovery responses
|
|
6
6
|
(`./unstable/registry/discover-schema`), publication-set preview and
|
|
7
7
|
validation (`./unstable/registry/publication-set`), publish visibility
|
|
8
|
-
(`./unstable/publish`),
|
|
9
|
-
(`./unstable/publish-authorization`), and the shared suggested-action and
|
|
8
|
+
(`./unstable/publish`), and the shared suggested-action and
|
|
10
9
|
human-handoff error vocabulary (`./unstable/suggested-action`,
|
|
11
10
|
`./unstable/human-handoff`).
|
|
12
11
|
|
|
13
12
|
Content parsing, Knowledge inspection, the lint catalog, and archive and
|
|
14
13
|
manifest validation live in `@agentxm/extension-content`; version selection
|
|
15
|
-
and release-age policy live in `@agentxm/
|
|
14
|
+
and release-age policy live in `@agentxm/workspace/resolution`.
|
|
16
15
|
|
|
17
16
|
Every export lives under an explicit `./unstable/*` subpath: the surface is
|
|
18
17
|
unsupported and may change in any release. Ordinary users should use the
|
|
@@ -2,7 +2,7 @@ import * as Schema from "effect/Schema";
|
|
|
2
2
|
/** Public references describe pending work; they never convey exchange authority. */
|
|
3
3
|
export declare const HumanHandoffActionSchema: Schema.Struct<{
|
|
4
4
|
readonly kind: Schema.Literal<"open-url">;
|
|
5
|
-
readonly purpose: Schema.Literals<readonly ["login", "step-up"
|
|
5
|
+
readonly purpose: Schema.Literals<readonly ["login", "step-up"]>;
|
|
6
6
|
readonly requestRef: Schema.String;
|
|
7
7
|
readonly registryUrl: Schema.String;
|
|
8
8
|
readonly url: Schema.String;
|
|
@@ -2,7 +2,7 @@ import * as Schema from "effect/Schema";
|
|
|
2
2
|
/** Public references describe pending work; they never convey exchange authority. */
|
|
3
3
|
export const HumanHandoffActionSchema = Schema.Struct({
|
|
4
4
|
kind: Schema.Literal("open-url"),
|
|
5
|
-
purpose: Schema.Literals(["login", "step-up"
|
|
5
|
+
purpose: Schema.Literals(["login", "step-up"]),
|
|
6
6
|
requestRef: Schema.String,
|
|
7
7
|
registryUrl: Schema.String,
|
|
8
8
|
url: Schema.String,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import * as Schema from "effect/Schema";
|
|
7
7
|
export declare const DiscoveryResolvedExtensionSchema: Schema.Struct<{
|
|
8
8
|
readonly owner: Schema.Union<readonly [Schema.brand<Schema.String, "Handle">, Schema.brand<Schema.String, "Slug">]>;
|
|
9
|
-
readonly type: Schema.Literals<readonly ("skill" | "mcp-server" | "subagent" | "rule" | "hook" | "knowledge" | "pack" | "
|
|
9
|
+
readonly type: Schema.Literals<readonly ("skill" | "mcp-server" | "subagent" | "rule" | "hook" | "knowledge" | "pack" | "skills" | "mcps" | "subagents" | "rules" | "hooks" | "packs")[]>;
|
|
10
10
|
readonly name: Schema.brand<Schema.NonEmptyString, "ExtensionName">;
|
|
11
11
|
readonly installVersion: Schema.brand<Schema.String, "Version">;
|
|
12
12
|
}>;
|
|
@@ -16,7 +16,7 @@ export declare const DiscoveryExtensionResultSchema: Schema.Struct<{
|
|
|
16
16
|
readonly resolved: Schema.Boolean;
|
|
17
17
|
readonly extension: Schema.optional<Schema.Struct<{
|
|
18
18
|
readonly owner: Schema.Union<readonly [Schema.brand<Schema.String, "Handle">, Schema.brand<Schema.String, "Slug">]>;
|
|
19
|
-
readonly type: Schema.Literals<readonly ("skill" | "mcp-server" | "subagent" | "rule" | "hook" | "knowledge" | "pack" | "
|
|
19
|
+
readonly type: Schema.Literals<readonly ("skill" | "mcp-server" | "subagent" | "rule" | "hook" | "knowledge" | "pack" | "skills" | "mcps" | "subagents" | "rules" | "hooks" | "packs")[]>;
|
|
20
20
|
readonly name: Schema.brand<Schema.NonEmptyString, "ExtensionName">;
|
|
21
21
|
readonly installVersion: Schema.brand<Schema.String, "Version">;
|
|
22
22
|
}>>;
|
|
@@ -34,7 +34,7 @@ export declare const DiscoveryPackageResultSchema: Schema.Struct<{
|
|
|
34
34
|
readonly resolved: Schema.Boolean;
|
|
35
35
|
readonly extension: Schema.optional<Schema.Struct<{
|
|
36
36
|
readonly owner: Schema.Union<readonly [Schema.brand<Schema.String, "Handle">, Schema.brand<Schema.String, "Slug">]>;
|
|
37
|
-
readonly type: Schema.Literals<readonly ("skill" | "mcp-server" | "subagent" | "rule" | "hook" | "knowledge" | "pack" | "
|
|
37
|
+
readonly type: Schema.Literals<readonly ("skill" | "mcp-server" | "subagent" | "rule" | "hook" | "knowledge" | "pack" | "skills" | "mcps" | "subagents" | "rules" | "hooks" | "packs")[]>;
|
|
38
38
|
readonly name: Schema.brand<Schema.NonEmptyString, "ExtensionName">;
|
|
39
39
|
readonly installVersion: Schema.brand<Schema.String, "Version">;
|
|
40
40
|
}>>;
|
|
@@ -54,7 +54,7 @@ export declare const DiscoverPackagesResponseSchema: Schema.Struct<{
|
|
|
54
54
|
readonly resolved: Schema.Boolean;
|
|
55
55
|
readonly extension: Schema.optional<Schema.Struct<{
|
|
56
56
|
readonly owner: Schema.Union<readonly [Schema.brand<Schema.String, "Handle">, Schema.brand<Schema.String, "Slug">]>;
|
|
57
|
-
readonly type: Schema.Literals<readonly ("skill" | "mcp-server" | "subagent" | "rule" | "hook" | "knowledge" | "pack" | "
|
|
57
|
+
readonly type: Schema.Literals<readonly ("skill" | "mcp-server" | "subagent" | "rule" | "hook" | "knowledge" | "pack" | "skills" | "mcps" | "subagents" | "rules" | "hooks" | "packs")[]>;
|
|
58
58
|
readonly name: Schema.brand<Schema.NonEmptyString, "ExtensionName">;
|
|
59
59
|
readonly installVersion: Schema.brand<Schema.String, "Version">;
|
|
60
60
|
}>>;
|
|
@@ -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-preview.35375320215.681db72976f8",
|
|
8
8
|
"effect": "4.0.0-rc.115",
|
|
9
9
|
"semver": "^7.8.5"
|
|
10
10
|
},
|
|
@@ -47,10 +47,6 @@
|
|
|
47
47
|
"./unstable/human-handoff": {
|
|
48
48
|
"types": "./dist/src/unstable/human-handoff.d.ts",
|
|
49
49
|
"default": "./dist/src/unstable/human-handoff.js"
|
|
50
|
-
},
|
|
51
|
-
"./unstable/publish-authorization": {
|
|
52
|
-
"types": "./dist/src/unstable/publish-authorization.d.ts",
|
|
53
|
-
"default": "./dist/src/unstable/publish-authorization.js"
|
|
54
50
|
}
|
|
55
51
|
},
|
|
56
52
|
"files": [
|
|
@@ -72,5 +68,5 @@
|
|
|
72
68
|
"url": "https://github.com/agentxm/axm.git"
|
|
73
69
|
},
|
|
74
70
|
"type": "module",
|
|
75
|
-
"version": "0.
|
|
71
|
+
"version": "0.31.1-preview.35375320215.681db72976f8"
|
|
76
72
|
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as Schema from "effect/Schema";
|
|
2
|
-
/** Delivery proof is specific to the initiating transport, independently of browser consent. */
|
|
3
|
-
export declare const PublishAuthorizationDeliverySchema: Schema.Union<readonly [Schema.Struct<{
|
|
4
|
-
readonly kind: Schema.Literal<"loopback">;
|
|
5
|
-
readonly redirect_uri: Schema.NonEmptyString;
|
|
6
|
-
readonly state: Schema.NonEmptyString;
|
|
7
|
-
readonly code_challenge: Schema.String;
|
|
8
|
-
readonly code_challenge_method: Schema.Literal<"S256">;
|
|
9
|
-
}>, Schema.Struct<{
|
|
10
|
-
readonly kind: Schema.Literal<"polling">;
|
|
11
|
-
readonly proof_challenge: Schema.String;
|
|
12
|
-
readonly proof_challenge_method: Schema.Literal<"S256">;
|
|
13
|
-
}>]>;
|
|
14
|
-
export type PublishAuthorizationDelivery = typeof PublishAuthorizationDeliverySchema.Type;
|
|
15
|
-
export declare const PublishAuthorizationPollingProofSchema: Schema.Struct<{
|
|
16
|
-
readonly initiator_proof: Schema.String;
|
|
17
|
-
}>;
|
|
18
|
-
export declare const PublishAuthorizationPollingStatusSchema: Schema.Struct<{
|
|
19
|
-
readonly purpose: Schema.Literal<"publish">;
|
|
20
|
-
readonly status: Schema.Literals<readonly ["pending", "approved", "denied", "expired", "exchanged"]>;
|
|
21
|
-
readonly expires_at: Schema.decodeTo<Schema.DateTimeUtc, Schema.String, never, never>;
|
|
22
|
-
readonly interval: Schema.Int;
|
|
23
|
-
readonly publication_set_digest: Schema.String;
|
|
24
|
-
}>;
|
|
25
|
-
export type PublishAuthorizationPollingStatus = typeof PublishAuthorizationPollingStatusSchema.Type;
|
|
26
|
-
//# sourceMappingURL=publish-authorization.d.ts.map
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import * as Schema from "effect/Schema";
|
|
2
|
-
import { DateTimeUtcSchema } from "@agentxm/extension-model/unstable/date-time";
|
|
3
|
-
import { Sha256HexSchema } from "./registry/publication-set.js";
|
|
4
|
-
const S256ChallengeSchema = Schema.String.check(Schema.isPattern(/^[A-Za-z0-9_-]{43}$/));
|
|
5
|
-
/** Delivery proof is specific to the initiating transport, independently of browser consent. */
|
|
6
|
-
export const PublishAuthorizationDeliverySchema = Schema.Union([
|
|
7
|
-
Schema.Struct({
|
|
8
|
-
kind: Schema.Literal("loopback"),
|
|
9
|
-
redirect_uri: Schema.NonEmptyString,
|
|
10
|
-
state: Schema.NonEmptyString,
|
|
11
|
-
code_challenge: S256ChallengeSchema,
|
|
12
|
-
code_challenge_method: Schema.Literal("S256"),
|
|
13
|
-
}),
|
|
14
|
-
Schema.Struct({
|
|
15
|
-
kind: Schema.Literal("polling"),
|
|
16
|
-
proof_challenge: S256ChallengeSchema,
|
|
17
|
-
proof_challenge_method: Schema.Literal("S256"),
|
|
18
|
-
}),
|
|
19
|
-
]).annotate({
|
|
20
|
-
identifier: "PublishAuthorizationDelivery",
|
|
21
|
-
title: "Publish authorization delivery",
|
|
22
|
-
description: "Loopback code delivery or resumable polling protected by a distinct initiator proof.",
|
|
23
|
-
});
|
|
24
|
-
export const PublishAuthorizationPollingProofSchema = Schema.Struct({
|
|
25
|
-
initiator_proof: Schema.String.check(Schema.isPattern(/^[A-Za-z0-9_-]{43,128}$/)),
|
|
26
|
-
}).annotate({
|
|
27
|
-
identifier: "PublishAuthorizationPollingProof",
|
|
28
|
-
description: "Secret proof held by the initiator; never a public request reference or browser code.",
|
|
29
|
-
});
|
|
30
|
-
export const PublishAuthorizationPollingStatusSchema = Schema.Struct({
|
|
31
|
-
purpose: Schema.Literal("publish"),
|
|
32
|
-
status: Schema.Literals(["pending", "approved", "denied", "expired", "exchanged"]),
|
|
33
|
-
expires_at: DateTimeUtcSchema,
|
|
34
|
-
interval: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
35
|
-
publication_set_digest: Sha256HexSchema,
|
|
36
|
-
}).annotate({
|
|
37
|
-
identifier: "PublishAuthorizationPollingStatus",
|
|
38
|
-
title: "Publish authorization status",
|
|
39
|
-
description: "Proof-protected authorization status and material binding; approval is not publication completion.",
|
|
40
|
-
});
|
|
41
|
-
//# sourceMappingURL=publish-authorization.js.map
|