import { rnxExit } from '../../run-rnx' import { resolveMaxMsFlag } from './core' import { waitForSootsimIdle } from './settling' import type { WsBridge } from '../../ws-bridge' // alias for `do settle` under the discoverable `wait` verb grouping. // layout hash stability across 3 polls; --strict also requires worker // animation flags to be clear. export async function runWaitIdleSubcommand(opts: { bridge: WsBridge args: string[] positional: string[] }): Promise { const { bridge, args } = opts const strict = args.includes('--strict') const maxMs = resolveMaxMsFlag(args, 3000) const { elapsed, settled } = await waitForSootsimIdle({ bridge, maxMs, strict }) if (settled) { console.log(` idle in ${elapsed}ms`) } else { console.error(` ⚠ wait idle timed out after ${elapsed}ms (may still be animating)`) rnxExit(1) } }