@hotrepl/protocol
v3.0.0
Published
Canonical HotRepl v2 wire protocol types and JSON Schemas.
Downloads
279
Maintainers
Readme
@hotrepl/protocol
TypeScript types and JSON schemas for the HotRepl WebSocket protocol — the wire format a HotRepl-instrumented Unity game speaks to its clients (SDK, CLI, MCP server, custom integrations).
Most consumers should depend on @hotrepl/sdk
instead. Use this package directly only when you are building an alternative SDK, a non-TypeScript
client, or a tool that needs the schemas (e.g., a code generator or a test fixture validator).
Install
bun add @hotrepl/protocol # or: npm install @hotrepl/protocolWhat's in the box
- TypeScript types for every protocol message (
HandshakeMessage,EvalResultMessage,CommandCallMessage,JobAcceptedMessage,SessionEvictedMessage, …). - Discriminant constants —
MESSAGE_TYPES,PROTOCOL_VERSION,ERROR_KINDS,defaultLimits. - JSON Schema files for every public message, exported under
schemas/and generated from the same TypeScript source viabun run schemas:export.
Usage
import { type HandshakeMessage, MESSAGE_TYPES, PROTOCOL_VERSION } from "@hotrepl/protocol";
function isHandshake(message: { type: string }): message is HandshakeMessage {
return message.type === MESSAGE_TYPES.handshake;
}Schemas (Draft 2020-12) live alongside the types if you need to validate wire frames:
import handshakeSchema from "@hotrepl/protocol/schemas/handshake.schema.json"
with { type: "json" };Reference
- Full protocol reference:
docs/control-plane-protocol.md - Repository: github.com/glockyco/HotRepl
- Issues: github.com/glockyco/HotRepl/issues
License
MIT
