# cv-superding/dsh-deepseek-web-login architecture

> Architecture diagram of the GitHub repository cv-superding/dsh-deepseek-web-login, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cv-superding/dsh-deepseek-web-login
- Repository: https://github.com/cv-superding/dsh-deepseek-web-login

## Overview

This repository is a DSH provider plugin that uses an existing DeepSeek web login rather than an API key. Its main workflow is: capture or supply credentials, register the provider with DSH, translate model requests into the web protocol, and return streamed text or tool calls to the agent. The README also documents image uploads and a settings panel for accounts, models, usage, context, transport, and diagnostics. Some subsystem connections are documented rather than visible in sampled implementation excerpts; those relationships cite the README or are omitted where evidence is insufficient.

Main entry points: [`src/index.ts`](https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/index.ts) (Plugin Host), [`src/adapter.ts`](https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/adapter.ts) (LLM Adapter), [`src/auth.ts`](https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/auth.ts) (Credential Facade), [`src/webapi.ts`](https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/webapi.ts) (Web API Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_integration["DSH Integration"]
  node_host["Plugin Host<br/>[index.ts]"]
  node_settings["Settings Panel<br/>[index.ts]"]
end

subgraph group_identity["Login and Accounts"]
  node_login["Login Flows<br/>[login.ts]"]
  node_browser["Browser Login<br/>[browser-login.ts]"]
  node_auth["Credential Facade<br/>[auth.ts]"]
  node_accounts[("Account Store<br/>[accounts.ts]")]
  node_account_add["Account Import<br/>[account-add.ts]"]
  node_cookies["Cookie Metadata<br/>[cookies.ts]"]
  node_paths["State Paths<br/>[paths.ts]"]
end

subgraph group_model["Model Runtime"]
  node_adapter["LLM Adapter<br/>[adapter.ts]"]
  node_protocol["Prompt and Tools<br/>[protocol.ts]"]
  node_context["Context Feed<br/>[context-feed.ts]"]
  node_webapi["Web API Client<br/>[webapi.ts]"]
  node_transport["HTTP Transport<br/>[transport.ts]"]
end

subgraph group_operations["Operations and Settings"]
  node_gate["Request Gate<br/>[gate.ts]"]
  node_auto_switch["Account Switching<br/>[auto-switch.ts]"]
  node_probe["Connectivity Probe<br/>[probe.ts]"]
  node_usage["Usage Tracking<br/>[usage.ts]"]
  node_ledger[("Call Ledger<br/>[ledger.ts]")]
  node_diagnostics["Network Diagnostics<br/>[net-diagnostics.ts]"]
end

node_user(("Plugin User"))
node_dsh(("DSH Agent"))
node_deepseek(("DeepSeek Web"))

node_user -->|"configures"| node_settings
node_settings -->|"calls host API"| node_host
node_host -->|"registers provider"| node_adapter
node_dsh -->|"invokes provider"| node_host
node_user -->|"starts login"| node_login
node_login -->|"starts browser flow"| node_browser
node_browser -->|"saves credentials"| node_auth
node_login -->|"manages credentials"| node_auth
node_auth -->|"reads and writes"| node_accounts
node_accounts -->|"uses state path"| node_paths
node_auth -->|"uses cookie metadata"| node_cookies
node_account_add -->|"adds accounts"| node_accounts
node_account_add -->|"uses credential facade"| node_auth
node_adapter -->|"gets credentials"| node_auth
node_adapter -->|"serializes requests"| node_protocol
node_adapter -->|"selects context feed"| node_context
node_adapter -->|"limits requests"| node_gate
node_adapter -->|"calls web API"| node_webapi
node_webapi -->|"sends web requests"| node_deepseek
node_webapi -.->|"uses transport"| node_transport
node_webapi -->|"uploads images"| node_deepseek
node_adapter -->|"returns stream and tools"| node_dsh
node_host -->|"runs connectivity checks"| node_probe
node_host -->|"runs network checks"| node_diagnostics
node_host -->|"records calls"| node_ledger
node_host -->|"serves usage features"| node_usage
node_host -->|"provides account switching"| node_auto_switch
node_host -->|"serves settings UI"| node_settings

click node_host "https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/index.ts"
click node_settings "https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/client/index.ts"
click node_login "https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/login.ts"
click node_browser "https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/browser-login.ts"
click node_auth "https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/auth.ts"
click node_accounts "https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/accounts.ts"
click node_account_add "https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/account-add.ts"
click node_cookies "https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/cookies.ts"
click node_paths "https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/paths.ts"
click node_adapter "https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/adapter.ts"
click node_protocol "https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/protocol.ts"
click node_context "https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/context-feed.ts"
click node_webapi "https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/webapi.ts"
click node_transport "https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/transport.ts"
click node_gate "https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/gate.ts"
click node_auto_switch "https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/auto-switch.ts"
click node_probe "https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/probe.ts"
click node_usage "https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/usage.ts"
click node_ledger "https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/ledger.ts"
click node_diagnostics "https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/net-diagnostics.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_host,node_settings,node_user toneBlue
class node_login,node_browser,node_auth,node_accounts,node_account_add,node_cookies,node_paths toneAmber
class node_adapter,node_protocol,node_context,node_webapi,node_transport toneMint
class node_gate,node_auto_switch,node_probe,node_usage,node_ledger,node_diagnostics toneRose
class node_dsh,node_deepseek toneIndigo
```

## Components

### DSH Integration

- [Plugin Host](https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/index.ts): `src/index.ts`
- [Settings Panel](https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/client/index.ts): `src/client/index.ts`

### Login and Accounts

- [Login Flows](https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/login.ts): `src/login.ts`
- [Browser Login](https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/browser-login.ts): `src/browser-login.ts`
- [Credential Facade](https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/auth.ts): `src/auth.ts`
- [Account Store](https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/accounts.ts): `src/accounts.ts`
- [Account Import](https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/account-add.ts): `src/account-add.ts`
- [Cookie Metadata](https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/cookies.ts): `src/cookies.ts`
- [State Paths](https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/paths.ts): `src/paths.ts`

### Model Runtime

- [LLM Adapter](https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/adapter.ts): `src/adapter.ts`
- [Prompt and Tools](https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/protocol.ts): `src/protocol.ts`
- [Context Feed](https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/context-feed.ts): `src/context-feed.ts`
- [Web API Client](https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/webapi.ts): `src/webapi.ts`
- [HTTP Transport](https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/transport.ts): `src/transport.ts`

### Operations and Settings

- [Request Gate](https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/gate.ts): `src/gate.ts`
- [Account Switching](https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/auto-switch.ts): `src/auto-switch.ts`
- [Connectivity Probe](https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/probe.ts): `src/probe.ts`
- [Usage Tracking](https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/usage.ts): `src/usage.ts`
- [Call Ledger](https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/ledger.ts): `src/ledger.ts`
- [Network Diagnostics](https://github.com/cv-superding/dsh-deepseek-web-login/blob/main/src/net-diagnostics.ts): `src/net-diagnostics.ts`

### Other components

- **Plugin User**
- **DSH Agent**
- **DeepSeek Web**

## Connections

- Plugin User → Settings Panel: configures (evidence: `README.md`)
- Settings Panel → Plugin Host: calls host API (evidence: `src/client/index.ts`)
- Plugin Host → LLM Adapter: registers provider (evidence: `README.md`)
- DSH Agent → Plugin Host: invokes provider (evidence: `README.md`)
- Plugin User → Login Flows: starts login (evidence: `README.md`)
- Login Flows → Browser Login: starts browser flow (evidence: `src/login.ts`)
- Browser Login → Credential Facade: saves credentials (evidence: `src/browser-login.ts`)
- Login Flows → Credential Facade: manages credentials (evidence: `src/login.ts`)
- Credential Facade → Account Store: reads and writes (evidence: `src/auth.ts`)
- Account Store → State Paths: uses state path (evidence: `src/accounts.ts`)
- Credential Facade → Cookie Metadata: uses cookie metadata (evidence: `src/auth.ts`)
- Account Import → Account Store: adds accounts (evidence: `src/account-add.ts`)
- Account Import → Credential Facade: uses credential facade (evidence: `src/account-add.ts`)
- LLM Adapter → Credential Facade: gets credentials (evidence: `src/adapter.ts`)
- LLM Adapter → Prompt and Tools: serializes requests (evidence: `src/adapter.ts`)
- LLM Adapter → Context Feed: selects context feed (evidence: `src/adapter.ts`)
- LLM Adapter → Request Gate: limits requests (evidence: `src/adapter.ts`)
- LLM Adapter → Web API Client: calls web API (evidence: `README.md`)
- Web API Client → DeepSeek Web: sends web requests (evidence: `README.md`)
- Web API Client → HTTP Transport: uses transport
- Web API Client → DeepSeek Web: uploads images (evidence: `README.md`)
- LLM Adapter → DSH Agent: returns stream and tools (evidence: `README.md`)
- Plugin Host → Connectivity Probe: runs connectivity checks (evidence: `src/index.ts`)
- Plugin Host → Network Diagnostics: runs network checks (evidence: `src/index.ts`)
- Plugin Host → Call Ledger: records calls (evidence: `src/index.ts`)
- Plugin Host → Usage Tracking: serves usage features (evidence: `README.md`)
- Plugin Host → Account Switching: provides account switching (evidence: `src/index.ts`)
- Plugin Host → Settings Panel: serves settings UI (evidence: `src/client/index.ts`)
