tauri-agent-tools 0.9.0 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: tauri-agent-tools
3
3
  description: CLI for inspecting and interacting with Tauri desktop apps — DOM queries, screenshots, interaction (click/type/scroll), IPC monitoring, store inspection, structured assertions, plus bridge-free diagnostics (unified cross-layer logs, deep OS process trees, OS logs, app paths, sidecar NDJSON tap/replay, forensic bundles) and the `diagnose`/`bundle` super-commands for one-shot triage. Works against older/vendored bridges by degrading gracefully.
4
- version: 0.9.0
4
+ version: 0.9.2
5
5
  tags: [tauri, desktop, debugging, screenshot, dom, inspection, diff, mutations, snapshot, interaction, click, type, scroll, invoke, probe, capture, check, store-inspect, logs, bundle, process-tree, forensics, os-logs, app-paths, sidecar, config-inspect, diagnose]
6
6
  ---
7
7
 
@@ -39,7 +39,7 @@ Some commands require the Rust dev bridge running inside the Tauri app. Others w
39
39
  `capabilities audit`, `webview attach`, `health` *(richer with bridge v0.7+)*
40
40
 
41
41
  **Standalone** (no bridge needed):
42
- `screenshot --title` (full window only), `wait --title`, `list-windows`, `info`, `diff`, `logs`, `app-paths`, `config inspect`, `os-logs`, `sidecar tap`, `sidecar replay`, `forensics`
42
+ `screenshot --title`/`--window-id` (full window only), `wait --title`, `list-windows`, `info`, `diff`, `logs`, `app-paths`, `config inspect`, `os-logs`, `sidecar tap`, `sidecar replay`, `forensics`
43
43
 
44
44
  **Optional bridge** (work standalone, richer with a bridge):
45
45
  `probe`, `process-tree` (use `--deep` for a bridge-free OS walk), `logs` (merges on-disk files alone, or also drains the bridge ring buffer), `bundle`, `diagnose`
@@ -269,6 +269,9 @@ tauri-agent-tools type "#search" "hello world" --json
269
269
  # Clear and retype
270
270
  tauri-agent-tools type "#email" "new@email.com" --clear --json
271
271
 
272
+ # App applies the value on a transition/async render: wait longer for it to stick
273
+ tauri-agent-tools type "#q" "term" --verify-timeout 2000 --json
274
+
272
275
  # Scroll to bottom
273
276
  tauri-agent-tools scroll --to-bottom --json
274
277
 
@@ -292,6 +295,8 @@ tauri-agent-tools invoke get_release_context --json
292
295
  tauri-agent-tools invoke save_item '{"id": 42}' --json
293
296
  ```
294
297
 
298
+ `type` and `select <value>` write through the element's native `value` setter (so React/Vue/Svelte controlled inputs see the change); `select --toggle` performs a native `click()`. Both then re-read the element. `verification: "reverted"` in the failure JSON (exit 1, with a `hint`; `type` prints it with `--json`, `select` always) means the app rolled the write back — a controlled input that rejected it — and is the app's answer, not a tooling error. `verification: "transformed"` means the app reformatted the value and counts as success (`verified: false`).
299
+
295
300
  ### Probe, capture, and check (workflow commands)
296
301
 
297
302
  ```bash
@@ -332,12 +337,12 @@ tauri-agent-tools eval "document.title" --window-label overlay --json
332
337
 
333
338
  | Command | Key Flags | Bridge? | Description |
334
339
  |---------|-----------|---------|-------------|
335
- | `screenshot` | `--selector <css>`, `--title <regex>`, `-o <path>`, `--max-width <n>` | selector: yes, title: no | Capture window or DOM element screenshot |
340
+ | `screenshot` | `--selector <css>`, `--title <regex>`, `--window-id <id>`, `-o <path>`, `--max-width <n>` | selector: yes, title/window-id: no | Capture window or DOM element screenshot |
336
341
  | `dom` | `[selector]`, `--depth <n>`, `--styles`, `--text <pattern>`, `--mode accessibility`, `--json` | yes | Query DOM structure or find elements by text |
337
342
  | `eval` | `<js-expression>`, `--file <path>` | yes | Evaluate JavaScript in webview |
338
343
  | `wait` | `--selector <css>`, `--eval <js>`, `--title <regex>`, `--timeout <ms>` | selector/eval: yes | Wait for a condition |
339
344
  | `list-windows` | `--tauri`, `--json` | no | List visible windows |
340
- | `info` | `--title <regex>`, `--json` | no | Window geometry and display info |
345
+ | `info` | `--title <regex>`, `--window-id <id>`, `--json` | no | Window geometry and display info |
341
346
  | `ipc-monitor` | `--filter <cmd>`, `--duration <ms>`, `--slow <ms>`, `--stats`, `--json` | yes | Monitor Tauri IPC calls; flag slow calls + per-command latency summary |
