dsh-mqtt
MQTT protocol driver and agent worker gateway for DeepSeek Harness 适合需要将DSH智能体与物联网设备或MQTT消息队列进行集成的开发者。
インストール
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:UllrAI/dsh-mqttドキュメント
README 全文を読む ↗Configuration reference
Options are grouped the same way the DSH settings form renders them. The resolved configuration stays flat, so the YAML below is unaffected by the grouping.
Broker connection
| Option | Default | Description |
|---|---|---|
url | mqtt://127.0.0.1:1883 | mqtt, mqtts, ws, or wss broker URL. |
protocolVersion | 5 | 5 for MQTT 5, 4 for MQTT 3.1.1. |
clientId | dsh-mqtt-{namespace}-{nodeId} | Stable MQTT client ID. |
clean | false | MQTT clean-session/start flag. Keep false for offline command delivery. |
keepaliveSeconds | 30 | MQTT keepalive. |
connectTimeoutMs | 10000 | Initial connection timeout. |
reconnectPeriodMs | 1000 | Reconnect delay; 0 disables reconnect. |
sessionExpirySeconds | 86400 | MQTT 5 Session expiry; ignored for MQTT 3.1.1. |
username, password | unset | Direct broker credentials. Avoid storing password in a profile. |
usernameEnv, passwordEnv | unset | Environment variable names containing broker credentials. Mutually exclusive with direct values. |
TLS
| Option | Default | Description |
|---|---|---|
caFile | unset | Absolute CA bundle path for TLS. |
certFile, keyFile | unset | Client certificate and private key paths for mutual TLS. |
rejectUnauthorized | true | Verify broker TLS certificates. Do not disable in production. |
Node identity
| Option | Default | Description |
|---|---|---|
namespace | local | Topic namespace; 1–64 topic-safe characters. |
nodeId | dsh-node | Node topic segment; 1–64 topic-safe characters. |
displayName | the node ID | Name shown to controllers and in the Worker UI. |
capabilities | [] | Informational values published in online presence. |
Agents and workspaces
| Option | Default | Description |
|---|---|---|
workspaces | {} | Alias-to-directory allowlist for new Sessions. |
defaultWorkspace | unset | Alias used when a new request omits workspace. |
allowExternalSessions | false | Permit continuation of Sessions not recorded by this gateway. See the security warning above. |
provider, model, maxTokens | current DSH profile selection | Optional Agent creation overrides. provider and model must be set together; otherwise the gateway reads ctx.agentDefaultModel. |
eventExposure | safe | safe normalized events or full raw event data. |
stateFile | .dsh-mqtt/state.json | Durable deduplication/result/Session-ownership JSON file. |
Limits
| Option | Default | Description |
|---|---|---|
maxMessageBytes | 65536 | Maximum inbound MQTT payload size. |
maxMetadataBytes | 8192 | Maximum serialized metadata size; cannot exceed maxMessageBytes. |
maxInputChars | 32768 | Maximum input length in JavaScript characters. |
maxActiveRequests | 16 | Maximum accepted/active requests. |
dedupTtlSeconds | 604800 | Terminal request/control retention. |
heartbeatSeconds | 15 | Interval between retained status publishes. Controllers treat a node as stale after two missed beats. |
Management interface
| Option | Default | Description |
|---|---|---|
managementPort | 3210 | Port for the management API and standalone page. 0 disables both, and leaves the DSH panel with nothing to read. |
managementHost | 127.0.0.1 | Bind address. Anything other than loopback requires a management token. |
managementCorsOrigin | unset | One exact origin allowed to call the API. Unset means loopback origins only, which is what the DSH panel needs. |
managementToken | unset | Bearer token required by the API. |
managementTokenEnv | unset | Environment variable holding the management token. Mutually exclusive with managementToken. |
requireControllerAuth | false | Require controllers to be invited and approved before they may submit or steer. Left off, broker credentials alone are enough to run agent work on this node, so the gateway warns at startup. |
Credentials and TLS
The gateway supports direct MQTT username/password values or environment-backed credentials. Prefer environment variables for unattended deployments so the password is not stored in the DSH profile.
Username/password without TLS
This is suitable only for a loopback interface, VPN, or otherwise trusted private network. MQTT username/password authentication does not encrypt the credentials or payload.
- id: mqtt-gateway
config:
url: mqtt://broker.internal.example:1883
namespace: ullrai
nodeId: mac-mini
username: dsh-mac-mini
password: replace-with-broker-password
The direct password form is shown for completeness. Do not commit a real password to the profile. Use mqtts:// or wss:// whenever traffic crosses an untrusted network.
Username/password over TLS
This is the recommended configuration for a cloud broker:
- id: mqtt-gateway
config:
url: mqtts://broker.example.com:8883
namespace: ullrai
nodeId: mac-mini
usernameEnv: DSH_MQTT_USERNAME
passwordEnv: DSH_MQTT_PASSWORD
rejectUnauthorized: true
stateFile: /var/lib/dsh-mqtt/state.json
workspaces:
repo-foo: /srv/repos/repo-foo
export DSH_MQTT_USERNAME='dsh-mac-mini'
export DSH_MQTT_PASSWORD='...'
npx @deepseek-ai/dsh --profile web
Use the exact hostname and port supplied by the broker. A public-CA certificate normally needs no caFile; hostname and certificate verification remain enabled by default. Secure WebSocket endpoints use wss:// with the provider's path and the same credential fields.
Custom CA and mutual TLS
For a private CA or a broker that requires a client certificate, add the relevant files to the TLS configuration:
- id: mqtt-gateway
config:
url: mqtts://broker.internal.example:8883
namespace: ullrai
nodeId: mac-mini
usernameEnv: DSH_MQTT_USERNAME
passwordEnv: DSH_MQTT_PASSWORD
caFile: /etc/dsh-mqtt/ca.pem
certFile: /etc/dsh-mqtt/client.pem
keyFile: /etc/dsh-mqtt/client-key.pem
rejectUnauthorized: true
caFile supplies the trusted CA bundle. certFile and keyFile enable mutual TLS and must be configured together when the broker requires them. A broker can require mTLS in addition to, or instead of, username/password authentication. Do not set rejectUnauthorized: false in production.