# zhu1090093659/dsh-web-ui architecture

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

- Interactive diagram: https://gitdiagram.com/zhu1090093659/dsh-web-ui
- Repository: https://github.com/zhu1090093659/dsh-web-ui

## Overview

#### Purpose and entry points
This pnpm monorepo supplies independently installable DeepSeek Harness (DSH) `web`-profile plugins, skins, and a marketplace. It extends—not forks—the DSH Web GUI through official profile/plugin mounting. The aggregate installable entry point is `packages/dsh-web-ui-all/src/index.ts`, with its composition declared in `packages/dsh-web-ui-all/aggregate.yml`. Individual plugins expose host and browser entry points through their package-level `src/index.ts` files.

#### Plugin architecture and host/client boundary
Most packages split browser UI under `src/client/` from privileged DSH-host integration, routes, and persistence at package root, `src/host/`, or `src/core/`. Shared mounting, loopback, DSH-home, and client patterns live in `shared/host/mount-once.ts`, `shared/host/loopback.ts`, and `shared/client/sidebar-entry-core.ts`. This boundary is central: React/TSX components invoke local host routes/APIs; host code accesses filesystem, processes, DSH sessions, and network services.

#### Workflow and operations plugins
Task execution is a host-controlled pipeline: board UI → controller/store → DSH-agent execution and cron scheduling → persisted state/status returned to UI. Key paths: `packages/dsh-task-board/src/client/board/TaskBoard.tsx`, `packages/dsh-task-board/src/core/execution.ts`, `packages/dsh-task-board/src/host-service.ts`.
SSH follows the same UI/API/engine separation, with pooled SSH connections supporting PTY, SFTP, tunnels, and clusters: `packages/dsh-ssh/src/client/panel/SshPanel.tsx`, `packages/dsh-ssh/src/engine/connection-pool.ts`, `packages/dsh-ssh/src/routes.ts`.

#### Remote access and recovery
Remote Web UI pairs devices, gates remote API access, and uses SSE with polling fallback. Its protocol boundary is implemented by pairing, channel rules, and mobile RPC/UI: `packages/dsh-remote-web-ui/src/pairing.ts`, `packages/dsh-remote-web-ui/src/remote-channel-rules.ts`, `packages/dsh-remote-web-ui/src/mobile/views/App.tsx`. Optional cloudflared/public tunneling is represented by `packages/dsh-remote-web-ui/src/tunnel.ts`.
Profile repair is a separate transactional recovery subsystem with host agent supervision and a browser console: `packages/dsh-doctor/src/core/transaction.ts`, `packages/dsh-doctor/src/agent/supervisor.ts`, `packages/dsh-doctor/src/client/DoctorRecoveryConsole.tsx`.

#### Content, presentation, and agent augmentation
Skin Center is the sole runtime loader for asset-directory skins. It validates v2 manifests, safely transforms CSS, coordinates preview/apply state, and loads runtime effects: `packages/skins/skin-center/src/routes-v2.ts`, `packages/skins/skin-center/src/core/css-safety/transform.ts`, `packages/skins/skin-center/src/client/runtime/skin-controller.ts`. Skin assets and manifests are data, e.g. `packages/skins/skin-center/skins/blue-fantasy/skin.json`.
Pet behavior is registry/state driven, with browser renderers including optional PixiJS/WebGL Live2D: `packages/dsh-pet/src/registry.ts`, `packages/dsh-pet/src/service.ts`, `packages/dsh-pet/src/client/renderers/live2d/runtime.ts`. Image understanding bridges chat attachments/URLs to configurable OpenAI-compatible vision endpoints: `packages/dsh-tool-describe-image/src/vision-client.ts`, `packages/dsh-tool-describe-image/src/attach-routes.ts`.

#### Marketplace and distribution
The static marketplace is deterministically built from skin, pet, and community manifests into `market/dist/`; its source UI is `market/src/app.js`, and build orchestration is `scripts/market-build`. Cloudflare Worker endpoints provide dynamic likes backed by D1 migrations: `market/worker/src/index.js`, `market/worker/migrations/0001_init.sql`, `market/worker/wrangler.jsonc`. The in-DSH market plugin installs assets/plugins through host routes: `packages/dsh-market/src/core/installer.ts`, `packages/dsh-market/src/routes.ts`.

