@agenticprimitives/content-storage 0.1.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.
Files changed (72) hide show
  1. package/CLAUDE.md +55 -0
  2. package/LICENSE +21 -0
  3. package/README.md +69 -0
  4. package/dist/access.d.ts +64 -0
  5. package/dist/access.d.ts.map +1 -0
  6. package/dist/access.js +30 -0
  7. package/dist/access.js.map +1 -0
  8. package/dist/anchors.d.ts +31 -0
  9. package/dist/anchors.d.ts.map +1 -0
  10. package/dist/anchors.js +12 -0
  11. package/dist/anchors.js.map +1 -0
  12. package/dist/bundle.d.ts +39 -0
  13. package/dist/bundle.d.ts.map +1 -0
  14. package/dist/bundle.js +57 -0
  15. package/dist/bundle.js.map +1 -0
  16. package/dist/canonicalization.d.ts +5 -0
  17. package/dist/canonicalization.d.ts.map +1 -0
  18. package/dist/canonicalization.js +11 -0
  19. package/dist/canonicalization.js.map +1 -0
  20. package/dist/containment.d.ts +40 -0
  21. package/dist/containment.d.ts.map +1 -0
  22. package/dist/containment.js +53 -0
  23. package/dist/containment.js.map +1 -0
  24. package/dist/context.d.ts +28 -0
  25. package/dist/context.d.ts.map +1 -0
  26. package/dist/context.js +27 -0
  27. package/dist/context.js.map +1 -0
  28. package/dist/index.d.ts +33 -0
  29. package/dist/index.d.ts.map +1 -0
  30. package/dist/index.js +51 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/manifest.d.ts +38 -0
  33. package/dist/manifest.d.ts.map +1 -0
  34. package/dist/manifest.js +70 -0
  35. package/dist/manifest.js.map +1 -0
  36. package/dist/publish.d.ts +62 -0
  37. package/dist/publish.d.ts.map +1 -0
  38. package/dist/publish.js +81 -0
  39. package/dist/publish.js.map +1 -0
  40. package/dist/receipts.d.ts +21 -0
  41. package/dist/receipts.d.ts.map +1 -0
  42. package/dist/receipts.js +13 -0
  43. package/dist/receipts.js.map +1 -0
  44. package/dist/relations.d.ts +23 -0
  45. package/dist/relations.d.ts.map +1 -0
  46. package/dist/relations.js +19 -0
  47. package/dist/relations.js.map +1 -0
  48. package/dist/release.d.ts +56 -0
  49. package/dist/release.d.ts.map +1 -0
  50. package/dist/release.js +30 -0
  51. package/dist/release.js.map +1 -0
  52. package/dist/resolver.d.ts +42 -0
  53. package/dist/resolver.d.ts.map +1 -0
  54. package/dist/resolver.js +58 -0
  55. package/dist/resolver.js.map +1 -0
  56. package/dist/storage-port.d.ts +81 -0
  57. package/dist/storage-port.d.ts.map +1 -0
  58. package/dist/storage-port.js +2 -0
  59. package/dist/storage-port.js.map +1 -0
  60. package/dist/types.d.ts +121 -0
  61. package/dist/types.d.ts.map +1 -0
  62. package/dist/types.js +2 -0
  63. package/dist/types.js.map +1 -0
  64. package/dist/versioning.d.ts +22 -0
  65. package/dist/versioning.d.ts.map +1 -0
  66. package/dist/versioning.js +13 -0
  67. package/dist/versioning.js.map +1 -0
  68. package/dist/wire.d.ts +88 -0
  69. package/dist/wire.d.ts.map +1 -0
  70. package/dist/wire.js +81 -0
  71. package/dist/wire.js.map +1 -0
  72. package/package.json +57 -0
