@vitronai/alethia 0.2.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,44 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 vitron.ai
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.
22
+
23
+ ---
24
+
25
+ PATENT NOTICE
26
+
27
+ This software is the public MCP bridge to a proprietary, closed-source runtime
28
+ ("Alethia Core") whose underlying method is the subject of:
29
+
30
+ U.S. Patent Application No. 19/571,437 (non-provisional)
31
+ Claiming priority to U.S. Provisional Application No. 63/785,814
32
+ Filed: April 9, 2025
33
+ Title: "Deterministic Local Automation Runtime with Zero-IPC Execution,
34
+ Offline Operation, and Per-Step Policy Enforcement"
35
+ Status: Patent Pending — U.S. Patent and Trademark Office
36
+
37
+ The MIT license above applies ONLY to the source code in this directory
38
+ (the @vitronai/alethia npm package — the MCP bridge and CLI). It does NOT
39
+ grant any license, express or implied, under U.S. Application No. 19/571,437
40
+ or any other patent rights of vitron.ai. Use of the Alethia Core runtime is
41
+ governed by separate terms; commercial and production use may require a
42
+ patent license from vitron.ai once the patent grants.
43
+
44
+ For licensing inquiries: gatekeeper@vitron.ai
package/README.md ADDED
@@ -0,0 +1,298 @@
1
+ # @vitronai/alethia
2
+
3
+ > **The MCP bridge to Alethia** — the patent-pending zero-IPC E2E test runtime built for AI agents.
4
+ > **45× faster than Playwright** on the localhost test loop. Fail-closed by default. Cryptographically chained audit packs. Local-first, no telemetry.
5
+
6
+ [![npm version](https://img.shields.io/npm/v/@vitronai/alethia.svg)](https://www.npmjs.com/package/@vitronai/alethia)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](./LICENSE)
8
+ [![Patent Pending](https://img.shields.io/badge/Patent-Pending-blue.svg)](#patent-notice)
9
+
10
+ ---
11
+
12
+ ## Why Alethia?
13
+
14
+ Your agent generates a Next.js app on `localhost:3000` and your users want it verified. Playwright adds **600ms of CDP marshalling tax** to every assertion — and worse, it's async-by-construction, so the agent's decide-act-verify loop is racing against stale DOM snapshots between every `await`.
15
+
16
+ Alethia is a different shape entirely. The driver and the DOM live in **the same V8 isolate**:
17
+
18
+ | | Playwright (CDP) | Alethia (zero-IPC) |
19
+ |---|---|---|
20
+ | Avg latency per step | 580 ms | **13 ms** |
21
+ | p95 latency per step | 654 ms | **24 ms** |
22
+ | Process boundary | 3 (test ↔ driver ↔ browser) | **0** between driver and DOM |
23
+ | DOM access | async, marshalled, race-prone | **synchronous, in-process** |
24
+ | Per-step safety policy | none | **VITRON-EA1 fail-closed gate** |
25
+ | Audit trail | trace viewer (debugging) | **SHA-256 chained, Ed25519 signable** |
26
+ | Telemetry | optional cloud | **none, ever** |
27
+ | Patent moat | none | **U.S. App 19/571,437** |
28
+
29
+ Benchmarks: `click-assert-wait` scenario, 20 iterations. Numbers from `benchmarks/league-latest.json` in the [alethia-core](https://github.com/vitron-ai/alethia-core) repo.
30
+
31
+ ---
32
+
33
+ ## Install
34
+
35
+ ```bash
36
+ npm install -g @vitronai/alethia
37
+ ```
38
+
39
+ You also need the **Alethia desktop app** running locally. Download the latest signed build:
40
+ 👉 [github.com/vitron-ai/alethia/releases](https://github.com/vitron-ai/alethia/releases)
41
+
42
+ The desktop app starts a loopback JSON-RPC server on `127.0.0.1:47432`. The npm package above is a thin **stdio→HTTP shim** that lets MCP-capable AI agents call into it.
43
+
44
+ ### Verify the install
45
+
46
+ ```bash
47
+ alethia-mcp --version
48
+ alethia-mcp --health-check
49
+ ```
50
+
51
+ Expected:
52
+
53
+ ```
54
+ ✓ Connected. 5 MCP tools available.
55
+ runtime version: 0.1.0-alpha.1
56
+ default profile: controlled-web
57
+ kill switch: inactive
58
+ ```
59
+
60
+ ---
61
+
62
+ ## Configure your agent
63
+
64
+ ### Claude Code
65
+
66
+ `~/.claude/mcp.json`:
67
+
68
+ ```json
69
+ {
70
+ "mcpServers": {
71
+ "alethia": { "command": "alethia-mcp" }
72
+ }
73
+ }
74
+ ```
75
+
76
+ ### Cursor
77
+
78
+ Cursor → Settings → MCP → Add server:
79
+
80
+ ```json
81
+ {
82
+ "alethia": { "command": "alethia-mcp" }
83
+ }
84
+ ```
85
+
86
+ ### Cline / Continue / any MCP client
87
+
88
+ Same shape. Any MCP-compatible client speaks the standard stdio protocol — point it at the `alethia-mcp` command.
89
+
90
+ ### Claude Desktop
91
+
92
+ `~/Library/Application Support/Claude/claude_desktop_config.json`:
93
+
94
+ ```json
95
+ {
96
+ "mcpServers": {
97
+ "alethia": {
98
+ "command": "npx",
99
+ "args": ["-y", "@vitronai/alethia"]
100
+ }
101
+ }
102
+ }
103
+ ```
104
+
105
+ After saving the config, restart your MCP client.
106
+
107
+ ---
108
+
109
+ ## Usage
110
+
111
+ Once configured, your agent has five Alethia tools available. The most common one:
112
+
113
+ > *"Use alethia_tell to navigate to localhost:3000, sign in as admin@example.com / password123, and verify the dashboard heading is visible."*
114
+
115
+ The agent will call `alethia_tell` with that NLP, Alethia compiles to Action IR, runs through the VITRON-EA1 policy gate, executes step by step, and returns a `PlanRun` with per-step results, policy audit records, and an integrity hash.
116
+
117
+ ---
118
+
119
+ ## Tools
120
+
121
+ ### `alethia_tell`
122
+ Execute natural-language test instructions. The headline tool.
123
+
124
+ ```
125
+ nlp: "navigate to http://localhost:3000/login
126
+ type admin@example.com into the email field
127
+ type password123 into the password field
128
+ click Sign In
129
+ assert the dashboard heading is visible"
130
+ ```
131
+
132
+ Returns a `PlanRun`:
133
+ ```json
134
+ {
135
+ "ok": true,
136
+ "elapsedMs": 87,
137
+ "stepRuns": [ /* per-step results */ ],
138
+ "policyAudits": [ /* per-step EA1 decisions */ ],
139
+ "integrity": {
140
+ "algorithm": "sha256",
141
+ "schemaVersion": "plan-run-v1",
142
+ "payloadHash": "..."
143
+ }
144
+ }
145
+ ```
146
+
147
+ By default, **destructive actions are blocked** (`controlled-web` profile). The runtime catches verbs like *delete, purchase, transfer, submit payment* via NLP intent inference and prepends `!://write-high` markers in the IR. Sensitive input (passwords, credit cards, SSN) is **always blocked** unless the caller explicitly opts in via `allowSensitiveInput: true`.
148
+
149
+ ### `alethia_compile`
150
+ Compile NL to Action IR **without executing**. Use this to preview what `alethia_tell` will run, debug NLP coverage gaps, or generate reproducible IR scripts for CI.
151
+
152
+ ### `alethia_status`
153
+ Liveness probe + identity. Returns runtime version, default policy profile, kill switch state, driver stats, current page domain, and capabilities. Call this before sending `tell()` calls to verify the runtime is in a known-good state.
154
+
155
+ ### `alethia_activate_kill_switch`
156
+ **Halt all current and queued automation immediately.** Per-step policy gate stays armed; subsequent `tell()` calls will be blocked with `KILL_SWITCH_ACTIVE` until reset. Optional `reason` argument lands in the audit trail.
157
+
158
+ ### `alethia_reset_kill_switch`
159
+ Clear an active kill switch and reset the shared executor state. Re-enables `tell()` calls. The reset itself is logged.
160
+
161
+ ---
162
+
163
+ ## Architecture
164
+
165
+ ```
166
+ ┌────────────────────────┐
167
+ │ Your AI agent │ Claude Code / Cursor / Cline / Continue / ...
168
+ │ speaks MCP stdio │
169
+ └──────────┬─────────────┘
170
+ │ stdio (JSON-RPC over newline-delimited JSON)
171
+
172
+ ┌────────────────────────┐
173
+ │ @vitronai/alethia │ This npm package — ~9 KB
174
+ │ stdio → HTTP shim │ - speaks MCP stdio inbound
175
+ └──────────┬─────────────┘ - wraps results in MCP content envelope
176
+ │ HTTP POST 127.0.0.1:47432 (loopback only, never networked)
177
+
178
+ ┌────────────────────────┐
179
+ │ Alethia desktop app │ Electron main process
180
+ │ local JSON-RPC server │ - tools/list, tools/call
181
+ └──────────┬─────────────┘ - loopback bind, never reachable from network
182
+ │ webContents.executeJavaScript('window.__alethia.tell(...)')
183
+
184
+ ┌────────────────────────┐
185
+ │ Alethia renderer │ Electron renderer process — IS the browser
186
+ │ zero-IPC runtime │ - tell() → NLP compiler → Action IR
187
+ └──────────┬─────────────┘ - VITRON-EA1 policy gate (per-step, fail-closed)
188
+ │ direct DOM access (no protocol, no marshalling)
189
+
190
+ ┌────────────────────────┐
191
+ │ The page under test │
192
+ └────────────────────────┘
193
+ ```
194
+
195
+ **Two process boundaries** between your agent and the runtime (agent ↔ shim, shim ↔ Electron). Then **zero** boundaries between the runtime and the DOM. That's the architectural difference that makes Alethia 45× faster than Playwright.
196
+
197
+ ---
198
+
199
+ ## CLI flags
200
+
201
+ ```
202
+ alethia-mcp Run as a stdio MCP server (default)
203
+ alethia-mcp --version Print the version and exit
204
+ alethia-mcp --help Print usage and exit
205
+ alethia-mcp --health-check Probe the Alethia desktop app and exit 0/1
206
+ alethia-mcp --debug Run with debug logging on stderr
207
+ ```
208
+
209
+ ## Environment variables
210
+
211
+ | Variable | Default | Description |
212
+ |---|---|---|
213
+ | `ALETHIA_HOST` | `127.0.0.1` | Host of the Alethia desktop app |
214
+ | `ALETHIA_PORT` | `47432` | Port of the Alethia desktop app |
215
+ | `ALETHIA_TIMEOUT_MS` | `60000` | Per-request timeout in milliseconds |
216
+ | `ALETHIA_DEBUG` | (unset) | Set to `1` to enable debug logging on stderr |
217
+
218
+ ---
219
+
220
+ ## Troubleshooting
221
+
222
+ ### "Alethia desktop app is not running on 127.0.0.1:47432"
223
+
224
+ The desktop app isn't running. Download it:
225
+ 👉 [github.com/vitron-ai/alethia/releases](https://github.com/vitron-ai/alethia/releases)
226
+
227
+ Launch it. You should see in its console:
228
+
229
+ ```
230
+ [alethia] local RPC server listening on 127.0.0.1:47432
231
+ ```
232
+
233
+ Then re-run your MCP client.
234
+
235
+ ### "DENY_WRITE_HIGH" in the audit log
236
+
237
+ The runtime blocked a destructive action under the default fail-closed policy. **This is correct behaviour** for an AI-agent-facing test runtime — destructive actions need explicit consent.
238
+
239
+ To allow them, pass `{ profile: 'open-web' }` in the `alethia_tell` arguments. But understand: you're opting out of the safety gate.
240
+
241
+ ### "SENSITIVE_INPUT_DENIED"
242
+
243
+ The runtime blocked typing into what looks like a sensitive field (matches `password`, `token`, `secret`, `credit card`, `ssn`, etc.). To override for a legitimate auth-flow test:
244
+
245
+ ```json
246
+ { "nlp": "...", "allowSensitiveInput": true }
247
+ ```
248
+
249
+ Only do this when you are knowingly testing a real auth or payment flow.
250
+
251
+ ### MCP client doesn't see the tools
252
+
253
+ 1. Verify the desktop app is running: `alethia-mcp --health-check`
254
+ 2. Verify your MCP config points at the correct command
255
+ 3. Restart your MCP client (some clients cache server lists)
256
+ 4. Run with debug logging: set `ALETHIA_DEBUG=1` in your MCP config's `env` section
257
+
258
+ ### `Script failed to execute`
259
+
260
+ The Electron renderer hasn't loaded `window.__alethia` yet (or crashed). Restart the desktop app. If it persists, file an issue.
261
+
262
+ ---
263
+
264
+ ## Privacy
265
+
266
+ Everything runs on your machine. **No cloud. No telemetry. No data leaves your network.** The bridge above only ever speaks to `127.0.0.1` (loopback). The desktop app's network filter blocks all non-`file://`, non-`app://`, non-`localhost` requests in production builds.
267
+
268
+ The bridge source is open and auditable: the entirety of what this package does is in [`src/index.ts`](./src/index.ts).
269
+
270
+ ---
271
+
272
+ ## License
273
+
274
+ MIT — see [LICENSE](./LICENSE).
275
+
276
+ The MIT license covers **this MCP bridge package only**. The underlying Alethia Core runtime is proprietary and closed-source.
277
+
278
+ ## Patent Notice
279
+
280
+ Alethia Core practices a method that is the subject of:
281
+
282
+ - **U.S. Patent Application No. 19/571,437** (non-provisional)
283
+ - Claiming priority to **U.S. Provisional Application No. 63/785,814** (filed April 9, 2025)
284
+ - **Title:** *"Deterministic Local Automation Runtime with Zero-IPC Execution, Offline Operation, and Per-Step Policy Enforcement"*
285
+ - **Status:** Patent Pending — U.S. Patent and Trademark Office
286
+
287
+ The MIT license on this MCP bridge does **not** grant any patent license under U.S. Application No. 19/571,437 or any other vitron.ai patent rights.
288
+
289
+ For licensing inquiries: **gatekeeper@vitron.ai**
290
+
291
+ ---
292
+
293
+ ## Links
294
+
295
+ - 🏠 Homepage: [github.com/vitron-ai/alethia](https://github.com/vitron-ai/alethia)
296
+ - 📦 Source: [github.com/vitron-ai/alethia-mcp](https://github.com/vitron-ai/alethia-mcp)
297
+ - 📥 Releases: [github.com/vitron-ai/alethia/releases](https://github.com/vitron-ai/alethia/releases)
298
+ - 📧 Licensing: gatekeeper@vitron.ai
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @vitronai/alethia — MCP bridge
4
+ *
5
+ * Stdio MCP server that connects AI agents (Claude Code, Cursor, Cline,
6
+ * Continue, etc.) to a running Alethia desktop app via JSON-RPC over a
7
+ * loopback HTTP socket on 127.0.0.1:47432.
8
+ *
9
+ * The Alethia desktop app must be running locally. Download it at:
10
+ * https://github.com/vitron-ai/alethia/releases
11
+ *
12
+ * Alethia is the patent-pending zero-IPC E2E test runtime built for AI agents.
13
+ * 45x faster than Playwright on the localhost loop. Fail-closed by default.
14
+ * Cryptographically chained audit packs. Local-first, no telemetry.
15
+ *
16
+ * MIT License — vitron-ai 2026.
17
+ * Patent Pending — U.S. Application No. 19/571,437. The MIT license on this
18
+ * MCP bridge does NOT grant any patent license under U.S. App 19/571,437.
19
+ */
20
+ export {};
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;GAiBG"}
package/dist/index.js ADDED
@@ -0,0 +1,475 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @vitronai/alethia — MCP bridge
4
+ *
5
+ * Stdio MCP server that connects AI agents (Claude Code, Cursor, Cline,
6
+ * Continue, etc.) to a running Alethia desktop app via JSON-RPC over a
7
+ * loopback HTTP socket on 127.0.0.1:47432.
8
+ *
9
+ * The Alethia desktop app must be running locally. Download it at:
10
+ * https://github.com/vitron-ai/alethia/releases
11
+ *
12
+ * Alethia is the patent-pending zero-IPC E2E test runtime built for AI agents.
13
+ * 45x faster than Playwright on the localhost loop. Fail-closed by default.
14
+ * Cryptographically chained audit packs. Local-first, no telemetry.
15
+ *
16
+ * MIT License — vitron-ai 2026.
17
+ * Patent Pending — U.S. Application No. 19/571,437. The MIT license on this
18
+ * MCP bridge does NOT grant any patent license under U.S. App 19/571,437.
19
+ */
20
+ import http from 'node:http';
21
+ import { readFileSync } from 'node:fs';
22
+ import { fileURLToPath } from 'node:url';
23
+ import { dirname, resolve } from 'node:path';
24
+ // ---------------------------------------------------------------------------
25
+ // Package metadata (read at runtime from the bundled package.json)
26
+ // ---------------------------------------------------------------------------
27
+ const __filename = fileURLToPath(import.meta.url);
28
+ const __dirname = dirname(__filename);
29
+ let PKG_VERSION = '0.0.0';
30
+ let PKG_NAME = '@vitronai/alethia';
31
+ try {
32
+ // dist/index.js -> ../package.json
33
+ const pkgPath = resolve(__dirname, '..', 'package.json');
34
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
35
+ if (pkg.version)
36
+ PKG_VERSION = pkg.version;
37
+ if (pkg.name)
38
+ PKG_NAME = pkg.name;
39
+ }
40
+ catch {
41
+ // Fallback if package.json can't be read — keeps the binary functional
42
+ // even when invoked from an unusual install location.
43
+ }
44
+ // ---------------------------------------------------------------------------
45
+ // Configuration (env vars + CLI flags)
46
+ // ---------------------------------------------------------------------------
47
+ const ALETHIA_HOST = process.env.ALETHIA_HOST ?? '127.0.0.1';
48
+ const ALETHIA_PORT = Number(process.env.ALETHIA_PORT ?? 47432);
49
+ const ALETHIA_TIMEOUT_MS = Number(process.env.ALETHIA_TIMEOUT_MS ?? 60_000);
50
+ const DEBUG = process.env.ALETHIA_DEBUG === '1' || process.argv.includes('--debug');
51
+ const debug = (...args) => {
52
+ if (DEBUG) {
53
+ process.stderr.write(`[alethia-mcp] ${args.map(String).join(' ')}\n`);
54
+ }
55
+ };
56
+ // ---------------------------------------------------------------------------
57
+ // CLI flag handling — runs before any stdio processing
58
+ // ---------------------------------------------------------------------------
59
+ const CLI_HELP = `${PKG_NAME} v${PKG_VERSION}
60
+ MCP bridge for Alethia — the zero-IPC E2E test runtime for AI agents.
61
+
62
+ USAGE
63
+ alethia-mcp Run as a stdio MCP server (default)
64
+ alethia-mcp --version Print the version and exit
65
+ alethia-mcp --help Print this message and exit
66
+ alethia-mcp --health-check Probe the Alethia desktop app and exit 0/1
67
+ alethia-mcp --debug Run with debug logging on stderr
68
+
69
+ REQUIREMENTS
70
+ The Alethia desktop app must be running locally on 127.0.0.1:47432.
71
+ Download the latest release: https://github.com/vitron-ai/alethia/releases
72
+
73
+ ENVIRONMENT
74
+ ALETHIA_HOST Host of the Alethia desktop app (default: 127.0.0.1)
75
+ ALETHIA_PORT Port of the Alethia desktop app (default: 47432)
76
+ ALETHIA_TIMEOUT_MS Per-request timeout in milliseconds (default: 60000)
77
+ ALETHIA_DEBUG Set to "1" to enable debug logging on stderr
78
+
79
+ INTEGRATIONS
80
+ Add to your MCP client config (Claude Code, Cursor, Cline, Continue, etc.):
81
+
82
+ {
83
+ "mcpServers": {
84
+ "alethia": { "command": "alethia-mcp" }
85
+ }
86
+ }
87
+
88
+ ABOUT
89
+ Patent Pending — U.S. Application No. 19/571,437.
90
+ Licensing inquiries: gatekeeper@vitron.ai
91
+ Source: https://github.com/vitron-ai/alethia-mcp
92
+ `;
93
+ const printAndExit = (message, code = 0) => {
94
+ process.stdout.write(message);
95
+ if (!message.endsWith('\n'))
96
+ process.stdout.write('\n');
97
+ process.exit(code);
98
+ };
99
+ if (process.argv.includes('--help') || process.argv.includes('-h')) {
100
+ printAndExit(CLI_HELP);
101
+ }
102
+ if (process.argv.includes('--version') || process.argv.includes('-v')) {
103
+ printAndExit(`${PKG_NAME} v${PKG_VERSION}`);
104
+ }
105
+ // ---------------------------------------------------------------------------
106
+ // HTTP client — calls the Alethia desktop app's local RPC server
107
+ // ---------------------------------------------------------------------------
108
+ class AlethiaConnectionError extends Error {
109
+ constructor(message) {
110
+ super(message);
111
+ this.name = 'AlethiaConnectionError';
112
+ }
113
+ }
114
+ const callAlethia = (body, timeoutMs = ALETHIA_TIMEOUT_MS) => new Promise((resolveCall, rejectCall) => {
115
+ const payload = JSON.stringify(body);
116
+ debug('->', payload);
117
+ const req = http.request({
118
+ hostname: ALETHIA_HOST,
119
+ port: ALETHIA_PORT,
120
+ path: '/',
121
+ method: 'POST',
122
+ headers: {
123
+ 'content-type': 'application/json',
124
+ 'content-length': Buffer.byteLength(payload),
125
+ },
126
+ }, (res) => {
127
+ let data = '';
128
+ res.setEncoding('utf8');
129
+ res.on('data', (chunk) => { data += chunk; });
130
+ res.on('end', () => {
131
+ debug('<-', data);
132
+ try {
133
+ resolveCall(JSON.parse(data));
134
+ }
135
+ catch {
136
+ rejectCall(new Error(`Invalid JSON from Alethia desktop app: ${data.slice(0, 200)}`));
137
+ }
138
+ });
139
+ });
140
+ req.setTimeout(timeoutMs, () => {
141
+ req.destroy(new Error(`Alethia desktop app timed out after ${timeoutMs}ms`));
142
+ });
143
+ req.on('error', (err) => {
144
+ const code = err.code;
145
+ if (code === 'ECONNREFUSED' || code === 'ENOTFOUND' || code === 'EHOSTUNREACH') {
146
+ rejectCall(new AlethiaConnectionError(`Alethia desktop app is not running on ${ALETHIA_HOST}:${ALETHIA_PORT}.\n` +
147
+ `\n` +
148
+ `To fix:\n` +
149
+ ` 1. Download the latest release: https://github.com/vitron-ai/alethia/releases\n` +
150
+ ` 2. Launch the desktop app — you should see "[alethia] local RPC server listening" in its console.\n` +
151
+ ` 3. Re-run your MCP client.\n` +
152
+ `\n` +
153
+ `Override host/port via ALETHIA_HOST / ALETHIA_PORT env vars if needed.`));
154
+ }
155
+ else {
156
+ rejectCall(err);
157
+ }
158
+ });
159
+ req.write(payload);
160
+ req.end();
161
+ });
162
+ // ---------------------------------------------------------------------------
163
+ // Health check mode — probe and exit
164
+ // ---------------------------------------------------------------------------
165
+ const runHealthCheck = async () => {
166
+ process.stdout.write(`Probing Alethia at ${ALETHIA_HOST}:${ALETHIA_PORT}...\n`);
167
+ try {
168
+ const response = await callAlethia({ jsonrpc: '2.0', id: 1, method: 'tools/list' }, 5_000);
169
+ if (response.error) {
170
+ process.stdout.write(`✗ Alethia returned an error: ${response.error.message}\n`);
171
+ process.exit(1);
172
+ }
173
+ const result = response.result;
174
+ const toolCount = result?.tools?.length ?? 0;
175
+ process.stdout.write(`✓ Connected. ${toolCount} MCP tool${toolCount === 1 ? '' : 's'} available.\n`);
176
+ // Also probe status if available
177
+ try {
178
+ const statusResp = await callAlethia({ jsonrpc: '2.0', id: 2, method: 'tools/call', params: { name: 'alethia_status', arguments: {} } }, 5_000);
179
+ if (!statusResp.error && statusResp.result) {
180
+ const status = statusResp.result;
181
+ process.stdout.write(` runtime version: ${status.version ?? 'unknown'}\n`);
182
+ process.stdout.write(` default profile: ${status.defaultPolicyProfile ?? 'unknown'}\n`);
183
+ process.stdout.write(` kill switch: ${status.killSwitch?.active ? 'ACTIVE' : 'inactive'}\n`);
184
+ }
185
+ }
186
+ catch {
187
+ // Old runtime versions may not have alethia_status; not fatal.
188
+ }
189
+ process.exit(0);
190
+ }
191
+ catch (err) {
192
+ if (err instanceof AlethiaConnectionError) {
193
+ process.stdout.write(`✗ ${err.message}\n`);
194
+ }
195
+ else {
196
+ process.stdout.write(`✗ Health check failed: ${err.message}\n`);
197
+ }
198
+ process.exit(1);
199
+ }
200
+ };
201
+ if (process.argv.includes('--health-check')) {
202
+ // Top-level await — blocks the rest of the script so the stdio loop below
203
+ // never gets a chance to close stdin out from under runHealthCheck.
204
+ // runHealthCheck calls process.exit() so this await never resolves.
205
+ await runHealthCheck();
206
+ }
207
+ // ---------------------------------------------------------------------------
208
+ // MCP tool definitions — these are the descriptions the LLM sees
209
+ // ---------------------------------------------------------------------------
210
+ const TOOLS = [
211
+ {
212
+ name: 'alethia_tell',
213
+ description: 'Execute natural-language E2E test instructions against the page Alethia is currently driving. ' +
214
+ 'Compiles to Action IR, runs through the VITRON-EA1 fail-closed policy gate, executes step-by-step ' +
215
+ 'with synchronous DOM access (no CDP marshalling), and returns a PlanRun with per-step results, ' +
216
+ 'policy audit records, and a SHA-256 integrity hash. ' +
217
+ 'Default profile is "controlled-web" — destructive actions (delete, purchase, transfer) are blocked unless ' +
218
+ 'the caller explicitly opts into "open-web". Sensitive input (passwords, credit cards, SSN) is blocked ' +
219
+ 'in all profiles unless allowSensitiveInput is true. ' +
220
+ '~13ms per step on average — 45x faster than Playwright on the localhost loop.',
221
+ inputSchema: {
222
+ type: 'object',
223
+ properties: {
224
+ nlp: {
225
+ type: 'string',
226
+ description: 'One or more plain-English test instructions, newline-separated. Example: "navigate to http://localhost:3000\\nclick Sign In\\nassert the dashboard is visible"',
227
+ },
228
+ name: {
229
+ type: 'string',
230
+ description: 'Optional run name for audit logs and replay.',
231
+ },
232
+ },
233
+ required: ['nlp'],
234
+ },
235
+ },
236
+ {
237
+ name: 'alethia_compile',
238
+ description: 'Compile natural-language test instructions to Alethia Action IR text, without executing anything. ' +
239
+ 'Returns the compiled IR, per-line confidence scores (0-1), and warnings for any lines the NLP compiler ' +
240
+ 'could not parse. Use this to preview what tell() will run, debug NLP coverage gaps, or generate ' +
241
+ 'reproducible IR scripts for CI pipelines.',
242
+ inputSchema: {
243
+ type: 'object',
244
+ properties: {
245
+ nlp: {
246
+ type: 'string',
247
+ description: 'NL instructions to compile (does not execute).',
248
+ },
249
+ },
250
+ required: ['nlp'],
251
+ },
252
+ },
253
+ {
254
+ name: 'alethia_status',
255
+ description: 'Health and identity probe. Returns runtime version, the default VITRON-EA1 policy profile in effect, ' +
256
+ 'kill switch state, driver statistics (queued plans, run count, audit count), the current page domain, ' +
257
+ 'and runtime capabilities. Use this for liveness checks before sending tell() calls, and to verify ' +
258
+ 'the runtime is in a known-good state at the start of an agent loop.',
259
+ inputSchema: { type: 'object', properties: {} },
260
+ },
261
+ {
262
+ name: 'alethia_activate_kill_switch',
263
+ description: 'Halt all current and queued automation immediately. The per-step VITRON-EA1 policy gate stays armed; ' +
264
+ 'subsequent tell() calls will be blocked with reason KILL_SWITCH_ACTIVE until reset. ' +
265
+ 'Use this when an agent appears to be acting unsafely, when human review is required, or to enforce ' +
266
+ 'a hard boundary at the end of a controlled test run.',
267
+ inputSchema: {
268
+ type: 'object',
269
+ properties: {
270
+ reason: {
271
+ type: 'string',
272
+ description: 'Optional explanation that lands in the audit trail for later review.',
273
+ },
274
+ },
275
+ },
276
+ },
277
+ {
278
+ name: 'alethia_reset_kill_switch',
279
+ description: 'Clear an active kill switch and reset the shared executor state. ' +
280
+ 'Re-enables tell() calls. The reset itself is logged in the audit trail for compliance review.',
281
+ inputSchema: { type: 'object', properties: {} },
282
+ },
283
+ ];
284
+ // Map external tool names to the internal Electron RPC tool names
285
+ const TOOL_NAME_MAP = {
286
+ alethia_tell: 'alethia_tell',
287
+ alethia_compile: 'alethia_compile_nlp',
288
+ alethia_status: 'alethia_status',
289
+ alethia_activate_kill_switch: 'alethia_activate_kill_switch',
290
+ alethia_reset_kill_switch: 'alethia_reset_kill_switch',
291
+ };
292
+ // ---------------------------------------------------------------------------
293
+ // Per-tool input validation
294
+ // ---------------------------------------------------------------------------
295
+ const validateToolArgs = (toolName, args) => {
296
+ switch (toolName) {
297
+ case 'alethia_tell':
298
+ case 'alethia_compile': {
299
+ const nlp = args.nlp;
300
+ if (typeof nlp !== 'string')
301
+ return `tool "${toolName}" requires "nlp" to be a string`;
302
+ if (nlp.trim().length === 0)
303
+ return `tool "${toolName}" requires "nlp" to be non-empty`;
304
+ if (nlp.length > 100_000)
305
+ return `tool "${toolName}" "nlp" exceeds 100KB limit`;
306
+ if ('name' in args && args.name !== undefined && typeof args.name !== 'string') {
307
+ return `tool "${toolName}" requires "name" to be a string when provided`;
308
+ }
309
+ return null;
310
+ }
311
+ case 'alethia_activate_kill_switch':
312
+ if ('reason' in args && args.reason !== undefined && typeof args.reason !== 'string') {
313
+ return `tool "${toolName}" requires "reason" to be a string when provided`;
314
+ }
315
+ return null;
316
+ case 'alethia_status':
317
+ case 'alethia_reset_kill_switch':
318
+ return null;
319
+ default:
320
+ return `unknown tool: ${toolName}`;
321
+ }
322
+ };
323
+ // ---------------------------------------------------------------------------
324
+ // MCP request handlers
325
+ // ---------------------------------------------------------------------------
326
+ const wrapMcpResult = (data, isError = false) => ({
327
+ content: [
328
+ {
329
+ type: 'text',
330
+ text: typeof data === 'string' ? data : JSON.stringify(data, null, 2),
331
+ },
332
+ ],
333
+ isError,
334
+ });
335
+ const handle = async (request) => {
336
+ const id = request.id ?? null;
337
+ const method = request.method ?? '';
338
+ try {
339
+ if (method === 'initialize') {
340
+ return {
341
+ jsonrpc: '2.0',
342
+ id,
343
+ result: {
344
+ protocolVersion: '2025-06-18',
345
+ serverInfo: { name: PKG_NAME, version: PKG_VERSION },
346
+ capabilities: {
347
+ tools: { listChanged: false },
348
+ },
349
+ instructions: 'Alethia is the patent-pending zero-IPC E2E test runtime built for AI agents. ' +
350
+ 'Use alethia_tell to drive a real browser with plain English. ' +
351
+ 'The Alethia desktop app must be running locally on 127.0.0.1:47432.',
352
+ },
353
+ };
354
+ }
355
+ if (method === 'notifications/initialized' || method === 'initialized') {
356
+ // No response expected for notifications, but return a stub for safety
357
+ return { jsonrpc: '2.0', id, result: {} };
358
+ }
359
+ if (method === 'tools/list') {
360
+ return { jsonrpc: '2.0', id, result: { tools: TOOLS } };
361
+ }
362
+ if (method === 'tools/call') {
363
+ const params = (request.params ?? {});
364
+ const toolName = String(params.name ?? '');
365
+ const args = (params.arguments ?? {});
366
+ const internalName = TOOL_NAME_MAP[toolName];
367
+ if (!internalName) {
368
+ return {
369
+ jsonrpc: '2.0',
370
+ id,
371
+ result: wrapMcpResult(`Unknown tool: ${toolName}. Valid tools: ${Object.keys(TOOL_NAME_MAP).join(', ')}`, true),
372
+ };
373
+ }
374
+ const validationError = validateToolArgs(toolName, args);
375
+ if (validationError) {
376
+ return {
377
+ jsonrpc: '2.0',
378
+ id,
379
+ result: wrapMcpResult(`Invalid arguments: ${validationError}`, true),
380
+ };
381
+ }
382
+ try {
383
+ const httpResponse = await callAlethia({
384
+ jsonrpc: '2.0',
385
+ id: 1,
386
+ method: 'tools/call',
387
+ params: { name: internalName, arguments: args },
388
+ });
389
+ if (httpResponse.error) {
390
+ return {
391
+ jsonrpc: '2.0',
392
+ id,
393
+ result: wrapMcpResult(`Alethia runtime error: ${httpResponse.error.message}`, true),
394
+ };
395
+ }
396
+ return {
397
+ jsonrpc: '2.0',
398
+ id,
399
+ result: wrapMcpResult(httpResponse.result ?? null),
400
+ };
401
+ }
402
+ catch (err) {
403
+ if (err instanceof AlethiaConnectionError) {
404
+ return {
405
+ jsonrpc: '2.0',
406
+ id,
407
+ result: wrapMcpResult(err.message, true),
408
+ };
409
+ }
410
+ throw err;
411
+ }
412
+ }
413
+ // Unknown method — return MCP-style error
414
+ return {
415
+ jsonrpc: '2.0',
416
+ id,
417
+ error: { code: -32601, message: `Method not found: ${method}` },
418
+ };
419
+ }
420
+ catch (err) {
421
+ return {
422
+ jsonrpc: '2.0',
423
+ id,
424
+ error: { code: -32000, message: err.message },
425
+ };
426
+ }
427
+ };
428
+ // ---------------------------------------------------------------------------
429
+ // Stdio transport — newline-delimited JSON-RPC
430
+ // ---------------------------------------------------------------------------
431
+ const write = (response) => {
432
+ process.stdout.write(`${JSON.stringify(response)}\n`);
433
+ };
434
+ debug(`starting ${PKG_NAME} v${PKG_VERSION}, target ${ALETHIA_HOST}:${ALETHIA_PORT}, timeout ${ALETHIA_TIMEOUT_MS}ms`);
435
+ process.stdin.setEncoding('utf8');
436
+ let buffer = '';
437
+ process.stdin.on('data', (chunk) => {
438
+ buffer += chunk;
439
+ while (true) {
440
+ const nl = buffer.indexOf('\n');
441
+ if (nl === -1)
442
+ break;
443
+ const line = buffer.slice(0, nl).trim();
444
+ buffer = buffer.slice(nl + 1);
445
+ if (!line)
446
+ continue;
447
+ let request;
448
+ try {
449
+ request = JSON.parse(line);
450
+ }
451
+ catch {
452
+ write({ jsonrpc: '2.0', id: null, error: { code: -32700, message: 'Parse error' } });
453
+ continue;
454
+ }
455
+ void handle(request).then(write).catch((err) => {
456
+ write({ jsonrpc: '2.0', id: request.id ?? null, error: { code: -32000, message: err.message } });
457
+ });
458
+ }
459
+ });
460
+ process.stdin.on('end', () => {
461
+ // Set exitCode but DON'T forcibly exit. Pending HTTP responses (e.g. an
462
+ // in-flight tools/call against an offline runtime) need to write their
463
+ // error response back before the process is allowed to exit. The Node
464
+ // event loop will drain naturally and exit with this code once there's
465
+ // no remaining work.
466
+ debug('stdin closed, will exit when pending work drains');
467
+ process.exitCode = 0;
468
+ });
469
+ const shutdown = (signal) => () => {
470
+ debug(`received ${signal}, exiting`);
471
+ process.exit(0);
472
+ };
473
+ process.on('SIGINT', shutdown('SIGINT'));
474
+ process.on('SIGTERM', shutdown('SIGTERM'));
475
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACv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2.0",
4
+ "description": "MCP bridge for Alethia — the patent-pending zero-IPC E2E test runtime built for AI agents. 45x faster than Playwright on the localhost loop. Fail-closed by default. Cryptographically chained audit packs. Local-first, no telemetry.",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "bin": {
8
+ "alethia-mcp": "dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "LICENSE",
13
+ "README.md"
14
+ ],
15
+ "scripts": {
16
+ "build": "tsc",
17
+ "dev": "tsc --watch",
18
+ "test": "node --test test/smoke.test.mjs",
19
+ "prepublishOnly": "npm run build && npm test"
20
+ },
21
+ "keywords": [
22
+ "mcp",
23
+ "model-context-protocol",
24
+ "alethia",
25
+ "e2e",
26
+ "e2e-testing",
27
+ "browser-automation",
28
+ "testing",
29
+ "ai-agents",
30
+ "zero-ipc",
31
+ "playwright-alternative",
32
+ "cypress-alternative",
33
+ "claude-code",
34
+ "cursor",
35
+ "cline",
36
+ "continue",
37
+ "agent-testing",
38
+ "patent-pending",
39
+ "fail-closed",
40
+ "vitron"
41
+ ],
42
+ "author": "vitron.ai <gatekeeper@vitron.ai>",
43
+ "license": "MIT",
44
+ "homepage": "https://github.com/vitron-ai/alethia",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "git+https://github.com/vitron-ai/alethia-mcp.git"
48
+ },
49
+ "bugs": {
50
+ "url": "https://github.com/vitron-ai/alethia-mcp/issues"
51
+ },
52
+ "publishConfig": {
53
+ "access": "public"
54
+ },
55
+ "engines": {
56
+ "node": ">=18"
57
+ },
58
+ "devDependencies": {
59
+ "typescript": "^5.9.3",
60
+ "@types/node": "^25.2.3"
61
+ }
62
+ }