@atriumjs/protocol
v0.3.0
Published
Shared wire types and validation for Atrium remote browser sessions
Maintainers
Readme
@atriumjs/protocol
Shared Zod schemas and TypeScript types for Atrium WebSocket JSON messages (viewer ↔ API relay ↔ worker) and a few HTTP request bodies (session bootstrap).
Docs hub: docs/README.md · User guide: docs/user-guide.md
Install
npm install @atriumjs/protocolWith pnpm: pnpm add @atriumjs/protocol.
Most applications do not need to install this directly; @atriumjs/express, @atriumjs/react, and @atriumjs/worker depend on it automatically. Install it directly when you want to validate wire messages or bootstrap payloads yourself.
Usage
import { parseServerMessage, parseClientMessage, serverMessageSchema } from "@atriumjs/protocol";
const msg = parseServerMessage(JSON.parse(text));
if (msg.t === "tabs") {
console.log(msg.tabs);
}Main exports:
serverMessageSchema,ServerMessage—hello,frame,control,navigate,title,tabs,webauthn_required,bye, …clientMessageSchema,ClientMessage—input,ping,tab_activate,tab_close,webauthn_decision,reload,back,forward, …parseServerMessage,parseClientMessagesessionBootstrapBodySchema,sessionSnapshotApplyBodySchema,clientCertificateSchema(TLS mTLS bootstrap), …
Source of truth: src/index.ts.
Build
pnpm --filter @atriumjs/protocol run buildMIT — see repository LICENSE.
