import { HomeRequest, HomeSnapshot, HubLifecycleSnapshot, HubSessionView, HubWorkspaceView, ProtocolClient } from "@agimon-ai/po-core/sessionProtocol"; import { PoPluginCall } from "@agimon-ai/po-core/pluginProtocol"; //#region src/web/lib/protocolHubSocket.d.ts type Frame = Record; export interface SessionSocket { /** Holds the extension channels of exactly these sessions. */ watchSessions(sessionIds: Iterable): void; /** Follows one child thread until the returned function is called. */ watchThread(sessionId: string, threadId: string): () => void; /** Sends one extension channel frame `{ type, sessionId, payload }` to its session. */ send(frame: object): void; invokePlugin(call: PoPluginCall): Promise; readHome(request: HomeRequest, signal?: AbortSignal): Promise; close(): void; } export interface SessionSocketHandlers { onSessions(sessions: HubSessionView[]): void; onWorkspaces(workspaces: HubWorkspaceView[]): void; /** Caller-specific rights, already qualified to this connection's host. Empty means unknown, not writable. */ onAccess?(interact: Readonly>): void; /** Optional startup projection. Empty means unavailable, including on older servers. */ onLifecycle?(sessions: Readonly>): void; /** A notification entry or agent dialog of any visible session, delivered once. */ onNotice(sessionId: string, frame: Frame): void; /** An extension channel frame `{ type, sessionId, payload }` of a watched session. */ onChannel(frame: Frame): void; onThreadFrame(sessionId: string, threadId: string, frame: Frame): void; onOpen(): void; onClose(): void; /** A global or workspace plugin composition changed on the server; not heard for the value a fresh hold opens with. */ onCompositions?(): void; /** The server needs newer client code. Heard once, after `onClose`; the socket never reconnects. */ onUpdateRequired?(): void; } /** Caller-specific rights for a host connection, shared by sealed and cookie-admitted clients. */ export declare function watchHubAccess(client: ProtocolClient, onAccess: (rights: Readonly>) => void, hostId?: string): () => void; /** Optional lifecycle snapshots for a host connection, shared by sealed and cookie-admitted clients. */ export declare function watchHubLifecycle(client: ProtocolClient, onLifecycle: (snapshots: Readonly>) => void, hostId?: string): () => void; /** Hub, channels and threads over the page's one protocol connection; references survive reconnects. */ export declare function createProtocolHubSocket(client: ProtocolClient, handlers: SessionSocketHandlers, hostId?: string): SessionSocket; //#endregion export {}; //# sourceMappingURL=protocolHubSocket.d.mts.map