tauri-agent-tools 0.9.2 → 0.9.3

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.
Files changed (110) hide show
  1. package/.agents/skills/tauri-agent-tools/SKILL.md +25 -11
  2. package/.agents/skills/tauri-bridge-setup/SKILL.md +4 -3
  3. package/.agents/skills/tauri-debug-quickstart/SKILL.md +3 -1
  4. package/AGENTS.md +7 -3
  5. package/README.md +31 -12
  6. package/dist/bridge/client.d.ts +1 -0
  7. package/dist/bridge/client.js +2 -0
  8. package/dist/bridge/client.js.map +1 -1
  9. package/dist/bridge/evaluate.d.ts +11 -0
  10. package/dist/bridge/evaluate.js +33 -0
  11. package/dist/bridge/evaluate.js.map +1 -0
  12. package/dist/bridge/logReader.d.ts +27 -0
  13. package/dist/bridge/logReader.js +26 -0
  14. package/dist/bridge/logReader.js.map +1 -0
  15. package/dist/bridge/observers.d.ts +11 -0
  16. package/dist/bridge/observers.js +195 -0
  17. package/dist/bridge/observers.js.map +1 -0
  18. package/dist/cli.js +28 -8
  19. package/dist/cli.js.map +1 -1
  20. package/dist/commands/bundle.js +122 -101
  21. package/dist/commands/bundle.js.map +1 -1
  22. package/dist/commands/capture.d.ts +3 -3
  23. package/dist/commands/capture.js +167 -141
  24. package/dist/commands/capture.js.map +1 -1
  25. package/dist/commands/check.js +44 -59
  26. package/dist/commands/check.js.map +1 -1
  27. package/dist/commands/consoleMonitor.js +18 -85
  28. package/dist/commands/consoleMonitor.js.map +1 -1
  29. package/dist/commands/diagnose.js +4 -32
  30. package/dist/commands/diagnose.js.map +1 -1
  31. package/dist/commands/diff.js +28 -38
  32. package/dist/commands/diff.js.map +1 -1
  33. package/dist/commands/dom.js +2 -2
  34. package/dist/commands/dom.js.map +1 -1
  35. package/dist/commands/eval.js +11 -1
  36. package/dist/commands/eval.js.map +1 -1
  37. package/dist/commands/forensics.js +1 -7
  38. package/dist/commands/forensics.js.map +1 -1
  39. package/dist/commands/info.d.ts +2 -2
  40. package/dist/commands/info.js +3 -1
  41. package/dist/commands/info.js.map +1 -1
  42. package/dist/commands/interact/click.js +14 -44
  43. package/dist/commands/interact/click.js.map +1 -1
  44. package/dist/commands/interact/scroll.js +6 -0
  45. package/dist/commands/interact/scroll.js.map +1 -1
  46. package/dist/commands/ipcMonitor.d.ts +3 -3
  47. package/dist/commands/ipcMonitor.js +26 -96
  48. package/dist/commands/ipcMonitor.js.map +1 -1
  49. package/dist/commands/listWindows.d.ts +2 -2
  50. package/dist/commands/listWindows.js.map +1 -1
  51. package/dist/commands/logs.d.ts +4 -27
  52. package/dist/commands/logs.js +12 -41
  53. package/dist/commands/logs.js.map +1 -1
  54. package/dist/commands/mutations.js +20 -101
  55. package/dist/commands/mutations.js.map +1 -1
  56. package/dist/commands/osLogs.js +2 -5
  57. package/dist/commands/osLogs.js.map +1 -1
  58. package/dist/commands/probe.js +18 -16
  59. package/dist/commands/probe.js.map +1 -1
  60. package/dist/commands/rustLogs.js +23 -43
  61. package/dist/commands/rustLogs.js.map +1 -1
  62. package/dist/commands/screenshot.d.ts +2 -2
  63. package/dist/commands/screenshot.js +7 -4
  64. package/dist/commands/screenshot.js.map +1 -1
  65. package/dist/commands/shared.d.ts +4 -1
  66. package/dist/commands/shared.js +34 -4
  67. package/dist/commands/shared.js.map +1 -1
  68. package/dist/commands/sidecarReplay.js +4 -0
  69. package/dist/commands/sidecarReplay.js.map +1 -1
  70. package/dist/commands/snapshot.d.ts +2 -2
  71. package/dist/commands/snapshot.js +4 -4
  72. package/dist/commands/snapshot.js.map +1 -1
  73. package/dist/commands/storeInspect.js +2 -2
  74. package/dist/commands/storeInspect.js.map +1 -1
  75. package/dist/commands/wait.d.ts +2 -2
  76. package/dist/commands/wait.js +42 -57
  77. package/dist/commands/wait.js.map +1 -1
  78. package/dist/errors.d.ts +10 -0
  79. package/dist/errors.js +26 -0
  80. package/dist/errors.js.map +1 -0
  81. package/dist/platform/detect.d.ts +2 -2
  82. package/dist/platform/detect.js +11 -2
  83. package/dist/platform/detect.js.map +1 -1
  84. package/dist/platform/x11.d.ts +1 -0
  85. package/dist/platform/x11.js +16 -5
  86. package/dist/platform/x11.js.map +1 -1
  87. package/dist/schemas/commands.d.ts +6 -0
  88. package/dist/schemas/commands.js +2 -0
  89. package/dist/schemas/commands.js.map +1 -1
  90. package/dist/types.d.ts +2 -0
  91. package/dist/util/exec.d.ts +6 -0
  92. package/dist/util/exec.js +13 -1
  93. package/dist/util/exec.js.map +1 -1
  94. package/dist/util/incidentFiles.d.ts +5 -0
  95. package/dist/util/incidentFiles.js +61 -0
  96. package/dist/util/incidentFiles.js.map +1 -0
  97. package/dist/util/monitor.d.ts +11 -0
  98. package/dist/util/monitor.js +42 -0
  99. package/dist/util/monitor.js.map +1 -0
  100. package/dist/util/poll.d.ts +2 -0
  101. package/dist/util/poll.js +28 -0
  102. package/dist/util/poll.js.map +1 -0
  103. package/dist/util/redactText.d.ts +5 -2
  104. package/dist/util/redactText.js +44 -11
  105. package/dist/util/redactText.js.map +1 -1
  106. package/dist/util/tauriConfig.js +15 -18
  107. package/dist/util/tauriConfig.js.map +1 -1
  108. package/examples/tauri-bridge/Cargo.lock +4742 -0
  109. package/package.json +7 -3
  110. package/rust-bridge/README.md +7 -1
