Member Junction
    Preparing search index...

    Server half of the Media interactive channel. One instance per realtime session (created by RealtimeChannelServerHost from the channel registry — never construct directly).

    On each landed state save (OnChannelStateSave):

    • payload parses to a JSON object → persist the canonical compact re-serialization;
    • payload is malformed JSON or a non-object → log loudly and keep the original unchanged (persistence is never blocked; the client's RestoreState is tolerant of bad payloads, so flag-don't-drop is the safe posture, matching WhiteboardChannelServer).

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    The bound session context, available from Initialize until Dispose. null outside that window — guard with ?. in any code that can run early/late.

    Accessors

    • get ToolNamePrefix(): string

      The shared name prefix of every server-executed tool this channel contributes (e.g. 'MeetingControls_'). The host routes any tool call whose name starts with this prefix to THIS plugin's ExecuteServerTool, which is what prevents tool-name collisions when multiple channels are active in one session. A channel that contributes no server tools may leave the default empty string (the host then never routes any call to it).

      Mirrors the client half's ToolNamePrefix. Default: '' (no server tools).

      Returns string

    Methods

    • Executes ONE of this channel's server-side tools (a tool whose name starts with ToolNamePrefix) and returns the result fed back to the model as the tool_response.

      Implementations should NOT throw — return a { Success: false, Output } result so the model can narrate the failure. The host additionally wraps anything thrown into a structured error, so a throwing implementation can never break the live session. The default implementation returns a structured "not implemented" error, so a channel that declares tools via GetServerToolDefinitions but forgets to implement execution fails safely and visibly.

      Parameters

      • toolName: string

        The full tool name the model invoked (begins with ToolNamePrefix).

      • argsJson: string

        The raw arguments JSON string the model emitted for the call.

      Returns ServerChannelToolResult | Promise<ServerChannelToolResult>

      The execution result (or a structured error), synchronously or as a promise.

    • Returns this channel's server-executed tool declarations — the tools the agent can invoke on this channel that run server-side (a bot has no browser). May be runtime-computed: the returned set can depend on the live session, the connected platform, or current channel state, so a bridge-contributed channel can declare a vocabulary that only exists because of the live connection. Every tool's Name SHOULD start with ToolNamePrefix so the host can route its execution back here unambiguously.

      Invoked by RealtimeChannelServerHost when assembling the session's tool set (after the plugin's OnSessionStarted). Default: [] (a state-only channel contributes none).

      Returns RealtimeToolDefinition[]

      The channel's server-executed tool definitions (possibly empty).

    • Media tracks this channel can SOURCE — samples flowing from the channel's surface INTO the model. Default []: a channel contributes no media unless it says so.

      This is where the media plane and the semantic plane meet. A channel remains a tool surface; declaring a sourced track additionally lets the model watch that surface live. The whiteboard sourcing inbound video is what lets an agent see what it draws and correct itself mid-stroke, and see what the user draws directly rather than through a described diff. The remote browser sourcing inbound video is what lets the model watch the page continuously while the agent still acts through tools — a different quality of control, not a faster version of polling screenshots.

      Declared in CODE rather than metadata for the same reason GetServerToolDefinitions is: whether a surface can produce frames is a property of the implementation, not a deployment choice. Whether it should on a given session is negotiation (ModelConfiguration.Realtime.RequestedTracks intersected with the model's support), and a model with no video track simply falls back to the channel's tool-only behaviour.

      Returns readonly RealtimeTrackDescriptor[]

      Track descriptors this channel can produce (possibly empty).

    • Media tracks this channel can SINK — samples flowing from the model OUT to the channel's surface. Default [].

      Nothing in play emits non-audio outbound media yet; the contract admits it because direction is a property of a track rather than part of its type. An avatar is the obvious first case: a channel owning a render surface that sinks outbound video.

      Returns readonly RealtimeTrackDescriptor[]

      Track descriptors this channel can consume (possibly empty).

    • Validates + canonicalizes a landed media-state save (see the class doc for the contract).

      Parameters

      • stateJson: string

        The serialized media state the client submitted ({ Items, ActiveItemId }).

      Returns Promise<string>

      The compact canonical JSON when the payload is a valid object and differs from the input; null (= keep the original) otherwise.

    • Subclass hook invoked from Initialize once Context is bound — allocate any per-session state here. Default: no-op.

      Returns void

    • Invoked when the session is closed — from ANY close path: the user's explicit hang-up, the janitor's orphan/staleness sweeps, the graceful shutdown drain, or an error-path teardown (the reason says which). Fired once per session; Dispose follows after the host's brief post-close linger window (during which late state saves still route here first). Default: no-op.

      Parameters

      Returns Promise<void>

    • Resolves the agent's curated media kit (a bound MJ: Collections of artifacts) into a manifest and feeds it to the live model as a background context note, so the agent knows what it can show (and surfaces items via the existing Media_ShowMedia tool). Best-effort: any failure is logged and the session proceeds with no kit (the host also wraps this in try/catch).

      Returns Promise<void>