@reticlehq/core 1.3.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/LICENSE ADDED
@@ -0,0 +1,113 @@
1
+ NOTE: @reticlehq/core is an umbrella package that bundles other Reticle packages.
2
+ The embeddable SDK packages it re-exports are Apache-2.0; the server it
3
+ includes is under the Functional Source License below, which is the most
4
+ restrictive term and therefore governs the bundle. See the root LICENSE for
5
+ the full per-package breakdown.
6
+
7
+ ----
8
+
9
+ # Functional Source License, Version 1.1, ALv2 Future License
10
+
11
+ ## Abbreviation
12
+
13
+ FSL-1.1-ALv2
14
+
15
+ ## Notice
16
+
17
+ Copyright 2026 Reticle Labs
18
+
19
+ ## Terms and Conditions
20
+
21
+ ### Licensor ("We")
22
+
23
+ The party offering the Software under these Terms and Conditions.
24
+
25
+ ### The Software
26
+
27
+ The "Software" is each version of the software that we make available under
28
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
29
+ Conditions with the Software.
30
+
31
+ ### License Grant
32
+
33
+ Subject to your compliance with this License Grant and the Patents,
34
+ Redistribution and Trademark clauses below, we hereby grant you the right to
35
+ use, copy, modify, create derivative works, publicly perform, publicly display
36
+ and redistribute the Software for any Permitted Purpose identified below.
37
+
38
+ ### Permitted Purpose
39
+
40
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
41
+ means making the Software available to others in a commercial product or
42
+ service that:
43
+
44
+ 1. substitutes for the Software;
45
+
46
+ 2. substitutes for any other product or service we offer using the Software
47
+ that exists as of the date we make the Software available; or
48
+
49
+ 3. offers the same or substantially similar functionality as the Software.
50
+
51
+ Permitted Purposes specifically include using the Software:
52
+
53
+ 1. for your internal use and access;
54
+
55
+ 2. for non-commercial education;
56
+
57
+ 3. for non-commercial research; and
58
+
59
+ 4. in connection with professional services that you provide to a licensee
60
+ using the Software in accordance with these Terms and Conditions.
61
+
62
+ ### Patents
63
+
64
+ To the extent your use for a Permitted Purpose would necessarily infringe our
65
+ patents, the license grant above includes a license under our patents. If you
66
+ make a claim against any party that the Software infringes or contributes to
67
+ the infringement of any patent, then your patent license to the Software ends
68
+ immediately.
69
+
70
+ ### Redistribution
71
+
72
+ The Terms and Conditions apply to all copies, modifications and derivatives of
73
+ the Software.
74
+
75
+ If you redistribute any copies, modifications or derivatives of the Software,
76
+ you must include a copy of or a link to these Terms and Conditions and not
77
+ remove any copyright notices provided in or with the Software.
78
+
79
+ ### Disclaimer
80
+
81
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
82
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
83
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
84
+
85
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
86
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
87
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
88
+
89
+ ### Trademarks
90
+
91
+ Except for displaying the License Details and identifying us as the origin of
92
+ the Software, you have no right under these Terms and Conditions to use our
93
+ trademarks, trade names, service marks or product names.
94
+
95
+ ## Grant of Future License
96
+
97
+ We hereby irrevocably grant you an additional license to use the Software under
98
+ the Apache License, Version 2.0 that is effective on the second anniversary of
99
+ the date we make the Software available. On or after that date, you may use the
100
+ Software under the Apache License, Version 2.0, in which case the following
101
+ will apply:
102
+
103
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
104
+ this file except in compliance with the License.
105
+
106
+ You may obtain a copy of the License at
107
+
108
+ http://www.apache.org/licenses/LICENSE-2.0
109
+
110
+ Unless required by applicable law or agreed to in writing, software distributed
111
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
112
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
113
+ specific language governing permissions and limitations under the License.
package/README.md ADDED
@@ -0,0 +1,97 @@
1
+ <div align="center">
2
+
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="https://cdn.jsdelivr.net/gh/reticlehq/reticle@main/assets/readme/lockup-on-dark.png" />
5
+ <img alt="Reticle — the proof layer for AI agents" src="https://cdn.jsdelivr.net/gh/reticlehq/reticle@main/assets/readme/lockup-on-light.png" width="300" />
6
+ </picture>
7
+
8
+ ### Your AI writes the code. Reticle tells it whether the code actually works — with evidence, not screenshots.
9
+
10
+ <a href="https://github.com/reticlehq/reticle"><img src="https://cdn.jsdelivr.net/gh/reticlehq/reticle@main/assets/readme/hero.gif" alt="Reticle catches a 401 your agent said was 'done' — pass:false with evidence, then a one-line fix to pass:true" width="760" /></a>
11
+
12
+ [![npm](https://img.shields.io/npm/v/@reticlehq/core?color=8b7bff&labelColor=15131f&logo=npm)](https://www.npmjs.com/package/@reticlehq/core) [![downloads](https://img.shields.io/npm/dm/@reticlehq/core?color=5fd9f5&labelColor=15131f)](https://www.npmjs.com/package/@reticlehq/core) [![license](https://img.shields.io/badge/license-Apache--2.0%20%2B%20FSL-46d6a0?labelColor=15131f)](https://github.com/reticlehq/reticle/blob/main/LICENSE)
13
+
14
+ **TypeScript · Model Context Protocol · React-first · dev-only · localhost-only · open-core (Apache-2.0 SDK + FSL server)**
15
+
16
+ [Docs & full README](https://github.com/reticlehq/reticle) · [Getting Started](https://github.com/reticlehq/reticle/blob/main/docs/getting-started.md) · [Why it's ~73× cheaper](https://github.com/reticlehq/reticle/blob/main/docs/token-efficiency.md)
17
+
18
+ </div>
19
+
20
+ ---
21
+
22
+ ## The problem: your agent has hands, but no eyes
23
+
24
+ You ask your AI agent to build a feature. It edits the files, says _"done ✅"_ — and then **you** open the browser, click around, and find out it isn't. Every. Single. Time. The agent can't really check its own work, so you become its QA department. Screenshots are bad eyes: ~1,500+ tokens through a vision model, slow, non-deterministic, and **blind to everything non-visual** — the failed request, the console error, the route that didn't change, the webhook that never came.
25
+
26
+ ## The idea: your app already knows what happened — let the agent ask
27
+
28
+ Reticle exposes your running app to your agent over **MCP** as a tight loop — **look → act → observe → assert** — and one call checks many things at once and comes back with proof:
29
+
30
+ ```jsonc
31
+ // The agent clicked "Pay". Did the right things actually happen? One call, ~33 tokens, no screenshot:
32
+ reticle_assert({
33
+ predicate: { allOf: [
34
+ { kind: "net", method: "POST", urlContains: "/api/order", status: 200 },
35
+ { kind: "element", query: { role: "dialog", name: "Order confirmed" }, state: "visible" },
36
+ { kind: "signal", name: "order:saved" }, // the charge actually committed
37
+ { kind: "console", level: "error", absent: true } // ...and nothing errored
38
+ ]}
39
+ })
40
+ // → { pass: false, evidence: { net: { status: 500, url: "/api/order" } },
41
+ // failureReason: "POST /api/order returned 500, expected 200",
42
+ // source: { file: "src/checkout/PayButton.tsx", line: 42 } } ❌ caught before you ever saw it
43
+ ```
44
+
45
+ Deterministic (structured events, not pixels), cheap (any model, no vision), and it points at the **file:line** to fix.
46
+
47
+ ## Quickstart
48
+
49
+ **One install** — SDK, React adapter, source-mapping plugins, spec runner, and the MCP server all ship in a single package:
50
+
51
+ ```bash
52
+ npm i -D @reticlehq/core
53
+ ```
54
+
55
+ **1. Point your agent at the MCP server** (Claude Code `.mcp.json`, Cursor, Windsurf, …):
56
+
57
+ ```jsonc
58
+ { "mcpServers": { "reticle": { "command": "npx", "args": ["@reticlehq/core"] } } }
59
+ ```
60
+
61
+ **2. Embed the SDK in your app (dev only):**
62
+
63
+ ```ts
64
+ import { reticle } from '@reticlehq/core';
65
+ if (import.meta.env.DEV) reticle.connect({ session: 'my-app' });
66
+ ```
67
+
68
+ Run your app and ask your agent: _"add a logout button and verify it works with Reticle."_ → [Full Getting Started walkthrough](https://github.com/reticlehq/reticle/blob/main/docs/getting-started.md).
69
+
70
+ ## What it can verify
71
+
72
+ API calls (`net`) · DOM changes · SPA navigation · console & errors (incl. "**no** errors") · animations · app **signals** (webhooks, store commits, async jobs you surface via `reticle.signal()`) · **regressions** (baseline now, diff later) · **source mapping** (DOM → React component → file:line). Plus an autonomous crawler. ~44 MCP tools in total.
73
+
74
+ ## ~73× fewer tokens than feeding the agent the whole page
75
+
76
+ | | Tokens per step |
77
+ | ------------------------------------------------------ | --------------: |
78
+ | Full accessibility-tree snapshot (e.g. Playwright MCP) | ~7,300 |
79
+ | **Reticle verify loop** (query + observe + assert) | **~100** |
80
+
81
+ The honest version: force Reticle to dump the whole tree too and the gap is only ~1.8×. The 73× comes from **not needing the whole tree** — that's architectural. [Full methodology + caveats →](https://github.com/reticlehq/reticle/blob/main/docs/token-efficiency.md)
82
+
83
+ ## Benchmarked two ways — a toy app and a real one — both published
84
+
85
+ <img src="https://cdn.jsdelivr.net/gh/reticlehq/reticle@main/assets/readme/bench-two-apps.png" alt="On a controlled app Reticle has the highest Verification Efficiency (12.3 vs 10.6 vs 7.0); on a real production dashboard Reticle is the cheapest to observe (1,023 vs 1,357 vs 2,193 tokens)" width="820" />
86
+
87
+ On a real production app (the [Reticle](https://reticle.ai) dashboard — React 19, auth, live data), Reticle observed the authenticated app for **1,023 tokens vs Chrome DevTools MCP 1,357 vs Playwright MCP 2,193 (2.1× leaner)** — and was the **only** tool that could assert login actually succeeded from the app's own signal (46 tok, un-fakeable) and read program state the DOM never shows. On the first uninstrumented pass it even caught two live `500`s the page completely hid (a missing DB migration). Full honest breakdown, including where Reticle **loses** (true pixels, sites you don't own): [`docs/benchmarks.md`](https://github.com/reticlehq/reticle/blob/main/docs/benchmarks.md).
88
+
89
+ ## How is this different?
90
+
91
+ Everyone now gives agents _eyes_; **Reticle gives agents a _verdict_.** Playwright/Cypress are scripted CI tests you write and maintain. Playwright MCP / Chrome DevTools MCP let an agent _drive_ a separate browser (token-heavy snapshots, no first-class assert/regression/source-map). Reticle runs _inside_ your real running app (your session/auth), returns a verdict-with-evidence in ~100 tokens, sees what screenshots can't, catches silent regressions, and points at the file to fix. **They compose: drive with Playwright MCP, verify with Reticle.**
92
+
93
+ ---
94
+
95
+ dev-only and localhost-only by default · no telemetry · tree-shaken out of production · open-core (Apache-2.0 SDK + FSL server)
96
+
97
+ **[→ Full documentation on GitHub](https://github.com/reticlehq/reticle)**
@@ -0,0 +1,7 @@
1
+ export { SOURCE_ATTR, default } from '@reticlehq/babel-plugin';
2
+ import '@reticlehq/eslint-plugin';
3
+ import '@reticlehq/browser';
4
+ import '@reticlehq/react';
5
+ import '@reticlehq/server';
6
+ import '@reticlehq/test';
7
+ import '@reticlehq/vite-plugin';
package/dist/babel.js ADDED
@@ -0,0 +1,32 @@
1
+ // ../babel-plugin/dist/index.js
2
+ import { relative } from "path";
3
+ var SOURCE_ATTR = "data-reticle-source";
4
+ function reticleSourcePlugin({ types: t }) {
5
+ return {
6
+ name: "reticle-source",
7
+ visitor: {
8
+ JSXOpeningElement(path, state) {
9
+ const node = path.node;
10
+ if (node.name.type !== "JSXIdentifier")
11
+ return;
12
+ const first = node.name.name[0];
13
+ if (first === void 0 || first !== first.toLowerCase())
14
+ return;
15
+ const alreadyStamped = node.attributes.some((attr) => attr.type === "JSXAttribute" && attr.name.type === "JSXIdentifier" && attr.name.name === SOURCE_ATTR);
16
+ if (alreadyStamped)
17
+ return;
18
+ const loc = node.loc;
19
+ if (loc === null || loc === void 0)
20
+ return;
21
+ const filename = state.filename ?? "unknown";
22
+ const rel = relative(process.cwd(), filename);
23
+ const value = `${rel}:${String(loc.start.line)}:${String(loc.start.column)}`;
24
+ node.attributes.push(t.jsxAttribute(t.jsxIdentifier(SOURCE_ATTR), t.stringLiteral(value)));
25
+ }
26
+ }
27
+ };
28
+ }
29
+ export {
30
+ SOURCE_ATTR,
31
+ reticleSourcePlugin as default
32
+ };
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node