assuremind 1.0.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.
@@ -0,0 +1,254 @@
1
+ # Contributing to Assuremind
2
+
3
+ This guide covers how to build, test, and publish the package from source.
4
+
5
+ ---
6
+
7
+ ## Prerequisites
8
+
9
+ | Tool | Version |
10
+ |------|---------|
11
+ | Node.js | >= 18 |
12
+ | npm | >= 9 |
13
+ | Git | any recent |
14
+
15
+ ---
16
+
17
+ ## Clone and Install
18
+
19
+ ```bash
20
+ git clone https://github.com/your-org/assuremind.git
21
+ cd assuremind
22
+ npm install
23
+ ```
24
+
25
+ Install the UI dependencies separately:
26
+
27
+ ```bash
28
+ cd ui && npm install && cd ..
29
+ ```
30
+
31
+ ---
32
+
33
+ ## Project Structure
34
+
35
+ ```
36
+ assuremind/
37
+ ├── src/
38
+ │ ├── cli/ # CLI entry point and commands (init, run, generate, …)
39
+ │ ├── engine/ # Test runner, executor, self-healing, Allure reporter
40
+ │ ├── ai/ # Smart router, provider adapters, prompts, code cache
41
+ │ ├── storage/ # File-based JSON stores (suites, cases, results, healing)
42
+ │ ├── server/ # Fastify API server + WebSocket
43
+ │ ├── types/ # Zod schemas and TypeScript types
44
+ │ └── utils/ # Shared utilities (errors, logger, hash, sanitize, env)
45
+ ├── ui/ # React 18 + Vite + TailwindCSS Studio front-end
46
+ │ └── src/
47
+ │ ├── api/ # Typed API client
48
+ │ ├── components/
49
+ │ ├── hooks/
50
+ │ └── pages/ # Dashboard, TestEditor, Reports, Healing, …
51
+ ├── templates/ # Files copied into user projects on `init`
52
+ ├── tests/
53
+ │ ├── unit/ # Pure unit tests (no I/O, fast)
54
+ │ └── integration/ # CLI and server integration tests
55
+ ├── tsup.config.ts # Library bundler config
56
+ └── vitest.config.ts # Test runner config
57
+ ```
58
+
59
+ ---
60
+
61
+ ## Build Commands
62
+
63
+ ### Build everything (library + UI)
64
+
65
+ ```bash
66
+ npm run build
67
+ ```
68
+
69
+ This runs two steps in order:
70
+
71
+ **1. Build the TypeScript library:**
72
+
73
+ ```bash
74
+ npm run build:lib
75
+ ```
76
+
77
+ Uses `tsup` to compile `src/` → `dist/`. Outputs:
78
+ - `dist/index.js` / `dist/index.mjs` — CJS + ESM entry points
79
+ - `dist/index.d.ts` — TypeScript declarations
80
+ - `dist/cli/index.js` — CLI binary (referenced by `bin.assuremind` in package.json)
81
+
82
+ **2. Build the React UI:**
83
+
84
+ ```bash
85
+ npm run build:ui
86
+ ```
87
+
88
+ Runs `vite build` inside `ui/`. Output goes to `ui/dist/`. The Fastify server serves this at runtime via `@fastify/static`.
89
+
90
+ ---
91
+
92
+ ## Development Mode
93
+
94
+ Watch for TypeScript changes and recompile the library:
95
+
96
+ ```bash
97
+ npm run dev
98
+ ```
99
+
100
+ Watch and hot-reload the Studio UI (requires `npm run dev` running in parallel):
101
+
102
+ ```bash
103
+ npm run dev:ui
104
+ ```
105
+
106
+ ---
107
+
108
+ ## Testing
109
+
110
+ Run the full test suite:
111
+
112
+ ```bash
113
+ npm test
114
+ ```
115
+
116
+ Run with coverage report:
117
+
118
+ ```bash
119
+ npm run test:coverage
120
+ ```
121
+
122
+ Run in watch mode during development:
123
+
124
+ ```bash
125
+ npm run test:watch
126
+ ```
127
+
128
+ ### Test organisation
129
+
130
+ | Directory | Purpose | Speed |
131
+ |-----------|---------|-------|
132
+ | `tests/unit/` | Individual functions and classes | ~5 ms/test |
133
+ | `tests/integration/` | CLI commands, server HTTP routes | ~50–300 ms/test |
134
+
135
+ **Coverage target:** > 80% statements.
136
+
137
+ Engine files (`src/engine/`) and AI provider adapters (`src/ai/providers/`) are excluded from coverage thresholds because they require live Playwright browsers and API keys respectively.
138
+
139
+ ---
140
+
141
+ ## Linting and Formatting
142
+
143
+ ```bash
144
+ npm run lint # ESLint (TypeScript-aware)
145
+ npm run lint:fix # Auto-fix lint issues
146
+ npm run format # Prettier
147
+ npm run typecheck # tsc --noEmit (no output, just type errors)
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Adding a New AI Provider
153
+
154
+ 1. Create `src/ai/providers/<name>.ts` implementing the `AIProvider` interface from `src/types/ai.ts`.
155
+ 2. Register it in `src/ai/router.ts` → `createProvider()` switch.
156
+ 3. Add the required env vars to `templates/env.example`.
157
+ 4. Add validation in `src/utils/env.ts` → `PROVIDER_ENV` map.
158
+ 5. Update `docs/GETTING-STARTED.md` with the new provider block.
159
+
160
+ ---
161
+
162
+ ## Releasing a New Version
163
+
164
+ This package is distributed via private GitHub repository (not npm registry).
165
+
166
+ ### Steps to release
167
+
168
+ ```bash
169
+ # 1. Update version in package.json
170
+ # e.g., "version": "1.1.0"
171
+
172
+ # 2. Build and verify
173
+ npm run build
174
+ npm test
175
+
176
+ # 3. Commit and tag
177
+ git add -A
178
+ git commit -m "release: v1.1.0"
179
+ git tag v1.1.0
180
+
181
+ # 4. Push
182
+ git push origin main
183
+ git push origin v1.1.0
184
+ ```
185
+
186
+ ### Versioning
187
+
188
+ Follow [Semantic Versioning](https://semver.org):
189
+
190
+ | Change | Version bump | Example |
191
+ |--------|-------------|---------|
192
+ | Bug fixes | Patch | `1.0.0` → `1.0.1` |
193
+ | New features (backwards compatible) | Minor | `1.0.0` → `1.1.0` |
194
+ | Breaking changes | Major | `1.0.0` → `2.0.0` |
195
+
196
+ ### Consumer installation
197
+
198
+ ```bash
199
+ npm install git+https://github.com/<org>/assuremind.git#v1.1.0
200
+ ```
201
+
202
+ ---
203
+
204
+ ## Architecture Notes
205
+
206
+ ### Storage model
207
+
208
+ Everything is stored as plain JSON files in the user's project directory — no database required. Structure after `init`:
209
+
210
+ ```
211
+ <project>/
212
+ ├── tests/
213
+ │ └── <suite-slug>/
214
+ │ ├── suite.json
215
+ │ └── <case-slug>.test.json
216
+ ├── variables/
217
+ │ ├── global.json
218
+ │ ├── dev.env.json
219
+ │ ├── staging.env.json
220
+ │ └── prod.env.json
221
+ ├── results/
222
+ │ ├── runs/
223
+ │ │ └── <runId>.json
224
+ │ ├── screenshots/
225
+ │ ├── videos/
226
+ │ ├── traces/
227
+ │ ├── reports/
228
+ │ └── healing/
229
+ └── autotest.config.json # written by writeConfig()
230
+ ```
231
+
232
+ Suite and case file names are derived from the `name` field via `toSlug()` (lowercased, alphanumeric + hyphens). This means **the directory/file name is the URL parameter** used in Studio API routes — not the UUID stored inside the JSON.
233
+
234
+ ### Self-healing cascade
235
+
236
+ When a test step fails, the engine tries up to 6 healing levels in order:
237
+
238
+ | Level | Strategy |
239
+ |-------|---------|
240
+ | 1 | Smart Retry — wait + retry with backoff |
241
+ | 2 | AI Regeneration — AI rewrites Playwright code |
242
+ | 3 | Multi-Selector — try alternate selectors (ID, text, role, aria) |
243
+ | 4 | Visual/SoM — screenshot + AI visual analysis |
244
+ | 5 | Decompose — break step into smaller sub-actions |
245
+ | 6 | Manual — flag for human review |
246
+
247
+ Healed steps are saved as `pending` events in `results/healing/pending.json` for human review via `npx assuremind apply-healing` or the Studio Healing page.
248
+
249
+ ### AI cost optimisation
250
+
251
+ 1. **Template engine** — recognises common patterns (navigate, click, fill, etc.) and uses zero-cost templates.
252
+ 2. **Code cache** — SHA-based cache keyed on `(normalised instruction, url pattern)`. Cache persists to `results/code-cache.json`.
253
+ 3. **Complexity classifier** — routes simple steps to cheap/fast models (tiered mode) and complex steps to capable models.
254
+ 4. **Batch generation** — multiple empty steps sent in one API call.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Deepak Hiremath
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 do so, subject to the
10
+ 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,367 @@
1
+ # Assuremind Studio
2
+
3
+ **AI-powered codeless UI & API automation framework**
4
+
5
+ ---
6
+
7
+ ## Features
8
+
9
+ - **Zero coding required** — describe test steps in plain English, AI generates Playwright code
10
+ - **Three suite types** — **UI** (Playwright browser automation), **API** (HTTP tests), and **Audit** (Playwright + Lighthouse non-functional checks)
11
+ - **Audit suites** — run full Playwright automation with built-in Lighthouse scoring for Performance, Accessibility, and SEO; mark individual steps as Lighthouse checkpoints with the `⚡ Audit` flag
12
+ - **Device emulation** — emulate real mobile and tablet devices (iPhone 15 Pro, Pixel 7, iPad Pro, Galaxy S9+ and more) using Playwright's built-in device descriptors; configurable from the Studio UI or via `--device` CLI flag
13
+ - **Self-healing** — when a selector breaks, AI regenerates it automatically (6-level cascade)
14
+ - **Multi-AI-provider** — Anthropic, OpenAI, Google Gemini, Groq, DeepSeek, Together, Qwen, Perplexity, Ollama, AWS Bedrock, Azure OpenAI, custom endpoints
15
+ - **Studio UI** — browser-based test editor, run dashboard, healing review, reports
16
+ - **Git Control Center** — branch management, AI commit messages, conflict resolution from the UI
17
+ - **Environment management** — switch between dev, stage, test, prod with per-environment base URLs
18
+ - **Cost-optimised** — template engine + code cache minimise API calls; AI only runs when genuinely needed
19
+ - **CI-ready** — `npx assuremind run --all --ci` integrates with any pipeline; supports `--device` for mobile CI runs
20
+ - **File-based storage** — plain JSON, fully Git-friendly, no database
21
+
22
+ ---
23
+
24
+ ## Quick Start
25
+
26
+ ```bash
27
+ npm init -y
28
+ npm install git+https://github.com/<org>/assuremind.git
29
+ npx assuremind init # creates folders, config, installs Playwright browsers
30
+ npx assuremind studio # opens web UI at http://localhost:4400
31
+ ```
32
+
33
+ ---
34
+
35
+ ## Installation
36
+
37
+ ```bash
38
+ # From private GitHub repo
39
+ npm install git+https://github.com/<org>/assuremind.git
40
+
41
+ # Or a specific version
42
+ npm install git+https://github.com/<org>/assuremind.git#v1.0.0
43
+ ```
44
+
45
+ Node.js >= 18 is required.
46
+
47
+ ---
48
+
49
+ ## Configuration
50
+
51
+ After `npx assuremind init`, edit `.env` with your AI provider:
52
+
53
+ ```bash
54
+ # .env — choose one provider block
55
+
56
+ # Anthropic (Claude)
57
+ AI_PROVIDER=anthropic
58
+ ANTHROPIC_API_KEY=sk-ant-...
59
+ ANTHROPIC_MODEL=claude-sonnet-4-20250514 # optional
60
+
61
+ # OpenAI (GPT)
62
+ AI_PROVIDER=openai
63
+ OPENAI_API_KEY=sk-...
64
+ OPENAI_MODEL=gpt-4o # optional
65
+
66
+ # Google (Gemini)
67
+ AI_PROVIDER=google
68
+ GOOGLE_API_KEY=AIza...
69
+ GOOGLE_MODEL=gemini-2.5-flash # optional
70
+
71
+ # Groq (fast inference)
72
+ AI_PROVIDER=groq
73
+ GROQ_API_KEY=gsk_...
74
+ GROQ_MODEL=llama-3.3-70b-versatile # optional
75
+
76
+ # DeepSeek
77
+ AI_PROVIDER=deepseek
78
+ DEEPSEEK_API_KEY=sk-...
79
+
80
+ # Together AI
81
+ AI_PROVIDER=together
82
+ TOGETHER_API_KEY=...
83
+
84
+ # Perplexity
85
+ AI_PROVIDER=perplexity
86
+ PERPLEXITY_API_KEY=pplx-...
87
+
88
+ # Qwen (Alibaba)
89
+ AI_PROVIDER=qwen
90
+ QWEN_API_KEY=...
91
+
92
+ # Ollama (local)
93
+ AI_PROVIDER=ollama
94
+ OLLAMA_BASE_URL=http://localhost:11434 # optional
95
+ OLLAMA_MODEL=llama3.3 # optional
96
+
97
+ # AWS Bedrock
98
+ AI_PROVIDER=bedrock
99
+ AWS_ACCESS_KEY_ID=...
100
+ AWS_SECRET_ACCESS_KEY=...
101
+ AWS_REGION=us-east-1
102
+
103
+ # Azure OpenAI
104
+ AI_PROVIDER=azure-openai
105
+ AZURE_OPENAI_API_KEY=...
106
+ AZURE_OPENAI_ENDPOINT=https://my-resource.openai.azure.com
107
+ AZURE_OPENAI_DEPLOYMENT=my-deployment
108
+
109
+ # Custom OpenAI-compatible endpoint
110
+ AI_PROVIDER=custom
111
+ CUSTOM_API_KEY=...
112
+ CUSTOM_BASE_URL=https://my-endpoint.com/v1
113
+ CUSTOM_MODEL=my-model
114
+ ```
115
+
116
+ Edit `autotest.config.ts` for test execution settings (base URL, browsers, timeouts, healing, etc.). Or use the **Settings** page in Studio to configure everything from the browser.
117
+
118
+ ---
119
+
120
+ ## CLI Commands
121
+
122
+ ### `npx assuremind init`
123
+
124
+ Initialises a project — creates folders, `.env`, config files, and installs Playwright browsers.
125
+
126
+ ```bash
127
+ npx assuremind init
128
+ npx assuremind init --skip-playwright # skip browser installation
129
+ ```
130
+
131
+ ### `npx assuremind studio`
132
+
133
+ Starts the web UI at `http://localhost:4400`.
134
+
135
+ ```bash
136
+ npx assuremind studio
137
+ npx assuremind studio --port 5000
138
+ npx assuremind studio --no-open # don't auto-open browser
139
+ ```
140
+
141
+ ### `npx assuremind run`
142
+
143
+ Runs tests from the command line. Filters are combinable with AND logic.
144
+
145
+ ```bash
146
+ # Run everything
147
+ npx assuremind run --all
148
+
149
+ # Filter by suite type
150
+ npx assuremind run --type ui
151
+ npx assuremind run --type api
152
+ npx assuremind run --type audit
153
+
154
+ # Run a suite (case-insensitive partial match)
155
+ npx assuremind run --suite "Login Tests"
156
+
157
+ # Run by tag
158
+ npx assuremind run --tag smoke
159
+
160
+ # Run a single test (case-insensitive partial match)
161
+ npx assuremind run --test "User can log in with valid credentials"
162
+
163
+ # Combine filters
164
+ npx assuremind run --type audit --tag regression
165
+ npx assuremind run --suite "Orange HRM" --tag smoke
166
+ npx assuremind run --type audit --test "Login Page"
167
+
168
+ # Device emulation (mobile/tablet)
169
+ npx assuremind run --all --device "iPhone 15 Pro" --browser chromium
170
+ npx assuremind run --tag smoke --device "Pixel 7" --browser chromium
171
+ npx assuremind run --all --device "iPad Pro 11" --browser webkit
172
+
173
+ # With options
174
+ npx assuremind run --all \
175
+ --browser chromium firefox \
176
+ --parallel 4 \
177
+ --headed \
178
+ --ci \
179
+ --no-healing \
180
+ --reporter allure json
181
+ ```
182
+
183
+ | Flag | Description |
184
+ |------|-------------|
185
+ | `--all` | Run every suite |
186
+ | `--type <type>` | Filter by suite type: `ui`, `api`, or `audit` |
187
+ | `--suite <name>` | Run suites whose name contains `<name>` |
188
+ | `--tag <tag>` | Run all cases with this tag |
189
+ | `--test <name>` | Run cases whose name contains `<name>` |
190
+ | `--browser <list>` | Browsers: `chromium` `firefox` `webkit` |
191
+ | `--device <name>` | Emulate a device (e.g. `"iPhone 15 Pro"`, `"Pixel 7"`, `"iPad Pro 11"`) |
192
+ | `--env <name>` | Variable environment: `dev` `staging` `prod` |
193
+ | `--parallel <n>` | Concurrent workers |
194
+ | `--headed` | Show browser window |
195
+ | `--ci` | CI mode — minimal output, exit code reflects pass/fail |
196
+ | `--no-healing` | Disable self-healing for this run |
197
+ | `--reporter <list>` | `allure` `html` `json` |
198
+
199
+ ### `npx assuremind generate`
200
+
201
+ Generates a test suite from a plain-English user story using AI.
202
+
203
+ ```bash
204
+ npx assuremind generate \
205
+ --story "User logs in with valid credentials and sees the dashboard"
206
+
207
+ npx assuremind generate \
208
+ --story-file ./stories/checkout.txt \
209
+ --suite "Checkout Flow" \
210
+ --output ./tests
211
+ ```
212
+
213
+ ### `npx assuremind apply-healing`
214
+
215
+ Reviews and applies self-healing suggestions to test files.
216
+
217
+ ```bash
218
+ # Interactive review
219
+ npx assuremind apply-healing
220
+
221
+ # Accept all pending heals without prompting
222
+ npx assuremind apply-healing --yes
223
+
224
+ # Load from a specific report file
225
+ npx assuremind apply-healing --from results/healing/healing-report-<runId>.json
226
+ ```
227
+
228
+ ### `npx assuremind validate`
229
+
230
+ Validates your config, environment variables, and test files.
231
+
232
+ ### `npx assuremind doctor`
233
+
234
+ Checks system requirements, AI provider connectivity, and configuration health.
235
+
236
+ ---
237
+
238
+ ## Project Structure
239
+
240
+ After `init`, your project looks like:
241
+
242
+ ```
243
+ my-project/
244
+ ├── autotest.config.ts # TypeScript config (human-readable)
245
+ ├── autotest.config.json # JSON config (used at runtime)
246
+ ├── .env # AI provider credentials (gitignored)
247
+ ├── tests/
248
+ │ ├── <suite-id>/ # UI and API suites
249
+ │ │ ├── suite.json
250
+ │ │ └── <case-id>.test.json
251
+ │ └── audit/ # Audit suites (Lighthouse)
252
+ │ ├── suite.json
253
+ │ └── <case-id>.test.json
254
+ ├── variables/
255
+ │ ├── global.json # Available in all tests as {{VAR_NAME}}
256
+ │ ├── dev.env.json
257
+ │ ├── staging.env.json
258
+ │ └── prod.env.json
259
+ ├── results/
260
+ │ ├── runs/ # Run result JSON files
261
+ │ ├── healing/ # Self-healing event store
262
+ │ ├── screenshots/
263
+ │ ├── videos/
264
+ │ ├── traces/
265
+ │ └── reports/
266
+ └── fixtures/
267
+ ├── auth/
268
+ └── data/
269
+ ```
270
+
271
+ ---
272
+
273
+ ## Studio UI
274
+
275
+ Open `http://localhost:4400` after running `npx assuremind studio`.
276
+
277
+ | Page | Description |
278
+ |------|-------------|
279
+ | **Dashboard** | Run health overview, live progress, recent results |
280
+ | **Smart Tests** | Paste a user story or Jira link, AI creates a full test suite |
281
+ | **Test Editor** | 3-level editor: suites → cases → steps, with AI code generation |
282
+ | **Run Config** | Configure and launch runs from the browser |
283
+ | **Reports** | Run history, pass/fail drill-down, Lighthouse score tabs (⚡ Speed, ♿ A11y, 🔍 SEO) for Audit suites, Allure report link |
284
+ | **Variables** | Manage `{{VARIABLE_NAME}}` tokens across all tests |
285
+ | **Self-Healing** | Review and accept/reject AI-generated fixes |
286
+ | **Settings** | Environment management, browsers, healing, capture settings |
287
+ | **Git Control Center** | Branch management, AI commit messages, push/pull, conflict resolution |
288
+
289
+ ---
290
+
291
+ ## Self-Healing
292
+
293
+ When a test step fails, Assuremind attempts up to 6 healing levels before marking the step as failed:
294
+
295
+ | Level | Strategy | AI Cost |
296
+ |-------|----------|---------|
297
+ | 1 | Smart Retry — wait + retry with backoff | None |
298
+ | 2 | AI Regeneration — AI rewrites the Playwright code | Yes |
299
+ | 3 | Multi-Selector — try alternate selectors (ID, text, role, aria) | Yes |
300
+ | 4 | Visual/SoM — screenshot + AI visual analysis | Yes |
301
+ | 5 | Decompose — break step into smaller sub-actions | Yes |
302
+ | 6 | Manual — flag for human review | None |
303
+
304
+ AI healing costs are tracked against a configurable daily budget (`healing.dailyBudget` in USD). Healed steps are saved as **pending events** for your review — run `npx assuremind apply-healing` or visit the Self-Healing page in Studio to accept or reject each fix.
305
+
306
+ ---
307
+
308
+ ## Variables
309
+
310
+ Use `{{VARIABLE_NAME}}` tokens in step instructions. Variables are resolved at run time from your variable files:
311
+
312
+ ```json
313
+ // variables/global.json
314
+ {
315
+ "BASE_URL": "http://localhost:3000",
316
+ "ADMIN_EMAIL": "admin@example.com"
317
+ }
318
+ ```
319
+
320
+ Step instruction: `Navigate to {{BASE_URL}}/login and enter {{ADMIN_EMAIL}}`
321
+
322
+ Secret variables (marked with `"secret": true`) are masked in logs and reports.
323
+
324
+ ---
325
+
326
+ ## CI/CD Integration
327
+
328
+ ```yaml
329
+ # GitHub Actions example
330
+ - name: Run tests
331
+ env:
332
+ AI_PROVIDER: anthropic
333
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
334
+ run: |
335
+ npx assuremind run --all --ci --no-healing
336
+ ```
337
+
338
+ Exit code `0` = all tests passed, `1` = at least one test failed.
339
+
340
+ ---
341
+
342
+ ## Security
343
+
344
+ - Generated Playwright code runs inside a sandboxed `new Function('page', 'context', 'expect', code)` — only `page`, `context`, and `expect` are available
345
+ - Secret variables are never sent to AI providers, never logged, never included in reports
346
+ - All generated code is validated against a forbidden-pattern list before execution
347
+ - Atomic file writes prevent partially-written results on crash
348
+
349
+ ---
350
+
351
+ ## Tiered AI Mode (Cost Optimisation)
352
+
353
+ Enable tiered mode to use a cheaper/faster model for simple steps and a more capable model for complex ones:
354
+
355
+ ```bash
356
+ AI_TIERED_ENABLED=true
357
+ AI_TIERED_FAST_PROVIDER=groq
358
+ AI_TIERED_FAST_MODEL=llama-3.1-8b-instant
359
+ ```
360
+
361
+ The smart router also applies (in order): template pattern matching → code cache lookup → batch generation → fast model → primary model.
362
+
363
+ ---
364
+
365
+ ## License
366
+
367
+ MIT