/** * Runtime integrity checkpoint — public surface + browser wiring. */ export type { CheckpointBaseline, CheckpointChange, CheckpointChangeKind, CheckpointConfig, CheckpointDeviceKind, CheckpointOptions, CheckpointProbes, CheckpointResult, CheckpointTrigger, DisplaySnapshot, FrameVerdict, PermissionSnapshot, } from "./types.js"; import type { CheckpointBaseline, CheckpointDeviceKind, CheckpointProbes, PermissionSnapshot, } from "./types.js"; export { runCheckpoint } from "./checkpoint.js"; export { pickLiveTrack } from "./tracks.js"; export { isDevicePresentLoose } from "./reconnect-match.js"; export type { DeviceRef, EnumeratedDevice } from "./reconnect-match.js"; import { listDeviceIds, probeDisplay, queryPermission, sampleVideoFrame, } from "./probes.js"; export { listDeviceIds, probeDisplay, queryPermission, sampleVideoFrame }; /** * Assemble the real browser probes, injecting the client's live-track getters * (the checkpoint reads the streams the session already holds — no new * getUserMedia, no second camera light). */ export function createBrowserProbes(opts: { getVideoTrack: () => MediaStreamTrack | null; getAudioTrack: () => MediaStreamTrack | null; now?: () => number; }): CheckpointProbes { return { queryPermission, listDeviceIds, probeDisplay, sampleVideoFrame, getVideoTrack: opts.getVideoTrack, getAudioTrack: opts.getAudioTrack, now: opts.now ?? (() => Date.now()), }; } /** * Snapshot the environment at session start — the comparison point every * later checkpoint drifts from. Only the permissions the session DEPENDS on * are queried and tracked (`dependsOn`): camera when the camera is captured, * microphone when the mic is captured or the speaker is used (outputs need a * mic grant to enumerate/route). The selected devices are the candidate's * preflight picks; the display is the current `screen.isExtended` state. */ export async function captureBaseline( selected: Partial>, dependsOn: { microphone: boolean; camera: boolean }, ): Promise { const permissions: Partial> = {}; if (dependsOn.microphone) permissions.microphone = await queryPermission("microphone"); if (dependsOn.camera) permissions.camera = await queryPermission("camera"); return { permissions, devices: selected, display: probeDisplay() }; }