import type { RnxBrowserOperations, RnxCommandBackend, RnxCommandInvocation, RnxExecutionContext, } from './command-contract' export function createRnxBrowserBackend( operations: RnxBrowserOperations, ): RnxCommandBackend { return { kind: 'browser', execute(invocation: RnxCommandInvocation, context: RnxExecutionContext) { switch (invocation.family) { case 'preview': return operations.selectPreview(invocation, context) case 'runtime': return operations.readRuntime(invocation, context) case 'tree': return operations.inspectTree(invocation, context) case 'layout': return operations.inspectLayout(invocation, context) case 'find': return operations.find(invocation, context) case 'wait': return operations.wait(invocation, context) case 'action': return operations.act(invocation, context) case 'screenshot': return operations.screenshot(invocation, context) case 'logs': return operations.readLogs(invocation, context) case 'network': return operations.readNetwork(invocation, context) case 'storage': return operations.accessStorage(invocation, context) case 'history': return operations.readHistory(invocation, context) case 'evidence': return operations.collectEvidence(invocation, context) } }, } }