前言¶
在 DeepSeek Harness(DSH)裏跑 agent 時,筆記往往還在有道雲筆記裏:搜索、讀正文、新建或改 Markdown、管待辦、做網頁剪藏,如果每次都讓人手工複製粘貼,上下文很容易斷。自己寫 HTTP 對接則要維護 API Key、協議變更和格式細節,成本不低。
dsh-youdaonote 由維護者 xmzd-S 發佈,分類爲聯網工具,把官方 youdaonote CLI 封裝成 8 個 dsh 工具,供 agent 直接調用。插件不直連雲筆記 HTTP API,鑑權與協議升級由 CLI 承擔;首次使用時可自動安裝 CLI,並在缺 API Key 時通過 dsh 提問服務彈卡片索要。
這是什麼¶
一句話:DSH 的有道雲筆記工具插件,覆蓋筆記 CRUD、待辦管理和網頁剪藏。
底層是官方 youdaonote CLI(API Key 鑑權)。CLI 二進制在 Linux/macOS 上可自動裝進 ~/.dsh/integrations/dsh-youdaonote/bin,不修改系統 PATH;API Key 由 CLI 寫入 ~/.youdaonote.json,插件不落盤、不進日誌。
當前 package 版本爲 0.2.0,許可證 MIT,要求 Node.js >=22。兼容 dsh 0.1.2-alpha.4 至 0.1.5-rc.2,profile 支持 web、headless、tui。
核心功能:八個工具¶
| 工具 | 用途 | 只讀(可併發) |
|---|---|---|
youdaonote_search |
關鍵詞搜索筆記 | ✅ |
youdaonote_read |
讀取筆記全文(含 rawFormat 元數據) | ✅ |
youdaonote_list |
瀏覽目錄(根目錄或指定文件夾) | ✅ |
youdaonote_save |
新建 Markdown 筆記(內部走 save,不走純文本的 create) |
❌ |
youdaonote_update |
覆蓋更新正文(經臨時文件傳遞) | ❌ |
youdaonote_manage |
delete / rename / move | ❌ |
youdaonote_todo |
待辦 list / groups / create / update / delete | 僅 list、groups 只讀 |
youdaonote_clip |
網頁剪藏(服務端抓取) | ❌ |
設計要點(來自 README):保存一律走 save(contentFormat: "md")以保留格式;正文經 stdin 或臨時文件傳遞,避免轉義與長度問題;輸出超過 maxOutputChars 會截斷;CLI 部分子命令不支持 --json(如 todo update、list)時,插件回退到純文本輸出再交給模型。
首次使用流程¶
下面介紹 agent 第一次調用任意 youdaonote 工具時插件的行爲,無需事先手工裝 CLI 或填 Key(在支持的環境下)。
- 檢查 CLI:若 PATH 或數據目錄裏已有
youdaonote則直接使用;若不存在且平臺爲 Linux/macOS,插件執行官方安裝腳本,目標目錄爲~/.dsh/integrations/dsh-youdaonote/bin(需要curl和bash)。Windows 不支持自動安裝,會報錯並附手動安裝指引。 - 檢查 API Key:運行
youdaonote check;若未配置且環境支持提問(Web UI / TUI),通過 dsh 用戶提問服務彈卡片,請從 https://mopen.163.com(手機號登錄)獲取 Key 並粘貼,插件自動執行config set apiKey。headless 等不支持提問的環境,報錯信息裏帶手動配置命令。 - 進程內記憶:配置結果按進程記憶,之後不重複檢查;Key 失效時下一次調用會重新檢查並再次詢問。
安裝與啓用¶
插件以當前 dsh 進程權限運行,安裝前建議閱讀倉庫源碼與 MIT 許可證。DSH 社區目錄 SkillHub 與 DeepSeek / 幻方無官方從屬關係,屬社區生態站點。
本地目錄或 tgz 均可安裝(--profile 換成你實際運行的 profile):
# 本地目錄或 tgz 均可(--profile 填實際運行的 profile)
dsh plugin --profile web add --save-exact /path/to/dsh-youdaonote
# 驗證 + 重啓
dsh --profile web --dump-config | grep youdaonote # 應看到 "- id: youdaonote"
sudo systemctl restart dsh
升級或卸載:
dsh plugin --profile web update dsh-youdaonote
dsh plugin --profile web remove dsh-youdaonote
若 dump-config 裏沒有 youdaonote,說明插件裝進了別的 profile,dsh plugin 是按 profile 安裝的。
配置(可選)¶
默認值內建,可不寫 config。需要覆蓋時在 profile 的 cordis.patch.yml 中 patch,例如:
- insert:
- id: youdaonote
name: dsh-youdaonote
config:
bin: youdaonote # CLI 路徑覆蓋;設爲非默認值後插件只認這一處
statSource: ydn # CLI -s 統計來源參數
timeoutMs: 120000 # 單次 CLI 調用超時(clip 較慢,別低於 60s)
maxOutputChars: 100000 # 工具輸出字符上限
autoInstall: true # CLI 缺失時自動安裝(Linux/macOS)
autoAskKey: true # 缺 Key 時通過提問服務索要
dataDir: ~/.dsh/integrations/dsh-youdaonote
binDir: ~/.dsh/integrations/dsh-youdaonote/bin
installUrl: https://artifact.lx.netease.com/download/youdaonote-cli/install.sh
典型用法(從 agent 視角)¶
README 未給出固定對話示例,用法即 agent 在任務中按需調用上表工具,例如:
- 用
youdaonote_search按關鍵詞定位筆記,再用youdaonote_read拉全文; - 用
youdaonote_list瀏覽文件夾結構; - 用
youdaonote_save/youdaonote_update寫入或更新 Markdown; - 用
youdaonote_todo查待辦或分組,或創建、更新、刪除待辦; - 用
youdaonote_clip把 URL 剪藏進筆記; - 用
youdaonote_manage刪除、重命名或移動筆記。
寫操作不可與同類寫操作併發;只讀工具標註爲可併發。
排錯與注意¶
| 現象 | 處理 |
|---|---|
| 自動安裝失敗 | 檢查能否訪問 artifact.lx.netease.com(可用 curl -I);失敗信息含手動安裝命令 |
| 想重新觸發 Key 提問 | 重啓 dsh 進程;或手動 youdaonote config set apiKey <KEY> |
| 提示不支持交互提問 | profile 未掛載提問服務(如 headless),按報錯裏的手動命令配置 |
| 輸出是純文本不是 JSON | 正常:部分 CLI 子命令不支持 --json,插件已回退 |
| dump-config 無 youdaonote | 插件裝在別的 profile |
實測基於 youdaonote CLI 1.3.4(Windows)驗證,Linux 走同一官方安裝腳本。升 dsh 後建議跑一次 --dump-config 驗證;developer preview 階段上游接口可能變動。
結尾¶
dsh-youdaonote 把有道雲筆記能力收斂爲 8 個 dsh 工具,依賴官方 CLI,並儘量自動化 CLI 安裝與 API Key 配置,適合已在用有道雲筆記、又希望 agent 直接讀寫筆記與待辦的 DSH 部署。