@syrin/iris 0.4.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 +21 -0
- package/README.md +110 -0
- package/dist/babel.d.ts +14 -0
- package/dist/babel.js +32 -0
- package/dist/cli.d.ts +17 -0
- package/dist/cli.js +5160 -0
- package/dist/eslint.d.ts +22 -0
- package/dist/eslint.js +134 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +3984 -0
- package/dist/next.d.ts +4 -0
- package/dist/next.js +64 -0
- package/dist/server.d.ts +59 -0
- package/dist/server.js +5174 -0
- package/dist/test.d.ts +16 -0
- package/dist/test.js +5798 -0
- package/package.json +93 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Iris contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://cdn.jsdelivr.net/gh/syrin-labs/iris@main/assets/readme/lockup-on-dark.png" />
|
|
5
|
+
<img alt="Syrin Iris — eyes for your coding agent" src="https://cdn.jsdelivr.net/gh/syrin-labs/iris@main/assets/readme/lockup-on-light.png" width="300" />
|
|
6
|
+
</picture>
|
|
7
|
+
|
|
8
|
+
### Your AI writes the code. Iris tells it whether the code actually works — with evidence, not screenshots.
|
|
9
|
+
|
|
10
|
+
<a href="https://github.com/syrin-labs/iris"><img src="https://cdn.jsdelivr.net/gh/syrin-labs/iris@main/assets/readme/hero.gif" alt="Iris 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
|
+
[](https://www.npmjs.com/package/@syrin/iris)
|
|
13
|
+
[](https://www.npmjs.com/package/@syrin/iris)
|
|
14
|
+
[](https://github.com/syrin-labs/iris/blob/main/LICENSE)
|
|
15
|
+
|
|
16
|
+
**TypeScript · Model Context Protocol · React-first · dev-only · localhost-only · MIT**
|
|
17
|
+
|
|
18
|
+
[Docs & full README](https://github.com/syrin-labs/iris) · [Getting Started](https://github.com/syrin-labs/iris/blob/main/docs/getting-started.md) · [Why it's ~73× cheaper](https://github.com/syrin-labs/iris/blob/main/docs/token-efficiency.md)
|
|
19
|
+
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## The problem: your agent has hands, but no eyes
|
|
25
|
+
|
|
26
|
+
You ask your AI agent to build a feature. It edits the files, says _"done ✅"_ — and then **you** open the
|
|
27
|
+
browser, click around, and find out it isn't. Every. Single. Time. The agent can't really check its own
|
|
28
|
+
work, so you become its QA department. Screenshots are bad eyes: ~1,500+ tokens through a vision model,
|
|
29
|
+
slow, non-deterministic, and **blind to everything non-visual** — the failed request, the console error,
|
|
30
|
+
the route that didn't change, the webhook that never came.
|
|
31
|
+
|
|
32
|
+
## The idea: your app already knows what happened — let the agent ask
|
|
33
|
+
|
|
34
|
+
Iris exposes your running app to your agent over **MCP** as a tight loop — **look → act → observe →
|
|
35
|
+
assert** — and one call checks many things at once and comes back with proof:
|
|
36
|
+
|
|
37
|
+
```jsonc
|
|
38
|
+
// The agent clicked "Pay". Did the right things actually happen? One call, ~33 tokens, no screenshot:
|
|
39
|
+
iris_assert({
|
|
40
|
+
predicate: { allOf: [
|
|
41
|
+
{ kind: "net", method: "POST", urlContains: "/api/order", status: 200 },
|
|
42
|
+
{ kind: "element", query: { role: "dialog", name: "Order confirmed" }, state: "visible" },
|
|
43
|
+
{ kind: "signal", name: "order:saved" }, // the charge actually committed
|
|
44
|
+
{ kind: "console", level: "error", absent: true } // ...and nothing errored
|
|
45
|
+
]}
|
|
46
|
+
})
|
|
47
|
+
// → { pass: false, evidence: { net: { status: 500, url: "/api/order" } },
|
|
48
|
+
// failureReason: "POST /api/order returned 500, expected 200",
|
|
49
|
+
// source: { file: "src/checkout/PayButton.tsx", line: 42 } } ❌ caught before you ever saw it
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Deterministic (structured events, not pixels), cheap (any model, no vision), and it points at the **file:line** to fix.
|
|
53
|
+
|
|
54
|
+
## Quickstart
|
|
55
|
+
|
|
56
|
+
**One install** — SDK, React adapter, source-mapping plugins, spec runner, and the MCP server all ship in
|
|
57
|
+
a single package:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm i -D @syrin/iris
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**1. Point your agent at the MCP server** (Claude Code `.mcp.json`, Cursor, Windsurf, …):
|
|
64
|
+
|
|
65
|
+
```jsonc
|
|
66
|
+
{ "mcpServers": { "iris": { "command": "npx", "args": ["@syrin/iris"] } } }
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**2. Embed the SDK in your app (dev only):**
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
import { iris } from '@syrin/iris';
|
|
73
|
+
if (import.meta.env.DEV) iris.connect({ session: 'my-app' });
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Run your app and ask your agent: _"add a logout button and verify it works with Iris."_
|
|
77
|
+
→ [Full Getting Started walkthrough](https://github.com/syrin-labs/iris/blob/main/docs/getting-started.md).
|
|
78
|
+
|
|
79
|
+
## What it can verify
|
|
80
|
+
|
|
81
|
+
API calls (`net`) · DOM changes · SPA navigation · console & errors (incl. "**no** errors") · animations ·
|
|
82
|
+
app **signals** (webhooks, store commits, async jobs you surface via `iris.signal()`) · **regressions**
|
|
83
|
+
(baseline now, diff later) · **source mapping** (DOM → React component → file:line). Plus an autonomous
|
|
84
|
+
crawler. ~44 MCP tools in total.
|
|
85
|
+
|
|
86
|
+
## ~73× fewer tokens than feeding the agent the whole page
|
|
87
|
+
|
|
88
|
+
| | Tokens per step |
|
|
89
|
+
| ------------------------------------------------------ | --------------: |
|
|
90
|
+
| Full accessibility-tree snapshot (e.g. Playwright MCP) | ~7,300 |
|
|
91
|
+
| **Iris verify loop** (query + observe + assert) | **~100** |
|
|
92
|
+
|
|
93
|
+
The honest version: force Iris to dump the whole tree too and the gap is only ~1.8×. The 73× comes from
|
|
94
|
+
**not needing the whole tree** — that's architectural.
|
|
95
|
+
[Full methodology + caveats →](https://github.com/syrin-labs/iris/blob/main/docs/token-efficiency.md)
|
|
96
|
+
|
|
97
|
+
## How is this different?
|
|
98
|
+
|
|
99
|
+
Everyone now gives agents _eyes_; **Iris gives agents a _verdict_.** Playwright/Cypress are scripted CI
|
|
100
|
+
tests you write and maintain. Playwright MCP / Chrome DevTools MCP let an agent _drive_ a separate browser
|
|
101
|
+
(token-heavy snapshots, no first-class assert/regression/source-map). Iris runs _inside_ your real running
|
|
102
|
+
app (your session/auth), returns a verdict-with-evidence in ~100 tokens, sees what screenshots can't,
|
|
103
|
+
catches silent regressions, and points at the file to fix. **They compose: drive with Playwright MCP,
|
|
104
|
+
verify with Iris.**
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
dev-only and localhost-only by default · no telemetry · tree-shaken out of production · MIT
|
|
109
|
+
|
|
110
|
+
**[→ Full documentation on GitHub](https://github.com/syrin-labs/iris)**
|
package/dist/babel.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { types, PluginObj, PluginPass } from '@babel/core';
|
|
2
|
+
|
|
3
|
+
declare const SOURCE_ATTR = "data-iris-source";
|
|
4
|
+
interface PluginApi {
|
|
5
|
+
types: typeof types;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Stamps `data-iris-source="relativeFile:line:col"` on every JSX host element (lowercase
|
|
9
|
+
* tag). @syrin/iris-react reads it to map a DOM node back to its source — needed on React 19,
|
|
10
|
+
* which removed `_debugSource`. Intended for dev builds only.
|
|
11
|
+
*/
|
|
12
|
+
declare function irisSourcePlugin({ types: t }: PluginApi): PluginObj<PluginPass>;
|
|
13
|
+
|
|
14
|
+
export { SOURCE_ATTR, irisSourcePlugin as default };
|
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-iris-source";
|
|
4
|
+
function irisSourcePlugin({ types: t }) {
|
|
5
|
+
return {
|
|
6
|
+
name: "iris-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
|
+
irisSourcePlugin as default
|
|
32
|
+
};
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import './spec.js';
|
|
3
|
+
import './registry.js';
|
|
4
|
+
import './runner.js';
|
|
5
|
+
import './summary.js';
|
|
6
|
+
import './junit.js';
|
|
7
|
+
import './boot.js';
|
|
8
|
+
import './skip.js';
|
|
9
|
+
import './test-context.js';
|
|
10
|
+
import './clock.js';
|
|
11
|
+
import './resolve.js';
|
|
12
|
+
import './input-mode.js';
|
|
13
|
+
import './constants.js';
|
|
14
|
+
import './types.js';
|
|
15
|
+
import './flow-spec.js';
|
|
16
|
+
import './success-assert.js';
|
|
17
|
+
import './register.js';
|