Gateway Protocol Frame Schemas (schema/frames.ts)

bitterbot-desktop · src/gateway/protocol/schema/frames.ts · typescript · MIT
database, integration, infra, tag:embed-classified, tag:typebox, tag:validation, tag:protocol

Defines TypeBox validation schemas for all gateway communication frames (tick, shutdown, connect, hello, error, request, response, event). Reuse for client/server protocol validation.

// Source: https://github.com/Bitterbot-AI/bitterbot-desktop | License: MIT | Copyright 2025-2026 Victor Michael Gil / Bitterbot AI
// Provided via justclaw.it.com; keep this notice with the code.
import { Type } from "@sinclair/typebox";
import { GatewayClientIdSchema, GatewayClientModeSchema, NonEmptyString } from "./primitives.js";
import { SnapshotSchema, StateVersionSchema } from "./snapshot.js";

export const TickEventSchema = Type.Object(
  {
    ts: Type.Integer({ minimum: 0 }),
  },
  { additionalProperties: false },
);

export const ShutdownEventSchema = Type.Object(
  {
    reason: NonEmptyString,
    restartExpectedMs: Type.Optional(Type.Integer({ minimum: 0 })),
  },
  { additionalProperties: false },
);

export const ConnectParamsSchema = Type.Object(
  {
    minProtocol: Typ

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key