//#region src/native-bridge.d.ts declare const FLUTTER_DOM_ROUTE_ID: "__coreframe_flutter_dom__"; type NativeBridgeFrame = Readonly<{ protocolVersion: number; shellSessionId: string; rootWebRuntimeId: string; applicationScopeId: string; messageId: string; sequence: number; kind: string; routeEntryKey?: string; payload: Readonly>; }>; type NativeBridgeWireSchema = { readonly kind: "string" | "number" | "boolean" | "color"; } | { readonly kind: "literal"; readonly value: string | number | boolean; } | { readonly kind: "nullable"; readonly value: NativeBridgeWireSchema; } | { readonly kind: "array"; readonly items: NativeBridgeWireSchema; } | { readonly kind: "object"; readonly properties: Readonly>; } | { readonly kind: "union"; readonly variants: readonly NativeBridgeWireSchema[]; }; type NativeBridgeMessageSchema = Readonly<{ kind: string; routeScoped: boolean; payload: NativeBridgeWireSchema; }>; type NativeBridgeRouteContract = Readonly<{ routeId: string; model: NativeBridgeWireSchema; actions: Readonly>; }>; type NativeBridgeSurfaceContract = Readonly<{ routeId: string; surface: "flutter-dom" | "native"; transitionKey: string; underlayColor: string | null; statusBarForeground: "automatic" | "light" | "dark" | null; z: number; stackId: string | null; stackRoot: boolean; }>; type NativeBridgeNativeSurfaceContract = Readonly<{ surfaceId: string; model: NativeBridgeWireSchema; actions: Readonly>; }>; type NativeBridgeStackContract = Readonly<{ id: string; rootRouteId: string; routeIds: readonly string[]; }>; type NativeBridgeProtocolSchema = Readonly<{ protocolVersion: number; routes: readonly NativeBridgeRouteContract[]; surfaces: readonly NativeBridgeSurfaceContract[]; nativeSurfaces: readonly NativeBridgeNativeSurfaceContract[]; stacks: readonly NativeBridgeStackContract[]; hostToWeb: readonly NativeBridgeMessageSchema[]; webToHost: readonly NativeBridgeMessageSchema[]; }>; type NativeBridgeCodecOptions = Readonly<{ protocolVersion: number; routes: readonly NativeBridgeRouteContract[]; surfaces: readonly NativeBridgeSurfaceContract[]; nativeSurfaces: readonly NativeBridgeNativeSurfaceContract[]; stacks: readonly NativeBridgeStackContract[]; }>; declare class NativeBridgeDecodeError extends TypeError { constructor(message: string); } declare function createNativeBridgeCodec(options: NativeBridgeCodecOptions): { decodeHostToWebFrame: (value: unknown) => Readonly<{ protocolVersion: number; shellSessionId: string; rootWebRuntimeId: string; applicationScopeId: string; messageId: string; sequence: number; kind: string; routeEntryKey?: string; payload: Readonly>; }>; decodeWebToHostFrame: (value: unknown) => Readonly<{ protocolVersion: number; shellSessionId: string; rootWebRuntimeId: string; applicationScopeId: string; messageId: string; sequence: number; kind: string; routeEntryKey?: string; payload: Readonly>; }>; encodeWebToHostFrame: (value: unknown) => string; }; declare function createNativeBridgeSchema(protocolVersion: number, routes: readonly NativeBridgeRouteContract[], surfaceContracts: readonly NativeBridgeSurfaceContract[], nativeSurfaceContracts: readonly NativeBridgeNativeSurfaceContract[], stackContracts: readonly NativeBridgeStackContract[]): NativeBridgeProtocolSchema; type NativeBridgeNavigationSnapshot = Readonly<{ activeStackId: string | null; revision: number; root: Readonly<{ pathname: string; search: string; hash: string; }>; stack: readonly Readonly<{ entryKey: string; routeId: string; presentationRevision: number; surface: "flutter-dom" | "native"; transitionKey: string; underlayColor: string | null; statusBarForeground: "automatic" | "light" | "dark" | null; location: Readonly<{ pathname: string; search: string; hash: string; }>; z: number; stackId: string | null; stackRoot: boolean; }>[]; stacks: readonly Readonly<{ id: string; root: NativeBridgeNavigationSnapshot["stack"][number] | null; stack: NativeBridgeNavigationSnapshot["stack"]; }>[]; }>; type NativeBridgeSurfacePresentation = Readonly<{ activationOrder: number; backBehavior: "dismiss" | "ignore"; transitionKey: string | null; statusBarForeground: "automatic" | "light" | "dark" | null; routeAttachment: "current" | null; z: number | null; }>; type NativeBridgeSurfaceSnapshot = Readonly<{ active: boolean; instanceId: string; model: unknown; presentation: NativeBridgeSurfacePresentation; revision: number; surfaceId: string; }>; type NativeBridgeApplicationState = "background" | "foreground"; type NativeBridgeNavigationResult = Readonly<{ navigationRequestId: string; snapshot: NativeBridgeNavigationSnapshot; status: "committed"; }> | Readonly<{ navigationRequestId: string; status: "busy" | "staleRevision" | "invalidStack"; }> | Readonly<{ errorCode: "internal" | "invalidRoute" | "transitionFailed" | "unauthorized"; navigationRequestId: string; status: "failed"; }>; type NativeBridgeDiagnostic = Readonly<{ code: "decode-rejected" | "identity-rejected" | "sequence-gap" | "outbox-full" | "retry-exhausted" | "handler-failed"; shellSessionId?: string; rootWebRuntimeId: string; applicationScopeId: string; messageId?: string; routeEntryKey?: string; }>; type NativeBridgeRetryPolicy = Readonly<{ maxEntries: number; maxAttempts: number; initialDelayMs: number; maxDelayMs: number; }>; type NativeRouteBridgeOptions = { protocolVersion: number; rootWebRuntimeId: string; decodeHostToWebFrame(value: unknown): HostFrame; encodeWebToHostFrame(value: unknown): string; send(encodedFrame: string): void; /** Authoritative proposed-or-committed controller binding. */ isRouteEntryCurrent(routeEntryKey: string, routeId: string): boolean; getResyncState(): { applicationState: NativeBridgeApplicationState; models: readonly unknown[]; navigation: NativeBridgeNavigationSnapshot; surfaces: readonly NativeBridgeSurfaceSnapshot[]; }; onApplicationState?(state: NativeBridgeApplicationState): void; /** The native credential boundary is authoritative for this opaque authorization epoch. */ onApplicationScope?(applicationScopeId: string): void; onBootstrap?(snapshot: NativeBridgeNavigationSnapshot): void; onSurfaceSnapshots?(snapshots: readonly NativeBridgeSurfaceSnapshot[]): void; onNavigationSnapshot?(snapshot: NativeBridgeNavigationSnapshot): void; onRoutePresentationResult?(entryKey: string, result: Readonly>): void; onNavigationResult?(result: NativeBridgeNavigationResult): void; onStackActivationResult?(result: NativeBridgeNavigationResult): void; onSurfaceActionRequested?(request: { actionId: string; instanceId: string; name: string; payload: unknown; surfaceId: string; /** Forward this stable key to destructive server mutations. */ idempotencyKey: string; }): Promise | void; onSurfaceDismissed?(dismissal: { dismissalId: string; instanceId: string; surfaceId: string; }): void; onActionRequested?(request: { actionId: string; name: string; payload: unknown; routeId: string; routeEntryKey: string; /** Forward this stable key to destructive server mutations. */ idempotencyKey: string; }): Promise | void; onClearApplicationScope?(previousScopeId: string, nextScopeId: string): Promise | void; isSurfaceCurrent?(instanceId: string, surfaceId: string): boolean; diagnose?(diagnostic: NativeBridgeDiagnostic): void; now?: () => number; createId?: () => string; retry?: Partial; }; type NativeRoutePresentation = Readonly<{ entryKey: string; routeId: string; presentationRevision: number; surface: "flutter-dom" | "native"; transitionKey: string; underlayColor: string | null; statusBarForeground: "automatic" | "light" | "dark" | null; location: Readonly<{ pathname: string; search: string; hash: string; }>; z: number; stackId: string | null; stackRoot: boolean; }>; type NativeSurfacePresentation = Readonly<{ activationOrder: number; backBehavior?: "dismiss" | "ignore"; transitionKey?: string; statusBarForeground?: "automatic" | "light" | "dark"; routeAttachment?: "current"; z?: number; }>; type NativeSurfaceRegistration = Readonly<{ active: boolean; instanceId: string; presentation: NativeSurfacePresentation; surfaceId: string; }>; /** * Runs the root-WebView side of the closed native-route protocol. Generated codecs must be passed * in so structural validation and defensive copying happen before this state machine observes * data. */ declare function createNativeRouteBridge(options: NativeRouteBridgeOptions): { dispose: () => void; getApplicationState: () => NativeBridgeApplicationState; getNavigationSnapshot: () => Readonly<{ activeStackId: string | null; revision: number; root: Readonly<{ pathname: string; search: string; hash: string; }>; stack: readonly Readonly<{ entryKey: string; routeId: string; presentationRevision: number; surface: "flutter-dom" | "native"; transitionKey: string; underlayColor: string | null; statusBarForeground: "automatic" | "light" | "dark" | null; location: Readonly<{ pathname: string; search: string; hash: string; }>; z: number; stackId: string | null; stackRoot: boolean; }>[]; stacks: readonly Readonly<{ id: string; root: NativeBridgeNavigationSnapshot["stack"][number] | null; stack: NativeBridgeNavigationSnapshot["stack"]; }>[]; }> | undefined; cancelRoutePresentation: (routeEntryKey: string) => boolean; presentRoute: (route: NativeRoutePresentation) => boolean; publishDomPresentationReady: (presentation: unknown) => boolean; publishRouteModel: (routeEntryKey: string, routeId: string, revision: number, model: unknown) => boolean; receive: (value: unknown) => boolean; requestNavigation: (navigationRequestId: string, intent: unknown) => boolean; registerSurface: (surface: NativeSurfaceRegistration) => boolean; unregisterSurface: (instanceId: string, surfaceId: string) => boolean; publishSurfaceModel: (surface: NativeBridgeSurfaceSnapshot) => boolean; acknowledgeSurfaceDismissal: (dismissal: { dismissalId: string; instanceId: string; surfaceId: string; }) => boolean; requestStackActivation: (navigationRequestId: string, baseRevision: number, stackId: string) => boolean; retryDue: () => void; sendResyncState: () => void; }; //#endregion export { FLUTTER_DOM_ROUTE_ID, NativeBridgeApplicationState, NativeBridgeCodecOptions, NativeBridgeDecodeError, NativeBridgeDiagnostic, NativeBridgeFrame, NativeBridgeMessageSchema, NativeBridgeNativeSurfaceContract, NativeBridgeNavigationResult, NativeBridgeNavigationSnapshot, NativeBridgeProtocolSchema, NativeBridgeRetryPolicy, NativeBridgeRouteContract, NativeBridgeStackContract, NativeBridgeSurfaceContract, NativeBridgeSurfacePresentation, NativeBridgeSurfaceSnapshot, NativeBridgeWireSchema, NativeRouteBridgeOptions, NativeRoutePresentation, NativeSurfacePresentation, NativeSurfaceRegistration, createNativeBridgeCodec, createNativeBridgeSchema, createNativeRouteBridge };