import { n as GatewayClientName, t as GatewayClientMode } from "./client-info-CgGSgtDZ.js"; import { Ei as HelloOk, _i as EventFrame } from "./schema-DtyqV_v0.js"; //#region packages/gateway-client/src/client.d.ts type DeviceIdentity = { deviceId: string; privateKeyPem: string; publicKeyPem: string; }; type DeviceAuthTokenRecord = { token?: string; scopes?: string[]; }; type GatewayClientHostDeps = { loadOrCreateDeviceIdentity?: () => DeviceIdentity | undefined; signDevicePayload?: (privateKeyPem: string, payload: string) => string; publicKeyRawBase64UrlFromPem?: (publicKeyPem: string) => string; loadDeviceAuthToken?: (params: { deviceId: string; role: string; env?: NodeJS.ProcessEnv; }) => DeviceAuthTokenRecord | null; storeDeviceAuthToken?: (params: { deviceId: string; role: string; token: string; scopes: string[]; env?: NodeJS.ProcessEnv; }) => void; clearDeviceAuthToken?: (params: { deviceId: string; role: string; env?: NodeJS.ProcessEnv; }) => void; beforeConnect?: () => void; registerGatewayLoopbackBypass?: (url: string) => (() => void) | undefined; logDebug?: (message: string) => void; logError?: (message: string) => void; redactForLog?: (message: string) => string; normalizeTlsFingerprint?: (fingerprint: string | undefined) => string; }; type GatewayClientRequestOptions = { expectFinal?: boolean; timeoutMs?: number | null; signal?: AbortSignal; /** Called once for expectFinal requests after an accepted response, before the final result. */ onAccepted?: (payload: unknown) => void; }; type GatewayReconnectPausedInfo = { code: number; reason: string; detailCode: string | null; }; type GatewayClientCloseInfo = { phase: "pre-hello" | "post-hello"; socketOpened: boolean; transportValidated: boolean; transientPreHelloCleanClose: boolean; }; type GatewayClientOptions = { url?: string; origin?: string; connectChallengeTimeoutMs?: number; /** @deprecated Use connectChallengeTimeoutMs. */ connectDelayMs?: number; /** * Server-side pre-auth handshake budget. Config-derived local clients use * this to keep the connect-challenge watchdog aligned with the gateway. */ preauthHandshakeTimeoutMs?: number; tickWatchMinIntervalMs?: number; tickWatchTimeoutMs?: number; requestTimeoutMs?: number; token?: string; bootstrapToken?: string; deviceToken?: string; password?: string; approvalRuntimeToken?: string; agentRuntimeIdentityToken?: string; instanceId?: string; clientName?: GatewayClientName; clientDisplayName?: string; clientVersion?: string; platform?: string; deviceFamily?: string; mode?: GatewayClientMode; role?: string; scopes?: string[]; caps?: string[]; commands?: string[]; permissions?: Record; pathEnv?: string; env?: NodeJS.ProcessEnv; deviceIdentity?: DeviceIdentity | null; hostDeps?: GatewayClientHostDeps; minProtocol?: number; maxProtocol?: number; tlsFingerprint?: string; onEvent?: (evt: EventFrame) => void; onHelloOk?: (hello: HelloOk) => void; onConnectError?: (err: Error) => void; onReconnectPaused?: (info: GatewayReconnectPausedInfo) => void; onClose?: (code: number, reason: string, info?: GatewayClientCloseInfo) => void; onGap?: (info: { expected: number; received: number; }) => void; }; type GatewayClientConnectionMetadata = { clientName?: GatewayClientName; hasDeviceIdentity: boolean; mode?: GatewayClientMode; preauthHandshakeTimeoutMs?: number; }; //#endregion //#region packages/gateway-client/src/event-loop-ready.d.ts /** Readiness probe outcome with timing data for diagnosing event-loop stalls. */ type EventLoopReadyResult = { ready: boolean; elapsedMs: number; maxDriftMs: number; checks: number; aborted: boolean; }; //#endregion //#region packages/gateway-client/src/readiness.d.ts type GatewayClientStartable = { start(): void; }; /** Timeout and abort controls for delaying client start until the loop can process IO. */ type GatewayClientStartReadinessOptions = { timeoutMs?: number; clientOptions?: Pick; signal?: AbortSignal; }; //#endregion //#region src/gateway/client.d.ts declare class GatewayClient { #private; constructor(opts: GatewayClientOptions); start(): void; stop(): void; stopAndWait(opts?: { timeoutMs?: number; }): Promise; request>(method: string, params?: unknown, opts?: GatewayClientRequestOptions): Promise; getConnectionMetadata(): GatewayClientConnectionMetadata; } //#endregion export { GatewayClientOptions as a, EventLoopReadyResult as i, GatewayClientStartReadinessOptions as n, GatewayClientRequestOptions as o, GatewayClientStartable as r, GatewayReconnectPausedInfo as s, GatewayClient as t };