UNPKG

llv-helix

Version:

The Helix Moment: Strategic Intelligence as Code - MCP server for Lines-Loops-Vibes framework from The Helix Moment

169 lines (144 loc) โ€ข 4.88 kB
#!/usr/bin/env node // Test the server methods directly console.log('๐Ÿงช Testing Lines-Loops-Vibes MCP Server...\n'); // Create a mock server instance for testing const server = { lines: new Map(), loops: new Map(), vibes: new Map(), rhythms: new Map(), contexts: new Map(), generateRhythm(type) { return { next: () => Math.random() }; }, visualizeLineRhythm(rhythm) { const patterns = { flowing: 'ใ€ฐ๏ธใ€ฐ๏ธใ€ฐ๏ธใ€ฐ๏ธ', steady: 'โ”โ”โ”โ”โ”โ”โ”โ”' }; return patterns[rhythm] || 'โ”โ”โ”โ”โ”โ”โ”โ”'; }, visualizeLoopPattern(type) { const patterns = { spiral: '๐ŸŒ€' }; return patterns[type] || 'โ—ฏโ—ฏโ—ฏโ—ฏ'; }, visualizeVibeEnergy(energy, frequency) { return `โšกโšกโšกโšกโšก ${'ใ€œ'.repeat(Math.ceil(frequency / 20))}`; }, visualizeSystemRhythm(timeWindow) { return '๐ŸŽต SYSTEM RHYTHM\nโ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”\nโ”‚โ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ”‚\nโ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜'; }, createLine(args) { const { name, from, to, rhythm = 'steady' } = args; const line = { name, from, to, rhythm }; this.lines.set(name, line); this.rhythms.set(`line_${name}`, this.generateRhythm(rhythm)); return { content: [{ type: 'text', text: `ใ€ฐ๏ธ Line "${name}" created!\n\nFrom: ${from} โ†’ To: ${to}\nRhythm: ${rhythm}\n\n${this.visualizeLineRhythm(rhythm)}\n\nThe line is ready to carry messages with ${rhythm} rhythm.` }] }; }, createLoop(args) { const { name, type, rhythm = 'constant' } = args; const loop = { name, type, rhythm }; this.loops.set(name, loop); this.rhythms.set(`loop_${name}`, this.generateRhythm(rhythm)); return { content: [{ type: 'text', text: `๐Ÿ”„ Loop "${name}" created!\n\nType: ${type}\nRhythm: ${rhythm}\n\n${this.visualizeLoopPattern(type)}\n\nThe ${type} loop is ready with ${rhythm} rhythm.` }] }; }, createVibe(args) { const { name, energy, frequency = 50, rhythm = 'ambient' } = args; const vibe = { name, energy, frequency, rhythm }; this.vibes.set(name, vibe); this.rhythms.set(`vibe_${name}`, this.generateRhythm(rhythm)); return { content: [{ type: 'text', text: `โœจ Vibe "${name}" created!\n\nEnergy: ${energy}\nFrequency: ${frequency} Hz\nRhythm: ${rhythm}\n\n${this.visualizeVibeEnergy(energy, frequency)}\n\nThe ${energy} vibe resonates at ${frequency}Hz with ${rhythm} rhythm.` }] }; }, visualizeSystem(args) { const lines = Array.from(this.lines.values()); const loops = Array.from(this.loops.values()); const vibes = Array.from(this.vibes.values()); let viz = '๐ŸŽจ LINES-LOOPS-VIBES SYSTEM\n\n'; if (lines.length > 0) { viz += 'ใ€ฐ๏ธ LINES:\n'; lines.forEach(line => viz += ` ${line.name}: ${line.from} โ†’ ${line.to} [${line.rhythm}]\n`); viz += '\n'; } if (loops.length > 0) { viz += '๐Ÿ”„ LOOPS:\n'; loops.forEach(loop => viz += ` ${loop.name}: ${loop.type} [${loop.rhythm}]\n`); viz += '\n'; } if (vibes.length > 0) { viz += 'โœจ VIBES:\n'; vibes.forEach(vibe => viz += ` ${vibe.name}: ${vibe.energy} @ ${vibe.frequency}Hz [${vibe.rhythm}]\n`); viz += '\n'; } viz += this.visualizeSystemRhythm(args.time_window); return { content: [{ type: 'text', text: viz }] }; } }; // Test create_line console.log('Testing create_line:'); try { const result = server.createLine({ name: 'test_line', from: 'start', to: 'end', rhythm: 'flowing' }); console.log(result.content[0].text); console.log('โœ… create_line works!\n'); } catch (error) { console.error('โŒ create_line failed:', error.message); } // Test create_loop console.log('Testing create_loop:'); try { const result = server.createLoop({ name: 'test_loop', type: 'spiral', rhythm: 'fibonacci' }); console.log(result.content[0].text); console.log('โœ… create_loop works!\n'); } catch (error) { console.error('โŒ create_loop failed:', error.message); } // Test create_vibe console.log('Testing create_vibe:'); try { const result = server.createVibe({ name: 'test_vibe', energy: 'intense', frequency: 60, rhythm: 'driving' }); console.log(result.content[0].text); console.log('โœ… create_vibe works!\n'); } catch (error) { console.error('โŒ create_vibe failed:', error.message); } // Test visualize_system console.log('Testing visualize_system:'); try { const result = server.visualizeSystem({ show_rhythms: true, time_window: 8 }); console.log(result.content[0].text); console.log('โœ… visualize_system works!\n'); } catch (error) { console.error('โŒ visualize_system failed:', error.message); } console.log('๐ŸŽ‰ All tests completed!');