@vertesia/tools-sdk 0.80.0-dev.20251121 → 0.80.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/README.md +122 -0
- package/lib/cjs/InteractionCollection.js +118 -0
- package/lib/cjs/InteractionCollection.js.map +1 -1
- package/lib/cjs/SkillCollection.js +318 -0
- package/lib/cjs/SkillCollection.js.map +1 -0
- package/lib/cjs/ToolCollection.js +98 -0
- package/lib/cjs/ToolCollection.js.map +1 -1
- package/lib/cjs/copy-assets.js +84 -0
- package/lib/cjs/copy-assets.js.map +1 -0
- package/lib/cjs/index.js +6 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/server.js +327 -0
- package/lib/cjs/server.js.map +1 -0
- package/lib/cjs/site/styles.js +621 -0
- package/lib/cjs/site/styles.js.map +1 -0
- package/lib/cjs/site/templates.js +932 -0
- package/lib/cjs/site/templates.js.map +1 -0
- package/lib/esm/InteractionCollection.js +83 -0
- package/lib/esm/InteractionCollection.js.map +1 -1
- package/lib/esm/SkillCollection.js +311 -0
- package/lib/esm/SkillCollection.js.map +1 -0
- package/lib/esm/ToolCollection.js +64 -0
- package/lib/esm/ToolCollection.js.map +1 -1
- package/lib/esm/copy-assets.js +81 -0
- package/lib/esm/copy-assets.js.map +1 -0
- package/lib/esm/index.js +4 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/server.js +323 -0
- package/lib/esm/server.js.map +1 -0
- package/lib/esm/site/styles.js +618 -0
- package/lib/esm/site/styles.js.map +1 -0
- package/lib/esm/site/templates.js +920 -0
- package/lib/esm/site/templates.js.map +1 -0
- package/lib/types/InteractionCollection.d.ts +29 -0
- package/lib/types/InteractionCollection.d.ts.map +1 -1
- package/lib/types/SkillCollection.d.ts +111 -0
- package/lib/types/SkillCollection.d.ts.map +1 -0
- package/lib/types/ToolCollection.d.ts +18 -0
- package/lib/types/ToolCollection.d.ts.map +1 -1
- package/lib/types/copy-assets.d.ts +14 -0
- package/lib/types/copy-assets.d.ts.map +1 -0
- package/lib/types/index.d.ts +4 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/server.d.ts +72 -0
- package/lib/types/server.d.ts.map +1 -0
- package/lib/types/site/styles.d.ts +5 -0
- package/lib/types/site/styles.d.ts.map +1 -0
- package/lib/types/site/templates.d.ts +54 -0
- package/lib/types/site/templates.d.ts.map +1 -0
- package/lib/types/types.d.ts +152 -0
- package/lib/types/types.d.ts.map +1 -1
- package/package.json +18 -5
- package/src/InteractionCollection.ts +90 -0
- package/src/SkillCollection.ts +389 -0
- package/src/ToolCollection.ts +68 -0
- package/src/copy-assets.ts +104 -0
- package/src/index.ts +4 -0
- package/src/server.ts +444 -0
- package/src/site/styles.ts +617 -0
- package/src/site/templates.ts +956 -0
- package/src/types.ts +162 -0
package/README.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# @vertesia/tools-sdk
|
|
2
|
+
|
|
3
|
+
SDK for building remote tools, interactions, and skills that integrate with the Vertesia platform. Built on top of [Hono](https://hono.dev/) for lightweight, high-performance HTTP servers.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @vertesia/tools-sdk hono
|
|
9
|
+
# or
|
|
10
|
+
pnpm add @vertesia/tools-sdk hono
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { createToolServer, ToolCollection } from "@vertesia/tools-sdk";
|
|
17
|
+
|
|
18
|
+
// Define a tool collection
|
|
19
|
+
const myTools = new ToolCollection({
|
|
20
|
+
name: "my-tools",
|
|
21
|
+
description: "My custom tools",
|
|
22
|
+
tools: [
|
|
23
|
+
{
|
|
24
|
+
name: "hello",
|
|
25
|
+
description: "Says hello",
|
|
26
|
+
parameters: {
|
|
27
|
+
type: "object",
|
|
28
|
+
properties: {
|
|
29
|
+
name: { type: "string", description: "Name to greet" },
|
|
30
|
+
},
|
|
31
|
+
required: ["name"],
|
|
32
|
+
},
|
|
33
|
+
execute: async ({ name }) => {
|
|
34
|
+
return { message: `Hello, ${name}!` };
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Create the server
|
|
41
|
+
const server = createToolServer({
|
|
42
|
+
title: "My Tools Server",
|
|
43
|
+
tools: [myTools],
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export default server;
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Features
|
|
50
|
+
|
|
51
|
+
### Tool Collections
|
|
52
|
+
|
|
53
|
+
Define collections of tools that can be called remotely:
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
import { ToolCollection } from "@vertesia/tools-sdk";
|
|
57
|
+
|
|
58
|
+
const tools = new ToolCollection({
|
|
59
|
+
name: "utilities",
|
|
60
|
+
description: "Utility tools",
|
|
61
|
+
tools: [/* tool definitions */],
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Skill Collections
|
|
66
|
+
|
|
67
|
+
Define skills that can be executed by agents:
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import { SkillCollection } from "@vertesia/tools-sdk";
|
|
71
|
+
|
|
72
|
+
const skills = new SkillCollection({
|
|
73
|
+
name: "my-skills",
|
|
74
|
+
description: "Custom skills",
|
|
75
|
+
skills: [/* skill definitions */],
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Interaction Collections
|
|
80
|
+
|
|
81
|
+
Expose interactions for execution:
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
import { InteractionCollection } from "@vertesia/tools-sdk";
|
|
85
|
+
|
|
86
|
+
const interactions = new InteractionCollection({
|
|
87
|
+
name: "my-interactions",
|
|
88
|
+
interactions: [/* interaction refs */],
|
|
89
|
+
});
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Server Configuration
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
const server = createToolServer({
|
|
96
|
+
title: "My Server", // HTML page title
|
|
97
|
+
prefix: "/api", // API route prefix (default: '/api')
|
|
98
|
+
tools: [toolCollection], // Tool collections
|
|
99
|
+
skills: [skillCollection], // Skill collections
|
|
100
|
+
interactions: [interactionCollection], // Interaction collections
|
|
101
|
+
disableHtml: false, // Disable HTML documentation pages
|
|
102
|
+
});
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Authentication
|
|
106
|
+
|
|
107
|
+
The SDK includes built-in JWT authentication:
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
import { authorize } from "@vertesia/tools-sdk";
|
|
111
|
+
|
|
112
|
+
// In your route handler
|
|
113
|
+
const session = await authorize(request);
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## API Reference
|
|
117
|
+
|
|
118
|
+
For detailed API documentation, visit [docs.vertesiahq.com](https://docs.vertesiahq.com).
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
Apache-2.0
|
|
@@ -1,6 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.InteractionCollection = void 0;
|
|
37
|
+
exports.loadInteractionsFromDirectory = loadInteractionsFromDirectory;
|
|
38
|
+
exports.readPromptFile = readPromptFile;
|
|
39
|
+
const fs_1 = require("fs");
|
|
40
|
+
const path_1 = require("path");
|
|
41
|
+
const url_1 = require("url");
|
|
4
42
|
const utils_js_1 = require("./utils.js");
|
|
5
43
|
class InteractionCollection {
|
|
6
44
|
interactions;
|
|
@@ -43,4 +81,84 @@ class InteractionCollection {
|
|
|
43
81
|
}
|
|
44
82
|
}
|
|
45
83
|
exports.InteractionCollection = InteractionCollection;
|
|
84
|
+
/**
|
|
85
|
+
* Load all interactions from a directory.
|
|
86
|
+
* Scans for subdirectories containing index.ts/index.js files.
|
|
87
|
+
*
|
|
88
|
+
* Directory structure:
|
|
89
|
+
* ```
|
|
90
|
+
* interactions/
|
|
91
|
+
* nagare/
|
|
92
|
+
* extract-fund-actuals/
|
|
93
|
+
* index.ts # exports default InteractionSpec
|
|
94
|
+
* prompt.jst # prompt template (read via readPromptFile helper)
|
|
95
|
+
* parse-fund-document/
|
|
96
|
+
* index.ts
|
|
97
|
+
* prompt.md
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* @param interactionsDir - Path to the interactions collection directory
|
|
101
|
+
* @returns Promise resolving to array of InteractionSpec objects
|
|
102
|
+
*/
|
|
103
|
+
async function loadInteractionsFromDirectory(interactionsDir) {
|
|
104
|
+
const interactions = [];
|
|
105
|
+
if (!(0, fs_1.existsSync)(interactionsDir)) {
|
|
106
|
+
console.warn(`Interactions directory not found: ${interactionsDir}`);
|
|
107
|
+
return interactions;
|
|
108
|
+
}
|
|
109
|
+
let entries;
|
|
110
|
+
try {
|
|
111
|
+
entries = (0, fs_1.readdirSync)(interactionsDir);
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
console.warn(`Could not read interactions directory: ${interactionsDir}`);
|
|
115
|
+
return interactions;
|
|
116
|
+
}
|
|
117
|
+
for (const entry of entries) {
|
|
118
|
+
// Skip hidden files and index files
|
|
119
|
+
if (entry.startsWith('.'))
|
|
120
|
+
continue;
|
|
121
|
+
if (entry === 'index.ts' || entry === 'index.js')
|
|
122
|
+
continue;
|
|
123
|
+
const entryPath = (0, path_1.join)(interactionsDir, entry);
|
|
124
|
+
try {
|
|
125
|
+
const stat = (0, fs_1.statSync)(entryPath);
|
|
126
|
+
if (!stat.isDirectory())
|
|
127
|
+
continue;
|
|
128
|
+
// Look for index.ts or index.js in the subdirectory
|
|
129
|
+
const indexTs = (0, path_1.join)(entryPath, 'index.ts');
|
|
130
|
+
const indexJs = (0, path_1.join)(entryPath, 'index.js');
|
|
131
|
+
const indexPath = (0, fs_1.existsSync)(indexTs) ? indexTs : (0, fs_1.existsSync)(indexJs) ? indexJs : null;
|
|
132
|
+
if (!indexPath) {
|
|
133
|
+
continue; // No index file, skip
|
|
134
|
+
}
|
|
135
|
+
// Dynamic import
|
|
136
|
+
const fileUrl = (0, url_1.pathToFileURL)(indexPath).href;
|
|
137
|
+
const module = await Promise.resolve(`${fileUrl}`).then(s => __importStar(require(s)));
|
|
138
|
+
const interaction = module.default || module.interaction;
|
|
139
|
+
if (interaction && typeof interaction.name === 'string') {
|
|
140
|
+
interactions.push(interaction);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
console.warn(`No valid InteractionSpec export found in ${entry}/index`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
catch (err) {
|
|
147
|
+
console.warn(`Error loading interaction from ${entry}:`, err);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return interactions;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Helper to read a prompt file from the same directory as the interaction.
|
|
154
|
+
* Use this in interaction index.ts files to load prompt templates.
|
|
155
|
+
*
|
|
156
|
+
* @param dirname - Pass __dirname or dirname(fileURLToPath(import.meta.url))
|
|
157
|
+
* @param filename - Prompt filename (e.g., 'prompt.jst' or 'prompt.md')
|
|
158
|
+
* @returns File contents as string
|
|
159
|
+
*/
|
|
160
|
+
function readPromptFile(dirname, filename) {
|
|
161
|
+
const filePath = (0, path_1.join)(dirname, filename);
|
|
162
|
+
return (0, fs_1.readFileSync)(filePath, 'utf-8');
|
|
163
|
+
}
|
|
46
164
|
//# sourceMappingURL=InteractionCollection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InteractionCollection.js","sourceRoot":"","sources":["../../src/InteractionCollection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InteractionCollection.js","sourceRoot":"","sources":["../../src/InteractionCollection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4EA,sEAqDC;AAUD,wCAGC;AA9ID,2BAAqE;AACrE,+BAA4B;AAC5B,6BAAoC;AAGpC,yCAA8C;AAK9C,MAAa,qBAAqB;IAC9B,YAAY,CAAoB;IAChC,IAAI,CAAS;IACb,KAAK,CAAU;IACf,IAAI,CAAU;IACd,WAA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YAEvF,IAAI,CAAC,SAAS,EAAE,CAAC;gBACb,SAAS,CAAC,sBAAsB;YACpC,CAAC;YAED,iBAAiB;YACjB,MAAM,OAAO,GAAG,IAAA,mBAAa,EAAC,SAAS,CAAC,CAAC,IAAI,CAAC;YAC9C,MAAM,MAAM,GAAG,yBAAa,OAAO,uCAAC,CAAC;YAErC,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,WAAW,CAAC;YAEzD,IAAI,WAAW,IAAI,OAAO,WAAW,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACtD,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACnC,CAAC;iBAAM,CAAC;gBACJ,OAAO,CAAC,IAAI,CAAC,4CAA4C,KAAK,QAAQ,CAAC,CAAC;YAC5E,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,OAAO,CAAC,IAAI,CAAC,kCAAkC,KAAK,GAAG,EAAE,GAAG,CAAC,CAAC;QAClE,CAAC;IACL,CAAC;IAED,OAAO,YAAY,CAAC;AACxB,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,cAAc,CAAC,OAAe,EAAE,QAAgB;IAC5D,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACzC,OAAO,IAAA,iBAAY,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SkillCollection = void 0;
|
|
4
|
+
exports.parseSkillFile = parseSkillFile;
|
|
5
|
+
exports.loadSkillFromFile = loadSkillFromFile;
|
|
6
|
+
exports.loadSkillsFromDirectory = loadSkillsFromDirectory;
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const http_exception_1 = require("hono/http-exception");
|
|
10
|
+
const utils_js_1 = require("./utils.js");
|
|
11
|
+
/**
|
|
12
|
+
* Implements a skills collection endpoint.
|
|
13
|
+
* Skills provide contextual instructions to agents.
|
|
14
|
+
* They can be static (markdown) or dynamic (JST templates).
|
|
15
|
+
*/
|
|
16
|
+
class SkillCollection {
|
|
17
|
+
/**
|
|
18
|
+
* A kebab case collection name
|
|
19
|
+
*/
|
|
20
|
+
name;
|
|
21
|
+
/**
|
|
22
|
+
* Optional title for UI display
|
|
23
|
+
*/
|
|
24
|
+
title;
|
|
25
|
+
/**
|
|
26
|
+
* Optional icon for UI display
|
|
27
|
+
*/
|
|
28
|
+
icon;
|
|
29
|
+
/**
|
|
30
|
+
* A short description
|
|
31
|
+
*/
|
|
32
|
+
description;
|
|
33
|
+
/**
|
|
34
|
+
* The skills in this collection
|
|
35
|
+
*/
|
|
36
|
+
skills;
|
|
37
|
+
constructor({ name, title, icon, description, skills }) {
|
|
38
|
+
this.name = name;
|
|
39
|
+
this.title = title || (0, utils_js_1.kebabCaseToTitle)(name);
|
|
40
|
+
this.icon = icon;
|
|
41
|
+
this.description = description;
|
|
42
|
+
this.skills = new Map(skills.map(s => [s.name, s]));
|
|
43
|
+
}
|
|
44
|
+
[Symbol.iterator]() {
|
|
45
|
+
return this.skills.values();
|
|
46
|
+
}
|
|
47
|
+
map(callback) {
|
|
48
|
+
return Array.from(this.skills.values()).map(callback);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get a skill by name
|
|
52
|
+
*/
|
|
53
|
+
getSkill(name) {
|
|
54
|
+
return this.skills.get(name);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Get all skill definitions
|
|
58
|
+
*/
|
|
59
|
+
getSkillDefinitions() {
|
|
60
|
+
return Array.from(this.skills.values());
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Get skills exposed as tool definitions.
|
|
64
|
+
* This allows skills to appear alongside regular tools.
|
|
65
|
+
* When called, they return rendered instructions.
|
|
66
|
+
*/
|
|
67
|
+
getToolDefinitions() {
|
|
68
|
+
const defaultSchema = {
|
|
69
|
+
type: 'object',
|
|
70
|
+
properties: {
|
|
71
|
+
context: {
|
|
72
|
+
type: "string",
|
|
73
|
+
description: "Additional context or specific requirements for this task"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
return Array.from(this.skills.values()).map(skill => ({
|
|
78
|
+
name: `skill_${skill.name}`,
|
|
79
|
+
description: `[Skill] ${skill.description}. Returns contextual instructions for this task.`,
|
|
80
|
+
input_schema: skill.input_schema || defaultSchema
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Get as a tool collection definition (for listing alongside tools)
|
|
85
|
+
*/
|
|
86
|
+
getAsToolCollection(baseUrl) {
|
|
87
|
+
return {
|
|
88
|
+
title: this.title || this.name,
|
|
89
|
+
description: this.description || `Skills: ${this.name}`,
|
|
90
|
+
src: `${baseUrl}/api/skills/${this.name}`,
|
|
91
|
+
tools: this.getToolDefinitions()
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Execute a skill - accepts standard tool execution payload.
|
|
96
|
+
* Returns rendered instructions in tool result format.
|
|
97
|
+
*/
|
|
98
|
+
async execute(ctx) {
|
|
99
|
+
let payload;
|
|
100
|
+
try {
|
|
101
|
+
payload = await ctx.req.json();
|
|
102
|
+
const toolName = payload.tool_use.tool_name;
|
|
103
|
+
// Extract skill name from tool name (remove "skill_" prefix if present)
|
|
104
|
+
const skillName = toolName.startsWith('skill_')
|
|
105
|
+
? toolName.slice(6)
|
|
106
|
+
: toolName;
|
|
107
|
+
const skill = this.skills.get(skillName);
|
|
108
|
+
if (!skill) {
|
|
109
|
+
throw new http_exception_1.HTTPException(404, {
|
|
110
|
+
message: `Skill not found: ${skillName}`
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
const data = payload.tool_use.tool_input || {};
|
|
114
|
+
const result = await this.renderSkill(skill, data);
|
|
115
|
+
// TODO: If skill.execution is set, run via Daytona
|
|
116
|
+
// Return in tool result format
|
|
117
|
+
return ctx.json({
|
|
118
|
+
tool_use_id: payload.tool_use.id,
|
|
119
|
+
is_error: false,
|
|
120
|
+
content: result.instructions,
|
|
121
|
+
meta: {
|
|
122
|
+
skill_name: skill.name,
|
|
123
|
+
content_type: skill.content_type,
|
|
124
|
+
execution: skill.execution,
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
const status = err.status || 500;
|
|
130
|
+
return ctx.json({
|
|
131
|
+
tool_use_id: payload?.tool_use?.id || "unknown",
|
|
132
|
+
is_error: true,
|
|
133
|
+
content: err.message || "Error executing skill",
|
|
134
|
+
}, status);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Render skill instructions (static or dynamic)
|
|
139
|
+
*/
|
|
140
|
+
async renderSkill(skill, _data) {
|
|
141
|
+
const instructions = skill.instructions;
|
|
142
|
+
if (skill.content_type === 'jst') {
|
|
143
|
+
// JST templates are not currently supported
|
|
144
|
+
throw new http_exception_1.HTTPException(501, {
|
|
145
|
+
message: `JST templates are not currently supported. Use 'md' content type instead.`
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
name: skill.name,
|
|
150
|
+
instructions,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
exports.SkillCollection = SkillCollection;
|
|
155
|
+
/**
|
|
156
|
+
* Parse a SKILL.md or SKILL.jst file content into a SkillDefinition.
|
|
157
|
+
*
|
|
158
|
+
* Format:
|
|
159
|
+
* ```
|
|
160
|
+
* ---
|
|
161
|
+
* name: skill-name
|
|
162
|
+
* description: Short description
|
|
163
|
+
* keywords: [keyword1, keyword2]
|
|
164
|
+
* tools: [tool1, tool2]
|
|
165
|
+
* language: python
|
|
166
|
+
* packages: [numpy, pandas]
|
|
167
|
+
* ---
|
|
168
|
+
*
|
|
169
|
+
* # Instructions
|
|
170
|
+
*
|
|
171
|
+
* Your markdown/jst content here...
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
function parseSkillFile(content, contentType) {
|
|
175
|
+
// Parse YAML frontmatter
|
|
176
|
+
const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
177
|
+
if (!frontmatterMatch) {
|
|
178
|
+
throw new Error("Invalid skill file: missing YAML frontmatter");
|
|
179
|
+
}
|
|
180
|
+
const [, yamlContent, body] = frontmatterMatch;
|
|
181
|
+
const frontmatter = parseYamlFrontmatter(yamlContent);
|
|
182
|
+
const instructions = body.trim();
|
|
183
|
+
if (!frontmatter.name) {
|
|
184
|
+
throw new Error("Skill file missing required 'name' field");
|
|
185
|
+
}
|
|
186
|
+
if (!frontmatter.description) {
|
|
187
|
+
throw new Error("Skill file missing required 'description' field");
|
|
188
|
+
}
|
|
189
|
+
const skill = {
|
|
190
|
+
name: frontmatter.name,
|
|
191
|
+
title: frontmatter.title,
|
|
192
|
+
description: frontmatter.description,
|
|
193
|
+
instructions,
|
|
194
|
+
content_type: contentType,
|
|
195
|
+
};
|
|
196
|
+
// Build context triggers
|
|
197
|
+
if (frontmatter.keywords || frontmatter.tools || frontmatter.data_patterns) {
|
|
198
|
+
skill.context_triggers = {
|
|
199
|
+
keywords: frontmatter.keywords,
|
|
200
|
+
tool_names: frontmatter.tools,
|
|
201
|
+
data_patterns: frontmatter.data_patterns,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
// Build execution config
|
|
205
|
+
if (frontmatter.language) {
|
|
206
|
+
skill.execution = {
|
|
207
|
+
language: frontmatter.language,
|
|
208
|
+
packages: frontmatter.packages,
|
|
209
|
+
system_packages: frontmatter.system_packages,
|
|
210
|
+
};
|
|
211
|
+
// Extract code template from instructions if present
|
|
212
|
+
const codeBlockMatch = instructions.match(/```(?:python|javascript|typescript|js|ts|py)\n([\s\S]*?)```/);
|
|
213
|
+
if (codeBlockMatch) {
|
|
214
|
+
skill.execution.template = codeBlockMatch[1].trim();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
// Related tools from frontmatter
|
|
218
|
+
if (frontmatter.tools) {
|
|
219
|
+
skill.related_tools = frontmatter.tools;
|
|
220
|
+
}
|
|
221
|
+
return skill;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Simple YAML frontmatter parser (handles basic key: value and arrays)
|
|
225
|
+
*/
|
|
226
|
+
function parseYamlFrontmatter(yaml) {
|
|
227
|
+
const result = {};
|
|
228
|
+
const lines = yaml.split('\n');
|
|
229
|
+
for (const line of lines) {
|
|
230
|
+
const trimmed = line.trim();
|
|
231
|
+
if (!trimmed || trimmed.startsWith('#'))
|
|
232
|
+
continue;
|
|
233
|
+
const colonIndex = trimmed.indexOf(':');
|
|
234
|
+
if (colonIndex === -1)
|
|
235
|
+
continue;
|
|
236
|
+
const key = trimmed.slice(0, colonIndex).trim();
|
|
237
|
+
let value = trimmed.slice(colonIndex + 1).trim();
|
|
238
|
+
// Handle array syntax: [item1, item2]
|
|
239
|
+
if (value.startsWith('[') && value.endsWith(']')) {
|
|
240
|
+
const items = value.slice(1, -1).split(',').map(s => s.trim());
|
|
241
|
+
result[key] = items.filter(s => s.length > 0);
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
// Remove quotes if present
|
|
245
|
+
if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
246
|
+
(value.startsWith("'") && value.endsWith("'"))) {
|
|
247
|
+
value = value.slice(1, -1);
|
|
248
|
+
}
|
|
249
|
+
result[key] = value;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return result;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Helper to load skill from file path (for Node.js usage)
|
|
256
|
+
*/
|
|
257
|
+
async function loadSkillFromFile(filePath, fs) {
|
|
258
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
259
|
+
const contentType = filePath.endsWith('.jst') ? 'jst' : 'md';
|
|
260
|
+
return parseSkillFile(content, contentType);
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Load all skills from a directory.
|
|
264
|
+
* Scans for subdirectories containing SKILL.md files.
|
|
265
|
+
*
|
|
266
|
+
* Directory structure:
|
|
267
|
+
* ```
|
|
268
|
+
* skills/
|
|
269
|
+
* nagare/
|
|
270
|
+
* fund-onboarding/
|
|
271
|
+
* SKILL.md
|
|
272
|
+
* monte-carlo/
|
|
273
|
+
* SKILL.md
|
|
274
|
+
* ```
|
|
275
|
+
*
|
|
276
|
+
* @param dirPath - Path to the skills collection directory
|
|
277
|
+
* @returns Array of parsed skill definitions
|
|
278
|
+
*/
|
|
279
|
+
function loadSkillsFromDirectory(dirPath) {
|
|
280
|
+
const skills = [];
|
|
281
|
+
let entries;
|
|
282
|
+
try {
|
|
283
|
+
entries = (0, fs_1.readdirSync)(dirPath);
|
|
284
|
+
}
|
|
285
|
+
catch {
|
|
286
|
+
console.warn(`Could not read skills directory: ${dirPath}`);
|
|
287
|
+
return skills;
|
|
288
|
+
}
|
|
289
|
+
for (const entry of entries) {
|
|
290
|
+
const entryPath = (0, path_1.join)(dirPath, entry);
|
|
291
|
+
try {
|
|
292
|
+
const stat = (0, fs_1.statSync)(entryPath);
|
|
293
|
+
if (!stat.isDirectory())
|
|
294
|
+
continue;
|
|
295
|
+
// Look for SKILL.md or SKILL.jst
|
|
296
|
+
const mdPath = (0, path_1.join)(entryPath, "SKILL.md");
|
|
297
|
+
const jstPath = (0, path_1.join)(entryPath, "SKILL.jst");
|
|
298
|
+
let content;
|
|
299
|
+
let contentType = 'md';
|
|
300
|
+
if ((0, fs_1.existsSync)(mdPath)) {
|
|
301
|
+
content = (0, fs_1.readFileSync)(mdPath, "utf-8");
|
|
302
|
+
contentType = 'md';
|
|
303
|
+
}
|
|
304
|
+
else if ((0, fs_1.existsSync)(jstPath)) {
|
|
305
|
+
content = (0, fs_1.readFileSync)(jstPath, "utf-8");
|
|
306
|
+
contentType = 'jst';
|
|
307
|
+
}
|
|
308
|
+
if (content) {
|
|
309
|
+
skills.push(parseSkillFile(content, contentType));
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
catch (err) {
|
|
313
|
+
console.warn(`Error loading skill from ${entryPath}:`, err);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return skills;
|
|
317
|
+
}
|
|
318
|
+
//# sourceMappingURL=SkillCollection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SkillCollection.js","sourceRoot":"","sources":["../../src/SkillCollection.ts"],"names":[],"mappings":";;;AA6NA,wCA4DC;AAuCD,8CAOC;AAmBD,0DA0CC;AApYD,2BAAqE;AACrE,+BAA4B;AAG5B,wDAAoD;AAWpD,yCAA8C;AAS9C;;;;GAIG;AACH,MAAa,eAAe;IACxB;;OAEG;IACH,IAAI,CAAS;IACb;;OAEG;IACH,KAAK,CAAU;IACf;;OAEG;IACH,IAAI,CAAU;IACd;;OAEG;IACH,WAAW,CAAU;IACrB;;OAEG;IACK,MAAM,CAA+B;IAE7C,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAA6B;QAC7E,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,IAAA,2BAAgB,EAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC;QACb,OAAO,IAAI,CAAC,MAAM,CAA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