/** * FeltDB Browser Runtime Observation * * The runtime that ships inside `@feltdb/core` and runs in the developer's * browser. It instruments the page's HTTP and error surfaces, correlates * console/runtime errors to the request that was in flight, and publishes * redacted observations into the FeltDB Development Workspace, where they are * persisted durably. * * Browser → @feltdb/core → observation → FeltDB workspace → durable persistence * * This module is browser-safe: it must not import Node built-ins. It uses only * `fetch`, `XMLHttpRequest`, `console`, and `window` event handlers, so the * same contract is produced by Chromium, Gecko, and WebKit browsers even * though their internal implementations differ. */ import type { RuntimeRequestObservation } from './workspace-types.js'; export interface RuntimeObservationOptions { /** Pairing code (FELT-XXXXXX) printed by `feltdb dev`. */ pairingCode?: string; /** Pairing discovery endpoint, when it differs from the authority. */ discoveryEndpoint?: string; /** Authority endpoint, when the workspace is already known. */ endpoint?: string; /** Workspace id, when the workspace is already known. */ workspaceId?: string; /** Canonical `feltdb dev` session identity supplied by the session handshake. */ sessionId?: string; /** Canonical runtime initialization identity supplied by the runtime bridge. */ runtimeInstanceId?: string; /** * How long a failing request is held so that console and runtime errors * emitted immediately afterwards can be correlated to it. */ correlationWindowMs?: number; /** Expose the handle as `globalThis.__feltdbRuntime`. Defaults to true. */ exposeGlobal?: boolean; } export interface RuntimeObservationHandle { workspaceId: string; sessionId?: string; runtimeInstanceId?: string; /** Observations produced by this page, in order. */ observations(): RuntimeRequestObservation[]; /** Resolve once every pending observation has been persisted. */ flush(): Promise; /** Restore the original browser APIs and disconnect from the workspace. */ stop(): Promise; } /** * Start observing the current page and reporting into the workspace. * * Returns once the workspace connection is established, so a caller can await * it before exercising the application. */ export declare function startRuntimeObservation(options: RuntimeObservationOptions): Promise; //# sourceMappingURL=runtime-observer.d.ts.map