@agenticprimitives/content-storage 1.0.0-alpha.20 → 1.0.0-alpha.22

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/dist/index.d.ts CHANGED
@@ -18,8 +18,8 @@ export type { InheritableResolver } from './containment.js';
18
18
  export { canonicalDigest, jcsCanonicalize } from './canonicalization.js';
19
19
  export { versionId, verifyVersionId } from './versioning.js';
20
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';
21
+ export { computeLockDigest, buildDependencyLock, computeReleaseId, verifyReleaseId, RELEASE_STATUS_FORMAT, releaseStatusGenesisId, buildReleaseStatusStatement, verifyReleaseStatusStatement, resolveReleaseStatus, } from './release.js';
22
+ export type { SkillRelease, DependencyPin, DependencyLock, RiskDeclaration, RiskTier, ReleaseProvenance, ReleaseStatusStatement, ReleaseStatusResult, ResolveReleaseStatusOptions, } from './release.js';
23
23
  export { buildReceipt, verifyReceipt } from './receipts.js';
24
24
  export type { LifecycleReceipt, ReceiptKind } from './receipts.js';
25
25
  export { relationId, buildRelation, verifyRelation, INVERSE_RELATION } from './relations.js';
@@ -28,6 +28,6 @@ export { anchorId, buildAnchor, verifyAnchor } from './anchors.js';
28
28
  export type { ContentAnchor, AnchorSelector } from './anchors.js';
29
29
  export { A2A_CONTENT_INTENTS, AP_VAULT_SCHEME, vaultResourceId, parseVaultResourceId, isRepresentationValid, CONTENT_RECORD_FAMILY, CONTENT_CATALOG_RECORD, toVaultRecordResource, containerRecordScope, } from './wire.js';
30
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';
31
+ export { buildRelease, isAuthorizedPublisher, compareVersions, validatePublication, buildOwnershipTransfer, verifyOwnershipTransfer, applyOwnershipTransfer, replayOwnershipChain, ownershipChainGenesis, ownershipGenesisId, isLegacyOwnershipTransfer, OWNERSHIP_TRANSFER_FORMAT, } from './publish.js';
32
+ export type { BuildReleaseInput, PublicationCheck, OwnershipTransfer, OwnershipChainState, OwnershipTransferResult } from './publish.js';
33
33
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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,gB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EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACnE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAIlE,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,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"}
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,YAA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E,MAAM,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -35,7 +35,7 @@ export { canonicalDigest, jcsCanonicalize } from './canonicalization.js';
35
35
  export { versionId, verifyVersionId } from './versioning.js';
36
36
  // The skill supply chain: a release is a governed package (exact bundle + dependency lock + risk),
37
37
  // owner/publisher separated, with a location-INDEPENDENT canonical id + release id (spec 335 §6).
38
- export { computeLockDigest, buildDependencyLock, computeReleaseId, verifyReleaseId, } from './release.js';
38
+ export { computeLockDigest, buildDependencyLock, computeReleaseId, verifyReleaseId, RELEASE_STATUS_FORMAT, releaseStatusGenesisId, buildReleaseStatusStatement, verifyReleaseStatusStatement, resolveReleaseStatus, } from './release.js';
39
39
  // Tamper-evident lifecycle receipts (install/activate/use/outcome/read/access).
40
40
  export { buildReceipt, verifyReceipt } from './receipts.js';
41
41
  // Typed relations (the relational content graph) + span-level content anchors (citations / anchored
@@ -47,5 +47,5 @@ export { anchorId, buildAnchor, verifyAnchor } from './anchors.js';
47
47
  export { A2A_CONTENT_INTENTS, AP_VAULT_SCHEME, vaultResourceId, parseVaultResourceId, isRepresentationValid, CONTENT_RECORD_FAMILY, CONTENT_CATALOG_RECORD, toVaultRecordResource, containerRecordScope, } from './wire.js';
48
48
  // The skill publication rules (ADR-0055 §5): owner-gated, append-only, version-monotonic publication with
