# yunpengdon/dsh-hitl architecture

> Architecture diagram of the GitHub repository yunpengdon/dsh-hitl, 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/yunpengdon/dsh-hitl
- Repository: https://github.com/yunpengdon/dsh-hitl

## Overview

dsh-hitl is a DeepSeek Harness plugin that pauses matched tool calls for human approval, edits, or rejection. Plugins or configuration mount tools; when a matched call reaches the host gate, it builds a proposal, waits in the pending registry, and sends it to the browser UI. A human decision returns through the transport and determines whether execution proceeds or receives feedback/revision context. The README also documents countdowns, editable fields, subagent visibility, and notices outside a conversation. Source excerpts establish the host’s internal modules; browser-to-host links rely on documented behavior where code excerpts are incomplete.

Main entry points: [`index.js`](https://github.com/yunpengdon/dsh-hitl/blob/main/index.js) (Pre-execution gate), [`client.js`](https://github.com/yunpengdon/dsh-hitl/blob/main/client.js) (Browser client), [`lib/pending.js`](https://github.com/yunpengdon/dsh-hitl/blob/main/lib/pending.js) (Pending registry), [`lib/fields.js`](https://github.com/yunpengdon/dsh-hitl/blob/main/lib/fields.js) (Proposal fields)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mount["Mounting and policy"]
  node_mount_api["Mount service<br/>[index.js]"]
  node_mount_rules["Mount normalization<br/>[resolve.js]"]
end

subgraph group_gate["Approval gate"]
  node_tool_gate["Pre-execution gate<br/>[index.js]"]
  node_proposal["Proposal fields<br/>[fields.js]"]
  node_pending["Pending registry<br/>[pending.js]"]
  node_revision["Revision context<br/>[fields.js]"]
end

subgraph group_transport["Decision transport"]
  node_wire_contract["Wire protocol<br/>[protocol.js]"]
  node_http_transport["HTTP and SSE transport<br/>[index.js]"]
end

subgraph group_browser["Browser experience"]
  node_browser_client["Browser client<br/>[client.js]"]
  node_decision_card["Decision card<br/>[client.js]"]
  node_session_views["Session and subagent views<br/>[client.js]"]
  node_floating_notice["Floating notice<br/>[client.js]"]
end

node_plugin_author(("Plugin or config author"))
node_tool_call(("Tool call"))
node_human(("Human reviewer"))

node_plugin_author -->|"mounts tools"| node_mount_api
node_mount_api -->|"normalizes mounts"| node_mount_rules
node_tool_call -->|"intercepted before execution"| node_tool_gate
node_tool_gate -->|"matches mount"| node_mount_rules
node_tool_gate -->|"resolves fields"| node_proposal
node_proposal -->|"uses limits"| node_wire_contract
node_proposal -->|"uses render defaults"| node_mount_rules
node_tool_gate -->|"opens request"| node_pending
node_pending -->|"settles blocked call"| node_tool_gate
node_tool_gate -->|"builds revision context"| node_revision
node_http_transport -->|"frames and validates"| node_wire_contract
node_http_transport -->|"reads pending state"| node_pending
node_http_transport -->|"streams requests"| node_browser_client
node_browser_client -->|"renders proposal"| node_decision_card
node_browser_client -->|"files requests to sessions"| node_session_views
node_browser_client -->|"shows off-session requests"| node_floating_notice
node_human -->|"reviews and decides"| node_decision_card
node_decision_card -->|"submits decision"| node_browser_client
node_browser_client -->|"posts decision"| node_http_transport
node_http_transport -->|"settles decision"| node_pending
node_mount_api -->|"lists pending requests"| node_pending

click node_mount_api "https://github.com/yunpengdon/dsh-hitl/blob/main/index.js"
click node_mount_rules "https://github.com/yunpengdon/dsh-hitl/blob/main/lib/resolve.js"
click node_tool_gate "https://github.com/yunpengdon/dsh-hitl/blob/main/index.js"
click node_proposal "https://github.com/yunpengdon/dsh-hitl/blob/main/lib/fields.js"
click node_pending "https://github.com/yunpengdon/dsh-hitl/blob/main/lib/pending.js"
click node_revision "https://github.com/yunpengdon/dsh-hitl/blob/main/lib/fields.js"
click node_wire_contract "https://github.com/yunpengdon/dsh-hitl/blob/main/lib/protocol.js"
click node_http_transport "https://github.com/yunpengdon/dsh-hitl/blob/main/index.js"
click node_browser_client "https://github.com/yunpengdon/dsh-hitl/blob/main/client.js"
click node_decision_card "https://github.com/yunpengdon/dsh-hitl/blob/main/client.js"
click node_session_views "https://github.com/yunpengdon/dsh-hitl/blob/main/client.js"
click node_floating_notice "https://github.com/yunpengdon/dsh-hitl/blob/main/client.js"

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_mount_api,node_mount_rules,node_human toneBlue
class node_tool_gate,node_proposal,node_pending,node_revision toneAmber
class node_wire_contract,node_http_transport toneMint
class node_browser_client,node_decision_card,node_session_views,node_floating_notice toneRose
class node_plugin_author,node_tool_call toneIndigo
```

## Components

### Mounting and policy

- [Mount service](https://github.com/yunpengdon/dsh-hitl/blob/main/index.js): `index.js`
- [Mount normalization](https://github.com/yunpengdon/dsh-hitl/blob/main/lib/resolve.js): `lib/resolve.js`

### Approval gate

- [Pre-execution gate](https://github.com/yunpengdon/dsh-hitl/blob/main/index.js): `index.js`
- [Proposal fields](https://github.com/yunpengdon/dsh-hitl/blob/main/lib/fields.js): `lib/fields.js`
- [Pending registry](https://github.com/yunpengdon/dsh-hitl/blob/main/lib/pending.js): `lib/pending.js`
- [Revision context](https://github.com/yunpengdon/dsh-hitl/blob/main/lib/fields.js): `lib/fields.js`

### Decision transport

- [Wire protocol](https://github.com/yunpengdon/dsh-hitl/blob/main/lib/protocol.js): `lib/protocol.js`
- [HTTP and SSE transport](https://github.com/yunpengdon/dsh-hitl/blob/main/index.js): `index.js`

### Browser experience

- [Browser client](https://github.com/yunpengdon/dsh-hitl/blob/main/client.js): `client.js`
- [Decision card](https://github.com/yunpengdon/dsh-hitl/blob/main/client.js): `client.js`
- [Session and subagent views](https://github.com/yunpengdon/dsh-hitl/blob/main/client.js): `client.js`
- [Floating notice](https://github.com/yunpengdon/dsh-hitl/blob/main/client.js): `client.js`

### Other components

- **Plugin or config author**
- **Tool call**
- **Human reviewer**

## Connections

- Plugin or config author → Mount service: mounts tools (evidence: `README.md`)
- Mount service → Mount normalization: normalizes mounts (evidence: `index.js`)
- Tool call → Pre-execution gate: intercepted before execution (evidence: `README.md`)
- Pre-execution gate → Mount normalization: matches mount (evidence: `index.js`)
- Pre-execution gate → Proposal fields: resolves fields (evidence: `index.js`)
- Proposal fields → Wire protocol: uses limits (evidence: `lib/fields.js`)
- Proposal fields → Mount normalization: uses render defaults (evidence: `lib/fields.js`)
- Pre-execution gate → Pending registry: opens request (evidence: `index.js`)
- Pending registry → Pre-execution gate: settles blocked call (evidence: `index.js`)
- Pre-execution gate → Revision context: builds revision context (evidence: `index.js`)
- HTTP and SSE transport → Wire protocol: frames and validates (evidence: `index.js`)
- HTTP and SSE transport → Pending registry: reads pending state (evidence: `index.js`)
- HTTP and SSE transport → Browser client: streams requests (evidence: `README.md`)
- Browser client → Decision card: renders proposal (evidence: `client.js`)
- Browser client → Session and subagent views: files requests to sessions (evidence: `README.md`)
- Browser client → Floating notice: shows off-session requests (evidence: `README.md`)
- Human reviewer → Decision card: reviews and decides (evidence: `README.md`)
- Decision card → Browser client: submits decision (evidence: `README.md`)
- Browser client → HTTP and SSE transport: posts decision (evidence: `README.md`)
- HTTP and SSE transport → Pending registry: settles decision (evidence: `index.js`)
- Mount service → Pending registry: lists pending requests (evidence: `README.md`)
