RelayLoom:爲 DSH 提供默認關閉的釘釘 Stream 會話中轉

前言

如果要在 DeepSeek Harness(DSH)中接入外部聊天入口,不能只考慮“把模型輸出發到羣裏”。還需要處理回調 ACK、重試去重、會話隔離、審批邊界和 webhook 回覆安全。

下面介紹 fieldnote-ops/relayloom。它是獨立維護、默認關閉的外部聊天中轉插件,首個兼容適配器連接公開的 DingTalk Stream 協議和 DSH agents。

這是什麼

RelayLoom 是一個 independent, default-off external chat relay for agent harnesses。它接收 DingTalk Stream callbacks,並將 DSH agent 的 committed answer 通過有界 sessionWebhook replies 返回給發送方。

基本事實如下:

  • 倉庫:fieldnote-ops/relayloom
  • 許可證:MIT
  • 版本:0.2.3
  • 直接運行時依賴:dingtalk-stream 2.1.6-beta.1
  • Node engines:^22.19.0 || >=24.0.0
  • 它與 DingTalk、Alibaba、DeepSeek 及其關聯方沒有隸屬、贊助或官方產品關係。

核心功能

回調處理

  • 接收 DingTalk Stream callbacks。
  • 在異步 agent work settles 之前發送 ACK。
  • msgId 做 retry deduplication。
  • 使用 bounded memory。

會話邊界

  • 支持 direct-message 和 group-mention filtering。
  • 使用 default-deny staff-id allowlist。
  • 按 sender 隔離 sessions。
  • 使用 deterministic、non-secret 的 storage ids。
  • 支持 DSH agent create/resume、preset mounting、committed-answer delivery、cancellation 和 bounded teardown。

審批與回覆

  • /approve/reject 是文本 fallback。
  • 這些決策是 single-use、expiring,並綁定到 original sender 和 conversation。
  • 不宣稱 interactive approval cards 可用。
  • 使用 official sessionWebhook Markdown replies。
  • 回覆鏈路包含 exact HTTPS host allowlisting、redirect denial、response limits、timeout、expiry checks 和 output chunking。

默認安全

  • Bundle 默認 enabled: false
  • Installation 和 boot 不讀取 credentials,也不發起 DingTalk requests。
  • 啓用後要求非空 staff-id allowlist。
  • Credentials 只從 named environment variables 讀取。
  • 不從 YAML 讀取 credentials。
  • 拒絕 unsafe webhook destinations 和 redirects。

安裝與啓用

從 GitHub 安裝

安裝時固定到公開的 commit,而不是依賴移動分支:

dsh plugin --profile web add github:fieldnote-ops/relayloom#e789dded22a6eeb00bddde0d06e47d15e23eced6

安裝完成後,bundle 仍保持 disabled。

創建釘釘內部機器人

先創建 DingTalk internal robot,並準備好 Client ID、Client Secret 和允許發送消息的 sender staff id。

啓用配置

在啓動環境中設置對應環境變量後,編輯 DSH profile 行:

- id: relayloom
  name: relayloom
  config:
    enabled: true
    clientIdEnv: DINGTALK_CLIENT_ID
    clientSecretEnv: DINGTALK_CLIENT_SECRET
    allowedUsers:
      - your-staff-id
    preset: standard

這裏只配置環境變量名,不把憑據寫進 YAML。RelayLoom 不從 YAML 讀取 credentials;啓用 bridge 時,空 allowlist 會被拒絕。

典型用法

運行本地傳輸探針

先克隆倉庫,並安裝鎖定依賴:

git clone https://github.com/fieldnote-ops/relayloom.git
cd relayloom
npm ci --ignore-scripts --registry=https://registry.npmjs.org

交互式讀取 Client ID、Client Secret 和 allowed sender staff id,避免它們進入 shell history:

printf 'DingTalk Client ID: '
IFS= read -r DINGTALK_CLIENT_ID
printf 'DingTalk Client Secret: '
IFS= read -r -s DINGTALK_CLIENT_SECRET
printf '\nAllowed sender staff id: '
IFS= read -r RELAYLOOM_ALLOWED_USER
export DINGTALK_CLIENT_ID DINGTALK_CLIENT_SECRET RELAYLOOM_ALLOWED_USER
npm run tenant:smoke
unset DINGTALK_CLIENT_ID DINGTALK_CLIENT_SECRET RELAYLOOM_ALLOWED_USER

運行後,把進程打印的 exact random challenge 發送給 internal robot。默認等待時間爲 180 秒。

注意:npm run tenant:smoke 會發起真實 DingTalk network calls,並且不會在 installation、DSH boot、tests 或 CI 中自動運行。

本地檢查

本地檢查可以執行:

npm ci --ignore-scripts
npm run check

適用場景與注意

RelayLoom 適合希望在 DSH 中接入 DingTalk Stream 會話、同時希望默認關閉和最小權限邊界的開發者。

使用它時需要明確以下幾點:

  • 它是 developer preview,不是 verified production bot。
  • 目前沒有真實 DingTalk tenant 完成 receive -> ACK -> reply round trip。
  • /approve/reject 是文本 fallback,不是 interactive cards 承諾。
  • 啓用後必須配置非空 staff-id allowlist。
  • 它會在當前 DSH 進程環境中運行;安裝前建議檢查源碼、依賴和 MIT 許可證。

相關鏈接

  • GitHub:https://github.com/fieldnote-ops/relayloom
  • 社區目錄頁:https://www.skillhub.cn/plugins/fieldnote-ops/relayloom
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

小夜