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

Function handleFillCommand

src/core/dispatch-interactions.ts:102–125  ·  view source on GitHub ↗
(
  interactor: Interactor,
  positionals: string[],
  context: DispatchContext | undefined,
)

Source from the content-addressed store, hash-verified

100}
101
102export async function handleFillCommand(
103 interactor: Interactor,
104 positionals: string[],
105 context: DispatchContext | undefined,
106): Promise<Record<string, unknown>> {
107 if (context?.directElementSelector) {
108 return await handleDirectElementSelectorFill(
109 interactor,
110 context.directElementSelector,
111 positionals,
112 context,
113 );
114 }
115
116 const x = Number(positionals[0]);
117 const y = Number(positionals[1]);
118 const text = positionals.slice(2).join(' ');
119 if (Number.isNaN(x) || Number.isNaN(y) || !text) {
120 throw new AppError('INVALID_ARGS', 'fill requires x y text');
121 }
122 const delayMs = requireIntInRange(context?.delayMs ?? 0, 'delay-ms', 0, 10_000);
123 await interactor.fill(x, y, text, delayMs);
124 return { x, y, text, delayMs, ...successText(formatTextLengthMessage('Filled', text)) };
125}
126
127async function handleDirectElementSelectorFill(
128 interactor: Interactor,

Callers 1

dispatch.tsFile · 0.90

Calls 5

requireIntInRangeFunction · 0.90
successTextFunction · 0.90
formatTextLengthMessageFunction · 0.85
fillMethod · 0.80

Tested by

no test coverage detected