fix: typescript forward model - #113
Merged
Merged
Conversation
The README listed a "TypeScript-fwd" kit but no forward-model example ever existed (only the basic Agent.ts). This adds one, mirroring the Python-fwd setup. The forward model is a separate engine instance run with role=admin (default port 6969): you send it a state + hypothetical actions and it returns the resulting next state, for lookahead / tree search. The bundled @coderone/bomberland-library GameStateClient can send EvaluateNextState but does not surface the next_game_state reply (its message handler has no next-state case), so: - ForwardModel.ts: a small client owning its own `ws` socket that sends typed EvaluateNextState packets and delivers next_game_state via a callback. - Agent_fwd.ts: the basic random agent plus a per-tick forward-model call that logs the predicted next state. - package.json: add `ws` + `@types/ws`, and run:fwd / start:fwd scripts. - tsconfig: skipLibCheck (the pinned typescript@4.7 chokes on newer @types/node and @types/ws .d.ts files; our own code is still fully type-checked). - Dockerfile.fwd / Dockerfile.fwd.dev and base-compose typescript-fwd(-dev) services, mirroring python3-fwd. - Bump all four TS Dockerfiles off EOL node:12 to node:22-alpine. - Add a scoped .gitignore (the root ignore's `typescript/dist` never matched agents/typescript/dist, so build output would have been committed). Verified end-to-end against a running engine: the client captures a real game_state, sends evaluate_next_state, and receives the matching next_game_state back through the callback.
Type-checks the kit (basic agent + forward-model example) with tsc. The TypeScript kit's wire-protocol conformance is enforced at compile time by the typed @coderone/bomberland-library, so a tsc build is the meaningful check (no engine-schema drift gate as with Go/Rust — the types come from the npm package, not the schema file). - Triggers on changes to agents/typescript/** and the workflow. - yarn install --frozen-lockfile + yarn build on node 22. GitHub-hosted runners.
Adds the forward-model example (Agent_fwd.ts / ForwardModel.ts) that the row promised, type-checked in CI (test-typescript-agent.yaml).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.