Skip to content

fix: typescript forward model - #113

Merged
thegalah merged 3 commits into
masterfrom
feat/typescript-fwd-example
Jul 25, 2026
Merged

fix: typescript forward model#113
thegalah merged 3 commits into
masterfrom
feat/typescript-fwd-example

Conversation

@thegalah

Copy link
Copy Markdown
Contributor

No description provided.

thegalah added 3 commits July 25, 2026 10:31
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).
@thegalah
thegalah merged commit 32ff7e5 into master Jul 25, 2026
1 check passed
@thegalah
thegalah deleted the feat/typescript-fwd-example branch July 25, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant