@douglas-agent/sandbank-skills 0.2.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.
@@ -0,0 +1,4 @@
1
+ export type { SkillSource, SkillRegistry } from './types.js';
2
+ export { createSkillRegistry } from './registry.js';
3
+ export { createLocalSource } from './sources/local.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { createSkillRegistry } from './registry.js';
2
+ export { createLocalSource } from './sources/local.js';
@@ -0,0 +1,3 @@
1
+ import type { SkillRegistry } from './types.js';
2
+ export declare function createSkillRegistry(): SkillRegistry;
3
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,YAAY,CAAA;AAE5D,wBAAgB,mBAAmB,IAAI,aAAa,CAoCnD"}
@@ -0,0 +1,35 @@
1
+ export function createSkillRegistry() {
2
+ const sources = [];
3
+ const registry = {
4
+ addSource(source) {
5
+ sources.push(source);
6
+ },
7
+ async load(name) {
8
+ for (const source of sources) {
9
+ const skill = await source.load(name);
10
+ if (skill)
11
+ return skill;
12
+ }
13
+ return undefined;
14
+ },
15
+ async loadMany(names) {
16
+ const results = [];
17
+ for (const name of names) {
18
+ const skill = await registry.load(name);
19
+ if (skill)
20
+ results.push(skill);
21
+ }
22
+ return results;
23
+ },
24
+ async list() {
25
+ const all = new Set();
26
+ for (const source of sources) {
27
+ const names = await source.list();
28
+ for (const n of names)
29
+ all.add(n);
30
+ }
31
+ return [...all];
32
+ },
33
+ };
34
+ return registry;
35
+ }
@@ -0,0 +1,3 @@
1
+ import type { SkillSource } from '../types.js';
2
+ export declare function createLocalSource(dir: string): SkillSource;
3
+ //# sourceMappingURL=local.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../src/sources/local.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CA4B1D"}
@@ -0,0 +1,31 @@
1
+ import { readFile, readdir } from 'node:fs/promises';
2
+ import { join, basename } from 'node:path';
3
+ export function createLocalSource(dir) {
4
+ return {
5
+ name: 'local',
6
+ async load(name) {
7
+ if (!name || name === '.' || name === '..' || name.includes('/') || name.includes('\\')) {
8
+ return undefined;
9
+ }
10
+ const filePath = join(dir, `${name}.md`);
11
+ try {
12
+ const content = await readFile(filePath, 'utf-8');
13
+ return { name, content };
14
+ }
15
+ catch {
16
+ return undefined;
17
+ }
18
+ },
19
+ async list() {
20
+ try {
21
+ const files = await readdir(dir);
22
+ return files
23
+ .filter(f => f.endsWith('.md'))
24
+ .map(f => basename(f, '.md'));
25
+ }
26
+ catch {
27
+ return [];
28
+ }
29
+ },
30
+ };
31
+ }
@@ -0,0 +1,13 @@
1
+ import type { SkillDefinition } from '@douglas-agent/sandbank-core';
2
+ export interface SkillSource {
3
+ readonly name: string;
4
+ load(name: string): Promise<SkillDefinition | undefined>;
5
+ list(): Promise<string[]>;
6
+ }
7
+ export interface SkillRegistry {
8
+ addSource(source: SkillSource): void;
9
+ load(name: string): Promise<SkillDefinition | undefined>;
10
+ loadMany(names: string[]): Promise<SkillDefinition[]>;
11
+ list(): Promise<string[]>;
12
+ }
13
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAEnE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAAA;IACxD,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;CAC1B;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAA;IACpC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAAA;IACxD,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAAA;IACrD,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;CAC1B"}
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@douglas-agent/sandbank-skills",
3
+ "version": "0.2.0",
4
+ "description": "Skill registry and loading for Sandbank agents",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "homepage": "https://sandbank.dev",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/Xeonice/sandbank-douglas-agent.git",
11
+ "directory": "packages/skills"
12
+ },
13
+ "keywords": [
14
+ "sandbox",
15
+ "ai-agent",
16
+ "skills",
17
+ "registry"
18
+ ],
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "import": "./dist/index.js"
23
+ }
24
+ },
25
+ "files": [
26
+ "dist"
27
+ ],
28
+ "scripts": {
29
+ "build": "tsc",
30
+ "test": "vitest run",
31
+ "typecheck": "tsc --noEmit",
32
+ "clean": "rm -rf dist"
33
+ },
34
+ "dependencies": {
35
+ "@douglas-agent/sandbank-core": "^0.3.6"
36
+ },
37
+ "devDependencies": {
38
+ "@types/node": "^22.15.0",
39
+ "typescript": "^5.7.3",
40
+ "vitest": "^3.0.5"
41
+ }
42
+ }