@hasna/skills 0.10.45 → 0.10.47

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.
@@ -163,5 +163,6 @@ export declare function readSkillVersion(store: SkillsProductStore, principal: A
163
163
  export declare function readSkillVersionBundle(store: SkillsProductStore, artifactStorage: ArtifactStorage, principal: ApiPrincipal, slug: string, version: string): Promise<{
164
164
  version: ServerSkillVersion;
165
165
  bytes: OwnedBytes;
166
+ authorizationEpoch?: string;
166
167
  }>;
167
168
  export {};
@@ -217,6 +217,8 @@ export interface ServerSkillRecord {
217
217
  */
218
218
  tombstonedAt?: string;
219
219
  tombstonePurgeAfter?: string;
220
+ /** Changes on lifecycle breaks, not ordinary immutable-version publication. */
221
+ authorizationEpoch?: string;
220
222
  /** Catalog lifecycle state. Archived rows retain versions and bundles for explicit reads. */
221
223
  lifecycle: "active" | "archived";
222
224
  archivedAt?: string;
@@ -286,7 +288,7 @@ export interface PublishedSkillSelection {
286
288
  }
287
289
  /** Metadata only: bundle availability means its tenant-owned storage row exists. */
288
290
  export interface PublishedSkillSelectionState extends PublishedSkillSelection {
289
- current: Pick<ServerSkillRecord, "lifecycle" | "tombstonedAt"> | null;
291
+ current: Pick<ServerSkillRecord, "lifecycle" | "tombstonedAt" | "authorizationEpoch"> | null;
290
292
  versionBundleSha256: string | null;
291
293
  bundleAvailable: boolean;
292
294
  }
@@ -19,6 +19,8 @@ export interface SkillProfile {
19
19
  updatedAt: string;
20
20
  }
21
21
  export interface ResolvedSkillSelection extends SkillSelection {
22
+ /** Server-minted lifecycle fence, absent on legacy authorities/snapshots. */
23
+ authorizationEpoch?: string;
22
24
  authority: string;
23
25
  workspaceId: string;
24
26
  profileRevision: string;
@@ -0,0 +1,22 @@
1
+ -- A new baseline is current authorization, never evidence of historical continuity.
2
+ -- Clients lacking a recorded epoch may adopt one only from exact-current selections.
3
+ ALTER TABLE skills_registry ADD COLUMN authorization_epoch text NOT NULL
4
+ DEFAULT replace(gen_random_uuid()::text, '-', '')
5
+ CHECK (authorization_epoch ~ '^[a-f0-9]{32}$');
6
+
7
+ CREATE FUNCTION skills_registry_authorization_epoch() RETURNS trigger LANGUAGE plpgsql AS $$
8
+ BEGIN
9
+ IF TG_OP = 'INSERT' THEN
10
+ NEW.authorization_epoch := replace(gen_random_uuid()::text, '-', '');
11
+ ELSIF (OLD.tombstoned_at IS NULL AND NEW.tombstoned_at IS NOT NULL)
12
+ OR OLD.lifecycle IS DISTINCT FROM NEW.lifecycle THEN
13
+ NEW.authorization_epoch := replace(gen_random_uuid()::text, '-', '');
14
+ ELSE
15
+ NEW.authorization_epoch := OLD.authorization_epoch;
16
+ END IF;
17
+ RETURN NEW;
18
+ END;
19
+ $$;
20
+ CREATE TRIGGER skills_registry_authorization_epoch
21
+ BEFORE INSERT OR UPDATE ON skills_registry
22
+ FOR EACH ROW EXECUTE FUNCTION skills_registry_authorization_epoch();
@@ -0,0 +1,17 @@
1
+ -- Snapshot epochs are server-owned. This baseline does not backfill local receipts.
2
+ ALTER TABLE skills_registry ADD COLUMN authorization_epoch text;
3
+ UPDATE skills_registry SET authorization_epoch = lower(hex(randomblob(16)));
4
+ CREATE TRIGGER skills_registry_authorization_epoch_insert
5
+ AFTER INSERT ON skills_registry
6
+ BEGIN
7
+ UPDATE skills_registry SET authorization_epoch = lower(hex(randomblob(16)))
8
+ WHERE org_id = NEW.org_id AND slug = NEW.slug;
9
+ END;
10
+ CREATE TRIGGER skills_registry_authorization_epoch_lifecycle
11
+ AFTER UPDATE OF tombstoned_at, lifecycle ON skills_registry
12
+ WHEN (OLD.tombstoned_at IS NULL AND NEW.tombstoned_at IS NOT NULL)
13
+ OR OLD.lifecycle IS NOT NEW.lifecycle
14
+ BEGIN
15
+ UPDATE skills_registry SET authorization_epoch = lower(hex(randomblob(16)))
16
+ WHERE org_id = NEW.org_id AND slug = NEW.slug;
17
+ END;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/skills",
3
- "version": "0.10.45",
3
+ "version": "0.10.47",
4
4
  "description": "Skills library for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {