From 83d56edd5edaaea3998970683bc7c99003ec3130 Mon Sep 17 00:00:00 2001 From: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Date: Wed, 21 Oct 2026 03:28:45 -0700 Subject: [PATCH 1/5] fix(provider-limrun): preserve Unicode in Limrun iOS fill After text-entry focus arrives, fill writes the whole string with one setElementValue call, including an empty string and characters that have no hardware key. A supplied delay remains on the signature and the replacement stays a single write. type still sends key events, with per-character timing when a delay is set. The Limrun iOS docs and the text-entry tests follow that path, including no write when focus never arrives and failure when the value write is rejected. Fixes #3819 --- .../src/ios-interactor-text-entry.test.ts | 107 +++++++++++++----- packages/provider-limrun/src/ios.ts | 15 +-- website/docs/docs/limrun.md | 2 +- 3 files changed, 87 insertions(+), 37 deletions(-) diff --git a/packages/provider-limrun/src/ios-interactor-text-entry.test.ts b/packages/provider-limrun/src/ios-interactor-text-entry.test.ts index 9986ffe273..233138c3f2 100644 --- a/packages/provider-limrun/src/ios-interactor-text-entry.test.ts +++ b/packages/provider-limrun/src/ios-interactor-text-entry.test.ts @@ -1,4 +1,4 @@ -import { expect, test, vi } from 'vitest'; +import { afterEach, expect, test, vi } from 'vitest'; import { createLimrunIosInteractor, type LimrunIosSession } from './ios.ts'; import type { IosTreeNode } from './snapshot.ts'; @@ -16,6 +16,10 @@ function emailField(editing: boolean): IosTreeNode { }; } +afterEach(() => { + vi.restoreAllMocks(); +}); + function sessionWithTrees(trees: IosTreeNode[]) { const calls: string[] = []; let reads = 0; @@ -35,6 +39,9 @@ function sessionWithTrees(trees: IosTreeNode[]) { typeText: vi.fn(async () => { calls.push('typeText'); }), + setElementValue: vi.fn(async () => { + calls.push('setElementValue'); + }), }; const session = { platform: 'ios', @@ -64,7 +71,7 @@ test('a delayed type sends one focused-blind key press per character', async () ]); }); -test('fill waits for text-entry focus to arrive and only then sends keys', async () => { +test('fill waits for text-entry focus to arrive and only then sets the value', async () => { const { interactor, client, calls } = sessionWithTrees([ emailField(false), emailField(false), @@ -73,40 +80,52 @@ test('fill waits for text-entry focus to arrive and only then sends keys', async const result = await interactor.fill(200, 170, 'qa@example.com'); - expect(calls).toEqual([ - 'elementTree', - 'tap', - 'elementTree', - 'elementTree', - 'pressKey:a+command', - 'typeText', - ]); + expect(calls).toEqual(['elementTree', 'tap', 'elementTree', 'elementTree', 'setElementValue']); expect(result).toEqual({ textEntryReadiness: 'focused-element' }); - expect(client.typeText).toHaveBeenCalledWith('qa@example.com', false, { requireFocus: false }); + expect(client.setElementValue.mock.calls).toEqual([['qa@example.com']]); + expect(client.pressKey).not.toHaveBeenCalled(); + expect(client.typeText).not.toHaveBeenCalled(); }); -test('fill selects the field value first, so entry replaces it', async () => { - const { interactor, calls } = sessionWithTrees([emailField(false), emailField(true)]); +test('fill sets Chinese, mixed, and emoji text in one write after focus', async () => { + for (const text of ['你好', 'qa@例子.com', '👋']) { + const { interactor, client, calls } = sessionWithTrees([emailField(false), emailField(true)]); - await interactor.fill(200, 170, 'replacement'); + const result = await interactor.fill(200, 170, text); - expect(calls.indexOf('pressKey:a+command')).toBeLessThan(calls.indexOf('typeText')); + expect(result).toEqual({ textEntryReadiness: 'focused-element' }); + expect(calls.indexOf('tap')).toBeLessThan(calls.lastIndexOf('elementTree')); + expect(calls.lastIndexOf('elementTree')).toBeLessThan(calls.indexOf('setElementValue')); + expect(client.setElementValue.mock.calls).toEqual([[text]]); + expect(client.pressKey).not.toHaveBeenCalled(); + expect(client.typeText).not.toHaveBeenCalled(); + } }); -test('the clear request empties the focused field instead of typing nothing', async () => { - const { interactor, client, calls } = sessionWithTrees([emailField(false), emailField(true)]); +test('fill replaces an ASCII value and clears with an empty string on the same path', async () => { + for (const text of ['replacement', '']) { + const { interactor, client } = sessionWithTrees([emailField(false), emailField(true)]); - const result = await interactor.fill(200, 170, ''); + const result = await interactor.fill(200, 170, text); - expect(calls).toEqual([ - 'elementTree', - 'tap', - 'elementTree', - 'pressKey:a+command', - 'pressKey:delete', - ]); - expect(client.typeText).not.toHaveBeenCalled(); - expect(result).toEqual({ textEntryReadiness: 'focused-element' }); + expect(result).toEqual({ textEntryReadiness: 'focused-element' }); + expect(client.setElementValue.mock.calls).toEqual([[text]]); + expect(client.pressKey).not.toHaveBeenCalled(); + expect(client.typeText).not.toHaveBeenCalled(); + } +}); + +test('a delayed fill still sets the complete value once', async () => { + for (const text of ['你好a', '']) { + const { interactor, client } = sessionWithTrees([emailField(false), emailField(true)]); + + const result = await interactor.fill(200, 170, text, 1); + + expect(result).toEqual({ textEntryReadiness: 'focused-element' }); + expect(client.setElementValue.mock.calls).toEqual([[text]]); + expect(client.pressKey).not.toHaveBeenCalled(); + expect(client.typeText).not.toHaveBeenCalled(); + } }); test('a session that cannot answer the focus read fails before the device is touched', async () => { @@ -121,5 +140,39 @@ test('a session that cannot answer the focus read fails before the device is tou ); expect(calls).toEqual(['elementTree']); expect(client.tap).not.toHaveBeenCalled(); + expect(client.setElementValue).not.toHaveBeenCalled(); + expect(client.pressKey).not.toHaveBeenCalled(); + expect(client.typeText).not.toHaveBeenCalled(); +}); + +test('fill writes no value when text-entry focus never arrives', async () => { + const { interactor, client } = sessionWithTrees([emailField(false)]); + // The focus budget is wall-clock time. Step the clock by that budget on every + // read so the first miss expires it, and the refusal is not a three-second wait. + let now = 0; + vi.spyOn(Date, 'now').mockImplementation(() => { + const current = now; + now += 3_000; + return current; + }); + + await expect(interactor.fill(200, 170, '你好')).rejects.toMatchObject({ + code: 'COMMAND_FAILED', + details: { reason: 'text_entry_focus_not_observed' }, + }); + expect(client.tap).toHaveBeenCalledTimes(1); + expect(client.setElementValue).not.toHaveBeenCalled(); + expect(client.pressKey).not.toHaveBeenCalled(); + expect(client.typeText).not.toHaveBeenCalled(); +}); + +test('a rejected value write fails the fill with that failure', async () => { + const { interactor, client } = sessionWithTrees([emailField(false), emailField(true)]); + const failure = new Error('element value refused'); + client.setElementValue.mockRejectedValueOnce(failure); + + await expect(interactor.fill(200, 170, '你好')).rejects.toBe(failure); + expect(client.setElementValue.mock.calls).toEqual([['你好']]); + expect(client.pressKey).not.toHaveBeenCalled(); expect(client.typeText).not.toHaveBeenCalled(); }); diff --git a/packages/provider-limrun/src/ios.ts b/packages/provider-limrun/src/ios.ts index 9c38d6ca4d..8040034c62 100644 --- a/packages/provider-limrun/src/ios.ts +++ b/packages/provider-limrun/src/ios.ts @@ -277,7 +277,7 @@ class LimrunIosInteractor implements Interactor { await this.enterText(text, delayMs); } - async fill(x: number, y: number, text: string, delayMs?: number): Promise { + async fill(x: number, y: number, text: string, _delayMs?: number): Promise { // Loaded on the fill path to keep this provider's declared import-time closure budget. const { awaitLimrunTextEntryFocus, readLimrunUnambiguousTapTargets, readLimrunTextEntryFocus } = await import('./text-entry-focus.ts'); @@ -295,14 +295,11 @@ class LimrunIosInteractor implements Interactor { x, y, }); - // Select first: iOS replaces a selection on the next key, so `fill` replaces and - // an empty fill clears. - await this.session.client.pressKey('a', ['command']); - if (text.length === 0) { - await this.session.client.pressKey('delete'); - return { textEntryReadiness }; - } - await this.enterText(text, delayMs); + // One value write on the focused element. The SDK omits the selector so the + // server resolves focus, and the whole string is the value, including an empty + // clear and characters that have no key code. A supplied delay stays on this + // signature for callers; per-character timing stays on `type`. + await this.session.client.setElementValue(text); return { textEntryReadiness }; } diff --git a/website/docs/docs/limrun.md b/website/docs/docs/limrun.md index c26eb1068f..45aa9aac10 100644 --- a/website/docs/docs/limrun.md +++ b/website/docs/docs/limrun.md @@ -75,7 +75,7 @@ On an iPhone, Limrun reports a native tab bar as one empty group. `snapshot` the On iOS, `settings` supports `appearance`, `permission`, `location`, and `clear-app-state`, with the same arguments as a local simulator. `clear-app-state` resets the app's data container through Limrun's soft reset. That reset relaunches the app once before agent-device stops it, so the app may run once after its data is cleared. `reset-keychain`, `wifi`, `airplane`, `mobile-data`, `faceid`, `touchid`, and `text-size` are unsupported, and you cannot read back any iOS setting. On Android, `settings mobile-data on|off` runs over the ADB tunnel like on a local device. -On iOS, `fill` taps the target, waits for that field to take text-entry focus, and only then types. Apps that never report a globally focused element, such as Flutter forms, still fill and report `textEntryReadiness: "focused-element"`. If the tap does not focus a field, `fill` fails with `text_entry_focus_not_observed` instead of typing into an unknown field. Use `type` to send text to whichever field already has focus. +On iOS, `fill` taps the target, waits for that field to take text-entry focus, and replaces the focused field's value in one write. The write is the complete text, including an empty string that clears the field and characters that have no hardware key. Apps that never report a globally focused element, such as Flutter forms, still fill and report `textEntryReadiness: "focused-element"`. If the tap does not focus a field, `fill` fails with `text_entry_focus_not_observed` and writes nothing. `type` sends key events to whichever field already has focus. `--delay-ms` on `type` enters one character at a time; `--delay-ms` on `fill` keeps that replacement as one write of the whole value. To drive Limrun only through MCP, see [Use a provider only through MCP](/docs/device-clouds#use-a-provider-only-through-mcp). For Limrun, `artifacts` lists the network capture file only when you connect with `--provider-network-logs`; otherwise there are no provider artifacts to fetch. From c5fbd951fc1c090639ec8fb72cbf4212d937c47d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Fri, 30 Oct 2026 10:57:45 +0100 Subject: [PATCH 2/5] fix(provider-limrun): clarify iOS fill behavior --- .../src/ios-interactor-text-entry.test.ts | 52 ++++++------------- packages/provider-limrun/src/ios.ts | 5 +- website/docs/docs/limrun.md | 2 +- 3 files changed, 17 insertions(+), 42 deletions(-) diff --git a/packages/provider-limrun/src/ios-interactor-text-entry.test.ts b/packages/provider-limrun/src/ios-interactor-text-entry.test.ts index 233138c3f2..4b2b4b0a18 100644 --- a/packages/provider-limrun/src/ios-interactor-text-entry.test.ts +++ b/packages/provider-limrun/src/ios-interactor-text-entry.test.ts @@ -87,45 +87,23 @@ test('fill waits for text-entry focus to arrive and only then sets the value', a expect(client.typeText).not.toHaveBeenCalled(); }); -test('fill sets Chinese, mixed, and emoji text in one write after focus', async () => { - for (const text of ['你好', 'qa@例子.com', '👋']) { - const { interactor, client, calls } = sessionWithTrees([emailField(false), emailField(true)]); - - const result = await interactor.fill(200, 170, text); - - expect(result).toEqual({ textEntryReadiness: 'focused-element' }); - expect(calls.indexOf('tap')).toBeLessThan(calls.lastIndexOf('elementTree')); - expect(calls.lastIndexOf('elementTree')).toBeLessThan(calls.indexOf('setElementValue')); - expect(client.setElementValue.mock.calls).toEqual([[text]]); - expect(client.pressKey).not.toHaveBeenCalled(); - expect(client.typeText).not.toHaveBeenCalled(); - } -}); - -test('fill replaces an ASCII value and clears with an empty string on the same path', async () => { - for (const text of ['replacement', '']) { - const { interactor, client } = sessionWithTrees([emailField(false), emailField(true)]); - - const result = await interactor.fill(200, 170, text); - - expect(result).toEqual({ textEntryReadiness: 'focused-element' }); - expect(client.setElementValue.mock.calls).toEqual([[text]]); - expect(client.pressKey).not.toHaveBeenCalled(); - expect(client.typeText).not.toHaveBeenCalled(); - } -}); - -test('a delayed fill still sets the complete value once', async () => { - for (const text of ['你好a', '']) { - const { interactor, client } = sessionWithTrees([emailField(false), emailField(true)]); +test.each([ + ['你好', undefined], + ['qa@例子.com', undefined], + ['👋', undefined], + ['replacement', undefined], + ['', undefined], + ['你好a', 1], + ['', 1], +])('fill writes %s once with delay %s', async (text, delayMs) => { + const { interactor, client } = sessionWithTrees([emailField(false), emailField(true)]); - const result = await interactor.fill(200, 170, text, 1); + const result = await interactor.fill(200, 170, text, delayMs); - expect(result).toEqual({ textEntryReadiness: 'focused-element' }); - expect(client.setElementValue.mock.calls).toEqual([[text]]); - expect(client.pressKey).not.toHaveBeenCalled(); - expect(client.typeText).not.toHaveBeenCalled(); - } + expect(result).toEqual({ textEntryReadiness: 'focused-element' }); + expect(client.setElementValue.mock.calls).toEqual([[text]]); + expect(client.pressKey).not.toHaveBeenCalled(); + expect(client.typeText).not.toHaveBeenCalled(); }); test('a session that cannot answer the focus read fails before the device is touched', async () => { diff --git a/packages/provider-limrun/src/ios.ts b/packages/provider-limrun/src/ios.ts index 8040034c62..06b9070d68 100644 --- a/packages/provider-limrun/src/ios.ts +++ b/packages/provider-limrun/src/ios.ts @@ -295,10 +295,7 @@ class LimrunIosInteractor implements Interactor { x, y, }); - // One value write on the focused element. The SDK omits the selector so the - // server resolves focus, and the whole string is the value, including an empty - // clear and characters that have no key code. A supplied delay stays on this - // signature for callers; per-character timing stays on `type`. + // Omitting the selector lets the server resolve focus. await this.session.client.setElementValue(text); return { textEntryReadiness }; } diff --git a/website/docs/docs/limrun.md b/website/docs/docs/limrun.md index 45aa9aac10..234e731a0e 100644 --- a/website/docs/docs/limrun.md +++ b/website/docs/docs/limrun.md @@ -75,7 +75,7 @@ On an iPhone, Limrun reports a native tab bar as one empty group. `snapshot` the On iOS, `settings` supports `appearance`, `permission`, `location`, and `clear-app-state`, with the same arguments as a local simulator. `clear-app-state` resets the app's data container through Limrun's soft reset. That reset relaunches the app once before agent-device stops it, so the app may run once after its data is cleared. `reset-keychain`, `wifi`, `airplane`, `mobile-data`, `faceid`, `touchid`, and `text-size` are unsupported, and you cannot read back any iOS setting. On Android, `settings mobile-data on|off` runs over the ADB tunnel like on a local device. -On iOS, `fill` taps the target, waits for that field to take text-entry focus, and replaces the focused field's value in one write. The write is the complete text, including an empty string that clears the field and characters that have no hardware key. Apps that never report a globally focused element, such as Flutter forms, still fill and report `textEntryReadiness: "focused-element"`. If the tap does not focus a field, `fill` fails with `text_entry_focus_not_observed` and writes nothing. `type` sends key events to whichever field already has focus. `--delay-ms` on `type` enters one character at a time; `--delay-ms` on `fill` keeps that replacement as one write of the whole value. +On iOS, `fill` taps the target, waits for that field to take text-entry focus, and replaces the focused field's value in one write. The write is the complete text, including an empty string that clears the field and characters that have no hardware key. It does not send key events, so key-event handlers may not run. Apps that never report a globally focused element, such as Flutter forms, still fill and report `textEntryReadiness: "focused-element"`. If the tap does not focus a field, `fill` fails with `text_entry_focus_not_observed` and writes nothing. `type` sends key events to whichever field already has focus. `--delay-ms` on `type` enters one character at a time; `--delay-ms` has no effect on `fill`. To drive Limrun only through MCP, see [Use a provider only through MCP](/docs/device-clouds#use-a-provider-only-through-mcp). For Limrun, `artifacts` lists the network capture file only when you connect with `--provider-network-logs`; otherwise there are no provider artifacts to fetch. From ee2d49a7bf255b4fa3864250634f0cd3c569bb88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Fri, 30 Oct 2026 11:08:49 +0100 Subject: [PATCH 3/5] fix(provider-limrun): report value write failures --- .../src/ios-interactor-text-entry.test.ts | 6 +++++- packages/provider-limrun/src/ios.ts | 16 +++++++++++++++- website/docs/docs/limrun.md | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/packages/provider-limrun/src/ios-interactor-text-entry.test.ts b/packages/provider-limrun/src/ios-interactor-text-entry.test.ts index 4b2b4b0a18..3e651cf8e0 100644 --- a/packages/provider-limrun/src/ios-interactor-text-entry.test.ts +++ b/packages/provider-limrun/src/ios-interactor-text-entry.test.ts @@ -149,7 +149,11 @@ test('a rejected value write fails the fill with that failure', async () => { const failure = new Error('element value refused'); client.setElementValue.mockRejectedValueOnce(failure); - await expect(interactor.fill(200, 170, '你好')).rejects.toBe(failure); + await expect(interactor.fill(200, 170, '你好')).rejects.toMatchObject({ + code: 'COMMAND_FAILED', + details: { reason: 'text_entry_value_write_failed', dispatched: 'unknown' }, + cause: failure, + }); expect(client.setElementValue.mock.calls).toEqual([['你好']]); expect(client.pressKey).not.toHaveBeenCalled(); expect(client.typeText).not.toHaveBeenCalled(); diff --git a/packages/provider-limrun/src/ios.ts b/packages/provider-limrun/src/ios.ts index 06b9070d68..ae9dcc7bc0 100644 --- a/packages/provider-limrun/src/ios.ts +++ b/packages/provider-limrun/src/ios.ts @@ -296,7 +296,21 @@ class LimrunIosInteractor implements Interactor { y, }); // Omitting the selector lets the server resolve focus. - await this.session.client.setElementValue(text); + try { + await this.session.client.setElementValue(text); + } catch (error) { + if (error instanceof AppError) throw error; + throw new AppError( + 'COMMAND_FAILED', + 'Limrun could not write the focused field value.', + { + reason: 'text_entry_value_write_failed', + dispatched: 'unknown', + hint: 'Inspect the field before retrying. Some apps do not expose a globally focused element to Limrun; use press and type to send key events instead.', + }, + error, + ); + } return { textEntryReadiness }; } diff --git a/website/docs/docs/limrun.md b/website/docs/docs/limrun.md index 234e731a0e..d516d9b70f 100644 --- a/website/docs/docs/limrun.md +++ b/website/docs/docs/limrun.md @@ -75,7 +75,7 @@ On an iPhone, Limrun reports a native tab bar as one empty group. `snapshot` the On iOS, `settings` supports `appearance`, `permission`, `location`, and `clear-app-state`, with the same arguments as a local simulator. `clear-app-state` resets the app's data container through Limrun's soft reset. That reset relaunches the app once before agent-device stops it, so the app may run once after its data is cleared. `reset-keychain`, `wifi`, `airplane`, `mobile-data`, `faceid`, `touchid`, and `text-size` are unsupported, and you cannot read back any iOS setting. On Android, `settings mobile-data on|off` runs over the ADB tunnel like on a local device. -On iOS, `fill` taps the target, waits for that field to take text-entry focus, and replaces the focused field's value in one write. The write is the complete text, including an empty string that clears the field and characters that have no hardware key. It does not send key events, so key-event handlers may not run. Apps that never report a globally focused element, such as Flutter forms, still fill and report `textEntryReadiness: "focused-element"`. If the tap does not focus a field, `fill` fails with `text_entry_focus_not_observed` and writes nothing. `type` sends key events to whichever field already has focus. `--delay-ms` on `type` enters one character at a time; `--delay-ms` has no effect on `fill`. +On iOS, `fill` taps the target, waits for that field to take text-entry focus, and replaces the focused field's value in one write. The write is the complete text, including an empty string that clears the field and characters that have no hardware key. It does not send key events, so key-event handlers may not run. Some apps, including Flutter forms, do not expose a globally focused element to Limrun. In those apps, `fill` can fail with `text_entry_value_write_failed` after focus is observed. Inspect the field before retrying; use `press` and `type` to send key events. If the tap does not focus a field, `fill` fails with `text_entry_focus_not_observed` and writes nothing. `type` sends key events to whichever field already has focus. `--delay-ms` on `type` enters one character at a time; `--delay-ms` has no effect on `fill`. To drive Limrun only through MCP, see [Use a provider only through MCP](/docs/device-clouds#use-a-provider-only-through-mcp). For Limrun, `artifacts` lists the network capture file only when you connect with `--provider-network-logs`; otherwise there are no provider artifacts to fetch. From 806016dacccc6f2a7701ac9869f9f02dc4eeff69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Fri, 30 Oct 2026 12:23:14 +0100 Subject: [PATCH 4/5] docs(limrun): clarify text entry recovery --- packages/provider-limrun/src/ios.ts | 2 +- src/commands/schema/cli-help.ts | 2 +- website/docs/docs/commands.md | 4 ++-- website/docs/docs/limrun.md | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/provider-limrun/src/ios.ts b/packages/provider-limrun/src/ios.ts index ae9dcc7bc0..ce79dc2c3c 100644 --- a/packages/provider-limrun/src/ios.ts +++ b/packages/provider-limrun/src/ios.ts @@ -306,7 +306,7 @@ class LimrunIosInteractor implements Interactor { { reason: 'text_entry_value_write_failed', dispatched: 'unknown', - hint: 'Inspect the field before retrying. Some apps do not expose a globally focused element to Limrun; use press and type to send key events instead.', + hint: 'Inspect and assert the field or resulting screen before continuing. If the value needs correction, retry fill with the full desired value. To append with key events, focus the field with press, then use type.', }, error, ); diff --git a/src/commands/schema/cli-help.ts b/src/commands/schema/cli-help.ts index 6cde4036ef..afd0fea202 100644 --- a/src/commands/schema/cli-help.ts +++ b/src/commands/schema/cli-help.ts @@ -104,7 +104,7 @@ Selectors: Text entry: fill replaces; type appends to an already-focused field: fill 'id="field-email"' "qa@example.com"; type "Handle with care" --delay-ms 80 fill "" clears the field (replace with nothing); the empty argument must be present -- fill alone is a missing argument. - Plain fill/type first; if an iOS debounced/search-as-you-type field drops characters, retry with --delay-ms before clipboard paste. + For dropped iOS text, retry with --delay-ms before clipboard paste. Limrun iOS: fill ignores --delay-ms; type supports delayed key events. Element presses behind the keyboard are refused with tap_keyboard_occludes_target. keyboard dismiss taps its own dismiss key when one exists, else UNSUPPORTED_OPERATION. Android: try dismiss before back. iOS: when both fail, do not tap a static text/heading hoping it is safe; prefer type "\\n" to submit. iOS paste-prompt limits and Android IME/handwriting capture quirks: help debugging. diff --git a/website/docs/docs/commands.md b/website/docs/docs/commands.md index fc0440d2ae..a8e8c94470 100644 --- a/website/docs/docs/commands.md +++ b/website/docs/docs/commands.md @@ -487,8 +487,8 @@ A `click` or `press` whose target the daemon resolves to a point (`@ref` or sele ### Text entry -- `fill` clears then types. `type` appends to the focused field and accepts text only: use `fill @ref "text"` to target a field, or `press @ref` then `type "text"`. -- Use plain `fill` or `type` first. Add `--delay-ms` only when a debounced or search-as-you-type field misses characters, or the app must receive each incremental update; delayed typing enters characters one at a time instead of using a clipboard-style fallback. +- `fill` replaces the field value. `type` appends to the focused field and accepts text only: use `fill @ref "text"` to target a field, or `press @ref` then `type "text"`. +- Use plain `fill` or `type` first. Add `--delay-ms` only when a debounced or search-as-you-type field misses characters, or the app must receive each incremental update; delayed typing enters characters one at a time instead of using a clipboard-style fallback. On Limrun iOS, `--delay-ms` has no effect on `fill`; use `press` to focus the field and `type --delay-ms` for intentional key-event input. - `fill --text-stdin` reads the text from stdin so a secret never appears in process arguments. Pipe it with `printf %s`. It reads at most 64 KiB, removes one trailing newline, and refuses a terminal, empty input, invalid UTF-8, or an extra text argument. Output shows the value as `${VAR}` with `--record-as ` and as `[REDACTED]` otherwise, including in error messages and details, and in the `requested`, `before`, and `after` read-back of an unconfirmed fill, which can hold a reformatted form of the value. With `--settle`, the diff line text and tail labels are replaced whole, so text around the value in the field is not shown either; refs and counts stay. While script recording is armed, pass `--record-as ` or `--no-record`; passing neither is an error. Batch steps don't accept it. - The privacy controls for typed input (`--text-stdin` and `--record-as`) keep the literal out of agent-device's own responses, diagnostics, and recorded scripts. They do not rewrite what the platform records: on iOS, XCTest writes its own diagnostic logs and its `.xcresult` bundle, and typed text can appear in both, on a simulator or a physical device. Treat those as sensitive, and use test-only credentials when they may be kept or shared. See [Security and trust](/docs/security-trust). - Android text entry is owned by `agent-device`. Don't fall back to raw `adb`, clipboard, or paste; if non-ASCII is unsupported on the current backend, report the gap. Android `fill` verifies the text and fails instead of retrying when the IME captures input. diff --git a/website/docs/docs/limrun.md b/website/docs/docs/limrun.md index d516d9b70f..68c827d6ff 100644 --- a/website/docs/docs/limrun.md +++ b/website/docs/docs/limrun.md @@ -75,7 +75,7 @@ On an iPhone, Limrun reports a native tab bar as one empty group. `snapshot` the On iOS, `settings` supports `appearance`, `permission`, `location`, and `clear-app-state`, with the same arguments as a local simulator. `clear-app-state` resets the app's data container through Limrun's soft reset. That reset relaunches the app once before agent-device stops it, so the app may run once after its data is cleared. `reset-keychain`, `wifi`, `airplane`, `mobile-data`, `faceid`, `touchid`, and `text-size` are unsupported, and you cannot read back any iOS setting. On Android, `settings mobile-data on|off` runs over the ADB tunnel like on a local device. -On iOS, `fill` taps the target, waits for that field to take text-entry focus, and replaces the focused field's value in one write. The write is the complete text, including an empty string that clears the field and characters that have no hardware key. It does not send key events, so key-event handlers may not run. Some apps, including Flutter forms, do not expose a globally focused element to Limrun. In those apps, `fill` can fail with `text_entry_value_write_failed` after focus is observed. Inspect the field before retrying; use `press` and `type` to send key events. If the tap does not focus a field, `fill` fails with `text_entry_focus_not_observed` and writes nothing. `type` sends key events to whichever field already has focus. `--delay-ms` on `type` enters one character at a time; `--delay-ms` has no effect on `fill`. +On iOS, `fill` taps the target, waits for that field to take text-entry focus, and replaces the focused field's value in one write. The write is the complete text, including an empty string that clears the field and characters that have no hardware key. It does not send key events, so key-event handlers may not run. Some apps, including Flutter forms, do not expose a globally focused element to Limrun. In those apps, `fill` can fail with `text_entry_value_write_failed` after focus is observed. The write outcome is unknown. Inspect and assert the field or resulting screen before continuing. If the value needs correction, retry `fill` with the full desired value. To append with key events, use `press` to focus the field, then `type`. If the tap does not focus a field, `fill` fails with `text_entry_focus_not_observed` and writes nothing. `type` sends key events to whichever field already has focus. `--delay-ms` on `type` enters one character at a time; `--delay-ms` has no effect on `fill`. To drive Limrun only through MCP, see [Use a provider only through MCP](/docs/device-clouds#use-a-provider-only-through-mcp). For Limrun, `artifacts` lists the network capture file only when you connect with `--provider-network-logs`; otherwise there are no provider artifacts to fetch. From 20adcdca626bd834c6ef1731d409fb1837f64d26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Fri, 30 Oct 2026 12:38:35 +0100 Subject: [PATCH 5/5] docs(limrun): describe fill errors in command reference --- website/docs/docs/commands.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/website/docs/docs/commands.md b/website/docs/docs/commands.md index a8e8c94470..03d96a0108 100644 --- a/website/docs/docs/commands.md +++ b/website/docs/docs/commands.md @@ -453,8 +453,8 @@ agent-device alert dismiss agent-device click @e1 agent-device click @e1 --button secondary # macOS secondary click / context menu agent-device focus @e2 -agent-device fill @e2 "text" # Clear then type -agent-device fill @e2 "search" --delay-ms 100 +agent-device fill @e2 "text" # Replace the field value +agent-device fill @e2 "search" --delay-ms 100 # No delay on Limrun iOS fill printf %s "$PASSWORD" | agent-device fill @e2 --text-stdin # Text from stdin, kept out of argv agent-device type "text" # Type into focused field without clearing agent-device type "query" --delay-ms 100 @@ -495,6 +495,8 @@ A `click` or `press` whose target the daemon resolves to a point (`@ref` or sele Text-entry errors and what to do: +- `text_entry_focus_not_observed` (Limrun iOS `fill`): the tap did not establish focus on the target, so no value was written. Run `snapshot -i` and choose the input again. +- `text_entry_value_write_failed` (Limrun iOS `fill`): the write outcome is unknown. Inspect and assert the field or resulting screen before continuing. Retry `fill` with the full value only if it needs correction. See [Limrun iOS text entry](/docs/limrun). - `TEXT_INPUT_NOT_FOCUSED` (`type`): focus a visible text input and retry. If accessibility does not expose the input, focus it by coordinates. - `NO_TEXT_INPUT_AT_POINT` (iOS `fill` under a degraded XCTest channel — coordinate, ref, selector, and replay fills all aim at a point): the runner identified no text input under that point and refused before dispatching anything (`error.details.reason` is `no_text_input_at_point`, `dispatched: no`), so no field changed. A ref or selector fill aims at the centre of the rect it resolved to, so an outer container or a non-input node can land outside the real field: run `snapshot -i`, pick the input node itself, and aim inside its rect. - `TEXT_INPUT_PROBE_UNAVAILABLE` (iOS `fill` under a degraded XCTest channel — coordinate, ref, selector, and replay fills all aim at a point): the runner's input lookup could not answer, so it refused before dispatching anything (`error.details.reason` is `text_input_probe_unavailable`, `dispatched: no`). This does not mean the point has no input. Retry the fill, or run `snapshot -i` once its capture reads back. A ref or selector fill aims at the centre of its resolved rect.