# Architecture Overview: dsh-super-subscriptions ## 1. System Components ``` src/ ├── index.ts # Cordis Host Plugin Entry & Adapter Registrations ├── types.ts # Common Provider, Session, and Status Types ├── config.ts # Schemastery Config Schema & Defaults ├── core/ │ ├── auth-store.ts # Atomic Token Storage (~/.dsh/plugins/super-subscriptions) │ ├── migration.ts # Route & Session Migration (openai-codex -> codex) │ ├── rpc.ts # Settings RPC Channel Handler │ └── token-manager.ts # Token Lifecycle & Refresh Automation ├── providers/ │ ├── base.ts # Provider Adapter Abstract Contract │ ├── codex/ # ChatGPT (Codex) Provider & Fast Mode │ ├── grok/ # Grok (X Premium) Provider & Tools │ ├── antigravity/ # Google AntiGravity (agy) Process Runner │ ├── claude/ # Claude OAuth & Keychain Bridge │ └── copilot/ # GitHub Copilot Device Flow └── client/ ├── index.ts # Web Client Slot Entry ├── SuperSubscriptionsSettings.tsx # Settings View Component └── locales.ts # i18n Strings (en / zh-TW) ``` ## 2. Configuration Flow 1. Host initializes `apply(ctx, config)`. 2. `config.ts` evaluates defaults: - `providers.chatgpt.enabled = true` - `providers.grok.enabled = true` - `providers.antigravity.enabled = true` (with `permissionMode = 'skip'`) - `providers.claude.enabled = false` - `providers.copilot.enabled = false` - `codexRoute = 'codex'` - `migrateOpenAiCodex = true` 3. If `migrateOpenAiCodex` is active, the migration engine binds an adapter alias so any legacy `openai-codex` invocation transparently resolves to `codex`. 4. Enabled providers instantiate adapters and register to `ctx.llm`. 5. RPC channel `/super-subscriptions-auth` binds to `ctx.connection` (if present) for Web Settings UI communication.