@hasna/skills 0.10.46 → 0.10.48
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/bin/index.js +1211 -926
- package/bin/maintenance.js +7 -2
- package/bin/mcp.js +577 -360
- package/bin/migrate.js +7 -5
- package/bin/server.js +29 -10
- package/bin/worker.js +12 -7
- package/dist/index.js +826 -613
- package/dist/lib/agent-discovery.d.ts +1 -1
- package/dist/lib/claude-plugin-manifest-witness.d.ts +9 -0
- package/dist/lib/profile-client.d.ts +6 -2
- package/dist/lib/remote-files.d.ts +1 -1
- package/dist/lib/selection-cache.d.ts +5 -0
- package/dist/lib/selection-resolver.d.ts +1 -0
- package/dist/lib/session-reconciliation.d.ts +6 -3
- package/dist/sdk/index.js +796 -564
- package/dist/server/skills-api.d.ts +1 -0
- package/dist/server/types.d.ts +3 -1
- package/dist/types/skill-selection.d.ts +2 -0
- package/migrations/postgres/0011_skill_authorization_epoch.sql +22 -0
- package/migrations/sqlite/0011_skill_authorization_epoch.sql +17 -0
- package/package.json +1 -1
package/bin/maintenance.js
CHANGED
|
@@ -2530,6 +2530,7 @@ function rowToSkill(row) {
|
|
|
2530
2530
|
revisionNumber: Number(row.revision_number ?? 0),
|
|
2531
2531
|
...row.tombstoned_at ? { tombstonedAt: dateString(row.tombstoned_at) } : {},
|
|
2532
2532
|
...row.tombstone_purge_after ? { tombstonePurgeAfter: dateString(row.tombstone_purge_after) } : {},
|
|
2533
|
+
...typeof row.authorization_epoch === "string" ? { authorizationEpoch: row.authorization_epoch } : {},
|
|
2533
2534
|
lifecycle: row.lifecycle === "archived" ? "archived" : "active",
|
|
2534
2535
|
...row.archived_at ? { archivedAt: dateString(row.archived_at) } : {},
|
|
2535
2536
|
...row.archive_reason ? { archiveReason: String(row.archive_reason) } : {},
|
|
@@ -2541,6 +2542,7 @@ function rowToPublishedSelectionState(row) {
|
|
|
2541
2542
|
slug: String(row.slug),
|
|
2542
2543
|
version: String(row.version),
|
|
2543
2544
|
current: row.skill_exists ? {
|
|
2545
|
+
...typeof row.authorization_epoch === "string" ? { authorizationEpoch: row.authorization_epoch } : {},
|
|
2544
2546
|
lifecycle: row.lifecycle === "archived" ? "archived" : "active",
|
|
2545
2547
|
...row.tombstoned_at ? { tombstonedAt: dateString(row.tombstoned_at) } : {}
|
|
2546
2548
|
} : null,
|
|
@@ -2904,6 +2906,7 @@ class MemorySkillsStore {
|
|
|
2904
2906
|
updatedAt: now,
|
|
2905
2907
|
revisionId: revisionIdOfRecord(recordFieldsOf(input, carriedBundle, carriedSkillMd)),
|
|
2906
2908
|
revisionNumber: (previous?.revisionNumber ?? 0) + 1,
|
|
2909
|
+
authorizationEpoch: previous?.authorizationEpoch ?? randomUUID4().replaceAll("-", ""),
|
|
2907
2910
|
lifecycle: previous?.lifecycle ?? "active",
|
|
2908
2911
|
...previous?.archivedAt ? { archivedAt: previous.archivedAt } : {},
|
|
2909
2912
|
...previous?.archiveReason ? { archiveReason: previous.archiveReason } : {},
|
|
@@ -2947,6 +2950,7 @@ class MemorySkillsStore {
|
|
|
2947
2950
|
slug,
|
|
2948
2951
|
version,
|
|
2949
2952
|
current: current?.orgId === principal.orgId ? {
|
|
2953
|
+
authorizationEpoch: current.authorizationEpoch,
|
|
2950
2954
|
lifecycle: current.lifecycle,
|
|
2951
2955
|
...current.tombstonedAt ? { tombstonedAt: current.tombstonedAt } : {}
|
|
2952
2956
|
} : null,
|
|
@@ -2975,6 +2979,7 @@ class MemorySkillsStore {
|
|
|
2975
2979
|
}
|
|
2976
2980
|
const next2 = {
|
|
2977
2981
|
...current,
|
|
2982
|
+
authorizationEpoch: current.lifecycle === patch.lifecycle ? current.authorizationEpoch : randomUUID4().replaceAll("-", ""),
|
|
2978
2983
|
lifecycle: patch.lifecycle,
|
|
2979
2984
|
updatedAt: nowIso(),
|
|
2980
2985
|
revisionId: revisionIdOfRecord({ ...current, lifecycle: patch.lifecycle, archiveReason: patch.reason, replacementSlug: patch.replacementSlug }),
|
|
@@ -3019,7 +3024,7 @@ class MemorySkillsStore {
|
|
|
3019
3024
|
if (!current.tombstonedAt) {
|
|
3020
3025
|
const tombstoned = nowIso();
|
|
3021
3026
|
const purgeAfter = new Date(Date.now() + tombstoneWindowMs).toISOString();
|
|
3022
|
-
const next2 = { ...current, tombstonedAt: tombstoned, tombstonePurgeAfter: purgeAfter, updatedAt: tombstoned };
|
|
3027
|
+
const next2 = { ...current, authorizationEpoch: randomUUID4().replaceAll("-", ""), tombstonedAt: tombstoned, tombstonePurgeAfter: purgeAfter, updatedAt: tombstoned };
|
|
3023
3028
|
this.skills.set(skillKey(principal.orgId, slug), next2);
|
|
3024
3029
|
return next2;
|
|
3025
3030
|
}
|
|
@@ -3773,7 +3778,7 @@ class PostgresSkillsStore {
|
|
|
3773
3778
|
const requested = JSON.stringify(selections2.map(({ slug, version }) => ({ slug, version })));
|
|
3774
3779
|
const rows = await this.sql`
|
|
3775
3780
|
SELECT q.value->>'slug' AS slug, q.value->>'version' AS version,
|
|
3776
|
-
r.slug IS NOT NULL AS skill_exists, r.lifecycle, r.tombstoned_at,
|
|
3781
|
+
r.slug IS NOT NULL AS skill_exists, r.lifecycle, r.tombstoned_at, r.authorization_epoch,
|
|
3777
3782
|
v.bundle_sha256, b.sha256 IS NOT NULL AS bundle_available
|
|
3778
3783
|
FROM jsonb_array_elements(${requested}::text::jsonb) WITH ORDINALITY AS q(value, ordinal)
|
|
3779
3784
|
LEFT JOIN skills_registry r ON r.org_id = ${principal.orgId} AND r.slug = q.value->>'slug'
|