@@ -1,13 +1,13 @@
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.2
4
+ version: 0.9.3
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
 
8
8
  # tauri-agent-tools
9
9
 
10
- CLI tool for agent-driven inspection and interaction with Tauri desktop applications. Inspection commands are read-only. Interaction commands (click, type, scroll, etc.) are debug-only — they only work when the app runs with the dev bridge enabled.
10
+ CLI tool for agent-driven inspection and interaction with Tauri desktop applications. DOM, screenshot, and storage inspection read app state; `eval` can modify it. Monitors install temporary instrumentation. Interaction commands (click, type, scroll, etc.) are debug-only — they only work when the app runs with the dev bridge enabled.
11
11
 
12
12
  ## Prerequisites
13
13
 
@@ -30,6 +30,20 @@ npm install -g tauri-agent-tools
30
30
 
31
31
  ## Bridge vs Standalone
32
32
 
33
+ Dependency checks follow the operation: window listing/info/title waits do not require ImageMagick; full-window PNG capture on macOS/Wayland uses native tools; crop/resize/diff and X11 capture require ImageMagick.
34
+
35
+ `--title` uses a regex on X11 and a substring on macOS/Sway/Hyprland. `probe --json` reports the selected PID, port, and window label; use `--pid` when multiple apps are running.
36
+
37
+ `eval --json` returns `{ "result": value }`. It awaits promises and reports thrown expressions as errors. Commands accepting `--json` send fatal `{ "error": { "code": "…", "message": "…", "hint": "…" } }` responses to stderr and exit nonzero; result records remain on stdout.
38
+
39
+ Choose exactly one condition for `wait`. Numeric intervals/timeouts must be positive integers; `click --wait` and `capture --logs-duration` also allow zero. `check` requires an assertion; `--no-errors` fails if observation is incomplete, including interruption by SIGINT/SIGTERM. Interrupted captures save available evidence with `partial: true` and warnings.
40
+
41
+ Console/IPC/mutation collectors have independent bounded buffers, report drops, and collect a final batch on stop. They restore their own instrumentation on completion, error, SIGINT, and SIGTERM while the webview is reachable. `logs`, `rust-logs`, and `capture` use independent v0.8 cursors; older bridges warn and fall back to destructive drain reads.
42
+
43
+ `bundle` stages privately and publishes only after text redaction and residual-secret checks pass. Redaction failures prevent the new archive and directory from being published. Its archive excludes unrelated existing files and rejects artifact symlinks. Missing sources produce `partial: true`; captures also save `warnings`. Images remain unredacted: review them before sharing.
44
+
45
+ Quote the complete replay command, e.g. `--to-exec "node my-sidecar.js"`; it is split on spaces, without shell syntax or support for arguments containing spaces.
46
+
33
47
  Some commands require the Rust dev bridge running inside the Tauri app. Others work standalone.
34
48
 
35
49
  **Bridge required** (needs running Tauri app with bridge):
@@ -42,7 +56,7 @@ Some commands require the Rust dev bridge running inside the Tauri app. Others w
42
56
  `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
57
 
44
58
  **Optional bridge** (work standalone, richer with a bridge):
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`
59
+ `probe`, `process-tree` (use `--deep` for a bridge-free OS walk), `logs` (merges on-disk files alone, or also reads the bridge ring buffer with an independent cursor on v0.8+), `bundle`, `diagnose`
46
60
 
47
61
  The bridge auto-discovers via token files in `/tmp/tauri-dev-bridge-*.token`. No manual port/token configuration needed.
48
62
 
@@ -223,7 +237,7 @@ tauri-agent-tools os-logs --level error --source main --duration 30000
223
237
  # Run a sidecar under a tap to see its stdio + validate against a JSON Schema
224
238
  tauri-agent-tools sidecar tap --schema ./schema.json --record /tmp/run.ndjson -- node my-sidecar.js
225
239
  # Replay deterministically
226
- tauri-agent-tools sidecar replay /tmp/run.ndjson --to-exec node my-sidecar.js --rate 100
240
+ tauri-agent-tools sidecar replay /tmp/run.ndjson --to-exec "node my-sidecar.js" --rate 100
227
241
 
228
242
  # One-shot forensic bundle for post-crash analysis. Works on a DEAD app.
229
243
  tauri-agent-tools forensics --config ./src-tauri -o ./forensics-out
@@ -337,12 +351,12 @@ tauri-agent-tools eval "document.title" --window-label overlay --json
337
351
 
338
352
  | Command | Key Flags | Bridge? | Description |
339
353
  |---------|-----------|---------|-------------|
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 |
354
+ | `screenshot` | `--selector <css>`, `--title <pattern>`, `--window-id <id>`, `-o <path>`, `--max-width <n>` | selector: yes, title/window-id: no | Capture window or DOM element screenshot |
341
355
  | `dom` | `[selector]`, `--depth <n>`, `--styles`, `--text <pattern>`, `--mode accessibility`, `--json` | yes | Query DOM structure or find elements by text |
