Mission Control docs
Technical Reference

Connection Wizard: Technical Reference

Implementation details for the 8-step connection wizard, state persistence, and provider key management.

Connection Wizard: Technical Reference

Key files

PathPurpose
src/app/dashboard/connect/page.tsxMain wizard page — renders step components
src/components/wizard/Per-step components (Step1Welcome, Step2Gateway, …)
src/app/api/gateway/ping/route.tsPOST — validates gateway connectivity
src/app/api/wizard/state/route.tsGET/POST — persist + retrieve wizard completion state
src/app/api/aipipe/proxy/chat/route.tsPOST — AiPipe proxy wired in Step 4

How state is stored

Wizard completion state is stored per-tenant in the database. The wizard_state column in the tenants table tracks which steps are complete as a JSON bitmask or step index. Step skips are allowed for Steps 4–8.

// Typical shape stored in tenants.wizard_state
{
  completedSteps: [1, 2, 3, 4],
  gatewayUrl: "http://localhost:18789",
  smartRoutingEnabled: true
}

How gateway checks work

POST /api/gateway/ping — forwards a health-check to the user-supplied gateway URL.

// Request
{ gatewayUrl: string }

// Response 200
{ ok: true, latencyMs: number }

// Response 400/503
{ ok: false, error: string }

The ping endpoint does not store the URL; it only validates reachability. URL is stored client-side until wizard submission.

How provider keys are handled

Step 3 posts keys to POST /api/aipipe/proxy → AiPipe /v1/tenants/{id}/providers. Keys are:

  • Stored in AiPipe's SQLite per-tenant key store
  • Never written to the MC database or logs
  • Scoped per tenant: other tenants cannot access your keys

How Step 6 stores agent roles

Agent roles are stored in the agent_roles table:

CREATE TABLE agent_roles (
  id         serial PRIMARY KEY,
  tenant_id  integer NOT NULL REFERENCES tenants(id),
  agent_name text NOT NULL,
  role       text NOT NULL,
  created_at timestamp DEFAULT now()
);

Roles are surfaced in the Kanban board header tiles and agent stats view.

Wizard steps at a glance

StepIDComponentSkippableStores
1welcomeStep1Welcomenothing
2gatewayStep2GatewayNogateway URL (ping required)
3providersStep3ProvidersNo (≥1 key)AiPipe key store
4routingStep4RoutingYessmartRoutingEnabled flag
5telegramStep5TelegramYesTELEGRAM_BOT_TOKEN, TELEGRAM_CHAT_ID
6agentsStep6AgentsYesagent_roles rows
7notificationsStep7NotificationsYesnotification preferences
8completeStep8Completewizard_state.completedSteps

On this page