@soulcraft/sdk 3.2.1 → 3.3.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.
- package/dist/modules/kits/index.d.ts +19 -32
- package/dist/modules/kits/index.d.ts.map +1 -1
- package/dist/modules/kits/index.js +40 -89
- package/dist/modules/kits/index.js.map +1 -1
- package/dist/modules/kits/types.d.ts +25 -61
- package/dist/modules/kits/types.d.ts.map +1 -1
- package/dist/modules/kits/types.js +5 -10
- package/dist/modules/kits/types.js.map +1 -1
- package/dist/modules/skills/index.d.ts +14 -19
- package/dist/modules/skills/index.d.ts.map +1 -1
- package/dist/modules/skills/index.js +24 -55
- package/dist/modules/skills/index.js.map +1 -1
- package/dist/modules/skills/types.d.ts +7 -12
- package/dist/modules/skills/types.d.ts.map +1 -1
- package/dist/modules/skills/types.js +2 -6
- package/dist/modules/skills/types.js.map +1 -1
- package/dist/server/handlers/project.d.ts +2 -2
- package/package.json +1 -1
|
@@ -2,61 +2,48 @@
|
|
|
2
2
|
* @module kits
|
|
3
3
|
* @description Factory for sdk.kits.* — the Soulcraft kit registry module.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* Fetches kits from the Forge Kit Registry (`forge.soulcraft.com`) over HTTP.
|
|
6
|
+
* Archives (.sck) are downloaded, unpacked to a local disk cache, and served
|
|
7
|
+
* as local filesystem paths. ETag-based revalidation minimizes network traffic.
|
|
6
8
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* to a local disk cache, and served as local filesystem paths. ETag-based
|
|
10
|
-
* revalidation minimizes network traffic. Set `registryUrl` to enable.
|
|
9
|
+
* For tests, pass `bundledRegistry` to inject an in-memory kit map without
|
|
10
|
+
* any network or filesystem access.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
* package via `createRequire()`. This is the backwards-compatible default
|
|
14
|
-
* that products use today. Will be removed once all products migrate to
|
|
15
|
-
* registry mode.
|
|
16
|
-
*
|
|
17
|
-
* The factory returns the same `KitsModule` interface regardless of mode.
|
|
18
|
-
* Callers never need to know which backing store is active.
|
|
19
|
-
*
|
|
20
|
-
* @example Registry mode (production)
|
|
12
|
+
* @example Production (zero-config — defaults to forge.soulcraft.com)
|
|
21
13
|
* ```typescript
|
|
22
14
|
* import { createKitsModule } from '@soulcraft/sdk/server'
|
|
23
15
|
*
|
|
24
|
-
* const kits = createKitsModule(
|
|
25
|
-
* registryUrl: process.env.FORGE_REGISTRY_URL, // 'https://forge.soulcraft.com'
|
|
26
|
-
* cachePath: '/home/app/.soulcraft/kits-cache',
|
|
27
|
-
* })
|
|
16
|
+
* const kits = createKitsModule()
|
|
28
17
|
* const kit = await kits.load('wicks-and-whiskers')
|
|
29
18
|
* ```
|
|
30
19
|
*
|
|
31
|
-
* @example
|
|
20
|
+
* @example Test mode
|
|
32
21
|
* ```typescript
|
|
33
|
-
* const kits = createKitsModule(
|
|
34
|
-
*
|
|
22
|
+
* const kits = createKitsModule({
|
|
23
|
+
* bundledRegistry: { 'test-kit': { id: 'test-kit', name: 'Test', ... } }
|
|
24
|
+
* })
|
|
35
25
|
* ```
|
|
36
26
|
*/
|
|
37
27
|
import type { KitsModule, CreateKitsModuleOptions } from './types.js';
|
|
38
28
|
/**
|
|
39
29
|
* Create the `sdk.kits.*` module.
|
|
40
30
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* - `registryUrl` set → HTTP-based registry mode (production)
|
|
44
|
-
* - Neither set → legacy bundled mode via `@soulcraft/kits` package
|
|
31
|
+
* With no arguments, connects to the Forge Kit Registry at `forge.soulcraft.com`.
|
|
32
|
+
* Pass `registryUrl` to override, or `bundledRegistry` for tests.
|
|
45
33
|
*
|
|
46
34
|
* @param options - Configuration for the kits module.
|
|
47
35
|
* @returns A `KitsModule` instance.
|
|
48
36
|
*
|
|
49
|
-
* @example
|
|
37
|
+
* @example Default (production — uses forge.soulcraft.com)
|
|
50
38
|
* ```typescript
|
|
51
|
-
* const kits = createKitsModule(
|
|
52
|
-
* registryUrl: 'https://forge.soulcraft.com',
|
|
53
|
-
* cachePath: '/home/app/.soulcraft/kits-cache',
|
|
54
|
-
* })
|
|
39
|
+
* const kits = createKitsModule()
|
|
55
40
|
* ```
|
|
56
41
|
*
|
|
57
|
-
* @example
|
|
42
|
+
* @example Custom registry URL
|
|
58
43
|
* ```typescript
|
|
59
|
-
* const kits = createKitsModule(
|
|
44
|
+
* const kits = createKitsModule({
|
|
45
|
+
* registryUrl: 'https://custom-registry.example.com',
|
|
46
|
+
* })
|
|
60
47
|
* ```
|
|
61
48
|
*
|
|
62
49
|
* @example Test mode — inject mock kits
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/kits/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/kits/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAKH,OAAO,KAAK,EAEV,UAAU,EACV,uBAAuB,EAExB,MAAM,YAAY,CAAA;AAqWnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,uBAA4B,GAAG,UAAU,CAgBlF"}
|
|
@@ -2,78 +2,42 @@
|
|
|
2
2
|
* @module kits
|
|
3
3
|
* @description Factory for sdk.kits.* — the Soulcraft kit registry module.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* Fetches kits from the Forge Kit Registry (`forge.soulcraft.com`) over HTTP.
|
|
6
|
+
* Archives (.sck) are downloaded, unpacked to a local disk cache, and served
|
|
7
|
+
* as local filesystem paths. ETag-based revalidation minimizes network traffic.
|
|
6
8
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* to a local disk cache, and served as local filesystem paths. ETag-based
|
|
10
|
-
* revalidation minimizes network traffic. Set `registryUrl` to enable.
|
|
9
|
+
* For tests, pass `bundledRegistry` to inject an in-memory kit map without
|
|
10
|
+
* any network or filesystem access.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
* package via `createRequire()`. This is the backwards-compatible default
|
|
14
|
-
* that products use today. Will be removed once all products migrate to
|
|
15
|
-
* registry mode.
|
|
16
|
-
*
|
|
17
|
-
* The factory returns the same `KitsModule` interface regardless of mode.
|
|
18
|
-
* Callers never need to know which backing store is active.
|
|
19
|
-
*
|
|
20
|
-
* @example Registry mode (production)
|
|
12
|
+
* @example Production (zero-config — defaults to forge.soulcraft.com)
|
|
21
13
|
* ```typescript
|
|
22
14
|
* import { createKitsModule } from '@soulcraft/sdk/server'
|
|
23
15
|
*
|
|
24
|
-
* const kits = createKitsModule(
|
|
25
|
-
* registryUrl: process.env.FORGE_REGISTRY_URL, // 'https://forge.soulcraft.com'
|
|
26
|
-
* cachePath: '/home/app/.soulcraft/kits-cache',
|
|
27
|
-
* })
|
|
16
|
+
* const kits = createKitsModule()
|
|
28
17
|
* const kit = await kits.load('wicks-and-whiskers')
|
|
29
18
|
* ```
|
|
30
19
|
*
|
|
31
|
-
* @example
|
|
20
|
+
* @example Test mode
|
|
32
21
|
* ```typescript
|
|
33
|
-
* const kits = createKitsModule(
|
|
34
|
-
*
|
|
22
|
+
* const kits = createKitsModule({
|
|
23
|
+
* bundledRegistry: { 'test-kit': { id: 'test-kit', name: 'Test', ... } }
|
|
24
|
+
* })
|
|
35
25
|
* ```
|
|
36
26
|
*/
|
|
37
|
-
import { createRequire } from 'node:module';
|
|
38
27
|
import { existsSync, mkdirSync, readFileSync, writeFileSync, rmSync, readdirSync } from 'node:fs';
|
|
39
28
|
import { join, resolve } from 'node:path';
|
|
40
29
|
import { homedir } from 'node:os';
|
|
41
30
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
42
|
-
//
|
|
31
|
+
// In-memory test mode
|
|
43
32
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
44
|
-
const _require = createRequire(import.meta.url);
|
|
45
|
-
/** Module-level cache — loaded once per process. */
|
|
46
|
-
let _kitsPackage = undefined;
|
|
47
|
-
/**
|
|
48
|
-
* @description Lazily load the `@soulcraft/kits` optional peer dependency.
|
|
49
|
-
* Returns `null` when the package is not installed.
|
|
50
|
-
*/
|
|
51
|
-
function _loadKitsPackage() {
|
|
52
|
-
if (_kitsPackage !== undefined)
|
|
53
|
-
return _kitsPackage;
|
|
54
|
-
try {
|
|
55
|
-
_kitsPackage = _require('@soulcraft/kits');
|
|
56
|
-
}
|
|
57
|
-
catch {
|
|
58
|
-
_kitsPackage = null;
|
|
59
|
-
}
|
|
60
|
-
return _kitsPackage;
|
|
61
|
-
}
|
|
62
33
|
/**
|
|
63
|
-
* @description
|
|
64
|
-
*
|
|
65
|
-
*/
|
|
66
|
-
function _getBundledRegistry() {
|
|
67
|
-
return _loadKitsPackage()?.kitRegistry ?? null;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* @description Create a KitsModule backed by the @soulcraft/kits npm package.
|
|
71
|
-
* This is the legacy mode, retained for backwards compatibility.
|
|
34
|
+
* @description Create a KitsModule backed by an in-memory registry map.
|
|
35
|
+
* Used in tests to avoid network and filesystem access.
|
|
72
36
|
*
|
|
73
|
-
* @param getRegistry - Function that returns the
|
|
74
|
-
* @returns A KitsModule that reads from the
|
|
37
|
+
* @param getRegistry - Function that returns the static registry (or null).
|
|
38
|
+
* @returns A KitsModule that reads from the in-memory map.
|
|
75
39
|
*/
|
|
76
|
-
function
|
|
40
|
+
function _createInMemoryKitsModule(getRegistry) {
|
|
77
41
|
return {
|
|
78
42
|
async load(kitId) {
|
|
79
43
|
const registry = getRegistry();
|
|
@@ -87,29 +51,22 @@ function _createBundledKitsModule(getRegistry) {
|
|
|
87
51
|
return [];
|
|
88
52
|
return Object.values(registry);
|
|
89
53
|
},
|
|
90
|
-
async resolveFilesPath(
|
|
91
|
-
|
|
92
|
-
if (!pkg?.resolveKitFilesPath)
|
|
93
|
-
return null;
|
|
94
|
-
return pkg.resolveKitFilesPath(kitId, product);
|
|
54
|
+
async resolveFilesPath() {
|
|
55
|
+
return null;
|
|
95
56
|
},
|
|
96
|
-
async resolveSkillsPath(
|
|
97
|
-
|
|
98
|
-
if (!pkg?.resolveKitSkillsPath)
|
|
99
|
-
return null;
|
|
100
|
-
return pkg.resolveKitSkillsPath(kitId);
|
|
57
|
+
async resolveSkillsPath() {
|
|
58
|
+
return null;
|
|
101
59
|
},
|
|
102
60
|
async resolveKitsRoot() {
|
|
103
|
-
|
|
104
|
-
if (!pkg?.resolveKitsRoot)
|
|
105
|
-
return null;
|
|
106
|
-
return pkg.resolveKitsRoot();
|
|
61
|
+
return null;
|
|
107
62
|
},
|
|
108
63
|
};
|
|
109
64
|
}
|
|
110
65
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
111
66
|
// Registry mode — fetch from Forge Kit Registry over HTTP
|
|
112
67
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
68
|
+
/** The canonical Forge Kit Registry URL. */
|
|
69
|
+
const DEFAULT_REGISTRY_URL = 'https://forge.soulcraft.com';
|
|
113
70
|
/** Default cache freshness: 5 minutes. */
|
|
114
71
|
const DEFAULT_CACHE_TTL_MS = 300_000;
|
|
115
72
|
/** Default local cache directory: ~/.soulcraft/kits-cache */
|
|
@@ -380,25 +337,22 @@ function _createRegistryKitsModule(registryUrl, cachePath, cacheTtlMs) {
|
|
|
380
337
|
/**
|
|
381
338
|
* Create the `sdk.kits.*` module.
|
|
382
339
|
*
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
* - `registryUrl` set → HTTP-based registry mode (production)
|
|
386
|
-
* - Neither set → legacy bundled mode via `@soulcraft/kits` package
|
|
340
|
+
* With no arguments, connects to the Forge Kit Registry at `forge.soulcraft.com`.
|
|
341
|
+
* Pass `registryUrl` to override, or `bundledRegistry` for tests.
|
|
387
342
|
*
|
|
388
343
|
* @param options - Configuration for the kits module.
|
|
389
344
|
* @returns A `KitsModule` instance.
|
|
390
345
|
*
|
|
391
|
-
* @example
|
|
346
|
+
* @example Default (production — uses forge.soulcraft.com)
|
|
392
347
|
* ```typescript
|
|
393
|
-
* const kits = createKitsModule(
|
|
394
|
-
* registryUrl: 'https://forge.soulcraft.com',
|
|
395
|
-
* cachePath: '/home/app/.soulcraft/kits-cache',
|
|
396
|
-
* })
|
|
348
|
+
* const kits = createKitsModule()
|
|
397
349
|
* ```
|
|
398
350
|
*
|
|
399
|
-
* @example
|
|
351
|
+
* @example Custom registry URL
|
|
400
352
|
* ```typescript
|
|
401
|
-
* const kits = createKitsModule(
|
|
353
|
+
* const kits = createKitsModule({
|
|
354
|
+
* registryUrl: 'https://custom-registry.example.com',
|
|
355
|
+
* })
|
|
402
356
|
* ```
|
|
403
357
|
*
|
|
404
358
|
* @example Test mode — inject mock kits
|
|
@@ -414,17 +368,14 @@ export function createKitsModule(options = {}) {
|
|
|
414
368
|
// Test mode — static in-memory registry takes highest precedence
|
|
415
369
|
if (options.bundledRegistry !== undefined) {
|
|
416
370
|
const getRegistry = () => options.bundledRegistry ?? null;
|
|
417
|
-
return
|
|
418
|
-
}
|
|
419
|
-
// Registry mode — fetch from Forge Kit Registry over HTTP
|
|
420
|
-
if (options.registryUrl) {
|
|
421
|
-
const cachePath = options.cachePath
|
|
422
|
-
? resolve(options.cachePath)
|
|
423
|
-
: DEFAULT_CACHE_PATH;
|
|
424
|
-
const cacheTtlMs = options.cacheTtlMs ?? DEFAULT_CACHE_TTL_MS;
|
|
425
|
-
return _createRegistryKitsModule(options.registryUrl, cachePath, cacheTtlMs);
|
|
371
|
+
return _createInMemoryKitsModule(getRegistry);
|
|
426
372
|
}
|
|
427
|
-
//
|
|
428
|
-
|
|
373
|
+
// Registry mode — default to forge.soulcraft.com
|
|
374
|
+
const registryUrl = options.registryUrl || DEFAULT_REGISTRY_URL;
|
|
375
|
+
const cachePath = options.cachePath
|
|
376
|
+
? resolve(options.cachePath)
|
|
377
|
+
: DEFAULT_CACHE_PATH;
|
|
378
|
+
const cacheTtlMs = options.cacheTtlMs ?? DEFAULT_CACHE_TTL_MS;
|
|
379
|
+
return _createRegistryKitsModule(registryUrl, cachePath, cacheTtlMs);
|
|
429
380
|
}
|
|
430
381
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/kits/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/kits/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACjG,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAQjC,gFAAgF;AAChF,sBAAsB;AACtB,gFAAgF;AAEhF;;;;;;GAMG;AACH,SAAS,yBAAyB,CAChC,WAA4D;IAE5D,OAAO;QACL,KAAK,CAAC,IAAI,CAAC,KAAa;YACtB,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAA;YAC9B,IAAI,CAAC,QAAQ;gBAAE,OAAO,IAAI,CAAA;YAC1B,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,IAAI,CAAA;QAChC,CAAC;QAED,KAAK,CAAC,IAAI;YACR,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAA;YAC9B,IAAI,CAAC,QAAQ;gBAAE,OAAO,EAAE,CAAA;YACxB,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;QAChC,CAAC;QAED,KAAK,CAAC,gBAAgB;YACpB,OAAO,IAAI,CAAA;QACb,CAAC;QAED,KAAK,CAAC,iBAAiB;YACrB,OAAO,IAAI,CAAA;QACb,CAAC;QAED,KAAK,CAAC,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e;YACnB,OAAO,SAAS,CAAA;QAClB,CAAC;KACF,CAAA;AACH,CAAC;AAED,gFAAgF;AAChF,iBAAiB;AACjB,gFAAgF;AAEhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAAmC,EAAE;IACpE,iEAAiE;IACjE,IAAI,OAAO,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;QAC1C,MAAM,WAAW,GAAG,GAA8C,EAAE,CAClE,OAAO,CAAC,eAAe,IAAI,IAAI,CAAA;QACjC,OAAO,yBAAyB,CAAC,WAAW,CAAC,CAAA;IAC/C,CAAC;IAED,iDAAiD;IACjD,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,oBAAoB,CAAA;IAC/D,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS;QACjC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC;QAC5B,CAAC,CAAC,kBAAkB,CAAA;IACtB,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,oBAAoB,CAAA;IAE7D,OAAO,yBAAyB,CAAC,WAAW,EAAE,SAAS,EAAE,UAAU,CAAC,CAAA;AACtE,CAAC"}
|
|
@@ -7,17 +7,12 @@
|
|
|
7
7
|
* persona, glossary, and workflow. They contain no TypeScript logic, no server
|
|
8
8
|
* code, and no SDK imports.
|
|
9
9
|
*
|
|
10
|
-
* The `KitsModule` provides read-only access to the kit registry
|
|
11
|
-
*
|
|
10
|
+
* The `KitsModule` provides read-only access to the kit registry via the Forge
|
|
11
|
+
* Kit Registry at `forge.soulcraft.com`. Archives (.sck) are fetched over HTTP,
|
|
12
|
+
* unpacked to a local disk cache, and served as filesystem paths. ETag-based
|
|
13
|
+
* cache validation avoids re-downloading unchanged kits.
|
|
12
14
|
*
|
|
13
|
-
*
|
|
14
|
-
* the Forge Kit Registry (`forge.soulcraft.com`) over HTTP. Archives (.sck)
|
|
15
|
-
* are unpacked to a local disk cache for filesystem access. ETag-based cache
|
|
16
|
-
* validation avoids re-downloading unchanged kits.
|
|
17
|
-
*
|
|
18
|
-
* 2. **Bundled mode** (legacy) — when no `registryUrl` is provided, kits are
|
|
19
|
-
* loaded from the `@soulcraft/kits` npm package via `createRequire()`. This
|
|
20
|
-
* is the backwards-compatible fallback used during migration.
|
|
15
|
+
* For tests, pass `bundledRegistry` to inject an in-memory kit map.
|
|
21
16
|
*
|
|
22
17
|
* Kit initialization (populating a workspace's Brainy and VFS from a kit's
|
|
23
18
|
* `starterFiles`) is a product-level concern and lives in each product's
|
|
@@ -75,29 +70,12 @@ export interface CachedKitEntry {
|
|
|
75
70
|
/**
|
|
76
71
|
* Options for `createKitsModule()`.
|
|
77
72
|
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* **Registry mode** — set `registryUrl` to fetch kits from the Forge Kit Registry.
|
|
81
|
-
* The SDK downloads `.sck` archives, unpacks them to `cachePath`, and serves
|
|
82
|
-
* filesystem paths from the local cache. ETag-based revalidation avoids
|
|
83
|
-
* re-downloading unchanged kits.
|
|
84
|
-
*
|
|
85
|
-
* **Bundled mode** (legacy) — omit `registryUrl` to load kits from the
|
|
86
|
-
* `@soulcraft/kits` npm package. This is the backwards-compatible default
|
|
87
|
-
* used during migration. Set `bundledRegistry` to inject a mock registry
|
|
88
|
-
* for testing.
|
|
89
|
-
*
|
|
90
|
-
* @example Registry mode (production)
|
|
91
|
-
* ```typescript
|
|
92
|
-
* const kits = createKitsModule({
|
|
93
|
-
* registryUrl: 'https://forge.soulcraft.com',
|
|
94
|
-
* cachePath: '/home/app/.soulcraft/kits-cache',
|
|
95
|
-
* })
|
|
96
|
-
* ```
|
|
73
|
+
* With no arguments, connects to `forge.soulcraft.com` (the canonical Forge
|
|
74
|
+
* Kit Registry). Pass `registryUrl` to override, or `bundledRegistry` for tests.
|
|
97
75
|
*
|
|
98
|
-
* @example
|
|
76
|
+
* @example Default (production)
|
|
99
77
|
* ```typescript
|
|
100
|
-
* const kits = createKitsModule()
|
|
78
|
+
* const kits = createKitsModule()
|
|
101
79
|
* ```
|
|
102
80
|
*
|
|
103
81
|
* @example Test mode
|
|
@@ -109,14 +87,10 @@ export interface CachedKitEntry {
|
|
|
109
87
|
*/
|
|
110
88
|
export interface CreateKitsModuleOptions {
|
|
111
89
|
/**
|
|
112
|
-
* Base URL of the Forge Kit Registry
|
|
90
|
+
* Base URL of the Forge Kit Registry.
|
|
113
91
|
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
* The `@soulcraft/kits` npm package is not needed.
|
|
117
|
-
*
|
|
118
|
-
* When omitted, the module falls back to **bundled mode** using the
|
|
119
|
-
* `@soulcraft/kits` package.
|
|
92
|
+
* Defaults to `'https://forge.soulcraft.com'`. Override only for self-hosted
|
|
93
|
+
* registries or local development.
|
|
120
94
|
*/
|
|
121
95
|
registryUrl?: string;
|
|
122
96
|
/**
|
|
@@ -142,7 +116,7 @@ export interface CreateKitsModuleOptions {
|
|
|
142
116
|
cacheTtlMs?: number;
|
|
143
117
|
/**
|
|
144
118
|
* Override the kit registry with a static in-memory map. Used in tests to
|
|
145
|
-
* avoid
|
|
119
|
+
* avoid network and filesystem access.
|
|
146
120
|
*
|
|
147
121
|
* Set to `null` to simulate no kits being available.
|
|
148
122
|
*
|
|
@@ -154,14 +128,9 @@ export interface CreateKitsModuleOptions {
|
|
|
154
128
|
* The `sdk.kits.*` namespace — read-only access to the Soulcraft kit registry
|
|
155
129
|
* and template file paths.
|
|
156
130
|
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* npm package.
|
|
161
|
-
*
|
|
162
|
-
* The interface is identical in both modes — callers don't know or care
|
|
163
|
-
* where kits come from. The `registryUrl` option in `createKitsModule()`
|
|
164
|
-
* controls the backing store.
|
|
131
|
+
* Kits are fetched from the Forge Kit Registry at `forge.soulcraft.com`,
|
|
132
|
+
* cached locally, and served from disk. For tests, pass `bundledRegistry`
|
|
133
|
+
* to `createKitsModule()` to inject an in-memory kit map.
|
|
165
134
|
*
|
|
166
135
|
* @example Load a kit and run AI with its persona
|
|
167
136
|
* ```typescript
|
|
@@ -177,17 +146,15 @@ export interface CreateKitsModuleOptions {
|
|
|
177
146
|
* @example Locate kit template files on disk
|
|
178
147
|
* ```typescript
|
|
179
148
|
* const dir = await sdk.kits.resolveFilesPath('blog-series', 'workshop')
|
|
180
|
-
* //
|
|
181
|
-
* // Bundled mode: '/path/to/node_modules/@soulcraft/kits/kits/blog-series/workshop/files'
|
|
149
|
+
* // → '~/.soulcraft/kits-cache/blog-series/workshop/files'
|
|
182
150
|
* ```
|
|
183
151
|
*/
|
|
184
152
|
export interface KitsModule {
|
|
185
153
|
/**
|
|
186
154
|
* Load a single kit configuration by ID.
|
|
187
155
|
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
* `@soulcraft/kits` package.
|
|
156
|
+
* Fetches the manifest from the registry (or returns a cached copy if
|
|
157
|
+
* within the TTL).
|
|
191
158
|
*
|
|
192
159
|
* @param kitId - The kit identifier (e.g. `'wicks-and-whiskers'`).
|
|
193
160
|
* @returns The kit configuration, or `null` if not found.
|
|
@@ -202,8 +169,7 @@ export interface KitsModule {
|
|
|
202
169
|
/**
|
|
203
170
|
* List all available kits from the registry.
|
|
204
171
|
*
|
|
205
|
-
*
|
|
206
|
-
* In bundled mode, it returns all kits from the `@soulcraft/kits` package.
|
|
172
|
+
* Fetches the full kit listing from the registry.
|
|
207
173
|
*
|
|
208
174
|
* @returns All kit configurations as an array.
|
|
209
175
|
*
|
|
@@ -217,9 +183,9 @@ export interface KitsModule {
|
|
|
217
183
|
/**
|
|
218
184
|
* Resolve the absolute path to a kit's product-specific template files directory.
|
|
219
185
|
*
|
|
220
|
-
*
|
|
186
|
+
* The path points into the local cache at
|
|
221
187
|
* `{cachePath}/{kitId}/{product}/files/`. The kit is downloaded and unpacked
|
|
222
|
-
* if not already cached.
|
|
188
|
+
* if not already cached.
|
|
223
189
|
*
|
|
224
190
|
* Returns `null` if the kit is not found or the files directory doesn't exist.
|
|
225
191
|
*
|
|
@@ -237,9 +203,8 @@ export interface KitsModule {
|
|
|
237
203
|
/**
|
|
238
204
|
* Resolve the absolute path to a kit's skills directory.
|
|
239
205
|
*
|
|
240
|
-
*
|
|
241
|
-
* `{cachePath}/{kitId}/skills/`.
|
|
242
|
-
* the npm package.
|
|
206
|
+
* The path points into the local cache at
|
|
207
|
+
* `{cachePath}/{kitId}/skills/`.
|
|
243
208
|
*
|
|
244
209
|
* @param kitId - Kit identifier.
|
|
245
210
|
* @returns Absolute path to the skills directory, or `null` if not found.
|
|
@@ -254,8 +219,7 @@ export interface KitsModule {
|
|
|
254
219
|
/**
|
|
255
220
|
* Resolve the absolute path to the root kits cache or package directory.
|
|
256
221
|
*
|
|
257
|
-
*
|
|
258
|
-
* returns the `kits/` directory inside the npm package.
|
|
222
|
+
* Returns the `cachePath` directory.
|
|
259
223
|
*
|
|
260
224
|
* @returns Absolute path to the kits root, or `null` if unavailable.
|
|
261
225
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/modules/kits/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/modules/kits/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAMH;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB;IACjC,qFAAqF;IACrF,EAAE,EAAE,MAAM,CAAA;IACV,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,wDAAwD;IACxD,WAAW,EAAE,MAAM,CAAA;IACnB,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAA;IACf,6BAA6B;IAC7B,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,GAAG,WAAW,CAAA;IAC3D,0CAA0C;IAC1C,MAAM,CAAC,EAAE;QACP,gCA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IAEtF;;;;;;;;;;;;;;OAcG;IACH,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IAExD;;;;;;;;;;;;OAYG;IACH,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;CAC1C"}
|
|
@@ -7,17 +7,12 @@
|
|
|
7
7
|
* persona, glossary, and workflow. They contain no TypeScript logic, no server
|
|
8
8
|
* code, and no SDK imports.
|
|
9
9
|
*
|
|
10
|
-
* The `KitsModule` provides read-only access to the kit registry
|
|
11
|
-
*
|
|
10
|
+
* The `KitsModule` provides read-only access to the kit registry via the Forge
|
|
11
|
+
* Kit Registry at `forge.soulcraft.com`. Archives (.sck) are fetched over HTTP,
|
|
12
|
+
* unpacked to a local disk cache, and served as filesystem paths. ETag-based
|
|
13
|
+
* cache validation avoids re-downloading unchanged kits.
|
|
12
14
|
*
|
|
13
|
-
*
|
|
14
|
-
* the Forge Kit Registry (`forge.soulcraft.com`) over HTTP. Archives (.sck)
|
|
15
|
-
* are unpacked to a local disk cache for filesystem access. ETag-based cache
|
|
16
|
-
* validation avoids re-downloading unchanged kits.
|
|
17
|
-
*
|
|
18
|
-
* 2. **Bundled mode** (legacy) — when no `registryUrl` is provided, kits are
|
|
19
|
-
* loaded from the `@soulcraft/kits` npm package via `createRequire()`. This
|
|
20
|
-
* is the backwards-compatible fallback used during migration.
|
|
15
|
+
* For tests, pass `bundledRegistry` to inject an in-memory kit map.
|
|
21
16
|
*
|
|
22
17
|
* Kit initialization (populating a workspace's Brainy and VFS from a kit's
|
|
23
18
|
* `starterFiles`) is a product-level concern and lives in each product's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/modules/kits/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/modules/kits/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG"}
|
|
@@ -4,25 +4,20 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Skills are SKILL.md files that define an AI persona, capabilities, and workflow
|
|
6
6
|
* for a kit domain. This module provides a unified `load()`/`list()`/`install()`
|
|
7
|
-
* API backed by
|
|
7
|
+
* API backed by VFS storage.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* **VFS** — `/skills/{kitId}/{skillId}.md` in the Brainy VFS. Managed at runtime
|
|
10
|
+
* via `install()` or the kit initialization pipeline. Skills are installed from
|
|
11
|
+
* the Forge Kit Registry during kit provisioning.
|
|
12
|
+
*
|
|
13
|
+
* For tests, pass `bundledRegistry` to inject an in-memory skill map without
|
|
14
|
+
* any VFS or filesystem access.
|
|
13
15
|
*
|
|
14
16
|
* ## VFS path convention
|
|
15
17
|
* ```
|
|
16
18
|
* /skills/{kitId}/{skillId}.md
|
|
17
19
|
* ```
|
|
18
20
|
* Example: `/skills/wicks-and-whiskers/inventory-health.md`
|
|
19
|
-
*
|
|
20
|
-
* ## Bundled fallback
|
|
21
|
-
*
|
|
22
|
-
* If `@soulcraft/kits` is installed, `skillRegistry[kitId]` is a Record mapping
|
|
23
|
-
* skill IDs to their raw SKILL.md content strings. The skills module reads from
|
|
24
|
-
* this registry when VFS lookup misses. If `@soulcraft/kits` is not installed,
|
|
25
|
-
* bundled lookup silently returns nothing.
|
|
26
21
|
*/
|
|
27
22
|
import type { Brainy } from '@soulcraft/brainy';
|
|
28
23
|
import type { SkillsModule } from './types.js';
|
|
@@ -31,19 +26,19 @@ import type { SkillsModule } from './types.js';
|
|
|
31
26
|
*/
|
|
32
27
|
export interface CreateSkillsModuleOptions {
|
|
33
28
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* When provided, this is used instead of the `@soulcraft/kits` package registry.
|
|
37
|
-
* Primarily used in tests to avoid requiring the kits package to be installed.
|
|
29
|
+
* Inject an in-memory skill registry for tests. When provided, these skills
|
|
30
|
+
* serve as the fallback when VFS lookup misses.
|
|
38
31
|
*/
|
|
39
32
|
bundledRegistry?: Record<string, Record<string, string>> | null;
|
|
40
33
|
}
|
|
41
34
|
/**
|
|
42
|
-
* Creates a `SkillsModule` backed by a Brainy VFS instance
|
|
43
|
-
*
|
|
35
|
+
* Creates a `SkillsModule` backed by a Brainy VFS instance.
|
|
36
|
+
*
|
|
37
|
+
* Skills are loaded from the VFS at `/skills/{kitId}/{skillId}.md`. For tests,
|
|
38
|
+
* pass `bundledRegistry` in options to provide an in-memory fallback.
|
|
44
39
|
*
|
|
45
40
|
* @param brain - An initialized Brainy instance. Required for VFS operations.
|
|
46
|
-
* Pass `null` to disable VFS skill loading (
|
|
41
|
+
* Pass `null` to disable VFS skill loading (test registry only).
|
|
47
42
|
* @param options - Optional configuration including a registry override for tests.
|
|
48
43
|
* @returns A configured {@link SkillsModule}.
|
|
49
44
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/skills/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/skills/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAgD,MAAM,YAAY,CAAA;AAM5F;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAAA;CAChE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,GAAG,IAAI,EACpB,OAAO,GAAE,yBAA8B,GACtC,YAAY,CAgDd;AAwJD,YAAY,EACV,YAAY,EACZ,KAAK,EACL,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,YAAY,CAAA"}
|
|
@@ -4,35 +4,29 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Skills are SKILL.md files that define an AI persona, capabilities, and workflow
|
|
6
6
|
* for a kit domain. This module provides a unified `load()`/`list()`/`install()`
|
|
7
|
-
* API backed by
|
|
7
|
+
* API backed by VFS storage.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* **VFS** — `/skills/{kitId}/{skillId}.md` in the Brainy VFS. Managed at runtime
|
|
10
|
+
* via `install()` or the kit initialization pipeline. Skills are installed from
|
|
11
|
+
* the Forge Kit Registry during kit provisioning.
|
|
12
|
+
*
|
|
13
|
+
* For tests, pass `bundledRegistry` to inject an in-memory skill map without
|
|
14
|
+
* any VFS or filesystem access.
|
|
13
15
|
*
|
|
14
16
|
* ## VFS path convention
|
|
15
17
|
* ```
|
|
16
18
|
* /skills/{kitId}/{skillId}.md
|
|
17
19
|
* ```
|
|
18
20
|
* Example: `/skills/wicks-and-whiskers/inventory-health.md`
|
|
19
|
-
*
|
|
20
|
-
* ## Bundled fallback
|
|
21
|
-
*
|
|
22
|
-
* If `@soulcraft/kits` is installed, `skillRegistry[kitId]` is a Record mapping
|
|
23
|
-
* skill IDs to their raw SKILL.md content strings. The skills module reads from
|
|
24
|
-
* this registry when VFS lookup misses. If `@soulcraft/kits` is not installed,
|
|
25
|
-
* bundled lookup silently returns nothing.
|
|
26
21
|
*/
|
|
27
|
-
import { createRequire } from 'node:module';
|
|
28
|
-
// ESM-compatible require for loading CJS packages like @soulcraft/kits.
|
|
29
|
-
const _require = createRequire(import.meta.url);
|
|
30
22
|
/**
|
|
31
|
-
* Creates a `SkillsModule` backed by a Brainy VFS instance
|
|
32
|
-
*
|
|
23
|
+
* Creates a `SkillsModule` backed by a Brainy VFS instance.
|
|
24
|
+
*
|
|
25
|
+
* Skills are loaded from the VFS at `/skills/{kitId}/{skillId}.md`. For tests,
|
|
26
|
+
* pass `bundledRegistry` in options to provide an in-memory fallback.
|
|
33
27
|
*
|
|
34
28
|
* @param brain - An initialized Brainy instance. Required for VFS operations.
|
|
35
|
-
* Pass `null` to disable VFS skill loading (
|
|
29
|
+
* Pass `null` to disable VFS skill loading (test registry only).
|
|
36
30
|
* @param options - Optional configuration including a registry override for tests.
|
|
37
31
|
* @returns A configured {@link SkillsModule}.
|
|
38
32
|
*
|
|
@@ -45,9 +39,9 @@ const _require = createRequire(import.meta.url);
|
|
|
45
39
|
* ```
|
|
46
40
|
*/
|
|
47
41
|
export function createSkillsModule(brain, options = {}) {
|
|
48
|
-
const
|
|
42
|
+
const getTestRegistry = options.bundledRegistry !== undefined
|
|
49
43
|
? () => options.bundledRegistry ?? null
|
|
50
|
-
:
|
|
44
|
+
: () => null;
|
|
51
45
|
return {
|
|
52
46
|
async load(id, kitId) {
|
|
53
47
|
// 1. Try VFS first
|
|
@@ -56,8 +50,8 @@ export function createSkillsModule(brain, options = {}) {
|
|
|
56
50
|
if (vfsSkill)
|
|
57
51
|
return vfsSkill;
|
|
58
52
|
}
|
|
59
|
-
// 2. Fall back to
|
|
60
|
-
return _loadBundled(id, kitId,
|
|
53
|
+
// 2. Fall back to test registry (only populated in tests)
|
|
54
|
+
return _loadBundled(id, kitId, getTestRegistry);
|
|
61
55
|
},
|
|
62
56
|
async list(options = {}) {
|
|
63
57
|
const { kitId, includeVfs = true, includeBundled = true } = options;
|
|
@@ -67,9 +61,9 @@ export function createSkillsModule(brain, options = {}) {
|
|
|
67
61
|
const vfsSkills = await _listFromVfs(brain, kitId);
|
|
68
62
|
results.push(...vfsSkills);
|
|
69
63
|
}
|
|
70
|
-
// Collect
|
|
64
|
+
// Collect test registry skills (only populated in tests)
|
|
71
65
|
if (includeBundled) {
|
|
72
|
-
const bundledSkills = _listBundled(kitId,
|
|
66
|
+
const bundledSkills = _listBundled(kitId, getTestRegistry);
|
|
73
67
|
results.push(...bundledSkills);
|
|
74
68
|
}
|
|
75
69
|
return results;
|
|
@@ -183,12 +177,12 @@ async function _listFromVfs(brain, kitId) {
|
|
|
183
177
|
// Bundled registry helpers
|
|
184
178
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
185
179
|
/**
|
|
186
|
-
* Load a single skill from the
|
|
180
|
+
* Load a single skill from the in-memory test registry.
|
|
187
181
|
*
|
|
188
182
|
* @param id - Skill ID.
|
|
189
183
|
* @param kitId - Kit ID.
|
|
190
|
-
* @param getRegistry - Function that returns the
|
|
191
|
-
* @returns The skill if found
|
|
184
|
+
* @param getRegistry - Function that returns the test registry (or null).
|
|
185
|
+
* @returns The skill if found, or `null`.
|
|
192
186
|
*/
|
|
193
187
|
function _loadBundled(id, kitId, getRegistry) {
|
|
194
188
|
const registry = getRegistry();
|
|
@@ -203,11 +197,11 @@ function _loadBundled(id, kitId, getRegistry) {
|
|
|
203
197
|
return { id, kitId, content, source: 'bundled' };
|
|
204
198
|
}
|
|
205
199
|
/**
|
|
206
|
-
* List skills from the
|
|
200
|
+
* List skills from the in-memory test registry, optionally filtered by kit ID.
|
|
207
201
|
*
|
|
208
202
|
* @param kitId - Optional kit filter.
|
|
209
|
-
* @param getRegistry - Function that returns the
|
|
210
|
-
* @returns Array of
|
|
203
|
+
* @param getRegistry - Function that returns the test registry (or null).
|
|
204
|
+
* @returns Array of skills from the registry.
|
|
211
205
|
*/
|
|
212
206
|
function _listBundled(kitId, getRegistry) {
|
|
213
207
|
const registry = getRegistry();
|
|
@@ -225,29 +219,4 @@ function _listBundled(kitId, getRegistry) {
|
|
|
225
219
|
}
|
|
226
220
|
return results;
|
|
227
221
|
}
|
|
228
|
-
// Lazily-resolved bundled registry cache.
|
|
229
|
-
// `undefined` = not yet attempted; `null` = @soulcraft/kits not installed.
|
|
230
|
-
let _registryCache = undefined;
|
|
231
|
-
/**
|
|
232
|
-
* Return the bundled `@soulcraft/kits` skill registry, loading it on first call.
|
|
233
|
-
*
|
|
234
|
-
* Uses `createRequire` (ESM-compatible CJS require) to load the package. Returns
|
|
235
|
-
* `null` and degrades gracefully if `@soulcraft/kits` is not installed — VFS
|
|
236
|
-
* skills continue to work normally.
|
|
237
|
-
*
|
|
238
|
-
* @returns The skill registry (kitId → skillId → content), or null.
|
|
239
|
-
*/
|
|
240
|
-
function _getBundledRegistry() {
|
|
241
|
-
if (_registryCache !== undefined)
|
|
242
|
-
return _registryCache;
|
|
243
|
-
try {
|
|
244
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
245
|
-
const kits = _require('@soulcraft/kits');
|
|
246
|
-
_registryCache = (kits.skillRegistry ?? null);
|
|
247
|
-
}
|
|
248
|
-
catch {
|
|
249
|
-
_registryCache = null;
|
|
250
|
-
}
|
|
251
|
-
return _registryCache;
|
|
252
|
-
}
|
|
253
222
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/skills/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/skills/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAoBH;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAoB,EACpB,UAAqC,EAAE;IAEvC,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,KAAK,SAAS;QAC3D,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,eAAe,IAAI,IAAI;QACvC,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAA;IAEd,OAAO;QACL,KAAK,CAAC,IAAI,CAAC,EAAU,EAAE,KAAa;YAClC,mBAAmB;YACnB,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,KAAK,EAAE,EAAE,EAAE,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AAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAA;AAClD,CAAC;AAED;;;;;;GAMG;AACH,SAAS,YAAY,CACnB,KAAyB,EACzB,WAA4E;IAE5E,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAA;IAC9B,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAA;IAExB,MAAM,OAAO,GAAY,EAAE,CAAA;IAC3B,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAE1D,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC7B,MAAM,SAAS,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAA;QAC/B,IAAI,CAAC,SAAS;YAAE,SAAQ;QACxB,KAAK,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YAC3D,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAA;QACvE,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
@@ -7,12 +7,8 @@
|
|
|
7
7
|
* Brainy AI system prompt construction and define what Claude knows how to do
|
|
8
8
|
* within a kit's context.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* 1. **VFS** — `/skills/{kitId}/{skillId}.md` in the Brainy VFS. Installed by the
|
|
13
|
-
* user or kit initialization pipeline. Takes priority over bundled skills.
|
|
14
|
-
* 2. **Bundled** — skills shipped with `@soulcraft/kits` as part of the kit manifest.
|
|
15
|
-
* Available without any VFS setup.
|
|
10
|
+
* Skills are stored in the Brainy VFS at `/skills/{kitId}/{skillId}.md`,
|
|
11
|
+
* installed by the kit initialization pipeline or via `sdk.skills.install()`.
|
|
16
12
|
*
|
|
17
13
|
* ## Skill ID convention
|
|
18
14
|
*
|
|
@@ -20,7 +16,7 @@
|
|
|
20
16
|
* SKILL.md file. Examples: `'inventory-health'`, `'session-flow'`, `'daily-brief'`.
|
|
21
17
|
*/
|
|
22
18
|
/**
|
|
23
|
-
* A parsed skill loaded from VFS or
|
|
19
|
+
* A parsed skill loaded from VFS or an in-memory test registry.
|
|
24
20
|
*/
|
|
25
21
|
export interface Skill {
|
|
26
22
|
/** Kebab-case skill identifier (matches the `id:` frontmatter field). */
|
|
@@ -47,7 +43,7 @@ export interface SkillListOptions {
|
|
|
47
43
|
*/
|
|
48
44
|
includeVfs?: boolean;
|
|
49
45
|
/**
|
|
50
|
-
* Whether to include
|
|
46
|
+
* Whether to include skills from the test registry (when provided) in results.
|
|
51
47
|
*
|
|
52
48
|
* @default true
|
|
53
49
|
*/
|
|
@@ -68,7 +64,7 @@ export interface SkillInstallOptions {
|
|
|
68
64
|
* The `sdk.skills` namespace.
|
|
69
65
|
*
|
|
70
66
|
* Provides a unified interface for loading, listing, and installing skills
|
|
71
|
-
*
|
|
67
|
+
* from the Brainy VFS.
|
|
72
68
|
*
|
|
73
69
|
* @example Loading a specific skill
|
|
74
70
|
* ```typescript
|
|
@@ -105,9 +101,8 @@ export interface SkillsModule {
|
|
|
105
101
|
/**
|
|
106
102
|
* List skills matching the given options.
|
|
107
103
|
*
|
|
108
|
-
* Skills are returned
|
|
109
|
-
*
|
|
110
|
-
* skill exists in both sources and both `includeVfs` and `includeBundled` are true).
|
|
104
|
+
* Skills are returned from VFS. When a test registry is provided, VFS skills
|
|
105
|
+
* appear first, followed by test registry skills (no deduplication).
|
|
111
106
|
*
|
|
112
107
|
* @param options - Filtering options.
|
|
113
108
|
* @returns An array of matching skills.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/modules/skills/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/modules/skills/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,yEAAyE;IACzE,EAAE,EAAE,MAAM,CAAA;IACV,uEAAuE;IACvE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,4DAA4D;IAC5D,OAAO,EAAE,MAAM,CAAA;IACf,wCAAwC;IACxC,MAAM,EAAE,KAAK,GAAG,SAAS,CAAA;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,iCAAiC;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAA;IACb,4DAA4D;IAC5D,OAAO,EAAE,MAAM,CAAA;CAChB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,CAAA;IAEtD;;;;;;;;OAQG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAAA;IAElD;;;;;;;;OAQG;IACH,OAAO,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACrD"}
|
|
@@ -7,12 +7,8 @@
|
|
|
7
7
|
* Brainy AI system prompt construction and define what Claude knows how to do
|
|
8
8
|
* within a kit's context.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* 1. **VFS** — `/skills/{kitId}/{skillId}.md` in the Brainy VFS. Installed by the
|
|
13
|
-
* user or kit initialization pipeline. Takes priority over bundled skills.
|
|
14
|
-
* 2. **Bundled** — skills shipped with `@soulcraft/kits` as part of the kit manifest.
|
|
15
|
-
* Available without any VFS setup.
|
|
10
|
+
* Skills are stored in the Brainy VFS at `/skills/{kitId}/{skillId}.md`,
|
|
11
|
+
* installed by the kit initialization pipeline or via `sdk.skills.install()`.
|
|
16
12
|
*
|
|
17
13
|
* ## Skill ID convention
|
|
18
14
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/modules/skills/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/modules/skills/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG"}
|
|
@@ -15,8 +15,8 @@ import type { NamespaceProvider } from '../namespace-router.js';
|
|
|
15
15
|
/**
|
|
16
16
|
* Kit loader function for resolving kit details by ID.
|
|
17
17
|
*
|
|
18
|
-
* Products inject their own kit loader
|
|
19
|
-
*
|
|
18
|
+
* Products inject their own kit loader via `createKitsModule()` from the SDK,
|
|
19
|
+
* backed by the Forge Kit Registry at forge.soulcraft.com.
|
|
20
20
|
*/
|
|
21
21
|
export interface KitLoader {
|
|
22
22
|
/** Load a kit definition by ID. Returns `null` if not found. */
|