342
356
  | `eval` | `<js-expression>`, `--file <path>` | yes | Evaluate JavaScript in webview |
343
- | `wait` | `--selector <css>`, `--eval <js>`, `--title <regex>`, `--timeout <ms>` | selector/eval: yes | Wait for a condition |
357
+ | `wait` | `--selector <css>`, `--eval <js>`, `--title <pattern>`, `--timeout <ms>` | selector/eval: yes | Wait for a condition |
344
358
  | `list-windows` | `--tauri`, `--json` | no | List visible windows |
345
- | `info` | `--title <regex>`, `--window-id <id>`, `--json` | no | Window geometry and display info |
359
+ | `info` | `--title <pattern>`, `--window-id <id>`, `--json` | no | Window geometry and display info |
346
360
  | `ipc-monitor` | `--filter <cmd>`, `--duration <ms>`, `--slow <ms>`, `--stats`, `--json` | yes | Monitor Tauri IPC calls; flag slow calls + per-command latency summary |
347
361
  | `console-monitor` | `--level <lvl>`, `--filter <regex>`, `--duration <ms>`, `--json` | yes | Monitor console output |
348
362
  | `rust-logs` | `--level <lvl>`, `--target <regex>`, `--source <src>`, `--duration <ms>`, `--json` | yes | Monitor Rust logs and sidecar output |
@@ -370,9 +384,9 @@ tauri-agent-tools eval "document.title" --window-label overlay --json
370
384
  | `forensics` | `--config <path>`, `--identifier <id>`, `-o <dir>`, `--since <dur>`, `--json` | no | One-shot forensic bundle (works on dead apps) |
371
385
  | `logs` | `--config <path>`, `--identifier <id>`, `--log-dir <path>`, `--log-file <path>`, `--level <lvl>`, `--source <re>`, `--filter <re>`, `--correlate`, `--follow`, `--interval <ms>`, `--no-bridge`, `--pretty` | optional | Merge on-disk log files + bridge ring buffer into one timestamp-ordered stream; `--follow` tails the bridge via v0.8 cursor reads (drain-polling fallback on older bridges) |
372
386
  | `process-tree` | `--deep`, `--pid <n>`, `--json` | optional | Tauri PID + sidecars (bridge /process); `--deep` walks the full OS descendant tree without the bridge |
373
- | `capabilities audit` | `--json` | yes (v0.7+) | Live Devtron-style audit of declared Tauri capabilities |
374
- | `webview attach` | `--print-url`, `--open`, `--json` | yes (v0.7+) | Print webview inspector URL or platform hint |
375
- | `health` | `--json` | yes (v0.7+) | Uptime + webview/sidecar liveness (exit non-zero if unhealthy) |
387
+ | `capabilities audit` | `--json` | yes; v0.7+ for full output | Live Devtron-style audit of declared Tauri capabilities |
388
+ | `webview attach` | `--print-url`, `--open`, `--json` | yes; v0.7+ for full output | Print webview inspector URL or platform hint |
389
+ | `health` | `--json` | yes; v0.7+ for full output | Uptime + webview/sidecar liveness (exit non-zero if unhealthy) |
376
390
  | `diagnose` | `--config <path>`, `-o <dir>`, `--since <dur>`, `--no-bridge`, `--json` | optional | Best-effort super-bundle (forensics + live bridge enrichment) |
377
391
  | `bundle` | `--config <path>`, `-o <dir>`, `--with-capture`, `--no-archive`, `--json` | optional | Shareable incident bundle: logs + deep process tree + app-paths + forensics → redacted dir + .tar.gz |
378
392
 
@@ -386,7 +400,7 @@ All bridge-dependent commands support these flags:
386
400
 
387
401
  ## Important Notes
388
402
 
389
- - **Inspection commands are read-only.** They don't modify app state.
403
+ - **Evaluation can modify app state.** `eval` runs unrestricted JavaScript. Monitors, `capture`, and `check --no-errors` install temporary instrumentation and clean it up when they stop; force-killing the CLI cannot run cleanup.
390
404
  - **Interaction commands are debug-only.** They only work with the dev bridge (debug builds).
391
405
  - **Use `--json`** for structured, parseable output in automation.
392
406
  - **Always use `--duration`** with `ipc-monitor`, `console-monitor`, `rust-logs`, and `mutations`.
@@ -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.2
4
+ version: 0.9.3
5
5
  tags: [tauri, rust, bridge, setup, integration, multi-window, process-tree, capabilities, devtools, health]
6
6
  ---
7
7
 
@@ -13,7 +13,7 @@ The bridge runs **only in debug builds** and is stripped from release builds aut
13
13
 
14
14
  ## Re-copying for v0.8 (optional enrichment — not required)
15
15
 
16
- > **Upgrading from v0.7:** Bridge v0.8 adds cursor-mode `/logs` reads (non-draining, long-polling) that power `logs --follow` and let multiple log consumers coexist. It is a **drop-in re-copy** of `dev_bridge.rs` — no `main.rs` changes this time. Without it, `logs --follow` emits a one-time note and degrades to drain polling.
16
+ > **Upgrading from v0.7:** Bridge v0.8 adds cursor-mode `/logs` reads (non-draining, long-polling) that power `logs`, `rust-logs`, and `capture` (including `logs --follow`) and let multiple log consumers coexist. It is a **drop-in re-copy** of `dev_bridge.rs` — no `main.rs` changes this time. Without it, `logs --follow` emits a one-time note and degrades to drain polling.
17
17
 
18
18
  ## Re-copying for v0.7 (optional enrichment — not required)
19
19
 
@@ -149,7 +149,8 @@ Use `probe` to discover available windows:
149
149
 
