@reticlehq/server 2.7.0 → 2.8.0
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.
- package/README.md +14 -5
- package/SKILL.md +64 -29
- package/dist/capsule/causal-summary.d.ts +20 -0
- package/dist/capsule/causal-summary.js +31 -6
- package/dist/capsule/divergence.js +7 -1
- package/dist/cli/chromium-hint.d.ts +33 -5
- package/dist/cli/chromium-hint.js +82 -12
- package/dist/cli/cli-doctor.js +28 -25
- package/dist/cli/cli-kill.d.ts +58 -0
- package/dist/cli/cli-kill.js +162 -0
- package/dist/cli/cli-launch.d.ts +17 -0
- package/dist/cli/cli-launch.js +28 -0
- package/dist/cli/cli-parse.d.ts +16 -1
- package/dist/cli/cli-parse.js +32 -9
- package/dist/cli/cli-port.d.ts +8 -0
- package/dist/cli/cli-port.js +16 -0
- package/dist/cli/cli-verify.js +2 -2
- package/dist/cli/doctor-sessions-line.d.ts +12 -0
- package/dist/cli/doctor-sessions-line.js +66 -0
- package/dist/cli/port-holder.d.ts +10 -0
- package/dist/cli/port-holder.js +26 -2
- package/dist/cli.js +99 -14
- package/dist/crawl/crawl-tools.js +12 -2
- package/dist/crawl/crawl.d.ts +13 -0
- package/dist/crawl/crawl.js +50 -2
- package/dist/events/contradictions.d.ts +14 -0
- package/dist/events/contradictions.js +26 -17
- package/dist/events/predicate-eval.d.ts +20 -1
- package/dist/events/predicate-eval.js +125 -3
- package/dist/events/predicate.js +170 -18
- package/dist/flows/flow-classify.js +1 -1
- package/dist/flows/flow-tools.js +12 -4
- package/dist/flows/heal-run.js +1 -1
- package/dist/honesty/blind-spots.js +6 -2
- package/dist/honesty/unsettled.d.ts +40 -0
- package/dist/honesty/unsettled.js +78 -0
- package/dist/honesty/verified.d.ts +7 -0
- package/dist/honesty/verified.js +3 -3
- package/dist/index.js +3 -0
- package/dist/init/agent-rules.d.ts +16 -0
- package/dist/init/agent-rules.js +96 -22
- package/dist/init/astro-patch.d.ts +2 -1
- package/dist/init/astro-patch.js +11 -5
- package/dist/init/capabilities.d.ts +22 -0
- package/dist/init/capabilities.js +76 -0
- package/dist/init/confirm.d.ts +96 -0
- package/dist/init/confirm.js +138 -0
- package/dist/init/cra.js +3 -2
- package/dist/init/non-js-project.js +29 -5
- package/dist/init/plan-framework.js +53 -15
- package/dist/init/plan.d.ts +40 -4
- package/dist/init/plan.js +163 -40
- package/dist/init/run.d.ts +24 -2
- package/dist/init/run.js +148 -42
- package/dist/init/slash-command.d.ts +1 -1
- package/dist/init/slash-command.js +46 -6
- package/dist/init/snippets.d.ts +44 -4
- package/dist/init/snippets.js +161 -37
- package/dist/init/vite-config.js +29 -3
- package/dist/input/network-mock-tools.d.ts +19 -0
- package/dist/input/network-mock-tools.js +29 -4
- package/dist/license/license.js +1 -1
- package/dist/mcp/mcp-proxy.d.ts +69 -3
- package/dist/mcp/mcp-proxy.js +205 -20
- package/dist/mcp/mcp.js +23 -7
- package/dist/mcp/proxy-lifecycle.d.ts +1 -1
- package/dist/mcp/proxy-lifecycle.js +1 -1
- package/dist/pool/browser-pool.d.ts +22 -2
- package/dist/pool/browser-pool.js +44 -4
- package/dist/project/learned-routes.d.ts +24 -0
- package/dist/project/learned-routes.js +63 -0
- package/dist/project/project-store.d.ts +6 -0
- package/dist/project/project-store.js +25 -1
- package/dist/session/no-session-diagnosis.d.ts +19 -0
- package/dist/session/no-session-diagnosis.js +71 -18
- package/dist/session/no-session-watch.js +12 -0
- package/dist/session/ref-provenance.d.ts +54 -0
- package/dist/session/ref-provenance.js +61 -0
- package/dist/session/session-lease.js +1 -1
- package/dist/telemetry/automation-hint.d.ts +17 -0
- package/dist/telemetry/automation-hint.js +71 -0
- package/dist/telemetry/bug-found.d.ts +0 -20
- package/dist/telemetry/bug-found.js +38 -21
- package/dist/telemetry/cli-telemetry.js +7 -1
- package/dist/telemetry/feedback.js +1 -1
- package/dist/telemetry/init-telemetry.js +9 -1
- package/dist/telemetry/install-source.d.ts +36 -0
- package/dist/telemetry/install-source.js +40 -0
- package/dist/telemetry/run-telemetry.js +4 -1
- package/dist/telemetry/session-metrics.js +5 -0
- package/dist/telemetry/telemetry.d.ts +5 -1
- package/dist/telemetry/telemetry.js +15 -2
- package/dist/telemetry/tool-refused.d.ts +19 -0
- package/dist/telemetry/tool-refused.js +55 -0
- package/dist/telemetry/verification-of.js +46 -7
- package/dist/temp-dir.d.ts +27 -0
- package/dist/temp-dir.js +46 -0
- package/dist/tools/act-tools.js +45 -1
- package/dist/tools/assert-grade.d.ts +1 -1
- package/dist/tools/assert-grade.js +27 -5
- package/dist/tools/assert-verdict.js +18 -1
- package/dist/tools/contract-tools.js +4 -0
- package/dist/tools/dynamic-tools.js +1 -1
- package/dist/tools/error-recovery.d.ts +10 -0
- package/dist/tools/error-recovery.js +64 -4
- package/dist/tools/feedback-invite.js +1 -1
- package/dist/tools/invoke-tool.js +139 -23
- package/dist/tools/lease-tools.d.ts +29 -1
- package/dist/tools/lease-tools.js +58 -5
- package/dist/tools/navigate-result.js +1 -1
- package/dist/tools/observe-tools.js +1 -1
- package/dist/tools/observed-nothing.js +1 -1
- package/dist/tools/react-grace.d.ts +48 -0
- package/dist/tools/react-grace.js +87 -0
- package/dist/tools/read-tools.js +20 -4
- package/dist/tools/settle-in-flight.d.ts +79 -0
- package/dist/tools/settle-in-flight.js +106 -0
- package/dist/tools/snapshot-delta.d.ts +7 -0
- package/dist/tools/snapshot-delta.js +130 -6
- package/dist/tools/tool-surface.js +19 -0
- package/dist/tools/tools.js +16 -4
- package/docs/README.md +56 -11
- package/docs/actions.mdx +87 -0
- package/docs/agent-cheatsheet.md +93 -29
- package/docs/architecture.md +46 -35
- package/docs/benchmarks.md +76 -72
- package/docs/best-practices.mdx +211 -0
- package/docs/capabilities.mdx +387 -0
- package/docs/cli/affected.mdx +51 -0
- package/docs/cli/capsules.mdx +69 -0
- package/docs/cli/cloud.mdx +127 -0
- package/docs/cli/doctor.mdx +76 -0
- package/docs/cli/drive.mdx +55 -0
- package/docs/cli/feedback.mdx +67 -0
- package/docs/cli/gate.mdx +64 -0
- package/docs/cli/help.mdx +92 -0
- package/docs/cli/hunt.mdx +57 -0
- package/docs/cli/identify.mdx +62 -0
- package/docs/cli/init.mdx +94 -0
- package/docs/cli/kill.mdx +91 -0
- package/docs/cli/license.mdx +48 -0
- package/docs/cli/mcp.mdx +61 -0
- package/docs/cli/open.mdx +68 -0
- package/docs/cli/restart.mdx +60 -0
- package/docs/cli/rollback.mdx +35 -0
- package/docs/cli/serve.mdx +62 -0
- package/docs/cli/status.mdx +64 -0
- package/docs/cli/stop.mdx +56 -0
- package/docs/cli/telemetry.mdx +57 -0
- package/docs/cli/update.mdx +52 -0
- package/docs/cli/verify.mdx +57 -0
- package/docs/cli/version.mdx +39 -0
- package/docs/cli/watch.mdx +55 -0
- package/docs/cli.mdx +219 -0
- package/docs/debugging.md +13 -9
- package/docs/deploy-checks.md +15 -11
- package/docs/desktop-apps.md +49 -40
- package/docs/desktop.mdx +188 -0
- package/docs/docs.json +363 -0
- package/docs/enterprise.md +20 -16
- package/docs/faq.mdx +88 -0
- package/docs/fixtures.md +11 -7
- package/docs/flows.md +26 -22
- package/docs/for-agents.md +71 -0
- package/docs/frameworks.mdx +199 -0
- package/docs/gate-plan.md +45 -41
- package/docs/gates.md +22 -18
- package/docs/getting-started.md +76 -65
- package/docs/human-control.md +22 -18
- package/docs/index.mdx +101 -0
- package/docs/install-agentic.mdx +215 -0
- package/docs/install-manual.mdx +194 -0
- package/docs/instrumentation.mdx +232 -0
- package/docs/integration-patterns.md +38 -34
- package/docs/local-registry.md +16 -12
- package/docs/multi-agent-testing.md +16 -12
- package/docs/packages/babel-plugin.mdx +70 -0
- package/docs/packages/browser.mdx +111 -0
- package/docs/packages/core.mdx +106 -0
- package/docs/packages/electron.mdx +87 -0
- package/docs/packages/eslint-plugin.mdx +84 -0
- package/docs/packages/next.mdx +91 -0
- package/docs/packages/react.mdx +91 -0
- package/docs/packages/server.mdx +98 -0
- package/docs/packages/tauri.mdx +63 -0
- package/docs/packages/test.mdx +108 -0
- package/docs/packages/vite-plugin.mdx +96 -0
- package/docs/packages.mdx +217 -0
- package/docs/platform-integration.md +33 -26
- package/docs/predicates.mdx +179 -0
- package/docs/quickstart.mdx +211 -0
- package/docs/recipes.mdx +242 -0
- package/docs/skill-file.mdx +105 -0
- package/docs/state-management.mdx +197 -0
- package/docs/style.css +14 -0
- package/docs/system-map.md +47 -32
- package/docs/telemetry-contract.md +93 -50
- package/docs/telemetry-events.mdx +430 -0
- package/docs/telemetry.md +57 -52
- package/docs/testing.md +10 -6
- package/docs/token-efficiency.md +30 -26
- package/docs/tools-act-and-wait.mdx +123 -0
- package/docs/tools-act-sequence.mdx +120 -0
- package/docs/tools-act.mdx +82 -0
- package/docs/tools-assert.mdx +70 -0
- package/docs/tools-console.mdx +59 -0
- package/docs/tools-inspect.mdx +85 -0
- package/docs/tools-navigate.mdx +63 -0
- package/docs/tools-network.mdx +86 -0
- package/docs/tools-observe.mdx +89 -0
- package/docs/tools-overview.mdx +157 -0
- package/docs/tools-query.mdx +82 -0
- package/docs/tools-session-and-feedback.mdx +91 -0
- package/docs/tools-sessions.mdx +65 -0
- package/docs/tools-snapshot.mdx +75 -0
- package/docs/tools-state.mdx +81 -0
- package/docs/tools-tools-and-run.mdx +125 -0
- package/docs/tools-wait-for.mdx +66 -0
- package/docs/troubleshooting.mdx +193 -0
- package/docs/usage.md +175 -153
- package/docs/vs-chrome-devtools-mcp.mdx +82 -0
- package/docs/vs-playwright-mcp.mdx +85 -0
- package/docs/vs-screenshots.mdx +96 -0
- package/docs/what-is-reticle.mdx +63 -0
- package/docs/why-reticle.mdx +107 -0
- package/package.json +2 -2
- package/docs/matrix/2.5.0/claude-code-machine.json +0 -19
- package/docs/matrix/2.5.0/codex-machine.json +0 -20
- package/docs/matrix/2.5.0/cursor-machine.json +0 -22
- package/docs/matrix/2.5.0/gemini-machine.json +0 -22
- package/docs/matrix/2.5.0/opencode-machine.json +0 -22
- package/docs/matrix/2.5.0/vscode-machine.json +0 -22
- package/docs/matrix/2.5.0/windsurf-machine.json +0 -22
- package/docs/matrix/MATRIX.md +0 -26
- package/docs/matrix/README.md +0 -59
- package/docs/mint.json +0 -61
package/docs/usage.md
CHANGED
|
@@ -1,14 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
title: Complete usage guide
|
|
3
|
+
description: 'The full reference and cookbook: every tool, flag, and workflow, with worked examples.'
|
|
4
|
+
icon: book
|
|
5
|
+
---
|
|
2
6
|
|
|
3
7
|
The full reference and cookbook. If you haven't set up Reticle yet, start with [Getting Started](getting-started.md).
|
|
4
8
|
|
|
9
|
+
> **Start here instead, unless you want the long form.** This page predates the focused reference and still holds the fullest single narrative, but almost everything in it now has a page of its own that is shorter, searchable and verified against a running app:
|
|
10
|
+
>
|
|
11
|
+
> | Looking for | Go to |
|
|
12
|
+
> | ------------------------------------------ | --------------------------------------- |
|
|
13
|
+
> | One tool, with a real request and response | [Tools reference](/tools-overview) |
|
|
14
|
+
> | The predicate grammar | [Predicates](/predicates) |
|
|
15
|
+
> | Every action and its arguments | [Actions](/actions) |
|
|
16
|
+
> | Worked examples for real situations | [Recipes](/recipes) |
|
|
17
|
+
> | Baselines, clock, crawl, mocking, flows | [Beyond the verify loop](/capabilities) |
|
|
18
|
+
> | Habits that make a verdict trustworthy | [Best practices](/best-practices) |
|
|
19
|
+
> | Common questions | [FAQ](/faq) |
|
|
20
|
+
>
|
|
21
|
+
> What is still only here: turning existing test cases into agent checks (§11), the security and privacy detail (§15), and real input mode (§18).
|
|
22
|
+
|
|
23
|
+
> **On the notation.** Examples here are written as `reticle_act({ ref, action })`, which is shorthand for "call that tool with these arguments". Over MCP you do not write JavaScript; your client sends the tool name and an arguments object. The shorthand is shorter to read, and the argument shapes are identical either way.
|
|
24
|
+
>
|
|
25
|
+
> If you want examples in the exact JSON your client sends, [Recipes](/recipes) has them, and every response on that page was captured from a running app.
|
|
26
|
+
|
|
5
27
|
**Contents**
|
|
6
28
|
|
|
7
29
|
1. [How Reticle helps you](#1-how-reticle-helps-you)
|
|
8
30
|
2. [Core concepts](#2-core-concepts)
|
|
9
|
-
3. [The tools
|
|
10
|
-
4. [The predicate DSL
|
|
11
|
-
5. [Actions
|
|
31
|
+
3. [The tools: full reference](#3-the-tools-full-reference)
|
|
32
|
+
4. [The predicate DSL: full reference](#4-the-predicate-dsl-full-reference)
|
|
33
|
+
5. [Actions: full list](#5-actions-full-list)
|
|
12
34
|
6. [Snapshot modes & scoping](#6-snapshot-modes--scoping)
|
|
13
35
|
7. [Cookbook: real situations](#7-cookbook-real-situations)
|
|
14
36
|
8. [Regression: baselines & diff](#8-regression-baselines--diff)
|
|
@@ -24,15 +46,15 @@ The full reference and cookbook. If you haven't set up Reticle yet, start with [
|
|
|
24
46
|
|
|
25
47
|
## 1. How Reticle helps you
|
|
26
48
|
|
|
27
|
-
You mostly **talk to your agent in plain English
|
|
49
|
+
You mostly **talk to your agent in plain English**: "add X and verify it works." The agent uses Reticle under the hood. Here's the value, by situation:
|
|
28
50
|
|
|
29
|
-
- **You stop being the agent's eyes.** Today you build a feature, then _you_ click through the browser to check it. With Reticle the agent checks its own work and only comes back when it's actually verified
|
|
30
|
-
- **Silent breakage gets caught.** A console error, a 500 on one locale, a button that quietly disappeared after a refactor
|
|
31
|
-
- **The fix loop closes.** When something's wrong, Reticle reports the _evidence_
|
|
51
|
+
- **You stop being the agent's eyes.** Today you build a feature, then _you_ click through the browser to check it. With Reticle the agent checks its own work and only comes back when it's actually verified, or with a precise reason it failed.
|
|
52
|
+
- **Silent breakage gets caught.** A console error, a 500 on one locale, a button that quietly disappeared after a refactor: humans skim past these; Reticle asserts on them.
|
|
53
|
+
- **The fix loop closes.** When something's wrong, Reticle reports the _evidence_: the failing network call, the console stack, and (on React) the **source file:line** to edit.
|
|
32
54
|
- **It's cheap enough to run constantly.** ~100 tokens per verified interaction means the agent can verify on _every_ edit, not just at the end (see [token-efficiency](token-efficiency.md)).
|
|
33
55
|
- **Your manual QA becomes automated.** The checklist you never turned into Playwright tests? Your agent runs it now (see [§11](#11-turning-your-test-cases-into-agent-checks)).
|
|
34
56
|
|
|
35
|
-
Who benefits most: anyone shipping **dashboards, internal tools, SaaS apps
|
|
57
|
+
Who benefits most: anyone shipping **dashboards, internal tools, SaaS apps**. Behavior-heavy UIs with lots of forms, lists, modals, and API calls that change often.
|
|
36
58
|
|
|
37
59
|
---
|
|
38
60
|
|
|
@@ -41,23 +63,23 @@ Who benefits most: anyone shipping **dashboards, internal tools, SaaS apps** —
|
|
|
41
63
|
**The loop: look → act → observe → assert.**
|
|
42
64
|
|
|
43
65
|
1. **Look** with `reticle_snapshot` (what's on screen) or `reticle_query` (find a specific thing).
|
|
44
|
-
2. **Act** with `reticle_act` (click/fill/…). It returns a `since` cursor
|
|
45
|
-
3. **Observe** with `reticle_observe({ since })
|
|
46
|
-
4. **Assert** with `reticle_assert({ predicate })
|
|
66
|
+
2. **Act** with `reticle_act` (click/fill/…). It returns a `since` cursor, a timestamp marker.
|
|
67
|
+
3. **Observe** with `reticle_observe({ since })`: everything the app did _after_ that action.
|
|
68
|
+
4. **Assert** with `reticle_assert({ predicate })`. Verify it, get evidence.
|
|
47
69
|
|
|
48
70
|
**Refs.** Elements are addressed by stable handles like `e7`. You get them from `snapshot` or `query`, then pass them to `act`/`inspect`. A ref re-resolves to its element across re-renders; if the element is gone, you get a clear error.
|
|
49
71
|
|
|
50
|
-
**Evidence, not prose.** Every tool returns structured data
|
|
72
|
+
**Evidence, not prose.** Every tool returns structured data (counts, the matching network call, the snapshot delta) so the agent reasons over facts, not a vibe.
|
|
51
73
|
|
|
52
74
|
**Sessions.** Each connected browser tab is a session (named via `reticle.connect({ session })`). With one tab open you never specify it; with several, pass `sessionId`.
|
|
53
75
|
|
|
54
76
|
---
|
|
55
77
|
|
|
56
|
-
## 3. The tools
|
|
78
|
+
## 3. The tools: full reference
|
|
57
79
|
|
|
58
80
|
### `reticle_sessions`
|
|
59
81
|
|
|
60
|
-
List connected tabs. → `{ sessions: [{ sessionId, url, title, lastSeenMs, hidden, focused, throttled }] }`. `lastSeenMs` is the silence since the tab last reported (not time-since-connect); `throttled` is `true` when the tab is hidden or has gone quiet
|
|
82
|
+
List connected tabs. → `{ sessions: [{ sessionId, url, title, lastSeenMs, hidden, focused, throttled }] }`. `lastSeenMs` is the silence since the tab last reported (not time-since-connect); `throttled` is `true` when the tab is hidden or has gone quiet, and a throttled tab silently no-ops timers/rAF/pointer.
|
|
61
83
|
|
|
62
84
|
### `reticle_snapshot`
|
|
63
85
|
|
|
@@ -65,8 +87,8 @@ A semantic, accessibility-tree view of the page.
|
|
|
65
87
|
|
|
66
88
|
- **args:** `mode?: 'full' | 'interactive' | 'status'` (default `full`), `scope?` (CSS selector or ref), `diff?: boolean`, `sessionId?`.
|
|
67
89
|
- **returns:** `{ tree, status: { route, title, visibleDialogs }, nodes, truncated, cost: { bytes, tokens } }`.
|
|
68
|
-
- **`diff: true`** returns only what changed since your last snapshot of the same scope/mode
|
|
69
|
-
- **`cost`** is an estimated size of the result
|
|
90
|
+
- **`diff: true`** returns only what changed since your last snapshot of the same scope/mode: `{ mode: 'delta', delta: { added, removed, addedCount, removedCount } }` or `{ mode: 'unchanged' }` (no full tree). The first call (and any call after a route change) still returns the full tree. ~99% fewer tokens to re-look after an action; see [token-efficiency.md](token-efficiency.md).
|
|
91
|
+
- **`cost`** is an estimated size of the result. Re-scope (`mode`/`scope`) before reading if large.
|
|
70
92
|
|
|
71
93
|
```jsonc
|
|
72
94
|
reticle_snapshot({ mode: "interactive" })
|
|
@@ -74,7 +96,7 @@ reticle_snapshot({ mode: "interactive" })
|
|
|
74
96
|
// - button "Add item" (ref=e5)
|
|
75
97
|
// status: { route: "/dashboard", visibleDialogs: [] }
|
|
76
98
|
|
|
77
|
-
reticle_snapshot({ diff: true }) // after an action
|
|
99
|
+
reticle_snapshot({ diff: true }) // after an action: only the change set
|
|
78
100
|
// { mode: "delta", delta: { added: ['- alert "Saved!"'], removed: [], addedCount: 1, removedCount: 0 } }
|
|
79
101
|
```
|
|
80
102
|
|
|
@@ -91,10 +113,10 @@ reticle_query({ by: "role", value: "button", name: "Save" }) // → ref + desc
|
|
|
91
113
|
|
|
92
114
|
### `reticle_inspect`
|
|
93
115
|
|
|
94
|
-
Deep detail on one element
|
|
116
|
+
Deep detail on one element, including the signals a snapshot/a11y tree omits, so you can tell "present" from "actually usable / on-theme".
|
|
95
117
|
|
|
96
118
|
- **args:** `ref`, `sessionId?`.
|
|
97
|
-
- **returns:** descriptor + `tag` + `box` + `occluded` (another element covers its center
|
|
119
|
+
- **returns:** descriptor + `tag` + `box` + `occluded` (another element covers its center: a z-index/overlay bug) + `styles { color, backgroundColor, opacity, cursor, display, visibility }` + `theme { colorToken, colorTokens, backgroundToken, backgroundTokens, offTheme, tokenCount, themeScope }` (compliance vs the app's design tokens, where `offTheme:true` flags an off-palette color; the plural fields list every token sharing that colour and the singular ones are `null` when several do, and `themeScope` names the theme active at capture) + `component { componentStack, source?: { file, line, column } }` (with `@reticlehq/react`).
|
|
98
120
|
- Use it to catch present-but-broken UI: `opacity:0` / `box` 0×0 / `occluded:true` (invisible or unclickable), `cursor` not `pointer` (dead control), `offTheme:true` (off-design-token color).
|
|
99
121
|
|
|
100
122
|
### `reticle_act` / `reticle_act_sequence`
|
|
@@ -103,9 +125,9 @@ Perform one action / several in order.
|
|
|
103
125
|
|
|
104
126
|
- **`reticle_act` args:** `ref`, `action`, `args?`, `refuseWhenThrottled?`, `sessionId?`. → `{ since, dispatched, settled, settleReason, result, session, warning? }` where `result = { ok, ref, action, dispatched, settled, settleReason, effect }`. The `session` block `{ lastSeenMs, throttled, focused }` (F2) reports tab health on every act; when `throttled` is true a `warning` string is also attached. Pass `refuseWhenThrottled: true` to hard-fail instead of warning (opt-in; default is warn-only so background testing never breaks).
|
|
105
127
|
- **`reticle_act_sequence` args:** `steps: [{ ref, action, args? }]`. → `{ since, dispatched, result }` where `result = { ok, count, effects: [...], steps: [...] }` (one `effect` per step; each step carries its own `dispatched`/`settled`/`settleReason`).
|
|
106
|
-
- See [§5](#5-actions
|
|
128
|
+
- See [§5](#5-actions-full-list) for the action list.
|
|
107
129
|
|
|
108
|
-
**Dispatch vs settle (F1).** The action is two phases: the **dispatch** (the synchronous click/fill
|
|
130
|
+
**Dispatch vs settle (F1).** The action is two phases: the **dispatch** (the synchronous click/fill, which is what can fail) and the **settle** (waiting one animation frame so React's commit lands before we return). The settle is **bounded** (~200ms): in a throttled/background tab `requestAnimationFrame` never fires, so Reticle falls back to a timer and resolves anyway. A settle timeout is therefore **never an error**: `reticle_act` resolves with `settled:false, settleReason:"timeout"` and the dispatch (the click) has still landed. Only a real dispatch failure (stale ref, wrong element type) throws.
|
|
109
131
|
|
|
110
132
|
| top-level field | meaning |
|
|
111
133
|
| --- | --- |
|
|
@@ -113,7 +135,7 @@ Perform one action / several in order.
|
|
|
113
135
|
| `settled` | a real animation frame flushed within the budget; `false` = the fallback timer fired |
|
|
114
136
|
| `settleReason` | `"timeout"` when the fallback fired (throttled tab), else `null` |
|
|
115
137
|
|
|
116
|
-
**`result.effect
|
|
138
|
+
**`result.effect`: best-effort evidence the action landed.** All probes are cheap and capture only the _immediate_ effect (one microtask + one rAF after dispatch); async, network-driven re-renders show up in `reticle_observe`, not here.
|
|
117
139
|
|
|
118
140
|
| field | meaning |
|
|
119
141
|
| --- | --- |
|
|
@@ -125,22 +147,22 @@ Perform one action / several in order.
|
|
|
125
147
|
| `focusMoved` | `"<prevRef>-><newRef>"` if `document.activeElement` changed, else `null` (body counts as `null`) |
|
|
126
148
|
| `valueChanged` | `fill`/`type`/`clear` only: input value before !== after; otherwise `false` |
|
|
127
149
|
| `domMutatedWithin` | count of MutationObserver records seen in the window |
|
|
128
|
-
| `occluded` | `click`/`dblclick` only: the click point hit-tested to a _foreign_ element (an overlay is on top). Synthetic dispatch still delivered the event, but **a real user could not click it
|
|
150
|
+
| `occluded` | `click`/`dblclick` only: the click point hit-tested to a _foreign_ element (an overlay is on top). Synthetic dispatch still delivered the event, but **a real user could not click it**, so treat the target as visually blocked. `false` when not click-like or not hit-testable |
|
|
129
151
|
| `occludedBy` | the ref of the element actually on top at the click point when `occluded`, else `null` |
|
|
130
152
|
| `scrolledIntoView` | `click`/`dblclick` only: the target was off-viewport, so Reticle scrolled it into view before dispatch |
|
|
131
153
|
|
|
132
154
|
Use it to distinguish failure modes: `visible:false`/`enabled:false`/`targetMatched:false` → your action missed; the tool throwing → it never dispatched; `occluded:true` → the control is covered by something (a real user is blocked even though the synthetic event landed); `defaultPrevented:true` or all of `valueChanged:false`/`focusMoved:null`/`domMutatedWithin:0` → the app didn't react.
|
|
133
155
|
|
|
134
|
-
**Clicks run the code, they don't push pixels.** A `click`/`dblclick` fires the full `pointerdown → mousedown → focus → pointerup → mouseup → click` sequence directly on the resolved element
|
|
156
|
+
**Clicks run the code, they don't push pixels.** A `click`/`dblclick` fires the full `pointerdown → mousedown → focus → pointerup → mouseup → click` sequence directly on the resolved element, so pointer- and focus-gated handlers fire the way they do for a real user, with no coordinate gesture to be intercepted by the presenter HUD or missed off-screen. This is the **default even when native CDP real input is configured** (`inputMode:"synthetic"`, `inputModeReason:"synthetic-click-preferred"`). Before dispatch Reticle hit-tests the click point (`occluded`) and scrolls an off-screen target in (`scrolledIntoView`), so a blocked or off-viewport target is reported, never silently "successful". For the rare case that needs a **trusted** native click (a native file picker, clipboard, or an `isTrusted`-gated handler), pass `args:{ native:true }` to drive it through CDP. `hover`/`drag` still use native pointer input (they need real hit-testing).
|
|
135
157
|
|
|
136
|
-
**Cookbook
|
|
158
|
+
**Cookbook: "Did my action even land?"**
|
|
137
159
|
|
|
138
160
|
```ts
|
|
139
161
|
const { result } = reticle_act({ ref: saveBtn, action: 'click' });
|
|
140
162
|
if (result.effect.defaultPrevented) {
|
|
141
|
-
// a handler blocked the default
|
|
163
|
+
// a handler blocked the default, so the click was swallowed
|
|
142
164
|
} else if (result.effect.domMutatedWithin === 0) {
|
|
143
|
-
// dispatched cleanly but the app rendered nothing
|
|
165
|
+
// dispatched cleanly but the app rendered nothing: likely a dead control
|
|
144
166
|
}
|
|
145
167
|
```
|
|
146
168
|
|
|
@@ -150,14 +172,14 @@ The timeline + summary of what happened.
|
|
|
150
172
|
|
|
151
173
|
- **args:** `window_ms?` (default 2000) **or** `since?` (cursor from an act), `filters?` (event-type names), `max_events?` (cap the timeline to the most recent N), `sessionId?`.
|
|
152
174
|
- **returns:** `{ window_ms, events: [...], summary: { network, domAdded, domRemoved, routeChanges, consoleErrors, animations, signals }, cost: { events, bytes, droppedOldest? } }`.
|
|
153
|
-
- **Output budget.** Every result carries a `cost:{ events, bytes }` hint so you can self-budget your next call. When `max_events` truncates the timeline, the dropped count is surfaced as `cost.droppedOldest
|
|
175
|
+
- **Output budget.** Every result carries a `cost:{ events, bytes }` hint so you can self-budget your next call. When `max_events` truncates the timeline, the dropped count is surfaced as `cost.droppedOldest`, never a silent cap. (The presenter HUD's own animations are filtered out of the timeline automatically, so `observe` shows the app, not the instrument.)
|
|
154
176
|
|
|
155
177
|
### `reticle_act_and_wait`
|
|
156
178
|
|
|
157
|
-
Act, then wait for a predicate
|
|
179
|
+
Act, then wait for a predicate: the whole act→observe→assert loop in one hop.
|
|
158
180
|
|
|
159
181
|
- **args:** `ref`, `action`, `args?`, `until: <predicate>`, `timeout_ms?` (default 4000; 0 = evaluate once), `refuseWhenThrottled?`, `sessionId?`.
|
|
160
|
-
- **returns:** `{ effect, verdict, trace, session, warning? }
|
|
182
|
+
- **returns:** `{ effect, verdict, trace, session, warning? }`. `effect` is the action result (`{ ok, ref, action }`), `verdict` is `{ pass, evidence?, failureReason? }`, `trace` is the reaction report of everything the app did after the action, and `session` (F2) is the tab-health block `{ lastSeenMs, throttled, focused }` (with a `warning` when throttled). A failing `verdict` still returns `effect` + `trace` so you can see what _did_ happen. The predicate is automatically floored at this act's cursor, so it only matches events the action actually caused.
|
|
161
183
|
|
|
162
184
|
### `reticle_wait_for`
|
|
163
185
|
|
|
@@ -173,7 +195,7 @@ Verify a predicate; optionally wait for it.
|
|
|
173
195
|
- **args:** `predicate`, `timeout_ms?` (0 = evaluate once), `since?`, `sessionId?`.
|
|
174
196
|
- Same `since` default as `reticle_wait_for`: scoped to your last act so a stale buffered event can't fake a pass; override with an explicit `since`.
|
|
175
197
|
- **returns:** `{ verified, because, pass, evidence, contradictions?, coverage?, failureReason?, session, warning? }`. On failure includes a **near-miss** (e.g. "found the dialog but not visible", or "no button named 'Submit'; saw: Cancel"). The `session` block `{ lastSeenMs, throttled, focused }` reports tab health on every assert; when throttled a `warning` is attached so you never assert against a tab that is silently no-oping.
|
|
176
|
-
- **Read `verified`, not `pass`.** `pass` says the predicate held; `verified` says whether that means anything. It is `"no"` when a channel contradicts the assertion (a failed write under a green screen, a batch whose body reports per-item failures, a request still in flight), and `"unknown"` when the outcome could not be known yet
|
|
198
|
+
- **Read `verified`, not `pass`.** `pass` says the predicate held; `verified` says whether that means anything. It is `"no"` when a channel contradicts the assertion (a failed write under a green screen, a batch whose body reports per-item failures, a request still in flight), and `"unknown"` when the outcome could not be known yet: a `202 Accepted` that has not reconciled, or a write whose response body was never recorded. `because` names the deciding evidence in one sentence.
|
|
177
199
|
|
|
178
200
|
### `reticle_reconcile`
|
|
179
201
|
|
|
@@ -182,7 +204,7 @@ Compare what the API **returned** against what the page **renders**.
|
|
|
182
204
|
- **args:** `since?`, `urlContains?`, `sessionId?`.
|
|
183
205
|
- **returns:** `{ mismatches, compared, note? }`.
|
|
184
206
|
- Catches the class no status code and no assertion can reach: a `USD 7997` amount rendered as `₹79.97`, or a record the API calls `on_hold` displayed as `"pending"`. Both sides agree on the digits; only the meaning differs, so every other channel reports success.
|
|
185
|
-
- Needs response bodies
|
|
207
|
+
- Needs response bodies: `connect({ captureNetworkBodies: true })`. When nothing could be compared it says so in `note` rather than returning an empty, clean-looking result over data it never read.
|
|
186
208
|
|
|
187
209
|
### `reticle_network` / `reticle_console` / `reticle_animations`
|
|
188
210
|
|
|
@@ -202,7 +224,7 @@ The app-advertised testable surface (registered via `reticle.describe`). Call th
|
|
|
202
224
|
|
|
203
225
|
### `reticle_domain`
|
|
204
226
|
|
|
205
|
-
Read the app's domain model **before testing**: a synthesis of every saved flow + the registered capabilities. Tells you what to test and where the real risk is without crawling the app. Reads `.reticle/flows/` + `.reticle/contract.json
|
|
227
|
+
Read the app's domain model **before testing**: a synthesis of every saved flow + the registered capabilities. Tells you what to test and where the real risk is without crawling the app. Reads `.reticle/flows/` + `.reticle/contract.json`, no browser needed.
|
|
206
228
|
|
|
207
229
|
- `reticle_domain({})` → `{ flowCount, flows: [{ name, steps, grade, asserts, signals, testids, warning?, risk? }], declared: { testids, signals, stores }, coverage: { asserted, presenceOnly, assertionFree }, gaps: { unassertedFlows, declaredUntestedSignals, declaredUntestedTestids }, riskRanked, summary }`
|
|
208
230
|
- **`gaps`** is the point: `declaredUntestedSignals` are intents the app emits that **no flow asserts** (untested behavior); `unassertedFlows` act but verify no consequence. Close them with a flow + a consequence assertion (`reticle_annotate`).
|
|
@@ -210,7 +232,7 @@ Read the app's domain model **before testing**: a synthesis of every saved flow
|
|
|
210
232
|
|
|
211
233
|
### `reticle_state`
|
|
212
234
|
|
|
213
|
-
Read live framework/store state directly instead of inferring it from the DOM
|
|
235
|
+
Read live framework/store state directly instead of inferring it from the DOM. See [§17](#17-evidence-of-effect-actawait-state-capabilities-replay).
|
|
214
236
|
|
|
215
237
|
- `reticle_state({ store?, ref?, path?, depth?, sessionId? })` → `{ stores, component? }`, or `{ store, path, found, value, availableKeys?, storeNames }` when `path`/`depth` is given.
|
|
216
238
|
|
|
@@ -220,14 +242,14 @@ Store reads are the reliable path. The `ref` component read is best-effort and b
|
|
|
220
242
|
|
|
221
243
|
- `path` extracts a dot-path sub-tree relative to the named `store` (numeric segments index arrays), e.g. `reticle_state({ store:"workspace", path:"captionCache.v3.0.text" })`.
|
|
222
244
|
- `depth` collapses anything deeper than N levels to a compact size marker (`{…7 keys}`, `[Array(120)]`) so you can skim a store's _shape_ before drilling in.
|
|
223
|
-
- A wrong `path` returns `{ found:false, availableKeys:[...] }
|
|
245
|
+
- A wrong `path` returns `{ found:false, availableKeys:[...] }`, the keys that _were_ present where the walk stopped, so a mistyped path is self-correcting, not a bare `null`.
|
|
224
246
|
|
|
225
247
|
### Detecting wasted re-renders (React)
|
|
226
248
|
|
|
227
|
-
A page can be **thrashing
|
|
249
|
+
A page can be **thrashing**, committing many React renders a second, while the DOM stays visually identical. The DOM/screenshot tools see an idle page; only a tool inside the runtime sees the commit rate. Reticle exposes it as a registered store you read with `reticle_state`:
|
|
228
250
|
|
|
229
251
|
```ts
|
|
230
|
-
// app entry
|
|
252
|
+
// app entry. MUST run before react-dom loads, so import it FIRST (React reads the devtools hook
|
|
231
253
|
// at renderer-inject time). It augments a real React DevTools hook if present; host-safe (no-ops on
|
|
232
254
|
// any failure, never breaks the app).
|
|
233
255
|
import { installRenderMeter } from '@reticlehq/react';
|
|
@@ -239,36 +261,36 @@ reticle_state({ store: "__reticle_renders", path: "commits" }) // → total Re
|
|
|
239
261
|
// read it, do an action (or wait a window), read again → the delta is the commit count for that span.
|
|
240
262
|
```
|
|
241
263
|
|
|
242
|
-
A render storm shows up as a commit count that climbs with no corresponding DOM mutation
|
|
264
|
+
A render storm shows up as a commit count that climbs with no corresponding DOM mutation: a perf regression invisible to any outside-the-page tool.
|
|
243
265
|
|
|
244
266
|
### `reticle_session {action:"narrate"}` / `reticle_clock`
|
|
245
267
|
|
|
246
|
-
Show the agent's intent on the page, and control time (toasts/debounces/auto-dismiss)
|
|
268
|
+
Show the agent's intent on the page, and control time (toasts/debounces/auto-dismiss). See [§16](#16-presenter-mode-narration--fake-clock-watch--control).
|
|
247
269
|
|
|
248
270
|
### `reticle_baseline {action:"save"}` / `reticle_baseline {action:"list"}` / `reticle_baseline {action:"diff"}`
|
|
249
271
|
|
|
250
|
-
Regression detection
|
|
272
|
+
Regression detection. See [§8](#8-regression-baselines--diff).
|
|
251
273
|
|
|
252
274
|
### `reticle_record {action:"start"}` / `reticle_record {action:"stop"}` / `reticle_replay`
|
|
253
275
|
|
|
254
|
-
Capture a flow's reaction report and compile it into a replayable program
|
|
276
|
+
Capture a flow's reaction report and compile it into a replayable program. See [§9](#9-recording-a-flow). `reticle_record {action:"stop"}` also returns a `cost:{ events, bytes }` hint alongside the reaction report so you can gauge the recording's size.
|
|
255
277
|
|
|
256
278
|
### `reticle_explore`
|
|
257
279
|
|
|
258
|
-
List interactive elements + console-error count for autonomous exploration
|
|
280
|
+
List interactive elements + console-error count for autonomous exploration. See [§10](#10-autonomous-exploration).
|
|
259
281
|
|
|
260
282
|
### Flows, recorder & self-healing (`.reticle/`)
|
|
261
283
|
|
|
262
|
-
`reticle_contract_save`, `reticle_flow_save` / `reticle_flow_save_recorded` / `reticle_flow {action:"list"}` / `reticle_flow {action:"load"}` / `reticle_flow_replay` / `reticle_flow_verify`, `reticle_flow_heal`, `reticle_annotate
|
|
284
|
+
`reticle_contract_save`, `reticle_flow_save` / `reticle_flow_save_recorded` / `reticle_flow {action:"list"}` / `reticle_flow {action:"load"}` / `reticle_flow_replay` / `reticle_flow_verify`, `reticle_flow_heal`, `reticle_annotate`: record once, replay forever (anchored on testid/signal, or on an auto-derived component/source anchor when there's no testid), with legible drift + self-heal. Full guide: [Flows, the recorder & self-healing](flows.md).
|
|
263
285
|
|
|
264
|
-
- **`reticle_flow_verify({ names?, sessionId? })`**
|
|
265
|
-
- **Decision envelope:** on a drift/fail, `reticle_flow_replay` (and each `reticle_flow_verify` failure) returns the actionable fix
|
|
286
|
+
- **`reticle_flow_verify({ names?, sessionId? })`** is the regression-suite call: it replays EVERY saved flow (or a subset) deterministically and returns one verdict `{ status, passed, failed, failures: [{ flow, verdict, whatChanged, whereInSource, nextAction }] }`. Passing flows are counted; only failures carry detail. Run it after any change: one call, no LLM per flow.
|
|
287
|
+
- **Decision envelope:** on a drift/fail, `reticle_flow_replay` (and each `reticle_flow_verify` failure) returns the actionable fix: `whatChanged`, `whereInSource` (`file:line`), and a one-line `nextAction` (e.g. "rebind the anchor to 'new-deploy', or update the flow if intended").
|
|
266
288
|
|
|
267
289
|
### Human-in-the-loop control
|
|
268
290
|
|
|
269
|
-
`reticle_session {action:"end"}`, `reticle_session {action:"resume"}`, `reticle_session {action:"messages"}
|
|
291
|
+
`reticle_session {action:"end"}`, `reticle_session {action:"resume"}`, `reticle_session {action:"messages"}`: the human can pause the agent, send it a correction, or end the session from the floating panel; the agent receives guidance on its next tool call. Full guide: [Human-in-the-loop control](human-control.md).
|
|
270
292
|
|
|
271
|
-
### `reticle_session {action:"review"}
|
|
293
|
+
### `reticle_session {action:"review"}`: drain the bugs the human flagged on the page
|
|
272
294
|
|
|
273
295
|
The dev clicks **"Flag a bug"** in the running app, points at the element that looks wrong, and types what's wrong (⌘/Ctrl+Enter to send). Each flag becomes a **mark** the agent drains:
|
|
274
296
|
|
|
@@ -280,22 +302,22 @@ reticle_session {action:"review"}({ sessionId })
|
|
|
280
302
|
pendingCount: 1 }
|
|
281
303
|
```
|
|
282
304
|
|
|
283
|
-
Each pending mark carries the human note, the element label, the source **`file:line`** (when the framework stamped one), and a ready-to-act `fix` hint. Open the file, apply the fix, then `reticle_session {action:"review"}({ resolve: "m1" })
|
|
305
|
+
Each pending mark carries the human note, the element label, the source **`file:line`** (when the framework stamped one), and a ready-to-act `fix` hint. Open the file, apply the fix, then `reticle_session {action:"review"}({ resolve: "m1" })`. The human watching the panel sees **"✓ fixed: …"** land. Reading never consumes a mark, so you can list → fix → verify → resolve. `reticle_sessions` also reports `pendingMarks` so you notice flagged bugs during normal orientation.
|
|
284
306
|
|
|
285
|
-
### `reticle_network_mock
|
|
307
|
+
### `reticle_network_mock`: stub the network for error-state testing (driven mode)
|
|
286
308
|
|
|
287
|
-
On a page Reticle drives (`reticle drive`), make a request return a 500, force it offline, or delay it
|
|
309
|
+
On a page Reticle drives (`reticle drive`), make a request return a 500, force it offline, or delay it, so testing error/edge states is one declared rule, no backend changes:
|
|
288
310
|
|
|
289
311
|
```
|
|
290
312
|
reticle_network_mock({ mocks: [{ urlContains: "/api/pay", method: "POST", status: 500 }] })
|
|
291
|
-
→ { applied: true, count: 1 } // now the checkout POST returns 500
|
|
313
|
+
→ { applied: true, count: 1 } // now the checkout POST returns 500; verify the failure UI
|
|
292
314
|
reticle_network_mock({ mocks: [{ urlContains: "/api/feed", abort: true }] }) // simulate offline
|
|
293
315
|
reticle_network_mock({ clear: true }) // turn mocking off
|
|
294
316
|
```
|
|
295
317
|
|
|
296
318
|
First matching rule wins (`urlContains` + optional case-insensitive `method`). Needs a driven browser; without one it returns a `recommendation` pointing at `reticle drive`.
|
|
297
319
|
|
|
298
|
-
### `reticle_viewport
|
|
320
|
+
### `reticle_viewport`: reproducible visual baselines (driven mode)
|
|
299
321
|
|
|
300
322
|
Pin the driven page to a fixed viewport so a screenshot baseline is reproducible across machines:
|
|
301
323
|
|
|
@@ -304,15 +326,15 @@ reticle_viewport({ width: 1280, height: 800 }) // set once, before reticle_scr
|
|
|
304
326
|
→ { applied: true, width: 1280, height: 800 }
|
|
305
327
|
```
|
|
306
328
|
|
|
307
|
-
This is one of three knobs for **CI-stable visual regression
|
|
329
|
+
This is one of three knobs for **CI-stable visual regression**. Set them together:
|
|
308
330
|
|
|
309
|
-
1. **`reticle_viewport({ width, height })`**
|
|
310
|
-
2. **`reticle_clock({ freeze: true })`**
|
|
311
|
-
3. **`reticle_visual_diff({ baseline, masks: [{ x, y, width, height }] })`**
|
|
331
|
+
1. **`reticle_viewport({ width, height })`** gives the same dimensions on every machine.
|
|
332
|
+
2. **`reticle_clock({ freeze: true })`** kills animation/time jitter so the pixels are stable.
|
|
333
|
+
3. **`reticle_visual_diff({ baseline, masks: [{ x, y, width, height }] })`** neutralizes volatile regions (clocks, avatars, ids) so only real changes fail.
|
|
312
334
|
|
|
313
335
|
---
|
|
314
336
|
|
|
315
|
-
## 4. The predicate DSL
|
|
337
|
+
## 4. The predicate DSL: full reference
|
|
316
338
|
|
|
317
339
|
A **predicate** declares what should be true. `reticle_assert` / `reticle_wait_for` evaluate it against the live DOM + the event buffer.
|
|
318
340
|
|
|
@@ -343,21 +365,21 @@ A **predicate** declares what should be true. `reticle_assert` / `reticle_wait_f
|
|
|
343
365
|
// An app-emitted signal (webhook/websocket/store change you surfaced via reticle.signal)
|
|
344
366
|
{ "kind": "signal", "name": "webhook:received", "dataMatches": { "provider": "stripe", "id": "*" } }
|
|
345
367
|
|
|
346
|
-
// A registered store's VALUE
|
|
368
|
+
// A registered store's VALUE: the source of truth no DOM/network read can reach. Walks a dot-path
|
|
347
369
|
// (numeric array indices) and matches `equals`: a literal, omitted = presence, or a
|
|
348
370
|
// { $gte | $lte | $gt | $lt | $contains | $length } operator pattern. Catches a UI-vs-store desync
|
|
349
|
-
// (a deploy that only LOOKS shipped) deterministically, in one call
|
|
371
|
+
// (a deploy that only LOOKS shipped) deterministically, in one call, with no LLM and no DOM scraping.
|
|
350
372
|
{ "kind": "state", "store": "app", "path": "deployments.0.status", "equals": "live" }
|
|
351
373
|
```
|
|
352
374
|
|
|
353
|
-
A `state` assertion is graded as a **consequence** (a wrong element or stale render cannot fake it), and is usable the same three ways anywhere predicates flow: ad-hoc (`reticle_assert` / `reticle_act_and_wait` `until`), as a flow step invariant (`reticle_annotate { kind: "assert-state", statePath, store?, equals? }`), and as a flow's golden end-condition (`reticle_annotate { kind: "success-state", statePath, … }`). On a miss it names the real store value and the keys that were available
|
|
375
|
+
A `state` assertion is graded as a **consequence** (a wrong element or stale render cannot fake it), and is usable the same three ways anywhere predicates flow: ad-hoc (`reticle_assert` / `reticle_act_and_wait` `until`), as a flow step invariant (`reticle_annotate { kind: "assert-state", statePath, store?, equals? }`), and as a flow's golden end-condition (`reticle_annotate { kind: "success-state", statePath, … }`). On a miss it names the real store value and the keys that were available: legible, not a blind fail.
|
|
354
376
|
|
|
355
377
|
### Combinators
|
|
356
378
|
|
|
357
379
|
```jsonc
|
|
358
|
-
{ "allOf": [ <predicate>, <predicate>, … ] }
|
|
359
|
-
{ "anyOf": [ <predicate>, … ] }
|
|
360
|
-
{ "not": <predicate> }
|
|
380
|
+
{ "kind": "allOf", "predicates": [ <predicate>, <predicate>, … ] } // every one must hold
|
|
381
|
+
{ "kind": "anyOf", "predicates": [ <predicate>, … ] } // at least one
|
|
382
|
+
{ "kind": "not", "predicate": <predicate> }
|
|
361
383
|
```
|
|
362
384
|
|
|
363
385
|
### Timing
|
|
@@ -369,23 +391,23 @@ A `state` assertion is graded as a **consequence** (a wrong element or stale ren
|
|
|
369
391
|
|
|
370
392
|
---
|
|
371
393
|
|
|
372
|
-
## 5. Actions
|
|
394
|
+
## 5. Actions: full list
|
|
373
395
|
|
|
374
396
|
`reticle_act({ ref, action, args })`:
|
|
375
397
|
|
|
376
398
|
| action | args | notes |
|
|
377
399
|
| --- | --- | --- |
|
|
378
|
-
| `click` / `dblclick` |
|
|
379
|
-
| `hover` |
|
|
380
|
-
| `focus` / `blur` |
|
|
400
|
+
| `click` / `dblclick` | n/a | dispatches a real click |
|
|
401
|
+
| `hover` | n/a | `mouseover`+`mouseenter` (triggers JS hover state) |
|
|
402
|
+
| `focus` / `blur` | n/a | |
|
|
381
403
|
| `fill` | `{ value }` | sets value via React-safe native setter + `input`/`change` |
|
|
382
404
|
| `type` | `{ text }` | appends to current value |
|
|
383
|
-
| `clear` |
|
|
405
|
+
| `clear` | n/a | empties an input |
|
|
384
406
|
| `select` | `{ value }` | `<select>` option |
|
|
385
|
-
| `check` / `uncheck` |
|
|
386
|
-
| `submit` |
|
|
407
|
+
| `check` / `uncheck` | n/a | checkbox/radio |
|
|
408
|
+
| `submit` | n/a | submits the element's `<form>` |
|
|
387
409
|
| `press` | `{ key }` | keydown/up (default `Enter`) |
|
|
388
|
-
| `scrollIntoView` |
|
|
410
|
+
| `scrollIntoView` | n/a | |
|
|
389
411
|
| `upload` | `{ name, content?, type? }` | sets a file on `<input type=file>` |
|
|
390
412
|
| `drag` | `{ toRef }` | pointer-based drag (dnd-kit / rbd) + HTML5 DnD |
|
|
391
413
|
| `webmcp` | `{ tool, params }` | calls a `navigator.modelContext` tool if the site exposes one |
|
|
@@ -394,13 +416,13 @@ A `state` assertion is graded as a **consequence** (a wrong element or stale ren
|
|
|
394
416
|
|
|
395
417
|
## 6. Snapshot modes & scoping
|
|
396
418
|
|
|
397
|
-
`reticle_snapshot` has three modes
|
|
419
|
+
`reticle_snapshot` has three modes. Pick the cheapest that answers your question:
|
|
398
420
|
|
|
399
|
-
- **`status`** (~30 tokens)
|
|
400
|
-
- **`interactive`** (~100 tokens)
|
|
401
|
-
- **`full
|
|
421
|
+
- **`status`** (~30 tokens): route, visible dialogs, counters. "Where am I, is a modal open?"
|
|
422
|
+
- **`interactive`** (~100 tokens): only actionable elements (buttons, inputs, tabs…). "What can I click?" Non-interactive content (e.g. 1,000 list rows) is skipped.
|
|
423
|
+
- **`full`**: the whole semantic tree. Use only when you truly need everything.
|
|
402
424
|
|
|
403
|
-
**`scope`** narrows any snapshot or query to a subtree
|
|
425
|
+
**`scope`** narrows any snapshot or query to a subtree, either a CSS selector (`scope: "[data-testid=item-list]"`) or a ref. This is the main lever for keeping payloads small and queries unambiguous on big pages.
|
|
404
426
|
|
|
405
427
|
---
|
|
406
428
|
|
|
@@ -412,17 +434,17 @@ Each is phrased as the situation you're in, then how the agent verifies it.
|
|
|
412
434
|
|
|
413
435
|
```jsonc
|
|
414
436
|
const { since } = reticle_act({ ref: iconBtn, action: "click" })
|
|
415
|
-
reticle_assert({ timeout_ms: 2000, predicate: { allOf: [
|
|
437
|
+
reticle_assert({ timeout_ms: 2000, predicate: { kind: "allOf", predicates: [
|
|
416
438
|
{ kind: "element", query: { role: "dialog" }, state: "visible" },
|
|
417
439
|
{ kind: "console", level: "error", absent: true }
|
|
418
440
|
]}})
|
|
419
441
|
```
|
|
420
442
|
|
|
421
|
-
### "I changed an API call
|
|
443
|
+
### "I changed an API call: did it fire correctly and update the UI?"
|
|
422
444
|
|
|
423
445
|
```jsonc
|
|
424
446
|
const { since } = reticle_act({ ref: saveBtn, action: "click" })
|
|
425
|
-
reticle_assert({ timeout_ms: 3000, predicate: { allOf: [
|
|
447
|
+
reticle_assert({ timeout_ms: 3000, predicate: { kind: "allOf", predicates: [
|
|
426
448
|
{ kind: "net", method: "PUT", urlContains: "/api/profile", status: 200, since },
|
|
427
449
|
{ kind: "text", contains: "Saved", visible: true }
|
|
428
450
|
]}})
|
|
@@ -439,7 +461,7 @@ reticle_assert({ timeout_ms: 2000,
|
|
|
439
461
|
predicate: { kind: "text", contains: "New item queued", visible: true } })
|
|
440
462
|
```
|
|
441
463
|
|
|
442
|
-
### "Data shows up only after ~30s (eventual consistency)
|
|
464
|
+
### "Data shows up only after ~30s (eventual consistency): how to refresh and see it"
|
|
443
465
|
|
|
444
466
|
```jsonc
|
|
445
467
|
const { since } = reticle_act({ ref: addBtn, action: "click" })
|
|
@@ -452,29 +474,29 @@ reticle_wait_for({ timeout_ms: 5000, predicate: { kind: "element",
|
|
|
452
474
|
query: { text: name, scope: "[data-testid=item-list]" }, state: "visible" } })
|
|
453
475
|
```
|
|
454
476
|
|
|
455
|
-
### "The list has 100s/1000s of rows
|
|
477
|
+
### "The list has 100s/1000s of rows: was my item actually added?"
|
|
456
478
|
|
|
457
|
-
Don't scroll and eyeball
|
|
479
|
+
Don't scroll and eyeball. Query finds it regardless of position:
|
|
458
480
|
|
|
459
481
|
```jsonc
|
|
460
482
|
reticle_assert({ timeout_ms: 3000, predicate: { kind: "element",
|
|
461
483
|
query: { text: "Invoice #4821", scope: "[data-testid=item-list]" }, state: "visible" } })
|
|
462
484
|
```
|
|
463
485
|
|
|
464
|
-
> Note: if your list is **virtualized** (react-window/virtuoso), off-screen rows aren't in the DOM yet
|
|
486
|
+
> Note: if your list is **virtualized** (react-window/virtuoso), off-screen rows aren't in the DOM yet. Scroll-to-find support is on the roadmap; for now scroll the container or assert against the data via an `reticle.signal`.
|
|
465
487
|
|
|
466
|
-
### "Login form
|
|
488
|
+
### "Login form: does it actually authorize?"
|
|
467
489
|
|
|
468
490
|
```jsonc
|
|
469
491
|
reticle_act({ ref: emailRef, action: "fill", args: { value: "admin@acme.com" } })
|
|
470
492
|
reticle_act({ ref: pwRef, action: "fill", args: { value: "•••••••" } })
|
|
471
493
|
const { since } = reticle_act({ ref: submitRef, action: "click" })
|
|
472
|
-
reticle_assert({ timeout_ms: 3000, predicate: { allOf: [
|
|
494
|
+
reticle_assert({ timeout_ms: 3000, predicate: { kind: "allOf", predicates: [
|
|
473
495
|
{ kind: "net", method: "POST", urlContains: "/api/login", status: 200, since },
|
|
474
496
|
{ kind: "element", query: { role: "heading", name: "Dashboard" }, state: "visible" }
|
|
475
497
|
]}})
|
|
476
498
|
// And the failure path:
|
|
477
|
-
reticle_assert({ predicate: { allOf: [
|
|
499
|
+
reticle_assert({ predicate: { kind: "allOf", predicates: [
|
|
478
500
|
{ kind: "net", urlContains: "/api/login", status: 401 },
|
|
479
501
|
{ kind: "element", query: { role: "alert" }, state: "visible" }
|
|
480
502
|
]}})
|
|
@@ -486,11 +508,11 @@ reticle_assert({ predicate: { allOf: [
|
|
|
486
508
|
reticle_assert({ predicate: { kind: "console", level: "error", absent: true } })
|
|
487
509
|
```
|
|
488
510
|
|
|
489
|
-
### "A real LLM call generates a script
|
|
511
|
+
### "A real LLM call generates a script: is it happening and rendering?"
|
|
490
512
|
|
|
491
513
|
```jsonc
|
|
492
514
|
const { since } = reticle_act({ ref: generateBtn, action: "click" })
|
|
493
|
-
reticle_assert({ timeout_ms: 15000, predicate: { allOf: [
|
|
515
|
+
reticle_assert({ timeout_ms: 15000, predicate: { kind: "allOf", predicates: [
|
|
494
516
|
{ kind: "net", method: "POST", urlContains: "/api/generate", status: 200, since },
|
|
495
517
|
{ kind: "element", query: { testid: "script-output" }, state: "visible" }
|
|
496
518
|
]}})
|
|
@@ -501,7 +523,7 @@ reticle_assert({ timeout_ms: 15000, predicate: { allOf: [
|
|
|
501
523
|
```jsonc
|
|
502
524
|
reticle_act({ ref: fileInput, action: "upload", args: { name: "pitch.mp4", type: "video/mp4" } })
|
|
503
525
|
const { since } = reticle_act({ ref: analyzeBtn, action: "click" })
|
|
504
|
-
reticle_assert({ timeout_ms: 15000, predicate: { allOf: [
|
|
526
|
+
reticle_assert({ timeout_ms: 15000, predicate: { kind: "allOf", predicates: [
|
|
505
527
|
{ kind: "net", method: "POST", urlContains: "/api/score", status: 200, since },
|
|
506
528
|
{ kind: "element", query: { role: "dialog", name: "Score result" }, state: "visible" },
|
|
507
529
|
{ kind: "text", contains: "/ 100", visible: true }
|
|
@@ -519,7 +541,7 @@ const after = reticle_inspect({ ref }).styles.backgroundColor
|
|
|
519
541
|
|
|
520
542
|
> Pure CSS `:hover` styling needs a real pointer; drive hover effects from JS state (or use a Playwright real-hover) if you need pixel-exact `:hover`. Reticle reads computed style after the JS state change.
|
|
521
543
|
|
|
522
|
-
### "Something off-DOM happened
|
|
544
|
+
### "Something off-DOM happened: a webhook arrived, a store changed"
|
|
523
545
|
|
|
524
546
|
Surface it from your app, then assert on it:
|
|
525
547
|
|
|
@@ -538,7 +560,7 @@ reticle.describe({
|
|
|
538
560
|
});
|
|
539
561
|
```
|
|
540
562
|
|
|
541
|
-
The agent reads this back with `reticle_capabilities()
|
|
563
|
+
The agent reads this back with `reticle_capabilities()`; see [§3](#3-tool-reference).
|
|
542
564
|
|
|
543
565
|
```jsonc
|
|
544
566
|
reticle_assert({ timeout_ms: 30000, predicate: {
|
|
@@ -547,7 +569,7 @@ reticle_assert({ timeout_ms: 30000, predicate: {
|
|
|
547
569
|
|
|
548
570
|
#### Keeping signals from drifting (lint)
|
|
549
571
|
|
|
550
|
-
Signals only help if you actually emit one whenever user-visible state changes. The `@reticlehq/eslint-plugin` package ships one rule, `reticle/require-signal-on-mutation`, that flags any function which calls a configured store **mutator** but never fires the **signal callee** in the same body
|
|
572
|
+
Signals only help if you actually emit one whenever user-visible state changes. The `@reticlehq/eslint-plugin` package ships one rule, `reticle/require-signal-on-mutation`, that flags any function which calls a configured store **mutator** but never fires the **signal callee** in the same body, so the signal map can't silently fall behind the store.
|
|
551
573
|
|
|
552
574
|
```js
|
|
553
575
|
// eslint.config.mjs
|
|
@@ -599,13 +621,13 @@ reticle_visual_diff({ baseline: "checkout-ok", masks: [{ x: 0, y: 0, width: 200,
|
|
|
599
621
|
// → { matched: false, changedPixels, ratio, region, diffPath } // 3. masks ignore volatile regions
|
|
600
622
|
```
|
|
601
623
|
|
|
602
|
-
Without all three, a pixel diff fails on a different window size, a mid-animation frame, or a live clock/avatar
|
|
624
|
+
Without all three, a pixel diff fails on a different window size, a mid-animation frame, or a live clock/avatar: the classic reasons teams give up on screenshot tests. With them, only a real visual change fails.
|
|
603
625
|
|
|
604
626
|
---
|
|
605
627
|
|
|
606
628
|
## 9. Recording a flow
|
|
607
629
|
|
|
608
|
-
Capture everything that happens across a span
|
|
630
|
+
Capture everything that happens across a span. Useful for "run my whole checkout flow and tell me what happened," or to keep a known-good trace.
|
|
609
631
|
|
|
610
632
|
```jsonc
|
|
611
633
|
reticle_record {action:"start"}({ recordingName: "checkout" })
|
|
@@ -647,7 +669,7 @@ The agent then acts on each ref, observes the reaction, and reports anomalies (f
|
|
|
647
669
|
|
|
648
670
|
## 11. Turning your test cases into agent checks
|
|
649
671
|
|
|
650
|
-
If you already have test cases
|
|
672
|
+
If you already have test cases (a QA checklist, acceptance criteria, a spreadsheet, manual steps), you can hand them to your agent and have it run + verify each against the live app. Each case becomes a predicate:
|
|
651
673
|
|
|
652
674
|
| Test case (English) | Reticle check |
|
|
653
675
|
| --- | --- |
|
|
@@ -662,7 +684,7 @@ A practical workflow:
|
|
|
662
684
|
|
|
663
685
|
> "Here are our 12 dashboard test cases. For each, drive the app with Reticle and tell me pass/fail with evidence. For any failure, show the source file to fix."
|
|
664
686
|
|
|
665
|
-
This is the sweet spot: the **manual cases you never automated** become things the agent runs in seconds, on every change. It **complements** your CI Playwright/Cypress suite (which gates releases)
|
|
687
|
+
This is the sweet spot: the **manual cases you never automated** become things the agent runs in seconds, on every change. It **complements** your CI Playwright/Cypress suite (which gates releases); Reticle is the in-loop checklist while you build.
|
|
666
688
|
|
|
667
689
|
---
|
|
668
690
|
|
|
@@ -680,7 +702,7 @@ Reticle is cheap by design ([benchmark](token-efficiency.md)), but keep it that
|
|
|
680
702
|
## 13. Best practices & gotchas
|
|
681
703
|
|
|
682
704
|
- **Accessibility = legibility.** Real `role`s, labels, and `data-testid`s make queries precise and stable. It's also just good a11y.
|
|
683
|
-
- **Stable handles for controls.** Prefer `data-testid` over names that include dynamic counts (e.g. "Notifications (3)")
|
|
705
|
+
- **Stable handles for controls.** Prefer `data-testid` over names that include dynamic counts (e.g. "Notifications (3)"); the count changes the accessible name.
|
|
684
706
|
- **Always thread `since`.** Pass the cursor from `reticle_act` into `observe`/`assert` so you only consider what happened _after_ the action.
|
|
685
707
|
- **Use `timeout_ms` for async.** Don't assert instantly on something that arrives over the network or after a re-render.
|
|
686
708
|
- **Watch `session.throttled` (F2).** Background tabs throttle timers/rAF/pointer gestures, so an act can silently no-op. Every `reticle_act` / `reticle_assert` / `reticle_act_and_wait` result carries `session: { lastSeenMs, throttled, focused }` and, when throttled, a `warning`. Refocus the tab (or run it foregrounded) before driving; pass `refuseWhenThrottled: true` to hard-fail instead.
|
|
@@ -691,15 +713,15 @@ Reticle is cheap by design ([benchmark](token-efficiency.md)), but keep it that
|
|
|
691
713
|
|
|
692
714
|
## 14. FAQ
|
|
693
715
|
|
|
694
|
-
**Does this run in production?** No
|
|
716
|
+
**Does this run in production?** No. Keep `reticle.connect()` behind a dev guard. The SDK is side-effect-free and tree-shakes out of prod builds.
|
|
695
717
|
|
|
696
718
|
**Do I have to change my components?** No, for basic look/act/observe. You'll get better results by adding `data-testid`s and labels where the agent needs precision.
|
|
697
719
|
|
|
698
|
-
**Does it work without React?** The core (DOM/network/route/console/animation/snapshot/actions) is framework-agnostic and is gated against a vanilla-TS app. React, Next.js, Remix and Astro each have an app and a CI gate. SvelteKit is wired end-to-end
|
|
720
|
+
**Does it work without React?** The core (DOM/network/route/console/animation/snapshot/actions) is framework-agnostic and is gated against a vanilla-TS app. React, Next.js, Remix and Astro each have an app and a CI gate. SvelteKit is wired end-to-end. `reticle init` writes the client hook and the Vite plugin, and the plugin stamps `data-reticle-source` into `.svelte` components so verdicts carry `file:line`. But there is still no SvelteKit app in CI, so it is unverified rather than supported. Vue has a Pinia store adapter and nothing else: no detection, no `.vue` stamping, no gate. See [what Svelte support is and is not](getting-started.md#what-svelte-support-is-and-what-it-is-not).
|
|
699
721
|
|
|
700
722
|
**Can it judge whether my UI _looks_ good?** No. Reticle verifies behavior, not aesthetics. Visual/pixel correctness and "does it feel right" remain human (or a visual-diff tool).
|
|
701
723
|
|
|
702
|
-
**Does it replace Playwright/Cypress?** No
|
|
724
|
+
**Does it replace Playwright/Cypress?** No. Those are your scripted CI suite. Reticle is for in-loop verification while the agent codes, and for the cases you never automated. They compose.
|
|
703
725
|
|
|
704
726
|
**How does it compare to Playwright MCP / Chrome DevTools MCP?** Those let an agent drive/ inspect a _separate_ browser; Reticle verifies your _own running app_ (real session/auth) with assertions + regression as first-class, far more cheaply. See the README comparison.
|
|
705
727
|
|
|
@@ -710,13 +732,13 @@ Reticle is cheap by design ([benchmark](token-efficiency.md)), but keep it that
|
|
|
710
732
|
## 15. Security & privacy
|
|
711
733
|
|
|
712
734
|
- **Dev-only, localhost-only by default.** The bridge binds `127.0.0.1`; the SDK is meant for dev builds.
|
|
713
|
-
- **No app data leaves your machine.** Baselines/recordings are local. The CLI sends anonymous, opt-out usage metrics only (random id + event names
|
|
714
|
-
- **Network bodies aren't captured by default
|
|
735
|
+
- **No app data leaves your machine.** Baselines/recordings are local. The CLI sends anonymous, opt-out usage metrics only (random id + event names, no code and no PII; see [telemetry](telemetry.md)); opt out with `reticle telemetry disable`, `RETICLE_TELEMETRY=0`, or `DO_NOT_TRACK=1`. Feedback you or your agent deliberately send (`reticle feedback` / `reticle_feedback`) is the only free text that ever leaves the machine: never passive, redacted first, and separately disabled with `RETICLE_FEEDBACK=0`.
|
|
736
|
+
- **Network bodies aren't captured by default:** only method/url/status/timing. Body capture is opt-in and runs through a redactor (drop `password`/`token`/`secret`/… + your patterns).
|
|
715
737
|
- **Additive & reversible.** Reticle patches `fetch`/History/console defensively and restores them on disconnect; it will not break the app under test.
|
|
716
738
|
|
|
717
739
|
### Extending the redaction rules
|
|
718
740
|
|
|
719
|
-
The built-in rule catches the credential names that are common across apps. Yours has its own vocabulary in both directions
|
|
741
|
+
The built-in rule catches the credential names that are common across apps. Yours has its own vocabulary in both directions (a `licenceKey` it has never heard of, and a `designToken` it redacts by mistake), so `connect()` takes a `redact` option:
|
|
720
742
|
|
|
721
743
|
```ts
|
|
722
744
|
reticle.connect({
|
|
@@ -727,17 +749,17 @@ reticle.connect({
|
|
|
727
749
|
});
|
|
728
750
|
```
|
|
729
751
|
|
|
730
|
-
- **`keys`** adds to the rule. A string matches a key name **exactly**, case-insensitively
|
|
731
|
-
- **`allow`** exempts a key from the **default** rule. It loses to `keys`: an explicit redact instruction beats an exemption. Exempting a key the default rule considers a credential prints a one-time warning naming it
|
|
752
|
+
- **`keys`** adds to the rule. A string matches a key name **exactly**, case-insensitively, so `'code'` does not redact `codeOwner`. A RegExp is tested against the key.
|
|
753
|
+
- **`allow`** exempts a key from the **default** rule. It loses to `keys`: an explicit redact instruction beats an exemption. Exempting a key the default rule considers a credential prints a one-time warning naming it, because that value now reaches the agent transcript and the on-disk journal in cleartext.
|
|
732
754
|
- **There is no way to replace the default set.** Both options are additive on purpose: a config that could turn the whole rule off would eventually ship in an app that leaks, and Reticle would be the thing that recorded it.
|
|
733
|
-
- **With no `redact` option, behaviour is exactly what it was before this option existed
|
|
755
|
+
- **With no `redact` option, behaviour is exactly what it was before this option existed**, pinned by a test that walks every credential name and every known false positive.
|
|
734
756
|
|
|
735
|
-
**What crosses the bridge, and why it matters.** Most captures pass through the SDK in your page. Request bodies and response headers on the **driven** path (`reticle drive`, or a CDP-attached browser) do not
|
|
757
|
+
**What crosses the bridge, and why it matters.** Most captures pass through the SDK in your page. Request bodies and response headers on the **driven** path (`reticle drive`, or a CDP-attached browser) do not: the daemon reads them straight from the network stack. So the literal strings in `keys` are announced to the daemon when your app connects, and it redacts them there too. Two parts deliberately stay in the page:
|
|
736
758
|
|
|
737
759
|
| | Applies in the page | Applies on the driven path |
|
|
738
760
|
| ----------------------- | :-----------------: | :------------------------: |
|
|
739
|
-
| `keys`
|
|
740
|
-
| `keys`
|
|
761
|
+
| `keys` (plain strings) | ✅ | ✅ |
|
|
762
|
+
| `keys` (RegExp entries) | ✅ | ❌ |
|
|
741
763
|
| `allow` | ✅ | ❌ |
|
|
742
764
|
|
|
743
765
|
A RegExp does not travel because compiling a pattern that arrived over a socket and running it against every key of every request body is a denial-of-service surface. `allow` does not travel because it is the only part of the config that **removes** redaction, and the driven path keeps the built-in floor rather than letting a page lower it. Both exclusions fail in the safe direction: the driven path can over-redact relative to your config, never under. **If a key must be redacted everywhere, name it as a plain string.**
|
|
@@ -746,7 +768,7 @@ A RegExp does not travel because compiling a pattern that arrived over a socket
|
|
|
746
768
|
|
|
747
769
|
## 16. Presenter mode, narration & fake clock (watch + control)
|
|
748
770
|
|
|
749
|
-
### Presenter mode
|
|
771
|
+
### Presenter mode: let a human watch the agent
|
|
750
772
|
|
|
751
773
|
Turn it on when connecting:
|
|
752
774
|
|
|
@@ -763,18 +785,18 @@ You get, in the page itself:
|
|
|
763
785
|
|
|
764
786
|
All presenter DOM uses `data-reticle-*` and is excluded from snapshots/observers, so it never pollutes what the agent sees. Use `setIgnoreSelectors([...])` to also hide your own dev widgets.
|
|
765
787
|
|
|
766
|
-
#### Session liveness
|
|
788
|
+
#### Session liveness: the HUD never gets stuck "running"
|
|
767
789
|
|
|
768
|
-
A session starts on the agent's first activity and must reliably end even when the agent misbehaves. Reticle is an MCP tool, so the agent (Claude) can crash, disconnect, or simply forget to call `reticle_session {action:"end"}
|
|
790
|
+
A session starts on the agent's first activity and must reliably end even when the agent misbehaves. Reticle is an MCP tool, so the agent (Claude) can crash, disconnect, or simply forget to call `reticle_session {action:"end"}`, and a backgrounded tab's own timers are throttled by the browser. So **the Node server owns liveness, not the browser tab:**
|
|
769
791
|
|
|
770
792
|
- **Agent goes idle / forgets to end** → a server-side reaper (immune to tab throttling) ends the session after `idleEndMs` of no agent commands and pushes the end to the browser. A backgrounded tab still receives that push, so you can switch windows and come back to a correctly-ended HUD.
|
|
771
793
|
- **Agent (MCP client) disconnects cleanly** → every active session ends at once.
|
|
772
794
|
- **Agent kills the Reticle server process** (so no push can arrive) → the SDK self-ends the session after it can't reach the bridge for `BRIDGE_LOST_MS` (~15s), showing "lost connection to Reticle."
|
|
773
795
|
- **Slow-but-alive agent** → if it goes quiet long enough to auto-end and then acts again, the session **revives** automatically (an explicit `reticle_session {action:"end"}` stays terminal).
|
|
774
796
|
|
|
775
|
-
Tune the idle window with `reticle_session({ idleEndMs })
|
|
797
|
+
Tune the idle window with `reticle_session({ idleEndMs })`; it updates both the browser timer and the server reaper. The human keeps the panel (with Copy/Export of the run) after any end.
|
|
776
798
|
|
|
777
|
-
### `reticle_session {action:"narrate"}
|
|
799
|
+
### `reticle_session {action:"narrate"}`: show the agent's intent
|
|
778
800
|
|
|
779
801
|
So the human sees _what the agent is about to do and why_:
|
|
780
802
|
|
|
@@ -782,16 +804,16 @@ So the human sees _what the agent is about to do and why_:
|
|
|
782
804
|
reticle_session {action:"narrate"}({ text: "Adding a beat, then checking the section count goes up" })
|
|
783
805
|
```
|
|
784
806
|
|
|
785
|
-
It renders on the HUD. (The agent's private reasoning isn't visible to Reticle
|
|
807
|
+
It renders on the HUD. (The agent's private reasoning isn't visible to Reticle; narration is how it surfaces intent on the page.)
|
|
786
808
|
|
|
787
|
-
### `reticle_clock
|
|
809
|
+
### `reticle_clock`: control time deterministically
|
|
788
810
|
|
|
789
811
|
Fast-forward toasts, debounces, auto-dismiss, and commit-on-blur without waiting:
|
|
790
812
|
|
|
791
813
|
```jsonc
|
|
792
814
|
reticle_clock({ freeze: true }) // freeze app timers (Date.now/setTimeout/setInterval)
|
|
793
815
|
reticle_act({ ref: e9, action: "click" })
|
|
794
|
-
reticle_clock({ advanceMs: 5000 }) // jump 5s
|
|
816
|
+
reticle_clock({ advanceMs: 5000 }) // jump 5s: the auto-dismiss fires now, deterministically
|
|
795
817
|
reticle_assert({ predicate: { kind: "element", query: { role: "alert" }, absent: true } })
|
|
796
818
|
reticle_clock({ reset: true }) // restore real timers
|
|
797
819
|
```
|
|
@@ -800,7 +822,7 @@ It does **not** freeze `requestAnimationFrame`/microtasks (React's scheduler kee
|
|
|
800
822
|
|
|
801
823
|
### Action refinements (from real-app use)
|
|
802
824
|
|
|
803
|
-
- **`blur`** now fires a bubbling `focusout`, so React's commit-on-blur (`onBlur`) runs
|
|
825
|
+
- **`blur`** now fires a bubbling `focusout`, so React's commit-on-blur (`onBlur`) runs, and inline editors and form fields commit. `fill`/`type` focus first so a later `blur` commits.
|
|
804
826
|
- **`hover`** accepts `{ holdMs }` to dwell, so timer-gated reveals mount; then `wait_for` the revealed nodes.
|
|
805
827
|
- **`drag`** yields a frame between phases (React flushes between steps) and accepts `{ data: { mime, value } }` for custom `dataTransfer` payloads.
|
|
806
828
|
|
|
@@ -821,7 +843,7 @@ On a failed signal assert, the result includes a **near-miss**: the signals that
|
|
|
821
843
|
|
|
822
844
|
## 17. Evidence-of-effect, act+await, state, capabilities, replay
|
|
823
845
|
|
|
824
|
-
These close the "is the action trusted?" gap
|
|
846
|
+
These close the "is the action trusted?" gap, so you can tell _my action missed_ vs _the app didn't react_ vs _the tool didn't dispatch_.
|
|
825
847
|
|
|
826
848
|
### `reticle_act` returns evidence-of-effect
|
|
827
849
|
|
|
@@ -834,11 +856,11 @@ Every `reticle_act` result now carries an `effect`:
|
|
|
834
856
|
focusMoved: "e11->e12"|null, valueChanged, domMutatedWithin } } }
|
|
835
857
|
```
|
|
836
858
|
|
|
837
|
-
`settled:false, settleReason:"timeout"` means the settle frame did not flush within the budget (a throttled/background tab)
|
|
859
|
+
`settled:false, settleReason:"timeout"` means the settle frame did not flush within the budget (a throttled/background tab). This is **not** a failure: the dispatch landed and the tool resolved.
|
|
838
860
|
|
|
839
861
|
Read it to disambiguate failures instantly: `targetMatched:false` = your ref was stale; `defaultPrevented:true` = a handler cancelled it; `domMutatedWithin:0` + `valueChanged:false` = the app didn't react.
|
|
840
862
|
|
|
841
|
-
### `reticle_act_and_wait
|
|
863
|
+
### `reticle_act_and_wait`: one hop for act → observe → assert
|
|
842
864
|
|
|
843
865
|
```jsonc
|
|
844
866
|
reticle_act_and_wait({ ref, action, args?, until: <predicate>, timeout_ms })
|
|
@@ -847,7 +869,7 @@ reticle_act_and_wait({ ref, action, args?, until: <predicate>, timeout_ms })
|
|
|
847
869
|
|
|
848
870
|
Performs the action (with settle so React commits land in the window), waits for `until`, and returns the action's effect + the verdict + the full causal trace. Collapses four calls into one.
|
|
849
871
|
|
|
850
|
-
### `reticle_state
|
|
872
|
+
### `reticle_state`: read live framework/store state
|
|
851
873
|
|
|
852
874
|
No need to broadcast a signal for every fact. Register stores in your app:
|
|
853
875
|
|
|
@@ -856,7 +878,7 @@ import { registerStore } from '@reticlehq/react';
|
|
|
856
878
|
registerStore('workspace', useWorkspace); // pass the store itself → auto STATE_CHANGE diffs
|
|
857
879
|
```
|
|
858
880
|
|
|
859
|
-
**Which state libraries work.** `registerStore` accepts anything shaped `{ getState, subscribe }`, so **zustand and Redux (and Redux Toolkit) need no adapter at all
|
|
881
|
+
**Which state libraries work.** `registerStore` accepts anything shaped `{ getState, subscribe }`, so **zustand and Redux (and Redux Toolkit) need no adapter at all**: pass the store. For everything else Reticle ships adapters, because the shape is the only thing missing:
|
|
860
882
|
|
|
861
883
|
```ts
|
|
862
884
|
import {
|
|
@@ -875,15 +897,15 @@ registerStore('app', jotaiStore(getDefaultStore(), { cart, user })); // Jotai (n
|
|
|
875
897
|
registerStore('machine', xstateStore(actor)); // XState
|
|
876
898
|
registerStore('app', valtioStore(state, snapshot, subscribe)); // Valtio
|
|
877
899
|
registerStore('app', mobxStore(store, toJS, reaction)); // MobX
|
|
878
|
-
registerStore('cart', svelteStore(cartStore)); // Svelte store
|
|
900
|
+
registerStore('cart', svelteStore(cartStore)); // Svelte store: `{ subscribe }` is the whole contract
|
|
879
901
|
registerStore('cart', piniaStore(useCartStore())); // Pinia (Vue)
|
|
880
902
|
```
|
|
881
903
|
|
|
882
904
|
**Svelte and Pinia** are the two whose adapters do something you would not guess from the shape.
|
|
883
905
|
|
|
884
|
-
A Svelte store has **no pull side at all
|
|
906
|
+
A Svelte store has **no pull side at all**: `{ subscribe }` is the entire contract, no `getState`. `svelteStore` reads the current value by subscribing, catching the synchronous first callback the store contract guarantees, and unsubscribing immediately (the same thing `svelte/store`'s own `get()` does), so it holds no lasting subscription and needs no teardown. It also _swallows_ that first callback on `subscribe`, because forwarding it would emit a state change at registration time for a change that never happened.
|
|
885
907
|
|
|
886
|
-
`piniaStore` subscribes with `detached: true` and `flush: 'sync'`. Without `detached`, a store registered from inside a component goes permanently silent after that component unmounts
|
|
908
|
+
`piniaStore` subscribes with `detached: true` and `flush: 'sync'`. Without `detached`, a store registered from inside a component goes permanently silent after that component unmounts: still readable, but never emitting another state change, which reads exactly like an app that stopped changing. Without `sync`, the notification lands a Vue tick late, outside the window that links a state change to the click that caused it. Note that `$state` carries state, not getters: a Pinia getter is derived, so asserting on the state it derives from is the stronger assertion anyway.
|
|
887
909
|
|
|
888
910
|
**Recoil** has no enumerable registry of live atoms and no per-atom subscription outside React, so it takes an atom map (like Jotai) plus the transaction stream from a small bridge component:
|
|
889
911
|
|
|
@@ -916,16 +938,16 @@ function ReticleRecoilBridge() {
|
|
|
916
938
|
|
|
917
939
|
Each atom comes back as `{ status, value, error }` rather than a bare value, because Recoil atoms can be async: calling `getValue()` on a pending selector **throws the pending promise**, which would lose the whole state read over one slow atom. A loading atom reports `status: 'loading'` instead of silently reading as empty.
|
|
918
940
|
|
|
919
|
-
**TanStack Query is worth registering even if you register nothing else.** Its cache holds the state most likely to be wrong in a way nothing else can observe: a stale value served as fresh, a mutation that never invalidated its query, an optimistic update never rolled back. None of those fire a network request, so a network log shows silence and the DOM shows a plausible number
|
|
941
|
+
**TanStack Query is worth registering even if you register nothing else.** Its cache holds the state most likely to be wrong in a way nothing else can observe: a stale value served as fresh, a mutation that never invalidated its query, an optimistic update never rolled back. None of those fire a network request, so a network log shows silence and the DOM shows a plausible number. The cache is the only witness. The adapter exposes `status`, `fetchStatus`, `isStale` and `dataUpdatedAt` per query key, so an agent can assert the stronger property: not "the number rendered is 42" but "the number rendered came from fresh data".
|
|
920
942
|
|
|
921
|
-
**React Context / `useState` / `useReducer`** have no store object to adapt
|
|
943
|
+
**React Context / `useState` / `useReducer`** have no store object to adapt: the value lives in the fiber tree and the only subscription is a re-render. Invert it with the hook:
|
|
922
944
|
|
|
923
945
|
```tsx
|
|
924
946
|
import { useReticleStore } from '@reticlehq/react/store';
|
|
925
947
|
|
|
926
948
|
function CartProvider({ children }) {
|
|
927
949
|
const [cart, dispatch] = useReducer(cartReducer, initial);
|
|
928
|
-
useReticleStore('cart', cart); // one line
|
|
950
|
+
useReticleStore('cart', cart); // one line, and the agent can now read and assert on cart
|
|
929
951
|
return <CartContext.Provider value={cart}>{children}</CartContext.Provider>;
|
|
930
952
|
}
|
|
931
953
|
```
|
|
@@ -933,8 +955,8 @@ function CartProvider({ children }) {
|
|
|
933
955
|
```jsonc
|
|
934
956
|
reticle_state({ store: "workspace" }) // → { stores: { workspace: {…} } }
|
|
935
957
|
reticle_state({ ref: "e9" }) // → { component: { ok: true, component, hooks } } or { component: { ok: false, reason: "component-state-unavailable" } }
|
|
936
|
-
// `hooks` carries the hook VALUES only (state / ref / memo). React effect entries
|
|
937
|
-
// null-filled fiber internals with nothing to act on
|
|
958
|
+
// `hooks` carries the hook VALUES only (state / ref / memo). React effect entries (chained,
|
|
959
|
+
// null-filled fiber internals with nothing to act on) are dropped, and when any were, the read
|
|
938
960
|
// says so: component.truncation = { droppedItems, note }.
|
|
939
961
|
|
|
940
962
|
// Scope a large store instead of paying for the whole thing:
|
|
@@ -943,11 +965,11 @@ reticle_state({ store: "workspace", depth: 1 }) // → top-level
|
|
|
943
965
|
reticle_state({ store: "workspace", path: "nope" }) // → { found: false, availableKeys: ["captionCache", "version", …] }
|
|
944
966
|
```
|
|
945
967
|
|
|
946
|
-
Store reads are the reliable path; ref reads degrade to a structured failure rather than blocking. `path` (dot-path, numeric segments index arrays) and `depth` keep a 60KB store from becoming a token tax
|
|
968
|
+
Store reads are the reliable path; ref reads degrade to a structured failure rather than blocking. `path` (dot-path, numeric segments index arrays) and `depth` keep a 60KB store from becoming a token tax, and a wrong `path` returns the keys that _were_ there, so it's self-correcting.
|
|
947
969
|
|
|
948
|
-
### Charts and dashboards
|
|
970
|
+
### Charts and dashboards: geometry faults report themselves
|
|
949
971
|
|
|
950
|
-
Every dashboard widget except one renders text a comparison can read: a KPI card renders a number, a table renders rows. A **chart renders geometry**
|
|
972
|
+
Every dashboard widget except one renders text a comparison can read: a KPI card renders a number, a table renders rows. A **chart renders geometry** (the data has been through a scale function into coordinates), and a perfectly correct `series` in the store can still become a blank, flat, or NaN-filled path. Neither a state read nor a screenshot-vs-baseline catches that.
|
|
951
973
|
|
|
952
974
|
So any element descriptor containing faulty plot geometry carries a `chart` field. There is no extra tool call and no flag: query the chart the way you already would, and a broken one tells you.
|
|
953
975
|
|
|
@@ -958,7 +980,7 @@ reticle_query({ by: "testid", value: "revenue-chart" })
|
|
|
958
980
|
// sample: "0,10 5,NaN 10,20" }] }] }
|
|
959
981
|
```
|
|
960
982
|
|
|
961
|
-
`kind` is one of `non-finite-coordinates` (a zero-range scale divided by zero
|
|
983
|
+
`kind` is one of `non-finite-coordinates` (a zero-range scale divided by zero, always a bug), `empty-geometry` (the chart mounted but no data reached it), or `degenerate-geometry` (every point identical). A **healthy chart adds no field at all**, so this costs nothing on the common path. A genuinely flat line (constant data) is not flagged.
|
|
962
984
|
|
|
963
985
|
**Canvas charts** (Chart.js, ECharts) are pixels, not DOM, so nothing above applies. Read their data directly instead, which is the only route short of vision:
|
|
964
986
|
|
|
@@ -967,7 +989,7 @@ import { canvasChartData } from '@reticlehq/browser';
|
|
|
967
989
|
canvasChartData(canvasEl, window); // → { library: "chartjs", data: { datasets: [...] } }
|
|
968
990
|
```
|
|
969
991
|
|
|
970
|
-
### `reticle_capabilities
|
|
992
|
+
### `reticle_capabilities`: the app's testable surface
|
|
971
993
|
|
|
972
994
|
Declare it once so the agent learns the surface without reading source:
|
|
973
995
|
|
|
@@ -980,40 +1002,40 @@ registerCapabilities({ testids: [...], signals: [...], stores: [...], flows: [..
|
|
|
980
1002
|
reticle_capabilities() // → { testids, signals, stores, flows }
|
|
981
1003
|
```
|
|
982
1004
|
|
|
983
|
-
### `reticle_replay
|
|
1005
|
+
### `reticle_replay`: recordings become re-runnable programs
|
|
984
1006
|
|
|
985
|
-
`reticle_record {action:"start"}` → drive the flow → `reticle_record {action:"stop"}` returns a **compiled program** (steps bound to testids/signals, not volatile refs). `reticle_replay({ recordingName })` re-executes it
|
|
1007
|
+
`reticle_record {action:"start"}` → drive the flow → `reticle_record {action:"stop"}` returns a **compiled program** (steps bound to testids/signals, not volatile refs). `reticle_replay({ recordingName })` re-executes it, so your flow becomes a deterministic regression run, not a checklist.
|
|
986
1008
|
|
|
987
1009
|
---
|
|
988
1010
|
|
|
989
|
-
## 18. Real input mode
|
|
1011
|
+
## 18. Real input mode: native hover & drag
|
|
990
1012
|
|
|
991
|
-
Reticle drives actions by dispatching JS events from inside the page. That covers click, fill, type, select, submit, press, and HTML5 drag
|
|
1013
|
+
Reticle drives actions by dispatching JS events from inside the page. That covers click, fill, type, select, submit, press, and HTML5 drag, but it **cannot** trigger browser-native pointer behavior: `onMouseEnter`/`onMouseLeave`, hover-gated reveals, and pointer-library drags rely on the browser's real hit-testing, which synthetic events don't drive.
|
|
992
1014
|
|
|
993
|
-
**Clicks are synthetic by default
|
|
1015
|
+
**Clicks are synthetic by default, on purpose.** Even with real input configured, `click`/`dblclick` run the occlusion-honest synthetic path (full `pointerdown→…→click` sequence + a `occluded` hit-test + off-viewport auto-scroll), reporting `inputModeReason:"synthetic-click-preferred"`. There's no coordinate gesture for the presenter HUD to intercept or to miss off-screen, and synthetic dispatch reaches the resolved element directly. Reserve native clicks for the rare `isTrusted`-gated case (native file picker, clipboard) with `args:{ native:true }`. Real input remains the path for `hover`/`drag`, which genuinely need the browser's hit-testing. Every `reticle_act` result tells you which path ran:
|
|
994
1016
|
|
|
995
1017
|
```jsonc
|
|
996
1018
|
{ since, dispatched, settled, inputMode: "synthetic" | "real", inputModeReason?, result, session, warning? }
|
|
997
1019
|
```
|
|
998
1020
|
|
|
999
|
-
When `inputMode` is `"synthetic"` and the target has hover/enter handlers, the result carries a `warning` so you know a hover may be a no-op
|
|
1021
|
+
When `inputMode` is `"synthetic"` and the target has hover/enter handlers, the result carries a `warning` so you know a hover may be a no-op. You never have to reverse-engineer it.
|
|
1000
1022
|
|
|
1001
|
-
**`inputModeReason`
|
|
1023
|
+
**`inputModeReason` is never a silent fallback.** When real input **is** configured but a pointer act still ran synthetic, the result says _why_, so per-element inconsistency is diagnosable instead of mysterious:
|
|
1002
1024
|
|
|
1003
1025
|
| `inputModeReason` | meaning / fix |
|
|
1004
1026
|
| --- | --- |
|
|
1005
|
-
| `page-not-correlated-to-a-cdp-target` | no CDP page matches the session URL
|
|
1006
|
-
| `element-not-locatable` | the element had no box (off-screen / stale ref)
|
|
1027
|
+
| `page-not-correlated-to-a-cdp-target` | no CDP page matches the session URL, usually a fresh tab or a CDP target that isn't this page |
|
|
1028
|
+
| `element-not-locatable` | the element had no box (off-screen / stale ref); `scrollIntoView` first |
|
|
1007
1029
|
| `drag-target-unresolved` | a drag's `toRef` was missing or not locatable |
|
|
1008
1030
|
| `provider-declined` / `provider-error` | the CDP provider declined or threw (the latter also sets `warning`) |
|
|
1009
|
-
| `not-a-pointer-action` | `fill`/`type`/etc.
|
|
1010
|
-
| `synthetic-click-preferred` | a `click`/`dblclick` ran the occlusion-honest synthetic path by default
|
|
1031
|
+
| `not-a-pointer-action` | `fill`/`type`/etc. are always synthetic by design |
|
|
1032
|
+
| `synthetic-click-preferred` | a `click`/`dblclick` ran the occlusion-honest synthetic path by default; pass `args:{ native:true }` to force a trusted native click |
|
|
1011
1033
|
|
|
1012
|
-
(No `inputModeReason` is set when real input simply isn't configured
|
|
1034
|
+
(No `inputModeReason` is set when real input simply isn't configured; synthetic is the expected default there.)
|
|
1013
1035
|
|
|
1014
1036
|
### Enable real input (optional, opt-in)
|
|
1015
1037
|
|
|
1016
|
-
Point Reticle's server at a Chrome DevTools (CDP) endpoint; it then drives **real** pointer input (via Playwright `connectOverCDP`) at the element's box for `hover`/`drag` (and for `click`/`dblclick` only when you pass `args:{ native:true }
|
|
1038
|
+
Point Reticle's server at a Chrome DevTools (CDP) endpoint; it then drives **real** pointer input (via Playwright `connectOverCDP`) at the element's box for `hover`/`drag` (and for `click`/`dblclick` only when you pass `args:{ native:true }`, since clicks default to synthetic), and reports `inputMode: "real"`.
|
|
1017
1039
|
|
|
1018
1040
|
1. Launch your browser with remote debugging:
|
|
1019
1041
|
|
|
@@ -1037,10 +1059,10 @@ Point Reticle's server at a Chrome DevTools (CDP) endpoint; it then drives **rea
|
|
|
1037
1059
|
}
|
|
1038
1060
|
```
|
|
1039
1061
|
|
|
1040
|
-
That's it. Reticle correlates the CDP page to your SDK session by URL; pointer actions now fire native hover/enter so hover-gated suggestion panels, tooltips, and pointer-based drag become drivable. Everything else is unchanged, and with no `RETICLE_CDP_URL` set, Reticle stays in the synthetic (zero-dependency, in-page) mode
|
|
1062
|
+
That's it. Reticle correlates the CDP page to your SDK session by URL; pointer actions now fire native hover/enter so hover-gated suggestion panels, tooltips, and pointer-based drag become drivable. Everything else is unchanged, and with no `RETICLE_CDP_URL` set, Reticle stays in the synthetic (zero-dependency, in-page) mode. Playwright is an optional dependency loaded only when you opt in.
|
|
1041
1063
|
|
|
1042
|
-
> **SPA navigation is handled.** The URL correlation tracks client-side route changes (`pushState`/`replaceState`/`popstate`), so real input keeps working after your app navigates into a sub-route
|
|
1064
|
+
> **SPA navigation is handled.** The URL correlation tracks client-side route changes (`pushState`/`replaceState`/`popstate`), so real input keeps working after your app navigates into a sub-route, e.g. the hover/quick-edit cluster on a `/workspace` view stays drivable. (If you see `inputModeReason:"page-not-correlated-to-a-cdp-target"`, the reported session URL isn't correlated to a CDP target and real input silently falls back to synthetic.)
|
|
1043
1065
|
|
|
1044
1066
|
> **Watching the agent (presenter).** With `present: true` the activity border now glows once while the agent is busy and fades when idle (no per-action strobe); the HUD sits **bottom-center**, shows a **READING** vs **ACTING** chip so you can tell observation from action at a glance, and `reticle_session {action:"narrate"}` lines are **queued** with a minimum on-screen dwell so none flash by unread.
|
|
1045
1067
|
|
|
1046
|
-
> **Limitation
|
|
1068
|
+
> **Limitation: un-scriptable tabs.** Reticle observes/drives a tab through the in-page SDK + (optionally) CDP; it **cannot bring to front or recover a browser tab the OS won't let it script** (e.g. a backgrounded or non-default-browser tab reporting `hidden:true`/`throttled:true`). When that happens, `reticle_sessions` and every act/assert result carry a `session.recommendation` saying so and pointing to `reticle drive <url>` for a guaranteed scriptable context. Refocus the tab, or use `reticle drive`.
|