┌───────────────────────────────────────────────────────────────────┐
│ MonoSurf System (v0.4) │
├───────────────────────────────────────────────────────────────────┤
│ │
│ CLI Binary (monosurf) │
│ ├── Command parser + flag handling │
│ ├── Profile management (start/stop/profiles) │
│ ├── Browser discovery (system Chrome, Playwright, Puppeteer) │
│ ├── Auth gate commands (grant/revoke/status) │
│ ├── Site plugin dispatch │
│ ├── Login flow + account detection │
│ └── Browse mode (standalone headless) │
│ │
│ Plugin Engine (lib-monosurf/plugin) │
│ ├── Load JSON from sites/ directory │
│ ├── Domain validation (filename = base_url) │
│ ├── Integrity check (checksum before execution) │
│ ├── Auth gate check before execution │
│ ├── Cookie injection from keychain │
│ ├── Navigate → wait → extract pipeline │
│ ├── Action executor (click/type/sleep/js) │
│ ├── Output formatting (template or generic) │
│ ├── Plugin signing (sign/verify/tamper-detect) │
│ └── SQLite index for site search │
│ │
│ Browser Layer (lib-monosurf/browser) │
│ ├── chromiumoxide — Rust-native CDP client (direct, no subproc) │
│ ├── Session struct with block_on boundary (sync API, async CDP) │
│ ├── Profile system (isolated Chrome per profile) │
│ ├── Browser discovery (5 locations, cross-platform) │
│ ├── Navigate with timeout fallback (goto → JS navigation) │
│ ├── Cookie management via CDP Network domain (incl. HttpOnly) │
│ └── Headless + visible mode │
│ │
│ Auth Gate (lib-auth-gate) │
│ ├── Time-limited scope grants │
│ ├── Gated secret storage (→ lib-secure-storage) │
│ └── Reusable by any Monolex tool │
│ │
│ Secure Storage (lib-secure-storage) │
│ ├── macOS Keychain integration │
│ ├── AES-256-GCM encryption │
│ └── Generic key-value store │
│ │
└───────────────────────────────────────────────────────────────────┘