import type { InputBackend } from './input-snapshot'; /** Options controlling the composite merge policy. */ export interface CompositeBackendOptions { /** * When `true` (default), a key held on the inner (human) backend suppresses * injected state only for that same key in that frame. Set `false` for * record/replay or AI-solo scenarios where both sources should coexist even * on key overlap. */ readonly yieldToHuman?: boolean; } /** * A composite backend: an `InputBackend` (drop-in for `INPUT_BACKEND_KEY`) plus * a programmatic injection surface. All injection is additive over the wrapped * human backend. */ export interface CompositeInputBackend extends InputBackend { /** Hold `key` down (mirrors a keydown). Idempotent. */ press(key: string): void; /** Release `key` (mirrors a keyup); emits a one-frame up-edge on next sample. */ release(key: string): void; /** Set an injected mouse-button slot (0/1/2) held-state. */ setButton(slot: 0 | 1 | 2, down: boolean): void; /** Accumulate injected pointer-lock movement delta (drained on next sample). */ addMovement(dx: number, dy: number): void; /** Accumulate injected wheel notches (drained on next sample). */ addWheel(notches: number): void; /** * Drop all injected state and pending frame edges; currently-held keys/buttons * emit one clean release edge so a previously observed hold is closed. */ clearInjected(): void; /** Open a fresh synthetic-input lease after a previous revoke boundary. */ beginInjectedLease(): void; /** Revoke the current lease and fence later injections until reopened. */ revokeInjectedLease(): void; /** * Create the one execution-scoped injection view. Creating a lease * invalidates every previously-created view; an invalid view remains a * no-op even after a later lease is opened. */ createInjectedLease(): CompositeInputLease; /** Toggle the yield-to-human gate at runtime. */ setYieldToHuman(yield_: boolean): void; } /** * Synthetic input exposed to one eval/execution. It deliberately has no * `beginInjectedLease` method: a script can release its own lease, but it * cannot reopen an old reference after the host has moved to another job. */ export interface CompositeInputLease extends InputBackend { press(key: string): void; release(key: string): void; setButton(slot: 0 | 1 | 2, down: boolean): void; addMovement(dx: number, dy: number): void; addWheel(notches: number): void; clearInjected(): void; revokeInjectedLease(): void; } export declare function makeCompositeBackend(inner: InputBackend, options?: CompositeBackendOptions): CompositeInputBackend; //# sourceMappingURL=composite-backend.d.ts.map