import type { OperatorMethodInput, OperatorMethodOutput, OperatorTypedMethodId } from '@pellux/goodvibes-contracts/generated/foundation-client-types';
import type { AuthTokenResolver, HttpRetryPolicy, ServerSentEventHandlers, StreamReconnectPolicy, TransportMiddleware } from './transport-http.js';
import type { GoodVibesAuthClient, GoodVibesTokenStore } from './auth.js';
import type { SDKObserver } from './observer/index.js';
export type BrowserScopedRouteDefinition = {
    readonly method: string;
    readonly path: string;
};
export interface ScopedBrowserSdkOptions {
    readonly baseUrl?: string | undefined;
    readonly authToken?: string | null | undefined;
    readonly getAuthToken?: AuthTokenResolver | undefined;
    readonly tokenStore?: GoodVibesTokenStore | undefined;
    readonly fetch?: typeof fetch | undefined;
    readonly WebSocketImpl?: typeof WebSocket | undefined;
    readonly headers?: HeadersInit | undefined;
    readonly getHeaders?: (() => HeadersInit | undefined | Promise<HeadersInit | undefined>) | undefined;
    readonly retry?: HttpRetryPolicy | undefined;
    readonly middleware?: readonly TransportMiddleware[] | undefined;
    readonly realtime?: {
        readonly sseReconnect?: StreamReconnectPolicy | undefined;
        readonly onError?: ((error: unknown) => void) | undefined;
    } | undefined;
    readonly observer?: SDKObserver | undefined;
}
export interface ScopedEventStreamOptions {
    readonly signal?: AbortSignal | undefined;
    readonly headers?: HeadersInit | undefined;
    readonly reconnect?: StreamReconnectPolicy | undefined;
}
export interface ScopedRawEventStream {
    open(pathOrUrl: string, handlers: ServerSentEventHandlers, options?: ScopedEventStreamOptions): Promise<() => void>;
}
export interface ScopedInvokeOptions {
    readonly signal?: AbortSignal | undefined;
    readonly headers?: HeadersInit | undefined;
}
type ScopedInput<TMethodId extends OperatorTypedMethodId> = OperatorMethodInput<TMethodId>;
type ScopedOutput<TMethodId extends OperatorTypedMethodId> = OperatorMethodOutput<TMethodId>;
export interface ScopedOperatorClient<TMethodId extends OperatorTypedMethodId> {
    invoke<TSelectedMethodId extends TMethodId>(methodId: TSelectedMethodId, input?: ScopedInput<TSelectedMethodId>, options?: ScopedInvokeOptions): Promise<ScopedOutput<TSelectedMethodId>>;
}
export interface ScopedRuntimeEventEnvelope<TPayload extends {
    readonly type: string;
} = {
    readonly type: string;
}> {
    readonly type: string;
    readonly ts: number;
    readonly traceId?: string | undefined;
    readonly sessionId?: string | undefined;
    readonly source?: string | undefined;
    readonly payload: TPayload;
}
export interface ScopedRuntimeEventFeed<TPayload extends {
    readonly type: string;
} = {
    readonly type: string;
}> {
    on<TType extends string>(type: TType, listener: (payload: TPayload & {
        readonly type: TType;
    }) => void): () => void;
    onEnvelope<TType extends string>(type: TType, listener: (envelope: ScopedRuntimeEventEnvelope<TPayload & {
        readonly type: TType;
    }>) => void): () => void;
}
export type ScopedRuntimeEvents<TDomain extends string> = {
    readonly domains: readonly TDomain[];
    domain(domain: TDomain): ScopedRuntimeEventFeed;
} & {
    readonly [K in TDomain]: ScopedRuntimeEventFeed;
};
export interface ScopedBrowserSdk<TMethodId extends OperatorTypedMethodId, TDomain extends string> {
    readonly operator: ScopedOperatorClient<TMethodId>;
    readonly auth: GoodVibesAuthClient;
    readonly realtime: {
        viaSse(): ScopedRuntimeEvents<TDomain>;
    };
    readonly streams: ScopedRawEventStream;
    use(middleware: TransportMiddleware): void;
}
declare const SHARED_BROWSER_ROUTES: {
    readonly 'accounts.snapshot': {
        readonly method: "GET";
        readonly path: "/api/accounts";
    };
    readonly 'control.auth.current': {
        readonly method: "GET";
        readonly path: "/api/control-plane/auth";
    };
    readonly 'control.auth.login': {
        readonly method: "POST";
        readonly path: "/login";
    };
    readonly 'control.snapshot': {
        readonly method: "GET";
        readonly path: "/api/control-plane";
    };
    readonly 'control.status': {
        readonly method: "GET";
        readonly path: "/status";
    };
    readonly 'providers.get': {
        readonly method: "GET";
        readonly path: "/api/providers/{providerId}";
    };
    readonly 'providers.list': {
        readonly method: "GET";
        readonly path: "/api/providers";
    };
    readonly 'providers.usage.get': {
        readonly method: "GET";
        readonly path: "/api/providers/{providerId}/usage";
    };
    readonly 'sessions.create': {
        readonly method: "POST";
        readonly path: "/api/sessions";
    };
    readonly 'sessions.followUp': {
        readonly method: "POST";
        readonly path: "/api/sessions/{sessionId}/follow-up";
    };
    readonly 'sessions.get': {
        readonly method: "GET";
        readonly path: "/api/sessions/{sessionId}";
    };
    readonly 'sessions.inputs.cancel': {
        readonly method: "POST";
        readonly path: "/api/sessions/{sessionId}/inputs/{inputId}/cancel";
    };
    readonly 'sessions.inputs.list': {
        readonly method: "GET";
        readonly path: "/api/sessions/{sessionId}/inputs";
    };
    readonly 'sessions.list': {
        readonly method: "GET";
        readonly path: "/api/sessions";
    };
    readonly 'sessions.messages.create': {
        readonly method: "POST";
        readonly path: "/api/sessions/{sessionId}/messages";
    };
    readonly 'sessions.messages.list': {
        readonly method: "GET";
        readonly path: "/api/sessions/{sessionId}/messages";
    };
    readonly 'sessions.steer': {
        readonly method: "POST";
        readonly path: "/api/sessions/{sessionId}/steer";
    };
};
export type SharedBrowserMethodId = Extract<keyof typeof SHARED_BROWSER_ROUTES, OperatorTypedMethodId>;
export declare function resolveBrowserBaseUrl(baseUrl?: string): string;
export declare function forScopedBrowserSession<TDomain extends string>(events: ScopedRuntimeEvents<TDomain>, sessionId: string): ScopedRuntimeEvents<TDomain>;
export declare function createScopedBrowserSdk<TMethodId extends OperatorTypedMethodId, TDomain extends string>(routes: Record<TMethodId, BrowserScopedRouteDefinition>, domains: readonly TDomain[], options?: ScopedBrowserSdkOptions): ScopedBrowserSdk<TMethodId, TDomain>;
export { SHARED_BROWSER_ROUTES };
//# sourceMappingURL=browser-scoped.d.ts.map