@framers/agentos 0.1.94 → 0.1.95

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 (55) hide show
  1. package/README.md +10 -0
  2. package/dist/api/AgentOS.d.ts +13 -0
  3. package/dist/api/AgentOS.d.ts.map +1 -1
  4. package/dist/api/AgentOS.js +36 -1
  5. package/dist/api/AgentOS.js.map +1 -1
  6. package/dist/core/tools/IToolOrchestrator.d.ts +38 -1
  7. package/dist/core/tools/IToolOrchestrator.d.ts.map +1 -1
  8. package/dist/core/tools/ToolOrchestrator.d.ts +58 -1
  9. package/dist/core/tools/ToolOrchestrator.d.ts.map +1 -1
  10. package/dist/core/tools/ToolOrchestrator.js +116 -1
  11. package/dist/core/tools/ToolOrchestrator.js.map +1 -1
  12. package/dist/discovery/CapabilityDiscoveryEngine.d.ts +19 -0
  13. package/dist/discovery/CapabilityDiscoveryEngine.d.ts.map +1 -1
  14. package/dist/discovery/CapabilityDiscoveryEngine.js +54 -0
  15. package/dist/discovery/CapabilityDiscoveryEngine.js.map +1 -1
  16. package/dist/discovery/types.d.ts +8 -1
  17. package/dist/discovery/types.d.ts.map +1 -1
  18. package/dist/discovery/types.js.map +1 -1
  19. package/dist/emergent/ComposableToolBuilder.d.ts +125 -0
  20. package/dist/emergent/ComposableToolBuilder.d.ts.map +1 -0
  21. package/dist/emergent/ComposableToolBuilder.js +318 -0
  22. package/dist/emergent/ComposableToolBuilder.js.map +1 -0
  23. package/dist/emergent/EmergentCapabilityEngine.d.ts +168 -0
  24. package/dist/emergent/EmergentCapabilityEngine.d.ts.map +1 -0
  25. package/dist/emergent/EmergentCapabilityEngine.js +437 -0
  26. package/dist/emergent/EmergentCapabilityEngine.js.map +1 -0
  27. package/dist/emergent/EmergentJudge.d.ts +283 -0
  28. package/dist/emergent/EmergentJudge.d.ts.map +1 -0
  29. package/dist/emergent/EmergentJudge.js +463 -0
  30. package/dist/emergent/EmergentJudge.js.map +1 -0
  31. package/dist/emergent/EmergentToolRegistry.d.ts +286 -0
  32. package/dist/emergent/EmergentToolRegistry.d.ts.map +1 -0
  33. package/dist/emergent/EmergentToolRegistry.js +546 -0
  34. package/dist/emergent/EmergentToolRegistry.js.map +1 -0
  35. package/dist/emergent/ForgeToolMetaTool.d.ts +124 -0
  36. package/dist/emergent/ForgeToolMetaTool.d.ts.map +1 -0
  37. package/dist/emergent/ForgeToolMetaTool.js +170 -0
  38. package/dist/emergent/ForgeToolMetaTool.js.map +1 -0
  39. package/dist/emergent/SandboxedToolForge.d.ts +185 -0
  40. package/dist/emergent/SandboxedToolForge.d.ts.map +1 -0
  41. package/dist/emergent/SandboxedToolForge.js +383 -0
  42. package/dist/emergent/SandboxedToolForge.js.map +1 -0
  43. package/dist/emergent/index.d.ts +25 -0
  44. package/dist/emergent/index.d.ts.map +1 -0
  45. package/dist/emergent/index.js +20 -0
  46. package/dist/emergent/index.js.map +1 -0
  47. package/dist/emergent/types.d.ts +596 -0
  48. package/dist/emergent/types.d.ts.map +1 -0
  49. package/dist/emergent/types.js +36 -0
  50. package/dist/emergent/types.js.map +1 -0
  51. package/dist/index.d.ts +1 -0
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +2 -0
  54. package/dist/index.js.map +1 -1
  55. package/package.json +1 -1