49
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';
50
+ export { buildRelease, isAuthorizedPublisher, compareVersions, validatePublication, buildOwnershipTransfer, verifyOwnershipTransfer, applyOwnershipTransfer, replayOwnershipChain, ownershipChainGenesis, ownershipGenesisId, isLegacyOwnershipTransfer, OWNERSHIP_TRANSFER_FORMAT, } from './publish.js';
51
51
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/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E,MAAM,cAAc,CAAC;AAGnE,sGAAsG;AACtG,wFAAwF;AACxF,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,WAAW,CAAC;AAanB,0GAA0G;AAC1G,wGAAwG;AACxG,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,cAAc,CAAC"}
package/dist/publish.d.ts CHANGED
@@ -31,32 +31,84 @@ export type PublicationCheck = {
31
31
  * id (or `null` for the first release):
32
32
  * - canonical id is immutable across the chain,
33
33
  * - version strictly advances (append-only, monotonic),
34
- * - the release id recomputes (integrity),
34
+ * - the release id recomputes, for the candidate AND for the prior head (integrity),
35
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).
36
+ * - the owner matches the expected current owner: `opts.expectedOwner` (after any transfer), else the prior
37
+ * head's owner.
38
+ *
39
+ * A FIRST release (`prev === null`) has no prior head to take the owner from, so `opts.expectedOwner` is
40
+ * REQUIRED (DATA-11, spec 445): with no owner expectation the call is refused — it used to accept whoever named
41
+ * themselves owner of a canonical id nobody had published under yet.
37
42
  */
38
43
  export declare function validatePublication(prev: SkillRelease | null, candidate: SkillRelease, opts?: {
39
44
  delegates?: readonly Address[];
40
45
  expectedOwner?: Address;
41
46
  }): PublicationCheck;
47
+ export declare const OWNERSHIP_TRANSFER_FORMAT: "ownership-transfer/v2";
42
48
  export interface OwnershipTransfer {
49
+ format: typeof OWNERSHIP_TRANSFER_FORMAT;
43
50
  canonicalId: Hex;
44
51
  from: Address;
45
52
  to: Address;
46
53
  at: string;
47
- /** Canonical digest over (canonicalId, from, to, at) — the transfer's identity. */
54
+ /** Position in this canonical id's ownership chain: 1 for the first transfer, then +1 each. */
55
+ sequence: number;
56
+ /** The `transferId` of the statement before this one; for sequence 1, `ownershipGenesisId(canonicalId, from)`. */
57
+ prevTransferId: Hex;
58
+ /** Canonical digest over (format, canonicalId, from, to, at, sequence, prevTransferId) — the transfer's identity. */
48
59
  transferId: Hex;
49
60
  /** The current owner's ERC-1271 signature over `transferId` (verified by the substrate). */
50
61
  signature?: Hex;
51
62
  }
52
- export declare function buildOwnershipTransfer(input: Omit<OwnershipTransfer, 'transferId' | 'signature'>): OwnershipTransfer;
63
+ /** Where a canonical id's ownership chain stands — what the next transfer must extend. Derive it by
64
+ * `replayOwnershipChain` over the whole history, or store it; never rebuild it from the owner alone. */
65
+ export interface OwnershipChainState {
66
+ owner: Address;
67
+ /** The sequence of the last applied transfer; 0 when none has been. */
68
+ sequence: number;
69
+ /** The `transferId` of the last applied transfer; the genesis id when none has been. */
70
+ headTransferId: Hex;
71
+ }
72
+ /** The chain's anchor: binds sequence 1 to THIS canonical id and THIS first owner. */
73
+ export declare function ownershipGenesisId(canonicalId: Hex, firstOwner: Address): Hex;
74
+ /** The state before any v2 transfer: `owner` holds the id, nothing applied. */
75
+ export declare function ownershipChainGenesis(canonicalId: Hex, owner: Address): OwnershipChainState;
76
+ /** Build the NEXT transfer on `state` — the position is taken from the chain, never chosen by the caller. */
77
+ export declare function buildOwnershipTransfer(input: {
78
+ canonicalId: Hex;
79
+ to: Address;
80
+ at: string;
81
+ state: OwnershipChainState;
82
+ }): OwnershipTransfer;
83
+ /** Integrity of a v2 statement: the format marker, a well-formed position, and the id recomputes. A legacy
84
+ * (v1) statement is NOT a valid transfer and returns false. */
53
85
  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): {
86
+ /** READ-ONLY recognition of a pre-2026-11-10 statement: no `format`, and its id is the v1 digest over
87
+ * (canonicalId, from, to, at). True means "this is a genuine old statement" — history to show, never a
88
+ * transfer to apply. */
89
+ export declare function isLegacyOwnershipTransfer(t: unknown): boolean;
90
+ export type OwnershipTransferResult = {
56
91
  ok: true;
57
92
  newOwner: Address;
93
+ state: OwnershipChainState;
94
+ } | {
95
+ ok: false;
96
+ reason: string;
97
+ };
98
+ /**
99
+ * Apply a transfer to the chain — fail-closed. The statement must be v2, recompute, be for this canonical id,
100
+ * come from the CURRENT owner, and be exactly the NEXT link: `sequence === state.sequence + 1` and
101
+ * `prevTransferId === state.headTransferId`. A statement that was valid at an earlier position — the replay —
102
+ * fails both. Returns the advanced state; the caller stores it (or replays the chain) for the next transfer.
103
+ */
104
+ export declare function applyOwnershipTransfer(canonicalId: Hex, state: OwnershipChainState, t: OwnershipTransfer): OwnershipTransferResult;
105
+ /** Fold a whole history from its genesis owner. Any link that does not apply fails the chain. */
106
+ export declare function replayOwnershipChain(canonicalId: Hex, genesisOwner: Address, transfers: readonly OwnershipTransfer[]): {
107
+ ok: true;
108
+ state: OwnershipChainState;
58
109
  } | {
59
110
  ok: false;
60
111
  reason: string;
112
+ atIndex: number;
61
113
  };
62
114
  //# sourceMappingURL=publish.d.ts.map
@@ -1 +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,G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
  }
