docs: refresh architecture and runtime documentation

- align architecture, development, MCP, and scenario docs with current code

- remove obsolete key descriptor document and stale keys/auth references
This commit is contained in:
2026-04-10 20:40:20 +03:00
parent 0e4a2e1819
commit 1627733701
5 changed files with 150 additions and 149 deletions
+35 -35
View File
@@ -1,45 +1,43 @@
# Architecture
```
┌─────────────────────────────────────────┐
Browser (React SPA client/) │
│ │
EnvironmentsPage KeysPage
SessionsPage ScenariosPage
└────────────────────────────────────────┘
│ HTTP REST (:13000)
┌──────────────────────────────────────────────────────
│ Browser (React SPA - client/)
│ Environments Credentials Snippets
│ Sessions Scenarios Runs
└─────────────────────────────┬────────────────────────┘
│ HTTP REST (:13000)
MCP client (AI agent / VS Code Copilot)
│ HTTP /mcp (Streamable MCP)
│ HTTP /mcp (Streamable MCP)
┌──────────────────────────────────────┐
NestJS app (server/src/) │
│ │
McpService all MCP tools │
AuthService login + sessions
SessionService session CRUD
EnvironmentService environment CRUD
BrowserService ad-hoc browsing
CodeExecutorService sandboxed JS
ScenarioService scenario CRUD
ScenarioSchedulerService
│ └─ @Interval(1 s) tick loop │
└──────────────────┬───────────────────┘
│ better-sqlite3 (TypeORM)
data/sessions.db
┌──────────────────────────────────────────────────────
│ NestJS app (server/src/)
│ McpService all MCP tools
SessionService session persistence
SessionContextService live browser contexts
EnvironmentService environment CRUD + import
CredentialService credential CRUD + import
SnippetService snippet CRUD + import
BrowserService ad-hoc open/exec
CodeExecutorService sandboxed JS runtime
│ ScenarioService scenarios/steps/runs CRUD │
│ ScenarioSchedulerService @Interval(1 s) run worker
└───────────────────────┬──────────────────────────────┘
│ better-sqlite3 (TypeORM)
data/sessions.db
```
- **McpService** registers every MCP tool and delegates to domain services.
- **AuthService** — drives a Playwright browser to log in via a key descriptor; saves cookies + localStorage as a `Session`.
- **SessionService** — stores and retrieves saved browser sessions.
- **EnvironmentService** — stores named environments (URL maps) used by auth and scenarios.
- **BrowserService** — ad-hoc, stateless `open_url` / `exec_code` operations outside the scenario scheduler.
- **CodeExecutorService** — compiles and runs user-supplied Playwright JS inside a sandboxed `async` function with `page`, `context`, and `helpers` in scope.
- **ScenarioService** — CRUD for scenarios, steps, runs, and run logs; import/export.
- **ScenarioSchedulerService** — polls for pending step runs every second and executes them. All steps in the same run share **one browser instance** (see [scenario.md](scenario.md)).
- **McpService** registers MCP tools and delegates to session, environment, browser, and scenario services.
- **SessionService** persists session records in SQLite. **SessionContextService** manages live Playwright contexts for open sessions.
- **EnvironmentService**, **CredentialService**, and **SnippetService** provide CRUD plus import/export upserts.
- **BrowserService** handles stateless ad-hoc automation (`/open`, `/exec`) and session-aware browsing.
- **CodeExecutorService** validates and executes user JS with `page`, `context`, and helper APIs.
- **ScenarioService** manages scenarios, steps, credential aliases, runs, logs, and scenario import/export.
- **ScenarioSchedulerService** polls pending runs every second and executes step runs to completion.
## Client (`client/`)
@@ -47,4 +45,6 @@ A React 19 + TypeScript SPA served separately by Vite during development. In Doc
The client calls the server REST endpoints directly — there is no separate BFF layer. Routing uses HashRouter so the Vite proxy and server-side routes are never ambiguous.
The sidebar footer contains the theme switcher and the app version (injected from the workspace root `package.json` at build time).
See [development.md](development.md) for the full client tech stack and directory layout.