@@ -0,0 +1,33 @@
1
+ export declare const PACKAGE_NAME = "@agenticprimitives/content-storage";
2
+ export declare const PACKAGE_STATUS: "scaffold";
3
+ export declare const SPEC_REF = "specs/335-content-artifact-managed-storage.md";
4
+ export type { BlobRef, ArtifactAccessPolicy, ArtifactCommitment, MediaChunking, ArtifactStorage, ArtifactMedia, ArtifactDescriptor, ContentArtifact, ArtifactBundle, BundleKind, BundleMemberRole, } from './types.js';
5
+ export { BUNDLE_MEMBER_ROLES, inferMemberRole, bundleManifestRoot, bundleResourceId, verifyBundleRoot, proveBundleMember, verifyBundleMember, } from './bundle.js';
6
+ export type { BundleMember, BundleManifest } from './bundle.js';
7
+ export type { PutOpts, BlobStat, PresignedUpload, StorageProvider, StoragePort, } from './storage-port.js';
8
+ export { validateStorageManifest, assertStorageManifest, resolveBackend, } from './manifest.js';
9
+ export type { StorageManifest, StorageBackend, ManifestFinding, } from './manifest.js';
10
+ export { parseRetrievalPointer, artifactSourceOf, blobPointer, ArtifactResolverRegistry, } from './resolver.js';
11
+ export type { ArtifactSource, ResolvedPointer, ArtifactResolver, } from './resolver.js';
12
+ export { artifactResourceId, resourceForArtifact, buildArtifactAccessGrant, } from './access.js';
13
+ export type { AgentKind, AgentRef, ArtifactAction, ArtifactAccessGrant, ArtifactAccessEntry, } from './access.js';
14
+ export { ARTIFACT_CONTEXT_KIND, artifactContextRef, isArtifactContextRef, } from './context.js';
15
+ export type { ArtifactContextRef } from './context.js';
16
+ export { containerResourceId, ancestorPaths, ancestorContainerResources, containmentRoot, proveMembership, verifyMembership, resolveWithInheritance, } from './containment.js';
17
+ export type { InheritableResolver } from './containment.js';
18
+ export { canonicalDigest, jcsCanonicalize } from './canonicalization.js';
19
+ export { versionId, verifyVersionId } from './versioning.js';
20
+ export type { VersionManifest, VersionStatus } from './versioning.js';
21
+ export { computeLockDigest, buildDependencyLock, computeReleaseId, verifyReleaseId, } from './release.js';
22
+ export type { SkillRelease, DependencyPin, DependencyLock, RiskDeclaration, RiskTier, ReleaseProvenance, } from './release.js';
23
+ export { buildReceipt, verifyReceipt } from './receipts.js';
24
+ export type { LifecycleReceipt, ReceiptKind } from './receipts.js';
25
+ export { relationId, buildRelation, verifyRelation, INVERSE_RELATION } from './relations.js';
26
+ export type { ArtifactRelation, RelationType } from './relations.js';
27
+ export { anchorId, buildAnchor, verifyAnchor } from './anchors.js';
28
+ export type { ContentAnchor, AnchorSelector } from './anchors.js';
29
+ export { A2A_CONTENT_INTENTS, AP_VAULT_SCHEME, vaultResourceId, parseVaultResourceId, isRepresentationValid, CONTENT_RECORD_FAMILY, CONTENT_CATALOG_RECORD, toVaultRecordResource, containerRecordScope, } from './wire.js';
30
+ export type { A2AContentIntent, A2AContentMessage, ContentAccessRequest, ContentPatchProposal, SkillPublishRequest, VaultExportRequest, VaultResourceKind, VaultResourceRef, RepresentationCapability, } from './wire.js';
31
+ export { buildRelease, isAuthorizedPublisher, compareVersions, validatePublication, buildOwnershipTransfer, verifyOwnershipTransfer, applyOwnershipTransfer, } from './publish.js';
32
+ export type { BuildReleaseInput, PublicationCheck, OwnershipTransfer } from './publish.js';
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,YAAY,uCAAuC,CAAC;AACjE,eAAO,MAAM,cAAc,EAAG,UAAmB,CAAC;AAClD,eAAO,MAAM,QAAQ,kDAAkD,CAAC;AAExE,YAAY,EACV,OAAO,EACP,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,UAAU,EACV,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAIpB,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEhE,YAAY,EACV,OAAO,EACP,QAAQ,EACR,eAAe,EACf,eAAe,EACf,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,cAAc,GACf,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,eAAe,EACf,cAAc,EACd,eAAe,GAChB,MAAM,eAAe,CAAC;AAIvB,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,wBAAwB,GACzB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,cAAc,EACd,eAAe,EACf,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAIvB,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,SAAS,EACT,QAAQ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f,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,WAAW,CAAC;AACnB,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,WAAW,CAAC;AAInB,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,51 @@
1
+ // @agenticprimitives/content-storage — managed storage for Content Artifacts.
2
+ //
3
+ // The STORED complement to content-primitives' referenced content (ADR-0033): SKILL.md, .ttl,
4
+ // .md, JSON-LD, and the images/video that travel with them, stored in a client-side
5
+ // envelope-encrypted, content-addressed blob store behind a provider-agnostic `StoragePort`,
6
+ // entitlement-gated (§7) and provenance-anchored (§8). The concrete storage driver + KMS
7
+ // `DekWrapper` are injected (ADR-0037); this package owns the model, the port, and the manifest.
8
+ //
9
+ // See: ../../specs/335-content-artifact-managed-storage.md
10
+ export const PACKAGE_NAME = '@agenticprimitives/content-storage';
11
+ export const PACKAGE_STATUS = 'scaffold';
12
+ export const SPEC_REF = 'specs/335-content-artifact-managed-storage.md';
13
+ // Skill/doc bundles — a skill is a DIRECTORY (SKILL.md + SPARQL/code/schema/media), not one file; a
14
+ // bundle IS a Container whose manifest root is the containment `containmentRoot` (spec 335 §7.2).
15
+ export { BUNDLE_MEMBER_ROLES, inferMemberRole, bundleManifestRoot, bundleResourceId, verifyBundleRoot, proveBundleMember, verifyBundleMember, } from './bundle.js';
16
+ export { validateStorageManifest, assertStorageManifest, resolveBackend, } from './manifest.js';
17
+ // Multi-source resolution — an artifact abstracts over WHERE its bytes live (blob / graphdb / vault /
18
+ // external); the access layer is uniform across all of them (spec 335 §5.1).
19
+ export { parseRetrievalPointer, artifactSourceOf, blobPointer, ArtifactResolverRegistry, } from './resolver.js';
20
+ // Per-artifact access management — grant a person/org/service agent access to a specific artifact,
21
+ // uniform across sources (spec 335 §7.1).
22
+ export { artifactResourceId, resourceForArtifact, buildArtifactAccessGrant, } from './access.js';
23
+ // The shared "about-ness" link that binds an artifact into messaging / discussion / notifications /
24
+ // coordination out of the box (spec 335 §7.1).
25
+ export { ARTIFACT_CONTEXT_KIND, artifactContextRef, isArtifactContextRef, } from './context.js';
26
+ // Containment hierarchy — one transitive part-of over BOTH document folders AND spatial regions
27
+ // (country → state → … → point): a grant on a container cascades to its whole subtree, and subtree
28
+ // membership is Merkle-provable via `containmentRoot` (reusing the audited content-primitives merkle;
29
+ // the `containment-membership-v1` atom). See spec 335 §7.2 and ontology at:Container/at:contains.
30
+ export { containerResourceId, ancestorPaths, ancestorContainerResources, containmentRoot, proveMembership, verifyMembership, resolveWithInheritance, } from './containment.js';
31
+ // ── Contracts-before-storage (Phase 2): versioned schemas + the skill trust fabric ──
32
+ // The ONE canonicalization stack (RFC 8785 JCS + keccak256) every stable id/digest derives from.
33
+ export { canonicalDigest, jcsCanonicalize } from './canonicalization.js';
34
+ // Immutable, append-only version manifests — identity is a canonical digest over identity-bearing fields.
35
+ export { versionId, verifyVersionId } from './versioning.js';
36
+ // The skill supply chain: a release is a governed package (exact bundle + dependency lock + risk),
37
+ // owner/publisher separated, with a location-INDEPENDENT canonical id + release id (spec 335 §6).
38
+ export { computeLockDigest, buildDependencyLock, computeReleaseId, verifyReleaseId, } from './release.js';
39
+ // Tamper-evident lifecycle receipts (install/activate/use/outcome/read/access).
40
+ export { buildReceipt, verifyReceipt } from './receipts.js';
41
+ // Typed relations (the relational content graph) + span-level content anchors (citations / anchored
42
+ // discussion / span provenance), each identified by a canonical digest over its identifying fields.
43
+ export { relationId, buildRelation, verifyRelation, INVERSE_RELATION } from './relations.js';
44
+ export { anchorId, buildAnchor, verifyAnchor } from './anchors.js';
45
+ // The A2A + MCP content-fabric wire profiles (ADR-0055, spec 335 §13): A2A intents, the `ap-vault://`
46
+ // MCP resource-id scheme, and the short-lived audience-bound representation capability.
47
+ export { A2A_CONTENT_INTENTS, AP_VAULT_SCHEME, vaultResourceId, parseVaultResourceId, isRepresentationValid, CONTENT_RECORD_FAMILY, CONTENT_CATALOG_RECORD, toVaultRecordResource, containerRecordScope, } from './wire.js';
48
+ // The skill publication rules (ADR-0055 §5): owner-gated, append-only, version-monotonic publication with
49
+ // delegated publishers, plus signed ownership transfer that never rewrites the canonical id or history.
50
+ export { buildRelease, isAuthorizedPublisher, compareVersions, validatePublication, buildOwnershipTransfer, verifyOwnershipTransfer, applyOwnershipTransfer, } from './publish.js';
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,EAAE;AACF,8FAA8F;AAC9F,oFAAoF;AACpF,6FAA6F;AAC7F,yFAAyF;AACzF,iGAAiG;AACjG,EAAE;AACF,2DAA2D;AAE3D,MAAM,CAAC,MAAM,YAAY,GAAG,oCAAoC,CAAC;AACjE,MAAM,CAAC,MAAM,cAAc,GAAG,UAAmB,CAAC;AAClD,MAAM,CAAC,MAAM,QAAQ,GAAG,+CAA+C,CAAC;AAgBxE,oGAAoG;AACpG,kGAAkG;AAClG,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAWrB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,cAAc,GACf,MAAM,eAAe,CAAC;AAOvB,sGAAsG;AACtG,6EAA6E;AAC7E,OAAO,EACL,qBAAqB,EACrB,gBAAgB,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G;AACxG,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,cAAc,CAAC"}
@@ -0,0 +1,38 @@
1
+ /** One storage backend a deployment can target. */
2
+ export interface StorageBackend {
3
+ /** Stable id referenced by artifacts/routes. */
4
+ id: string;
5
+ /** Opaque platform tag the `StorageProvider` driver switches on (`r2` | `s3` | `gcs` | `b2` | `ipfs`). */
6
+ platform: string;
7
+ /** The bucket / namespace within the provider. */
8
+ bucket: string;
9
+ /** Name of the env var holding the provider credential — NEVER the credential itself. */
10
+ credentialEnv: string;
11
+ /** KMS key id (KEK) used to wrap per-object DEKs for artifacts in this backend. */
12
+ kekId: string;
13
+ /** Optional endpoint override (S3-compatible providers). No hostname is hard-coded (ADR-0021). */
14
+ endpointEnv?: string;
15
+ /** Writer-specific config — kept open so a provider driver can carry its own fields. */
16
+ [key: string]: unknown;
17
+ }
18
+ export interface StorageManifest {
19
+ version: 'content-storage-manifest-v1';
20
+ /** The default backend id when an artifact does not name one. */
21
+ defaultBackend: string;
22
+ backends: StorageBackend[];
23
+ }
24
+ export interface ManifestFinding {
25
+ level: 'error' | 'warn';
26
+ path: string;
27
+ message: string;
28
+ }
29
+ /**
30
+ * Pure, fail-closed structural validation of a storage manifest. Returns findings; `error`-level
31
+ * findings mean the manifest MUST NOT be used. Mirrors ap-kms `validateManifest`.
32
+ */
33
+ export declare function validateStorageManifest(manifest: unknown): ManifestFinding[];
34
+ /** Throwing form — use at boot. */
35
+ export declare function assertStorageManifest(manifest: unknown): asserts manifest is StorageManifest;
36
+ /** Resolve the backend an artifact should use, defaulting per the manifest. */
37
+ export declare function resolveBackend(manifest: StorageManifest, backendId?: string): StorageBackend;
38
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAKA,mDAAmD;AACnD,MAAM,WAAW,cAAc;IAC7B,gDAAgD;IAChD,EAAE,EAAE,MAAM,CAAC;IACX,0GAA0G;IAC1G,QAAQ,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,yFAAyF;IACzF,aAAa,EAAE,MAAM,CAAC;IACtB,mFAAmF;IACnF,KAAK,EAAE,MAAM,CAAC;IACd,kGAAkG;IAClG,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wFAAwF;IACxF,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,6BAA6B,CAAC;IACvC,iEAAiE;IACjE,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAID;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,OAAO,GAAG,eAAe,EAAE,CAkC5E;AAED,mCAAmC;AACnC,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,IAAI,eAAe,CAK5F;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,CAAC,QAAQ,EAAE,eAAe,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,CAK5F"}
@@ -0,0 +1,70 @@
1
+ // Declarative storage manifest (spec 335 §5) — the single source of truth for which blob backend
2
+ // an artifact deployment uses, mirroring ap-kms's manifest discipline (ADR-0037): the `platform`
3
+ // tag is opaque, provider credentials are NEVER in the manifest (they're read from an env var the
4
+ // manifest NAMES), and `validateStorageManifest` is a pure, fail-closed structural gate.
5
+ const ID_RE = /^[a-z0-9][a-z0-9-]{0,63}$/;
6
+ /**
7
+ * Pure, fail-closed structural validation of a storage manifest. Returns findings; `error`-level
8
+ * findings mean the manifest MUST NOT be used. Mirrors ap-kms `validateManifest`.
9
+ */
10
+ export function validateStorageManifest(manifest) {
11
+ const out = [];
12
+ const err = (path, message) => out.push({ level: 'error', path, message });
13
+ if (typeof manifest !== 'object' || manifest === null) {
14
+ err('$', 'manifest must be an object');
15
+ return out;
16
+ }
17
+ const m = manifest;
18
+ if (m.version !== 'content-storage-manifest-v1')
19
+ err('version', 'version must be "content-storage-manifest-v1"');
20
+ if (!Array.isArray(m.backends) || m.backends.length === 0) {
21
+ err('backends', 'backends must be a non-empty array');
22
+ return out;
23
+ }
24
+ const ids = new Set();
25
+ m.backends.forEach((b, i) => {
26
+ const p = `backends[${i}]`;
27
+ if (typeof b !== 'object' || b === null) {
28
+ err(p, 'backend must be an object');
29
+ return;
30
+ }
31
+ if (!ID_RE.test(String(b.id ?? '')))
32
+ err(`${p}.id`, 'id must be kebab-case [a-z0-9-], ≤64 chars');
33
+ else if (ids.has(b.id))
34
+ err(`${p}.id`, `duplicate backend id "${b.id}"`);
35
+ else
36
+ ids.add(b.id);
37
+ if (!b.platform)
38
+ err(`${p}.platform`, 'platform tag required');
39
+ if (!b.bucket)
40
+ err(`${p}.bucket`, 'bucket required');
41
+ // Credentials must be referenced by env-var NAME, never inlined (ADR-0021 / ap-kms discipline).
42
+ if (!b.credentialEnv)
43
+ err(`${p}.credentialEnv`, 'credentialEnv (the env var NAME) required');
44
+ if (typeof b.credentialEnv === 'string' && b.credentialEnv.startsWith('AKIA'))
45
+ err(`${p}.credentialEnv`, 'looks like a credential value, not an env-var name — never inline secrets');
46
+ if (!b.kekId)
47
+ err(`${p}.kekId`, 'kekId (KMS KEK for envelope encryption) required');
48
+ });
49
+ if (!m.defaultBackend)
50
+ err('defaultBackend', 'defaultBackend required');
51
+ else if (!ids.has(m.defaultBackend))
52
+ err('defaultBackend', `defaultBackend "${m.defaultBackend}" is not a declared backend id`);
53
+ return out;
54
+ }
55
+ /** Throwing form — use at boot. */
56
+ export function assertStorageManifest(manifest) {
57
+ const findings = validateStorageManifest(manifest).filter((f) => f.level === 'error');
58
+ if (findings.length > 0) {
59
+ throw new Error(`invalid storage manifest: ${findings.map((f) => `${f.path}: ${f.message}`).join('; ')}`);
60
+ }
61
+ }
62
+ /** Resolve the backend an artifact should use, defaulting per the manifest. */
63
+ export function resolveBackend(manifest, backendId) {
64
+ const id = backendId ?? manifest.defaultBackend;
65
+ const backend = manifest.backends.find((b) => b.id === id);
66
+ if (!backend)
67
+ throw new Error(`unknown storage backend "${id}"`);
68
+ return backend;
69
+ }
70
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,iGAAiG;AACjG,kGAAkG;AAClG,yFAAyF;AAiCzF,MAAM,KAAK,GAAG,2BAA2B,CAAC;AAE1C;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,QAAiB;IACvD,MAAM,GAAG,GAAsB,EAAE,CAAC;IAClC,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,OAAe,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IAE3F,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtD,GAAG,CAAC,GAAG,EAAE,4BAA4B,CAAC,CAAC;QACvC,OAAO,GAAG,CAAC;IACb,CAAC;IACD,MAAM,CAAC,GAAG,QAAoC,CAAC;IAC/C,IAAI,CAAC,CAAC,OAAO,KAAK,6BAA6B;QAAE,GAAG,CAAC,SAAS,EAAE,+CAA+C,CAAC,CAAC;IACjH,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,KAAK,C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K,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;IACjE,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,62 @@
1
+ import type { Address, Hex } from '@agenticprimitives/types';
2
+ import { type SkillRelease, type DependencyPin, type RiskDeclaration, type ReleaseProvenance } from './release.js';
3
+ import type { VersionStatus } from './versioning.js';
4
+ export interface BuildReleaseInput {
5
+ canonicalId: Hex;
6
+ version: string;
7
+ bundleRoot: Hex;
8
+ owner: Address;
9
+ publisher: Address;
10
+ dependencies?: DependencyPin[];
11
+ risk: RiskDeclaration;
12
+ issuedAt: string;
13
+ provenance?: ReleaseProvenance;
14
+ status?: VersionStatus;
15
+ }
16
+ /** Assemble a `SkillRelease` — normalizes the dependency lock and computes the (location-independent)
17
+ * `releaseId`. The publisher signature is attached separately by the substrate (ERC-1271 over `releaseId`). */
18
+ export declare function buildRelease(input: BuildReleaseInput): SkillRelease;
19
+ /** The publisher must be the owner OR an owner-authorized delegate (case-insensitive address compare). */
20
+ export declare function isAuthorizedPublisher(owner: Address, publisher: Address, delegates?: readonly Address[]): boolean;
21
+ /** Compare dotted numeric versions: -1 | 0 | 1. Non-numeric segments compare as 0. */
22
+ export declare function compareVersions(a: string, b: string): number;
23
+ export type PublicationCheck = {
24
+ ok: true;
25
+ } | {
26
+ ok: false;
27
+ reason: string;
28
+ };
29
+ /**
30
+ * Validate a candidate release for publication — fail-closed. Against the prior head of the SAME canonical
31
+ * id (or `null` for the first release):
32
+ * - canonical id is immutable across the chain,
33
+ * - version strictly advances (append-only, monotonic),
34
+ * - the release id recomputes (integrity),
35
+ * - the publisher is authorized (owner or listed delegate),
36
+ * - the owner matches the expected current owner (`opts.expectedOwner` after any transfer, else prev.owner).
37
+ */
38
+ export declare function validatePublication(prev: SkillRelease | null, candidate: SkillRelease, opts?: {
39
+ delegates?: readonly Address[];
40
+ expectedOwner?: Address;
41
+ }): PublicationCheck;
42
+ export interface OwnershipTransfer {
43
+ canonicalId: Hex;
44
+ from: Address;
45
+ to: Address;
46
+ at: string;
47
+ /** Canonical digest over (canonicalId, from, to, at) — the transfer's identity. */
48
+ transferId: Hex;
49
+ /** The current owner's ERC-1271 signature over `transferId` (verified by the substrate). */
50
+ signature?: Hex;
51
+ }
52
+ export declare function buildOwnershipTransfer(input: Omit<OwnershipTransfer, 'transferId' | 'signature'>): OwnershipTransfer;
53
+ export declare function verifyOwnershipTransfer(t: OwnershipTransfer): boolean;
54
+ /** Apply a transfer to the current owner — only the current owner may transfer, and the id must match. */
55
+ export declare function applyOwnershipTransfer(canonicalId: Hex, currentOwner: Address, t: OwnershipTransfer): {
56
+ ok: true;
57
+ newOwner: Address;
58
+ } | {
59
+ ok: false;
60
+ reason: string;
61
+ };
62
+ //# sourceMappingURL=publish.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAA0D,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC3K,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAOrD,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,GAAG,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,GAAG,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,aAAa,EAAE,CAAC;IAC/B,IAAI,EAAE,eAAe,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED;gHACgH;AAChH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG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O,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAKrK"}
@@ -0,0 +1,81 @@
1
+ import { canonicalDigest } from './canonicalization.js';
2
+ import { computeReleaseId, buildDependencyLock, verifyReleaseId } from './release.js';
3
+ /** Assemble a `SkillRelease` — normalizes the dependency lock and computes the (location-independent)
4
+ * `releaseId`. The publisher signature is attached separately by the substrate (ERC-1271 over `releaseId`). */
5
+ export function buildRelease(input) {
6
+ const dependencyLock = buildDependencyLock(input.dependencies ?? []);
7
+ const draft = {
8
+ canonicalId: input.canonicalId,
9
+ version: input.version,
10
+ bundleRoot: input.bundleRoot,
11
+ owner: input.owner,
12
+ publisher: input.publisher,
13
+ dependencyLock,
14
+ risk: input.risk,
15
+ issuedAt: input.issuedAt,
16
+ status: input.status ?? 'published',
17
+ provenance: input.provenance,
18
+ releaseId: '0x',
19
+ };
20
+ return { ...draft, releaseId: computeReleaseId(draft) };
21
+ }
22
+ /** The publisher must be the owner OR an owner-authorized delegate (case-insensitive address compare). */
23
+ export function isAuthorizedPublisher(owner, publisher, delegates = []) {
24
+ const p = publisher.toLowerCase();
25
+ return p === owner.toLowerCase() || delegates.some((d) => d.toLowerCase() === p);
26
+ }
27
+ /** Compare dotted numeric versions: -1 | 0 | 1. Non-numeric segments compare as 0. */
28
+ export function compareVersions(a, b) {
29
+ const pa = a.split('.'), pb = b.split('.');
30
+ for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
31
+ const d = (parseInt(pa[i] ?? '0', 10) || 0) - (parseInt(pb[i] ?? '0', 10) || 0);
32
+ if (d !== 0)
33
+ return Math.sign(d);
34
+ }
35
+ return 0;
36
+ }
37
+ /**
38
+ * Validate a candidate release for publication — fail-closed. Against the prior head of the SAME canonical
39
+ * id (or `null` for the first release):
40
+ * - canonical id is immutable across the chain,
41
+ * - version strictly advances (append-only, monotonic),
42
+ * - the release id recomputes (integrity),
43
+ * - the publisher is authorized (owner or listed delegate),
44
+ * - the owner matches the expected current owner (`opts.expectedOwner` after any transfer, else prev.owner).
45
+ */
46
+ export function validatePublication(prev, candidate, opts = {}) {
47
+ if (!verifyReleaseId(candidate))
48
+ return { ok: false, reason: 'release id does not match the release core' };
49
+ const expectedOwner = opts.expectedOwner ?? prev?.owner;
50
+ if (expectedOwner && candidate.owner.toLowerCase() !== expectedOwner.toLowerCase()) {
51
+ return { ok: false, reason: 'owner mismatch — ownership changes only via a signed transfer' };
52
+ }
53
+ if (!isAuthorizedPublisher(candidate.owner, candidate.publisher, opts.delegates)) {
54
+ return { ok: false, reason: 'publisher is neither the owner nor an authorized delegate' };
55
+ }
56
+ if (prev) {
57
+ if (candidate.canonicalId.toLowerCase() !== prev.canonicalId.toLowerCase())
58
+ return { ok: false, reason: 'canonical id is immutable across a skill\'s history' };
59
+ if (compareVersions(candidate.version, prev.version) <= 0)
60
+ return { ok: false, reason: `version must advance (${prev.version} → ${candidate.version})` };
61
+ }
62
+ return { ok: true };
63
+ }
64
+ const transferFields = (t) => ({ canonicalId: t.canonicalId, from: t.from, to: t.to, at: t.at });
65
+ export function buildOwnershipTransfer(input) {
66
+ return { ...input, transferId: canonicalDigest(transferFields(input)) };
67
+ }
68
+ export function verifyOwnershipTransfer(t) {
69
+ return canonicalDigest(transferFields(t)) === t.transferId;
70
+ }
71
+ /** Apply a transfer to the current owner — only the current owner may transfer, and the id must match. */
72
+ export function applyOwnershipTransfer(canonicalId, currentOwner, t) {
73
+ if (!verifyOwnershipTransfer(t))
74
+ return { ok: false, reason: 'transfer id does not match' };
75
+ if (t.canonicalId.toLowerCase() !== canonicalId.toLowerCase())
76
+ return { ok: false, reason: 'transfer is for a different canonical id' };
77
+ if (t.from.toLowerCase() !== currentOwner.toLowerCase())
78
+ return { ok: false, reason: 'only the current owner may transfer ownership' };
79
+ return { ok: true, newOwner: t.to };
80
+ }
81
+ //# sourceMappingURL=publish.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish.js","sourceR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AAC,WAAW,CAAC,WAAW,EAAE,KAAK,WAAW,CAAC,WAAW,EAAE;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,0CAA0C,EAAE,CAAC;IACxI,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,YAAY,CAAC,WAAW,EAAE;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,+CAA+C,EAAE,CAAC;IACvI,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;AACtC,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { Address, Hex } from '@agenticprimitives/types';
2
+ export type ReceiptKind = 'install' | 'activate' | 'rollback' | 'use' | 'outcome' | 'read' | 'access-granted' | 'access-revoked';
3
+ export interface LifecycleReceipt {
4
+ kind: ReceiptKind;
5
+ /** The artifact/version/release id this receipt is about. */
6
+ subject: Hex;
7
+ /** The SA that performed / is bound to the event (authority anchors here — ADR-0010). */
8
+ principal: Address;
9
+ /** ISO-8601 timestamp (passed in — the pure layer holds no ambient clock). */
10
+ at: string;
11
+ /** The exact release in effect, when the event concerns a runtime skill. */
12
+ releaseId?: Hex;
13
+ detail?: Record<string, unknown>;
14
+ /** Canonical digest over the receipt fields — tamper-evident. */
15
+ receiptId: Hex;
16
+ }
17
+ /** Build a receipt, deriving its tamper-evident `receiptId`. */
18
+ export declare function buildReceipt(input: Omit<LifecycleReceipt, 'receiptId'>): LifecycleReceipt;
19
+ /** Recompute + compare — fail-closed integrity check. */
20
+ export declare function verifyReceipt(r: LifecycleReceipt): boolean;
21
+ //# sourceMappingURL=receipts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"receipts.d.ts","sourceRoot":"","sources":["../src/receipts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAO7D,MAAM,MAAM,WAAW,GACnB,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,KAAK,GAAG,SAAS,GACvD,MAAM,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,WAAW,CAAC;IAClB,6DAA6D;IAC7D,OAAO,EAAE,GAAG,CAAC;IACb,yFAAyF;IACzF,SAAS,EAAE,OAAO,CAAC;IACnB,8EAA8E;IAC9E,EAAE,EAAE,MAAM,CAAC;IACX,4EAA4E;IAC5E,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,iEAAiE;IACjE,SAAS,EAAE,GAAG,CAAC;CAChB;AAMD,gEAAgE;AAChE,wBAAgB,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,WAAW,CAAC,GAAG,gBAAgB,CAEzF;AACD,yDAAyD;AACzD,wBAAgB,aAAa,CAAC,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAE1D"}
@@ -0,0 +1,13 @@
1
+ import { canonicalDigest } from './canonicalization.js';
2
+ const idFields = (r) => ({
3
+ kind: r.kind, subject: r.subject, principal: r.principal, at: r.at, releaseId: r.releaseId ?? null, detail: r.detail ?? null,
4
+ });
5
+ /** Build a receipt, deriving its tamper-evident `receiptId`. */
6
+ export function buildReceipt(input) {
7
+ return { ...input, receiptId: canonicalDigest(idFields(input)) };
8
+ }
9
+ /** Recompute + compare — fail-closed integrity check. */
10
+ export function verifyReceipt(r) {
11
+ return canonicalDigest(idFields(r)) === r.receiptId;
12
+ }
13
+ //# sourceMappingURL=receipts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"receipts.js","sourceRoot":"","sources":["../src/receipts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAyBxD,MAAM,QAAQ,GAAG,CAAC,CAAsC,EAAE,EAAE,CAAC,CAAC;IAC5D,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,IAAI,IAAI;CAC7H,CAAC,CAAC;AAEH,gEAAgE;AAChE,MAAM,UAAU,YAAY,CAAC,KAA0C;IACrE,OAAO,EAAE,GAAG,KAAK,EAAE,SAAS,EAAE,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;AACnE,CAAC;AACD,yDAAyD;AACzD,MAAM,UAAU,aAAa,CAAC,CAAmB;IAC/C,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC;AACtD,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { Hex } from '@agenticprimitives/types';
2
+ export type RelationType = 'derived-from' | 'references' | 'supersedes' | 'part-of' | 'describes' | 'depends-on' | 'translates' | 'annotates';
3
+ /** The inverse of each relation, for bidirectional graph traversal (undirected types map to themselves). */
4
+ export declare const INVERSE_RELATION: Record<RelationType, RelationType | null>;
5
+ export interface ArtifactRelation {
6
+ /** Subject artifact/version id. */
7
+ from: Hex;
8
+ /** Object artifact/version id. */
9
+ to: Hex;
10
+ type: RelationType;
11
+ /** ISO-8601 timestamp (evidence, excluded from the relation id). */
12
+ at?: string;
13
+ /** Optional evidence (excluded from the id). */
14
+ detail?: Record<string, unknown>;
15
+ /** Canonical digest over the identifying triple (from, to, type). */
16
+ relationId: Hex;
17
+ }
18
+ /** The relation's stable identity — its (from, to, type) triple. */
19
+ export declare function relationId(r: Pick<ArtifactRelation, 'from' | 'to' | 'type'>): Hex;
20
+ /** Build a relation, deriving its id from the triple. */
21
+ export declare function buildRelation(input: Omit<ArtifactRelation, 'relationId'>): ArtifactRelation;
22
+ export declare function verifyRelation(r: ArtifactRelation): boolean;
23
+ //# sourceMappingURL=relations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relations.d.ts","sourceRoot":"","sources":["../src/relations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAOpD,MAAM,MAAM,YAAY,GACpB,cAAc,GACd,YAAY,GACZ,YAAY,GACZ,SAAS,GACT,WAAW,GACX,YAAY,GACZ,YAAY,GACZ,WAAW,CAAC;AAEhB,4GAA4G;AAC5G,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI,CAGtE,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,mCAAmC;IACnC,IAAI,EAAE,GAAG,CAAC;IACV,kCAAkC;IAClC,EAAE,EAAE,GAAG,CAAC;IACR,IAAI,EAAE,YAAY,CAAC;IACnB,oEAAoE;IACpE,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,qEAAqE;IACrE,UAAU,EAAE,GAAG,CAAC;CACjB;AAID,oEAAoE;AACpE,wBAAgB,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,GAAG,GAAG,CAEjF;AACD,yDAAyD;AACzD,wBAAgB,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,YAAY,CAAC,GAAG,gBAAgB,CAE3F;AACD,wBAAgB,cAAc,CAAC,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAE3D"}
@@ -0,0 +1,19 @@
1
+ import { canonicalDigest } from './canonicalization.js';
2
+ /** The inverse of each relation, for bidirectional graph traversal (undirected types map to themselves). */
3
+ export const INVERSE_RELATION = {
4
+ 'derived-from': null, references: null, supersedes: null, 'part-of': null,
5
+ describes: null, 'depends-on': null, translates: null, annotates: null,
6
+ };
7
+ const idFields = (r) => ({ from: r.from, to: r.to, type: r.type });
8
+ /** The relation's stable identity — its (from, to, type) triple. */
9
+ export function relationId(r) {
10
+ return canonicalDigest(idFields(r));
11
+ }
12
+ /** Build a relation, deriving its id from the triple. */
13
+ export function buildRelation(input) {
14
+ return { ...input, relationId: relationId(input) };
15
+ }
16
+ export function verifyRelation(r) {
17
+ return relationId(r) === r.relationId;
18
+ }
19
+ //# sourceMappingURL=relations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relations.js","sourceRoot":"","sources":["../src/relations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAgBxD,4GAA4G;AAC5G,MAAM,CAAC,MAAM,gBAAgB,GAA8C;IACzE,cAAc,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI;IACzE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI;CACvE,CAAC;AAgBF,MAAM,QAAQ,GAAG,CAAC,CAAiD,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AAEnH,oEAAoE;AACpE,MAAM,UAAU,UAAU,CAAC,CAAiD;IAC1E,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AACtC,CAAC;AACD,yDAAyD;AACzD,MAAM,UAAU,aAAa,CAAC,KAA2C;IACvE,OAAO,EAAE,GAAG,KAAK,EAAE,UAAU,EAAE,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;AACrD,CAAC;AACD,MAAM,UAAU,cAAc,CAAC,CAAmB;IAChD,OAAO,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC;AACxC,CAAC"}
@@ -0,0 +1,56 @@
1
+ import type { Address, Hex } from '@agenticprimitives/types';
2
+ import type { VersionStatus } from './versioning.js';
3
+ export type RiskTier = 'low' | 'medium' | 'high' | 'critical';
4
+ export interface RiskDeclaration {
5
+ riskTier: RiskTier;
6
+ /** The runtime capabilities the skill requests (e.g. network, filesystem, a named MCP tool). */
7
+ requestedCapabilities: string[];
8
+ notes?: string;
9
+ }
10
+ /** An exact, pinned dependency — another skill/artifact by canonical id + version + content root. */
11
+ export interface DependencyPin {
12
+ canonicalId: Hex;
13
+ version: string;
14
+ contentRoot: Hex;
15
+ }
16
+ export interface DependencyLock {
17
+ dependencies: DependencyPin[];
18
+ /** Digest over the deterministically-sorted pins — order-independent, tamper-evident. */
19
+ lockDigest: Hex;
20
+ }
21
+ /** Provenance is EVIDENCE of where the source came from — never identity. Excluded from `releaseId`. */
22
+ export interface ReleaseProvenance {
23
+ sourceRepo?: string;
24
+ revision?: string;
25
+ buildRef?: string;
26
+ }
27
+ export interface SkillRelease {
28
+ /** Location-independent skill identity (skill:<ns>/<name>). Stable across owner/registry/location. */
29
+ canonicalId: Hex;
30
+ version: string;
31
+ /** Exact normalized file-tree digest — the bundle `containmentRoot`. */
32
+ bundleRoot: Hex;
33
+ /** First-author / owner SA: the authority that may authorize a version of this canonical id. */
34
+ owner: Address;
35
+ /** Delegated publisher SA (may equal `owner`) — signs the exact release. */
36
+ publisher: Address;
37
+ dependencyLock: DependencyLock;
38
+ risk: RiskDeclaration;
39
+ issuedAt: string;
40
+ status: VersionStatus;
41
+ /** Where the source came from — evidence, not identity (excluded from `releaseId`). */
42
+ provenance?: ReleaseProvenance;
43
+ /** Canonical digest over the release CORE (excludes provenance + signature) — the release's identity. */
44
+ releaseId: Hex;
45
+ /** Publisher ERC-1271 signature over `releaseId` (verified by the substrate, not here). */
46
+ signature?: Hex;
47
+ }
48
+ /** The order-independent digest over a set of exact dependency pins. */
49
+ export declare function computeLockDigest(deps: DependencyPin[]): Hex;
50
+ /** Build a normalized (sorted) dependency lock + its digest. */
51
+ export declare function buildDependencyLock(deps: DependencyPin[]): DependencyLock;
52
+ /** The release's stable identity — reproducible from its content core, independent of source location. */
53
+ export declare function computeReleaseId(r: SkillRelease): Hex;
54
+ /** Recompute + compare — the integrity check that the release core wasn't altered under its `releaseId`. */
55
+ export declare function verifyReleaseId(r: SkillRelease): boolean;
56
+ //# sourceMappingURL=release.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../src/release.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAQrD,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;AAC9D,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,QAAQ,CAAC;IACnB,gGAAgG;IAChG,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qGAAqG;AACrG,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,GAAG,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,GAAG,CAAC;CAClB;AACD,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,aAAa,EAAE,CAAC;IAC9B,yFAAyF;IACzF,UAAU,EAAE,GAAG,CAAC;CACjB;AAED,wGAAwG;AACxG,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,sGAAsG;IACtG,WAAW,EAAE,GAAG,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,UAAU,EAAE,GAAG,CAAC;IAChB,gGAAgG;IAChG,KAAK,EAAE,OAAO,CAAC;IACf,4EAA4E;IAC5E,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,cAAc,CAAC;IAC/B,IAAI,EAAE,eAAe,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,aAAa,CAAC;IACtB,uFAAuF;IACvF,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,yGAAyG;IACzG,SAAS,EAAE,GAAG,CAAC;IACf,2FAA2F;IAC3F,SAAS,CAAC,EAAE,GAAG,CAAC;CACjB;AAKD,wEAAwE;AACxE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,aAAa,EAAE,GAAG,GAAG,CAE5D;AACD,gEAAgE;AAChE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,aAAa,EAAE,GAAG,cAAc,CAEzE;AAcD,0GAA0G;AAC1G,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,YAAY,GAAG,GAAG,CAErD;AACD,4GAA4G;AAC5G,wBAAgB,eAAe,CAAC,CAAC,EAAE,YAAY,GAAG,OAAO,CAExD"}
@@ -0,0 +1,30 @@
1
+ import { canonicalDigest } from './canonicalization.js';
2
+ const sortPins = (deps) => [...deps].sort((a, b) => `${a.canonicalId}@${a.version}`.localeCompare(`${b.canonicalId}@${b.version}`));
3
+ /** The order-independent digest over a set of exact dependency pins. */
4
+ export function computeLockDigest(deps) {
5
+ return canonicalDigest(sortPins(deps));
6
+ }
7
+ /** Build a normalized (sorted) dependency lock + its digest. */
8
+ export function buildDependencyLock(deps) {
9
+ return { dependencies: sortPins(deps), lockDigest: computeLockDigest(deps) };
10
+ }
11
+ // The release identity: the IP/authority-bearing content fields ONLY. Provenance (git url/revision) and
12
+ // the signature are deliberately excluded — the same release from a mirror repo has the same identity.
13
+ const releaseIdFields = (r) => ({
14
+ canonicalId: r.canonicalId,
15
+ version: r.version,
16
+ bundleRoot: r.bundleRoot,
17
+ owner: r.owner,
18
+ publisher: r.publisher,
19
+ lockDigest: r.dependencyLock.lockDigest,
20
+ risk: r.risk,
21
+ });
22
+ /** The release's stable identity — reproducible from its content core, independent of source location. */
23
+ export function computeReleaseId(r) {
24
+ return canonicalDigest(releaseIdFields(r));
25
+ }
26
+ /** Recompute + compare — the integrity check that the release core wasn't altered under its `releaseId`. */
27
+ export function verifyReleaseId(r) {
28
+ return computeReleaseId(r) === r.releaseId;
29
+ }
30
+ //# sourceMappingURL=release.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"release.js","sourceRoot":"","sources":["../src/release.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AA0DxD,MAAM,QAAQ,GAAG,CAAC,IAAqB,EAAmB,EAAE,CAC1D,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;AAE3G,wEAAwE;AACxE,MAAM,UAAU,iBAAiB,CAAC,IAAqB;IACrD,OAAO,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AACzC,CAAC;AACD,gEAAgE;AAChE,MAAM,UAAU,mBAAmB,CAAC,IAAqB;IACvD,OAAO,EAAE,YAAY,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC;AAC/E,CAAC;AAED,wGAAwG;AACxG,uGAAuG;AACvG,MAAM,eAAe,GAAG,CAAC,CAAe,EAAE,EAAE,CAAC,CAAC;IAC5C,WAAW,EAAE,CAAC,CAAC,W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