342
347
  | `console-monitor` | `--level <lvl>`, `--filter <regex>`, `--duration <ms>`, `--json` | yes | Monitor console output |
343
348
  | `rust-logs` | `--level <lvl>`, `--target <regex>`, `--source <src>`, `--duration <ms>`, `--json` | yes | Monitor Rust logs and sidecar output |
@@ -345,16 +350,16 @@ tauri-agent-tools eval "document.title" --window-label overlay --json
345
350
  | `page-state` | `--json` | yes | URL, title, viewport, scroll, document size |
346
351
  | `diff` | `<image1> <image2>`, `-o <path>`, `--threshold <pct>`, `--json` | no | Compare two screenshots |
347
352
  | `mutations` | `<selector>`, `--attributes`, `--duration <ms>`, `--json` | yes | Watch DOM mutations |
348
- | `snapshot` | `-o <prefix>`, `-s <css>`, `--dom-depth <n>`, `--eval <js>`, `--json` | yes | Screenshot + DOM + page state + storage |
353
+ | `snapshot` | `-o <prefix>`, `-s <css>`, `--window-id <id>`, `--dom-depth <n>`, `--eval <js>`, `--json` | yes | Screenshot + DOM + page state + storage |
349
354
  | `click` | `<selector>`, `--double`, `--right`, `--wait <ms>`, `--json` | yes | Click a DOM element |
350
- | `type` | `<selector> <text>`, `--clear`, `--json` | yes | Type text into an input |
355
+ | `type` | `<selector> <text>`, `--clear`, `--verify-timeout <ms>`, `--json` | yes | Type text into an input (native setter, verified write) |
351
356
  | `scroll` | `--selector <css>`, `--by <px>`, `--to-top`, `--to-bottom`, `--into-view`, `--json` | yes | Scroll window or element |
352
357
  | `focus` | `<selector>`, `--json` | yes | Focus a DOM element |
353
358
  | `navigate` | `<target>`, `--json` | yes | Navigate within the app |
354
- | `select` | `<selector> [value]`, `--toggle`, `--json` | yes | Select dropdown or toggle checkbox |
359
+ | `select` | `<selector> [value]`, `--toggle`, `--verify-timeout <ms>`, `--json` | yes | Select dropdown or toggle checkbox (native setter; `--toggle` via native `click()`; verified write) |
355
360
  | `invoke` | `<command> [args-json]`, `--json` | yes | Invoke a Tauri IPC command |
356
361
  | `probe` | `--pid <n>`, `--json` | optional | Discover targets and bridge health |
357
- | `capture` | `-o <dir>`, `-s <css>`, `--logs-duration <ms>`, `--json` | yes | Full debug evidence bundle |
362
+ | `capture` | `-o <dir>`, `-s <css>`, `--window-id <id>`, `--logs-duration <ms>`, `--json` | yes | Full debug evidence bundle |
358
363
  | `check` | `--selector`, `--text`, `--eval`, `--no-errors`, `--json` | yes | Structured assertions (exit 0/1) |
359
364
  | `store-inspect` | `--framework`, `--store <name>`, `--depth <n>`, `--json` | yes | Inspect reactive store state |
360
365
  | `app-paths` | `--config <path>`, `--identifier <id>`, `--platform <os>`, `--exists`, `--json` | no | Resolve Tauri 2 app's OS data/log/cache/config dirs |
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: tauri-bridge-setup
3
3
  description: How to add the tauri-agent-tools Rust dev bridge to a Tauri application
4
- version: 0.9.0
4
+ version: 0.9.2
5
5
  tags: [tauri, rust, bridge, setup, integration, multi-window, process-tree, capabilities, devtools, health]
6
6
  ---
7
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: tauri-debug-quickstart
3
3
  description: First-30-seconds triage for a broken Tauri desktop app. Pick the right command for the symptom you're seeing, with one-line escalations to deeper skills.
4
- version: 0.9.0
4
+ version: 0.9.2
5
5
  tags: [tauri, debugging, triage, quickstart, decision-tree, logs, process-tree, bundle, forensics, diagnose]
6
6
  ---
7
7
 
package/README.md CHANGED
@@ -92,7 +92,8 @@ Capture a screenshot of a window or DOM element.
92
92
  | Option | Description |
93
93
  |--------|-------------|
94
94
  | `-s, --selector <css>` | CSS selector — screenshot just this element (requires bridge) |
95
- | `-t, --title <regex>` | Window title to match |
95
+ | `-t, --title <regex>` | Window title to match — regex; quote titles with spaces |
96
+ | `-w, --window-id <id>` | Platform window id (from `list-windows`) — overrides `--title` |
96
97
  | `-o, --output <path>` | Output file path (default: auto-named) |