150
150
  ```bash
151
151
  tauri-agent-tools probe --json
152
- # → { "bridges": [{ "windows": ["main", "overlay", "settings"], ... }] }
152
+ # → { "target": { "pid": 12345, "port": 9876, "windowLabel": "main",
153
+ # "describe": { "windows": ["main", "overlay", "settings"] }, ... }, ... }
153
154
  ```
154
155
 
155
156
  ## Optional: Sidecar Log Capture + Process Visibility
@@ -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.2
4
+ version: 0.9.3
5
5
  tags: [tauri, debugging, triage, quickstart, decision-tree, logs, process-tree, bundle, forensics, diagnose]
6
6
  ---
7
7
 
@@ -82,3 +82,5 @@ This guidance assumes the agent is inspecting a Tauri 2 desktop app on macOS or
82
82
  - **The dev bridge requires `cfg!(debug_assertions)`** — release builds strip it, so bridge-dependent commands won't work against signed/notarized release artifacts. Use bridge-free commands (`forensics`, `app-paths`, `os-logs`, `config inspect`, `sidecar tap`) for those.
83
83
 
84
84
  For deeper how-tos see the [`tauri-agent-tools`](../tauri-agent-tools/SKILL.md) skill. For bridge integration setup (Rust side), see [`tauri-bridge-setup`](../tauri-bridge-setup/SKILL.md).
