diff --git a/packages/server/package.json b/packages/server/package.json index 8aac4f7..fd54035 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -19,7 +19,6 @@ "fastify": "^5.2.0", "js-chess-engine": "^2.4.6", "pino": "^9.5.0", - "ws": "^8.18.0", "zod": "^3.24.0" }, "devDependencies": { @@ -28,6 +27,7 @@ "pino-pretty": "^11.3.0", "tsx": "^4.19.2", "typescript": "^5.6.0", - "vitest": "^3.0.0" + "vitest": "^3.0.0", + "ws": "^8.18.0" } } diff --git a/packages/server/src/bot/candidates.ts b/packages/server/src/bot/candidates.ts index 9e7fe69..1bdac3e 100644 --- a/packages/server/src/bot/candidates.ts +++ b/packages/server/src/bot/candidates.ts @@ -27,11 +27,7 @@ function vanillaCandidates(game: Game, color: Color): CandidateMove[] { const moves = game.chess.moves({ verbose: true }) as Array<{ from: Square; to: Square; promotion?: PromotionType; }>; - const out: CandidateMove[] = []; - for (const m of moves) { - out.push({ from: m.from, to: m.to, promotion: m.promotion }); - } - return out; + return moves.map((m) => ({ from: m.from, to: m.to, promotion: m.promotion })); } function blindCandidates(game: Game, color: Color): CandidateMove[] { diff --git a/packages/server/src/bot/index.ts b/packages/server/src/bot/index.ts deleted file mode 100644 index 6b084ca..0000000 --- a/packages/server/src/bot/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -export type { - Brain, BrainInput, BrainAction, BrainInitArgs, - CandidateMove, AttemptHistoryEntry, -} from './brain.js'; -export { CasualBrain } from './casual-brain.js'; -export { BotDriver } from './driver.js'; -export { legalCandidates } from './candidates.js'; diff --git a/packages/server/src/server.ts b/packages/server/src/server.ts index f3f8918..d4c2697 100644 --- a/packages/server/src/server.ts +++ b/packages/server/src/server.ts @@ -12,7 +12,8 @@ import { } from './games.js'; import { attachSocket } from './ws.js'; import { createGameSchema } from './validation.js'; -import { CasualBrain, BotDriver } from './bot/index.js'; +import { CasualBrain } from './bot/casual-brain.js'; +import { BotDriver } from './bot/driver.js'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); diff --git a/packages/server/test/integration/ai-game-casual.test.ts b/packages/server/test/integration/ai-game-casual.test.ts index a7d7671..4279cc9 100644 --- a/packages/server/test/integration/ai-game-casual.test.ts +++ b/packages/server/test/integration/ai-game-casual.test.ts @@ -7,7 +7,8 @@ import { } from '../../src/games.js'; import { attachSocket } from '../../src/ws.js'; import { createGameSchema } from '../../src/validation.js'; -import { CasualBrain, BotDriver } from '../../src/bot/index.js'; +import { CasualBrain } from '../../src/bot/casual-brain.js'; +import { BotDriver } from '../../src/bot/driver.js'; import type { ServerMessage } from '@blind-chess/shared'; let app: ReturnType; diff --git a/packages/server/tsconfig.tsbuildinfo b/packages/server/tsconfig.tsbuildinfo deleted file mode 100644 index 2c4ebff..0000000 --- a/packages/server/tsconfig.tsbuildinfo +++ /dev/null @@ -1 +0,0 @@ -{"root":["./src/commit.ts","./src/games.ts","./src/ratelimit.ts","./src/server.ts","./src/state.ts","./src/translator.ts","./src/validation.ts","./src/view.ts","./src/ws.ts"],"version":"5.9.3"} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b3c32f6..e3478f5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -63,9 +63,6 @@ importers: pino: specifier: ^9.5.0 version: 9.14.0 - ws: - specifier: ^8.18.0 - version: 8.20.0 zod: specifier: ^3.24.0 version: 3.25.76 @@ -88,6 +85,9 @@ importers: vitest: specifier: ^3.0.0 version: 3.2.4(@types/node@22.19.17)(tsx@4.21.0) + ws: + specifier: ^8.18.0 + version: 8.20.0 packages/shared: devDependencies: