前言¶
DSH 的理念是「一切皆插件」。但實際擴展運行時時,工具、技能、命令、提示段、事件監聽、LLM 適配器、子代理提供者、Web 路由、設置命名空間、投影、藍圖、服務等仍然分屬不同接縫。dsh-fabric 面向這個場景,把這些擴展點收斂成一套聲明式 DSL、一個 fabric Service 和兩個模型工具。
這是什麼¶
- GitHub 倉庫:
https://github.com/hellosky983/dsh-fabric - 許可證:
MIT - 定位:
Fabric — the everything-is-a-plugin primitive for DeepSeek Harness (dsh)。
它提供統一的 fabric Service 與模型工具 fabric_extend / fabric_inspect,用於註冊、查詢和管理 DSH 運行時擴展。
核心能力¶
Service API¶
fabric Service 提供以下方法:
register
list
get
remove
graph
schema
插件代碼通過 ctx.get('fabric') 獲取該 Service,並調用 register 註冊擴展。
模型工具¶
fabric_extend 用於在對話中註冊純聲明式擴展,例如 promptVariable 或 promptSection。
fabric_inspect 用於查看 census 或 schema:
fabric_inspect({ detail: 'census' })
fabric_inspect({ detail: 'schema' })
支持的擴展接縫¶
支持以下 kind:
tool
skill
command
promptSection
promptContext
promptVariable
eventListener
llmAdapter
subagentProvider
webRoute
settingsNamespace
projection
blueprint
service
其中,帶可執行代碼的 kind 必須由插件代碼通過 ctx.get('fabric').register(...) 註冊,不能通過 JSON 的 fabric_extend 註冊。
只讀 census 路由¶
該插件在 DSH 自帶 web server 上註冊只讀路由:
GET /fabric/census
census 只含計數與擴展元數據,不包含會話內容。
安裝與啓用¶
下面是 README 給出的本機 web profile link 方式安裝命令。安裝時不要用 dsh plugin --profile web add ./dir;README 建議用 link: 手動寫入 profile package.json,然後執行安裝。
1、在目標 profile 的 package.json 中按 link: 方式加入 dsh-fabric。
2、執行:
export PATH=/home/kevin/.local/lib/nodejs/node-v24.19.0-linux-x64/bin:$PATH
cd /home/kevin/.dsh/profiles/web && pnpm install
該插件聲明的 peerDependency 爲:
@deepseek-ai/dsh-tools@0.1.0-rc.6
文中給出的驗證 DSH 主包版本爲:
@deepseek-ai/dsh@0.1.0-rc.6
典型用法¶
插件代碼註冊 tool¶
以下示例表示在插件 apply(ctx) 中註冊一個帶代碼的 tool:
const fabric = ctx.get('fabric')
if (!fabric) return
fabric.register({
kind: 'tool',
name: 'hello_fabric',
description: 'A tool born from another plugin via the Fabric DSL.',
parameters: { who: { type: 'string' } },
execute: async (args) => ({ hello: (args && args.who) || 'world' }),
})
對話中註冊 promptVariable 或 promptSection¶
以下示例通過 fabric_extend 註冊純聲明式擴展:
fabric_extend({ definitions: [
{ kind: 'promptVariable', name: 'myvar', value: 'hello' },
{ kind: 'promptSection', name: 'my-rules', order: 800, text: 'Always be concise.' },
]})
查看 census 與 schema¶
fabric_inspect({ detail: 'census' })
fabric_inspect({ detail: 'schema' })
本地檢查¶
做語法檢查:
node --check index.js && node --check client.js
做冒煙測試:
node smoke-test.mjs
適用場景與注意¶
適合:
- DSH 插件開發者:通過一個插件註冊其他擴展,並使用
fabricService 查詢、獲取、移除和查看 graph。 - 模型或用戶:在對話中使用
fabric_extend註冊promptVariable、promptSection等純聲明式擴展。 - 運行時觀察者:通過
fabric_inspect或GET /fabric/census查看當前擴展的計數與元數據。
注意:
- 插件以當前 dsh 進程權限運行;安裝前應檢查源碼與許可證。
- 尚未在真實 DSH 進程中做端到端運行實測;已通過靜態語法檢查與 mock 上下文冒煙測試。
- 零配置:無配置項、無環境變量、無敏感項。
- 不讀寫任何文件;不讀取會話內容;不讀取、不存儲任何憑據。
- 無持久化狀態;所有運行時擴展在插件停止時自動 dispose。
- 如果發現安全問題,應通過 GitHub private vulnerability reporting 報告。
相關鏈接¶
- GitHub:
https://github.com/hellosky983/dsh-fabric - 社區目錄頁:
https://www.skillhub.cn/plugins/hellosky983/dsh-fabric(獨立站點,非官方應用商店)