Skip to content
PEERLESSDocs

Types

The main data shapes returned by the SDK.

The full declarations, with comments, are in peerless-sdk.d.ts.

PlatformRuntime

interface PlatformRuntime {
  grantId?: string;
  guest?: boolean;
  mode: "managed_backend" | "developer_backend" | "peerless_rooms" | "none";
  endpoint?: string;
  hostingMode?: "listen" | "creator-dedicated" | "forge" | "legacy-managed" | "relay";
  endpoints?: { region: string; url: string }[];
  region?: string;
  token: string;
  playerId: string;
  playerName: string;
  buildId: string;
  gameId: string;
  expiresAt: number;
  intent: PartyIntent | null;
}

PartyIntent

interface PartyIntent {
  id: string;
  buildId: string;
  mode: string;
  version: number;
  status: "loading" | "ready" | "queueing" | "active" | "paused" | "cancelled" | "error";
  leaderId: string;
  members: { playerId: string; playerName: string; ready: boolean; state: string }[];
}

Social

interface SocialProfile {
  playerId: string;          // stable within this game
  playerName: string;
  avatarUrl: string | null;
  avatarFrame: string;
  nameStyle: string;
  membershipBadge: "plus" | "forge" | null;
  profileUrl: string | null;
}
interface SocialFriend extends SocialProfile {
  presence: "online" | "looking_for_party" | "away" | "busy" | "offline";
  activity: string;
  statusText: string;
}
interface SocialParty {
  id: string;
  leaderId: string;
  selectedGameId: string | null;
  members: (SocialProfile & { ready: boolean })[];
}

Capabilities and audio

interface PeerlessCapabilities {
  enhancedPlayer?: boolean;
  social?: boolean;
  socialUI?: boolean;
  multiplayer?: unknown;
  leaderboards?: boolean;
  achievements?: boolean;
}
interface PlayerAudio {
  muted: boolean;
  volume: number; // 0 to 1
}

SessionAdapter

interface SessionAdapter {
  queue?(options: { mode?: string; intent?: PartyIntent; runtime: PlatformRuntime }): Promise<unknown>;
  syncParty?(intent: PartyIntent | null): Promise<void>; // null releases the copied roster
  poll?(): Promise<unknown>;                             // each lobby heartbeat
  host?(options: Record<string, unknown>): Promise<unknown>;
  join?(options: Record<string, unknown>): Promise<unknown>;
  list?(options: Record<string, unknown>): Promise<unknown>;
  cancel?(): Promise<unknown>;
  reconnect?(runtime: PlatformRuntime): Promise<unknown>;
  dispose?(): void;
}