Zero drift
Rust exports JSON schemas from the real public engine types. TypeScript types are generated from those schemas on every build — no hand-maintained protocol definitions.
HTTP + WebSocket wire contracts generated straight from the Rust server, with runtime validation and a stateful session helper.
pnpm add @my-swu/simulator-clientimport { createEngineClient } from '@my-swu/simulator-client'
const client = createEngineClient({
baseUrl: 'http://127.0.0.1:4000',
})
const premierMainDeck = [
45, 35, 100, 105, 110, 115, 120, 125, 130,
135, 140, 145, 1228, 1230, 1232, 1243, 1244,
].flatMap(cardId => [cardId, cardId, cardId])
const host = await client.createMatch({
seed: 7,
format: 'premier',
hostDeck: {
leader: 46102,
base: 308,
cards: premierMainDeck,
},
})
const connection = await client.connectMatch({
matchId: host.matchId,
seatToken: host.seatToken,
})
connection.on('snapshot', snapshot => {
console.log('prompt:', snapshot.prompt)
})
connection.ready()Next steps: