MCPcopy Index your code
hub / github.com/callstack/agent-device / typeTextCommand

Function typeTextCommand

src/commands/interaction/runtime/interactions.ts:124–152  ·  view source on GitHub ↗
(runtime, options)

Source from the content-addressed store, hash-verified

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
154async function tapCommand(
155 runtime: AgentDeviceRuntime,

Callers

nothing calls this directly

Calls 5

requireIntInRangeFunction · 0.90
toBackendContextFunction · 0.90
toBackendResultFunction · 0.90
successTextFunction · 0.90
findMistargetedTypeRefFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…