feat: communication spine — gateway, TUI, Discord

Gateway:
- Agent service wrapping Pi SDK createAgentSession (in-process)
- Chat WebSocket gateway (Socket.IO) streaming agent events
- Chat REST controller for synchronous requests
- NestJS module structure: AgentModule (global), ChatModule

CLI:
- Ink-based TUI client connecting to gateway via WebSocket
- Commander-based CLI with `mosaic tui` command
- Streaming message display with React components

Discord:
- Discord.js bot with mention-based activation + DM support
- Routes messages through gateway WebSocket
- Chunked response delivery (2000-char Discord limit)
- Single-guild binding for v0.1.0

Architecture: All channels → Gateway WebSocket → Pi SDK → LLM

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-12 20:24:33 -05:00
parent 888bc32be1
commit 98380e610d
14 changed files with 5009 additions and 10 deletions

View File

@@ -1,10 +1,11 @@
{
"name": "@mosaic/cli",
"version": "0.0.0",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"bin": {
"mosaic": "dist/index.js"
"mosaic": "dist/cli.js"
},
"exports": {
".": {
@@ -14,11 +15,22 @@
},
"scripts": {
"build": "tsc",
"dev": "tsx src/cli.ts",
"lint": "eslint src",
"typecheck": "tsc --noEmit",
"test": "vitest run"
},
"dependencies": {
"ink": "^5.0.0",
"ink-text-input": "^6.0.0",
"ink-spinner": "^5.0.0",
"react": "^18.3.0",
"socket.io-client": "^4.8.0",
"commander": "^13.0.0"
},
"devDependencies": {
"@types/react": "^18.3.0",
"tsx": "^4.0.0",
"typescript": "^5.8.0",
"vitest": "^2.0.0"
}