Skip to main content

Room Types

Room types define the structure and metadata for collaborative spaces where participants share LLM endpoints.

RoomInfo

Internal room information schema including all fields used by the hub.
import { z } from "zod";

const RoomInfoInternal = z.object({
  id: z.string(),
  code: z.string(),
  name: z.string(),
  hostId: z.string(),
  createdAt: z.number(),
  passwordHash: z.string().optional(),
});

type RoomInfo = z.infer<typeof RoomInfoInternal>;
id
string
required
Unique identifier for the room
code
string
required
Human-readable room code used for joining (e.g., “swift-eagle-42”)
name
string
required
Display name of the room
hostId
string
required
ID of the participant who created the room
createdAt
number
required
Unix timestamp (milliseconds) when the room was created
passwordHash
string
Optional hashed password for room protection. Only stored internally.

RoomInfoPublic

Public room information schema that excludes sensitive fields like passwordHash. This is used in API responses.
const RoomInfoPublic = RoomInfoInternal.omit({ passwordHash: true });

type RoomInfoPublic = z.infer<typeof RoomInfoPublic>;
id
string
required
Unique identifier for the room
code
string
required
Human-readable room code used for joining
name
string
required
Display name of the room
hostId
string
required
ID of the participant who created the room
createdAt
number
required
Unix timestamp (milliseconds) when the room was created

Usage Example

import { RoomInfo, RoomInfoPublic } from "@gambiarra/core";

// Internal usage (includes passwordHash)
const internalRoom: RoomInfo = {
  id: "room_abc123",
  code: "swift-eagle-42",
  name: "Team Dev Session",
  hostId: "participant_xyz789",
  createdAt: Date.now(),
  passwordHash: "$2b$10$...",
};

// Public API response (passwordHash omitted)
const publicRoom: RoomInfoPublic = {
  id: "room_abc123",
  code: "swift-eagle-42",
  name: "Team Dev Session",
  hostId: "participant_xyz789",
  createdAt: Date.now(),
};

Build docs developers (and LLMs) love