@agentxm/registry-protocol 0.28.4-bootstrap.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +110 -0
- package/README.md +13 -0
- package/dist/src/unstable/content/agent-skills-standard.d.ts +17 -0
- package/dist/src/unstable/content/agent-skills-standard.js +24 -0
- package/dist/src/unstable/content/frontmatter.d.ts +52 -0
- package/dist/src/unstable/content/frontmatter.js +115 -0
- package/dist/src/unstable/content/index.d.ts +11 -0
- package/dist/src/unstable/content/index.js +11 -0
- package/dist/src/unstable/content/skill-content.d.ts +43 -0
- package/dist/src/unstable/content/skill-content.js +184 -0
- package/dist/src/unstable/content/skill-types.d.ts +22 -0
- package/dist/src/unstable/content/skill-types.js +9 -0
- package/dist/src/unstable/content/subagent-content.d.ts +58 -0
- package/dist/src/unstable/content/subagent-content.js +101 -0
- package/dist/src/unstable/knowledge/index.d.ts +8 -0
- package/dist/src/unstable/knowledge/index.js +8 -0
- package/dist/src/unstable/knowledge/knowledge-search.d.ts +32 -0
- package/dist/src/unstable/knowledge/knowledge-search.js +147 -0
- package/dist/src/unstable/knowledge/okf.d.ts +86 -0
- package/dist/src/unstable/knowledge/okf.js +1090 -0
- package/dist/src/unstable/lint/catalog/hook/decision-portability.d.ts +4 -0
- package/dist/src/unstable/lint/catalog/hook/decision-portability.js +40 -0
- package/dist/src/unstable/lint/catalog/hook/entrypoint-exists.d.ts +4 -0
- package/dist/src/unstable/lint/catalog/hook/entrypoint-exists.js +39 -0
- package/dist/src/unstable/lint/catalog/hook/envelope.d.ts +6 -0
- package/dist/src/unstable/lint/catalog/hook/envelope.js +15 -0
- package/dist/src/unstable/lint/catalog/hook/matcher-raw-portability.d.ts +4 -0
- package/dist/src/unstable/lint/catalog/hook/matcher-raw-portability.js +51 -0
- package/dist/src/unstable/lint/catalog/hook.d.ts +4 -0
- package/dist/src/unstable/lint/catalog/hook.js +17 -0
- package/dist/src/unstable/lint/catalog/knowledge/diagnostics.d.ts +128 -0
- package/dist/src/unstable/lint/catalog/knowledge/diagnostics.js +78 -0
- package/dist/src/unstable/lint/catalog/knowledge/envelope.d.ts +6 -0
- package/dist/src/unstable/lint/catalog/knowledge/envelope.js +15 -0
- package/dist/src/unstable/lint/catalog/knowledge.d.ts +5 -0
- package/dist/src/unstable/lint/catalog/knowledge.js +11 -0
- package/dist/src/unstable/lint/catalog/mcp-server/envelope.d.ts +6 -0
- package/dist/src/unstable/lint/catalog/mcp-server/envelope.js +15 -0
- package/dist/src/unstable/lint/catalog/mcp-server.d.ts +4 -0
- package/dist/src/unstable/lint/catalog/mcp-server.js +6 -0
- package/dist/src/unstable/lint/catalog/pack/manifest-keys-recognized.d.ts +28 -0
- package/dist/src/unstable/lint/catalog/pack/manifest-keys-recognized.js +38 -0
- package/dist/src/unstable/lint/catalog/pack/manifest-present.d.ts +17 -0
- package/dist/src/unstable/lint/catalog/pack/manifest-present.js +24 -0
- package/dist/src/unstable/lint/catalog/pack/manifest-schema-valid.d.ts +25 -0
- package/dist/src/unstable/lint/catalog/pack/manifest-schema-valid.js +33 -0
- package/dist/src/unstable/lint/catalog/pack-accessor/contexts.d.ts +51 -0
- package/dist/src/unstable/lint/catalog/pack-accessor/contexts.js +45 -0
- package/dist/src/unstable/lint/catalog/pack-accessor/vft.d.ts +60 -0
- package/dist/src/unstable/lint/catalog/pack-accessor/vft.js +85 -0
- package/dist/src/unstable/lint/catalog/pack.d.ts +37 -0
- package/dist/src/unstable/lint/catalog/pack.js +47 -0
- package/dist/src/unstable/lint/catalog/rule/envelope.d.ts +6 -0
- package/dist/src/unstable/lint/catalog/rule/envelope.js +15 -0
- package/dist/src/unstable/lint/catalog/rule.d.ts +4 -0
- package/dist/src/unstable/lint/catalog/rule.js +6 -0
- package/dist/src/unstable/lint/catalog/shared/envelope-rules.d.ts +93 -0
- package/dist/src/unstable/lint/catalog/shared/envelope-rules.js +89 -0
- package/dist/src/unstable/lint/catalog/shared/manifest-json.d.ts +18 -0
- package/dist/src/unstable/lint/catalog/shared/manifest-json.js +28 -0
- package/dist/src/unstable/lint/catalog/shared/manifest-present.d.ts +25 -0
- package/dist/src/unstable/lint/catalog/shared/manifest-present.js +37 -0
- package/dist/src/unstable/lint/catalog/shared/recommended-packs-rules.d.ts +70 -0
- package/dist/src/unstable/lint/catalog/shared/recommended-packs-rules.js +139 -0
- package/dist/src/unstable/lint/catalog/shared/schema-rule.d.ts +58 -0
- package/dist/src/unstable/lint/catalog/shared/schema-rule.js +103 -0
- package/dist/src/unstable/lint/catalog/skill/frontmatter-parseable.d.ts +31 -0
- package/dist/src/unstable/lint/catalog/skill/frontmatter-parseable.js +148 -0
- package/dist/src/unstable/lint/catalog/skill/frontmatter-standard-valid.d.ts +13 -0
- package/dist/src/unstable/lint/catalog/skill/frontmatter-standard-valid.js +61 -0
- package/dist/src/unstable/lint/catalog/skill/manifest-keys-recognized.d.ts +26 -0
- package/dist/src/unstable/lint/catalog/skill/manifest-keys-recognized.js +41 -0
- package/dist/src/unstable/lint/catalog/skill/manifest-present.d.ts +23 -0
- package/dist/src/unstable/lint/catalog/skill/manifest-present.js +32 -0
- package/dist/src/unstable/lint/catalog/skill/manifest-schema-valid.d.ts +21 -0
- package/dist/src/unstable/lint/catalog/skill/manifest-schema-valid.js +36 -0
- package/dist/src/unstable/lint/catalog/skill/recommended-packs-valid.d.ts +8 -0
- package/dist/src/unstable/lint/catalog/skill/recommended-packs-valid.js +12 -0
- package/dist/src/unstable/lint/catalog/skill/skill-md-present.d.ts +17 -0
- package/dist/src/unstable/lint/catalog/skill/skill-md-present.js +37 -0
- package/dist/src/unstable/lint/catalog/skill/standalone-declaration-valid.d.ts +8 -0
- package/dist/src/unstable/lint/catalog/skill/standalone-declaration-valid.js +12 -0
- package/dist/src/unstable/lint/catalog/skill-accessor/contexts.d.ts +61 -0
- package/dist/src/unstable/lint/catalog/skill-accessor/contexts.js +55 -0
- package/dist/src/unstable/lint/catalog/skill-accessor/vft.d.ts +77 -0
- package/dist/src/unstable/lint/catalog/skill-accessor/vft.js +135 -0
- package/dist/src/unstable/lint/catalog/skill.d.ts +44 -0
- package/dist/src/unstable/lint/catalog/skill.js +64 -0
- package/dist/src/unstable/lint/catalog/subagent/envelope.d.ts +6 -0
- package/dist/src/unstable/lint/catalog/subagent/envelope.js +15 -0
- package/dist/src/unstable/lint/catalog/subagent.d.ts +4 -0
- package/dist/src/unstable/lint/catalog/subagent.js +6 -0
- package/dist/src/unstable/lint/compose-path.d.ts +28 -0
- package/dist/src/unstable/lint/compose-path.js +64 -0
- package/dist/src/unstable/lint/config.d.ts +103 -0
- package/dist/src/unstable/lint/config.js +140 -0
- package/dist/src/unstable/lint/context.d.ts +246 -0
- package/dist/src/unstable/lint/context.js +21 -0
- package/dist/src/unstable/lint/describe-document.d.ts +31 -0
- package/dist/src/unstable/lint/describe-document.js +50 -0
- package/dist/src/unstable/lint/evaluate.d.ts +47 -0
- package/dist/src/unstable/lint/evaluate.js +82 -0
- package/dist/src/unstable/lint/issues-to-findings.d.ts +35 -0
- package/dist/src/unstable/lint/issues-to-findings.js +149 -0
- package/dist/src/unstable/lint/publish.d.ts +49 -0
- package/dist/src/unstable/lint/publish.js +86 -0
- package/dist/src/unstable/lint/rule.d.ts +98 -0
- package/dist/src/unstable/lint/rule.js +18 -0
- package/dist/src/unstable/publish/archive-guardrails.d.ts +39 -0
- package/dist/src/unstable/publish/archive-guardrails.js +250 -0
- package/dist/src/unstable/publish/filtered-package-validation.d.ts +24 -0
- package/dist/src/unstable/publish/filtered-package-validation.js +117 -0
- package/dist/src/unstable/publish/index.d.ts +12 -0
- package/dist/src/unstable/publish/index.js +12 -0
- package/dist/src/unstable/publish/ingest-limits.d.ts +25 -0
- package/dist/src/unstable/publish/ingest-limits.js +41 -0
- package/dist/src/unstable/publish/input-normalization.d.ts +40 -0
- package/dist/src/unstable/publish/input-normalization.js +125 -0
- package/dist/src/unstable/publish/manifest-policy.d.ts +611 -0
- package/dist/src/unstable/publish/manifest-policy.js +196 -0
- package/dist/src/unstable/publish/test-zip-helpers.d.ts +13 -0
- package/dist/src/unstable/publish/test-zip-helpers.js +117 -0
- package/dist/src/unstable/publish/visibility.d.ts +161 -0
- package/dist/src/unstable/publish/visibility.js +124 -0
- package/dist/src/unstable/registry/discover-schema.d.ts +68 -0
- package/dist/src/unstable/registry/discover-schema.js +35 -0
- package/dist/src/unstable/registry/index.d.ts +9 -0
- package/dist/src/unstable/registry/index.js +9 -0
- package/dist/src/unstable/registry/publication-set.d.ts +303 -0
- package/dist/src/unstable/registry/publication-set.js +507 -0
- package/dist/src/unstable/registry/release-age-policy.d.ts +57 -0
- package/dist/src/unstable/registry/release-age-policy.js +117 -0
- package/dist/src/unstable/registry/schema.d.ts +220 -0
- package/dist/src/unstable/registry/schema.js +114 -0
- package/dist/src/unstable/suggested-action.d.ts +19 -0
- package/dist/src/unstable/suggested-action.js +42 -0
- package/package.json +214 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import * as Data from "effect/Data";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Result from "effect/Result";
|
|
4
|
+
import * as Schema from "effect/Schema";
|
|
5
|
+
import * as SchemaIssue from "effect/SchemaIssue";
|
|
6
|
+
import { ExtensionNameSchema, ExtensionTypeSchema, } from "@agentxm/extension-model/unstable/extensions/common";
|
|
7
|
+
import { HookManifestSchema, HOOK_MANIFEST_FILENAME, } from "@agentxm/extension-model/unstable/hooks/manifest-schema";
|
|
8
|
+
import { HandleSchema } from "@agentxm/extension-model/unstable/extensions/handle";
|
|
9
|
+
import { KnowledgeManifestSchema, KNOWLEDGE_MANIFEST_FILENAME, } from "@agentxm/extension-model/unstable/knowledge/manifest-schema";
|
|
10
|
+
import { McpServerManifestSchema, MCP_SERVER_MANIFEST_FILENAME, } from "@agentxm/extension-model/unstable/mcps/manifest-schema";
|
|
11
|
+
import { PACK_MANIFEST_FILENAME, PackManifestSchema, } from "@agentxm/extension-model/unstable/packs/manifest-schema";
|
|
12
|
+
import { RuleManifestSchema, RULE_MANIFEST_FILENAME, } from "@agentxm/extension-model/unstable/rules/manifest-schema";
|
|
13
|
+
import { SkillManifestSchema, MANIFEST_FILENAME as SKILL_MANIFEST_FILENAME, } from "@agentxm/extension-model/unstable/skills/manifest-schema";
|
|
14
|
+
import { SubagentManifestSchema, MANIFEST_FILENAME as SUBAGENT_MANIFEST_FILENAME, } from "@agentxm/extension-model/unstable/subagents/manifest-schema";
|
|
15
|
+
import { VersionSchema } from "@agentxm/extension-model/unstable/version-constraints";
|
|
16
|
+
export class ManifestError extends Data.TaggedError("ManifestError") {
|
|
17
|
+
}
|
|
18
|
+
export const MANIFEST_FILENAME_BY_TYPE = {
|
|
19
|
+
skill: SKILL_MANIFEST_FILENAME,
|
|
20
|
+
"mcp-server": MCP_SERVER_MANIFEST_FILENAME,
|
|
21
|
+
subagent: SUBAGENT_MANIFEST_FILENAME,
|
|
22
|
+
pack: PACK_MANIFEST_FILENAME,
|
|
23
|
+
rule: RULE_MANIFEST_FILENAME,
|
|
24
|
+
hook: HOOK_MANIFEST_FILENAME,
|
|
25
|
+
knowledge: KNOWLEDGE_MANIFEST_FILENAME,
|
|
26
|
+
};
|
|
27
|
+
export const manifestFilenameForType = (type) => MANIFEST_FILENAME_BY_TYPE[type];
|
|
28
|
+
export const ManifestIdentitySchema = Schema.Struct({
|
|
29
|
+
owner: HandleSchema.pipe(Schema.annotateKey({ messageMissingKey: "owner is required" })),
|
|
30
|
+
type: ExtensionTypeSchema.pipe(Schema.annotateKey({ messageMissingKey: "type is required" })),
|
|
31
|
+
name: ExtensionNameSchema.pipe(Schema.annotateKey({ messageMissingKey: "name is required" })),
|
|
32
|
+
version: VersionSchema.pipe(Schema.annotateKey({ messageMissingKey: "version is required" })),
|
|
33
|
+
}).annotate({
|
|
34
|
+
identifier: "ManifestIdentity",
|
|
35
|
+
title: "Manifest Identity",
|
|
36
|
+
description: "The key identity fields from a manifest: who owns it, what type, its name, and version.",
|
|
37
|
+
});
|
|
38
|
+
const MANIFEST_SCHEMA_BY_TYPE = {
|
|
39
|
+
skill: SkillManifestSchema,
|
|
40
|
+
"mcp-server": McpServerManifestSchema,
|
|
41
|
+
subagent: SubagentManifestSchema,
|
|
42
|
+
pack: PackManifestSchema,
|
|
43
|
+
rule: RuleManifestSchema,
|
|
44
|
+
hook: HookManifestSchema,
|
|
45
|
+
knowledge: KnowledgeManifestSchema,
|
|
46
|
+
};
|
|
47
|
+
export const manifestSchemaForType = (type) => MANIFEST_SCHEMA_BY_TYPE[type];
|
|
48
|
+
const hasOwnField = (value, field) => typeof value === "object" &&
|
|
49
|
+
value !== null &&
|
|
50
|
+
!Array.isArray(value) &&
|
|
51
|
+
Object.hasOwn(value, field);
|
|
52
|
+
const purlHasVersion = (value) => {
|
|
53
|
+
const queryStart = value.search(/[?#]/);
|
|
54
|
+
const comparable = queryStart === -1 ? value : value.slice(0, queryStart);
|
|
55
|
+
const lastSlash = comparable.lastIndexOf("/");
|
|
56
|
+
return lastSlash >= 0 && comparable.indexOf("@", lastSlash + 1) !== -1;
|
|
57
|
+
};
|
|
58
|
+
const purlType = (value) => {
|
|
59
|
+
const match = /^pkg:([^/]+)\//i.exec(value);
|
|
60
|
+
return match?.[1]?.toLowerCase();
|
|
61
|
+
};
|
|
62
|
+
const versScheme = (value) => {
|
|
63
|
+
const match = /^vers:([^/]+)\//i.exec(value);
|
|
64
|
+
return match?.[1]?.toLowerCase();
|
|
65
|
+
};
|
|
66
|
+
const classifyCompanionPackageManifestError = (raw) => {
|
|
67
|
+
if (typeof raw !== "object" || raw === null || !("packages" in raw)) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
const packages = Reflect.get(raw, "packages");
|
|
71
|
+
if (!Array.isArray(packages)) {
|
|
72
|
+
return {
|
|
73
|
+
code: "companion_package_invalid",
|
|
74
|
+
detail: "Manifest packages must be an array of companion package objects.",
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
for (const entry of packages) {
|
|
78
|
+
if (typeof entry !== "object" || entry === null || Array.isArray(entry)) {
|
|
79
|
+
return {
|
|
80
|
+
code: "companion_package_invalid",
|
|
81
|
+
detail: "Manifest packages entries must be objects with purl and optional versionRange fields.",
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
const purl = Reflect.get(entry, "purl");
|
|
85
|
+
if (typeof purl !== "string") {
|
|
86
|
+
return {
|
|
87
|
+
code: "companion_package_invalid",
|
|
88
|
+
detail: "Manifest packages entries must include a purl string.",
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
if (purlHasVersion(purl)) {
|
|
92
|
+
return {
|
|
93
|
+
code: "companion_package_purl_has_version",
|
|
94
|
+
detail: "Companion package purls are identities, not pins. Move versions into versionRange.",
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
const versionRange = Reflect.get(entry, "versionRange");
|
|
98
|
+
if (versionRange !== undefined && typeof versionRange !== "string") {
|
|
99
|
+
return {
|
|
100
|
+
code: "companion_package_invalid",
|
|
101
|
+
detail: "Manifest packages versionRange must be a VERS string.",
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
const packageType = purlType(purl);
|
|
105
|
+
const rangeScheme = typeof versionRange === "string" ? versScheme(versionRange) : undefined;
|
|
106
|
+
if (packageType !== undefined && rangeScheme !== undefined && packageType !== rangeScheme) {
|
|
107
|
+
return {
|
|
108
|
+
code: "companion_package_scheme_mismatch",
|
|
109
|
+
detail: "Companion package purl ecosystem must match the versionRange VERS scheme.",
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// No concrete companion-package problem found: the schema decode failed for an
|
|
114
|
+
// unrelated reason, so let the caller fall back to a generic manifest error
|
|
115
|
+
// rather than misreporting it as companion_package_invalid.
|
|
116
|
+
return undefined;
|
|
117
|
+
};
|
|
118
|
+
export const validateManifestHasNoAgentsField = (fileName, raw) => {
|
|
119
|
+
if (!hasOwnField(raw, "agents"))
|
|
120
|
+
return Result.void;
|
|
121
|
+
return Result.fail(new ManifestError({
|
|
122
|
+
code: "manifest_schema_invalid",
|
|
123
|
+
detail: `Manifest file "${fileName}" must not include "agents"; express targeting in settings.agents.`,
|
|
124
|
+
}));
|
|
125
|
+
};
|
|
126
|
+
export const resolveManifest = (input) => Effect.gen(function* () {
|
|
127
|
+
const expectedFilename = manifestFilenameForType(input.type);
|
|
128
|
+
const [manifestEntry, ...rest] = input.entries.filter((entry) => {
|
|
129
|
+
const normalized = entry.fileName.replace(/\\/g, "/");
|
|
130
|
+
return (normalized === expectedFilename ||
|
|
131
|
+
normalized.toLowerCase() === expectedFilename.toLowerCase());
|
|
132
|
+
});
|
|
133
|
+
if (manifestEntry === undefined) {
|
|
134
|
+
return yield* new ManifestError({
|
|
135
|
+
code: "manifest_missing",
|
|
136
|
+
detail: `Expected manifest file "${expectedFilename}" not found in archive root.`,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
if (rest.length > 0) {
|
|
140
|
+
const allCandidates = [manifestEntry, ...rest];
|
|
141
|
+
return yield* new ManifestError({
|
|
142
|
+
code: "manifest_multiple",
|
|
143
|
+
detail: `Multiple manifest candidates found for type "${input.type}": ${allCandidates.map((candidate) => candidate.fileName).join(", ")}.`,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
const rawBytes = yield* input.readEntry(manifestEntry.fileName);
|
|
147
|
+
const text = new TextDecoder().decode(rawBytes);
|
|
148
|
+
const parsed = yield* Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.Unknown))(text).pipe(Effect.mapError(() => new ManifestError({
|
|
149
|
+
code: "manifest_invalid_json",
|
|
150
|
+
detail: `Manifest file "${manifestEntry.fileName}" contains invalid JSON.`,
|
|
151
|
+
})));
|
|
152
|
+
yield* Effect.fromResult(validateManifestHasNoAgentsField(manifestEntry.fileName, parsed));
|
|
153
|
+
const schema = manifestSchemaForType(input.type);
|
|
154
|
+
yield* Schema.decodeUnknownEffect(schema)(parsed).pipe(Effect.mapError((error) => {
|
|
155
|
+
const companionPackageError = classifyCompanionPackageManifestError(parsed);
|
|
156
|
+
return new ManifestError({
|
|
157
|
+
code: companionPackageError?.code ?? "manifest_schema_invalid",
|
|
158
|
+
detail: companionPackageError?.detail ??
|
|
159
|
+
`Manifest file "${manifestEntry.fileName}" does not conform to the ${input.type} manifest schema.`,
|
|
160
|
+
details: SchemaIssue.makeFormatterDefault()(error.issue),
|
|
161
|
+
});
|
|
162
|
+
}));
|
|
163
|
+
const identity = yield* Schema.decodeUnknownEffect(ManifestIdentitySchema)(parsed).pipe(Effect.mapError(() => new ManifestError({
|
|
164
|
+
code: "manifest_schema_invalid",
|
|
165
|
+
detail: `Manifest file "${manifestEntry.fileName}" is missing required identity fields (owner, type, name, version).`,
|
|
166
|
+
})));
|
|
167
|
+
return {
|
|
168
|
+
identity,
|
|
169
|
+
raw: parsed,
|
|
170
|
+
fileName: manifestEntry.fileName,
|
|
171
|
+
};
|
|
172
|
+
});
|
|
173
|
+
export const validateDeclaredManifestAlignment = (declaredIdentity, manifest) => {
|
|
174
|
+
const mismatches = [];
|
|
175
|
+
if (declaredIdentity.name !== manifest.name) {
|
|
176
|
+
mismatches.push(`name: declared="${declaredIdentity.name}" manifest="${manifest.name}"`);
|
|
177
|
+
}
|
|
178
|
+
if (declaredIdentity.owner !== manifest.owner) {
|
|
179
|
+
mismatches.push(`owner: declared="${declaredIdentity.owner}" manifest="${manifest.owner}"`);
|
|
180
|
+
}
|
|
181
|
+
if (declaredIdentity.type !== manifest.type) {
|
|
182
|
+
mismatches.push(`type: declared="${declaredIdentity.type}" manifest="${manifest.type}"`);
|
|
183
|
+
}
|
|
184
|
+
if (declaredIdentity.version !== manifest.version) {
|
|
185
|
+
mismatches.push(`version: declared="${declaredIdentity.version}" manifest="${manifest.version}"`);
|
|
186
|
+
}
|
|
187
|
+
if (mismatches.length > 0) {
|
|
188
|
+
return Result.fail(new ManifestError({
|
|
189
|
+
code: "declared_manifest_mismatch",
|
|
190
|
+
detail: `Declared publish identity and manifest identity disagree: ${mismatches.join(", ")}.`,
|
|
191
|
+
details: { declaredIdentity, manifest },
|
|
192
|
+
}));
|
|
193
|
+
}
|
|
194
|
+
return Result.void;
|
|
195
|
+
};
|
|
196
|
+
//# sourceMappingURL=manifest-policy.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface ZipFileEntry {
|
|
2
|
+
fileName: string;
|
|
3
|
+
content: Uint8Array;
|
|
4
|
+
compressionMethod?: number;
|
|
5
|
+
externalAttributes?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const buildZip: (entries: ZipFileEntry[]) => Uint8Array;
|
|
8
|
+
export declare const buildSymlinkZip: (symlinkName: string, targetPath: string) => Uint8Array;
|
|
9
|
+
export declare const buildDecompressionBombZip: (uncompressedSize: number, compressedSize: number, entryName?: string) => Uint8Array;
|
|
10
|
+
export declare const buildMalformedZip: () => Uint8Array;
|
|
11
|
+
export declare const textContent: (text: string) => Uint8Array;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=test-zip-helpers.d.ts.map
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import * as zlib from "node:zlib";
|
|
2
|
+
const textEncoder = new TextEncoder();
|
|
3
|
+
const LOCAL_FILE_HEADER_SIG = 0x04034b50;
|
|
4
|
+
const CENTRAL_DIR_SIG = 0x02014b50;
|
|
5
|
+
const EOCD_SIG = 0x06054b50;
|
|
6
|
+
const writeUint32LE = (buf, offset, value) => buf.setUint32(offset, value, true);
|
|
7
|
+
const writeUint16LE = (buf, offset, value) => buf.setUint16(offset, value, true);
|
|
8
|
+
const concatBytes = (arrays) => {
|
|
9
|
+
const totalLength = arrays.reduce((sum, array) => sum + array.length, 0);
|
|
10
|
+
const result = new Uint8Array(totalLength);
|
|
11
|
+
let offset = 0;
|
|
12
|
+
for (const array of arrays) {
|
|
13
|
+
result.set(array, offset);
|
|
14
|
+
offset += array.length;
|
|
15
|
+
}
|
|
16
|
+
return result;
|
|
17
|
+
};
|
|
18
|
+
export const buildZip = (entries) => {
|
|
19
|
+
const centralDirs = [];
|
|
20
|
+
let currentOffset = 0;
|
|
21
|
+
const localParts = [];
|
|
22
|
+
for (const entry of entries) {
|
|
23
|
+
const fileNameBytes = textEncoder.encode(entry.fileName);
|
|
24
|
+
const compressionMethod = entry.compressionMethod ?? 0;
|
|
25
|
+
let compressedData;
|
|
26
|
+
if (compressionMethod === 8) {
|
|
27
|
+
const deflated = zlib.deflateRawSync(entry.content);
|
|
28
|
+
compressedData = new Uint8Array(deflated.buffer, deflated.byteOffset, deflated.byteLength);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
compressedData = entry.content;
|
|
32
|
+
}
|
|
33
|
+
const localBuf = new ArrayBuffer(30);
|
|
34
|
+
const localView = new DataView(localBuf);
|
|
35
|
+
writeUint32LE(localView, 0, LOCAL_FILE_HEADER_SIG);
|
|
36
|
+
writeUint16LE(localView, 4, 20);
|
|
37
|
+
writeUint16LE(localView, 6, 0);
|
|
38
|
+
writeUint16LE(localView, 8, compressionMethod);
|
|
39
|
+
writeUint16LE(localView, 10, 0);
|
|
40
|
+
writeUint16LE(localView, 12, 0);
|
|
41
|
+
writeUint32LE(localView, 14, 0);
|
|
42
|
+
writeUint32LE(localView, 18, compressedData.length);
|
|
43
|
+
writeUint32LE(localView, 22, entry.content.length);
|
|
44
|
+
writeUint16LE(localView, 26, fileNameBytes.length);
|
|
45
|
+
writeUint16LE(localView, 28, 0);
|
|
46
|
+
const localHeaderBytes = new Uint8Array(localBuf);
|
|
47
|
+
const localRecord = concatBytes([localHeaderBytes, fileNameBytes, compressedData]);
|
|
48
|
+
localParts.push(localRecord);
|
|
49
|
+
const cdirBuf = new ArrayBuffer(46);
|
|
50
|
+
const cdirView = new DataView(cdirBuf);
|
|
51
|
+
writeUint32LE(cdirView, 0, CENTRAL_DIR_SIG);
|
|
52
|
+
writeUint16LE(cdirView, 4, 20);
|
|
53
|
+
writeUint16LE(cdirView, 6, 20);
|
|
54
|
+
writeUint16LE(cdirView, 8, 0);
|
|
55
|
+
writeUint16LE(cdirView, 10, compressionMethod);
|
|
56
|
+
writeUint16LE(cdirView, 12, 0);
|
|
57
|
+
writeUint16LE(cdirView, 14, 0);
|
|
58
|
+
writeUint32LE(cdirView, 16, 0);
|
|
59
|
+
writeUint32LE(cdirView, 20, compressedData.length);
|
|
60
|
+
writeUint32LE(cdirView, 24, entry.content.length);
|
|
61
|
+
writeUint16LE(cdirView, 28, fileNameBytes.length);
|
|
62
|
+
writeUint16LE(cdirView, 30, 0);
|
|
63
|
+
writeUint16LE(cdirView, 32, 0);
|
|
64
|
+
writeUint16LE(cdirView, 34, 0);
|
|
65
|
+
writeUint16LE(cdirView, 36, 0);
|
|
66
|
+
writeUint32LE(cdirView, 38, entry.externalAttributes ?? 0);
|
|
67
|
+
writeUint32LE(cdirView, 42, currentOffset);
|
|
68
|
+
centralDirs.push(concatBytes([new Uint8Array(cdirBuf), fileNameBytes]));
|
|
69
|
+
currentOffset += localRecord.length;
|
|
70
|
+
}
|
|
71
|
+
const cdirStartOffset = currentOffset;
|
|
72
|
+
const allCdir = concatBytes(centralDirs);
|
|
73
|
+
const eocdBuf = new ArrayBuffer(22);
|
|
74
|
+
const eocdView = new DataView(eocdBuf);
|
|
75
|
+
writeUint32LE(eocdView, 0, EOCD_SIG);
|
|
76
|
+
writeUint16LE(eocdView, 4, 0);
|
|
77
|
+
writeUint16LE(eocdView, 6, 0);
|
|
78
|
+
writeUint16LE(eocdView, 8, entries.length);
|
|
79
|
+
writeUint16LE(eocdView, 10, entries.length);
|
|
80
|
+
writeUint32LE(eocdView, 12, allCdir.length);
|
|
81
|
+
writeUint32LE(eocdView, 16, cdirStartOffset);
|
|
82
|
+
writeUint16LE(eocdView, 20, 0);
|
|
83
|
+
return concatBytes([...localParts, allCdir, new Uint8Array(eocdBuf)]);
|
|
84
|
+
};
|
|
85
|
+
export const buildSymlinkZip = (symlinkName, targetPath) => {
|
|
86
|
+
const symlinkAttrs = (0xa000 | 0o777) << 16;
|
|
87
|
+
return buildZip([
|
|
88
|
+
{
|
|
89
|
+
fileName: symlinkName,
|
|
90
|
+
content: textEncoder.encode(targetPath),
|
|
91
|
+
externalAttributes: symlinkAttrs,
|
|
92
|
+
},
|
|
93
|
+
]);
|
|
94
|
+
};
|
|
95
|
+
export const buildDecompressionBombZip = (uncompressedSize, compressedSize, entryName = "bomb.bin") => {
|
|
96
|
+
const content = new Uint8Array(compressedSize);
|
|
97
|
+
const zip = buildZip([
|
|
98
|
+
{
|
|
99
|
+
fileName: entryName,
|
|
100
|
+
content,
|
|
101
|
+
compressionMethod: 0,
|
|
102
|
+
},
|
|
103
|
+
]);
|
|
104
|
+
const view = new DataView(zip.buffer, zip.byteOffset, zip.byteLength);
|
|
105
|
+
view.setUint32(22, uncompressedSize, true);
|
|
106
|
+
for (let i = zip.length - 22; i >= 0; i--) {
|
|
107
|
+
if (view.getUint32(i, true) === EOCD_SIG) {
|
|
108
|
+
const cdirOffset = view.getUint32(i + 16, true);
|
|
109
|
+
view.setUint32(cdirOffset + 24, uncompressedSize, true);
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return zip;
|
|
114
|
+
};
|
|
115
|
+
export const buildMalformedZip = () => new Uint8Array([0x00, 0x01, 0x02, 0x03, 0x04, 0x05]);
|
|
116
|
+
export const textContent = (text) => textEncoder.encode(text);
|
|
117
|
+
//# sourceMappingURL=test-zip-helpers.js.map
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/** Source and Registry contracts for whole-Extension visibility. */
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
import { type ExtensionVisibility } from "@agentxm/extension-model/unstable/extensions/common";
|
|
4
|
+
export declare const VisibilityFingerprintSchema: Schema.String;
|
|
5
|
+
export type VisibilityFingerprint = typeof VisibilityFingerprintSchema.Type;
|
|
6
|
+
export declare const VisibilityRevisionSchema: Schema.NonEmptyString;
|
|
7
|
+
export type VisibilityRevision = typeof VisibilityRevisionSchema.Type;
|
|
8
|
+
export declare const VisibilityIntentSchema: Schema.Struct<{
|
|
9
|
+
readonly value: Schema.Literals<readonly ["public", "private"]>;
|
|
10
|
+
readonly source: Schema.Literals<readonly ["manifest", "workspace"]>;
|
|
11
|
+
readonly fingerprint: Schema.String;
|
|
12
|
+
}>;
|
|
13
|
+
export type VisibilityIntent = typeof VisibilityIntentSchema.Type;
|
|
14
|
+
export interface VisibilityIntentSource {
|
|
15
|
+
readonly value: ExtensionVisibility;
|
|
16
|
+
readonly material: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ResolveVisibilityIntentArgs {
|
|
19
|
+
readonly manifest?: VisibilityIntentSource;
|
|
20
|
+
readonly workspace?: VisibilityIntentSource;
|
|
21
|
+
}
|
|
22
|
+
export declare const resolveVisibilityIntent: (args: ResolveVisibilityIntentArgs) => VisibilityIntent | null;
|
|
23
|
+
export declare const PublishVisibilitySchema: Schema.Union<readonly [Schema.Struct<{
|
|
24
|
+
readonly value: Schema.Literals<readonly ["public", "private"]>;
|
|
25
|
+
readonly disposition: Schema.Literal<"establish">;
|
|
26
|
+
readonly source: Schema.Literals<readonly ["manifest", "workspace", "explicit", "account", "platform"]>;
|
|
27
|
+
}>, Schema.Struct<{
|
|
28
|
+
readonly value: Schema.Literals<readonly ["public", "private"]>;
|
|
29
|
+
readonly disposition: Schema.Literal<"preserve">;
|
|
30
|
+
readonly source: Schema.Literal<"existing">;
|
|
31
|
+
}>]>;
|
|
32
|
+
export type PublishVisibility = typeof PublishVisibilitySchema.Type;
|
|
33
|
+
export declare const VisibilityActualSchema: Schema.Struct<{
|
|
34
|
+
readonly value: Schema.Literals<readonly ["public", "private"]>;
|
|
35
|
+
readonly revision: Schema.NonEmptyString;
|
|
36
|
+
}>;
|
|
37
|
+
export type VisibilityActual = typeof VisibilityActualSchema.Type;
|
|
38
|
+
export declare const VisibilityComparisonSchema: Schema.Literals<readonly ["not-established", "unconfigured", "match", "drift"]>;
|
|
39
|
+
export type VisibilityComparison = typeof VisibilityComparisonSchema.Type;
|
|
40
|
+
export declare const VisibilityFindingCodeSchema: Schema.Literals<readonly ["visibility/intent-conflict", "visibility/drift", "visibility/unavailable", "visibility/intent-required", "visibility/not-established", "visibility/stale-source", "visibility/stale-revision", "visibility/confirmation-required", "visibility/authorization-denied", "visibility/impersonation-denied", "visibility/verification-required", "visibility/verification-expired", "visibility/verification-cancelled", "visibility/verification-replayed", "visibility/pack-blocked"]>;
|
|
41
|
+
export type VisibilityFindingCode = typeof VisibilityFindingCodeSchema.Type;
|
|
42
|
+
export declare const VisibilityFindingSchema: Schema.Struct<{
|
|
43
|
+
readonly code: Schema.Literals<readonly ["visibility/intent-conflict", "visibility/drift", "visibility/unavailable", "visibility/intent-required", "visibility/not-established", "visibility/stale-source", "visibility/stale-revision", "visibility/confirmation-required", "visibility/authorization-denied", "visibility/impersonation-denied", "visibility/verification-required", "visibility/verification-expired", "visibility/verification-cancelled", "visibility/verification-replayed", "visibility/pack-blocked"]>;
|
|
44
|
+
readonly severity: Schema.Literals<readonly ["error", "warning"]>;
|
|
45
|
+
readonly message: Schema.String;
|
|
46
|
+
}>;
|
|
47
|
+
export type VisibilityFinding = typeof VisibilityFindingSchema.Type;
|
|
48
|
+
export declare const VisibilityEvaluationSchema: Schema.Struct<{
|
|
49
|
+
readonly target: Schema.String;
|
|
50
|
+
readonly intent: Schema.NullOr<Schema.Struct<{
|
|
51
|
+
readonly value: Schema.Literals<readonly ["public", "private"]>;
|
|
52
|
+
readonly source: Schema.Literals<readonly ["manifest", "workspace"]>;
|
|
53
|
+
readonly fingerprint: Schema.String;
|
|
54
|
+
}>>;
|
|
55
|
+
readonly request: Schema.NullOr<Schema.Literals<readonly ["public", "private"]>>;
|
|
56
|
+
readonly resolved: Schema.NullOr<Schema.Union<readonly [Schema.Struct<{
|
|
57
|
+
readonly value: Schema.Literals<readonly ["public", "private"]>;
|
|
58
|
+
readonly disposition: Schema.Literal<"establish">;
|
|
59
|
+
readonly source: Schema.Literals<readonly ["manifest", "workspace", "explicit", "account", "platform"]>;
|
|
60
|
+
}>, Schema.Struct<{
|
|
61
|
+
readonly value: Schema.Literals<readonly ["public", "private"]>;
|
|
62
|
+
readonly disposition: Schema.Literal<"preserve">;
|
|
63
|
+
readonly source: Schema.Literal<"existing">;
|
|
64
|
+
}>]>>;
|
|
65
|
+
readonly actual: Schema.NullOr<Schema.Struct<{
|
|
66
|
+
readonly value: Schema.Literals<readonly ["public", "private"]>;
|
|
67
|
+
readonly revision: Schema.NonEmptyString;
|
|
68
|
+
}>>;
|
|
69
|
+
readonly comparison: Schema.Literals<readonly ["not-established", "unconfigured", "match", "drift"]>;
|
|
70
|
+
readonly findings: Schema.$Array<Schema.Struct<{
|
|
71
|
+
readonly code: Schema.Literals<readonly ["visibility/intent-conflict", "visibility/drift", "visibility/unavailable", "visibility/intent-required", "visibility/not-established", "visibility/stale-source", "visibility/stale-revision", "visibility/confirmation-required", "visibility/authorization-denied", "visibility/impersonation-denied", "visibility/verification-required", "visibility/verification-expired", "visibility/verification-cancelled", "visibility/verification-replayed", "visibility/pack-blocked"]>;
|
|
72
|
+
readonly severity: Schema.Literals<readonly ["error", "warning"]>;
|
|
73
|
+
readonly message: Schema.String;
|
|
74
|
+
}>>;
|
|
75
|
+
}>;
|
|
76
|
+
export type VisibilityEvaluation = typeof VisibilityEvaluationSchema.Type;
|
|
77
|
+
export declare const VisibilityEvaluationUnavailableSchema: Schema.Struct<{
|
|
78
|
+
readonly target: Schema.String;
|
|
79
|
+
readonly unavailable: Schema.Literal<true>;
|
|
80
|
+
readonly findings: Schema.$Array<Schema.Struct<{
|
|
81
|
+
readonly code: Schema.Literals<readonly ["visibility/intent-conflict", "visibility/drift", "visibility/unavailable", "visibility/intent-required", "visibility/not-established", "visibility/stale-source", "visibility/stale-revision", "visibility/confirmation-required", "visibility/authorization-denied", "visibility/impersonation-denied", "visibility/verification-required", "visibility/verification-expired", "visibility/verification-cancelled", "visibility/verification-replayed", "visibility/pack-blocked"]>;
|
|
82
|
+
readonly severity: Schema.Literals<readonly ["error", "warning"]>;
|
|
83
|
+
readonly message: Schema.String;
|
|
84
|
+
}>>;
|
|
85
|
+
}>;
|
|
86
|
+
export type VisibilityEvaluationUnavailable = typeof VisibilityEvaluationUnavailableSchema.Type;
|
|
87
|
+
export declare const VisibilityEvaluationResultSchema: Schema.Union<readonly [Schema.Struct<{
|
|
88
|
+
readonly target: Schema.String;
|
|
89
|
+
readonly intent: Schema.NullOr<Schema.Struct<{
|
|
90
|
+
readonly value: Schema.Literals<readonly ["public", "private"]>;
|
|
91
|
+
readonly source: Schema.Literals<readonly ["manifest", "workspace"]>;
|
|
92
|
+
readonly fingerprint: Schema.String;
|
|
93
|
+
}>>;
|
|
94
|
+
readonly request: Schema.NullOr<Schema.Literals<readonly ["public", "private"]>>;
|
|
95
|
+
readonly resolved: Schema.NullOr<Schema.Union<readonly [Schema.Struct<{
|
|
96
|
+
readonly value: Schema.Literals<readonly ["public", "private"]>;
|
|
97
|
+
readonly disposition: Schema.Literal<"establish">;
|
|
98
|
+
readonly source: Schema.Literals<readonly ["manifest", "workspace", "explicit", "account", "platform"]>;
|
|
99
|
+
}>, Schema.Struct<{
|
|
100
|
+
readonly value: Schema.Literals<readonly ["public", "private"]>;
|
|
101
|
+
readonly disposition: Schema.Literal<"preserve">;
|
|
102
|
+
readonly source: Schema.Literal<"existing">;
|
|
103
|
+
}>]>>;
|
|
104
|
+
readonly actual: Schema.NullOr<Schema.Struct<{
|
|
105
|
+
readonly value: Schema.Literals<readonly ["public", "private"]>;
|
|
106
|
+
readonly revision: Schema.NonEmptyString;
|
|
107
|
+
}>>;
|
|
108
|
+
readonly comparison: Schema.Literals<readonly ["not-established", "unconfigured", "match", "drift"]>;
|
|
109
|
+
readonly findings: Schema.$Array<Schema.Struct<{
|
|
110
|
+
readonly code: Schema.Literals<readonly ["visibility/intent-conflict", "visibility/drift", "visibility/unavailable", "visibility/intent-required", "visibility/not-established", "visibility/stale-source", "visibility/stale-revision", "visibility/confirmation-required", "visibility/authorization-denied", "visibility/impersonation-denied", "visibility/verification-required", "visibility/verification-expired", "visibility/verification-cancelled", "visibility/verification-replayed", "visibility/pack-blocked"]>;
|
|
111
|
+
readonly severity: Schema.Literals<readonly ["error", "warning"]>;
|
|
112
|
+
readonly message: Schema.String;
|
|
113
|
+
}>>;
|
|
114
|
+
}>, Schema.Struct<{
|
|
115
|
+
readonly target: Schema.String;
|
|
116
|
+
readonly unavailable: Schema.Literal<true>;
|
|
117
|
+
readonly findings: Schema.$Array<Schema.Struct<{
|
|
118
|
+
readonly code: Schema.Literals<readonly ["visibility/intent-conflict", "visibility/drift", "visibility/unavailable", "visibility/intent-required", "visibility/not-established", "visibility/stale-source", "visibility/stale-revision", "visibility/confirmation-required", "visibility/authorization-denied", "visibility/impersonation-denied", "visibility/verification-required", "visibility/verification-expired", "visibility/verification-cancelled", "visibility/verification-replayed", "visibility/pack-blocked"]>;
|
|
119
|
+
readonly severity: Schema.Literals<readonly ["error", "warning"]>;
|
|
120
|
+
readonly message: Schema.String;
|
|
121
|
+
}>>;
|
|
122
|
+
}>]>;
|
|
123
|
+
export type VisibilityEvaluationResult = typeof VisibilityEvaluationResultSchema.Type;
|
|
124
|
+
export declare const VisibilityMutationAuthoritySchema: Schema.Union<readonly [Schema.Struct<{
|
|
125
|
+
readonly kind: Schema.Literal<"operator">;
|
|
126
|
+
}>, Schema.Struct<{
|
|
127
|
+
readonly kind: Schema.Literal<"repository">;
|
|
128
|
+
readonly source: Schema.Literals<readonly ["manifest", "workspace"]>;
|
|
129
|
+
readonly fingerprint: Schema.String;
|
|
130
|
+
}>]>;
|
|
131
|
+
export type VisibilityMutationAuthority = typeof VisibilityMutationAuthoritySchema.Type;
|
|
132
|
+
export declare const VisibilityMutationRequestSchema: Schema.Struct<{
|
|
133
|
+
readonly target: Schema.String;
|
|
134
|
+
readonly visibility: Schema.Literals<readonly ["public", "private"]>;
|
|
135
|
+
readonly revision: Schema.NonEmptyString;
|
|
136
|
+
readonly authority: Schema.Union<readonly [Schema.Struct<{
|
|
137
|
+
readonly kind: Schema.Literal<"operator">;
|
|
138
|
+
}>, Schema.Struct<{
|
|
139
|
+
readonly kind: Schema.Literal<"repository">;
|
|
140
|
+
readonly source: Schema.Literals<readonly ["manifest", "workspace"]>;
|
|
141
|
+
readonly fingerprint: Schema.String;
|
|
142
|
+
}>]>;
|
|
143
|
+
readonly verification: Schema.optional<Schema.NonEmptyString>;
|
|
144
|
+
}>;
|
|
145
|
+
export type VisibilityMutationRequest = typeof VisibilityMutationRequestSchema.Type;
|
|
146
|
+
export declare const VisibilityMutationResultSchema: Schema.Struct<{
|
|
147
|
+
readonly target: Schema.String;
|
|
148
|
+
readonly before: Schema.Literals<readonly ["public", "private"]>;
|
|
149
|
+
readonly after: Schema.Literals<readonly ["public", "private"]>;
|
|
150
|
+
readonly authority: Schema.Union<readonly [Schema.Struct<{
|
|
151
|
+
readonly kind: Schema.Literal<"operator">;
|
|
152
|
+
}>, Schema.Struct<{
|
|
153
|
+
readonly kind: Schema.Literal<"repository">;
|
|
154
|
+
readonly source: Schema.Literals<readonly ["manifest", "workspace"]>;
|
|
155
|
+
readonly fingerprint: Schema.String;
|
|
156
|
+
}>]>;
|
|
157
|
+
readonly result: Schema.Literals<readonly ["already-satisfied", "changed"]>;
|
|
158
|
+
readonly revision: Schema.NonEmptyString;
|
|
159
|
+
}>;
|
|
160
|
+
export type VisibilityMutationResult = typeof VisibilityMutationResultSchema.Type;
|
|
161
|
+
//# sourceMappingURL=visibility.d.ts.map
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/** Source and Registry contracts for whole-Extension visibility. */
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import * as Schema from "effect/Schema";
|
|
4
|
+
import { ExtensionFqnSchema, ExtensionVisibilitySchema, } from "@agentxm/extension-model/unstable/extensions/common";
|
|
5
|
+
export const VisibilityFingerprintSchema = Schema.String.check(Schema.isPattern(/^[a-f0-9]{64}$/)).annotate({ identifier: "VisibilityFingerprint" });
|
|
6
|
+
export const VisibilityRevisionSchema = Schema.NonEmptyString.annotate({
|
|
7
|
+
identifier: "VisibilityRevision",
|
|
8
|
+
description: "Opaque revision for conditional whole-Extension visibility mutation.",
|
|
9
|
+
});
|
|
10
|
+
export const VisibilityIntentSchema = Schema.Struct({
|
|
11
|
+
value: ExtensionVisibilitySchema,
|
|
12
|
+
source: Schema.Literals(["manifest", "workspace"]),
|
|
13
|
+
fingerprint: VisibilityFingerprintSchema,
|
|
14
|
+
}).annotate({ identifier: "VisibilityIntent" });
|
|
15
|
+
const fingerprint = (source, input) => Schema.decodeUnknownSync(VisibilityFingerprintSchema)(createHash("sha256")
|
|
16
|
+
.update(JSON.stringify({ source, value: input.value, material: input.material }))
|
|
17
|
+
.digest("hex"));
|
|
18
|
+
export const resolveVisibilityIntent = (args) => {
|
|
19
|
+
if (args.manifest !== undefined) {
|
|
20
|
+
return {
|
|
21
|
+
value: args.manifest.value,
|
|
22
|
+
source: "manifest",
|
|
23
|
+
fingerprint: fingerprint("manifest", args.manifest),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
if (args.workspace !== undefined) {
|
|
27
|
+
return {
|
|
28
|
+
value: args.workspace.value,
|
|
29
|
+
source: "workspace",
|
|
30
|
+
fingerprint: fingerprint("workspace", args.workspace),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
};
|
|
35
|
+
export const PublishVisibilitySchema = Schema.Union([
|
|
36
|
+
Schema.Struct({
|
|
37
|
+
value: ExtensionVisibilitySchema,
|
|
38
|
+
disposition: Schema.Literal("establish"),
|
|
39
|
+
source: Schema.Literals(["manifest", "workspace", "explicit", "account", "platform"]),
|
|
40
|
+
}),
|
|
41
|
+
Schema.Struct({
|
|
42
|
+
value: ExtensionVisibilitySchema,
|
|
43
|
+
disposition: Schema.Literal("preserve"),
|
|
44
|
+
source: Schema.Literal("existing"),
|
|
45
|
+
}),
|
|
46
|
+
]).annotate({
|
|
47
|
+
identifier: "PublishVisibility",
|
|
48
|
+
title: "Publish Visibility",
|
|
49
|
+
description: "Authoritative whole-Extension visibility and provenance resolved for a publication.",
|
|
50
|
+
});
|
|
51
|
+
export const VisibilityActualSchema = Schema.Struct({
|
|
52
|
+
value: ExtensionVisibilitySchema,
|
|
53
|
+
revision: VisibilityRevisionSchema,
|
|
54
|
+
}).annotate({ identifier: "VisibilityActual" });
|
|
55
|
+
export const VisibilityComparisonSchema = Schema.Literals([
|
|
56
|
+
"not-established",
|
|
57
|
+
"unconfigured",
|
|
58
|
+
"match",
|
|
59
|
+
"drift",
|
|
60
|
+
]).annotate({ identifier: "VisibilityComparison" });
|
|
61
|
+
export const VisibilityFindingCodeSchema = Schema.Literals([
|
|
62
|
+
"visibility/intent-conflict",
|
|
63
|
+
"visibility/drift",
|
|
64
|
+
"visibility/unavailable",
|
|
65
|
+
"visibility/intent-required",
|
|
66
|
+
"visibility/not-established",
|
|
67
|
+
"visibility/stale-source",
|
|
68
|
+
"visibility/stale-revision",
|
|
69
|
+
"visibility/confirmation-required",
|
|
70
|
+
"visibility/authorization-denied",
|
|
71
|
+
"visibility/impersonation-denied",
|
|
72
|
+
"visibility/verification-required",
|
|
73
|
+
"visibility/verification-expired",
|
|
74
|
+
"visibility/verification-cancelled",
|
|
75
|
+
"visibility/verification-replayed",
|
|
76
|
+
"visibility/pack-blocked",
|
|
77
|
+
]).annotate({ identifier: "VisibilityFindingCode" });
|
|
78
|
+
export const VisibilityFindingSchema = Schema.Struct({
|
|
79
|
+
code: VisibilityFindingCodeSchema,
|
|
80
|
+
severity: Schema.Literals(["error", "warning"]),
|
|
81
|
+
message: Schema.String,
|
|
82
|
+
}).annotate({ identifier: "VisibilityFinding" });
|
|
83
|
+
export const VisibilityEvaluationSchema = Schema.Struct({
|
|
84
|
+
target: ExtensionFqnSchema,
|
|
85
|
+
intent: Schema.NullOr(VisibilityIntentSchema),
|
|
86
|
+
request: Schema.NullOr(ExtensionVisibilitySchema),
|
|
87
|
+
resolved: Schema.NullOr(PublishVisibilitySchema),
|
|
88
|
+
actual: Schema.NullOr(VisibilityActualSchema),
|
|
89
|
+
comparison: VisibilityComparisonSchema,
|
|
90
|
+
findings: Schema.Array(VisibilityFindingSchema),
|
|
91
|
+
}).annotate({ identifier: "VisibilityEvaluation" });
|
|
92
|
+
export const VisibilityEvaluationUnavailableSchema = Schema.Struct({
|
|
93
|
+
target: ExtensionFqnSchema,
|
|
94
|
+
unavailable: Schema.Literal(true),
|
|
95
|
+
findings: Schema.Array(VisibilityFindingSchema),
|
|
96
|
+
}).annotate({ identifier: "VisibilityEvaluationUnavailable" });
|
|
97
|
+
export const VisibilityEvaluationResultSchema = Schema.Union([
|
|
98
|
+
VisibilityEvaluationSchema,
|
|
99
|
+
VisibilityEvaluationUnavailableSchema,
|
|
100
|
+
]).annotate({ identifier: "VisibilityEvaluationResult" });
|
|
101
|
+
export const VisibilityMutationAuthoritySchema = Schema.Union([
|
|
102
|
+
Schema.Struct({ kind: Schema.Literal("operator") }),
|
|
103
|
+
Schema.Struct({
|
|
104
|
+
kind: Schema.Literal("repository"),
|
|
105
|
+
source: Schema.Literals(["manifest", "workspace"]),
|
|
106
|
+
fingerprint: VisibilityFingerprintSchema,
|
|
107
|
+
}),
|
|
108
|
+
]).annotate({ identifier: "VisibilityMutationAuthority" });
|
|
109
|
+
export const VisibilityMutationRequestSchema = Schema.Struct({
|
|
110
|
+
target: ExtensionFqnSchema,
|
|
111
|
+
visibility: ExtensionVisibilitySchema,
|
|
112
|
+
revision: VisibilityRevisionSchema,
|
|
113
|
+
authority: VisibilityMutationAuthoritySchema,
|
|
114
|
+
verification: Schema.optional(Schema.NonEmptyString),
|
|
115
|
+
}).annotate({ identifier: "VisibilityMutationRequest" });
|
|
116
|
+
export const VisibilityMutationResultSchema = Schema.Struct({
|
|
117
|
+
target: ExtensionFqnSchema,
|
|
118
|
+
before: ExtensionVisibilitySchema,
|
|
119
|
+
after: ExtensionVisibilitySchema,
|
|
120
|
+
authority: VisibilityMutationAuthoritySchema,
|
|
121
|
+
result: Schema.Literals(["already-satisfied", "changed"]),
|
|
122
|
+
revision: VisibilityRevisionSchema,
|
|
123
|
+
}).annotate({ identifier: "VisibilityMutationResult" });
|
|
124
|
+
//# sourceMappingURL=visibility.js.map
|