feat: implement input event system with durable command handling

- Introduced InputEvent model with status tracking (PENDING, PROCESSING, SUCCEEDED, FAILED) and unique request IDs.
- Added DatabaseTurnDaemonTransport for sending commands and handling idempotency.
- Implemented executeInputEvent function to manage input event lifecycle and error handling.
- Created DatabaseTurnDaemonCommandQueue for managing command processing and lease recovery.
- Enhanced turn daemon lifecycle to support atomic command execution and error recovery.
- Added tests for input event atomicity, command queuing, and error handling scenarios.
This commit is contained in:
2026-07-25 05:36:34 +00:00
parent c5da507df9
commit 5040691d7c
34 changed files with 1587 additions and 448 deletions
+7 -4
View File
@@ -8,11 +8,14 @@ import { runTournamentWorker } from './tournament/worker.js';
export * from './config.js';
export * from './context.js';
export * from './inputEventBoundary.js';
export * from './router.js';
export * from './server.js';
export * from './daemon/types.js';
export * from './daemon/streamKeys.js';
export * from './daemon/transport.js';
export * from './daemon/databaseTransport.js';
export * from './daemon/idempotentTransport.js';
export * from './daemon/inMemoryTransport.js';
export * from './daemon/redisTransport.js';
export * from './auth/flushStore.js';
@@ -51,10 +54,10 @@ if (isMain()) {
role === 'battle-sim-worker'
? runBattleSimWorker
: role === 'auction-worker'
? runAuctionWorker
: role === 'tournament-worker'
? runTournamentWorker
: runGameApiServer;
? runAuctionWorker
: role === 'tournament-worker'
? runTournamentWorker
: runGameApiServer;
run().catch((error) => {
console.error('[game-api] failed to start', error);
process.exitCode = 1;