# xmanrui/dsh-im architecture

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

- Interactive diagram: https://gitdiagram.com/xmanrui/dsh-im
- Repository: https://github.com/xmanrui/dsh-im

## Overview

DSH-IM is a DeepSeek Harness plugin that connects IM bots and an AI Office Connector to a local Harness. The user configures bots and channel behavior in the plugin settings; the host-side channel integrations manage connections and message handling, with Harness sessions producing replies back through the messaging channels. The README also describes multi-bot management and channel-specific features such as voice, streaming, QR setup, and callbacks. Edges are limited to relationships documented in the README or visible in indexed imports; unsampled channel internals are represented at directory level.

Main entry points: [`plugin-src/client/index.js`](https://github.com/xmanrui/dsh-im/blob/main/plugin-src/client/index.js) (Settings UI), [`plugin-src/host/channels`](https://github.com/xmanrui/dsh-im/tree/main/plugin-src/host/channels) (Channel host adapters), [`src/channels`](https://github.com/xmanrui/dsh-im/tree/main/src/channels) (IM channel runtimes), [`plugin-src/client/context-enhancement.js`](https://github.com/xmanrui/dsh-im/blob/main/plugin-src/client/context-enhancement.js) (Context settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_settings["Plugin settings"]
  node_settings_ui["Settings UI<br/>[index.js]"]
  node_channel_ui["Channel settings"]
  node_workspace_ui["Workspace editor"]
  node_context_ui["Context settings"]
  node_preset_ui["Agent presets<br/>[agent-preset.js]"]
  node_alias_ui["Bot aliases<br/>[bot-alias.js]"]
end

subgraph group_host["Plugin host"]
  node_host_entry["Host registration<br/>[index.mjs]"]
  node_management_rpc["Management RPC<br/>[management-rpc.mjs]"]
  node_channel_host["Channel host adapters"]
  node_delivery["Delivery service"]
end

subgraph group_channels["Messaging channels"]
  node_office["AI Office connector"]
  node_im_channels["IM channel runtimes"]
end

subgraph group_shared["Shared capabilities"]
  node_connection_diagnostics["Connection diagnostics"]
  node_connection_tests["Connection tests"]
  node_message_failures["Message failure handling"]
  node_host_i18n["Host localization<br/>[i18n.mjs]"]
  node_context_config["Context enhancement config"]
end

node_user(("Operator"))
node_harness["DeepSeek Harness"]

node_user -->|"configures"| node_settings_ui
node_settings_ui -->|"presents"| node_channel_ui
node_user -.->|"sets workspace"| node_workspace_ui
node_user -.->|"sets context"| node_context_ui
node_user -.->|"selects preset"| node_preset_ui
node_user -.->|"edits alias"| node_alias_ui
node_settings_ui -->|"requests management"| node_management_rpc
node_management_rpc -->|"dispatches"| node_host_entry
node_host_entry -->|"registers channels"| node_channel_host
node_channel_host -.->|"adapts channels"| node_im_channels
node_channel_host -.->|"adapts connector"| node_office
node_im_channels -.->|"forwards messages"| node_harness
node_harness -.->|"provides replies"| node_delivery
node_delivery -->|"delivers replies"| node_im_channels
node_office -->|"connects outward"| node_harness
node_connection_diagnostics -->|"localizes errors"| node_host_i18n
node_message_failures -->|"extracts evidence"| node_connection_diagnostics
node_connection_tests -->|"formats test text"| node_host_i18n
node_context_ui -->|"validates settings"| node_context_config

click node_settings_ui "https://github.com/xmanrui/dsh-im/blob/main/plugin-src/client/index.js"
click node_channel_ui "https://github.com/xmanrui/dsh-im/tree/main/plugin-src/client/channels"
click node_workspace_ui "https://github.com/xmanrui/dsh-im/blob/main/plugin-src/client/workspace-editor.js"
click node_context_ui "https://github.com/xmanrui/dsh-im/blob/main/plugin-src/client/context-enhancement.js"
click node_preset_ui "https://github.com/xmanrui/dsh-im/blob/main/plugin-src/client/agent-preset.js"
click node_alias_ui "https://github.com/xmanrui/dsh-im/blob/main/plugin-src/client/bot-alias.js"
click node_host_entry "https://github.com/xmanrui/dsh-im/blob/main/plugin-src/host/index.mjs"
click node_management_rpc "https://github.com/xmanrui/dsh-im/blob/main/plugin-src/management-rpc.mjs"
click node_channel_host "https://github.com/xmanrui/dsh-im/tree/main/plugin-src/host/channels"
click node_delivery "https://github.com/xmanrui/dsh-im/blob/main/plugin-src/host/delivery-service.mjs"
click node_office "https://github.com/xmanrui/dsh-im/tree/main/src/channels/office"
click node_im_channels "https://github.com/xmanrui/dsh-im/tree/main/src/channels"
click node_connection_diagnostics "https://github.com/xmanrui/dsh-im/blob/main/src/channels/shared/connection-error.mjs"
click node_connection_tests "https://github.com/xmanrui/dsh-im/blob/main/src/channels/shared/connection-test.mjs"
click node_message_failures "https://github.com/xmanrui/dsh-im/blob/main/src/channels/shared/message-failure.mjs"
click node_host_i18n "https://github.com/xmanrui/dsh-im/blob/main/src/channels/shared/i18n.mjs"
click node_context_config "https://github.com/xmanrui/dsh-im/blob/main/src/channels/shared/context-enhancement.mjs"

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_settings_ui,node_channel_ui,node_workspace_ui,node_context_ui,node_preset_ui,node_alias_ui toneBlue
class node_host_entry,node_management_rpc,node_channel_host,node_delivery toneAmber
class node_office,node_im_channels toneMint
class node_connection_diagnostics,node_connection_tests,node_message_failures,node_host_i18n,node_context_config toneRose
class node_user,node_harness toneIndigo
```

## Components

### Plugin settings

- [Settings UI](https://github.com/xmanrui/dsh-im/blob/main/plugin-src/client/index.js): `plugin-src/client/index.js`
- [Channel settings](https://github.com/xmanrui/dsh-im/tree/main/plugin-src/client/channels): `plugin-src/client/channels`
- [Workspace editor](https://github.com/xmanrui/dsh-im/blob/main/plugin-src/client/workspace-editor.js): `plugin-src/client/workspace-editor.js`
- [Context settings](https://github.com/xmanrui/dsh-im/blob/main/plugin-src/client/context-enhancement.js): `plugin-src/client/context-enhancement.js`
- [Agent presets](https://github.com/xmanrui/dsh-im/blob/main/plugin-src/client/agent-preset.js): `plugin-src/client/agent-preset.js`
- [Bot aliases](https://github.com/xmanrui/dsh-im/blob/main/plugin-src/client/bot-alias.js): `plugin-src/client/bot-alias.js`

### Plugin host

- [Host registration](https://github.com/xmanrui/dsh-im/blob/main/plugin-src/host/index.mjs): `plugin-src/host/index.mjs`
- [Management RPC](https://github.com/xmanrui/dsh-im/blob/main/plugin-src/management-rpc.mjs): `plugin-src/management-rpc.mjs`
- [Channel host adapters](https://github.com/xmanrui/dsh-im/tree/main/plugin-src/host/channels): `plugin-src/host/channels`
- [Delivery service](https://github.com/xmanrui/dsh-im/blob/main/plugin-src/host/delivery-service.mjs): `plugin-src/host/delivery-service.mjs`

### Messaging channels

- [AI Office connector](https://github.com/xmanrui/dsh-im/tree/main/src/channels/office): `src/channels/office`
- [IM channel runtimes](https://github.com/xmanrui/dsh-im/tree/main/src/channels): `src/channels`

### Shared capabilities

- [Connection diagnostics](https://github.com/xmanrui/dsh-im/blob/main/src/channels/shared/connection-error.mjs): `src/channels/shared/connection-error.mjs`
- [Connection tests](https://github.com/xmanrui/dsh-im/blob/main/src/channels/shared/connection-test.mjs): `src/channels/shared/connection-test.mjs`
- [Message failure handling](https://github.com/xmanrui/dsh-im/blob/main/src/channels/shared/message-failure.mjs): `src/channels/shared/message-failure.mjs`
- [Host localization](https://github.com/xmanrui/dsh-im/blob/main/src/channels/shared/i18n.mjs): `src/channels/shared/i18n.mjs`
- [Context enhancement config](https://github.com/xmanrui/dsh-im/blob/main/src/channels/shared/context-enhancement.mjs): `src/channels/shared/context-enhancement.mjs`

### Other components

- **Operator**
- **DeepSeek Harness**

## Connections

- Operator → Settings UI: configures (evidence: `README.md`)
- Settings UI → Channel settings: presents (evidence: `plugin-src/client/index.js`)
- Operator → Workspace editor: sets workspace
- Operator → Context settings: sets context
- Operator → Agent presets: selects preset
- Operator → Bot aliases: edits alias
- Settings UI → Management RPC: requests management (evidence: `plugin-src/client/index.js`)
- Management RPC → Host registration: dispatches (evidence: `plugin-src/management-rpc.mjs`)
- Host registration → Channel host adapters: registers channels (evidence: `plugin-src/host/index.mjs`)
- Channel host adapters → IM channel runtimes: adapts channels
- Channel host adapters → AI Office connector: adapts connector
- IM channel runtimes → DeepSeek Harness: forwards messages
- DeepSeek Harness → Delivery service: provides replies
- Delivery service → IM channel runtimes: delivers replies (evidence: `plugin-src/host/delivery-service.mjs`)
- AI Office connector → DeepSeek Harness: connects outward (evidence: `README.md`)
- Connection diagnostics → Host localization: localizes errors (evidence: `src/channels/shared/connection-error.mjs`)
- Message failure handling → Connection diagnostics: extracts evidence (evidence: `src/channels/shared/message-failure.mjs`)
- Connection tests → Host localization: formats test text (evidence: `src/channels/shared/connection-test.mjs`)
- Context settings → Context enhancement config: validates settings (evidence: `plugin-src/client/context-enhancement.js`)
