How b-nnett/grok-bot-0.18-reconstructed works
Purpose and delivery model
Unofficial reconstruction of Grok Bot 0.18.0 for macOS/Apple Silicon. It rebuilds desktop/runtime control planes from TypeScript while preserving a checksum-pinned upstream renderer and applying a narrow Router-settings patch. Packaging produces a separately identified, ad-hoc-signed app.
• scripts/bootstrap-runtime.mjs
• scripts/package-macos.mjs
• scripts/lib/router-renderer-patch.mjs
Runtime entry points
Electron main owns application lifecycle and desktop services; preload exposes constrained renderer bridges; the coordinator and host run the agent/control plane. A separate daemon supports local execution.
• source/electron-main/main.ts
• source/electron-preload/preload.ts
• source/node-agent-coordinator/main.ts
• source/host/main.ts
• source/local-exec-daemon/main.ts
Desktop boundary and control plane
Renderer calls cross the Electron trust boundary through preload RPC/port bridges into Electron main. Main wires settings, auth/secrets, update policy, box connectivity, coordinator lifecycle, and native integrations; it should remain the authority for privileged OS access.
• source/electron-preload/main-rpc-runtime.ts
• source/electron-preload/coordinator-port-bridge.ts
• source/electron-main/main-edge-wiring.ts
• source/electron-main/coordinator/coordinator-launcher.ts
Renderer surfaces
The shipped renderer is production baseline; frontend/ is a readable partial React/TypeScript reconstruction. Its production bootstrap renders conversation, roster/sidebar, command palette, and Router-related settings through coordinator-facing models.
• frontend/src/main.tsx
• frontend/src/production/bootstrap.tsx
• frontend/src/production/ProductionRenderer.tsx
• frontend/src/recovered/features/conversation/workspace/view.tsx
• frontend/src/recovered/features/settings/overlay/router.ts
Coordinator, gateway, and streaming
The coordinator mediates renderer traffic, host supervision, remote gateway requests/SSE, routed MCP calls, local-exec supervision, and inference dispatch. It is the transport boundary between desktop processes and host execution.
• source/node-agent-coordinator/renderer-port-server.ts
• source/node-agent-coordinator/gateway/gateway-request-dispatcher.ts
• source/node-agent-coordinator/inference-router.ts
• source/node-agent-coordinator/routed-mcp-bridge.ts
Host: durable agent state and turn execution
The host composes extensions around persisted sessions/transcripts, then turns accepted messages into scheduled agent runs. The runner assembles prompts, selects tools, invokes model inference, and emits transcript/tool-result events back through the coordinator. SQLite/blob-backed storage and worker isolation support local durability.
• source/host/host-runner-composition.ts
• source/host/extensions/session/session-materialization.ts
• source/host/extensions/transcript/send-pipeline.ts
• source/host/runner/turn-agent-composition.ts
• source/host/storage/store-db.ts
Inference, tools, sandbox, and external services
Inference can route to Cursor, Claude Code, Codex, or OpenRouter; tool execution supports Grok Bot tools, MCP plugins, shell/files, subagents, and computer use. The default box path is remote; an optional Docker-backed local box runs a host and execution daemon on loopback. OAuth/account sessions, MCP servers/marketplace, provider APIs, Docker, VNC, telemetry/Sentry, and OS notifications are material integrations.
• source/shared/node/inference-router-local.ts
• source/host/extensions/inference/inference-service.ts
• source/host/extensions/mcp/mcp-service.ts
• source/electron-main/box/local-docker-host-connector.ts
• source/host/box/loopback-sand-box.ts
• source/packages/shell-exec/sandbox/sandbox.ts
Main entry points: main.ts Agent coordinator · ProductionRenderer.tsx Production renderer · turn-agent-composition.ts Turn agent runner · main-edge-wiring.ts Main edge wiring
Components 22
Build & Packaging
- Runtime bootstrap · Pins the upstream renderer and applies the Router settings patch.
scripts/bootstrap-runtime.mjs - macOS packager · Produces the separately identified ad-hoc-signed app.
scripts/package-macos.mjs
Desktop Runtime
- Electron main · Owns lifecycle, privileged OS access, desktop services, and control-plane wiring.
source/electron-main/main.ts - Main edge wiring · Connects settings, auth, updates, box connectivity, and native integrations.
source/electron-main/main-edge-wiring.ts - Preload bridge · Exposes constrained renderer RPC and port bridges.
source/electron-preload/preload.ts - Renderer RPC runtime
source/electron-preload/main-rpc-runtime.ts - Coordinator port bridge
source/electron-preload/coordinator-port-bridge.ts
Renderer
- Production renderer · Production bootstrap for conversation, roster, commands, and settings.
frontend/src/production/ProductionRenderer.tsx - Conversation workspace
frontend/src/recovered/features/conversation/workspace/view.tsx - Router settings · Narrowly patched settings surface.
frontend/src/recovered/features/settings/overlay/router.ts
Coordinator & Host
- Agent coordinator · Mediates renderer traffic, host supervision, gateway, MCP, local execution, and inference.
source/node-agent-coordinator/main.ts - Renderer port server
source/node-agent-coordinator/renderer-port-server.ts - Remote gateway dispatcher
source/node-agent-coordinator/gateway/gateway-request-dispatcher.ts - Agent host · Composes session, transcript, inference, and tool extensions.
source/host/main.ts - Message send pipeline · Turns accepted messages into scheduled agent runs.
source/host/extensions/transcript/send-pipeline.ts - Turn agent runner · Builds prompts, selects tools, invokes inference, and emits events.
source/host/runner/turn-agent-composition.ts - Session & transcript store · Persists sessions and transcripts for local durability.
source/host/storage/store-db.ts
Execution & Integrations
- Inference routing · Routes to Cursor, Claude Code, Codex, or OpenRouter.
source/host/extensions/inference/inference-service.ts - MCP & tool service · Supports MCP plugins alongside agent tool execution.
source/host/extensions/mcp/mcp-service.ts - Local Docker box · Connects a loopback host and execution daemon through Docker.
source/electron-main/box/local-docker-host-connector.ts - Local execution daemon
source/local-exec-daemon/main.ts - Shell execution sandbox
source/packages/shell-exec/sandbox/sandbox.ts
Connections 24
- Runtime bootstrap → Production renderer: pins and patches
- Runtime bootstrap → macOS packager: prepares runtime
- macOS packager → Electron main: packages
- Production renderer → Conversation workspace: renders
- Production renderer → Router settings: renders
- Production renderer → Preload bridge: privileged calls
- Preload bridge → Renderer RPC runtime: main RPC
- Renderer RPC runtime → Electron main: crosses trust boundary
- Preload bridge → Coordinator port bridge: coordinator port
- Coordinator port bridge → Renderer port server: connects
- Renderer port server → Agent coordinator: renderer traffic
- Electron main → Main edge wiring: wires services
- Main edge wiring → Agent coordinator: supervises lifecycle
- Agent coordinator → Remote gateway dispatcher: remote requests and SSE
- Agent coordinator → Agent host: supervises
- Agent host → Message send pipeline: accepted messages
- Message send pipeline → Turn agent runner: schedules turns
- Agent host → Session & transcript store: persists state
- Turn agent runner → Inference routing: invokes models
- Turn agent runner → MCP & tool service: selects tools
- Turn agent runner → Agent coordinator: transcript and tool events
- Main edge wiring → Local Docker box: optional local path
- Local Docker box → Local execution daemon: loopback execution
- Local execution daemon → Shell execution sandbox: runs commands