/** * Lazy / re-detecting host adapter. * * The original architecture bound a single VideoHost instance at startup — * if the user opened DaVinci Resolve *after* launching ggeditor, every * subsequent tool call still went into the NoneAdapter even though the * footer's polling loop could see Resolve was now alive. * * createLazyHost() returns a VideoHost that re-detects the running NLE on * demand. Detection is cached for `redetectIntervalMs` (default 2s) so we * don't spawn `ps -axo` on every tool call. When the detected host *name* * changes, the previous adapter (Resolve / Premiere bridges) is shut down * cleanly before the new one is instantiated. * * The proxy preserves the VideoHost contract: * - `name` / `displayName` are getters returning the live adapter's value. * - Optional methods (`openPage`, `smartReframe`, `setClipVolume`, * `executeCode`) are exposed via getters that return either a bound * function or `undefined`, so existing existence checks * (`if (host.openPage)`, `typeof host.openPage === 'function'`) remain * authoritative against the live adapter at the moment of the check. * - `shutdown()` (not part of VideoHost) cleans up the underlying adapter * for the CLI's exit handler. * * The agent's startup-baked system prompt should treat host identity as * informational, not contractual. Workflow rule #1 already says * "host_info first" — host_info reads the live adapter, so the agent always * gets fresh ground truth. */ import type { HostName } from "../../types.js"; import type { VideoHost } from "./types.js"; export interface LazyHostOptions { /** * Force a specific host instead of auto-detecting. When set, the proxy * still acts as a normal adapter but never re-detects. */ forced?: HostName; /** * Min ms between detection probes. Detection is a `ps` spawn (~5-15ms), * cheap individually but death by a thousand cuts if we ran it on every * tool call. Default 2000ms — fast enough that opening Resolve mid-session * lights up within 2s of the next agent tool call. */ redetectIntervalMs?: number; } export interface LazyHost extends VideoHost { /** Shut down the underlying adapter (closes Resolve/Premiere bridges). */ shutdown(): void; /** Force a re-detection on the next call (bypasses the cache). */ invalidate(): void; } export declare function createLazyHost(opts?: LazyHostOptions): LazyHost; //# sourceMappingURL=lazy.d.ts.map