@hasna/skills 0.1.63 → 0.1.64

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 (38) hide show
  1. package/README.md +28 -6
  2. package/bin/index.js +1593 -228
  3. package/bin/mcp.js +290 -24
  4. package/bin/migrate.js +229 -33
  5. package/bin/server.js +774 -116
  6. package/bin/worker.js +558 -79
  7. package/dist/cli/commands/registry-reconcile.d.ts +2 -0
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.js +559 -251
  10. package/dist/lib/agent-sync.d.ts +26 -6
  11. package/dist/lib/auth-store.d.ts +37 -0
  12. package/dist/lib/config.d.ts +51 -0
  13. package/dist/lib/home-census.d.ts +4 -0
  14. package/dist/lib/home-migration.d.ts +8 -9
  15. package/dist/lib/native-storage.d.ts +1 -1
  16. package/dist/lib/portable-skills.d.ts +35 -6
  17. package/dist/lib/pull.d.ts +31 -0
  18. package/dist/lib/registry-reconcile.d.ts +114 -0
  19. package/dist/lib/registry.d.ts +7 -4
  20. package/dist/lib/remote-client.d.ts +118 -1
  21. package/dist/lib/remote-registry.d.ts +26 -0
  22. package/dist/lib/revision.d.ts +29 -0
  23. package/dist/sdk/index.js +1351 -353
  24. package/dist/server/app.d.ts +1 -1
  25. package/dist/server/config.d.ts +12 -2
  26. package/dist/server/rows.d.ts +2 -1
  27. package/dist/server/skills-api.d.ts +108 -6
  28. package/dist/server/sqlite-store.d.ts +20 -3
  29. package/dist/server/store.d.ts +31 -5
  30. package/dist/server/types.d.ts +98 -3
  31. package/dist/storage.js +7 -2
  32. package/migrations/postgres/0004_hosted_pins.sql +28 -0
  33. package/migrations/postgres/0005_revision_tombstone_registry.sql +37 -0
  34. package/migrations/postgres/0005_tag_projection.sql +36 -0
  35. package/migrations/sqlite/0004_hosted_pins.sql +21 -0
  36. package/migrations/sqlite/0005_revision_tombstone_registry.sql +18 -0
  37. package/migrations/sqlite/0005_tag_projection.sql +25 -0
  38. package/package.json +3 -2
@@ -19,4 +19,30 @@ export declare function buildSkillsApiUrl(apiUrl: string, endpoint?: string): st
19
19
  export declare function parseRemoteRegistryPayload(payload: unknown): SkillMeta[];
20
20
  export declare function parseRemoteSkillPayload(payload: unknown): SkillMeta;
21
21
  export declare function loadRemoteRegistry(options?: RemoteRegistryOptions): Promise<SkillMeta[]>;
22
+ /**
23
+ * Merge the authenticated remote registry into a local listing, whenever the
24
+ * install is pointed at a hosted instance.
25
+ *
26
+ * This is the fail-closed (R1) default-read merge: a client configured with an
27
+ * origin sees the folder UNION cloud in the plain `list`/`search` path, while
28
+ * every other install keeps today's exact local behavior.
29
+ *
30
+ * - No origin configured -> the local list is returned unchanged and no
31
+ * request is attempted. An unconfigured install must stay byte-identical
32
+ * to the pre-merge output.
33
+ * - Origin configured but no credential -> the local list is returned
34
+ * unchanged and nothing throws. Auth-missing must never crash a read.
35
+ * - Origin + credential -> the remote registry is fetched and merged under
36
+ * the precedence in registry-merge.ts (custom > extension > private >
37
+ * private-hosted > remote > upstream > official), remote rows tagged
38
+ * `source: "remote"`.
39
+ * - A configured, authenticated read that FAILS (auth rejection, HTTP
40
+ * error, network failure) throws a clear error rather than silently
41
+ * returning the local half — a silent partial listing would report
42
+ * success for a union the caller asked to include.
43
+ *
44
+ * The explicit `--remote` path stays on loadRemoteRegistry(): an explicit
45
+ * request has always been fatal on failure, and that contract is unchanged.
46
+ */
47
+ export declare function mergeRemoteRegistry(local: SkillMeta[], options?: RemoteRegistryOptions): Promise<SkillMeta[]>;
22
48
  export declare function loadRemoteSkill(name: string, options?: RemoteRegistryOptions): Promise<SkillMeta>;
@@ -0,0 +1,29 @@
1
+ /** The row's content-addressed revision identity: a lowercase hex sha-256. */
2
+ export declare const REVISION_ID_PATTERN: RegExp;
3
+ export interface RevisionContent {
4
+ slug: string;
5
+ displayName: string;
6
+ description: string;
7
+ category: string;
8
+ tags: string[];
9
+ source: string;
10
+ kind: "executable" | "instruction";
11
+ version?: string;
12
+ skillMd?: string;
13
+ bundleSha256?: string;
14
+ bundleByteSize?: number;
15
+ }
16
+ export declare function revisionIdOf(content: RevisionContent): string;
17
+ export declare function revisionIdOfRecord(record: RevisionContent): string;
18
+ /**
19
+ * The legacy-row marker the 0004 migration leaves behind.
20
+ *
21
+ * Migration 0004 adds revision_id with DEFAULT '', so rows written before the migration
22
+ * carry an empty id. An empty id would make the If-Match guard vacuous for those rows:
23
+ * two clients that both read '' would both "match" and both land, silently overwriting
24
+ * each other. The stores replace the marker with a real content sha on first open
25
+ * (idempotent: new code always writes a full id, so the marker never reappears).
26
+ */
27
+ export declare const LEGACY_REVISION_ID = "";
28
+ /** True when a revision id is the empty legacy marker (needs backfill). */
29
+ export declare function isLegacyRevisionId(value: string): boolean;