Member Junction
    Preparing search index...

    Host services handed to a BaseRealtimeChannelClient at BaseRealtimeChannelClient.Initialize.

    The context is the plugin's ONLY line back to the live session — channels never talk to RealtimeSessionService (or any host component) directly, which is what keeps them drop-in plugins. Every member is host-implemented:

    • the SESSION SERVICE supplies SendContextNote (perception feed into the live model), RequestSave (debounced state-of-record persistence onto the session's MJ: AI Agent Session Channels row) and AgentName;
    • the OVERLAY SHELL wires SetFocusMode (through the service's focus stream) so a channel surface can request the focus layout — main call column collapsed, surface panel filling the overlay, floating call pill riding on top.
    interface RealtimeChannelContext {
        AgentName: string;
        AgentSessionID: string | null;
        AppContext$?: Observable<AppContextSnapshot | null>;
        Provider: IMetadataProvider | null;
        ExecuteClientTool?(
            name: string,
            params: Record<string, unknown>,
        ): Promise<{ ErrorMessage?: string; Result?: unknown; Success: boolean }>;
        ExecuteServerAction<TResult>(
            query: string,
            variables: Record<string, JSONValue>,
        ): Promise<TResult | null>;
        RequestSave(stateJson: string): void;
        RequestSpokenResponse?(instructions: string): void;
        SaveAsArtifact(name: string, contentJson: string): Promise<string | null>;
        SendContextNote(text: string): void;
        SetFocusMode(on: boolean): void;
    }
    Index

    Properties

    AgentName: string

    Display name of the agent the live session fronts (e.g. "Sage"), fixed at session start.

    AgentSessionID: string | null

    The live MJ: AI Agent Sessions id this channel belongs to, or null before the session has minted / after it has torn down. A channel whose tools or surface drive a SERVER-SIDE resource (e.g. the Remote Browser channel's server-hosted browser) passes this as the agentSessionID argument to its own GraphQL resolvers via ExecuteServerAction. Most channels (whiteboard, shared doc) keep all state client-side and never read it.

    AppContext$?: Observable<AppContextSnapshot | null>

    OPTIONAL — the live app-context stream (where the user is, what they see, and the available client-tool + agent manifest), pushed by the host (Explorer) at session start and on subsequent changes. The headless ClientContextChannel subscribes to this and streams deltas to the model via SendContextNote. Absent on hosts that don't supply app context (e.g. custom apps); channels must read it null-safely.

    Provider: IMetadataProvider | null

    The MJ metadata provider the live session runs on — the SAME IMetadataProvider instance that authenticates the session (NOT necessarily the global default). A channel whose surface renders MemberJunction-backed data (e.g. the Media channel streaming an MJ: Files record through mj-storage-media-player) threads THIS provider into its surface / GraphQL calls so it stays multi-provider safe. null only in degenerate/early states; channels fall back to the global default when absent.

    Methods

    • OPTIONAL — executes a host-registered surface CLIENT TOOL by name (the handlers the host wired from the active surface's SetAgentClientTools). The headless ClientContextChannel's ContextTool proxy routes the model's { action, params } here so a surface tool runs in the browser with no server round-trip. Best-effort and tolerant — resolves to a structured result (never throws); Success: false for an unknown tool or a thrown handler. Absent on hosts that register no client tools.

      Parameters

      • name: string

        The client-tool name (the model's action).

      • params: Record<string, unknown>

        The tool parameters (the model's params).

      Returns Promise<{ ErrorMessage?: string; Result?: unknown; Success: boolean }>

      A structured result the channel serializes back to the model.

    • Executes a CHANNEL-SPECIFIC GraphQL operation against the session's MJ server — the escape hatch for channels backed by a SERVER-SIDE resource that the generic RequestSave / SaveAsArtifact contract doesn't cover (e.g. the Remote Browser channel driving a server-hosted browser through its own ExecuteRemoteBrowserAction mutation + RemoteBrowserSnapshot query).

      The host runs the operation through the SAME provider the live session uses, so the request rides the authenticated session. Best-effort and tolerant: a transport or server error resolves to null (logged host-side) rather than throwing, so a channel can map the failure to a model-readable result string without try/catch.

      Type Parameters

      • TResult

        The expected shape of the GraphQL operation's data payload.

      Parameters

      • query: string

        The GraphQL query/mutation document.

      • variables: Record<string, JSONValue>

        The operation variables (all JSON-serializable).

      Returns Promise<TResult | null>

      The operation's data payload, or null on any failure / when no session is live.

    • Asks the live model to SPEAK a response to the supplied instructions RIGHT NOW — the channel's "react to this" path, e.g. a widget submission the user expects an audible reaction to (SendContextNote deliberately never triggers speech). Rides the realtime client's spoken-update channel, so on some providers the spoken reply is narration-kind (ephemeral, not persisted as a caption). OPTIONAL member: older host contexts may not supply it — plugins must call it null-safely.

      Parameters

      • instructions: string

      Returns void

    • Persists a snapshot of the channel's state as a first-class versioned artifact (MJ: Artifacts + version, linked into conversation history when possible) — e.g. the whiteboard's "Save to artifacts". Distinct from RealtimeChannelContext.RequestSave, which maintains the session's rolling state of record. Best-effort: resolves to the created Artifact ID, or null on failure (logged host-side, never thrown). Works during the call AND right after it ends (the host retains the session id for late saves).

      Parameters

      • name: string
      • contentJson: string

      Returns Promise<string | null>