85
+
86
+ For bridge-free collection even when a live target exists, pass `diagnose --no-bridge`. `probe --json` identifies the selected PID, port, and window label. Inspect `partial` and warnings in captures/bundles before assuming collection completed; interrupted `check --no-errors` fails. Bundle redaction failures prevent publication, and images require review before sharing.
package/AGENTS.md CHANGED
@@ -16,7 +16,7 @@ This package includes three [Agent Skills](https://agentskills.io):
16
16
 
17
17
  **Install:** `npm install -g tauri-agent-tools`
18
18
 
19
- **Inspection commands are read-only.** Interaction commands (click, type, scroll, etc.) are debug-only — they only work with the dev bridge.
19
+ **DOM, screenshot, and storage inspection read app state.** `eval` can modify app state. Monitors install temporary instrumentation. Interaction commands (click, type, scroll, etc.) are debug-only — they only work with the dev bridge.
20
20
 
21
21
  **Standalone commands** (no bridge needed):
22
22
  `list-windows`, `info`, `screenshot --title`, `wait --title`, `diff`
@@ -27,7 +27,7 @@ This package includes three [Agent Skills](https://agentskills.io):
27
27
  **Bridge-required commands** (Tauri app must have dev bridge running):
28
28
  `dom`, `eval`, `screenshot --selector`, `wait --selector/--eval`, `ipc-monitor`, `console-monitor`, `rust-logs`, `storage`, `page-state`, `mutations`, `snapshot`, `click`, `type`, `scroll`, `focus`, `navigate`, `select`, `invoke`, `capture`, `check`, `store-inspect`
29
29
 
30
- **Bridge-extending diagnostics** (require bridge v0.7+; degrade gracefully against older/vendored bridges, or pass `--strict` to fail):
30
+ **Bridge-extending diagnostics** (use bridge v0.7+ for full output; degrade gracefully against older/vendored bridges, or pass `--strict` to fail):
31
31
  `process-tree`, `capabilities audit`, `webview attach`, `health`
32
32
 
33
33
  **Super-commands** (best-effort, compose the above):
@@ -40,8 +40,12 @@ This package includes three [Agent Skills](https://agentskills.io):
40
40
 
41
41
  **Bridge auto-discovery:** The CLI finds the running bridge via token files in `/tmp/tauri-dev-bridge-*.token`. No manual configuration needed.
42
42
 
43
- **Structured output:** Use `--json` on any command for machine-readable output.
43
+ **Structured output:** Use `--json` where supported for machine-readable output. Fatal JSON errors go to stderr; command results stay on stdout.
44
44
 
45
45
  **Monitors:** Always pass `--duration <ms>` to `ipc-monitor`, `console-monitor`, `rust-logs`, and `mutations` to avoid indefinite execution.
46
46
 
47
47
  **Sidecar monitoring:** `rust-logs` can capture stdout/stderr from sidecar processes (external binaries spawned by the Tauri app). Use `--source sidecar` for all sidecars or `--source sidecar:<name>` for a specific one.
48
+
49
+ **Automation:** `wait` requires exactly one condition, and `check` requires at least one assertion. An interrupted `check --no-errors` fails. `capture` reports incomplete evidence with `partial` and `warnings`. Console/IPC/mutation collectors keep independent bounded sessions; Rust log readers use independent cursors on bridge v0.8+.
50
+
51
+ **Release checks:** Run `npm run lint`, `npm test`, `cargo test --locked --manifest-path examples/tauri-bridge/Cargo.toml`, `zensical build`, and `npm run check:package`. The example lockfile is tracked; Rust build outputs are excluded from npm.
package/README.md CHANGED
@@ -49,6 +49,12 @@ npm install -g tauri-agent-tools
49
49
  - **Linux Wayland/Hyprland:** `hyprctl` (included with Hyprland), `grim`, `imagemagick`
50
50
  - **macOS:** `imagemagick` (`brew install imagemagick`) — all other tools are built-in. Grant Screen Recording permission in System Settings → Privacy & Security → Screen Recording.
51
51
 
52
+ Dependencies are checked for the requested operation. `list-windows`, `info`, and `wait --title` only need the platform's window inspection tool. Full-window PNG capture on macOS and Wayland does not require ImageMagick; cropping, resizing, image comparison, and X11 capture do. Bridge-only commands need no screenshot tools.
53
+
54
+ `--title` uses a regular expression on X11 and a substring on macOS, Sway, and Hyprland. Quote patterns containing spaces. `--window-id` selects a window directly; `--pid` selects an app bridge, and `--window-label` selects its webview. `probe --json` reports the selected PID, port, and label and notes ambiguous discovery.
55
+
56
+ Commands that accept `--json` keep results on stdout and report fatal errors on stderr as `{"error":{"code":"…","message":"…","hint":"…"}}`, with a nonzero exit status. Monitors emit NDJSON; progress and warnings go to stderr. Failed `check` assertions and `diff` thresholds retain their structured result on stdout and exit 1.
57
+
52
58
  ## Quick Start
53
59
 
54
60
  ### 1. Add the bridge to your Tauri app
@@ -92,7 +98,7 @@ Capture a screenshot of a window or DOM element.
92
98
  | Option | Description |
93
99
  |--------|-------------|
94
100
  | `-s, --selector <css>` | CSS selector — screenshot just this element (requires bridge) |
95
- | `-t, --title <regex>` | Window title to match regex; quote titles with spaces |
101
+ | `-t, --title <pattern>` | Window title (X11: regex; macOS/Wayland: substring); quote titles with spaces |
96
102
  | `-w, --window-id <id>` | Platform window id (from `list-windows`) — overrides `--title` |
97
103
  | `-o, --output <path>` | Output file path (default: auto-named) |
98
104
  | `--format <png\|jpg>` | Output format (default: png) |
@@ -129,17 +135,20 @@ tauri-agent-tools eval --file script.js
129
135
  |--------|-------------|
130
136
  | `<js-expression>` | Inline JavaScript to evaluate |
131
137
  | `--file <path>` | Load JavaScript from a file instead |
138
+ | `--json` | Output `{ "result": value }`; awaits promises and reports evaluation errors |
132
139
  | `--window-label <label>` | Target a specific webview window (default: main) |
133
140
 
134
141
  ### `wait`
135
142
 
136
143
  Wait for a condition to be met.
137
144
 
145
+ Choose exactly one of `--selector`, `--eval`, or `--title`. Evaluation uses JavaScript truthiness: `false`, `0`, and `null` keep waiting, while the string `"false"` is truthy. A thrown expression fails immediately. Timeouts and polling intervals must be positive integers.
146
+
138
147
  | Option | Description |
139
148
  |--------|-------------|
140
149
  | `-s, --selector <css>` | Wait for CSS selector to match |
141
150
  | `-e, --eval <js>` | Wait for JS expression to be truthy |
142
- | `-t, --title <regex>` | Wait for window with title (no bridge) |
151
+ | `-t, --title <pattern>` | Wait for window with title (no bridge) |
143
152
  | `--timeout <ms>` | Maximum wait time (default: 10000) |
144
153
  | `--interval <ms>` | Polling interval (default: 500) |
145
154
 
@@ -163,7 +172,7 @@ List all visible windows, marking Tauri apps.
163
172
 
164
173
  ### `ipc-monitor`
165
174
 
166
- Monitor Tauri IPC calls in real-time (read-only). Monkey-patches Tauri's invoke API (`window.__TAURI_INTERNALS__.invoke`, falling back to `window.__TAURI__.core.invoke`) to capture calls, then polls and restores on exit.
175
+ Monitor Tauri IPC calls in real-time. Monkey-patches Tauri's invoke API (`window.__TAURI_INTERNALS__.invoke`, falling back to `window.__TAURI__.core.invoke`) to capture calls, then polls and restores on exit.
167
176
 
168
177
  | Option | Description |
169
178
  |--------|-------------|
@@ -176,6 +185,8 @@ Monitor Tauri IPC calls in real-time (read-only). Monkey-patches Tauri's invoke
176
185
 
177
186
  Monitor console output (log/warn/error/info/debug) in real-time. Monkey-patches console methods to capture entries, then polls and restores on exit.
178
187
 
188
+ Always set `--duration <ms>` for automated runs. IPC, console, and mutation collectors have independent sessions with 1,000-entry buffers and report overflow on stderr. They collect a final batch before cleanup, including when duration is shorter than the polling interval. Circular values and BigInts are serialized safely. Cleanup also runs on SIGINT/SIGTERM; force-killing the CLI or losing the webview can prevent restoration.
189
+
179
190
  | Option | Description |
180
191
  |--------|-------------|
181
192
  | `--level <level>` | Filter by level (log, warn, error, info, debug) |
@@ -234,7 +245,7 @@ Capture screenshot + DOM tree + page state + storage in one shot. Writes multipl
234
245
  |--------|-------------|
235
246
  | `-o, --output <prefix>` | Output path prefix (e.g. `/tmp/debug`) |
236
247
  | `-s, --selector <css>` | CSS selector to screenshot (full window if omitted) |
237
- | `-t, --title <regex>` | Window title to match regex; quote titles with spaces (default: auto-discover) |
248
+ | `-t, --title <pattern>` | Window title (X11: regex; macOS/Wayland: substring); quote titles with spaces (default: auto-discover) |
238
249
  | `-w, --window-id <id>` | Platform window id (from `list-windows`) — overrides `--title` |
239
250
  | `--dom-depth <number>` | DOM tree depth (default: 3) |
240
251
  | `--eval <js>` | Additional JS to eval and save |
@@ -279,6 +290,8 @@ Interaction commands dispatch DOM events inside the webview. They require the de
279
290
  | `check` | Structured assertions (`--selector`, `--text`, `--eval`, `--no-errors`) — exits 0/1 |
280
291
  | `store-inspect` | Inspect reactive store state (Pinia, Vue devtools, custom hooks) |
281
292
 
293
+ `check` requires at least one assertion. `--no-errors` observes for `--duration` (default 3000 ms) and fails if interrupted or if collection is incomplete. `capture` records interruptions and missing artifacts as `partial: true` with warnings; available evidence is preserved. `click --wait` polls in the CLI before dispatching once. Conflicting click types and scroll actions are rejected.
294
+
282
295
  `capture`'s pipeline is also callable as a library: `captureToDir(bridge, adapter, opts)` returns the `CaptureManifest`. Deep-import it from `tauri-agent-tools/dist/commands/capture.js` — there is no package-root library entry point (the root is the CLI).
283
296
 
284
297
  ### Targeting Flags
@@ -306,9 +319,9 @@ tauri-agent-tools diagnose --config ./src-tauri -o ./diagnose-out
306
319
 
307
320
  See [`docs/troubleshooting/decision-tree.md`](docs/troubleshooting/decision-tree.md) for the full symptom → command flowchart.
308
321
 
309
- ## Bridge-extending diagnostics (new in 0.7, requires bridge v0.7.0+)
322
+ ## Bridge-extending diagnostics
310
323
 
311
- Four commands that talk to new dev-bridge endpoints. Each feature-detects via `GET /version` and surfaces an actionable upgrade error when the bridge is older than v0.7.0.
324
+ These commands feature-detect via `GET /version` and degrade with a note against older bridges. `process-tree` can use an OS fallback when a PID is available. Use `--strict` to require the richer endpoint and fail with an upgrade error.
312
325
 
313
326
  ```bash
314
327
  # Tauri PID + registered sidecars (--deep walks the full OS descendant tree, no bridge needed)
@@ -326,7 +339,7 @@ tauri-agent-tools webview attach --open
326
339
  tauri-agent-tools health --json
327
340
  ```
328
341
 
329
- > **Integrators upgrading from v0.6:** Re-copy `examples/tauri-bridge/src/dev_bridge.rs` into your app. `start_bridge` now returns a third tuple element (`SidecarRegistry`); pass it to `spawn_sidecar_monitored` so sidecars show up in `process-tree`/`health`. See `.agents/skills/tauri-bridge-setup/SKILL.md` for the full upgrade walkthrough.
342
+ > **Optional enrichment for integrators upgrading from v0.6:** To enable the richer endpoints, re-copy `examples/tauri-bridge/src/dev_bridge.rs` into your app. `start_bridge` now returns a third tuple element (`SidecarRegistry`); pass it to `spawn_sidecar_monitored` so sidecars show up in `process-tree`/`health`. See `.agents/skills/tauri-bridge-setup/SKILL.md` for the full upgrade walkthrough.
330
343
 
331
344
  ## Bridge-free diagnostics (new in 0.7)
332
345
 
@@ -348,7 +361,7 @@ tauri-agent-tools os-logs --level error --source main --duration 30000
348
361
  # Wrap a sidecar, frame its stdout as NDJSON, validate against a JSON Schema
349
362
  tauri-agent-tools sidecar tap --schema ./schema.json --record /tmp/run.ndjson -- node my-sidecar.js
350
363
  # Replay the recording deterministically — to stdout or into a fresh sidecar's stdin
351
- tauri-agent-tools sidecar replay /tmp/run.ndjson --to-exec node my-sidecar.js --rate 100
364
+ tauri-agent-tools sidecar replay /tmp/run.ndjson --to-exec "node my-sidecar.js" --rate 100
352
365
  tauri-agent-tools sidecar replay /tmp/ipc-tap.ndjson --tap-format --dir out # (new in 0.9) unwrap {dir,ts,line} tap rows, replay one direction
353
366
 
354
367
  # Forensic bundle for post-crash analysis (composes the above; works on dead apps)
@@ -382,7 +395,13 @@ tauri-agent-tools bundle --config ./src-tauri -o ./incident --since 10m
382
395
  tauri-agent-tools bundle --with-capture # also snapshot the UI (needs live bridge)
383
396
  ```
384
397
 
385
- `logs` works with no bridge (it reads the on-disk log files); a running bridge just adds the live ring buffer. `bundle` redacts secrets (tokens, API keys, passwords, JWTs, AWS keys) and PII (emails, IPs, phone numbers, home paths including base64-encoded ones) from artifacts on write; `.json`/`.ndjson` artifacts stay parseable, unredacted images are flagged as warnings, and it degrades cleanly when a phase can't run.
398
+ `logs` works with no bridge (it reads the on-disk log files); a running bridge adds the live ring buffer. `logs`, `rust-logs`, and `capture` use independent cursors on bridge v0.8+, so one consumer does not drain another's entries. Older bridges fall back to draining with a warning. `logs --follow` requires a bridge; `diagnose --no-bridge` skips bridge requests even if a target is supplied.
399
+
400
+ `bundle` collects into a private temporary directory, redacts text and structured storage credentials, sanitizes its summaries, and scans for remaining secrets before publishing. A redaction failure exits nonzero and prevents publication of the new directory and archive. Missing optional sources are reported as failed phases with `partial: true`; captures also record `partial` and `warnings` in their manifest. Images remain unredacted and are listed as warnings for review before sharing.
401
+
402
+ The archive contains only artifacts generated by that run. Existing unrelated output files are preserved and excluded from the archive; artifact symlinks are rejected. If archive creation or publication fails, the directory remains available and its summary reports `archive: null`. `--no-archive` intentionally creates only the directory. Automatic redaction cannot guarantee removal of every secret; review the output before sharing it.
403
+
404
+ For `sidecar replay --to-exec`, quote the whole command, for example `--to-exec "node my-sidecar.js"`. The value is split on spaces; shell syntax and arguments containing spaces are not supported.
386
405
 
387
406
  ## How It Works
388
407
 
@@ -414,12 +433,12 @@ The crop accounts for window decoration (title bar, borders) by comparing `windo
414
433
 
415
434
  ## Design Decisions
416
435
 
417
- ### Inspection is read-only, interaction is debug-only
436
+ ### Inspection, evaluation, and interaction
418
437
 
419
- Inspection commands (screenshot, dom, eval, storage, etc.) are strictly read-only they never modify app state. Interaction commands (click, type, scroll, focus, navigate, select, invoke) use eval-based DOM event dispatch and **only work with the dev bridge** (debug builds). Native input injection (xdotool, Accessibility API) is deliberately avoided:
438
+ Commands such as screenshot, DOM inspection, and storage inspection read app state. `eval` executes arbitrary JavaScript and can modify the app; the bridge does not enforce read-only evaluation. IPC and console monitors, `capture`, and `check --no-errors` temporarily wrap app APIs; mutations installs an observer. Each collector restores its own instrumentation on completion, error, SIGINT, or SIGTERM when the webview is reachable. Interaction commands (click, type, scroll, focus, navigate, select, invoke) use eval-based DOM event dispatch and **only work with the dev bridge** (debug builds). Native input injection (xdotool, Accessibility API) is deliberately avoided:
420
439
 
421
440
  - **Native input is system-wide and risky.** X11 injection operates globally, not per-window — it can grab the cursor and require a hard reboot.
422
- - **Eval-based dispatch is per-window and sandboxed.** Interaction commands dispatch DOM events inside the webview via the bridge. They can't affect other apps or the OS.
441
+ - **Eval-based dispatch targets the selected webview.** Application event handlers and invoked Tauri commands still run normally, including any backend work they perform.
423
442
  - **Debug-only by design.** The bridge is compiled out of release builds (`cfg!(debug_assertions)`), so interaction commands cannot run against production apps.
424
443
 
425
444
  ### Why no MCP server mode
@@ -14,6 +14,7 @@ interface FetchLogsCursorResponse {
14
14
  }
15
15
  export declare class BridgeClient {
16
16
  private baseUrl;
17
+ readonly port: number;
17
18
  private token;
18
19
  private windowLabel;
19
20
  /** Cached `/version` response. Populated by `requireEndpoint` on first call. */
@@ -13,6 +13,7 @@ const ENDPOINT_MIN_VERSION = {
13
13
  };
14
14
  export class BridgeClient {
15
15
  baseUrl;
16
+ port;
16
17
  token;
17
18
  windowLabel;
18
19
  /** Cached `/version` response. Populated by `requireEndpoint` on first call. */
@@ -20,6 +21,7 @@ export class BridgeClient {
20
21
  /** Set when `/version` is unreachable so we don't retry it for every call. */
21
22
  versionUnreachable = false;
22
23
  constructor(config, windowLabel) {
24
+ this.port = config.port;
23
25
  this.baseUrl = `http://127.0.0.1:${config.port}`;
24
26
  this.token = config.token;
25
27
  this.windowLabel = windowLabel;
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/bridge/client.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,EAC1B,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAW9B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD;;;;GAIG;AACH,MAAM,oBAAoB,GAA2B;IACnD,UAAU,EAAE,OAAO;IACnB,eAAe,EAAE,OAAO;IACxB,WAAW,EAAE,OAAO;IACpB,SAAS,EAAE,OAAO;CACnB,CAAC;AAmBF,MAAM,OAAO,YAAY;IACf,OAAO,CAAS;IAChB,KAAK,CAAS;IACd,WAAW,CAAqB;IACxC,gFAAgF;IACxE,YAAY,GAA2B,IAAI,CAAC;IACpD,8EAA8E;IACtE,kBAAkB,GAAG,KAAK,CAAC;IAEnC,YAAY,MAAoB,EAAE,WAAoB;QACpD,IAAI,CAAC,OAAO,GAAG,oBAAoB,MAAM,CAAC,IAAI,EAAE,CAAC;QACjD,IAAI,CAAC,K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AG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,iBAAiB,GAAG,CAAC,MAAM,QAAQ,IAAI,KAAK,IAAI,EAAE,CAAC,CAAC;QACtE,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ import type { BridgeClient } from './client.js';
2
+ /** Keep evaluation errors distinct from strings beginning with "ERROR:".
3
+ * The envelope is JSON text, so it works with both legacy stringifying bridges
4
+ * and bridges that preserve native JSON values. Truthiness is computed before
5
+ * serialization ("false" and false must remain different).
6
+ */
7
+ export declare function buildEvaluationScript(expression: string): string;
8
+ export declare function evaluateExpression(bridge: Pick<BridgeClient, 'eval'>, expression: string, timeout?: number): Promise<{
9
+ value: unknown;
10
+ truthy: boolean;
11
+ }>;
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ import { CliError } from '../errors.js';
3
+ const EvaluationSchema = z.discriminatedUnion('ok', [
4
+ z.object({ ok: z.literal(true), value: z.unknown(), truthy: z.boolean() }),
5
+ z.object({ ok: z.literal(false), error: z.string() }),
6
+ ]);
7
+ /** Keep evaluation errors distinct from strings beginning with "ERROR:".
8
+ * The envelope is JSON text, so it works with both legacy stringifying bridges
9
+ * and bridges that preserve native JSON values. Truthiness is computed before
10
+ * serialization ("false" and false must remain different).
11
+ */
12
+ export function buildEvaluationScript(expression) {
13
+ return `(async () => {
14
+ try {
15
+ const value = await (0, eval)(${JSON.stringify(expression)});
16
+ const kind = typeof value;
17
+ const encoded = kind === 'undefined' ? null
18
+ : ['bigint', 'symbol', 'function'].includes(kind) || (kind === 'number' && !Number.isFinite(value))
19
+ ? String(value) : value;
20
+ return JSON.stringify({ ok: true, value: encoded, truthy: !!value });
21
+ } catch (error) {
22
+ return JSON.stringify({ ok: false, error: error && error.message ? String(error.message) : String(error) });
23
+ }
24
+ })()`;
25
+ }
26
+ export async function evaluateExpression(bridge, expression, timeout = 5000) {
27
+ const raw = await bridge.eval(buildEvaluationScript(expression), timeout);
28
+ const result = EvaluationSchema.parse(typeof raw === 'string' ? JSON.parse(raw) : raw);
29
+ if (!result.ok)
30
+ throw new CliError('EVAL_FAILED', result.error, 'Check the expression or selector in the selected webview.');
31
+ return { value: result.value, truthy: result.truthy };
32
+ }
33
+ //# sourceMappingURL=evaluate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluate.js","sourceRoot":"","sources":["../../src/bridge/evaluate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,MAAM,gBAAgB,GAAG,CAAC,CAAC,kBAAkB,CAAC,IAAI,EAAE;IAClD,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;IAC1E,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;CACtD,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,UAAkB;IACtD,OAAO;;sCAE6B,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC;;;;;;;;;OASzD,CAAC;AACR,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAAkC,EAClC,UAAkB,EAClB,OAAO,GAAG,IAAI;IAEd,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,CAAC;IAC1E,MAAM,MAAM,GAAG,gBAAgB,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACvF,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,MAAM,IAAI,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,KAAK,EAAE,2DAA2D,CAAC,CAAC;IAC7H,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;AACxD,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { RustLogEntry } from '../schemas/bridge.js';
2
+ export declare const LOG_CURSOR_UNAVAILABLE_NOTE = "bridge <0.8 has no log cursor; using drain polling (entries may be lost between polls)";
3
+ export interface LogCursor {
4
+ cursor: number;
5
+ drainFallback: boolean;
6
+ warnedDrainFallback: boolean;
7
+ }
8
+ export declare function newLogCursor(): LogCursor;
9
+ interface LogClient {
10
+ fetchLogs(arg?: number | {
11
+ cursor?: number;
12
+ waitMs?: number;
13
+ limit?: number;
14
+ timeoutMs?: number;
15
+ }): Promise<RustLogEntry[] | {
16
+ entries: RustLogEntry[];
17
+ cursor?: number;
18
+ dropped?: number;
19
+ }>;
20
+ }
21
+ export declare function readRustLogs(client: LogClient, state?: LogCursor, options?: {
22
+ waitMs?: number;
23
+ limit?: number;
24
+ intervalMs?: number;
25
+ warn?: (message: string) => void;
26
+ }): Promise<RustLogEntry[]>;
27
+ export {};
@@ -0,0 +1,26 @@
1
+ export const LOG_CURSOR_UNAVAILABLE_NOTE = 'bridge <0.8 has no log cursor; using drain polling (entries may be lost between polls)';
2
+ export function newLogCursor() {
3
+ return { cursor: 0, drainFallback: false, warnedDrainFallback: false };
4
+ }
5
+ export async function readRustLogs(client, state = newLogCursor(), options = {}) {
6
+ const warn = options.warn ?? console.error;
7
+ const response = state.drainFallback
8
+ ? await client.fetchLogs(Math.max(options.intervalMs ?? 2000, 2000))
9
+ : await client.fetchLogs({ cursor: state.cursor, waitMs: options.waitMs ?? 0,
10
+ limit: options.limit ?? 1000, timeoutMs: Math.max(5000, (options.waitMs ?? 0) + 1000) });
11
+ const batch = Array.isArray(response) ? { entries: response } : response;
12
+ if (batch.cursor === undefined) {
13
+ state.drainFallback = true;
14
+ if (!state.warnedDrainFallback) {
15
+ state.warnedDrainFallback = true;
16
+ warn(`note: ${LOG_CURSOR_UNAVAILABLE_NOTE}`);
17
+ }
18
+ }
19
+ else {
20
+ state.cursor = batch.cursor;
21
+ if (batch.dropped)
22
+ warn(`warning: bridge log cursor dropped ${batch.dropped} evicted entries`);
23
+ }
24
+ return batch.entries;
25
+ }
26
+ //# sourceMappingURL=logReader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logReader.js","sourceRoot":"","sources":["../../src/bridge/logReader.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,2BAA2B,GACtC,wFAAwF,CAAC;AAQ3F,MAAM,UAAU,YAAY;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC;AACzE,CAAC;AAOD,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAiB,EACjB,QAAmB,YAAY,EAAE,EACjC,UAAsG,EAAE;IAExG,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC;IAC3C,MAAM,QAAQ,GAAG,KAAK,CAAC,aAAa;QAClC,CAAC,CAAC,MAAM,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,IAAI,IAAI,EAAE,IAAI,CAAC,CAAC;QACpE,CAAC,CAAC,MAAM,MAAM,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,CAAC;YAC1E,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;IAC7F,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;IACzE,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC/B,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC;YAC/B,KAAK,CAAC,mBAAmB,GAAG,IAAI,CAAC;YACjC,IAAI,CAAC,SAAS,2BAA2B,EAAE,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC5B,IAAI,KAAK,CAAC,OAAO;YAAE,IAAI,CAAC,sCAAsC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;IACjG,CAAC;IACD,OAAO,KAAK,CAAC,OAAO,CAAC;AACvB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { BridgeClient } from './client.js';
2
+ export interface ObserverScripts {
3
+ patch: string;
4
+ drain: string;
5
+ cleanup: string;
6
+ }
7
+ export declare function consoleObserver(id?: string): ObserverScripts;
8
+ export declare function ipcObserver(id?: string): ObserverScripts;
9
+ export declare function mutationObserver(selector: string, attributes: boolean, id?: string): ObserverScripts;
10
+ export declare function readObserver(bridge: Pick<BridgeClient, 'eval'>, scripts: ObserverScripts, warn?: (message: string) => void): Promise<unknown[]>;
11
+ export declare function closeObserver(bridge: Pick<BridgeClient, 'eval'>, scripts: ObserverScripts, warn?: (message: string) => void): Promise<void>;