@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.
Files changed (46) hide show
  1. package/dist/cognitive_substrate/GMIManager.d.ts.map +1 -1
  2. package/dist/cognitive_substrate/GMIManager.js +0 -2
  3. package/dist/cognitive_substrate/GMIManager.js.map +1 -1
  4. package/dist/core/tools/IToolOrchestrator.d.ts +17 -0
  5. package/dist/core/tools/IToolOrchestrator.d.ts.map +1 -1
  6. package/dist/core/tools/ToolOrchestrator.d.ts +13 -0
  7. package/dist/core/tools/ToolOrchestrator.d.ts.map +1 -1
  8. package/dist/core/tools/ToolOrchestrator.js +28 -0
  9. package/dist/core/tools/ToolOrchestrator.js.map +1 -1
  10. package/dist/discovery/CapabilityContextAssembler.d.ts +54 -0
  11. package/dist/discovery/CapabilityContextAssembler.d.ts.map +1 -0
  12. package/dist/discovery/CapabilityContextAssembler.js +192 -0
  13. package/dist/discovery/CapabilityContextAssembler.js.map +1 -0
  14. package/dist/discovery/CapabilityDiscoveryEngine.d.ts +76 -0
  15. package/dist/discovery/CapabilityDiscoveryEngine.d.ts.map +1 -0
  16. package/dist/discovery/CapabilityDiscoveryEngine.js +197 -0
  17. package/dist/discovery/CapabilityDiscoveryEngine.js.map +1 -0
  18. package/dist/discovery/CapabilityEmbeddingStrategy.d.ts +45 -0
  19. package/dist/discovery/CapabilityEmbeddingStrategy.d.ts.map +1 -0
  20. package/dist/discovery/CapabilityEmbeddingStrategy.js +167 -0
  21. package/dist/discovery/CapabilityEmbeddingStrategy.js.map +1 -0
  22. package/dist/discovery/CapabilityGraph.d.ts +78 -0
  23. package/dist/discovery/CapabilityGraph.d.ts.map +1 -0
  24. package/dist/discovery/CapabilityGraph.js +263 -0
  25. package/dist/discovery/CapabilityGraph.js.map +1 -0
  26. package/dist/discovery/CapabilityIndex.d.ts +93 -0
  27. package/dist/discovery/CapabilityIndex.d.ts.map +1 -0
  28. package/dist/discovery/CapabilityIndex.js +324 -0
  29. package/dist/discovery/CapabilityIndex.js.map +1 -0
  30. package/dist/discovery/CapabilityManifestScanner.d.ts +66 -0
  31. package/dist/discovery/CapabilityManifestScanner.d.ts.map +1 -0
  32. package/dist/discovery/CapabilityManifestScanner.js +315 -0
  33. package/dist/discovery/CapabilityManifestScanner.js.map +1 -0
  34. package/dist/discovery/DiscoverCapabilitiesTool.d.ts +44 -0
  35. package/dist/discovery/DiscoverCapabilitiesTool.d.ts.map +1 -0
  36. package/dist/discovery/DiscoverCapabilitiesTool.js +118 -0
  37. package/dist/discovery/DiscoverCapabilitiesTool.js.map +1 -0
  38. package/dist/discovery/index.d.ts +39 -0
  39. package/dist/discovery/index.d.ts.map +1 -0
  40. package/dist/discovery/index.js +41 -0
  41. package/dist/discovery/index.js.map +1 -0
  42. package/dist/discovery/types.d.ts +357 -0
  43. package/dist/discovery/types.d.ts.map +1 -0
  44. package/dist/discovery/types.js +46 -0
  45. package/dist/discovery/types.js.map +1 -0
  46. package/package.json +6 -1