#### Browser-contained DSH shell
`market/shell/` is a distinct Vite/TypeScript browser runtime used for marketplace try-on/demo functionality. It boots a plugin-capable host, virtual filesystem/network, Node-like shims, shell tooling, WebContainer/Python/V86 guest runtimes, and service-worker support: `market/shell/src/main.ts`, `market/shell/src/host/boot.ts`, `market/shell/src/runtime/webcontainer.ts`, `market/shell/src/runtime/v86.ts`. Built output is deployed beneath `market/dist/tryon/`.

Main entry points: [`market/src/app.js`](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/market/src/app.js) (Marketplace UI), [`scripts/market-build`](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/scripts/market-build) (Catalog build), [`market/shell/src/host/boot.ts`](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/market/shell/src/host/boot.ts) (Shell host boot), [`packages/dsh-web-ui-all/src/index.ts`](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-web-ui-all/src/index.ts) (All-in-one entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_plugins["DSH Web Plugins"]
  node_aggregate["All-in-one entry<br/>aggregate plugin<br/>[index.ts]"]
  node_aggregate_manifest["Aggregate composition<br/>manifest<br/>[aggregate.yml]"]
  node_shared_mounting["Shared host/client patterns<br/>integration primitives<br/>[mount-once.ts]"]
  node_task_board_ui["Task Board UI<br/>React client<br/>[TaskBoard.tsx]"]
  node_task_execution["Task execution<br/>host workflow core<br/>[execution.ts]"]
  node_task_service[("Task host service<br/>host API and state<br/>[host-service.ts]")]
  node_ssh_ui["SSH panel<br/>React client<br/>[SshPanel.tsx]"]
  node_ssh_routes["SSH host routes<br/>host API<br/>[routes.ts]"]
  node_ssh_pool["SSH connection pool<br/>SSH engine<br/>[connection-pool.ts]"]
  node_remote_protocol["Remote pairing and policy<br/>remote protocol<br/>[pairing.ts]"]
  node_remote_mobile["Remote mobile UI<br/>browser client<br/>[App.tsx]"]
  node_remote_tunnel["Public tunnel<br/>optional tunnel<br/>[tunnel.ts]"]
  node_doctor_console["Recovery console<br/>browser client"]
  node_doctor_transaction["Profile repair transaction<br/>recovery core<br/>[transaction.ts]"]
  node_skin_routes["Skin Center routes<br/>host API<br/>[routes-v2.ts]"]
  node_skin_css["Safe CSS transform<br/>skin security core<br/>[transform.ts]"]
  node_skin_runtime["Skin runtime controller<br/>browser runtime<br/>[skin-controller.ts]"]
end

subgraph group_marketplace["Marketplace"]
  node_market_installer["In-DSH installer<br/>market host core<br/>[installer.ts]"]
  node_market_ui["Marketplace UI<br/>static web app<br/>[app.js]"]
  node_market_build["Catalog build<br/>build pipeline"]
  node_market_worker{{"Likes API<br/>Cloudflare Worker<br/>[index.js]"}}
end

subgraph group_shell["Try-on Browser Shell"]
  node_shell_boot["Shell host boot<br/>browser host<br/>[boot.ts]"]
  node_shell_runtimes["Guest runtimes<br/>browser runtimes<br/>[webcontainer.ts]"]
  node_shell_output["Try-on deployment<br/>built static output"]
end

node_aggregate_manifest -->|"declares"| node_aggregate
node_aggregate -->|"mounts via"| node_shared_mounting
node_task_board_ui -->|"local host API"| node_task_service
node_task_service -->|"executes and schedules"| node_task_execution
node_ssh_ui -->|"local host API"| node_ssh_routes
node_ssh_routes -->|"uses"| node_ssh_pool
node_remote_mobile -->|"pairs and RPC"| node_remote_protocol
node_remote_tunnel -.->|"optional exposure"| node_remote_protocol
node_doctor_console -->|"drives recovery"| node_doctor_transaction
node_skin_routes -->|"sanitizes CSS"| node_skin_css
node_skin_runtime -->|"preview/apply API"| node_skin_routes
node_market_build -->|"builds catalog"| node_market_ui
node_market_worker -->|"likes endpoint"| node_market_ui
node_market_ui -->|"installation flow"| node_market_installer
node_shell_boot -->|"hosts"| node_shell_runtimes
node_shell_boot -->|"built to"| node_shell_output
node_market_build -->|"publishes under dist"| node_shell_output

click node_aggregate "https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-web-ui-all/src/index.ts"
click node_aggregate_manifest "https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-web-ui-all/aggregate.yml"
click node_shared_mounting "https://github.com/zhu1090093659/dsh-web-ui/blob/dev/shared/host/mount-once.ts"
click node_task_board_ui "https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-task-board/src/client/board/TaskBoard.tsx"
click node_task_execution "https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-task-board/src/core/execution.ts"
click node_task_service "https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-task-board/src/host-service.ts"
click node_ssh_ui "https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-ssh/src/client/panel/SshPanel.tsx"
click node_ssh_routes "https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-ssh/src/routes.ts"
click node_ssh_pool "https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-ssh/src/engine/connection-pool.ts"
click node_remote_protocol "https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-remote-web-ui/src/pairing.ts"
click node_remote_mobile "https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-remote-web-ui/src/mobile/views/App.tsx"
click node_remote_tunnel "https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-remote-web-ui/src/tunnel.ts"
click node_doctor_console "https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-doctor/src/client/DoctorRecoveryConsole.tsx"
click node_doctor_transaction "https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-doctor/src/core/transaction.ts"
click node_skin_routes "https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/skins/skin-center/src/routes-v2.ts"
click node_skin_css "https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/skins/skin-center/src/core/css-safety/transform.ts"
click node_skin_runtime "https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/skins/skin-center/src/client/runtime/skin-controller.ts"
click node_market_installer "https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-market/src/core/installer.ts"
click node_market_ui "https://github.com/zhu1090093659/dsh-web-ui/blob/dev/market/src/app.js"
click node_market_build "https://github.com/zhu1090093659/dsh-web-ui/blob/dev/scripts/market-build"
click node_market_worker "https://github.com/zhu1090093659/dsh-web-ui/blob/dev/market/worker/src/index.js"
click node_shell_boot "https://github.com/zhu1090093659/dsh-web-ui/blob/dev/market/shell/src/host/boot.ts"
click node_shell_runtimes "https://github.com/zhu1090093659/dsh-web-ui/blob/dev/market/shell/src/runtime/webcontainer.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_aggregate,node_aggregate_manifest,node_shared_mounting,node_task_board_ui,node_task_execution,node_task_service,node_ssh_ui,node_ssh_routes,node_ssh_pool,node_remote_protocol,node_remote_mobile,node_remote_tunnel,node_doctor_console,node_doctor_transaction,node_skin_routes,node_skin_css,node_skin_runtime toneBlue
class node_market_installer,node_market_ui,node_market_build,node_market_worker toneAmber
class node_shell_boot,node_shell_runtimes,node_shell_output toneMint
```

## Components

### DSH Web Plugins

Mounted web-profile extensions with browser-to-host boundaries.

- [All-in-one entry](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-web-ui-all/src/index.ts): aggregate plugin · Composes installable web-profile packages. · `packages/dsh-web-ui-all/src/index.ts`
- [Aggregate composition](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-web-ui-all/aggregate.yml): manifest · `packages/dsh-web-ui-all/aggregate.yml`
- [Shared host/client patterns](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/shared/host/mount-once.ts): integration primitives · Provides mounting, loopback, and sidebar patterns. · `shared/host/mount-once.ts`
- [Task Board UI](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-task-board/src/client/board/TaskBoard.tsx): React client · `packages/dsh-task-board/src/client/board/TaskBoard.tsx`
- [Task execution](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-task-board/src/core/execution.ts): host workflow core · Runs DSH agents and cron-backed tasks. · `packages/dsh-task-board/src/core/execution.ts`
- [Task host service](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-task-board/src/host-service.ts): host API and state · Persists task state and returns status to the UI. · `packages/dsh-task-board/src/host-service.ts`
- [SSH panel](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-ssh/src/client/panel/SshPanel.tsx): React client · `packages/dsh-ssh/src/client/panel/SshPanel.tsx`
- [SSH host routes](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-ssh/src/routes.ts): host API · `packages/dsh-ssh/src/routes.ts`
- [SSH connection pool](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-ssh/src/engine/connection-pool.ts): SSH engine · Pools connections for PTY, SFTP, tunnels, and clusters. · `packages/dsh-ssh/src/engine/connection-pool.ts`
- [Remote pairing and policy](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-remote-web-ui/src/pairing.ts): remote protocol · Pairs devices and enforces remote-channel rules. · `packages/dsh-remote-web-ui/src/pairing.ts`
- [Remote mobile UI](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-remote-web-ui/src/mobile/views/App.tsx): browser client · Uses SSE with polling fallback for remote control. · `packages/dsh-remote-web-ui/src/mobile/views/App.tsx`
- [Public tunnel](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-remote-web-ui/src/tunnel.ts): optional tunnel · Cloudflared-based remote exposure. · `packages/dsh-remote-web-ui/src/tunnel.ts`
- [Recovery console](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-doctor/src/client/DoctorRecoveryConsole.tsx): browser client · `packages/dsh-doctor/src/client/DoctorRecoveryConsole.tsx`
- [Profile repair transaction](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-doctor/src/core/transaction.ts): recovery core · Transactional profile repair under agent supervision. · `packages/dsh-doctor/src/core/transaction.ts`
- [Skin Center routes](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/skins/skin-center/src/routes-v2.ts): host API · Validates v2 manifests and coordinates skin state. · `packages/skins/skin-center/src/routes-v2.ts`
- [Safe CSS transform](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/skins/skin-center/src/core/css-safety/transform.ts): skin security core · `packages/skins/skin-center/src/core/css-safety/transform.ts`
- [Skin runtime controller](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/skins/skin-center/src/client/runtime/skin-controller.ts): browser runtime · Previews, applies, and loads runtime effects. · `packages/skins/skin-center/src/client/runtime/skin-controller.ts`

### Marketplace

Static catalog, dynamic likes, and in-DSH installation.

- [In-DSH installer](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/packages/dsh-market/src/core/installer.ts): market host core · Installs marketplace assets and plugins through host routes. · `packages/dsh-market/src/core/installer.ts`
- [Marketplace UI](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/market/src/app.js): static web app · `market/src/app.js`
- [Catalog build](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/scripts/market-build): build pipeline · Deterministically builds manifests into the static market. · `scripts/market-build`
- [Likes API](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/market/worker/src/index.js): Cloudflare Worker · Dynamic likes backed by D1 migrations. · `market/worker/src/index.js`

### Try-on Browser Shell

Standalone browser-contained DSH demo runtime.

- [Shell host boot](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/market/shell/src/host/boot.ts): browser host · Boots plugin-capable host, virtual filesystem, network, and shims. · `market/shell/src/host/boot.ts`
- [Guest runtimes](https://github.com/zhu1090093659/dsh-web-ui/blob/dev/market/shell/src/runtime/webcontainer.ts): browser runtimes · WebContainer, Python, and V86 guest execution. · `market/shell/src/runtime/webcontainer.ts`
- **Try-on deployment**: built static output · Shell output deployed under the marketplace distribution.

## Connections

- Aggregate composition → All-in-one entry: declares
- All-in-one entry → Shared host/client patterns: mounts via
- Task Board UI → Task host service: local host API
- Task host service → Task execution: executes and schedules
- SSH panel → SSH host routes: local host API
- SSH host routes → SSH connection pool: uses
- Remote mobile UI → Remote pairing and policy: pairs and RPC
- Public tunnel → Remote pairing and policy: optional exposure
- Recovery console → Profile repair transaction: drives recovery
- Skin Center routes → Safe CSS transform: sanitizes CSS
- Skin runtime controller → Skin Center routes: preview/apply API
- Catalog build → Marketplace UI: builds catalog
- Likes API → Marketplace UI: likes endpoint
- Marketplace UI → In-DSH installer: installation flow
- Shell host boot → Guest runtimes: hosts
- Shell host boot → Try-on deployment: built to
- Catalog build → Try-on deployment: publishes under dist