97
98
  | `--format <png\|jpg>` | Output format (default: png) |
98
99
  | `--max-width <number>` | Resize to max width |
@@ -148,6 +149,7 @@ Show window geometry and display server info.
148
149
 
149
150
  ```bash
150
151
  tauri-agent-tools info --title "My App" --json
152
+ tauri-agent-tools info --window-id 12345678 # id from list-windows, skips title search
151
153
  ```
152
154
 
153
155
  ### `list-windows`
@@ -232,7 +234,8 @@ Capture screenshot + DOM tree + page state + storage in one shot. Writes multipl
232
234
  |--------|-------------|
233
235
  | `-o, --output <prefix>` | Output path prefix (e.g. `/tmp/debug`) |
234
236
  | `-s, --selector <css>` | CSS selector to screenshot (full window if omitted) |
235
- | `-t, --title <regex>` | Window title to match (default: auto-discover) |
237
+ | `-t, --title <regex>` | Window title to match — regex; quote titles with spaces (default: auto-discover) |
238
+ | `-w, --window-id <id>` | Platform window id (from `list-windows`) — overrides `--title` |
236
239
  | `--dom-depth <number>` | DOM tree depth (default: 3) |
237
240
  | `--eval <js>` | Additional JS to eval and save |
238
241
  | `--json` | Output structured manifest |