@@ -0,0 +1,324 @@
1
+ /**
2
+ * @fileoverview Capability Index — vector index over all capabilities.
3
+ * @module @framers/agentos/discovery/CapabilityIndex
4
+ *
5
+ * Normalizes tools, skills, extensions, and channels into unified
6
+ * CapabilityDescriptor objects, embeds them, and stores them in a
7
+ * vector index for semantic search.
8
+ *
9
+ * Reuses existing infrastructure:
10
+ * - IEmbeddingManager for embedding generation (with LRU cache)
11
+ * - IVectorStore for vector storage (InMemory, HNSW, Qdrant, SQL)
12
+ *
13
+ * Performance targets:
14
+ * - Index build: ~3s for ~100 capabilities (one-time, embedding API calls)
15
+ * - Search: <1ms HNSW lookup + ~50ms embedding cold / <5ms warm
16
+ */
17
+ import { CapabilityEmbeddingStrategy } from './CapabilityEmbeddingStrategy.js';
18
+ // ============================================================================
19
+ // CAPABILITY INDEX
20
+ // ============================================================================
21
+ export class CapabilityIndex {
22
+ constructor(embeddingManager, vectorStore, collectionName, embeddingModelId) {
23
+ this.embeddingManager = embeddingManager;
24
+ this.vectorStore = vectorStore;
25
+ this.collectionName = collectionName;
26
+ this.embeddingModelId = embeddingModelId;
27
+ this.descriptors = new Map();
28
+ this.built = false;
29
+ this.embeddingStrategy = new CapabilityEmbeddingStrategy();
30
+ }
31
+ // ============================================================================
32
+ // INDEX LIFECYCLE
33
+ // ============================================================================
34
+ /**
35
+ * Build the index from all capability sources.
36
+ * Normalizes sources into CapabilityDescriptors, embeds them, and stores
37
+ * in the vector store.
38
+ */
39
+ async buildIndex(sources) {
40
+ // 1. Normalize all sources into CapabilityDescriptors
41
+ const descriptors = this.normalizeSources(sources);
42
+ // 2. Store descriptors in memory
43
+ for (const desc of descriptors) {
44
+ this.descriptors.set(desc.id, desc);
45
+ }
46
+ if (descriptors.length === 0) {
47
+ this.built = true;
48
+ return;
49
+ }
50
+ // 3. Generate embedding texts
51
+ const embeddingTexts = descriptors.map((d) => this.embeddingStrategy.buildEmbeddingText(d));
52
+ // 4. Batch embed all capabilities
53
+ const embeddingResponse = await this.embeddingManager.generateEmbeddings({
54
+ texts: embeddingTexts,
55
+ modelId: this.embeddingModelId,
56
+ });
57
+ // 5. Create collection if the store supports it
58
+ if (this.vectorStore.createCollection) {
59
+ const dimension = embeddingResponse.embeddings[0]?.length;
60
+ if (dimension) {
61
+ const exists = this.vectorStore.collectionExists
62
+ ? await this.vectorStore.collectionExists(this.collectionName)
63
+ : false;
64
+ if (!exists) {
65
+ await this.vectorStore.createCollection(this.collectionName, dimension, {
66
+ similarityMetric: 'cosine',
67
+ });
68
+ }
69
+ }
70
+ }
71
+ // 6. Upsert into vector store
72
+ const documents = descriptors.map((desc, i) => ({
73
+ id: desc.id,
74
+ embedding: embeddingResponse.embeddings[i],
75
+ metadata: {
76
+ kind: desc.kind,
77
+ name: desc.name,
78
+ category: desc.category,
79
+ available: desc.available,
80
+ },
81
+ textContent: embeddingTexts[i],
82
+ }));
83
+ await this.vectorStore.upsert(this.collectionName, documents);
84
+ this.built = true;
85
+ }
86
+ /**
87
+ * Incrementally add or update a single capability.
88
+ */
89
+ async upsertCapability(cap) {
90
+ this.descriptors.set(cap.id, cap);
91
+ const text = this.embeddingStrategy.buildEmbeddingText(cap);
92
+ const response = await this.embeddingManager.generateEmbeddings({
93
+ texts: text,
94
+ modelId: this.embeddingModelId,
95
+ });
96
+ const doc = {
97
+ id: cap.id,
98
+ embedding: response.embeddings[0],
99
+ metadata: {
100
+ kind: cap.kind,
101
+ name: cap.name,
102
+ category: cap.category,
103
+ available: cap.available,
104
+ },
105
+ textContent: text,
106
+ };
107
+ await this.vectorStore.upsert(this.collectionName, [doc]);
108
+ }
109
+ /**
110
+ * Remove a capability from the index.
111
+ */
112
+ async removeCapability(id) {
113
+ this.descriptors.delete(id);
114
+ await this.vectorStore.delete(this.collectionName, [id]);
115
+ }
116
+ // ============================================================================
117
+ // SEARCH
118
+ // ============================================================================
119
+ /**
120
+ * Semantic search for capabilities matching a query.
121
+ *
122
+ * @param query - Natural language query (e.g., "search the web for news")
123
+ * @param topK - Number of results to return
124
+ * @param filters - Optional filters by kind, category, availability
125
+ */
126
+ async search(query, topK, filters) {
127
+ if (!this.built || this.descriptors.size === 0) {
128
+ return [];
129
+ }
130
+ // Embed the query
131
+ const queryResponse = await this.embeddingManager.generateEmbeddings({
132
+ texts: query,
133
+ modelId: this.embeddingModelId,
134
+ });
135
+ const queryEmbedding = queryResponse.embeddings[0];
136
+ // Build metadata filter
137
+ const metadataFilter = {};
138
+ if (filters?.kind && filters.kind !== 'any') {
139
+ metadataFilter.kind = filters.kind;
140
+ }
141
+ if (filters?.category) {
142
+ metadataFilter.category = filters.category;
143
+ }
144
+ if (filters?.onlyAvailable) {
145
+ metadataFilter.available = true;
146
+ }
147
+ // Query vector store
148
+ const result = await this.vectorStore.query(this.collectionName, queryEmbedding, {
149
+ topK,
150
+ filter: Object.keys(metadataFilter).length > 0 ? metadataFilter : undefined,
151
+ includeMetadata: true,
152
+ });
153
+ // Map results back to CapabilityDescriptors
154
+ return result.documents
155
+ .map((doc) => {
156
+ const descriptor = this.descriptors.get(doc.id);
157
+ if (!descriptor)
158
+ return null;
159
+ return {
160
+ descriptor,
161
+ score: doc.similarityScore,
162
+ };
163
+ })
164
+ .filter((r) => r !== null);
165
+ }
166
+ // ============================================================================
167
+ // ACCESSORS
168
+ // ============================================================================
169
+ /**
170
+ * Get a capability by ID.
171
+ */
172
+ getCapability(id) {
173
+ return this.descriptors.get(id);
174
+ }
175
+ /**
176
+ * Get all registered capabilities.
177
+ */
178
+ getAllCapabilities() {
179
+ return Array.from(this.descriptors.values());
180
+ }
181
+ /**
182
+ * Get all capability IDs.
183
+ */
184
+ listIds() {
185
+ return Array.from(this.descriptors.keys());
186
+ }
187
+ /**
188
+ * Get capabilities grouped by category.
189
+ */
190
+ getByCategory() {
191
+ const grouped = new Map();
192
+ for (const desc of this.descriptors.values()) {
193
+ const list = grouped.get(desc.category) ?? [];
194
+ list.push(desc);
195
+ grouped.set(desc.category, list);
196
+ }
197
+ return grouped;
198
+ }
199
+ /**
200
+ * Whether the index has been built.
201
+ */
202
+ isBuilt() {
203
+ return this.built;
204
+ }
205
+ /**
206
+ * Number of indexed capabilities.
207
+ */
208
+ size() {
209
+ return this.descriptors.size;
210
+ }
211
+ /**
212
+ * Get the embedding strategy (for external use by assembler).
213
+ */
214
+ getEmbeddingStrategy() {
215
+ return this.embeddingStrategy;
216
+ }
217
+ // ============================================================================
218
+ // SOURCE NORMALIZATION
219
+ // ============================================================================
220
+ /**
221
+ * Normalize all sources into CapabilityDescriptor objects.
222
+ */
223
+ normalizeSources(sources) {
224
+ const descriptors = [];
225
+ if (sources.tools) {
226
+ for (const tool of sources.tools) {
227
+ descriptors.push(this.normalizeToolSource(tool));
228
+ }
229
+ }
230
+ if (sources.skills) {
231
+ for (const skill of sources.skills) {
232
+ descriptors.push(this.normalizeSkillSource(skill));
233
+ }
234
+ }
235
+ if (sources.extensions) {
236
+ for (const ext of sources.extensions) {
237
+ descriptors.push(this.normalizeExtensionSource(ext));
238
+ }
239
+ }
240
+ if (sources.channels) {
241
+ for (const ch of sources.channels) {
242
+ descriptors.push(this.normalizeChannelSource(ch));
243
+ }
244
+ }
245
+ if (sources.manifests) {
246
+ for (const manifest of sources.manifests) {
247
+ descriptors.push(manifest);
248
+ }
249
+ }
250
+ return descriptors;
251
+ }
252
+ normalizeToolSource(tool) {
253
+ return {
254
+ id: `tool:${tool.name}`,
255
+ kind: 'tool',
256
+ name: tool.name,
257
+ displayName: tool.displayName,
258
+ description: tool.description,
259
+ category: tool.category ?? 'general',
260
+ tags: [],
261
+ requiredSecrets: [],
262
+ requiredTools: [],
263
+ available: true,
264
+ hasSideEffects: tool.hasSideEffects,
265
+ fullSchema: tool.inputSchema,
266
+ sourceRef: { type: 'tool', toolName: tool.name },
267
+ };
268
+ }
269
+ normalizeSkillSource(skill) {
270
+ return {
271
+ id: `skill:${skill.name}`,
272
+ kind: 'skill',
273
+ name: skill.name,
274
+ displayName: skill.name.split('-').map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(' '),
275
+ description: skill.description,
276
+ category: skill.category ?? 'general',
277
+ tags: skill.tags ?? [],
278
+ requiredSecrets: skill.requiredSecrets ?? [],
279
+ requiredTools: skill.requiredTools ?? skill.metadata?.requires?.bins ?? [],
280
+ available: true,
281
+ fullContent: skill.content,
282
+ sourceRef: {
283
+ type: 'skill',
284
+ skillName: skill.name,
285
+ skillPath: skill.sourcePath,
286
+ },
287
+ };
288
+ }
289
+ normalizeExtensionSource(ext) {
290
+ return {
291
+ id: `extension:${ext.name}`,
292
+ kind: 'extension',
293
+ name: ext.name,
294
+ displayName: ext.displayName,
295
+ description: ext.description,
296
+ category: ext.category,
297
+ tags: [],
298
+ requiredSecrets: ext.requiredSecrets ?? [],
299
+ requiredTools: [],
300
+ available: ext.available ?? false,
301
+ sourceRef: {
302
+ type: 'extension',
303
+ packageName: ext.name,
304
+ extensionId: ext.id,
305
+ },
306
+ };
307
+ }
308
+ normalizeChannelSource(ch) {
309
+ return {
310
+ id: `channel:${ch.platform}`,
311
+ kind: 'channel',
312
+ name: ch.platform,
313
+ displayName: ch.displayName,
314
+ description: ch.description,
315
+ category: 'communication',
316
+ tags: ch.capabilities ?? [],
317
+ requiredSecrets: [],
318
+ requiredTools: [],
319
+ available: true,
320
+ sourceRef: { type: 'channel', platform: ch.platform },
321
+ };
322
+ }
323
+ }
324
+ //# sourceMappingURL=CapabilityIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CapabilityIndex.js","sourceRoot":"","sources":["../../src/discovery/CapabilityIndex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAWH,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAE/E,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E,MAAM,OAAO,eAAe;IAK1B,YACmB,gBAAmC,EACnC,WAAyB,EACzB,cAAsB,EACtB,gBAAyB;QAHzB,qBAAgB,GAAhB,gBAAgB,CAAmB;QACnC,gBAAW,GAAX,WAAW,CAAc;QACzB,mBAAc,GAAd,cAAc,CAAQ;QACtB,qBAAgB,GAAhB,gBAAgB,CAAS;QAR3B,gBAAW,GAAsC,IAAI,GAAG,EAAE,CAAC;QAEpE,UAAK,GAAG,KAAK,CAAC;QAQpB,IAAI,CAAC,iBAAiB,GAAG,IAAI,2BAA2B,EAAE,CAAC;IAC7D,CAAC;IAED,+EAA+E;IAC/E,kBAAkB;IAClB,+EAA+E;IAE/E;;;;OAIG;IACH,KAAK,CAAC,UAAU,CAAC,OAA+B;QAC9C,sDAAsD;QACtD,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAEnD,iCAAiC;QACjC,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;YAC/B,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QACtC,CAAC;QAED,IAAI,WAAW,CAAC,M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WAAW;YAC3B,QAAQ,EAAE,eAAe;YACzB,IAAI,EAAE,EAAE,CAAC,YAAY,IAAI,EAAE;YAC3B,eAAe,EAAE,EAAE;YACnB,aAAa,EAAE,EAAE;YACjB,SAAS,EAAE,IAAI;YACf,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,QAAQ,EAAE;SACtD,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,66 @@
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 type { CapabilityDescriptor } from './types.js';
28
+ export declare class CapabilityManifestScanner {
29
+ private watchers;
30
+ /**
31
+ * Get default scan directories.
32
+ *
33
+ * 1. ~/.wunderland/capabilities/ (user-global)
34
+ * 2. ./.wunderland/capabilities/ (workspace-local, relative to cwd)
35
+ * 3. $WUNDERLAND_CAPABILITY_DIRS (env var, colon-separated)
36
+ */
37
+ getDefaultDirs(): string[];
38
+ /**
39
+ * Scan directories for CAPABILITY.yaml files.
40
+ * Each subdirectory should contain a CAPABILITY.yaml and optional SKILL.md.
41
+ *
42
+ * Structure:
43
+ * <dir>/
44
+ * my-custom-tool/
45
+ * CAPABILITY.yaml
46
+ * SKILL.md (optional)
47
+ * schema.json (optional)
48
+ */
49
+ scan(dirs?: string[]): Promise<CapabilityDescriptor[]>;
50
+ /**
51
+ * Parse a single CAPABILITY.yaml file into a CapabilityDescriptor.
52
+ */
53
+ parseManifest(yamlPath: string, capDir: string): Promise<CapabilityDescriptor | null>;
54
+ /**
55
+ * Watch directories for changes and call the callback when capabilities
56
+ * are added, modified, or removed.
57
+ *
58
+ * Uses debouncing to prevent rapid-fire events from fs.watch.
59
+ */
60
+ watch(dirs: string[], onChange: (descriptors: CapabilityDescriptor[]) => void, debounceMs?: number): void;
61
+ /**
62
+ * Stop watching all directories.
63
+ */
64
+ stopWatching(): void;
65
+ }
66
+ //# sourceMappingURL=CapabilityManifestScanner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CapabilityManifestScanner.d.ts","sourceRoot":"","sources":["../../src/discovery/CapabilityManifestScanner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAMH,OAAO,KAAK,EACV,oBAAoB,EAGrB,MAAM,YAAY,CAAC;AAgHpB,qBAAa,yBAAyB;IACpC,OAAO,CAAC,QAAQ,CAAsB;IAEtC;;;;;;OAMG;IACH,cAAc,IAAI,MAAM,EAAE;IAmB1B;;;;;;;;;;OAUG;IACG,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC;IA6C5D;;OAEG;IACG,aAAa,CACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAoEvC;;;;;OAKG;IACH,KAAK,CACH,IAAI,EAAE,MAAM,EAAE,EACd,QAAQ,EAAE,CAAC,WAAW,EAAE,oBAAoB,EAAE,KAAK,IAAI,EACvD,UAAU,SAAM,GACf,IAAI;IA2BP;;OAEG;IACH,YAAY,IAAI,IAAI;CAMrB"}