37
+ const ADDRESS_RE = /^0x[0-9a-fA-F]{40}$/;
38
+ const sameAddress = (a, b) => a.toLowerCase() === b.toLowerCase();
37
39
  /**
38
40
  * Validate a candidate release for publication — fail-closed. Against the prior head of the SAME canonical
39
41
  * id (or `null` for the first release):
40
42
  * - canonical id is immutable across the chain,
41
43
  * - version strictly advances (append-only, monotonic),
42
- * - the release id recomputes (integrity),
44
+ * - the release id recomputes, for the candidate AND for the prior head (integrity),
43
45
  * - the publisher is authorized (owner or listed delegate),
44
- * - the owner matches the expected current owner (`opts.expectedOwner` after any transfer, else prev.owner).
46
+ * - the owner matches the expected current owner: `opts.expectedOwner` (after any transfer), else the prior
47
+ * head's owner.
48
+ *
49
+ * A FIRST release (`prev === null`) has no prior head to take the owner from, so `opts.expectedOwner` is
50
+ * REQUIRED (DATA-11, spec 445): with no owner expectation the call is refused — it used to accept whoever named
51
+ * themselves owner of a canonical id nobody had published under yet.
45
52
  */
46
53
  export function validatePublication(prev, candidate, opts = {}) {
47
- if (!verifyReleaseId(candidate))
54
+ if (!candidate || !verifyReleaseId(candidate))
48
55
  return { ok: false, reason: 'release id does not match the release core' };
56
+ if (prev && !verifyReleaseId(prev))
57
+ return { ok: false, reason: 'the prior head\'s release id does not match its release core' };
58
+ if (opts.expectedOwner !== undefined && !(typeof opts.expectedOwner === 'string' && ADDRESS_RE.test(opts.expectedOwner))) {
59
+ return { ok: false, reason: 'expected owner is not an address' };
60
+ }
49
61
  const expectedOwner = opts.expectedOwner ?? prev?.owner;
50
- if (expectedOwner && candidate.owner.toLowerCase() !== expectedOwner.toLowerCase()) {
62
+ if (!expectedOwner) {
63
+ return { ok: false, reason: 'a first release requires an expected owner — no owner expectation, no publication' };
64
+ }
65
+ if (!sameAddress(candidate.owner, expectedOwner)) {
51
66
  return { ok: false, reason: 'owner mismatch — ownership changes only via a signed transfer' };
52
67
  }
53
68
  if (!isAuthorizedPublisher(candidate.owner, candidate.publisher, opts.delegates)) {
@@ -61,21 +76,102 @@ export function validatePublication(prev, candidate, opts = {}) {
61
76
  }
62
77
  return { ok: true };
63
78
  }
64
- const transferFields = (t) => ({ canonicalId: t.canonicalId, from: t.from, to: t.to, at: t.at });
79
+ // ── Ownership transfer — a signed statement BOUND TO ITS POSITION in the ownership chain ──────────────────
80
+ //
81
+ // DATA-6 (spec 445 W0, 2026-11-10). The v1 statement signed `(canonicalId, from, to, at)` and nothing else, so
82
+ // once ownership returned to an earlier owner (A → B, later B → A) anyone holding A's first statement could
83
+ // replay it: `from` was the current owner again and the signature was still good. The v2 statement signs its
84
+ // place in the chain as well — a strictly increasing `sequence` and the id of the statement before it — and
85
+ // `applyOwnershipTransfer` accepts exactly the NEXT link of the chain the caller holds.
86
+ //
87
+ // THE LEGACY RULE. A v1 statement (no `format`) carries no position and can never be made safe to apply, so
88
+ // it is REFUSED: `applyOwnershipTransfer` and `verifyOwnershipTransfer` both reject it. It stays READABLE as
89
+ // history — `isLegacyOwnershipTransfer` recognises one and checks its old digest — and nothing is lost by
90
+ // refusing it: every release names its owner INSIDE `releaseId`, so works already released keep verifying
91
+ // without any transfer statement. The v2 chain for a skill starts at its CURRENT owner
92
+ // (`ownershipChainGenesis`), whoever earlier v1 statements moved it through; the next transfer is a v2
93
+ // statement at sequence 1, signed by that owner.
94
+ export const OWNERSHIP_TRANSFER_FORMAT = 'ownership-transfer/v2';
95
+ const transferFields = (t) => ({ format: t.format, canonicalId: t.canonicalId, from: t.from, to: t.to, at: t.at, sequence: t.sequence, prevTransferId: t.prevTransferId });
96
+ const legacyTransferFields = (t) => ({ canonicalId: t.canonicalId, from: t.from, to: t.to, at: t.at });
97
+ /** The chain's anchor: binds sequence 1 to THIS canonical id and THIS first owner. */
98
+ export function ownershipGenesisId(canonicalId, firstOwner) {
99
+ return canonicalDigest({ format: 'ownership-genesis/v2', canonicalId: canonicalId.toLowerCase(), owner: firstOwner.toLowerCase() });
100
+ }
101
+ /** The state before any v2 transfer: `owner` holds the id, nothing applied. */
102
+ export function ownershipChainGenesis(canonicalId, owner) {
103
+ return { owner, sequence: 0, headTransferId: ownershipGenesisId(canonicalId, owner) };
104
+ }
105
+ /** Build the NEXT transfer on `state` — the position is taken from the chain, never chosen by the caller. */
65
106
  export function buildOwnershipTransfer(input) {
66
- return { ...input, transferId: canonicalDigest(transferFields(input)) };
107
+ const core = {
108
+ format: OWNERSHIP_TRANSFER_FORMAT,
109
+ canonicalId: input.canonicalId,
110
+ from: input.state.owner,
111
+ to: input.to,
112
+ at: input.at,
113
+ sequence: input.state.sequence + 1,
114
+ prevTransferId: input.state.headTransferId,
115
+ };
116
+ return { ...core, transferId: canonicalDigest(transferFields(core)) };
67
117
  }
118
+ /** Integrity of a v2 statement: the format marker, a well-formed position, and the id recomputes. A legacy
119
+ * (v1) statement is NOT a valid transfer and returns false. */
68
120
  export function verifyOwnershipTransfer(t) {
121
+ if (!t || t.format !== OWNERSHIP_TRANSFER_FORMAT)
122
+ return false;
123
+ if (!Number.isSafeInteger(t.sequence) || t.sequence < 1)
124
+ return false;
125
+ if (typeof t.prevTransferId !== 'string' || !/^0x[0-9a-fA-F]{64}$/.test(t.prevTransferId))
126
+ return false;
127
+ if (typeof t.from !== 'string' || !ADDRESS_RE.test(t.from) || typeof t.to !== 'string' || !ADDRESS_RE.test(t.to))
128
+ return false;
69
129
  return canonicalDigest(transferFields(t)) === t.transferId;
70
130
  }
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) {
131
+ /** READ-ONLY recognition of a pre-2026-11-10 statement: no `format`, and its id is the v1 digest over
132
+ * (canonicalId, from, to, at). True means "this is a genuine old statement" — history to show, never a
133
+ * transfer to apply. */
134
+ export function isLegacyOwnershipTransfer(t) {
135
+ const x = t;
136
+ if (!x || typeof x !== 'object' || x.format !== undefined)
137
+ return false;
138
+ if (typeof x.canonicalId !== 'string' || typeof x.from !== 'string' || typeof x.to !== 'string' || typeof x.at !== 'string')
139
+ return false;
140
+ return canonicalDigest(legacyTransferFields(x)) === x.transferId;
141
+ }
142
+ /**
143
+ * Apply a transfer to the chain — fail-closed. The statement must be v2, recompute, be for this canonical id,
144
+ * come from the CURRENT owner, and be exactly the NEXT link: `sequence === state.sequence + 1` and
145
+ * `prevTransferId === state.headTransferId`. A statement that was valid at an earlier position — the replay —
146
+ * fails both. Returns the advanced state; the caller stores it (or replays the chain) for the next transfer.
147
+ */
148
+ export function applyOwnershipTransfer(canonicalId, state, t) {
149
+ if (!state || typeof state !== 'object' || typeof state.owner !== 'string' || !Number.isSafeInteger(state.sequence) || state.sequence < 0 || typeof state.headTransferId !== 'string') {
150
+ return { ok: false, reason: 'the ownership chain position is required (owner, sequence, head) — an owner address alone cannot refuse a replay' };
151
+ }
152
+ if (isLegacyOwnershipTransfer(t))
153
+ return { ok: false, reason: 'legacy transfer statement (no chain position) — refused; re-sign it as ownership-transfer/v2' };
73
154
  if (!verifyOwnershipTransfer(t))
74
155
  return { ok: false, reason: 'transfer id does not match' };
75
156
  if (t.canonicalId.toLowerCase() !== canonicalId.toLowerCase())
76
157
  return { ok: false, reason: 'transfer is for a different canonical id' };
77
- if (t.from.toLowerCase() !== currentOwner.toLowerCase())
158
+ if (!sameAddress(t.from, state.owner))
78
159
  return { ok: false, reason: 'only the current owner may transfer ownership' };
79
- return { ok: true, newOwner: t.to };
160
+ if (t.sequence !== state.sequence + 1)
161
+ return { ok: false, reason: `transfer is not the next in the ownership chain (expected sequence ${state.sequence + 1}, got ${t.sequence}) — a replayed or skipped statement` };
162
+ if (t.prevTransferId.toLowerCase() !== state.headTransferId.toLowerCase())
163
+ return { ok: false, reason: 'transfer does not extend the current head of the ownership chain' };
164
+ return { ok: true, newOwner: t.to, state: { owner: t.to, sequence: t.sequence, headTransferId: t.transferId } };
165
+ }
166
+ /** Fold a whole history from its genesis owner. Any link that does not apply fails the chain. */
167
+ export function replayOwnershipChain(canonicalId, genesisOwner, transfers) {
168
+ let state = ownershipChainGenesis(canonicalId, genesisOwner);
169
+ for (let i = 0; i < transfers.length; i++) {
170
+ const r = applyOwnershipTransfer(canonicalId, state, transfers[i]);
171
+ if (!r.ok)
172
+ return { ok: false, reason: r.reason, atIndex: i };
173
+ state = r.state;
174
+ }
175
+ return { ok: true, state };
80
176
  }
81
177
  //# sourceMappingURL=publish.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"publish.js","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,eAAe,EAAuF,MAAM,cAAc,CAAC;AAqB3K;gHACgH;AAChH,MAAM,UAAU,YAAY,CAAC,KAAwB;IACnD,MAAM,cAAc,GAAG,mBAAmB,CAAC,KAAK,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;IACrE,MAAM,KAAK,GAAiB;QAC1B,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,cAAc;QACd,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,WAAW;QACnC,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,SAAS,EAAE,IAAW;KACvB,CAAC;IACF,OAAO,EAAE,GAAG,KAAK,EAAE,SAAS,EAAE,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;AAC1D,CAAC;AAED,0GAA0G;AAC1G,MAAM,UAAU,qBAAqB,CAAC,KAAc,EAAE,SAAkB,EAAE,YAAgC,EAAE;IAC1G,MAAM,CAAC,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;IAClC,OAAO,CAAC,KAAK,KAAK,CAAC,WAAW,EAAE,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5K,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,cAAc,EAAE,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC;AAClH,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,oBAAoB,CAAC,WAAgB,EAAE,YAAqB,EAAE,SAAuC;IACnH,IAAI,KAAK,GAAG,qBAAqB,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IAC7D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1C,MAAM,CAAC,GAAG,sBAAsB,CAAC,WAAW,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAE,CAAC,CAAC;QACpE,IAAI,CAAC,CAAC,CAAC,EAAE;YAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;QAC9D,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;IAClB,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AAC7B,CAAC"}
package/dist/release.d.ts CHANGED
@@ -36,6 +36,10 @@ export interface SkillRelease {
36
36
  publisher: Address;
37
37
  dependencyLock: DependencyLock;
38
38
  risk: RiskDeclaration;
39
+ /** UNSIGNED LABELS (DATA-11, spec 445). `issuedAt` and `status` are outside `releaseId`, so they are outside
40
+ * the publisher's signature: anyone can rewrite them and the release still verifies its id. They are a
41
+ * display hint and are NEVER the release's status. The status — and the authenticated issuance time — come
42
+ * from the signed, sequenced status statements (`resolveReleaseStatus`). */
39
43
  issuedAt: string;
40
44
  status: VersionStatus;
41
45
  /** Where the source came from — evidence, not identity (excluded from `releaseId`). */
@@ -53,4 +57,64 @@ export declare function buildDependencyLock(deps: DependencyPin[]): DependencyLo
53
57
  export declare function computeReleaseId(r: SkillRelease): Hex;
54
58
  /** Recompute + compare — the integrity check that the release core wasn't altered under its `releaseId`. */
55
59
  export declare function verifyReleaseId(r: SkillRelease): boolean;
60
+ export declare const RELEASE_STATUS_FORMAT: "release-status/v1";
61
+ export interface ReleaseStatusStatement {
62
+ format: typeof RELEASE_STATUS_FORMAT;
63
+ canonicalId: Hex;
64
+ releaseId: Hex;
65
+ status: VersionStatus;
66
+ /** 1 for the first statement about this release, then +1 each. */
67
+ sequence: number;
68
+ /** The `statementId` before this one; `releaseStatusGenesisId(releaseId)` for sequence 1. */
69
+ prevStatementId: Hex;
70
+ /** ISO-8601. For the sequence-1 `published` statement this is the AUTHENTICATED issuance time. */
71
+ at: string;
72
+ /** Who states it: the release's owner or publisher (or a delegate the caller lists). */
73
+ issuer: Address;
74
+ /** Canonical digest over every field above. */
75
+ statementId: Hex;
76
+ /** The issuer's signature over `statementId` — verified through the port given to `resolveReleaseStatus`. */
77
+ signature?: Hex;
78
+ }
79
+ export declare function releaseStatusGenesisId(releaseId: Hex): Hex;
80
+ /** Build the next status statement for `release` on top of `prev` (the current head statement, or null). */
81
+ export declare function buildReleaseStatusStatement(input: {
82
+ release: SkillRelease;
83
+ status: VersionStatus;
84
+ at: string;
85
+ issuer: Address;
86
+ prev: ReleaseStatusStatement | null;
87
+ }): ReleaseStatusStatement;
88
+ export declare function verifyReleaseStatusStatement(s: ReleaseStatusStatement): boolean;
89
+ export type ReleaseStatusResult = {
90
+ ok: true;
91
+ status: VersionStatus; /** true = from a signed statement chain; false = a legacy release with none. */
92
+ authenticated: boolean; /** The authenticated issuance time (the sequence-1 `published` statement), when there is one. */
93
+ issuedAt?: string;
94
+ sequence: number;
95
+ head: Hex | null;
96
+ } | {
97
+ ok: false;
98
+ reason: string;
99
+ };
100
+ export interface ResolveReleaseStatusOptions {
101
+ /** REQUIRED: the head `statementId` the caller read from its registry / anchor; `null` = no statements exist. */
102
+ expectedHead: Hex | null;
103
+ /** REQUIRED: verifies `signature` over `statementId` for `signer` (ERC-1271 / ECDSA — the caller's ONE mechanism). */
104
+ verifySignature: (input: {
105
+ signer: Address;
106
+ digest: Hex;
107
+ signature: Hex;
108
+ }) => boolean | Promise<boolean>;
109
+ /** Delegates the owner authorized, beyond the release's own owner and publisher. */
110
+ delegates?: readonly Address[];
111
+ }
112
+ /**
113
+ * The release's status, from the signed chain — fail-closed. The release id must recompute; every statement
114
+ * must be for this release, recompute, extend the one before by sequence and id, come from the owner / the
115
+ * publisher / a listed delegate, and carry a signature the port accepts; once `revoked`, nothing follows; the
116
+ * chain must end exactly at `expectedHead`; and the release's unsigned `status` label must AGREE with the
117
+ * result — a `revoked` release relabelled `published` is refused, not corrected.
118
+ */
119
+ export declare function resolveReleaseStatus(release: SkillRelease, statements: readonly ReleaseStatusStatement[], opts: ResolveReleaseStatusOptions): Promise<ReleaseStatusResult>;
56
120
  //# sourceMappingURL=release.d.ts.map
@@ -1 +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,WA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EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,aAAa,CAAC,CAAC,gFAAgF;IAAC,aAAa,EAAE,OAAO,CAAC,CAAC,iGAAiG;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,GAAG,GAAG,IAAI,CAAA;CAAE,GACrS;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAElC,MAAM,WAAW,2BAA2B;IAC1C,iHAAiH;IACjH,YAAY,EAAE,GAAG,GAAG,IAAI,CAAC;IACzB,sHAAsH;IACtH,eAAe,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,GAAG,CAAC;QAAC,SAAS,EAAE,GAAG,CAAA;KAAE,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACzG,oFAAoF;IACpF,SAAS,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;CAChC;AAID;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,sBAAsB,EAAE,EAAE,IAAI,EAAE,2BAA2B,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAkChL"}
package/dist/release.js CHANGED
@@ -27,4 +27,112 @@ export function computeReleaseId(r) {
27
27
  export function verifyReleaseId(r) {
28
28
  return computeReleaseId(r) === r.releaseId;
29
29
  }
30
+ // ── Release status — its own signed, sequenced statement (DATA-11, spec 445 W0, 2026-11-10) ─────────────────
31
+ //
32
+ // THE DESIGN, and why this one. `releaseId` is left EXACTLY as it was: every id already released, and every
33
+ // publisher signature over one, keeps verifying — the public shelf reproduces `computeReleaseId` from served
34
+ // content, and changing what it covers would orphan every released work. So `status` could not go inside it.
35
+ // Instead a status is its own statement: `(releaseId, status, sequence, prevStatementId, at, issuer)`, signed
36
+ // by the owner or an authorized publisher, each one extending the one before. A revocation is statement N;
37
+ // relabelling the release's unsigned `status` field back to `published` changes nothing, because that field
38
+ // is never read as the status.
39
+ //
40
+ // Withholding is the other half: a holder who hides the revocation statement presents a shorter chain. The
41
+ // caller therefore MUST say which head it expects (`expectedHead`, read from its registry / anchor; `null` =
42
+ // "there are no status statements for this release"). No expectation → refused.
43
+ //
44
+ // LEGACY releases (signed before this format: no status statements, `expectedHead: null`) stay verifiable
45
+ // READ-ONLY as `published` with `authenticated: false` — but only when their unsigned label also says
46
+ // `published`. A legacy release labelled anything else is refused: the label is unsigned, so it proves
47
+ // nothing, and the fail-closed reading of "someone says this is not published, nobody signed it" is no.
48
+ export const RELEASE_STATUS_FORMAT = 'release-status/v1';
49
+ const statusFields = (s) => ({ format: s.format, canonicalId: s.canonicalId, releaseId: s.releaseId, status: s.status, sequence: s.sequence, prevStatementId: s.prevStatementId, at: s.at, issuer: s.issuer });
50
+ export function releaseStatusGenesisId(releaseId) {
51
+ return canonicalDigest({ format: 'release-status-genesis/v1', releaseId: releaseId.toLowerCase() });
52
+ }
53
+ /** Build the next status statement for `release` on top of `prev` (the current head statement, or null). */
54
+ export function buildReleaseStatusStatement(input) {
55
+ const core = {
56
+ format: RELEASE_STATUS_FORMAT,
57
+ canonicalId: input.release.canonicalId,
58
+ releaseId: input.release.releaseId,
59
+ status: input.status,
60
+ sequence: (input.prev?.sequence ?? 0) + 1,
61
+ prevStatementId: input.prev?.statementId ?? releaseStatusGenesisId(input.release.releaseId),
62
+ at: input.at,
63
+ issuer: input.issuer,
64
+ };
65
+ return { ...core, statementId: canonicalDigest(statusFields(core)) };
66
+ }
67
+ export function verifyReleaseStatusStatement(s) {
68
+ if (!s || s.format !== RELEASE_STATUS_FORMAT)
69
+ return false;
70
+ if (!Number.isSafeInteger(s.sequence) || s.sequence < 1)
71
+ return false;
72
+ if (!['draft', 'published', 'superseded', 'revoked'].includes(s.status))
73
+ return false;
74
+ return canonicalDigest(statusFields(s)) === s.statementId;
75
+ }
76
+ const lc = (s) => s.toLowerCase();
77
+ /**
78
+ * The release's status, from the signed chain — fail-closed. The release id must recompute; every statement
79
+ * must be for this release, recompute, extend the one before by sequence and id, come from the owner / the
80
+ * publisher / a listed delegate, and carry a signature the port accepts; once `revoked`, nothing follows; the
81
+ * chain must end exactly at `expectedHead`; and the release's unsigned `status` label must AGREE with the
82
+ * result — a `revoked` release relabelled `published` is refused, not corrected.
83
+ */
84
+ export async function resolveReleaseStatus(release, statements, opts) {
85
+ if (!release || !verifyReleaseId(release))
86
+ return { ok: false, reason: 'release id does not match the release core' };
87
+ if (!opts || opts.expectedHead === undefined)
88
+ return { ok: false, reason: 'an expected status head is required (null when no status statement exists) — without it a withheld revocation cannot be refused' };
89
+ if (typeof opts.verifySignature !== 'function')
90
+ return { ok: false, reason: 'a signature verifier is required — an unsigned status statement is not a status' };
91
+ if (!Array.isArray(statements))
92
+ return { ok: false, reason: 'status statements must be a list' };
93
+ if (statements.length === 0) {
94
+ if (opts.expectedHead !== null)
95
+ return { ok: false, reason: 'the status chain does not reach the expected head — a statement was withheld' };
96
+ if (release.status !== 'published')
97
+ return { ok: false, reason: `the release is labelled "${String(release.status)}" and no signed status statement backs any status` };
98
+ return { ok: true, status: 'published', authenticated: false, sequence: 0, head: null };
99
+ }
100
+ const allowed = new Set([lc(release.owner), lc(release.publisher), ...(opts.delegates ?? []).map(lc)]);
101
+ let prevId = releaseStatusGenesisId(release.releaseId);
102
+ let status = null;
103
+ let issuedAt;
104
+ for (let i = 0; i < statements.length; i++) {
105
+ const s = statements[i];
106
+ if (!verifyReleaseStatusStatement(s))
107
+ return { ok: false, reason: `status statement ${i + 1} does not match its id` };
108
+ if (lc(s.releaseId) !== lc(release.releaseId) || lc(s.canonicalId) !== lc(release.canonicalId))
109
+ return { ok: false, reason: `status statement ${i + 1} is for another release` };
110
+ if (s.sequence !== i + 1 || lc(s.prevStatementId) !== lc(prevId))
111
+ return { ok: false, reason: `status statement ${i + 1} does not extend the chain (replayed, reordered or skipped)` };
112
+ if (status === 'revoked')
113
+ return { ok: false, reason: 'a revoked release takes no further status' };
114
+ if (typeof s.issuer !== 'string' || !allowed.has(lc(s.issuer)))
115
+ return { ok: false, reason: `status statement ${i + 1} is not from the owner, the publisher or an authorized delegate` };
116
+ if (typeof s.signature !== 'string' || s.signature.length === 0)
117
+ return { ok: false, reason: `status statement ${i + 1} is unsigned` };
118
+ let signed = false;
119
+ try {
120
+ signed = (await opts.verifySignature({ signer: s.issuer, digest: s.statementId, signature: s.signature })) === true;
121
+ }
122
+ catch {
123
+ signed = false;
124
+ }
125
+ if (!signed)
126
+ return { ok: false, reason: `status statement ${i + 1}: the signature does not verify` };
127
+ if (i === 0 && s.status === 'published')
128
+ issuedAt = s.at;
129
+ status = s.status;
130
+ prevId = s.statementId;
131
+ }
132
+ if (opts.expectedHead === null || lc(prevId) !== lc(opts.expectedHead))
133
+ return { ok: false, reason: 'the status chain does not end at the expected head' };
134
+ if (release.status !== status)
135
+ return { ok: false, reason: `the release is labelled "${String(release.status)}" but its signed status is "${status}"` };
136
+ return { ok: true, status: status, authenticated: true, ...(issuedAt !== undefined ? { issuedAt } : {}), sequence: statements.length, head: prevId };
137
+ }
30
138
  //# sourceMappingURL=release.js.map
@@ -1 +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,OA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;QAAC,CAAC;QACtJ,IAAI,CAAC,MAAM;YAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,oBAAoB,CAAC,GAAG,CAAC,iCAAiC,EAAE,CAAC;QACtG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,WAAW;YAAE,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC;QACzD,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;QAClB,MAAM,GAAG,CAAC,CAAC,WAAW,CAAC;IACzB,CAAC;IACD,IAAI,IAAI,CAAC,YAAY,KAAK,IAAI,IAAI,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,oDAAoD,EAAE,CAAC;IAC3J,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,4BAA4B,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,+BAA+B,MAAM,GAAG,EAAE,CAAC;IACxJ,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAO,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACxJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticprimitives/content-storage",
3
- "version": "1.0.0-alpha.20",
3
+ "version": "1.0.0-alpha.22",
4
4
  "description": "Managed storage for Content Artifacts (SKILL.md, .ttl, .md, JSON-LD, images/video): the StoragePort provider abstraction + ContentArtifact/ArtifactBundle model that stores a content-primitives descriptor's bytes in a client-side-envelope-encrypted, content-addressed blob store, entitlement-gated and provenance-anchored. Provider-agnostic (S3 API); the concrete driver is app-injected (ADR-0037). See spec 335.",
5
5
  "homepage": "https://agenticprimitives.dev",
6
6
  "bugs": {
@@ -35,8 +35,8 @@
35
35
  "access": "public"
36
36
  },
37
37
  "peerDependencies": {
38
- "@agenticprimitives/types": "^1.0.0-alpha.45",
39
- "@agenticprimitives/content-primitives": "^1.0.0-alpha.41"
38
+ "@agenticprimitives/types": "^1.0.0-alpha.49",
39
+ "@agenticprimitives/content-primitives": "^1.0.0-alpha.43"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "^22.7.0",
@@ -60,6 +60,7 @@
60
60
  "build": "tsc -p tsconfig.build.json",
61
61
  "typecheck": "tsc -p tsconfig.json --noEmit",
62
62
  "test": "vitest run",
63
+ "test:unit": "vitest run",
63
64
  "test:watch": "vitest",
64
65
  "clean": "rm -rf dist"
65
66
  }