/** * Tracker lifecycle pipeline for the public facade: build the built-in * tracker set from the `disable*` config flags, append host plugins, * attach each defensively, and tear them all down on shutdown. Split * out of `keewano.ts` so the facade file keeps to boot / teardown * orchestration while this module owns the (security-sensitive) * plugin-attach plumbing. * * Every entry point is hostile-input-hardened: `config.plugins` and * each plugin's `attach()` / detach handle can come from untyped JS, * so reads and calls are wrapped so one malformed plugin cannot crash * `init()` or leak listeners across a failed boot. */ import type { KeewanoConfig } from './types/config'; import type { SdkRuntime } from './types/runtime'; /** * Attach the InitialEventsTracker before anything else can emit. The * tracker's `attach()` is intentionally synchronous: it writes the * canonical APP_LAUNCH / PLATFORM / OS / DEVICE_TYPE / RAM_SIZE / * SCREEN_RESOLUTION / SYSTEM_LANG burst into the in-batch buffer * during this call, BEFORE `drainPreInitQueue` replays the host's * pre-init reports and BEFORE the runtime trackers install their * listeners. The fixed order keeps the wire stream identifiable * across sessions: every session starts with the same 7-event * environment frame. * * `criticalPath: true` on the tracker means an attach failure rejects * `init()` instead of silently booting without the burst - * `attachOneTracker` rethrows when the failed tracker is critical. */ declare function attachInitialEventsTracker(runtime: SdkRuntime): void; /** * Build the runtime tracker set per the `disable*` flags on `config`, * append the host-supplied `plugins`, and attach every entry. Each * successful `attach()` pushes its detach onto `runtime.detachFns` so * `shutdown()` can tear them down. * * The InitialEventsTracker is attached separately by * `attachInitialEventsTracker` BEFORE this function runs (and before * the pre-init queue drains) so the canonical burst always leads the * wire stream and the host's pre-init reports drain ahead of any * plugin sync-emit on attach. A single failing `attach()` is logged * but does NOT block the rest of the pipeline. */ declare function attachTrackers(runtime: SdkRuntime, config: KeewanoConfig): void; /** * Run every queued detach once and clear the list. Each detach is * wrapped so one throwing teardown cannot block the rest; the list is * snapshotted-and-cleared up front so a re-entrant call cannot run a * detach twice across a single shutdown. */ declare function detachAllTrackers(runtime: SdkRuntime): void; export { attachInitialEventsTracker, attachTrackers, detachAllTrackers };