MCPcopy
hub / github.com/callstack/agent-device / buildFindRecordResult

Function buildFindRecordResult

src/daemon/selector-recording.ts:4–19  ·  view source on GitHub ↗
(
  result: Record<string, unknown>,
  action: 'exists' | 'wait' | 'get_text' | 'get_attrs',
)

Source from the content-addressed store, hash-verified

2import { SessionStore } from './session-store.ts';
3
4export function buildFindRecordResult(
5 result: Record<string, unknown>,
6 action: 'exists' | 'wait' | 'get_text' | 'get_attrs',
7): Record<string, unknown> {
8 if (action === 'exists') return { found: true };
9 if (action === 'wait') {
10 return { found: true, waitedMs: result.waitedMs };
11 }
12 const ref = typeof result.ref === 'string' ? result.ref : undefined;
13 if (action === 'get_attrs') return { ref, action: 'get attrs' };
14 return {
15 ref,
16 action: 'get text',
17 text: typeof result.text === 'string' ? result.text : '',
18 };
19}
20
21export function toDaemonFindData(result: Record<string, unknown>): Record<string, unknown> {
22 if (result.kind === 'found') {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected