@agentxm/registry-protocol 0.28.11 → 0.28.13
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 +13 -5
- package/dist/src/unstable/human-handoff.d.ts +16 -0
- package/dist/src/unstable/human-handoff.js +19 -0
- package/dist/src/unstable/publish/index.d.ts +1 -6
- package/dist/src/unstable/publish/index.js +1 -6
- package/dist/src/unstable/publish-authorization.d.ts +26 -0
- package/dist/src/unstable/publish-authorization.js +41 -0
- package/dist/src/unstable/registry/discover-schema.d.ts +4 -4
- package/dist/src/unstable/registry/index.d.ts +1 -0
- package/dist/src/unstable/registry/index.js +1 -0
- package/dist/src/unstable/registry/version-selection.d.ts +22 -0
- package/dist/src/unstable/registry/version-selection.js +39 -0
- package/package.json +19 -190
- package/dist/src/unstable/content/agent-skills-standard.d.ts +0 -17
- package/dist/src/unstable/content/agent-skills-standard.js +0 -24
- package/dist/src/unstable/content/frontmatter.d.ts +0 -52
- package/dist/src/unstable/content/frontmatter.js +0 -115
- package/dist/src/unstable/content/index.d.ts +0 -11
- package/dist/src/unstable/content/index.js +0 -11
- package/dist/src/unstable/content/skill-content.d.ts +0 -43
- package/dist/src/unstable/content/skill-content.js +0 -184
- package/dist/src/unstable/content/skill-types.d.ts +0 -22
- package/dist/src/unstable/content/skill-types.js +0 -9
- package/dist/src/unstable/content/subagent-content.d.ts +0 -58
- package/dist/src/unstable/content/subagent-content.js +0 -101
- package/dist/src/unstable/knowledge/index.d.ts +0 -8
- package/dist/src/unstable/knowledge/index.js +0 -8
- package/dist/src/unstable/knowledge/knowledge-search.d.ts +0 -32
- package/dist/src/unstable/knowledge/knowledge-search.js +0 -147
- package/dist/src/unstable/knowledge/okf.d.ts +0 -86
- package/dist/src/unstable/knowledge/okf.js +0 -1090
- package/dist/src/unstable/lint/catalog/hook/decision-portability.d.ts +0 -4
- package/dist/src/unstable/lint/catalog/hook/decision-portability.js +0 -40
- package/dist/src/unstable/lint/catalog/hook/entrypoint-exists.d.ts +0 -4
- package/dist/src/unstable/lint/catalog/hook/entrypoint-exists.js +0 -39
- package/dist/src/unstable/lint/catalog/hook/envelope.d.ts +0 -6
- package/dist/src/unstable/lint/catalog/hook/envelope.js +0 -15
- package/dist/src/unstable/lint/catalog/hook/matcher-raw-portability.d.ts +0 -4
- package/dist/src/unstable/lint/catalog/hook/matcher-raw-portability.js +0 -51
- package/dist/src/unstable/lint/catalog/hook.d.ts +0 -4
- package/dist/src/unstable/lint/catalog/hook.js +0 -15
- package/dist/src/unstable/lint/catalog/knowledge/diagnostics.d.ts +0 -128
- package/dist/src/unstable/lint/catalog/knowledge/diagnostics.js +0 -78
- package/dist/src/unstable/lint/catalog/knowledge/envelope.d.ts +0 -6
- package/dist/src/unstable/lint/catalog/knowledge/envelope.js +0 -15
- package/dist/src/unstable/lint/catalog/knowledge.d.ts +0 -5
- package/dist/src/unstable/lint/catalog/knowledge.js +0 -9
- package/dist/src/unstable/lint/catalog/mcp-server/envelope.d.ts +0 -6
- package/dist/src/unstable/lint/catalog/mcp-server/envelope.js +0 -15
- package/dist/src/unstable/lint/catalog/mcp-server.d.ts +0 -4
- package/dist/src/unstable/lint/catalog/mcp-server.js +0 -4
- package/dist/src/unstable/lint/catalog/pack/manifest-keys-recognized.d.ts +0 -28
- package/dist/src/unstable/lint/catalog/pack/manifest-keys-recognized.js +0 -38
- package/dist/src/unstable/lint/catalog/pack/manifest-present.d.ts +0 -17
- package/dist/src/unstable/lint/catalog/pack/manifest-present.js +0 -24
- package/dist/src/unstable/lint/catalog/pack/manifest-schema-valid.d.ts +0 -25
- package/dist/src/unstable/lint/catalog/pack/manifest-schema-valid.js +0 -33
- package/dist/src/unstable/lint/catalog/pack-accessor/contexts.d.ts +0 -51
- package/dist/src/unstable/lint/catalog/pack-accessor/contexts.js +0 -45
- package/dist/src/unstable/lint/catalog/pack-accessor/vft.d.ts +0 -60
- package/dist/src/unstable/lint/catalog/pack-accessor/vft.js +0 -85
- package/dist/src/unstable/lint/catalog/pack.d.ts +0 -31
- package/dist/src/unstable/lint/catalog/pack.js +0 -36
- package/dist/src/unstable/lint/catalog/rule/envelope.d.ts +0 -6
- package/dist/src/unstable/lint/catalog/rule/envelope.js +0 -15
- package/dist/src/unstable/lint/catalog/rule.d.ts +0 -4
- package/dist/src/unstable/lint/catalog/rule.js +0 -4
- package/dist/src/unstable/lint/catalog/shared/envelope-rules.d.ts +0 -88
- package/dist/src/unstable/lint/catalog/shared/envelope-rules.js +0 -84
- package/dist/src/unstable/lint/catalog/shared/manifest-json.d.ts +0 -18
- package/dist/src/unstable/lint/catalog/shared/manifest-json.js +0 -28
- package/dist/src/unstable/lint/catalog/shared/manifest-present.d.ts +0 -25
- package/dist/src/unstable/lint/catalog/shared/manifest-present.js +0 -37
- package/dist/src/unstable/lint/catalog/shared/recommended-packs-rules.d.ts +0 -70
- package/dist/src/unstable/lint/catalog/shared/recommended-packs-rules.js +0 -139
- package/dist/src/unstable/lint/catalog/shared/schema-rule.d.ts +0 -57
- package/dist/src/unstable/lint/catalog/shared/schema-rule.js +0 -102
- package/dist/src/unstable/lint/catalog/skill/frontmatter-parseable.d.ts +0 -31
- package/dist/src/unstable/lint/catalog/skill/frontmatter-parseable.js +0 -148
- package/dist/src/unstable/lint/catalog/skill/frontmatter-standard-valid.d.ts +0 -13
- package/dist/src/unstable/lint/catalog/skill/frontmatter-standard-valid.js +0 -61
- package/dist/src/unstable/lint/catalog/skill/manifest-keys-recognized.d.ts +0 -26
- package/dist/src/unstable/lint/catalog/skill/manifest-keys-recognized.js +0 -41
- package/dist/src/unstable/lint/catalog/skill/manifest-present.d.ts +0 -23
- package/dist/src/unstable/lint/catalog/skill/manifest-present.js +0 -32
- package/dist/src/unstable/lint/catalog/skill/manifest-schema-valid.d.ts +0 -21
- package/dist/src/unstable/lint/catalog/skill/manifest-schema-valid.js +0 -36
- package/dist/src/unstable/lint/catalog/skill/recommended-packs-valid.d.ts +0 -8
- package/dist/src/unstable/lint/catalog/skill/recommended-packs-valid.js +0 -12
- package/dist/src/unstable/lint/catalog/skill/skill-md-present.d.ts +0 -17
- package/dist/src/unstable/lint/catalog/skill/skill-md-present.js +0 -37
- package/dist/src/unstable/lint/catalog/skill/standalone-declaration-valid.d.ts +0 -8
- package/dist/src/unstable/lint/catalog/skill/standalone-declaration-valid.js +0 -12
- package/dist/src/unstable/lint/catalog/skill-accessor/contexts.d.ts +0 -61
- package/dist/src/unstable/lint/catalog/skill-accessor/contexts.js +0 -55
- package/dist/src/unstable/lint/catalog/skill-accessor/vft.d.ts +0 -77
- package/dist/src/unstable/lint/catalog/skill-accessor/vft.js +0 -135
- package/dist/src/unstable/lint/catalog/skill.d.ts +0 -38
- package/dist/src/unstable/lint/catalog/skill.js +0 -53
- package/dist/src/unstable/lint/catalog/subagent/envelope.d.ts +0 -6
- package/dist/src/unstable/lint/catalog/subagent/envelope.js +0 -15
- package/dist/src/unstable/lint/catalog/subagent.d.ts +0 -4
- package/dist/src/unstable/lint/catalog/subagent.js +0 -4
- package/dist/src/unstable/lint/catalog-metadata.d.ts +0 -125
- package/dist/src/unstable/lint/catalog-metadata.js +0 -642
- package/dist/src/unstable/lint/compose-path.d.ts +0 -28
- package/dist/src/unstable/lint/compose-path.js +0 -64
- package/dist/src/unstable/lint/config.d.ts +0 -77
- package/dist/src/unstable/lint/config.js +0 -99
- package/dist/src/unstable/lint/context.d.ts +0 -239
- package/dist/src/unstable/lint/context.js +0 -17
- package/dist/src/unstable/lint/describe-document.d.ts +0 -31
- package/dist/src/unstable/lint/describe-document.js +0 -50
- package/dist/src/unstable/lint/evaluate.d.ts +0 -47
- package/dist/src/unstable/lint/evaluate.js +0 -73
- package/dist/src/unstable/lint/issues-to-findings.d.ts +0 -35
- package/dist/src/unstable/lint/issues-to-findings.js +0 -149
- package/dist/src/unstable/lint/publish.d.ts +0 -49
- package/dist/src/unstable/lint/publish.js +0 -86
- package/dist/src/unstable/lint/rule.d.ts +0 -97
- package/dist/src/unstable/lint/rule.js +0 -17
- package/dist/src/unstable/publish/archive-guardrails.d.ts +0 -39
- package/dist/src/unstable/publish/archive-guardrails.js +0 -250
- package/dist/src/unstable/publish/filtered-package-validation.d.ts +0 -24
- package/dist/src/unstable/publish/filtered-package-validation.js +0 -117
- package/dist/src/unstable/publish/ingest-limits.d.ts +0 -25
- package/dist/src/unstable/publish/ingest-limits.js +0 -41
- package/dist/src/unstable/publish/input-normalization.d.ts +0 -40
- package/dist/src/unstable/publish/input-normalization.js +0 -125
- package/dist/src/unstable/publish/manifest-policy.d.ts +0 -611
- package/dist/src/unstable/publish/manifest-policy.js +0 -196
- package/dist/src/unstable/publish/test-zip-helpers.d.ts +0 -13
- package/dist/src/unstable/publish/test-zip-helpers.js +0 -117
- package/dist/src/unstable/registry/release-age-policy.d.ts +0 -57
- package/dist/src/unstable/registry/release-age-policy.js +0 -117
|
@@ -1,196 +0,0 @@
|
|
|
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
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
|
@@ -1,117 +0,0 @@
|
|
|
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
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import * as Duration from "effect/Duration";
|
|
2
|
-
import * as Effect from "effect/Effect";
|
|
3
|
-
import * as Option from "effect/Option";
|
|
4
|
-
import type { ExtensionFqnParts } from "@agentxm/extension-model/unstable/extensions/common";
|
|
5
|
-
import type { ReleaseAgeEvaluation, ReleaseAgeEvidence, ReleaseAgeExemption } from "@agentxm/extension-model/unstable/extensions/release-age";
|
|
6
|
-
import type { VersionEntry } from "./schema.js";
|
|
7
|
-
export declare const releaseAgeExemptionForIdentity: (evaluation: ReleaseAgeEvaluation, identity: ExtensionFqnParts) => ReleaseAgeExemption | undefined;
|
|
8
|
-
export interface ReleaseAgeRecordBase {
|
|
9
|
-
readonly reason: "minimum-release-age";
|
|
10
|
-
readonly target: string;
|
|
11
|
-
readonly dependencyPath: ReadonlyArray<string>;
|
|
12
|
-
readonly requestedRange?: string;
|
|
13
|
-
readonly currentVersion?: string;
|
|
14
|
-
readonly selectedVersion?: string;
|
|
15
|
-
readonly candidateVersion: string;
|
|
16
|
-
readonly publishedAt: string;
|
|
17
|
-
readonly eligibleAt: string;
|
|
18
|
-
readonly minimumReleaseAgeSeconds: number;
|
|
19
|
-
}
|
|
20
|
-
export type ReleaseAgeHoldbackRecord = ReleaseAgeRecordBase;
|
|
21
|
-
export type ReleaseAgeBypassRecord = ReleaseAgeRecordBase & ({
|
|
22
|
-
readonly bypassCause: "exclude";
|
|
23
|
-
readonly exemptionScope: "project" | "user";
|
|
24
|
-
} | {
|
|
25
|
-
readonly bypassCause: "ignore-flag";
|
|
26
|
-
});
|
|
27
|
-
export type ReleaseAgeRecord = ReleaseAgeHoldbackRecord | ReleaseAgeBypassRecord;
|
|
28
|
-
export interface ReleaseAgeOperationEvidence {
|
|
29
|
-
readonly evaluatedAt: string;
|
|
30
|
-
readonly holdbacks: ReadonlyArray<ReleaseAgeHoldbackRecord>;
|
|
31
|
-
readonly bypasses: ReadonlyArray<ReleaseAgeBypassRecord>;
|
|
32
|
-
}
|
|
33
|
-
/** Deduplicate and order operation evidence independently from concurrent resolution order. */
|
|
34
|
-
export declare const normalizeReleaseAgeRecords: <Record extends ReleaseAgeRecord>(records: ReadonlyArray<Record>) => ReadonlyArray<Record>;
|
|
35
|
-
export declare const DEFAULT_MINIMUM_RELEASE_AGE = "24h";
|
|
36
|
-
export declare const DEFAULT_MINIMUM_RELEASE_AGE_DURATION: Duration.Duration;
|
|
37
|
-
export declare const parseMinimumReleaseAge: (value: string) => Option.Option<Duration.Duration>;
|
|
38
|
-
/**
|
|
39
|
-
* Render a release-age window in the compact grammar the setting accepts, so
|
|
40
|
-
* output names the policy in the same units the reader would configure.
|
|
41
|
-
*
|
|
42
|
-
* Days are used only from two days up: the default window is written `24h`,
|
|
43
|
-
* and reporting it as `1d` would not match the setting the reader would edit.
|
|
44
|
-
* Falls back to whole seconds when the window is not a clean larger unit.
|
|
45
|
-
*/
|
|
46
|
-
export declare const formatMinimumReleaseAgeSeconds: (seconds: number) => string;
|
|
47
|
-
export declare const isVersionEntryMature: (entry: VersionEntry, minimumAge: Duration.Duration) => Effect.Effect<boolean>;
|
|
48
|
-
export declare const isVersionEntryEligibleAt: (entry: VersionEntry, evaluation: ReleaseAgeEvaluation) => boolean;
|
|
49
|
-
export declare const releaseAgeEvidence: (entry: VersionEntry, evaluation: ReleaseAgeEvaluation) => ReleaseAgeEvidence;
|
|
50
|
-
export declare const filterMatureVersions: (versions: ReadonlyArray<VersionEntry>, minimumAge: Duration.Duration) => Effect.Effect<ReadonlyArray<VersionEntry>>;
|
|
51
|
-
export declare const releaseAgeHoldbackWarning: (args: {
|
|
52
|
-
readonly fqn: string;
|
|
53
|
-
readonly selectedVersion: string;
|
|
54
|
-
readonly heldVersion: string;
|
|
55
|
-
readonly minimumReleaseAge: string;
|
|
56
|
-
}) => string;
|
|
57
|
-
//# sourceMappingURL=release-age-policy.d.ts.map
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import * as DateTime from "effect/DateTime";
|
|
2
|
-
import * as Duration from "effect/Duration";
|
|
3
|
-
import * as Effect from "effect/Effect";
|
|
4
|
-
import * as Option from "effect/Option";
|
|
5
|
-
import { matchesReleaseAgeExcludePattern } from "@agentxm/extension-model/unstable/extensions/fqn-pattern";
|
|
6
|
-
export const releaseAgeExemptionForIdentity = (evaluation, identity) => {
|
|
7
|
-
if (evaluation.grantedExemption !== undefined)
|
|
8
|
-
return evaluation.grantedExemption;
|
|
9
|
-
const excluded = evaluation.exclude?.find(({ pattern }) => matchesReleaseAgeExcludePattern(pattern, identity));
|
|
10
|
-
if (excluded !== undefined) {
|
|
11
|
-
return { bypassCause: "exclude", exemptionScope: excluded.scope };
|
|
12
|
-
}
|
|
13
|
-
return evaluation.mode === "ignore" ? { bypassCause: "ignore-flag" } : undefined;
|
|
14
|
-
};
|
|
15
|
-
const releaseAgeRecordKey = (record) => [
|
|
16
|
-
record.target,
|
|
17
|
-
...record.dependencyPath,
|
|
18
|
-
record.candidateVersion,
|
|
19
|
-
record.selectedVersion ?? "",
|
|
20
|
-
record.currentVersion ?? "",
|
|
21
|
-
record.requestedRange ?? "",
|
|
22
|
-
"bypassCause" in record ? record.bypassCause : "",
|
|
23
|
-
"exemptionScope" in record ? record.exemptionScope : "",
|
|
24
|
-
].join("\u0000");
|
|
25
|
-
/** Deduplicate and order operation evidence independently from concurrent resolution order. */
|
|
26
|
-
export const normalizeReleaseAgeRecords = (records) => {
|
|
27
|
-
const byKey = new Map();
|
|
28
|
-
for (const record of records) {
|
|
29
|
-
byKey.set(releaseAgeRecordKey(record), record);
|
|
30
|
-
}
|
|
31
|
-
return [...byKey.entries()]
|
|
32
|
-
.sort(([left], [right]) => left.localeCompare(right))
|
|
33
|
-
.map(([, record]) => record);
|
|
34
|
-
};
|
|
35
|
-
export const DEFAULT_MINIMUM_RELEASE_AGE = "24h";
|
|
36
|
-
export const DEFAULT_MINIMUM_RELEASE_AGE_DURATION = Duration.hours(24);
|
|
37
|
-
/**
|
|
38
|
-
* Documented exception: hand-rolled parser for the compact duration grammar
|
|
39
|
-
* (`24h`, `30d`, `500ms`).
|
|
40
|
-
*
|
|
41
|
-
* Effect v4 has no `Duration.decode`; the closest constructors are
|
|
42
|
-
* `Duration.fromInput` / `Duration.fromInputUnsafe`, and the `Duration.Input`
|
|
43
|
-
* string form only accepts space-separated long-unit strings ("30 days"), so
|
|
44
|
-
* the compact grammar is not expressible upstream. `durationPattern` and
|
|
45
|
-
* `parseMinimumReleaseAge` therefore stay as a thin syntax adapter over the
|
|
46
|
-
* `Duration` constructors (`Duration.millis` / `seconds` / `minutes` /
|
|
47
|
-
* `hours` / `days`).
|
|
48
|
-
*
|
|
49
|
-
* Removal condition: upstream `Duration` accepting the compact unit grammar.
|
|
50
|
-
*/
|
|
51
|
-
const durationPattern = /^(\d+)(ms|s|m|h|d)$/;
|
|
52
|
-
export const parseMinimumReleaseAge = (value) => {
|
|
53
|
-
const trimmed = value.trim();
|
|
54
|
-
const match = durationPattern.exec(trimmed);
|
|
55
|
-
if (match === null)
|
|
56
|
-
return Option.none();
|
|
57
|
-
const amountText = match[1];
|
|
58
|
-
const unit = match[2];
|
|
59
|
-
if (amountText === undefined || unit === undefined)
|
|
60
|
-
return Option.none();
|
|
61
|
-
const amount = Number(amountText);
|
|
62
|
-
if (!Number.isSafeInteger(amount))
|
|
63
|
-
return Option.none();
|
|
64
|
-
switch (unit) {
|
|
65
|
-
case "ms":
|
|
66
|
-
return Option.some(Duration.millis(amount));
|
|
67
|
-
case "s":
|
|
68
|
-
return Option.some(Duration.seconds(amount));
|
|
69
|
-
case "m":
|
|
70
|
-
return Option.some(Duration.minutes(amount));
|
|
71
|
-
case "h":
|
|
72
|
-
return Option.some(Duration.hours(amount));
|
|
73
|
-
case "d":
|
|
74
|
-
return Option.some(Duration.days(amount));
|
|
75
|
-
}
|
|
76
|
-
// Unreachable at runtime, but `unit` is typed `string` (a regex capture),
|
|
77
|
-
// so the switch is not statically exhaustive and the compiler (TS2366)
|
|
78
|
-
// requires this ending return.
|
|
79
|
-
return Option.none();
|
|
80
|
-
};
|
|
81
|
-
/**
|
|
82
|
-
* Render a release-age window in the compact grammar the setting accepts, so
|
|
83
|
-
* output names the policy in the same units the reader would configure.
|
|
84
|
-
*
|
|
85
|
-
* Days are used only from two days up: the default window is written `24h`,
|
|
86
|
-
* and reporting it as `1d` would not match the setting the reader would edit.
|
|
87
|
-
* Falls back to whole seconds when the window is not a clean larger unit.
|
|
88
|
-
*/
|
|
89
|
-
export const formatMinimumReleaseAgeSeconds = (seconds) => {
|
|
90
|
-
const whole = Math.max(0, Math.round(seconds));
|
|
91
|
-
if (whole === 0)
|
|
92
|
-
return "0s";
|
|
93
|
-
if (whole % 86_400 === 0 && whole >= 172_800)
|
|
94
|
-
return `${whole / 86_400}d`;
|
|
95
|
-
if (whole % 3_600 === 0)
|
|
96
|
-
return `${whole / 3_600}h`;
|
|
97
|
-
if (whole % 60 === 0)
|
|
98
|
-
return `${whole / 60}m`;
|
|
99
|
-
return `${whole}s`;
|
|
100
|
-
};
|
|
101
|
-
export const isVersionEntryMature = (entry, minimumAge) => Duration.isLessThanOrEqualTo(minimumAge, Duration.zero)
|
|
102
|
-
? Effect.succeed(true)
|
|
103
|
-
: DateTime.now.pipe(Effect.map((now) =>
|
|
104
|
-
// Inclusive at the boundary: a release published exactly `minimumAge`
|
|
105
|
-
// ago is mature, matching the original `now - published >= minimumAge`.
|
|
106
|
-
DateTime.isLessThanOrEqualTo(DateTime.addDuration(entry.published, minimumAge), now)));
|
|
107
|
-
export const isVersionEntryEligibleAt = (entry, evaluation) => Duration.isLessThanOrEqualTo(evaluation.minimumReleaseAge, Duration.zero) ||
|
|
108
|
-
DateTime.isLessThanOrEqualTo(DateTime.addDuration(entry.published, evaluation.minimumReleaseAge), evaluation.evaluatedAt);
|
|
109
|
-
export const releaseAgeEvidence = (entry, evaluation) => ({
|
|
110
|
-
version: entry.version,
|
|
111
|
-
publishedAt: DateTime.formatIso(entry.published),
|
|
112
|
-
eligibleAt: DateTime.formatIso(DateTime.addDuration(entry.published, evaluation.minimumReleaseAge)),
|
|
113
|
-
minimumReleaseAgeSeconds: Math.max(0, Duration.toMillis(evaluation.minimumReleaseAge) / 1_000),
|
|
114
|
-
});
|
|
115
|
-
export const filterMatureVersions = (versions, minimumAge) => Effect.filter(versions, (entry) => isVersionEntryMature(entry, minimumAge));
|
|
116
|
-
export const releaseAgeHoldbackWarning = (args) => `${args.fqn} held at ${args.selectedVersion} — ${args.heldVersion} has not reached the ${args.minimumReleaseAge} minimum release age`;
|
|
117
|
-
//# sourceMappingURL=release-age-policy.js.map
|