How zhuiyueya/dsh-im-gateway works
dsh-im-gateway is a DeepSeek Harness plugin that connects chat platforms to coding-agent sessions. A user message enters through a channel adapter, is authorized and routed by the gateway into an agent session, and agent replies return through the gateway to the originating chat. The product also provides channel setup and lifecycle management, session commands, remote approvals, interactive questions, media handling, and chat-bound scheduled reminders. Core flow links follow the documented architecture; unsampled subsystem links are included only where the README or excerpts support them.
Main entry points: gateway.ts IM gateway · manager.ts Channel manager · channels Channel adapters · router.ts Session router
Components 20
Chat channels
- Channel adapters
src/channels - Channel registry
src/channels/index.ts
Gateway runtime
- IM gateway
src/core/gateway.ts - Message merge
src/core/merge.ts - Message formatting
src/core/format.ts - Reply splitting
src/core/split.ts - Access control
src/core/approval.ts
Session handling
- Session router
src/core/router.ts - Workspace preferences
src/index.ts
Agent interactions
- Approval bridge
src/core/approval.ts - Question bridge
src/core/questions.ts - Chat reminders
src/core/cron.ts - Schedule calculation
src/core/cron-time.ts
Channel management
- Plugin entry
src/index.ts - Channel manager
src/manager.ts - Channel provisioning
src/core/provisioning.ts - Channel state
src/manager.ts
Other components
- Chat user
- Chat platforms
- DSH agent
Connections 24
- Chat user → Chat platforms: sends message
- Chat platforms → Channel adapters: delivers message
- Channel adapters → IM gateway: normalizes input
- IM gateway → Access control: checks access
src/core/gateway.ts - IM gateway → Message merge: merges input
src/core/gateway.ts - IM gateway → Session router: routes message
src/core/gateway.ts - Session router → DSH agent: follows up
- DSH agent → IM gateway: emits events
- IM gateway → Reply splitting: splits reply
src/core/gateway.ts - IM gateway → Channel adapters: sends reply
- Channel adapters → Chat platforms: delivers reply
- Plugin entry → Channel manager: starts management
src/index.ts - Channel manager → Channel registry: creates adapters
src/channels/index.ts - Channel registry → Channel adapters: dispatches factory
src/channels/index.ts - Channel manager → IM gateway: registers channels
src/manager.ts - Channel manager → Channel state: persists config
src/manager.ts - Channel manager → Channel provisioning: handles setup
src/core/provisioning.ts - IM gateway → Message formatting: formats messages
src/core/gateway.ts - IM gateway → Approval bridge: bridges decisions
src/core/gateway.ts - IM gateway → Question bridge: bridges questions
src/core/gateway.ts - IM gateway → Chat reminders: manages reminders
src/core/gateway.ts - Chat reminders → Schedule calculation: calculates schedule
src/core/cron.ts - Plugin entry → Workspace preferences: persists preferences
src/index.ts - Session router → Workspace preferences: loads preferences