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
羽毛球分组比赛记分
小程序二维码

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

Xiaoye