/** * Browser-side gateway store: per-session state snapshots polled from the * host plus the floating-window visibility/position controller. Plain * module singletons + `useSyncExternalStore`; components never own the * polling lifecycle (the last subscriber for a session stops its timer). * * @module dsh-subagent-codex-plus/client/gateway-store */ import type { GatewayApi } from './api.ts'; import type { GatewaySessionView } from '../shared/types.ts'; /** One session's snapshot entry. */ export interface GatewayViewEntry { readonly view: GatewaySessionView | null; readonly loading: boolean; readonly error?: string; } /** Set the live API instance (client apply body). */ export declare function setGatewayApi(instance: GatewayApi): void; /** Subscribe a React component to one session's gateway snapshot. */ export declare function useGatewayView(sessionId: string | undefined): GatewayViewEntry; /** Force an immediate poll (after an action). */ export declare function refreshGateway(sessionId: string): void; /** Run one host action, refresh the session view, and return the error text. */ export declare function runGatewayAction(sessionId: string, action: (instance: GatewayApi) => Promise): Promise; /** Structural subset of GatewayActionResponse for the action helper. */ interface GatewayActionLike { readonly ok: boolean; readonly error?: string; } /** Floating-window visibility and position (module singleton). */ export interface PanelState { readonly open: boolean; readonly x: number; readonly y: number; /** Whether the user has dragged the window; default anchors to chat top. */ readonly userMoved: boolean; } /** Toggle the floating control window. */ export declare function togglePanel(open?: boolean): void; /** Move the floating control window (drag). */ export declare function movePanel(x: number, y: number): void; /** Subscribe to the panel state. */ export declare function usePanelState(): PanelState; export {};