@@ -255,14 +258,16 @@ Monitor Rust backend logs and sidecar output in real-time. Unlike `console-monit
255
258
 
256
259
  Interaction commands dispatch DOM events inside the webview. They require the dev bridge (debug builds only).
257
260
 
261
+ `type` and `select` write through the element's native prototype `value` setter — React's per-instance value tracker turns a plain `el.value = …` into a no-op — and dispatch bubbling `input`/`change` events, so React, Vue, and Svelte controlled inputs update their state; `select --toggle` performs a native `click()`. Both then re-read the element: a value the app rolled back fails with `Value reverted` (`Checked state reverted` for `--toggle`; exit 1 with the reason and a `hint` on stderr, and the failure object with `verification: "reverted"` on stdout — with `--json` for `type`, always for `select`) — treat that as the app's answer, not a tooling error — while a value the app reformatted is a success reported with `verification: "transformed"`. `--verify-timeout <ms>` (default 500) tunes the re-read deadline for apps that apply values asynchronously.
262
+
258
263
  | Command | Description |
259
264
  |---------|-------------|
260
265
  | `click <selector>` | Click a DOM element (`--double`, `--right`, `--wait <ms>`) |
261
- | `type <selector> <text>` | Type text into an input (`--clear` to empty first) |
266
+ | `type <selector> <text>` | Type text into an input via the native value setter, then verify the write (`--clear` to empty first, `--verify-timeout <ms>`) |
262
267
  | `scroll` | Scroll window or element (`--by <px>`, `--to-top`, `--to-bottom`, `--into-view`) |
263
268
  | `focus <selector>` | Focus a DOM element |
264
269
  | `navigate <target>` | Navigate within the app (route path or URL) |
265
- | `select <selector> [value]` | Select dropdown value or toggle checkbox (`--toggle`) |
270
+ | `select <selector> [value]` | Select a dropdown value or toggle a checkbox via native `click()`, then verify the write (`--toggle`, `--verify-timeout <ms>`) |
266
271
  | `invoke <command> [args-json]` | Invoke a Tauri IPC command |
267
272
 
268
273
  ### Workflow Commands
@@ -6,6 +6,7 @@ export interface CaptureToDirOptions {
6
6
  output: string;
7
7
  selector?: string;
8
8
  title?: string;
9
+ windowId?: string;
9
10
  domDepth: number;
10
11
  eval?: string;
11
12
  logsDuration: number;
@@ -1,7 +1,7 @@
1
1
  import { writeFile, mkdir } from 'node:fs/promises';
2
2
  import { join } from 'node:path';
3
3
  import { Command } from 'commander';
4
- import { addBridgeOptions, resolveBridge, parseIntArg } from './shared.js';
4
+ import { addBridgeOptions, resolveBridge, resolveWindowId, parseIntArg } from './shared.js';
5
5
  import { buildSerializerScript } from './dom.js';
6
6
  import { computeCropRect, cropImage } from '../util/image.js';
7
7
  import { DomNodeSchema } from '../schemas/dom.js';
@@ -37,14 +37,6 @@ const DRAIN_CONSOLE_ERRORS_SCRIPT = `(() => {
37
37
  window.__captureErrors = [];
38
38
  return JSON.stringify(errs);
39
39
  })()`;
40
- async function resolveWindowId(adapter, bridge, title) {
41
- if (title)
42
- return adapter.findWindow(title);
43
- const docTitle = await bridge.getDocumentTitle();
44
- if (!docTitle)
45
- throw new Error('Could not get window title. Use --title.');
46
- return adapter.findWindow(docTitle);
47
- }
48
40
  export async function captureToDir(bridge, adapter, opts) {
49
41
  const outDir = opts.output;
50
42
  const format = 'png';
@@ -77,7 +69,7 @@ export async function captureToDir(bridge, adapter, opts) {
77
69
  }
78
70
  // 4. Screenshot — save to screenshot.png
79
71
  try {
80
- const windowId = await resolveWindowId(adapter, bridge, opts.title);
72
+ const windowId = await resolveWindowId(adapter, bridge, opts);
81
73
  let buffer;
82
74
  if (opts.selector) {
83
75
  const elementRect = await bridge.getElementRect(opts.selector);
@@ -185,7 +177,8 @@ export function registerCapture(program, getAdapter) {
185
177
  .description('Capture enhanced snapshot with manifest directory (screenshot, DOM, state, logs, errors)')
186
178
  .requiredOption('-o, --output <dir>', 'Output directory path')
187
179
  .option('-s, --selector <css>', 'CSS selector to screenshot (full window if omitted)')
188
- .option('-t, --title <regex>', 'Window title to match (default: auto-discover)')
180
+ .option('-t, --title <regex>', 'Window title to match — regex; quote titles with spaces (default: auto-discover)')
181
+ .option('-w, --window-id <id>', 'Platform window id (from list-windows) — overrides --title')
189
182
  .option('--dom-depth <number>', 'DOM tree depth', parseIntArg, 3)
190
183
  .option('--eval <js>', 'Additional JS to eval and save')
191
184
  .option('--logs-duration <ms>', 'Duration to wait for console errors (ms)', parseIntArg, 3000)
@@ -1 +1 @@
1
- {"version":3,"file":"capture.js","sourceRoot":"","sources":["../../src/commands/capture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAItF,MAAM,iBAAiB,GAAG;;;;;;;;;KASrB,CAAC;AAEN,MAAM,cAAc,GAAG;;;;KAIlB,CAAC;AAEN,MAAM,2BAA2B,GAAG;;;;;;;;;;KAU/B,CAAC;AAEN,MAAM,2BAA2B,GAAG;;;;KAI/B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CAAC;QAC5C,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;QACzC,OAAO,CAAC,GAAG,CAAC,IAAI,MAAM,KAAK,GAAG,KAAK,KAAK,EAAE,CAAC,CAAC;IAC9C,CAAC;IACD,IAAI,CAAC,QAAQ,CAAC,UAAU,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;QACnC,OAAO,CAAC,GAAG,CAAC,KAAK,QAAQ,CAAC,UAAU,sBAAsB,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC"}
@@ -3,11 +3,21 @@ import { detectDisplayServer } from '../platform/detect.js';
3
3
  export function registerInfo(program, getAdapter) {
4
4
  const cmd = new Command('info')
5
5
  .description('Show window geometry and display server info')
6
- .requiredOption('-t, --title <regex>', 'Window title to match')
6
+ .option('-t, --title <regex>', 'Window title to match — regex; quote titles with spaces')
7
+ .option('-w, --window-id <id>', 'Platform window id (from list-windows) — overrides --title')
7
8
  .option('--json', 'Output as JSON')
8
9
  .action(async (opts) => {
9
10
  const adapter = await getAdapter();
10
- const windowId = await adapter.findWindow(opts.title);
11
+ let windowId;
12
+ if (opts.windowId) {
13
+ windowId = opts.windowId;
14
+ }
15
+ else if (opts.title) {
16
+ windowId = await adapter.findWindow(opts.title);
17
+ }
18
+ else {
19
+ throw new Error('Either --title or --window-id is required');
20
+ }
11
21
  const geom = await adapter.getWindowGeometry(windowId);
12
22
  const name = await adapter.getWindowName(windowId);
13
23
  const displayServer = detectDisplayServer();
@@ -1 +1 @@
1
- {"version":3,"file":"info.js","sourceRoot":"","sources":["../../src/commands/info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,YAAY,CAC1B,OAAgB,EAChB,UAA4D;IAE5D,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,M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CAAC,IAAI,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7C,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;YAChD,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YAC5C,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;YACpD,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;YAC5D,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;QACvD,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AAC1B,CAAC"}
@@ -1,3 +1,8 @@
1
1
  import { Command } from 'commander';
2
- export declare function buildSelectScript(selector: string, value?: string, toggle?: boolean): string;
2
+ import type { VerifyOptions } from './shared.js';
3
+ /**
4
+ * Value mode writes through the native prototype value setter and verifies the
5
+ * write (see buildSetValueScript); toggle mode performs a native click().
6
+ */
7
+ export declare function buildSelectScript(selector: string, value?: string, toggle?: boolean, options?: VerifyOptions): string;
3
8
  export declare function registerSelect(program: Command): void;
@@ -1,37 +1,83 @@
1
1
  import { Command } from 'commander';
2
2
  import { resolveBridge } from '../shared.js';
3
- import { addInteractOptions, escapeSelector } from './shared.js';
3
+ import { addInteractOptions, addVerifyOptions, buildSetValueScript, escapeSelector, parseInteractResult, resolveVerifyTimeout, VERIFY_INTERVAL_MS, VERIFY_POLL_SNIPPET, } from './shared.js';
4
4
  import { SelectResultSchema } from '../../schemas/interact.js';
5
- export function buildSelectScript(selector, value, toggle = false) {
5
+ /**
6
+ * --toggle: a native click(). The browser flips checkedness internally (not
7
+ * through the JS `checked` setter React wraps), fires input + change, honours
8
+ * preventDefault(), and is the only event React's ChangeEventPlugin observes
9
+ * for checkbox/radio. click() is a no-op on disabled controls (including
10
+ * descendants of <fieldset disabled>) and cannot uncheck a radio, so those
11
+ * are refused up front instead of reporting a state that did not change.
12
+ */
13
+ function buildToggleScript(selector, verifyTimeoutMs) {
6
14
  const escaped = escapeSelector(selector);
7
- if (toggle) {
8
- return `(function() {
9
- try {
10
- var el = document.querySelector('${escaped}');
11
- if (!el) return JSON.stringify({ success: false, error: 'Element not found: ${escaped}' });
12
- el.checked = !el.checked;
13
- el.dispatchEvent(new Event('change', { bubbles: true }));
14
- el.dispatchEvent(new Event('input', { bubbles: true }));
15
- return JSON.stringify({ success: true, selector: '${escaped}', tagName: el.tagName.toLowerCase(), checked: el.checked });
16
- } catch (e) {
17
- return JSON.stringify({ success: false, error: String(e) });
15
+ return `(() => {${VERIFY_POLL_SNIPPET}
16
+ var selector = '${escaped}';
17
+ var fail = function (extra) { return JSON.stringify(Object.assign({ success: false, selector: selector }, extra)); };
18
+ function isDisabled(node) {
19
+ try { if (node.matches(':disabled')) return true; } catch (e) { /* selector unsupported */ }
20
+ if (node.disabled) return true;
21
+ return !!(typeof node.closest === 'function' && node.closest('fieldset[disabled]'));
18
22
  }
19
- })()`;
20
- }
21
- const escapedValue = value !== undefined ? escapeSelector(value) : '';
22
- return `(function() {
23
23
  try {
24
- var el = document.querySelector('${escaped}');
25
- if (!el) return JSON.stringify({ success: false, error: 'Element not found: ${escaped}' });
26
- el.value = '${escapedValue}';
27
- el.dispatchEvent(new Event('change', { bubbles: true }));
28
- el.dispatchEvent(new Event('input', { bubbles: true }));
29
- return JSON.stringify({ success: true, selector: '${escaped}', tagName: el.tagName.toLowerCase(), value: el.value });
24
+ var el = document.querySelector(selector);
25
+ if (!el) return fail({ error: 'Element not found: ' + selector });
26
+ var tagName = el.tagName.toLowerCase();
27
+ var inputType = tagName === 'input' ? String(el.type || 'text').toLowerCase() : '';
28
+ if (inputType !== 'checkbox' && inputType !== 'radio') {
29
+ return fail({ tagName: tagName, error: 'Element <' + tagName + (inputType ? ' type=' + inputType : '') + '> is not a checkbox or radio', hint: '--toggle supports <input type=checkbox|radio>; use \`select <selector> <value>\` for other elements.' });
30
+ }
31
+ var before = !!el.checked;
32
+ if (isDisabled(el)) {
33
+ return fail({ tagName: tagName, checked: before, error: 'Element is disabled (or inside a disabled <fieldset>); click() has no effect' });
34
+ }
35
+ if (inputType === 'radio' && before) {
36
+ return fail({ tagName: tagName, checked: true, error: 'Radio input is already checked; a radio cannot be unchecked by clicking it', hint: 'Toggle the sibling radio you want selected instead.' });
37
+ }
38
+ var expected = !before;
39
+ el.click();
40
+ return __verify(function () {
41
+ var cur = document.querySelector(selector) || (el.isConnected ? el : null);
42
+ return cur ? !!cur.checked : null;
43
+ }, expected, ${verifyTimeoutMs}, ${VERIFY_INTERVAL_MS}).then(function (v) {
44
+ if (v.ok) {
45
+ return JSON.stringify({ success: true, selector: selector, tagName: tagName, checked: v.observed, previousChecked: before, verified: true, verification: 'matched' });
46
+ }
47
+ if (v.observed === null) {
48
+ return fail({
49
+ tagName: tagName, previousChecked: before, verified: false,
50
+ error: 'Element left the document after click(); the checked state could not be verified',
51
+ hint: 'The app removed or re-rendered the element without a matching selector after the click (navigation, a remount, or the click consumed the item). Re-query the DOM to confirm the app state.'
52
+ });
53
+ }
54
+ return fail({
55
+ tagName: tagName, checked: !!v.observed, previousChecked: before, verified: false, verification: 'reverted',
56
+ error: 'Checked state reverted: click() set checked=' + expected + ' but the element reads ' + String(!!v.observed) + ' after ${verifyTimeoutMs}ms',
57
+ hint: 'A controlled checkbox whose change handler did not accept the change, or a click listener that called preventDefault().'
58
+ });
59
+ });
30
60
  } catch (e) {
31
- return JSON.stringify({ success: false, error: String(e) });
61
+ return fail({ error: 'Script error: ' + (e && e.message ? e.message : String(e)) });
32
62
  }
33
63
  })()`;
34
64
  }
65
+ /**
66
+ * Value mode writes through the native prototype value setter and verifies the
67
+ * write (see buildSetValueScript); toggle mode performs a native click().
68
+ */
69
+ export function buildSelectScript(selector, value, toggle = false, options) {
70
+ const verifyTimeoutMs = resolveVerifyTimeout(options);
71
+ if (toggle)
72
+ return buildToggleScript(selector, verifyTimeoutMs);
73
+ return buildSetValueScript(selector, value ?? '', {
74
+ focus: false,
75
+ clear: false,
76
+ lowerCaseTagName: true,
77
+ notFoundErrorExpr: `'Element not found: ' + selector`,
78
+ verifyTimeoutMs,
79
+ });
80
+ }
35
81
  export function registerSelect(program) {
36
82
  const cmd = new Command('select')
37
83
  .description('Set the value of a form element or toggle a checkbox')
@@ -42,17 +88,29 @@ export function registerSelect(program) {
42
88
  Examples:
43
89
  $ tauri-agent-tools select "select#country" "US"
44
90
  $ tauri-agent-tools select "input[name='agree']" --toggle
45
- $ tauri-agent-tools select "input#search" "hello world"`);
91
+ $ tauri-agent-tools select "input#search" "hello world"
92
+
93
+ Values are written through the native prototype setter and followed by bubbling
94
+ input + change events; <select> values must match an <option> value attribute.
95
+ --toggle performs a native click() so React and other frameworks that listen to
96
+ click for checkboxes update their state. The element is re-read afterwards and
97
+ the command fails when the app reverted the change.`);
46
98
  addInteractOptions(cmd);
99
+ addVerifyOptions(cmd);
47
100
  cmd.action(async (selector, value, opts) => {
101
+ // Build first: an invalid --verify-timeout fails before any bridge call.
102
+ const script = buildSelectScript(selector, value, opts.toggle ?? false, { verifyTimeoutMs: opts.verifyTimeout });
48
103
  const bridge = await resolveBridge(opts);
49
- const script = buildSelectScript(selector, value, opts.toggle ?? false);
50
104
  const raw = await bridge.eval(script);
51
- const result = SelectResultSchema.parse(JSON.parse(String(raw)));
105
+ const result = parseInteractResult(raw, SelectResultSchema, 'Select');
106
+ // select always prints its JSON result; on failure the object (verification,
107
+ // hint, options, …) still goes to stdout, and the thrown error reaches
108
+ // stderr and sets exit code 1.
109
+ console.log(JSON.stringify(result, null, 2));
52
110
  if (!result.success) {
53
- throw new Error(result.error ?? 'Select failed');
111
+ const hint = result.hint ? `\n hint: ${result.hint}` : '';
112
+ throw new Error(`${result.error ?? 'Select failed'}${hint}`);
54
113
  }
55
- console.log(JSON.stringify(result, null, 2));
56
114
  });
57
115
  program.addCommand(cmd);
58
116
  }
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","sourceRoot":"","sources":["../../../src/commands/interact/select.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,UAAU,iBAAiB,CAAC,QAAgB,EAAE,KAAc,EAAE,SAAkB,KAAK;IACzF,MAAM,OAAO,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;IAEzC,IAAI,MAAM,EAAE,CAAC;QACX,OAAO;;uCAE4B,OAAO;kFACoC,OAAO;;;;wDAIjC,OAAO;;;;KAI1D,CAAC;IACJ,CAAC;IAED,MAAM,YAAY,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACtE,OAAO;;uCAE8B,OAAO;kFACoC,OAAO;kBACvE,YAAY;;;wDAG0B,OAAO;;;;KAI1D,CAAC;AACN,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAAgB;IAC7C,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;SAC9B,WAAW,CAAC,sDAAsD,CAAC;SACnE,QAAQ,CAAC,YAAY,EAAE,6BAA6B,CAAC;SACrD,QAAQ,CAAC,SAAS,EAAE,oCAAoC,CAAC;SACzD,MAAM,CAAC,UAAU,EAAE,iDAAiD,CAAC;SACrE,WAAW,CAAC,OAAO,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,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,IAAI,KAAK,EAAE,EAAE,eAAe,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;QACjH,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtC,MAAM,MAAM,GAAG,mBAAmB,CAAC,GAAG,EAAE,kBAAkB,EAAE,QAAQ,CAAC,CAAC;QACtE,6EAA6E;QAC7E,uEAAuE;QACvE,+BAA+B;QAC/B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3D,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,IAAI,eAAe,GAAG,IAAI,EAAE,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC,CACF,CAAC;IAEF,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AAC1B,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { Command } from 'commander';
2
+ import type { z } from 'zod';
2
3
  /**
3
4
  * Escapes backslashes and single quotes in CSS selectors for safe
4
5
  * embedding inside JS string literals wrapped in single quotes.
@@ -21,3 +22,98 @@ export declare function buildWaitAndFindScript(selector: string, waitMs: number)
21
22
  * plus --json for machine-readable output. Returns the command for chaining.
22
23
  */
23
24
  export declare function addInteractOptions(cmd: Command): Command;
25
+ /**
26
+ * Default deadline for the post-write re-read. An accepted write resolves on
27
+ * the first (synchronous) check, so it costs nothing; only a rejected write
28
+ * waits out the whole deadline.
29
+ */
30
+ export declare const DEFAULT_VERIFY_TIMEOUT_MS = 500;
31
+ /**
32
+ * dev_bridge.rs answers 504 after 5 s and BridgeClient.eval aborts at 5 s;
33
+ * keep at least 1 s of slack for dispatch + IPC + HTTP.
34
+ */
35
+ export declare const MAX_VERIFY_TIMEOUT_MS = 4000;
36
+ /**
37
+ * Poll cadence after the synchronous first check. React commits
38
+ * transition-lane updates on a Scheduler macrotask, so a microtask/rAF
39
+ * re-read would be too early.
40
+ */
41
+ export declare const VERIFY_INTERVAL_MS = 50;
42
+ export interface VerifyOptions {
43
+ /** 0..MAX_VERIFY_TIMEOUT_MS; 0 = single synchronous check. Default DEFAULT_VERIFY_TIMEOUT_MS. */
44
+ verifyTimeoutMs?: number;
45
+ }
46
+ export declare function resolveVerifyTimeout(opts?: VerifyOptions): number;
47
+ /** Adds --verify-timeout to a value-writing interaction command. */
48
+ export declare function addVerifyOptions(cmd: Command): Command;
49
+ /**
50
+ * JS snippet defining `__resolveValueWriter(node)`.
51
+ *
52
+ * React (react-dom's inputValueTracking) redefines `value` as an own accessor
53
+ * on every mounted <input>/<textarea> instance to remember what it wrote;
54
+ * assigning through that accessor makes the following input/change event a
55
+ * no-op for React (#10). Built-in form elements are therefore written through
56
+ * the prototype setter React itself captured. Custom elements are searched up
57
+ * their prototype chain (Lit/Stencil define accessors on the class prototype)
58
+ * and fall back to plain assignment for instance-defined or class-field
59
+ * `value`s. Anything else has no value setter and is refused instead of being
60
+ * silently given an expando property.
61
+ *
62
+ * The parameter is deliberately named `node` so generated scripts never
63
+ * contain the text `el.value =`.
64
+ */
65
+ export declare const NATIVE_VALUE_WRITER_SNIPPET = "\n function __resolveValueWriter(node) {\n var tag = node.tagName;\n var proto = tag === 'INPUT' ? HTMLInputElement.prototype\n : tag === 'TEXTAREA' ? HTMLTextAreaElement.prototype\n : tag === 'SELECT' ? HTMLSelectElement.prototype\n : null;\n if (proto) {\n var d = Object.getOwnPropertyDescriptor(proto, 'value');\n if (d && typeof d.set === 'function') return { kind: 'native', set: function (v) { d.set.call(node, v); } };\n return { kind: 'assign', set: function (v) { node.value = v; } };\n }\n if (String(node.localName || '').indexOf('-') !== -1) {\n var p = Object.getPrototypeOf(node);\n while (p && p !== Object.prototype) {\n var cd = Object.getOwnPropertyDescriptor(p, 'value');\n if (cd && typeof cd.set === 'function') return { kind: 'custom', set: function (v) { cd.set.call(node, v); } };\n p = Object.getPrototypeOf(p);\n }\n if ('value' in node) return { kind: 'assign', set: function (v) { node.value = v; } };\n }\n return null;\n }";
66
+ /**
67
+ * JS snippet defining `__verify(read, expected, timeoutMs, intervalMs)`.
68
+ *
69
+ * The first read is synchronous: React restores a rejected controlled value
70
+ * inside dispatchEvent, so it is already visible. Later reads catch
71
+ * transition-lane commits and frameworks that apply values asynchronously.
72
+ * Resolves `{ ok, observed }` and never rejects. `read` is re-invoked on every
73
+ * tick so a re-mounted node is read instead of a stale reference.
74
+ */
75
+ export declare const VERIFY_POLL_SNIPPET = "\n function __verify(read, expected, timeoutMs, intervalMs) {\n return new Promise(function (resolve) {\n var deadline = Date.now() + timeoutMs;\n function check() {\n var observed;\n try { observed = read(); } catch (e) { observed = undefined; }\n if (observed === expected) { resolve({ ok: true, observed: observed }); return; }\n if (Date.now() >= deadline) { resolve({ ok: false, observed: observed }); return; }\n setTimeout(check, intervalMs);\n }\n check();\n });\n }";
76
+ /**
77
+ * JS snippet defining `__settle()` — resolves after two macrotasks. Used after
78
+ * focus()/--clear so that state the app changed in response (React flushes an
79
+ * onFocus setState on a microtask, an accepted clear commits synchronously, and
80
+ * a commit scheduled from the app's own zero-delay timer lands on a Scheduler
81
+ * task after the first macrotask) is visible before the pre-write baseline is
82
+ * read and the target node is re-resolved.
83
+ */
84
+ export declare const SETTLE_SNIPPET = "\n function __settle() {\n return new Promise(function (resolve) {\n setTimeout(function () { setTimeout(resolve, 0); }, 0);\n });\n }";
85
+ /** JS snippet defining `__selectOptionValues(node)` — option values of a <select>, [] otherwise. */
86
+ export declare const SELECT_OPTIONS_SNIPPET = "\n function __selectOptionValues(node) {\n if (!node.options || typeof node.options.length !== 'number') return [];\n return Array.prototype.map.call(node.options, function (o) { return String(o.value); });\n }";
87
+ export interface SetValueScriptOptions {
88
+ /** `type` focuses the element first; `select` does not. */
89
+ focus: boolean;
90
+ /** `type --clear`: select() + write '' + input event before the real write. */
91
+ clear: boolean;
92
+ /** Existing contracts differ: `type` reports el.tagName as-is, `select` lower-cases it. */
93
+ lowerCaseTagName: boolean;
94
+ /** JS expression for the not-found error; `selector` is in scope. */
95
+ notFoundErrorExpr: string;
96
+ verifyTimeoutMs: number;
97
+ }
98
+ /**
99
+ * Shared script body for `type` and `select` value mode. Returns an arrow IIFE
100
+ * that resolves (via a Promise — the bridge awaits it) to a JSON string and
101
+ * never throws into the bridge.
102
+ *
103
+ * Sequence: snapshot `previousValue` → [focus] → [clear + input] → settle →
104
+ * re-resolve the target (the app may have re-mounted it) → snapshot `baseline`
105
+ * → native write → `applied` → refuse values the browser discarded or clamped
106
+ * back → input, change → verify. `reverted` means the re-read equals
107
+ * `baseline` or `previousValue`; comparing only against the pre-command value
108
+ * would let an app that accepted the clear (or changed the value on focus) but
109
+ * rejected the real write pass as `transformed`. A field the app empties after
110
+ * a non-empty write is a failure too ("cleared"): the intended value did not
111
+ * land whether the app rejected or consumed it.
112
+ */
113
+ export declare function buildSetValueScript(selector: string, value: string, o: SetValueScriptOptions): string;
114
+ /**
115
+ * Parses an interaction result from the bridge. dev_bridge.rs turns a thrown
116
+ * script into the string "ERROR: <message>", which JSON.parse would reject
117
+ * with an opaque SyntaxError — surface it as an actionable error instead.
118
+ */
119
+ export declare function parseInteractResult<S extends z.ZodTypeAny>(raw: unknown, schema: S, command: string): z.infer<S>;