@agentic-robotics/mcp 0.2.0 → 0.2.2

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/src/benchmark.ts DELETED
@@ -1,434 +0,0 @@
1
- /**
2
- * Comprehensive Benchmark Suite
3
- *
4
- * Benchmarks AgentDB and agentic-flow integration performance
5
- */
6
-
7
- import { EnhancedAgentDBMemory, Episode } from './enhanced-memory.js';
8
- import { FlowOrchestrator, AgentTask } from './flow-orchestrator.js';
9
-
10
- interface BenchmarkResult {
11
- name: string;
12
- iterations: number;
13
- totalTime: number;
14
- avgTime: number;
15
- minTime: number;
16
- maxTime: number;
17
- opsPerSec: number;
18
- p50: number;
19
- p95: number;
20
- p99: number;
21
- }
22
-
23
- interface BenchmarkSuite {
24
- agentdb: {
25
- storeEpisode: BenchmarkResult;
26
- retrieveMemories: BenchmarkResult;
27
- queryWithContext: BenchmarkResult;
28
- consolidateSkills: BenchmarkResult;
29
- searchSkills: BenchmarkResult;
30
- };
31
- agenticFlow: {
32
- executeTask: BenchmarkResult;
33
- executeSwarm: BenchmarkResult;
34
- coordinateRobots: BenchmarkResult;
35
- reasonAboutTask: BenchmarkResult;
36
- };
37
- overall: {
38
- totalTime: number;
39
- timestamp: string;
40
- };
41
- }
42
-
43
- export class IntegrationBenchmark {
44
- private memory: EnhancedAgentDBMemory;
45
- private orchestrator: FlowOrchestrator;
46
-
47
- constructor() {
48
- this.memory = new EnhancedAgentDBMemory('./benchmark-memory.db');
49
- this.orchestrator = new FlowOrchestrator({
50
- numAgents: 66,
51
- strategy: 'adaptive',
52
- reasoningEnabled: true,
53
- learningEnabled: true,
54
- });
55
- }
56
-
57
- async initialize(): Promise<void> {
58
- console.log('šŸ Initializing benchmark suite...\n');
59
- await this.memory.initialize();
60
- await this.orchestrator.initialize();
61
- console.log('āœ… Benchmark suite ready\n');
62
- }
63
-
64
- /**
65
- * Run complete benchmark suite
66
- */
67
- async runAll(): Promise<BenchmarkSuite> {
68
- const suiteStartTime = Date.now();
69
-
70
- console.log('ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”');
71
- console.log('│ Integration Benchmark Suite │');
72
- console.log('│ AgentDB + agentic-flow Performance Test │');
73
- console.log('ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜\n');
74
-
75
- // AgentDB Benchmarks
76
- console.log('šŸ“Š AGENTDB BENCHMARKS\n');
77
-
78
- const storeEpisode = await this.benchmarkStoreEpisode(1000);
79
- this.printResult('Store Episode', storeEpisode);
80
-
81
- const retrieveMemories = await this.benchmarkRetrieveMemories(500);
82
- this.printResult('Retrieve Memories', retrieveMemories);
83
-
84
- const queryWithContext = await this.benchmarkQueryWithContext(300);
85
- this.printResult('Query with Context', queryWithContext);
86
-
87
- const consolidateSkills = await this.benchmarkConsolidateSkills(10);
88
- this.printResult('Consolidate Skills', consolidateSkills);
89
-
90
- const searchSkills = await this.benchmarkSearchSkills(200);
91
- this.printResult('Search Skills', searchSkills);
92
-
93
- // agentic-flow Benchmarks
94
- console.log('\n🌊 AGENTIC-FLOW BENCHMARKS\n');
95
-
96
- const executeTask = await this.benchmarkExecuteTask(100);
97
- this.printResult('Execute Task', executeTask);
98
-
99
- const executeSwarm = await this.benchmarkExecuteSwarm(20);
100
- this.printResult('Execute Swarm', executeSwarm);
101
-
102
- const coordinateRobots = await this.benchmarkCoordinateRobots(50);
103
- this.printResult('Coordinate Robots', coordinateRobots);
104
-
105
- const reasonAboutTask = await this.benchmarkReasonAboutTask(100);
106
- this.printResult('Reason About Task', reasonAboutTask);
107
-
108
- const totalTime = Date.now() - suiteStartTime;
109
-
110
- console.log('\nā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”');
111
- console.log('│ BENCHMARK COMPLETE │');
112
- console.log(`│ Total Time: ${(totalTime / 1000).toFixed(2)}s │`);
113
- console.log('ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜\n');
114
-
115
- return {
116
- agentdb: {
117
- storeEpisode,
118
- retrieveMemories,
119
- queryWithContext,
120
- consolidateSkills,
121
- searchSkills,
122
- },
123
- agenticFlow: {
124
- executeTask,
125
- executeSwarm,
126
- coordinateRobots,
127
- reasonAboutTask,
128
- },
129
- overall: {
130
- totalTime,
131
- timestamp: new Date().toISOString(),
132
- },
133
- };
134
- }
135
-
136
- /**
137
- * Benchmark: Store Episode
138
- */
139
- private async benchmarkStoreEpisode(iterations: number): Promise<BenchmarkResult> {
140
- const times: number[] = [];
141
-
142
- for (let i = 0; i < iterations; i++) {
143
- const episode: Episode = {
144
- sessionId: `bench-${i}`,
145
- taskName: 'navigation',
146
- confidence: Math.random(),
147
- success: Math.random() > 0.3,
148
- outcome: 'Completed navigation task',
149
- strategy: 'adaptive_planning',
150
- metadata: { x: i, y: i * 2, latency: Math.random() * 100 },
151
- };
152
-
153
- const start = Date.now();
154
- await this.memory.storeEpisode(episode);
155
- times.push(Date.now() - start);
156
-
157
- if (i % 100 === 0 && i > 0) {
158
- process.stderr.write(` Progress: ${i}/${iterations}\r`);
159
- }
160
- }
161
-
162
- return this.calculateStats('Store Episode', times);
163
- }
164
-
165
- /**
166
- * Benchmark: Retrieve Memories
167
- */
168
- private async benchmarkRetrieveMemories(iterations: number): Promise<BenchmarkResult> {
169
- const times: number[] = [];
170
-
171
- const queries = [
172
- 'navigation task',
173
- 'object detection',
174
- 'path planning',
175
- 'sensor fusion',
176
- 'motor control',
177
- ];
178
-
179
- for (let i = 0; i < iterations; i++) {
180
- const query = queries[i % queries.length];
181
-
182
- const start = Date.now();
183
- await this.memory.retrieveMemories(query, 5, {
184
- onlySuccesses: true,
185
- synthesizeContext: true,
186
- });
187
- times.push(Date.now() - start);
188
-
189
- if (i % 50 === 0 && i > 0) {
190
- process.stderr.write(` Progress: ${i}/${iterations}\r`);
191
- }
192
- }
193
-
194
- return this.calculateStats('Retrieve Memories', times);
195
- }
196
-
197
- /**
198
- * Benchmark: Query with Context
199
- */
200
- private async benchmarkQueryWithContext(iterations: number): Promise<BenchmarkResult> {
201
- const times: number[] = [];
202
-
203
- for (let i = 0; i < iterations; i++) {
204
- const start = Date.now();
205
- await this.memory.queryWithContext('warehouse navigation', {
206
- k: 10,
207
- minConfidence: 0.5,
208
- synthesizeReasoning: true,
209
- });
210
- times.push(Date.now() - start);
211
-
212
- if (i % 30 === 0 && i > 0) {
213
- process.stderr.write(` Progress: ${i}/${iterations}\r`);
214
- }
215
- }
216
-
217
- return this.calculateStats('Query with Context', times);
218
- }
219
-
220
- /**
221
- * Benchmark: Consolidate Skills
222
- */
223
- private async benchmarkConsolidateSkills(iterations: number): Promise<BenchmarkResult> {
224
- const times: number[] = [];
225
-
226
- for (let i = 0; i < iterations; i++) {
227
- const start = Date.now();
228
- await this.memory.consolidateSkills({
229
- minAttempts: 3,
230
- minReward: 0.7,
231
- timeWindowDays: 7,
232
- enablePruning: true,
233
- });
234
- times.push(Date.now() - start);
235
-
236
- if (i % 2 === 0 && i > 0) {
237
- process.stderr.write(` Progress: ${i}/${iterations}\r`);
238
- }
239
- }
240
-
241
- return this.calculateStats('Consolidate Skills', times);
242
- }
243
-
244
- /**
245
- * Benchmark: Search Skills
246
- */
247
- private async benchmarkSearchSkills(iterations: number): Promise<BenchmarkResult> {
248
- const times: number[] = [];
249
-
250
- for (let i = 0; i < iterations; i++) {
251
- const start = Date.now();
252
- await this.memory.searchSkills('navigation', {
253
- k: 5,
254
- minSuccessRate: 0.5,
255
- sortBy: 'success_rate',
256
- });
257
- times.push(Date.now() - start);
258
-
259
- if (i % 20 === 0 && i > 0) {
260
- process.stderr.write(` Progress: ${i}/${iterations}\r`);
261
- }
262
- }
263
-
264
- return this.calculateStats('Search Skills', times);
265
- }
266
-
267
- /**
268
- * Benchmark: Execute Task
269
- */
270
- private async benchmarkExecuteTask(iterations: number): Promise<BenchmarkResult> {
271
- const times: number[] = [];
272
-
273
- for (let i = 0; i < iterations; i++) {
274
- const task: AgentTask = {
275
- id: `task-${i}`,
276
- type: 'navigation',
277
- priority: 'medium',
278
- params: { target: { x: i, y: i * 2 } },
279
- timeout: 5000,
280
- };
281
-
282
- const start = Date.now();
283
- await this.orchestrator.executeTask(task);
284
- times.push(Date.now() - start);
285
-
286
- if (i % 10 === 0 && i > 0) {
287
- process.stderr.write(` Progress: ${i}/${iterations}\r`);
288
- }
289
- }
290
-
291
- return this.calculateStats('Execute Task', times);
292
- }
293
-
294
- /**
295
- * Benchmark: Execute Swarm
296
- */
297
- private async benchmarkExecuteSwarm(iterations: number): Promise<BenchmarkResult> {
298
- const times: number[] = [];
299
-
300
- for (let i = 0; i < iterations; i++) {
301
- const tasks: AgentTask[] = Array.from({ length: 5 }, (_, j) => ({
302
- id: `swarm-${i}-${j}`,
303
- type: 'patrol',
304
- priority: 'medium',
305
- params: { area: j },
306
- }));
307
-
308
- const start = Date.now();
309
- await this.orchestrator.executeSwarm(tasks);
310
- times.push(Date.now() - start);
311
-
312
- if (i % 5 === 0 && i > 0) {
313
- process.stderr.write(` Progress: ${i}/${iterations}\r`);
314
- }
315
- }
316
-
317
- return this.calculateStats('Execute Swarm', times);
318
- }
319
-
320
- /**
321
- * Benchmark: Coordinate Robots
322
- */
323
- private async benchmarkCoordinateRobots(iterations: number): Promise<BenchmarkResult> {
324
- const times: number[] = [];
325
-
326
- for (let i = 0; i < iterations; i++) {
327
- const start = Date.now();
328
- await this.orchestrator.coordinateRobots(
329
- ['robot1', 'robot2', 'robot3'],
330
- {
331
- type: 'warehouse_inventory',
332
- objectives: ['scan', 'count', 'report'],
333
- }
334
- );
335
- times.push(Date.now() - start);
336
-
337
- if (i % 10 === 0 && i > 0) {
338
- process.stderr.write(` Progress: ${i}/${iterations}\r`);
339
- }
340
- }
341
-
342
- return this.calculateStats('Coordinate Robots', times);
343
- }
344
-
345
- /**
346
- * Benchmark: Reason About Task
347
- */
348
- private async benchmarkReasonAboutTask(iterations: number): Promise<BenchmarkResult> {
349
- const times: number[] = [];
350
-
351
- for (let i = 0; i < iterations; i++) {
352
- const start = Date.now();
353
- await this.orchestrator.reasonAboutTask(
354
- 'Should robot prioritize speed or accuracy?',
355
- {
356
- useMemory: true,
357
- synthesizeStrategy: true,
358
- explainReasoning: true,
359
- }
360
- );
361
- times.push(Date.now() - start);
362
-
363
- if (i % 10 === 0 && i > 0) {
364
- process.stderr.write(` Progress: ${i}/${iterations}\r`);
365
- }
366
- }
367
-
368
- return this.calculateStats('Reason About Task', times);
369
- }
370
-
371
- /**
372
- * Calculate statistics from timing data
373
- */
374
- private calculateStats(name: string, times: number[]): BenchmarkResult {
375
- const sorted = [...times].sort((a, b) => a - b);
376
- const total = times.reduce((a, b) => a + b, 0);
377
-
378
- return {
379
- name,
380
- iterations: times.length,
381
- totalTime: total,
382
- avgTime: total / times.length,
383
- minTime: sorted[0],
384
- maxTime: sorted[sorted.length - 1],
385
- opsPerSec: (times.length / total) * 1000,
386
- p50: sorted[Math.floor(sorted.length * 0.50)],
387
- p95: sorted[Math.floor(sorted.length * 0.95)],
388
- p99: sorted[Math.floor(sorted.length * 0.99)],
389
- };
390
- }
391
-
392
- /**
393
- * Print benchmark result
394
- */
395
- private printResult(name: string, result: BenchmarkResult): void {
396
- console.log(`${name}:`);
397
- console.log(` Iterations: ${result.iterations.toLocaleString()}`);
398
- console.log(` Avg Time: ${result.avgTime.toFixed(3)}ms`);
399
- console.log(` Min/Max: ${result.minTime.toFixed(3)}ms / ${result.maxTime.toFixed(3)}ms`);
400
- console.log(` p50/p95/p99: ${result.p50.toFixed(3)}ms / ${result.p95.toFixed(3)}ms / ${result.p99.toFixed(3)}ms`);
401
- console.log(` Ops/sec: ${result.opsPerSec.toFixed(0)}`);
402
- console.log('');
403
- }
404
-
405
- /**
406
- * Export results to JSON
407
- */
408
- async exportResults(suite: BenchmarkSuite, filename: string): Promise<void> {
409
- const fs = await import('fs/promises');
410
- await fs.writeFile(filename, JSON.stringify(suite, null, 2));
411
- console.log(`šŸ“ Results exported to ${filename}`);
412
- }
413
-
414
- async close(): Promise<void> {
415
- await this.memory.close();
416
- await this.orchestrator.close();
417
- }
418
- }
419
-
420
- // CLI entry point
421
- if (import.meta.url === `file://${process.argv[1]}`) {
422
- const benchmark = new IntegrationBenchmark();
423
-
424
- try {
425
- await benchmark.initialize();
426
- const results = await benchmark.runAll();
427
- await benchmark.exportResults(results, './benchmark-results.json');
428
- } catch (error) {
429
- console.error('āŒ Benchmark failed:', error);
430
- process.exit(1);
431
- } finally {
432
- await benchmark.close();
433
- }
434
- }
package/src/cli.ts DELETED
@@ -1,89 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * ROS3 MCP Server CLI
5
- */
6
-
7
- import { ROS3McpServer } from './server.js';
8
-
9
- async function main() {
10
- const server = new ROS3McpServer({
11
- name: 'ros3-mcp-server',
12
- version: '1.0.0',
13
- dbPath: process.env.AGENTDB_PATH || './ros3-agentdb.db',
14
- });
15
-
16
- // Handle graceful shutdown
17
- process.on('SIGINT', async () => {
18
- console.error('\nShutting down ROS3 MCP Server...');
19
- await server.stop();
20
- process.exit(0);
21
- });
22
-
23
- process.on('SIGTERM', async () => {
24
- console.error('\nShutting down ROS3 MCP Server...');
25
- await server.stop();
26
- process.exit(0);
27
- });
28
-
29
- // Start the server
30
- await server.start();
31
-
32
- // Keep the process running
33
- console.error('\nPress Ctrl+C to stop the server');
34
-
35
- // Simple REPL for testing
36
- const readline = await import('readline');
37
- const rl = readline.createInterface({
38
- input: process.stdin,
39
- output: process.stdout,
40
- terminal: false,
41
- });
42
-
43
- console.error('\nEnter commands (e.g., "get_pose", "get_status"):');
44
-
45
- rl.on('line', async (line) => {
46
- const cmd = line.trim();
47
-
48
- try {
49
- switch (cmd) {
50
- case 'get_pose':
51
- console.log(await server.getPose());
52
- break;
53
- case 'get_status':
54
- console.log(await server.getStatus());
55
- break;
56
- case 'get_memory_stats':
57
- console.log(await server.getMemoryStats());
58
- break;
59
- case 'info':
60
- console.log(JSON.stringify(server.getInfo(), null, 2));
61
- break;
62
- case 'help':
63
- console.log('Available commands:');
64
- console.log(' get_pose - Get current robot pose');
65
- console.log(' get_status - Get robot status');
66
- console.log(' get_memory_stats - Get memory statistics');
67
- console.log(' info - Get server info');
68
- console.log(' help - Show this help');
69
- console.log(' exit - Stop the server');
70
- break;
71
- case 'exit':
72
- await server.stop();
73
- process.exit(0);
74
- break;
75
- default:
76
- if (cmd) {
77
- console.log(`Unknown command: ${cmd}. Type "help" for available commands.`);
78
- }
79
- }
80
- } catch (error: any) {
81
- console.error(`Error: ${error.message}`);
82
- }
83
- });
84
- }
85
-
86
- main().catch((error) => {
87
- console.error('Fatal error:', error);
88
- process.exit(1);
89
- });