@framers/agentos 0.1.28 → 0.1.30
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/cognitive_substrate/GMIManager.d.ts.map +1 -1
- package/dist/cognitive_substrate/GMIManager.js +0 -2
- package/dist/cognitive_substrate/GMIManager.js.map +1 -1
- package/dist/core/tools/IToolOrchestrator.d.ts +17 -0
- package/dist/core/tools/IToolOrchestrator.d.ts.map +1 -1
- package/dist/core/tools/ToolOrchestrator.d.ts +13 -0
- package/dist/core/tools/ToolOrchestrator.d.ts.map +1 -1
- package/dist/core/tools/ToolOrchestrator.js +28 -0
- package/dist/core/tools/ToolOrchestrator.js.map +1 -1
- package/dist/discovery/CapabilityContextAssembler.d.ts +54 -0
- package/dist/discovery/CapabilityContextAssembler.d.ts.map +1 -0
- package/dist/discovery/CapabilityContextAssembler.js +192 -0
- package/dist/discovery/CapabilityContextAssembler.js.map +1 -0
- package/dist/discovery/CapabilityDiscoveryEngine.d.ts +76 -0
- package/dist/discovery/CapabilityDiscoveryEngine.d.ts.map +1 -0
- package/dist/discovery/CapabilityDiscoveryEngine.js +197 -0
- package/dist/discovery/CapabilityDiscoveryEngine.js.map +1 -0
- package/dist/discovery/CapabilityEmbeddingStrategy.d.ts +45 -0
- package/dist/discovery/CapabilityEmbeddingStrategy.d.ts.map +1 -0
- package/dist/discovery/CapabilityEmbeddingStrategy.js +167 -0
- package/dist/discovery/CapabilityEmbeddingStrategy.js.map +1 -0
- package/dist/discovery/CapabilityGraph.d.ts +78 -0
- package/dist/discovery/CapabilityGraph.d.ts.map +1 -0
- package/dist/discovery/CapabilityGraph.js +263 -0
- package/dist/discovery/CapabilityGraph.js.map +1 -0
- package/dist/discovery/CapabilityIndex.d.ts +93 -0
- package/dist/discovery/CapabilityIndex.d.ts.map +1 -0
- package/dist/discovery/CapabilityIndex.js +324 -0
- package/dist/discovery/CapabilityIndex.js.map +1 -0
- package/dist/discovery/CapabilityManifestScanner.d.ts +66 -0
- package/dist/discovery/CapabilityManifestScanner.d.ts.map +1 -0
- package/dist/discovery/CapabilityManifestScanner.js +315 -0
- package/dist/discovery/CapabilityManifestScanner.js.map +1 -0
- package/dist/discovery/DiscoverCapabilitiesTool.d.ts +44 -0
- package/dist/discovery/DiscoverCapabilitiesTool.d.ts.map +1 -0
- package/dist/discovery/DiscoverCapabilitiesTool.js +118 -0
- package/dist/discovery/DiscoverCapabilitiesTool.js.map +1 -0
- package/dist/discovery/index.d.ts +39 -0
- package/dist/discovery/index.d.ts.map +1 -0
- package/dist/discovery/index.js +41 -0
- package/dist/discovery/index.js.map +1 -0
- package/dist/discovery/types.d.ts +357 -0
- package/dist/discovery/types.d.ts.map +1 -0
- package/dist/discovery/types.js +46 -0
- package/dist/discovery/types.js.map +1 -0
- package/package.json +6 -1
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Capability Manifest Scanner — file-based discovery.
|
|
3
|
+
* @module @framers/agentos/discovery/CapabilityManifestScanner
|
|
4
|
+
*
|
|
5
|
+
* Scans directories for CAPABILITY.yaml manifest files and optional
|
|
6
|
+
* SKILL.md companions. Supports hot-reload via fs.watch with debouncing.
|
|
7
|
+
*
|
|
8
|
+
* Directory conventions:
|
|
9
|
+
* ~/.wunderland/capabilities/ (user-global)
|
|
10
|
+
* ./.wunderland/capabilities/ (workspace-local)
|
|
11
|
+
* $WUNDERLAND_CAPABILITY_DIRS (env var, colon-separated)
|
|
12
|
+
*
|
|
13
|
+
* CAPABILITY.yaml format:
|
|
14
|
+
* id: custom:my-tool
|
|
15
|
+
* kind: tool
|
|
16
|
+
* name: my-tool
|
|
17
|
+
* displayName: My Custom Tool
|
|
18
|
+
* description: Does something useful
|
|
19
|
+
* category: information
|
|
20
|
+
* tags: [search, api]
|
|
21
|
+
* requiredSecrets: [MY_API_KEY]
|
|
22
|
+
* inputSchema: { type: object, properties: { query: { type: string } } }
|
|
23
|
+
* skillContent: ./SKILL.md # optional relative path
|
|
24
|
+
*
|
|
25
|
+
* Extends the existing workspace-discovery.ts pattern from agentos-skills-registry.
|
|
26
|
+
*/
|
|
27
|
+
import * as fs from 'node:fs';
|
|
28
|
+
import * as path from 'node:path';
|
|
29
|
+
import * as os from 'node:os';
|
|
30
|
+
// ============================================================================
|
|
31
|
+
// YAML FRONTMATTER PARSER (lightweight, no external dependency)
|
|
32
|
+
// ============================================================================
|
|
33
|
+
/**
|
|
34
|
+
* Parse a simple YAML document into a plain object.
|
|
35
|
+
* Handles basic scalar values, arrays, and nested objects.
|
|
36
|
+
* Not a full YAML parser — sufficient for CAPABILITY.yaml manifests.
|
|
37
|
+
*/
|
|
38
|
+
function parseSimpleYaml(content) {
|
|
39
|
+
const result = {};
|
|
40
|
+
const lines = content.split('\n');
|
|
41
|
+
let currentKey = '';
|
|
42
|
+
let inArray = false;
|
|
43
|
+
let arrayItems = [];
|
|
44
|
+
for (const rawLine of lines) {
|
|
45
|
+
const line = rawLine.replace(/\r$/, '');
|
|
46
|
+
// Skip empty lines and comments
|
|
47
|
+
if (!line.trim() || line.trim().startsWith('#'))
|
|
48
|
+
continue;
|
|
49
|
+
// Array item (indented with -)
|
|
50
|
+
if (inArray && /^\s+-\s*/.test(line)) {
|
|
51
|
+
const value = line.replace(/^\s+-\s*/, '').trim();
|
|
52
|
+
arrayItems.push(parseScalar(value));
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
// If we were in an array, flush it
|
|
56
|
+
if (inArray) {
|
|
57
|
+
result[currentKey] = arrayItems;
|
|
58
|
+
inArray = false;
|
|
59
|
+
arrayItems = [];
|
|
60
|
+
}
|
|
61
|
+
// Key-value pair
|
|
62
|
+
const kvMatch = line.match(/^(\w[\w.]*)\s*:\s*(.*)/);
|
|
63
|
+
if (kvMatch) {
|
|
64
|
+
const [, key, rawValue] = kvMatch;
|
|
65
|
+
const value = rawValue.trim();
|
|
66
|
+
if (!value) {
|
|
67
|
+
// Could be start of array or nested object
|
|
68
|
+
currentKey = key;
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
// Inline array: [item1, item2, item3]
|
|
72
|
+
if (value.startsWith('[') && value.endsWith(']')) {
|
|
73
|
+
const inner = value.slice(1, -1);
|
|
74
|
+
result[key] = inner
|
|
75
|
+
.split(',')
|
|
76
|
+
.map((s) => parseScalar(s.trim()))
|
|
77
|
+
.filter((s) => s !== '');
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
// Inline object: { key: value }
|
|
81
|
+
if (value.startsWith('{') && value.endsWith('}')) {
|
|
82
|
+
try {
|
|
83
|
+
result[key] = JSON.parse(value);
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
result[key] = value;
|
|
87
|
+
}
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
result[key] = parseScalar(value);
|
|
91
|
+
currentKey = key;
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
// Check if this starts an array
|
|
95
|
+
if (/^\s+-\s*/.test(line) && currentKey) {
|
|
96
|
+
inArray = true;
|
|
97
|
+
const value = line.replace(/^\s+-\s*/, '').trim();
|
|
98
|
+
arrayItems.push(parseScalar(value));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// Flush any remaining array
|
|
102
|
+
if (inArray && currentKey) {
|
|
103
|
+
result[currentKey] = arrayItems;
|
|
104
|
+
}
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Parse a YAML scalar value to its JS type.
|
|
109
|
+
*/
|
|
110
|
+
function parseScalar(value) {
|
|
111
|
+
if (value === 'true')
|
|
112
|
+
return true;
|
|
113
|
+
if (value === 'false')
|
|
114
|
+
return false;
|
|
115
|
+
if (value === 'null' || value === '~')
|
|
116
|
+
return '';
|
|
117
|
+
if (/^-?\d+$/.test(value))
|
|
118
|
+
return parseInt(value, 10);
|
|
119
|
+
if (/^-?\d+\.\d+$/.test(value))
|
|
120
|
+
return parseFloat(value);
|
|
121
|
+
// Remove surrounding quotes
|
|
122
|
+
if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
123
|
+
(value.startsWith("'") && value.endsWith("'"))) {
|
|
124
|
+
return value.slice(1, -1);
|
|
125
|
+
}
|
|
126
|
+
return value;
|
|
127
|
+
}
|
|
128
|
+
// ============================================================================
|
|
129
|
+
// MANIFEST SCANNER
|
|
130
|
+
// ============================================================================
|
|
131
|
+
export class CapabilityManifestScanner {
|
|
132
|
+
constructor() {
|
|
133
|
+
this.watchers = [];
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Get default scan directories.
|
|
137
|
+
*
|
|
138
|
+
* 1. ~/.wunderland/capabilities/ (user-global)
|
|
139
|
+
* 2. ./.wunderland/capabilities/ (workspace-local, relative to cwd)
|
|
140
|
+
* 3. $WUNDERLAND_CAPABILITY_DIRS (env var, colon-separated)
|
|
141
|
+
*/
|
|
142
|
+
getDefaultDirs() {
|
|
143
|
+
const dirs = [];
|
|
144
|
+
// User-global
|
|
145
|
+
const homeDir = os.homedir();
|
|
146
|
+
dirs.push(path.join(homeDir, '.wunderland', 'capabilities'));
|
|
147
|
+
// Workspace-local
|
|
148
|
+
dirs.push(path.join(process.cwd(), '.wunderland', 'capabilities'));
|
|
149
|
+
// Env var
|
|
150
|
+
const envDirs = process.env.WUNDERLAND_CAPABILITY_DIRS;
|
|
151
|
+
if (envDirs) {
|
|
152
|
+
dirs.push(...envDirs.split(':').filter(Boolean));
|
|
153
|
+
}
|
|
154
|
+
return dirs;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Scan directories for CAPABILITY.yaml files.
|
|
158
|
+
* Each subdirectory should contain a CAPABILITY.yaml and optional SKILL.md.
|
|
159
|
+
*
|
|
160
|
+
* Structure:
|
|
161
|
+
* <dir>/
|
|
162
|
+
* my-custom-tool/
|
|
163
|
+
* CAPABILITY.yaml
|
|
164
|
+
* SKILL.md (optional)
|
|
165
|
+
* schema.json (optional)
|
|
166
|
+
*/
|
|
167
|
+
async scan(dirs) {
|
|
168
|
+
const scanDirs = dirs ?? this.getDefaultDirs();
|
|
169
|
+
const descriptors = [];
|
|
170
|
+
for (const dir of scanDirs) {
|
|
171
|
+
if (!fs.existsSync(dir))
|
|
172
|
+
continue;
|
|
173
|
+
let entries;
|
|
174
|
+
try {
|
|
175
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
for (const entry of entries) {
|
|
181
|
+
if (!entry.isDirectory())
|
|
182
|
+
continue;
|
|
183
|
+
const capDir = path.join(dir, entry.name);
|
|
184
|
+
const yamlPath = path.join(capDir, 'CAPABILITY.yaml');
|
|
185
|
+
const ymlPath = path.join(capDir, 'CAPABILITY.yml');
|
|
186
|
+
const manifestPath = fs.existsSync(yamlPath)
|
|
187
|
+
? yamlPath
|
|
188
|
+
: fs.existsSync(ymlPath)
|
|
189
|
+
? ymlPath
|
|
190
|
+
: null;
|
|
191
|
+
if (!manifestPath)
|
|
192
|
+
continue;
|
|
193
|
+
try {
|
|
194
|
+
const descriptor = await this.parseManifest(manifestPath, capDir);
|
|
195
|
+
if (descriptor) {
|
|
196
|
+
descriptors.push(descriptor);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
catch (err) {
|
|
200
|
+
console.warn(`[CapabilityManifestScanner] Failed to parse ${manifestPath}: ${err}`);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return descriptors;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Parse a single CAPABILITY.yaml file into a CapabilityDescriptor.
|
|
208
|
+
*/
|
|
209
|
+
async parseManifest(yamlPath, capDir) {
|
|
210
|
+
const content = fs.readFileSync(yamlPath, 'utf-8');
|
|
211
|
+
const parsed = parseSimpleYaml(content);
|
|
212
|
+
// Validate required fields
|
|
213
|
+
if (!parsed.name || !parsed.kind || !parsed.description) {
|
|
214
|
+
console.warn(`[CapabilityManifestScanner] Missing required fields in ${yamlPath}`);
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
// Load optional SKILL.md content
|
|
218
|
+
let fullContent;
|
|
219
|
+
if (parsed.skillContent) {
|
|
220
|
+
const skillPath = path.resolve(capDir, parsed.skillContent);
|
|
221
|
+
if (fs.existsSync(skillPath)) {
|
|
222
|
+
fullContent = fs.readFileSync(skillPath, 'utf-8');
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
// Check for default SKILL.md in same directory
|
|
227
|
+
const defaultSkillPath = path.join(capDir, 'SKILL.md');
|
|
228
|
+
if (fs.existsSync(defaultSkillPath)) {
|
|
229
|
+
fullContent = fs.readFileSync(defaultSkillPath, 'utf-8');
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
// Load optional schema.json
|
|
233
|
+
let fullSchema;
|
|
234
|
+
if (parsed.inputSchema) {
|
|
235
|
+
fullSchema = parsed.inputSchema;
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
const schemaPath = path.join(capDir, 'schema.json');
|
|
239
|
+
if (fs.existsSync(schemaPath)) {
|
|
240
|
+
try {
|
|
241
|
+
fullSchema = JSON.parse(fs.readFileSync(schemaPath, 'utf-8'));
|
|
242
|
+
}
|
|
243
|
+
catch {
|
|
244
|
+
// Ignore invalid schema files
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
const kind = parsed.kind;
|
|
249
|
+
const name = parsed.name;
|
|
250
|
+
const id = parsed.id ?? `${kind}:${name}`;
|
|
251
|
+
return {
|
|
252
|
+
id,
|
|
253
|
+
kind,
|
|
254
|
+
name,
|
|
255
|
+
displayName: parsed.displayName ?? name,
|
|
256
|
+
description: parsed.description,
|
|
257
|
+
category: parsed.category ?? 'custom',
|
|
258
|
+
tags: parsed.tags ?? [],
|
|
259
|
+
requiredSecrets: parsed.requiredSecrets ?? [],
|
|
260
|
+
requiredTools: parsed.requiredTools ?? [],
|
|
261
|
+
available: true,
|
|
262
|
+
hasSideEffects: parsed.hasSideEffects,
|
|
263
|
+
fullSchema,
|
|
264
|
+
fullContent,
|
|
265
|
+
sourceRef: {
|
|
266
|
+
type: 'manifest',
|
|
267
|
+
manifestPath: yamlPath,
|
|
268
|
+
entryId: id,
|
|
269
|
+
},
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Watch directories for changes and call the callback when capabilities
|
|
274
|
+
* are added, modified, or removed.
|
|
275
|
+
*
|
|
276
|
+
* Uses debouncing to prevent rapid-fire events from fs.watch.
|
|
277
|
+
*/
|
|
278
|
+
watch(dirs, onChange, debounceMs = 500) {
|
|
279
|
+
let debounceTimer = null;
|
|
280
|
+
const handleChange = () => {
|
|
281
|
+
if (debounceTimer)
|
|
282
|
+
clearTimeout(debounceTimer);
|
|
283
|
+
debounceTimer = setTimeout(async () => {
|
|
284
|
+
try {
|
|
285
|
+
const descriptors = await this.scan(dirs);
|
|
286
|
+
onChange(descriptors);
|
|
287
|
+
}
|
|
288
|
+
catch (err) {
|
|
289
|
+
console.warn(`[CapabilityManifestScanner] Watch error: ${err}`);
|
|
290
|
+
}
|
|
291
|
+
}, debounceMs);
|
|
292
|
+
};
|
|
293
|
+
for (const dir of dirs) {
|
|
294
|
+
if (!fs.existsSync(dir))
|
|
295
|
+
continue;
|
|
296
|
+
try {
|
|
297
|
+
const watcher = fs.watch(dir, { recursive: true }, handleChange);
|
|
298
|
+
this.watchers.push(watcher);
|
|
299
|
+
}
|
|
300
|
+
catch {
|
|
301
|
+
// fs.watch may not support recursive on all platforms
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Stop watching all directories.
|
|
307
|
+
*/
|
|
308
|
+
stopWatching() {
|
|
309
|
+
for (const watcher of this.watchers) {
|
|
310
|
+
watcher.close();
|
|
311
|
+
}
|
|
312
|
+
this.watchers = [];
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
//# sourceMappingURL=CapabilityManifestScanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CapabilityManifestScanner.js","sourceRoot":"","sources":["../../src/discovery/CapabilityManifestScanner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAQ9B,+EAA+E;AAC/E,gEAAgE;AAChE,+EAA+E;AAE/E;;;;GAIG;AACH,SAAS,eAAe,CAAC,OAAe;IACtC,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,UAAU,GAAG,EAAE,CAAC;IACpB,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI,UAAU,GAAc,EAAE,CAAC;IAE/B,KAAK,MAAM,OAAO,IAAI,KAAK,EAAE,CAAC;QAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAExC,gCAAgC;QAChC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAS;QAE1D,+BAA+B;QAC/B,IAAI,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACrC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;YAClD,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;YACpC,SAAS;QACX,CAAC;QAED,mCAAmC;QACnC,IAAI,OAAO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IAAI,CAAC,IAAI,CAAC,CAAC;oBAC1C,QAAQ,CAAC,WAAW,CAAC,CAAC;gBACxB,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,OAAO,CAAC,IAAI,CAAC,4CAA4C,GAAG,EAAE,CAAC,CAAC;gBAClE,CAAC;YACH,CAAC,EAAE,UAAU,CAAC,CAAC;QACjB,CAAC,CAAC;QAEF,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC;gBAAE,SAAS;YAElC,IAAI,CAAC;gBACH,MAAM,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,YAAY,CAAC,CAAC;gBACjE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC9B,CAAC;YAAC,MAAM,CAAC;gBACP,sDAAsD;YACxD,CAAC;QACH,CAAC;IACH,CAAC;IAED;;OAEG;IACH,YAAY;QACV,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACpC,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,CAAC;QACD,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview discover_capabilities meta-tool.
|
|
3
|
+
* @module @framers/agentos/discovery/DiscoverCapabilitiesTool
|
|
4
|
+
*
|
|
5
|
+
* A built-in ITool that agents can call to search for available capabilities.
|
|
6
|
+
* This is the "agentic" part of the discovery loop — the agent actively
|
|
7
|
+
* participates in finding capabilities rather than passively receiving
|
|
8
|
+
* a static tool list.
|
|
9
|
+
*
|
|
10
|
+
* The tool costs ~80 tokens in the tool list, returning semantically
|
|
11
|
+
* matched capabilities with relevance scores.
|
|
12
|
+
*
|
|
13
|
+
* Usage by the agent:
|
|
14
|
+
* discover_capabilities({ query: "search the web", kind: "tool" })
|
|
15
|
+
* → [{ id: "tool:web-search", name: "Web Search", relevance: 0.87, ... }]
|
|
16
|
+
*/
|
|
17
|
+
import type { ITool } from '../core/tools/ITool.js';
|
|
18
|
+
import type { ICapabilityDiscoveryEngine } from './types.js';
|
|
19
|
+
interface DiscoverCapabilitiesInput {
|
|
20
|
+
query: string;
|
|
21
|
+
kind?: 'tool' | 'skill' | 'extension' | 'channel' | 'any';
|
|
22
|
+
category?: string;
|
|
23
|
+
}
|
|
24
|
+
interface DiscoverCapabilitiesOutput {
|
|
25
|
+
capabilities: Array<{
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
kind: string;
|
|
29
|
+
description: string;
|
|
30
|
+
category: string;
|
|
31
|
+
relevance: number;
|
|
32
|
+
available: boolean;
|
|
33
|
+
}>;
|
|
34
|
+
totalIndexed: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Create the discover_capabilities meta-tool.
|
|
38
|
+
*
|
|
39
|
+
* @param discoveryEngine - The initialized CapabilityDiscoveryEngine
|
|
40
|
+
* @returns An ITool instance ready for registration with ToolOrchestrator
|
|
41
|
+
*/
|
|
42
|
+
export declare function createDiscoverCapabilitiesTool(discoveryEngine: ICapabilityDiscoveryEngine): ITool<DiscoverCapabilitiesInput, DiscoverCapabilitiesOutput>;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=DiscoverCapabilitiesTool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DiscoverCapabilitiesTool.d.ts","sourceRoot":"","sources":["../../src/discovery/DiscoverCapabilitiesTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,KAAK,EAA+D,MAAM,wBAAwB,CAAC;AACjH,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAqD7D,UAAU,yBAAyB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,WAAW,GAAG,SAAS,GAAG,KAAK,CAAC;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,0BAA0B;IAClC,YAAY,EAAE,KAAK,CAAC;QAClB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,OAAO,CAAC;KACpB,CAAC,CAAC;IACH,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC5C,eAAe,EAAE,0BAA0B,GAC1C,KAAK,CAAC,yBAAyB,EAAE,0BAA0B,CAAC,CAyD9D"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview discover_capabilities meta-tool.
|
|
3
|
+
* @module @framers/agentos/discovery/DiscoverCapabilitiesTool
|
|
4
|
+
*
|
|
5
|
+
* A built-in ITool that agents can call to search for available capabilities.
|
|
6
|
+
* This is the "agentic" part of the discovery loop — the agent actively
|
|
7
|
+
* participates in finding capabilities rather than passively receiving
|
|
8
|
+
* a static tool list.
|
|
9
|
+
*
|
|
10
|
+
* The tool costs ~80 tokens in the tool list, returning semantically
|
|
11
|
+
* matched capabilities with relevance scores.
|
|
12
|
+
*
|
|
13
|
+
* Usage by the agent:
|
|
14
|
+
* discover_capabilities({ query: "search the web", kind: "tool" })
|
|
15
|
+
* → [{ id: "tool:web-search", name: "Web Search", relevance: 0.87, ... }]
|
|
16
|
+
*/
|
|
17
|
+
// ============================================================================
|
|
18
|
+
// TOOL DEFINITION
|
|
19
|
+
// ============================================================================
|
|
20
|
+
const INPUT_SCHEMA = {
|
|
21
|
+
type: 'object',
|
|
22
|
+
properties: {
|
|
23
|
+
query: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
description: 'Natural language description of the capability you need (e.g., "search the web", "send a Discord message", "summarize a document")',
|
|
26
|
+
},
|
|
27
|
+
kind: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
enum: ['tool', 'skill', 'extension', 'channel', 'any'],
|
|
30
|
+
description: 'Filter by capability type. Use "any" to search all types.',
|
|
31
|
+
default: 'any',
|
|
32
|
+
},
|
|
33
|
+
category: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
description: 'Filter by category (e.g., "information", "communication", "developer-tools")',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
required: ['query'],
|
|
39
|
+
};
|
|
40
|
+
const OUTPUT_SCHEMA = {
|
|
41
|
+
type: 'object',
|
|
42
|
+
properties: {
|
|
43
|
+
capabilities: {
|
|
44
|
+
type: 'array',
|
|
45
|
+
items: {
|
|
46
|
+
type: 'object',
|
|
47
|
+
properties: {
|
|
48
|
+
id: { type: 'string' },
|
|
49
|
+
name: { type: 'string' },
|
|
50
|
+
kind: { type: 'string' },
|
|
51
|
+
description: { type: 'string' },
|
|
52
|
+
category: { type: 'string' },
|
|
53
|
+
relevance: { type: 'number' },
|
|
54
|
+
available: { type: 'boolean' },
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
totalIndexed: { type: 'number' },
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Create the discover_capabilities meta-tool.
|
|
63
|
+
*
|
|
64
|
+
* @param discoveryEngine - The initialized CapabilityDiscoveryEngine
|
|
65
|
+
* @returns An ITool instance ready for registration with ToolOrchestrator
|
|
66
|
+
*/
|
|
67
|
+
export function createDiscoverCapabilitiesTool(discoveryEngine) {
|
|
68
|
+
return {
|
|
69
|
+
id: 'agentos-discover-capabilities',
|
|
70
|
+
name: 'discover_capabilities',
|
|
71
|
+
displayName: 'Discover Capabilities',
|
|
72
|
+
description: 'Search for available tools, skills, extensions, and channels by describing what you need. ' +
|
|
73
|
+
'Use when you need a capability not already visible in your context. ' +
|
|
74
|
+
'Returns matched capabilities with relevance scores.',
|
|
75
|
+
inputSchema: INPUT_SCHEMA,
|
|
76
|
+
outputSchema: OUTPUT_SCHEMA,
|
|
77
|
+
category: 'meta',
|
|
78
|
+
hasSideEffects: false,
|
|
79
|
+
async execute(args, _context) {
|
|
80
|
+
if (!discoveryEngine.isInitialized()) {
|
|
81
|
+
return {
|
|
82
|
+
success: false,
|
|
83
|
+
error: 'Capability discovery engine is not initialized.',
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
const result = await discoveryEngine.discover(args.query, {
|
|
88
|
+
kind: args.kind ?? 'any',
|
|
89
|
+
category: args.category,
|
|
90
|
+
onlyAvailable: false,
|
|
91
|
+
});
|
|
92
|
+
const capabilities = result.tier1.map((r) => ({
|
|
93
|
+
id: r.capability.id,
|
|
94
|
+
name: r.capability.displayName,
|
|
95
|
+
kind: r.capability.kind,
|
|
96
|
+
description: r.capability.description,
|
|
97
|
+
category: r.capability.category,
|
|
98
|
+
relevance: Math.round(r.relevanceScore * 100) / 100,
|
|
99
|
+
available: r.capability.available,
|
|
100
|
+
}));
|
|
101
|
+
return {
|
|
102
|
+
success: true,
|
|
103
|
+
output: {
|
|
104
|
+
capabilities,
|
|
105
|
+
totalIndexed: discoveryEngine.listCapabilityIds().length,
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
return {
|
|
111
|
+
success: false,
|
|
112
|
+
error: `Discovery search failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=DiscoverCapabilitiesTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DiscoverCapabilitiesTool.js","sourceR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,IAAI;oBACb,MAAM,EAAE;wBACN,YAAY;wBACZ,YAAY,EAAE,eAAe,CAAC,iBAAiB,EAAE,CAAC,MAAM;qBACzD;iBACF,CAAC;YACJ,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,4BAA4B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;iBACtF,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Capability Discovery Engine — barrel exports.
|
|
3
|
+
* @module @framers/agentos/discovery
|
|
4
|
+
*
|
|
5
|
+
* Smart, tiered capability discovery for AgentOS agents.
|
|
6
|
+
* Reduces capability context by ~90% (from ~20,000 to ~1,850 tokens)
|
|
7
|
+
* while improving discovery accuracy through semantic search + graph re-ranking.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import {
|
|
12
|
+
* CapabilityDiscoveryEngine,
|
|
13
|
+
* CapabilityManifestScanner,
|
|
14
|
+
* createDiscoverCapabilitiesTool,
|
|
15
|
+
* } from '../discovery';
|
|
16
|
+
*
|
|
17
|
+
* // Initialize
|
|
18
|
+
* const engine = new CapabilityDiscoveryEngine(embeddingManager, vectorStore);
|
|
19
|
+
* await engine.initialize({ tools, skills, extensions, channels });
|
|
20
|
+
*
|
|
21
|
+
* // Per-turn discovery
|
|
22
|
+
* const result = await engine.discover("search the web for AI news");
|
|
23
|
+
* const contextText = engine.renderForPrompt(result);
|
|
24
|
+
*
|
|
25
|
+
* // Register meta-tool for agent self-discovery
|
|
26
|
+
* const metaTool = createDiscoverCapabilitiesTool(engine);
|
|
27
|
+
* toolOrchestrator.registerTool(metaTool);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export type { CapabilityKind, CapabilitySourceRef, CapabilityDescriptor, CapabilityTier, Tier1Result, Tier2Result, TokenEstimate, DiscoveryDiagnostics, CapabilityDiscoveryResult, CapabilityDiscoveryConfig, CapabilityEdgeType, CapabilityEdge, RelatedCapability, ICapabilityGraph, PresetCoOccurrence, CapabilitySearchResult, CapabilityIndexSources, CapabilityManifestFile, DiscoveryQueryOptions, ICapabilityDiscoveryEngine, } from './types.js';
|
|
31
|
+
export { DEFAULT_DISCOVERY_CONFIG } from './types.js';
|
|
32
|
+
export { CapabilityDiscoveryEngine } from './CapabilityDiscoveryEngine.js';
|
|
33
|
+
export { CapabilityIndex } from './CapabilityIndex.js';
|
|
34
|
+
export { CapabilityGraph } from './CapabilityGraph.js';
|
|
35
|
+
export { CapabilityContextAssembler } from './CapabilityContextAssembler.js';
|
|
36
|
+
export { CapabilityEmbeddingStrategy } from './CapabilityEmbeddingStrategy.js';
|
|
37
|
+
export { CapabilityManifestScanner } from './CapabilityManifestScanner.js';
|
|
38
|
+
export { createDiscoverCapabilitiesTool } from './DiscoverCapabilitiesTool.js';
|
|
39
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/discovery/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,yBAAyB,EACzB,yBAAyB,EACzB,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAGtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAG3E,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Capability Discovery Engine — barrel exports.
|
|
3
|
+
* @module @framers/agentos/discovery
|
|
4
|
+
*
|
|
5
|
+
* Smart, tiered capability discovery for AgentOS agents.
|
|
6
|
+
* Reduces capability context by ~90% (from ~20,000 to ~1,850 tokens)
|
|
7
|
+
* while improving discovery accuracy through semantic search + graph re-ranking.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import {
|
|
12
|
+
* CapabilityDiscoveryEngine,
|
|
13
|
+
* CapabilityManifestScanner,
|
|
14
|
+
* createDiscoverCapabilitiesTool,
|
|
15
|
+
* } from '../discovery/index.js';
|
|
16
|
+
*
|
|
17
|
+
* // Initialize
|
|
18
|
+
* const engine = new CapabilityDiscoveryEngine(embeddingManager, vectorStore);
|
|
19
|
+
* await engine.initialize({ tools, skills, extensions, channels });
|
|
20
|
+
*
|
|
21
|
+
* // Per-turn discovery
|
|
22
|
+
* const result = await engine.discover("search the web for AI news");
|
|
23
|
+
* const contextText = engine.renderForPrompt(result);
|
|
24
|
+
*
|
|
25
|
+
* // Register meta-tool for agent self-discovery
|
|
26
|
+
* const metaTool = createDiscoverCapabilitiesTool(engine);
|
|
27
|
+
* toolOrchestrator.registerTool(metaTool);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
// Constants
|
|
31
|
+
export { DEFAULT_DISCOVERY_CONFIG } from './types.js';
|
|
32
|
+
// Core classes
|
|
33
|
+
export { CapabilityDiscoveryEngine } from './CapabilityDiscoveryEngine.js';
|
|
34
|
+
export { CapabilityIndex } from './CapabilityIndex.js';
|
|
35
|
+
export { CapabilityGraph } from './CapabilityGraph.js';
|
|
36
|
+
export { CapabilityContextAssembler } from './CapabilityContextAssembler.js';
|
|
37
|
+
export { CapabilityEmbeddingStrategy } from './CapabilityEmbeddingStrategy.js';
|
|
38
|
+
export { CapabilityManifestScanner } from './CapabilityManifestScanner.js';
|
|
39
|
+
// Meta-tool
|
|
40
|
+
export { createDiscoverCapabilitiesTool } from './DiscoverCapabilitiesTool.js';
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/discovery/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AA0BH,YAAY;AACZ,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEtD,eAAe;AACf,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,YAAY;AACZ,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC"}
|