Member Junction
    Preparing search index...

    The minimal, session-scoped view of the realtime runner's server-side channel plane that import('./index').AIBridgeEngine needs to wire a bridged session's channels — declared here (not imported from @memberjunction/ai-agents) so the bridge-server engine does not take a heavy dependency on the agents package. The runner-constructing layer (which already depends on @memberjunction/ai-agents) supplies an adapter binding these to RealtimeChannelServerHost.OnSessionStarted / GetSessionServerTools / ExecuteSessionServerTool / OnSessionClosed and constructs the per-session MeetingControlsChannelServer from a driver's IBridgeMeetingControlsEventSource.

    The engine calls StartSessionChannels at connect (passing the driver's optional Meeting Controls event source + the runner session's perception sink), then reads GetSessionServerTools / routes ExecuteSessionServerTool, and calls CloseSessionChannels at teardown.

    interface IBridgeChannelHost {
        CloseSessionChannels(sessionId: string): Promise<void>;
        ExecuteSessionServerTool(
            sessionId: string,
            toolName: string,
            argsJson: string,
        ): Promise<BridgeChannelToolResult>;
        GetSessionServerTools(sessionId: string): BridgeChannelToolDefinition[];
        StartSessionChannels(
            sessionId: string,
            meetingControls: IBridgeMeetingControlsEventSource,
            sendContextNote?: (text: string) => void,
        ): Promise<void>;
    }
    Index

    Methods

    • Tears down the session's server-side channels (RealtimeChannelServerHost.OnSessionClosed). Never throws.

      Parameters

      • sessionId: string

        The session whose channels to close.

      Returns Promise<void>

    • Routes ONE server-channel tool call to the session's owning channel and returns its result. Bound by the runner-constructing layer to the runner's ExecuteServerChannelTool hook. Never throws — an unowned tool / unknown session / throwing channel resolves to { Success: false }.

      Parameters

      • sessionId: string

        The session the tool call belongs to.

      • toolName: string

        The full (prefixed) tool name the model invoked.

      • argsJson: string

        The raw arguments JSON the model emitted.

      Returns Promise<BridgeChannelToolResult>

    • Starts the session's server-side channels. The host registers the session with the channel plane (RealtimeChannelServerHost.OnSessionStarted) and, when an IBridgeMeetingControlsEventSource is supplied, constructs + registers a MeetingControlsChannelServer bound to it, feeding the supplied sendContextNote perception sink into the channel context.

      Never throws to the engine — a channel-plane failure must not break a live bridged session.

      Parameters

      • sessionId: string

        The MJ: AI Agent Sessions row id whose channels to start.

      • meetingControls: IBridgeMeetingControlsEventSource

        The driver's Meeting Controls event source, or null when the driver contributes none.

      • OptionalsendContextNote: (text: string) => void

        The runner session's perception sink (IRealtimeSession.SendContextNote), or undefined when the provider can't inject mid-session — channels degrade gracefully.

      Returns Promise<void>