(runtime, options)
| 122 | TypeTextCommandOptions, |
| 123 | TypeTextCommandResult |
| 124 | > = async (runtime, options): Promise<TypeTextCommandResult> => { |
| 125 | const text = options.text; |
| 126 | if (!text) throw new AppError('INVALID_ARGS', 'type requires text'); |
| 127 | const mistargetedRef = findMistargetedTypeRef(text); |
| 128 | if (mistargetedRef) { |
| 129 | throw new AppError( |
| 130 | 'INVALID_ARGS', |
| 131 | `type does not accept a target ref like "${mistargetedRef}"`, |
| 132 | { |
| 133 | hint: `Use fill ${mistargetedRef} "text" to target that field, or press ${mistargetedRef} then type "text" to append.`, |
| 134 | }, |
| 135 | ); |
| 136 | } |
| 137 | if (!runtime.backend.typeText) { |
| 138 | throw new AppError('UNSUPPORTED_OPERATION', 'type is not supported by this backend'); |
| 139 | } |
| 140 | const delayMs = requireIntInRange(options.delayMs ?? 0, 'delay-ms', 0, 10_000); |
| 141 | const backendResult = await runtime.backend.typeText(toBackendContext(runtime, options), text, { |
| 142 | delayMs, |
| 143 | }); |
| 144 | const formattedBackendResult = toBackendResult(backendResult); |
| 145 | return { |
| 146 | kind: 'text', |
| 147 | text, |
| 148 | delayMs, |
| 149 | ...(formattedBackendResult ? { backendResult: formattedBackendResult } : {}), |
| 150 | ...successText(`Typed ${Array.from(text).length} chars`), |
| 151 | }; |
| 152 | }; |
| 153 | |
| 154 | async function tapCommand( |
| 155 | runtime: AgentDeviceRuntime, |
nothing calls this directly
no test coverage detected
searching dependent graphs…