How runvendo/vendo works
Purpose and entry points
Vendo is a TypeScript monorepo for embedding a guarded, streaming AI customization layer into host products. It extracts host APIs into tools, generates customer-owned UI/apps, and supports approved automations. The default SDK/composition and CLI are packages/vendo/src/index.ts, packages/vendo/src/server.ts, and packages/vendo/src/cli.ts; executable entry is packages/vendo/bin/vendo.mjs. Thin compatibility alias: packages/vendoai/src/index.ts.
Core contracts and UI document pipeline
@vendoai/core defines shared identity, principals, grants, tool envelopes, app documents, and generated UI tree/wire formats. The v2 compiler and patch/shape validation make generated UI structured rather than arbitrary frontend code.
• packages/core/src/app-document.ts
• packages/core/src/tree-v2.ts
• packages/core/src/wire-v2/compile.ts
Generated trees are rendered by the React UI package using a component registry and bindings. Untrusted/generated components can run in a jailed iframe runtime; host-mounted/in-client views are a distinct boundary.
• packages/ui/src/tree/renderer-v2.tsx
• packages/ui/src/tree/jail/JailedComponent.tsx
• packages/ui/src/kit/registry.ts
Host integration and tool extraction
The CLI initializes and maintains .vendo/ host metadata, scans APIs/routes and schemas, extracts theme/semantics, and proposes reviewable wiring. Sync adapters support OpenAPI, route scans, GraphQL, tRPC, and server actions.
• packages/vendo/src/cli/init.ts
• packages/vendo/src/cli/sync.ts
• packages/actions/src/sync/route-scan.ts
At runtime, Actions normalizes extracted host API, connector, and compound tools into a searchable registry. Auth presets and host-file adapters bridge host identity and execution environments, including edge-oriented variants.
• packages/actions/src/runtime/registry.ts
• packages/actions/src/connectors/mcp.ts
• packages/actions/src/presets/index.ts
Agent execution and safety choke point
The Agent package owns conversation threads, context packing, model streaming, tool selection, and iterative execution. It is model-provider-oriented rather than tied to a specific agent framework.
• packages/agent/src/agent.ts
• packages/agent/src/runner.ts
• packages/agent/src/threads.ts
Every consequential tool/app action crosses Guard, which evaluates policy and risk, creates single-use approval flows, enforces grants/breakers, and writes audit outcomes. This separates model intent from authorized execution.
• packages/guard/src/guard.ts
• packages/guard/src/policy.ts
• packages/guard/src/judge.ts
Apps, sandboxing, and automations
Apps turns agent output into versioned app records and machine lifecycles: generation/edit pipeline, run/ship diffs, persistence, pins, and sandbox adapters. The sandbox/box layer is the escalation boundary for server-capable generated behavior.
• packages/apps/src/engine.ts
• packages/apps/src/machine-lifecycle.ts
• packages/apps/src/sandbox.ts
Automations ingests schedules, host events, and external triggers, then runs app-bound work through the same guarded path; it maintains engine-level run behavior rather than bypassing safety.
• packages/automations/src/engine.ts
• packages/apps/src/schedules.ts
• packages/apps/src/automation-plan.ts
Persistence, external surfaces, and runtime
Store provides the durable isolation boundary for tenants/principals, threads, grants, app rows, audit, blobs, encrypted secrets, retention, and compare-and-swap semantics. It supports PGlite default/local operation and Postgres production backends.
• packages/store/src/store.ts
• packages/store/src/db.ts
• packages/store/src/secrets.ts
Optional external integrations include Composio connectors, MCP exposure with OAuth/consent, cloud-gated services, and anonymous opt-out telemetry. The React UI supplies headless hooks plus optional branded chrome, voice, approvals, and connection surfaces.
• packages/mcp/src/door.ts
• packages/vendo/src/cloud-tools.ts
• packages/vendo-telemetry/src/client.ts
Reference hosts and validation ecosystem
Next.js accounting and banking demos are end-to-end reference integrations, each combining host APIs, local domain data, Vendo routes, React embedding, and optional Supabase/auth seams. An Express/Vite corpus host verifies framework portability. Corpus, fixtures, and benchmarks exercise conformance, installation, UI parity, security, and live-provider paths.
• apps/demo-bank/src/app/api/vendo/[...vendo]/route.ts
• apps/demo-accounting/src/vendo/server.ts
• corpus/hosts/express-host/src/server/vendo.ts
Main entry points: guard.ts Guard · runner.ts Agent runner · engine.ts Apps engine · registry.ts Tool registry
Components 20
Host Integration
- Vendo SDK / server · Default host-facing composition API.
packages/vendo/src/index.ts - Vendo CLI · Initializes .vendo and proposes host wiring.
packages/vendo/src/cli.ts - API sync · Scans routes, schemas, themes, and host semantics.
packages/vendo/src/cli/sync.ts - Route scanner
packages/actions/src/sync/route-scan.ts
Generation & UI
- Core contracts · Identity, grants, tools, app documents, and UI wire formats.
packages/core/src/app-document.ts - UI v2 compiler · Compiles and validates structured generated UI.
packages/core/src/wire-v2/compile.ts - React tree renderer · Renders generated trees through registered components and bindings.
packages/ui/src/tree/renderer-v2.tsx - Jailed components · Isolation boundary for untrusted generated components.
packages/ui/src/tree/jail/JailedComponent.tsx
Guarded Execution
- Tool registry · Normalizes host APIs, connectors, and compound tools into searchable tools.
packages/actions/src/runtime/registry.ts - Connectors & presets · MCP connectors plus identity and execution-environment presets.
packages/actions/src/connectors/mcp.ts - Agent runner · Packs context, streams models, selects tools, and iterates execution.
packages/agent/src/runner.ts - Conversation threads
packages/agent/src/threads.ts - Guard · Separates model intent from approved execution and records outcomes.
packages/guard/src/guard.ts - Policy & risk judge · Evaluates risk, grants, approvals, and breakers.
packages/guard/src/judge.ts - Apps engine · Versions generated apps and manages generation, edit, run, and ship lifecycles.
packages/apps/src/engine.ts - App sandbox · Escalation boundary for generated server behavior.
packages/apps/src/sandbox.ts - Automations engine · Runs schedules, host events, and external triggers through Guard.
packages/automations/src/engine.ts
Persistence & Surfaces
- Tenant store · Isolated persistence for principals, threads, grants, apps, audit, blobs, and secrets.
packages/store/src/store.ts - MCP door · OAuth- and consent-gated MCP exposure.
packages/mcp/src/door.ts - Opt-out telemetry
packages/vendo-telemetry/src/client.ts
Connections 24
- Vendo SDK / server → Agent runner: composes runtime
- Vendo SDK / server → React tree renderer: embeds UI
- Vendo CLI → API sync: runs
- API sync → Route scanner: uses adapter
- API sync → Tool registry: extracts tools
- Core contracts → UI v2 compiler: defines documents
- UI v2 compiler → React tree renderer: compiled tree
- React tree renderer → Jailed components: renders untrusted components
- Connectors & presets → Tool registry: contributes tools
- Conversation threads → Agent runner: context
- Tool registry → Agent runner: searchable tools
- Agent runner → Guard: proposed actions
- Guard → Policy & risk judge: evaluates
- Policy & risk judge → Guard: decision / approval
- Guard → Tool registry: authorized execution
- Agent runner → Apps engine: generated app output
- Apps engine → App sandbox: server-capable runs
- Automations engine → Guard: triggered work
- Apps engine → Automations engine: app-bound plans
- Agent runner → Tenant store: threads and context
- Guard → Tenant store: grants and audit
- Apps engine → Tenant store: app records and versions
- MCP door → Guard: consented requests
- Vendo SDK / server → Opt-out telemetry: optional events