deriveActivity (activityState.ts)

diorama-builder · realtime

Activity State System — derives visual activity from gateway events. Maps event type + room preset → agent activity for 3D visualization. Pure functions, no React/Three.js dependencies. /

// Source: https://github.com/hitesh153/diorama-builder | License: MIT | Copyright 2026 Hitesh Goyal
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Activity State System — derives visual activity from gateway events.
 *
 * Maps event type + room preset → agent activity for 3D visualization.
 * Pure functions, no React/Three.js dependencies.
 */

export type AgentActivity =
  | "idle"
  | "talking"
  | "working"
  | "testing"
  | "presenting"
  | "listening"
  | "sending"
  | "reviewing";

export interface ActivityRecord {
  activity: AgentActivity;
  startedAt: number;
  eventType: string;
  eventLabel: string;
  roomPreset: string;
}

/** How long an agent stays in an activity before returning to idle (ms). */
export const ACTIVITY_TIMEOUT_MS = 8000;

/**
 * Event

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

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

Get a free API key