Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

2.3 KB
Raw Blame
import type { BackgroundEffect } from '@core/media/background-effect';
import type { Accessor } from 'solid-js';
import type { MeetingSessionLifecycle } from './meeting-session-lifecycle';

export type MeetingCredentials = {
  callId: string;
  channelId: string | null;
  roomName: string;
  serverUrl: string;
  token: string;
  participantId: string;
  shareToken: string | null;
  started: boolean;
};

/** Live waiting-room capture tracks; whoever holds them must stop them. */
export type MeetingLocalTracks = {
  microphone?: MediaStreamTrack;
  camera?: MediaStreamTrack;
};

export type MeetingMediaDiagnostics = {
  setupId: string;
  microphone:
    | 'not_requested'
    | 'pending'
    | 'granted'
    | 'blocked'
    | 'failed'
    | 'cancelled';
  camera:
    | 'not_requested'
    | 'pending'
    | 'granted'
    | 'blocked'
    | 'failed'
    | 'cancelled';
};

export type MeetingMediaPreferences = {
  microphoneEnabled: boolean;
  cameraEnabled: boolean;
  microphoneDeviceId?: string;
  cameraDeviceId?: string;
  speakerDeviceId?: string;
  backgroundEffect?: BackgroundEffect;
  /** Owned by `connect` once passed; the session stops them on early exits. */
  localTracks?: MeetingLocalTracks;
};

/** The session owns only the connection it joined, including late replies. */
export type MeetingSessionCapabilities = {
  lifecycle: MeetingSessionLifecycle;
  /** Fetch browser call code during setup, without creating or connecting a call. */
  warmup?: () => Promise<void>;
  shareToken: Accessor<string>;
  isInCall: Accessor<boolean>;
  activeCallId: Accessor<string | null>;
  /** Prepare a draft before requesting credentials; stop side effects if aborted. */
  prepare?: (signal: AbortSignal) => Promise<void>;
  join: (displayName?: string) => Promise<MeetingCredentials>;
  release: (
    shareToken: string,
    token: string
  ) => Promise<{ callEnded: boolean } | void>;
  connect: (
    credentials: MeetingCredentials,
    preferences: MeetingMediaPreferences
  ) => Promise<void>;
  disconnect: () => Promise<void>;
};

export type MeetingPageState =
  | { kind: 'loading' }
  | { kind: 'unavailable' }
  | {
      kind: 'ready';
      title: string;
      scheduledStart: string | null;
      scheduledEnd: string | null;
      /** Channel-linked meetings are members-only; guests cannot join them. */
      channelId: string | null;
    };