( runtime: AgentDeviceRuntime, capture: CapturedSnapshot, node: SnapshotNode, )
| 73 | } |
| 74 | |
| 75 | export async function readText( |
| 76 | runtime: AgentDeviceRuntime, |
| 77 | capture: CapturedSnapshot, |
| 78 | node: SnapshotNode, |
| 79 | ): Promise<string> { |
| 80 | if (runtime.backend.readText) { |
| 81 | const result = await runtime.backend.readText( |
| 82 | toBackendContext(runtime, { |
| 83 | session: capture.sessionName, |
| 84 | }), |
| 85 | node, |
| 86 | ); |
| 87 | if (result.text.trim()) return result.text; |
| 88 | } |
| 89 | return extractReadableText(node); |
| 90 | } |
| 91 | |
| 92 | export function resolveRefNode( |
| 93 | nodes: SnapshotState['nodes'], |
no test coverage detected