Initial Commit
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
# OpenSpec Change: enterprise-gaming-api-plugin-game-server
|
||||
|
||||
- **Change ID**: enterprise-gaming-api-plugin-game-server
|
||||
- **Package**: `@suaveplan/api-plugin-game-server`
|
||||
- **Category**: gaming/server
|
||||
- **Target path**: `gaming/server/api-plugin-game-server`
|
||||
- **Status**: PROPOSED
|
||||
- **Date**: 2026-04-24
|
||||
- **Reference spec**: `/mnt/s/web/suaveplan/enterprise/api-plugin-game-server.md`
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
Deliver `@suaveplan/api-plugin-game-server` on the genesis branch from scratch at enterprise quality. The package wraps `@suaveplan/game-server`'s `SessionManager` in a Hono HTTP plugin. Routes expose session lifecycle (create, list, join, leave, heartbeat, terminate), player management (add/remove/list), and server health. A `definePlugin()` factory registers the `SessionManager` as an injectable service. Genesis adds Zod request/response schemas, structured errors, OTel route instrumentation, and 100% coverage with Hono test client integration tests.
|
||||
|
||||
---
|
||||
|
||||
## Current-state audit (genesis)
|
||||
|
||||
Package does not exist on genesis yet — fresh build.
|
||||
|
||||
---
|
||||
|
||||
## Available workspace deps on genesis
|
||||
|
||||
| Package | Role |
|
||||
|---|---|
|
||||
| `@suaveplan/error` (`workspace:^`) | HTTP error mapping |
|
||||
| `@suaveplan/game-server` (`workspace:^`) | `SessionManager`, `Session` core logic |
|
||||
| `@suaveplan/events` (`workspace:^`) | Session event forwarding |
|
||||
| `zod` (`catalog:forms`) | Request/response schemas |
|
||||
| `@opentelemetry/api` (`catalog:observability`) | Route span instrumentation |
|
||||
|
||||
---
|
||||
|
||||
## HTTP Routes
|
||||
|
||||
| Method | Path | Description |
|
||||
|---|---|---|
|
||||
| `POST` | `/sessions` | Create session |
|
||||
| `GET` | `/sessions` | List sessions |
|
||||
| `GET` | `/sessions/:id` | Get session |
|
||||
| `DELETE` | `/sessions/:id` | Terminate session |
|
||||
| `POST` | `/sessions/:id/join` | Player join |
|
||||
| `POST` | `/sessions/:id/leave` | Player leave |
|
||||
| `POST` | `/sessions/:id/heartbeat` | Update heartbeat |
|
||||
| `GET` | `/sessions/:id/players` | List players |
|
||||
| `GET` | `/health` | Session manager health |
|
||||
|
||||
---
|
||||
|
||||
## File layout
|
||||
|
||||
```text
|
||||
gaming/server/api-plugin-game-server/
|
||||
package.json
|
||||
tsconfig.json
|
||||
vitest.config.ts
|
||||
src/
|
||||
index.ts
|
||||
error-codes.ts
|
||||
types/common.ts
|
||||
types/common.md
|
||||
routes/
|
||||
sessions.ts
|
||||
sessions.md
|
||||
players.ts
|
||||
health.ts
|
||||
plugin.ts
|
||||
plugin.md
|
||||
tests/
|
||||
integration.test.ts
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Impact
|
||||
|
||||
**Downstream**: `@suaveplan/api-plugin-matchmaking` posts to this to assign matches. Prerequisites: `@suaveplan/error`, `@suaveplan/game-server`, `@suaveplan/events`.
|
||||
Reference in New Issue
Block a user