Files
vinihcrosaandClaude Opus 4.8 4a1727e13e feat(api): WebSocket /ws gateway + message router
Add @fastify/websocket (v8, Fastify 4) and a GET /ws endpoint. MessageRouter
validates inbound ClientMessages (TypeBox), dispatches to SimulationManager,
binds each connection to its sim_id on Create/Attach, and maps worker events
to ServerMessage frames. REST routes coexist unchanged.

Task: task_05. Tests: 31 passing (real Fastify + WebSocket roundtrip,
malformed-message handling, REST coexistence); branches 82.5%.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-03 20:31:36 -03:00

33 lines
783 B
JSON

{
"name": "@ymir/api",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"dev": "tsx watch src/index.ts",
"build": "tsc",
"start": "node dist/index.js",
"clean": "rm -rf dist",
"test": "vitest run --coverage"
},
"dependencies": {
"@fastify/cors": "^9.0.1",
"@fastify/websocket": "^8.3.1",
"@sinclair/typebox": "^0.34.0",
"@ymir/types": "workspace:*",
"@ymir/wasm": "workspace:*",
"better-sqlite3": "^11.0.0",
"drizzle-orm": "^0.44.0",
"fastify": "^4.29.0"
},
"devDependencies": {
"@types/better-sqlite3": "^7.6.0",
"@types/node": "^22.0.0",
"@vitest/coverage-v8": "^4.1.9",
"drizzle-kit": "^0.30.0",
"tsx": "^4.19.0",
"typescript": "^5.8.0",
"vitest": "^4.1.9"
}
}