# focuxdot/wokey-provider-node architecture

> Architecture diagram of the GitHub repository focuxdot/wokey-provider-node, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/focuxdot/wokey-provider-node
- Repository: https://github.com/focuxdot/wokey-provider-node

## Overview

Provider Node is a local onboarding console and restricted outbound relay, not the platform’s routing or billing engine. The main workflow is user setup and node binding, followed by credential authorization/import; the node then maintains an outbound Platform connection and relays requested traffic to approved vendor hosts. The graph also shows local configuration, diagnostics, Jimeng operations and runtime updates. Some subsystem links rely on explicit README descriptions or SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`src/provider-node/server.ts`](https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/server.ts) (Console and API server), [`src/provider-node/bridge.ts`](https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/bridge.ts) (Platform WebSocket bridge), [`src/provider-node/official-exit.ts`](https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/official-exit.ts) (Official exit tunnels), [`src/provider-node/local-auth-detect.ts`](https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/local-auth-detect.ts) (Local auth detection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_onboarding["Onboarding and Console"]
  node_console["Local console<br/>[app.js]"]
  node_server["Console and API server<br/>[server.ts]"]
  node_auth_detect["Local auth detection"]
  node_claude_auth["Claude credentials"]
  node_codex_auth["Codex auth import<br/>[codex-auth-json.ts]"]
  node_manual_oauth["Manual OAuth tokens"]
  node_device_poller["Device authorization"]
  node_jimeng_auth["Jimeng authorization<br/>[jimeng-auth.ts]"]
end

subgraph group_connection["Platform Connection"]
  node_bridge["Platform WebSocket bridge<br/>[bridge.ts]"]
  node_protocol["Control protocol<br/>[protocol.ts]"]
  node_scheduler["WebSocket send scheduler"]
end

subgraph group_egress["Restricted Egress"]
  node_official_exit["Official exit tunnels<br/>[official-exit.ts]"]
  node_binary["Exit frame codec"]
  node_allowlist["Vendor host allowlist"]
  node_jimeng_video["Jimeng video tasks<br/>[jimeng-video.ts]"]
end

subgraph group_runtime["Local Runtime"]
  node_config[("Encrypted configuration<br/>[config.ts]")]
  node_upgrade["Automatic upgrades<br/>[auto-upgrade.ts]"]
  node_macos_update["macOS runtime updater"]
  node_risk["Risk and health state<br/>[risk.ts]"]
end

node_user(("Node operator"))
node_platform["Wokey Platform"]
node_vendor["Official vendor hosts"]

node_user -->|"uses locally"| node_console
node_console -->|"calls local API"| node_server
node_server -->|"loads and persists"| node_config
node_server -->|"detects credentials"| node_auth_detect
node_auth_detect -->|"checks Claude"| node_claude_auth
node_auth_detect -->|"checks Codex"| node_codex_auth
node_server -->|"accepts token import"| node_manual_oauth
node_server -.->|"supports device flows"| node_device_poller
node_server -->|"starts authorization"| node_jimeng_auth
node_server -->|"handles task routes"| node_jimeng_video
node_server -->|"starts bridge"| node_bridge
node_bridge -->|"connects outbound"| node_platform
node_bridge -->|"exchanges control messages"| node_protocol
node_bridge -->|"schedules sends"| node_scheduler
node_bridge -->|"dispatches exit traffic"| node_official_exit
node_official_exit -->|"decodes frames"| node_binary
node_official_exit -->|"enforces hosts"| node_allowlist
node_official_exit -->|"relays TCP bytes"| node_vendor
node_jimeng_video -.->|"uses exit path"| node_official_exit
node_server -->|"reports upgrade state"| node_upgrade
node_upgrade -.->|"uses runtime updater"| node_macos_update
node_bridge -->|"checks relay readiness"| node_risk
node_platform -->|"requests outbound sessions"| node_bridge

click node_console "https://github.com/focuxdot/wokey-provider-node/blob/main/web/console/app.js"
click node_server "https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/server.ts"
click node_config "https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/config.ts"
click node_auth_detect "https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/local-auth-detect.ts"
click node_claude_auth "https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/claude-code-auth.ts"
click node_codex_auth "https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/codex-auth-json.ts"
click node_manual_oauth "https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/manual-oauth-token.ts"
click node_device_poller "https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/bounded-device-poller.ts"
click node_bridge "https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/bridge.ts"
click node_protocol "https://github.com/focuxdot/wokey-provider-node/blob/main/src/shared/protocol.ts"
click node_scheduler "https://github.com/focuxdot/wokey-provider-node/blob/main/src/shared/websocket-send-scheduler.ts"
click node_official_exit "https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/official-exit.ts"
click node_binary "https://github.com/focuxdot/wokey-provider-node/blob/main/src/shared/official-exit-binary.ts"
click node_allowlist "https://github.com/focuxdot/wokey-provider-node/blob/main/src/shared/official-exit-vendors.ts"
click node_jimeng_auth "https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/jimeng-auth.ts"
click node_jimeng_video "https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/jimeng-video.ts"
click node_upgrade "https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/auto-upgrade.ts"
click node_macos_update "https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/macos-runtime-updater.ts"
click node_risk "https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/risk.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_console,node_server,node_auth_detect,node_claude_auth,node_codex_auth,node_manual_oauth,node_device_poller,node_jimeng_auth toneBlue
class node_bridge,node_protocol,node_scheduler toneAmber
class node_official_exit,node_binary,node_allowlist,node_jimeng_video toneMint
class node_config,node_upgrade,node_macos_update,node_risk toneRose
class node_user,node_platform,node_vendor toneIndigo
```

## Components

### Onboarding and Console

- [Local console](https://github.com/focuxdot/wokey-provider-node/blob/main/web/console/app.js): `web/console/app.js`
- [Console and API server](https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/server.ts): `src/provider-node/server.ts`
- [Local auth detection](https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/local-auth-detect.ts): `src/provider-node/local-auth-detect.ts`
- [Claude credentials](https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/claude-code-auth.ts): `src/provider-node/claude-code-auth.ts`
- [Codex auth import](https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/codex-auth-json.ts): `src/provider-node/codex-auth-json.ts`
- [Manual OAuth tokens](https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/manual-oauth-token.ts): `src/provider-node/manual-oauth-token.ts`
- [Device authorization](https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/bounded-device-poller.ts): `src/provider-node/bounded-device-poller.ts`
- [Jimeng authorization](https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/jimeng-auth.ts): `src/provider-node/jimeng-auth.ts`

### Platform Connection

- [Platform WebSocket bridge](https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/bridge.ts): `src/provider-node/bridge.ts`
- [Control protocol](https://github.com/focuxdot/wokey-provider-node/blob/main/src/shared/protocol.ts): `src/shared/protocol.ts`
- [WebSocket send scheduler](https://github.com/focuxdot/wokey-provider-node/blob/main/src/shared/websocket-send-scheduler.ts): `src/shared/websocket-send-scheduler.ts`

### Restricted Egress

- [Official exit tunnels](https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/official-exit.ts): `src/provider-node/official-exit.ts`
- [Exit frame codec](https://github.com/focuxdot/wokey-provider-node/blob/main/src/shared/official-exit-binary.ts): `src/shared/official-exit-binary.ts`
- [Vendor host allowlist](https://github.com/focuxdot/wokey-provider-node/blob/main/src/shared/official-exit-vendors.ts): `src/shared/official-exit-vendors.ts`
- [Jimeng video tasks](https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/jimeng-video.ts): `src/provider-node/jimeng-video.ts`

### Local Runtime

- [Encrypted configuration](https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/config.ts): `src/provider-node/config.ts`
- [Automatic upgrades](https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/auto-upgrade.ts): `src/provider-node/auto-upgrade.ts`
- [macOS runtime updater](https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/macos-runtime-updater.ts): `src/provider-node/macos-runtime-updater.ts`
- [Risk and health state](https://github.com/focuxdot/wokey-provider-node/blob/main/src/provider-node/risk.ts): `src/provider-node/risk.ts`

### Other components

- **Node operator**
- **Wokey Platform**
- **Official vendor hosts**

## Connections

- Node operator → Local console: uses locally (evidence: `README.md`)
- Local console → Console and API server: calls local API (evidence: `src/provider-node/server.ts`)
- Console and API server → Encrypted configuration: loads and persists (evidence: `src/provider-node/config.ts`)
- Console and API server → Local auth detection: detects credentials (evidence: `src/provider-node/server.ts`)
- Local auth detection → Claude credentials: checks Claude (evidence: `src/provider-node/local-auth-detect.ts`)
- Local auth detection → Codex auth import: checks Codex (evidence: `src/provider-node/local-auth-detect.ts`)
- Console and API server → Manual OAuth tokens: accepts token import (evidence: `src/provider-node/server.ts`)
- Console and API server → Device authorization: supports device flows
- Console and API server → Jimeng authorization: starts authorization (evidence: `src/provider-node/server.ts`)
- Console and API server → Jimeng video tasks: handles task routes (evidence: `src/provider-node/server.ts`)
- Console and API server → Platform WebSocket bridge: starts bridge (evidence: `src/provider-node/server.ts`)
- Platform WebSocket bridge → Wokey Platform: connects outbound (evidence: `README.md`)
- Platform WebSocket bridge → Control protocol: exchanges control messages (evidence: `src/provider-node/bridge.ts`)
- Platform WebSocket bridge → WebSocket send scheduler: schedules sends (evidence: `src/provider-node/bridge.ts`)
- Platform WebSocket bridge → Official exit tunnels: dispatches exit traffic (evidence: `src/provider-node/bridge.ts`)
- Official exit tunnels → Exit frame codec: decodes frames (evidence: `src/provider-node/official-exit.ts`)
- Official exit tunnels → Vendor host allowlist: enforces hosts (evidence: `src/provider-node/official-exit.ts`)
- Official exit tunnels → Official vendor hosts: relays TCP bytes (evidence: `README.md`)
- Jimeng video tasks → Official exit tunnels: uses exit path
- Console and API server → Automatic upgrades: reports upgrade state (evidence: `src/provider-node/server.ts`)
- Automatic upgrades → macOS runtime updater: uses runtime updater
- Platform WebSocket bridge → Risk and health state: checks relay readiness (evidence: `src/provider-node/bridge.ts`)
- Wokey Platform → Platform WebSocket bridge: requests outbound sessions (evidence: `README.md`)
