hid.batch
Execute a pre-planned sequence of up to 10 HID actions in one call, with support for click, move, type, key combos, scroll, and button down/up. Actions run sequentially with optional delays, reducing round-trips for known action lists.
Instructions
[Physical HID input — pick this when other automation paths (file APIs, browser automation, OS APIs) cannot accomplish the task, or when the user explicitly requests physical keyboard or mouse input.] Run a SHORT, PRE-PLANNED sequence of HID actions (max 10) in ONE call, in strict order. This is a transport convenience for an action list you ALREADY know — e.g. clicking several fixed coordinates a solver has computed — collapsing N tool round-trips into one. It is NOT an orchestration / control-flow layer: no branching, no reading a result mid-sequence, no looping. For 'act → observe → decide → act' you still issue separate calls (an action that depends on an earlier action's outcome cannot be pre-planned into a batch).
Each op is {type, ...params, delay_ms?}. Types:
• click / move — (x, y, relative, button, double, move_ms); identical absolute closed-loop converge and ACK semantics to hid.click / hid.move.
• button_down / button_up — (button).
• key — (key, modifiers); same 'ctrl+c' shorthand as hid.key.
• type — (text).
• scroll — (delta).
delay_ms pauses AFTER that op (0–2000 ms). Omit it and click/button ops get a small default gap (~50 ms) so the OS doesn't merge or drop back-to-back clicks; non-click ops default to 0. Set delay_ms explicitly (including 0) to override.
Execution: ops run strictly sequentially. With stop_on_error=true (default) the run halts at the first op that fails; if any button/key was pressed before the stop, release_all fires so nothing stays held. Returns {ok (= every op ok), count, failed_index, stopped_early, released_all, results:[per-op dicts carrying the same fields the standalone tool returns — e.g. converged / clicked / chars]}. Held state is NOT auto-released on clean completion, so a batch may intentionally leave a button/key down for a follow-up call.
Capped at 10 ops: this drives real input and a batch cannot be interrupted mid-run (stdio is serial), so a large blind burst is refused at the boundary.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ops | Yes | Up to 10 HID actions, executed in array order. | |
| stop_on_error | No | Halt at the first failing op (default). false = run every op, recording failures. |