# 0-mkdad/codex-chatgpt-web-multidevice architecture

> Architecture diagram of the GitHub repository 0-mkdad/codex-chatgpt-web-multidevice, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/0-mkdad/codex-chatgpt-web-multidevice
- Repository: https://github.com/0-mkdad/codex-chatgpt-web-multidevice

## Overview

Codex sends Responses API requests to the local runtime, which parses them, prepares a ChatGPT Web turn, drives the browser, and returns the result. The Electron launcher configures that runtime and browser, guides MCP setup, and offers usage and health surfaces. The README documents additional modes and capabilities that are represented at subsystem level; several launcher and runtime internals were not sampled, so their links are limited to documented or indexed relationships.

Main entry points: [`launcher/electron/main.cjs`](https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/launcher/electron/main.cjs) (Launcher controller), [`src/server.ts`](https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/server.ts) (HTTP runtime), [`launcher/src/App.tsx`](https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/launcher/src/App.tsx) (Launcher interface), [`src/adapters/chatgpt-web/index.ts`](https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/adapters/chatgpt-web/index.ts) (Web adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Codex runtime"]
  node_runtime["HTTP runtime<br/>[server.ts]"]
  node_responses["Responses parser<br/>[parser.ts]"]
  node_modelroutes["Model routing"]
  node_config["Runtime configuration<br/>[config.ts]"]
end

subgraph group_web["ChatGPT Web adapter"]
  node_adapter["Web adapter<br/>[index.ts]"]
  node_prompt["Prompt assembly<br/>[prompt.ts]"]
  node_tokens["Token estimation<br/>[token-estimate.ts]"]
  node_turns["Turn coordination<br/>[turn-broker.ts]"]
  node_browserworker["Browser worker<br/>[browser-worker.ts]"]
end

subgraph group_launcher["Desktop launcher"]
  node_launcherui["Launcher interface<br/>[App.tsx]"]
  node_electron["Launcher controller<br/>[main.cjs]"]
  node_browserhost["Embedded browser<br/>[browser-host.cjs]"]
  node_supervisor["Runtime supervisor"]
end

subgraph group_harness["MCP harness"]
  node_tunnel["Outbound tunnel<br/>[tunnel-service.ts]"]
  node_mcp["MCP integration<br/>[mcp-server.ts]"]
end

subgraph group_ops["Usage and diagnostics"]
  node_limitsui["Limits surface<br/>[LimitsSurface.tsx]"]
  node_limits["Usage tracking"]
  node_diagnostics["Health diagnostics<br/>[doctor.ts]"]
end

node_codex(("Codex client"))

node_codex -->|"sends requests"| node_runtime
node_runtime -->|"parses responses"| node_responses
node_runtime -->|"routes turns"| node_adapter
node_runtime -->|"resolves models"| node_modelroutes
node_adapter -->|"builds prompts"| node_prompt
node_prompt -->|"estimates tokens"| node_tokens
node_adapter -->|"coordinates turns"| node_turns
node_turns -->|"dispatches turns"| node_browserworker
node_browserworker -->|"uses browser"| node_browserhost
node_launcherui -->|"requests operations"| node_electron
node_electron -->|"controls runtime"| node_supervisor
node_electron -->|"controls browser"| node_browserhost
node_electron -.->|"configures runtime"| node_config
node_electron -.->|"sets up tunnel"| node_tunnel
node_runtime -.->|"serves MCP tools"| node_mcp
node_launcherui -->|"shows limits"| node_limitsui
node_limitsui -.->|"requests tracking"| node_limits
node_electron -->|"handles limits"| node_limits
node_launcherui -.->|"offers health checks"| node_diagnostics

click node_runtime "https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/server.ts"
click node_responses "https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/responses/parser.ts"
click node_modelroutes "https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/chatgpt-web-models.ts"
click node_adapter "https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/adapters/chatgpt-web/index.ts"
click node_prompt "https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/adapters/chatgpt-web/prompt.ts"
click node_tokens "https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/lib/token-estimate.ts"
click node_turns "https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/adapters/chatgpt-web/turn-broker.ts"
click node_browserworker "https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/adapters/chatgpt-web/browser-worker.ts"
click node_launcherui "https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/launcher/src/App.tsx"
click node_electron "https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/launcher/electron/main.cjs"
click node_browserhost "https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/launcher/electron/browser-host.cjs"
click node_supervisor "https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/launcher/electron/runtime-supervisor.cjs"
click node_config "https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/config.ts"
click node_tunnel "https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/tunnel-service.ts"
click node_mcp "https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/adapters/chatgpt-web/mcp-server.ts"
click node_limitsui "https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/launcher/src/LimitsSurface.tsx"
click node_limits "https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/launcher/electron/limits-controller.cjs"
click node_diagnostics "https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/doctor.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_runtime,node_responses,node_modelroutes,node_config,node_codex toneBlue
class node_adapter,node_prompt,node_tokens,node_turns,node_browserworker toneAmber
class node_launcherui,node_electron,node_browserhost,node_supervisor toneMint
class node_tunnel,node_mcp toneRose
class node_limitsui,node_limits,node_diagnostics toneIndigo
```

## Components

### Codex runtime

- [HTTP runtime](https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/server.ts): `src/server.ts`
- [Responses parser](https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/responses/parser.ts): `src/responses/parser.ts`
- [Model routing](https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/chatgpt-web-models.ts): `src/chatgpt-web-models.ts`
- [Runtime configuration](https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/config.ts): `src/config.ts`

### ChatGPT Web adapter

- [Web adapter](https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/adapters/chatgpt-web/index.ts): `src/adapters/chatgpt-web/index.ts`
- [Prompt assembly](https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/adapters/chatgpt-web/prompt.ts): `src/adapters/chatgpt-web/prompt.ts`
- [Token estimation](https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/lib/token-estimate.ts): `src/lib/token-estimate.ts`
- [Turn coordination](https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/adapters/chatgpt-web/turn-broker.ts): `src/adapters/chatgpt-web/turn-broker.ts`
- [Browser worker](https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/adapters/chatgpt-web/browser-worker.ts): `src/adapters/chatgpt-web/browser-worker.ts`

### Desktop launcher

- [Launcher interface](https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/launcher/src/App.tsx): `launcher/src/App.tsx`
- [Launcher controller](https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/launcher/electron/main.cjs): `launcher/electron/main.cjs`
- [Embedded browser](https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/launcher/electron/browser-host.cjs): `launcher/electron/browser-host.cjs`
- [Runtime supervisor](https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/launcher/electron/runtime-supervisor.cjs): `launcher/electron/runtime-supervisor.cjs`

### MCP harness

- [Outbound tunnel](https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/tunnel-service.ts): `src/tunnel-service.ts`
- [MCP integration](https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/adapters/chatgpt-web/mcp-server.ts): `src/adapters/chatgpt-web/mcp-server.ts`

### Usage and diagnostics

- [Limits surface](https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/launcher/src/LimitsSurface.tsx): `launcher/src/LimitsSurface.tsx`
- [Usage tracking](https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/launcher/electron/limits-controller.cjs): `launcher/electron/limits-controller.cjs`
- [Health diagnostics](https://github.com/0-mkdad/codex-chatgpt-web-multidevice/blob/main/src/doctor.ts): `src/doctor.ts`

### Other components

- **Codex client**

## Connections

- Codex client → HTTP runtime: sends requests (evidence: `README.md`)
- HTTP runtime → Responses parser: parses responses (evidence: `src/server.ts`)
- HTTP runtime → Web adapter: routes turns (evidence: `src/server.ts`)
- HTTP runtime → Model routing: resolves models (evidence: `src/server.ts`)
- Web adapter → Prompt assembly: builds prompts (evidence: `src/adapters/chatgpt-web/index.ts`)
- Prompt assembly → Token estimation: estimates tokens (evidence: `src/adapters/chatgpt-web/prompt.ts`)
- Web adapter → Turn coordination: coordinates turns (evidence: `src/adapters/chatgpt-web/index.ts`)
- Turn coordination → Browser worker: dispatches turns (evidence: `src/adapters/chatgpt-web/turn-broker.ts`)
- Browser worker → Embedded browser: uses browser (evidence: `src/adapters/chatgpt-web/browser-worker.ts`)
- Launcher interface → Launcher controller: requests operations (evidence: `launcher/src/App.tsx`)
- Launcher controller → Runtime supervisor: controls runtime (evidence: `launcher/electron/main.cjs`)
- Launcher controller → Embedded browser: controls browser (evidence: `launcher/electron/main.cjs`)
- Launcher controller → Runtime configuration: configures runtime (evidence: `README.md`)
- Launcher controller → Outbound tunnel: sets up tunnel (evidence: `README.md`)
- HTTP runtime → MCP integration: serves MCP tools (evidence: `README.md`)
- Launcher interface → Limits surface: shows limits (evidence: `launcher/src/App.tsx`)
- Limits surface → Usage tracking: requests tracking
- Launcher controller → Usage tracking: handles limits (evidence: `launcher/electron/main.cjs`)
- Launcher interface → Health diagnostics: offers health checks (evidence: `README.md`)
