前言¶
DSH 已有 send_message 和 list_agents,但原始形態偏層級:父會話給自身後臺 subagent 發消息。兩個 DSH 會話在同一臺機器、不同倉庫中運行時,默認無法互相發現或互發消息。
Jesse-njx/dsh-crosstalk 爲這種多會話工作流補齊同機橫向通信能力:任一會話可以列出本機 live 會話,並向其中任意一個發送消息,無需 daemon。
這是什麼¶
Jesse-njx/dsh-crosstalk 是一個 DeepSeek Harness bundle,MIT 許可。它把 DSH 的會話通信擴展到同機、同用戶運行的 peer 會話之間,讓 list_agents 和 send_message 獲得 peer 發現與 peer 尋址能力。
v0.1 不提供網絡傳輸,只做本地文件與目錄級別的消息投遞。
核心能力¶
會話發現與消息接口¶
list_agents增加scope: peers,用於查看本機其他 live 會話;scope: all覆蓋 descendants 與 peers。send_message的to字段除 subagent id 外,也接受 peer name 或 ref,並可攜帶summary。- 該 bundle 按 agent shadow 原生工具;卸載時可恢復原生行爲。
本地投遞¶
- 每個運行中的會話在
~/.dsh/crosstalk下發布 heartbeat JSON 文件。 - 消息以文件形式寫入目標 inbox,採用臨時文件加 rename 的原子方式。
- 空閒目標會被喚醒一個 turn;忙碌目標會在下一個 turn 邊界接收。
- 投遞是 best-effort;
list_agents中的狀態不構成送達承諾。
注入與信任邊界¶
- 接收端看到的消息會被標註爲 relay turn,例如:
[message from session dsh-cowork-amber (/Users/me/projects/dsh-cowork)]
- 系統提示會說明這是 peer agent 的請求,不是用戶指令。
- v0.1 固定只接受 same-user;可再配置 name/cwd allowlist 做更嚴格的入站過濾。
安裝與啓用¶
環境要求¶
- Node >=22
- 若從 GitHub 安裝,需要先允許構建 hook
@dsh-crosstalk/bundle。
從 GitHub 安裝¶
先配置 profile workspace,允許 bundle 的構建 hook:
# ~/.dsh/profiles/web/pnpm-workspace.yaml
packages:
- .
allowBuilds:
'@dsh-crosstalk/bundle': true
然後爲每個需要參與的 profile 添加 bundle:
dsh plugin --profile web add github:Jesse-njx/dsh-crosstalk
dsh plugin --profile <other-profile> add github:Jesse-njx/dsh-crosstalk
GitHub 安裝會通過 package 的 postinstall hook 從 src/ 構建 lib/。
本地檢出安裝¶
從倉庫源碼安裝時,先構建,再把倉庫根目錄加入 profile:
git clone https://github.com/Jesse-njx/dsh-crosstalk
cd dsh-crosstalk
pnpm install
pnpm build
dsh plugin --profile web add "$PWD"
dsh plugin --profile <other-profile> add "$PWD"
本地檢出加載的是編譯後的 lib/;修改源碼後運行 pnpm build 並重啓 DSH,不需要重新安裝。
配置覆蓋¶
bundle 添加後會自動掛載。要覆蓋字段,在 profile 的 cordis.patch.yml 中按 id 覆蓋 crosstalk 條目;不要新增第二個 crosstalk row,否則會出現重複條目錯誤。
# in <DSH_HOME>/profiles/<name>/cordis.patch.yml
- id: crosstalk
config:
homeDir: ~/.dsh/crosstalk
cwd: /path/to/repo
name: my-custom-name
accept: same-user
mode: open
allowlist: []
notifyUser: true
heartbeatIntervalMs: 10000
inboxPollMs: 1000
staleAfterMs: 20000
maxInboxAttempts: 30
未設置字段回落到默認值;loader 會整體替換 config,所以只列需要改動的字段即可。
典型用法¶
兩個安裝了 bundle 的 DSH 終端可以做如下往返:
You: list_agents peers
dsh-cowork-amber [idle] — /Users/me/projects/dsh-cowork
dsh-memory-azure [running] — /Users/me/projects/dsh-memory
You: send_message to="dsh-cowork-amber" message="Round-trip check: can you list the files in your repo?" summary="ping for round-trip"
對端會話會醒來,或在當前 turn 結束後接收該消息;它看到帶來源標註的消息後,可以用 send_message 發回你的名字。
適用場景與注意¶
適合這類場景:同一臺機器上按倉庫拆分多個 DSH 會話、需要一個協調者分發任務、一個例行會話 ping 一個 live 會話,或人工參與會話與 agent 會話互發消息。
使用注意:
- v0.1 僅限同機、同用戶;沒有網絡傳輸。
- 對端消息是 peer request,不是用戶指令;模型應在既定用戶指令範圍內處理,並暴露有副作用的操作。
- 投遞是 best-effort,不保證送達。
- 該 bundle 會在當前 DSH 進程權限下運行;安裝前建議檢查源碼、構建 hook 與 MIT 許可證,不要在不信任的倉庫上直接安裝。
- 若使用 allowlist 模式,可用精確 session name 或 cwd glob 限制入站來源。
結尾¶
dsh-crosstalk 的價值在於把 DSH 的會話通信從“父到子”擴展到“同機對等會話之間”,適合多倉庫、多會話、同用戶環境。
- GitHub: https://github.com/Jesse-njx/dsh-crosstalk
- 目錄頁:可按
Jesse-njx/dsh-crosstalk在社區目錄檢索;社區目錄是獨立站點,不是 DeepSeek / 幻方官方應用商店。