@@ -0,0 +1,437 @@
1
+ /**
2
+ * @fileoverview EmergentCapabilityEngine — orchestrates runtime tool creation.
3
+ * @module @framers/agentos/emergent/EmergentCapabilityEngine
4
+ *
5
+ * Provides the top-level pipeline that ties the forge subsystem together:
6
+ *
7
+ * forge request → build tool → run tests → judge review → register
8
+ *
9
+ * Supports two creation modes:
10
+ * - **Compose**: chains existing tools via {@link ComposableToolBuilder} (safe by construction).
11
+ * - **Sandbox**: runs agent-written code via {@link SandboxedToolForge} (judge-gated).
12
+ *
13
+ * After registration the engine tracks usage and auto-promotes tools that
14
+ * meet the configured {@link EmergentConfig.promotionThreshold} criteria.
15
+ */
16
+ // ============================================================================
17
+ // ENGINE
18
+ // ============================================================================
19
+ /**
20
+ * Orchestrates runtime tool creation for agents with emergent capabilities.
21
+ *
22
+ * Pipeline: forge request → build tool → run tests → judge review → register.
23
+ *
24
+ * Supports two creation modes:
25
+ * - **Compose**: chains existing tools via {@link ComposableToolBuilder} (safe by construction).
26
+ * - **Sandbox**: runs agent-written code via {@link SandboxedToolForge} (judge-gated).
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const engine = new EmergentCapabilityEngine({
31
+ * config: { ...DEFAULT_EMERGENT_CONFIG, enabled: true },
32
+ * composableBuilder,
33
+ * sandboxForge,
34
+ * judge,
35
+ * registry,
36
+ * });
37
+ *
38
+ * const result = await engine.forge(request, { agentId: 'gmi-1', sessionId: 'sess-1' });
39
+ * if (result.success) {
40
+ * console.log('Registered tool:', result.toolId);
41
+ * }
42
+ * ```
43
+ */
44
+ export class EmergentCapabilityEngine {
45
+ /**
46
+ * Create a new EmergentCapabilityEngine.
47
+ *
48
+ * @param deps - All collaborator dependencies. See {@link EmergentCapabilityEngineDeps}.
49
+ */
50
+ constructor(deps) {
51
+ /** Internal index for fast session/agent → tool lookups. */
52
+ this.index = {
53
+ bySession: new Map(),
54
+ byAgent: new Map(),
55
+ };
56
+ this.config = deps.config;
57
+ this.composableBuilder = deps.composableBuilder;
58
+ this.sandboxForge = deps.sandboxForge;
59
+ this.judge = deps.judge;
60
+ this.registry = deps.registry;
61
+ this.onToolForged = deps.onToolForged;
62
+ this.onToolPromoted = deps.onToolPromoted;
63
+ }
64
+ // --------------------------------------------------------------------------
65
+ // PUBLIC: forge
66
+ // --------------------------------------------------------------------------
67
+ /**
68
+ * Forge a new tool from a request.
69
+ *
70
+ * Runs test cases, submits the candidate to the LLM judge, and registers the
71
+ * tool at the `'session'` tier if approved. Returns a {@link ForgeResult} with
72
+ * the tool ID on success, or an error / rejection verdict on failure.
73
+ *
74
+ * Pipeline:
75
+ * 1. Generate unique tool ID.
76
+ * 2. Build or validate implementation (compose vs. sandbox).
77
+ * 3. Execute all declared test cases and collect results.
78
+ * 4. Submit candidate to the judge for creation review.
79
+ * 5. If approved: create {@link EmergentTool}, register at session tier, index.
80
+ * 6. If rejected: return failure with the judge's reasoning.
81
+ *
82
+ * @param request - The forge request describing the desired tool.
83
+ * @param context - Caller context containing the agent and session IDs.
84
+ * @returns A {@link ForgeResult} indicating success or failure.
85
+ */
86
+ async forge(request, context) {
87
+ // Guard: engine must be enabled.
88
+ if (!this.config.enabled) {
89
+ return { success: false, error: 'Emergent capabilities are disabled.' };
90
+ }
91
+ // Step 1: Generate a unique tool ID.
92
+ const toolId = `emergent_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
93
+ // Step 2 & 3: Build implementation and run test cases.
94
+ const testResults = [];
95
+ let source;
96
+ if (request.implementation.mode === 'compose') {
97
+ // ---- COMPOSE MODE ----
98
+ source = JSON.stringify(request.implementation);
99
+ // Build the composable tool so we can execute test cases against it.
100
+ const composedTool = this.composableBuilder.build(request.name, request.description, request.inputSchema, request.implementation);
101
+ // Run every declared test case.
102
+ const mockContext = {
103
+ gmiId: context.agentId,
104
+ personaId: 'emergent-forge',
105
+ userContext: { userId: 'system' },
106
+ correlationId: context.sessionId,
107
+ };
108
+ for (const tc of request.testCases) {
109
+ try {
110
+ const result = await composedTool.execute(tc.input, mockContext);
111
+ testResults.push({
112
+ input: tc.input,
113
+ output: result.output,
114
+ success: result.success,
115
+ error: result.error,
116
+ });
117
+ }
118
+ catch (err) {
119
+ const message = err instanceof Error ? err.message : String(err);
120
+ testResults.push({
121
+ input: tc.input,
122
+ output: undefined,
123
+ success: false,
124
+ error: message,
125
+ });
126
+ }
127
+ }
128
+ }
129
+ else {
130
+ // ---- SANDBOX MODE ----
131
+ source = request.implementation.code;
132
+ // Step 2a: Static code validation before any execution.
133
+ const validation = this.sandboxForge.validateCode(request.implementation.code, request.implementation.allowlist);
134
+ if (!validation.valid) {
135
+ return {
136
+ success: false,
137
+ error: `Code validation failed: ${validation.violations.join('; ')}`,
138
+ };
139
+ }
140
+ // Step 3: Execute test cases in the sandbox.
141
+ for (const tc of request.testCases) {
142
+ const sandboxResult = await this.sandboxForge.execute({
143
+ code: request.implementation.code,
144
+ input: tc.input,
145
+ allowlist: request.implementation.allowlist,
146
+ memoryMB: this.config.sandboxMemoryMB,
147
+ timeoutMs: this.config.sandboxTimeoutMs,
148
+ });
149
+ testResults.push({
150
+ input: tc.input,
151
+ output: sandboxResult.output,
152
+ success: sandboxResult.success,
153
+ error: sandboxResult.error,
154
+ });
155
+ }
156
+ }
157
+ // Step 4: Build candidate and submit to judge.
158
+ const candidate = {
159
+ name: request.name,
160
+ description: request.description,
161
+ inputSchema: request.inputSchema,
162
+ outputSchema: request.outputSchema,
163
+ source,
164
+ implementationMode: request.implementation.mode,
165
+ allowlist: request.implementation.mode === 'sandbox'
166
+ ? request.implementation.allowlist
167
+ : undefined,
168
+ testResults,
169
+ };
170
+ const verdict = await this.judge.reviewCreation(candidate);
171
+ // Step 5: Register if approved.
172
+ if (verdict.approved) {
173
+ const now = new Date().toISOString();
174
+ const usageStats = {
175
+ totalUses: 0,
176
+ successCount: 0,
177
+ failureCount: 0,
178
+ avgExecutionTimeMs: 0,
179
+ lastUsedAt: null,
180
+ confidenceScore: verdict.confidence,
181
+ };
182
+ const tool = {
183
+ id: toolId,
184
+ name: request.name,
185
+ description: request.description,
186
+ inputSchema: request.inputSchema,
187
+ outputSchema: request.outputSchema,
188
+ implementation: request.implementation,
189
+ tier: 'session',
190
+ createdBy: context.agentId,
191
+ createdAt: now,
192
+ judgeVerdicts: [verdict],
193
+ usageStats,
194
+ source: `forged by agent ${context.agentId} during session ${context.sessionId}`,
195
+ };
196
+ this.registry.register(tool, 'session');
197
+ this.indexTool(toolId, context.agentId, context.sessionId);
198
+ if (this.onToolForged) {
199
+ try {
200
+ await this.onToolForged(tool, this.createExecutableTool(tool));
201
+ }
202
+ catch (error) {
203
+ this.registry.remove(toolId);
204
+ this.removeIndexedTool(toolId, context.agentId, context.sessionId);
205
+ return {
206
+ success: false,
207
+ error: error instanceof Error
208
+ ? error.message
209
+ : 'Failed to activate forged tool.',
210
+ };
211
+ }
212
+ }
213
+ return {
214
+ success: true,
215
+ toolId,
216
+ tool,
217
+ verdict,
218
+ };
219
+ }
220
+ // Step 6: Rejected.
221
+ return {
222
+ success: false,
223
+ verdict,
224
+ error: verdict.reasoning,
225
+ };
226
+ }
227
+ // --------------------------------------------------------------------------
228
+ // PUBLIC: checkPromotion
229
+ // --------------------------------------------------------------------------
230
+ /**
231
+ * Check if a tool is eligible for promotion and auto-promote if the threshold
232
+ * is met.
233
+ *
234
+ * A tool qualifies for promotion when:
235
+ * 1. It is at the `'session'` tier.
236
+ * 2. Its usage stats meet {@link EmergentConfig.promotionThreshold}:
237
+ * - `totalUses >= threshold.uses`
238
+ * - `confidenceScore >= threshold.confidence`
239
+ *
240
+ * When eligible, the engine submits the tool to the judge's promotion panel.
241
+ * If both reviewers approve, the tool is promoted to `'agent'` tier.
242
+ *
243
+ * @param toolId - The ID of the tool to check.
244
+ * @returns A {@link PromotionResult} if promotion was attempted, or `null` if
245
+ * the tool is not eligible or does not exist.
246
+ */
247
+ async checkPromotion(toolId) {
248
+ const tool = this.registry.get(toolId);
249
+ if (!tool) {
250
+ return null;
251
+ }
252
+ // Only session-tier tools are eligible for auto-promotion.
253
+ if (tool.tier !== 'session') {
254
+ return null;
255
+ }
256
+ // Check thresholds.
257
+ const { uses, confidence } = this.config.promotionThreshold;
258
+ if (tool.usageStats.totalUses < uses ||
259
+ tool.usageStats.confidenceScore < confidence) {
260
+ return null;
261
+ }
262
+ // Submit to the promotion panel.
263
+ const promotionVerdict = await this.judge.reviewPromotion(tool);
264
+ tool.judgeVerdicts.push(promotionVerdict);
265
+ if (promotionVerdict.approved) {
266
+ await this.registry.promote(toolId, 'agent');
267
+ const promotedTool = this.registry.get(toolId);
268
+ if (promotedTool && this.onToolPromoted) {
269
+ await this.onToolPromoted(promotedTool);
270
+ }
271
+ return {
272
+ success: true,
273
+ verdict: promotionVerdict,
274
+ };
275
+ }
276
+ return {
277
+ success: false,
278
+ verdict: promotionVerdict,
279
+ error: 'Promotion panel rejected the tool.',
280
+ };
281
+ }
282
+ // --------------------------------------------------------------------------
283
+ // PUBLIC: getSessionTools
284
+ // --------------------------------------------------------------------------
285
+ /**
286
+ * Get all session-scoped tools for a given session ID.
287
+ *
288
+ * @param sessionId - The session identifier.
289
+ * @returns An array of {@link EmergentTool} objects belonging to the session.
290
+ */
291
+ getSessionTools(sessionId) {
292
+ const toolIds = this.index.bySession.get(sessionId);
293
+ if (!toolIds) {
294
+ return [];
295
+ }
296
+ const tools = [];
297
+ for (const id of toolIds) {
298
+ const tool = this.registry.get(id);
299
+ if (tool) {
300
+ tools.push(tool);
301
+ }
302
+ }
303
+ return tools;
304
+ }
305
+ // --------------------------------------------------------------------------
306
+ // PUBLIC: getAgentTools
307
+ // --------------------------------------------------------------------------
308
+ /**
309
+ * Get all agent-tier tools for a given agent ID.
310
+ *
311
+ * @param agentId - The agent identifier.
312
+ * @returns An array of {@link EmergentTool} objects created by the agent.
313
+ */
314
+ getAgentTools(agentId) {
315
+ return this.registry.getByTier('agent', { agentId });
316
+ }
317
+ // --------------------------------------------------------------------------
318
+ // PUBLIC: cleanupSession
319
+ // --------------------------------------------------------------------------
320
+ /**
321
+ * Clean up all session tools for a given session.
322
+ *
323
+ * Delegates to the registry's {@link EmergentToolRegistry.cleanupSession}
324
+ * method and clears the local session index.
325
+ *
326
+ * @param sessionId - The session identifier to clean up.
327
+ */
328
+ cleanupSession(sessionId) {
329
+ const removedTools = this.getSessionTools(sessionId);
330
+ this.registry.cleanupSession(sessionId);
331
+ this.index.bySession.delete(sessionId);
332
+ return removedTools;
333
+ }
334
+ /**
335
+ * Create an executable ITool wrapper for a forged emergent tool.
336
+ *
337
+ * The wrapper performs runtime output validation, usage tracking, and
338
+ * promotion checks after each successful execution.
339
+ */
340
+ createExecutableTool(tool) {
341
+ const baseTool = tool.implementation.mode === 'compose'
342
+ ? this.composableBuilder.build(tool.name, tool.description, tool.inputSchema, tool.implementation)
343
+ : this.buildSandboxExecutable(tool);
344
+ return {
345
+ id: `emergent-tool:${tool.id}`,
346
+ name: tool.name,
347
+ displayName: tool.name,
348
+ description: tool.description,
349
+ inputSchema: tool.inputSchema,
350
+ outputSchema: tool.outputSchema,
351
+ category: 'emergent',
352
+ hasSideEffects: tool.implementation.mode === 'sandbox',
353
+ execute: async (args, context) => {
354
+ const startTime = performance.now();
355
+ const result = await baseTool.execute(args, context);
356
+ const executionTimeMs = Math.round(performance.now() - startTime);
357
+ let success = result.success;
358
+ let error = result.error;
359
+ if (success) {
360
+ const reuseVerdict = this.judge.validateReuse(tool.id, result.output, tool.outputSchema);
361
+ if (!reuseVerdict.valid) {
362
+ success = false;
363
+ error = `Output schema validation failed: ${reuseVerdict.schemaErrors.join('; ')}`;
364
+ }
365
+ }
366
+ this.registry.recordUse(tool.id, args, result.output, success, executionTimeMs);
367
+ if (success) {
368
+ await this.checkPromotion(tool.id);
369
+ }
370
+ return success
371
+ ? result
372
+ : {
373
+ success: false,
374
+ output: result.output,
375
+ error: error ?? 'Emergent tool execution failed.',
376
+ };
377
+ },
378
+ };
379
+ }
380
+ // --------------------------------------------------------------------------
381
+ // PRIVATE: indexTool
382
+ // --------------------------------------------------------------------------
383
+ /**
384
+ * Add a tool ID to the session and agent indexes for fast future lookup.
385
+ *
386
+ * @param toolId - The tool ID to index.
387
+ * @param agentId - The agent that created the tool.
388
+ * @param sessionId - The session in which the tool was created.
389
+ */
390
+ indexTool(toolId, agentId, sessionId) {
391
+ // Session index.
392
+ if (!this.index.bySession.has(sessionId)) {
393
+ this.index.bySession.set(sessionId, new Set());
394
+ }
395
+ this.index.bySession.get(sessionId).add(toolId);
396
+ // Agent index.
397
+ if (!this.index.byAgent.has(agentId)) {
398
+ this.index.byAgent.set(agentId, new Set());
399
+ }
400
+ this.index.byAgent.get(agentId).add(toolId);
401
+ }
402
+ removeIndexedTool(toolId, agentId, sessionId) {
403
+ this.index.bySession.get(sessionId)?.delete(toolId);
404
+ this.index.byAgent.get(agentId)?.delete(toolId);
405
+ }
406
+ buildSandboxExecutable(tool) {
407
+ return {
408
+ id: `sandboxed:${tool.id}`,
409
+ name: tool.name,
410
+ displayName: tool.name,
411
+ description: tool.description,
412
+ inputSchema: tool.inputSchema,
413
+ outputSchema: tool.outputSchema,
414
+ category: 'emergent',
415
+ hasSideEffects: true,
416
+ execute: async (args) => {
417
+ if (tool.implementation.mode !== 'sandbox') {
418
+ return {
419
+ success: false,
420
+ error: 'Sandbox executor received a non-sandbox emergent tool.',
421
+ };
422
+ }
423
+ const sandboxResult = await this.sandboxForge.execute({
424
+ code: tool.implementation.code,
425
+ input: args,
426
+ allowlist: tool.implementation.allowlist,
427
+ memoryMB: this.config.sandboxMemoryMB,
428
+ timeoutMs: this.config.sandboxTimeoutMs,
429
+ });
430
+ return sandboxResult.success
431
+ ? { success: true, output: sandboxResult.output }
432
+ : { success: false, error: sandboxResult.error };
433
+ },
434
+ };
435
+ }
436
+ }
437
+ //# sourceMappingURL=EmergentCapabilityEngine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmergentCapabilityEngine.js","sourceRoot":"","sources":["../../src/emergent/EmergentCapabilityEngine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAsEH,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,OAAO,wBAAwB;IAgBnC;;;;OAIG;IACH,YAAY,IAAkC;QAX9C,4DAA4D;QAC3C,UAAK,GAAc;YAClC,SAAS,EAAE,IAAI,GAAG,EAAE;YACpB,OAAO,EAAE,IAAI,GAAG,EAAE;SACnB,CAAC;QAQA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAC;QAChD,IAAI,CAAC,YAAY,GAAG,IAAI,CA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