dsh-granular-settings:DeepSeek Harness 的精細化設置平臺

前言

DeepSeek Harness (DSH) 生態強調“一切皆插件”。插件開發者常面臨一個具體需求:需要在不同粒度上管理配置——例如,爲當前會話指定模型,爲整個工作區設置構建標誌,或者爲全局安裝調整主題色。dsh-granular-settings 旨在解決這一問題,它作爲一個共享平臺,允許其他插件註冊這些配置項。

這是什麼

這是一個 DSH 插件,提供 Granular Settings 頁面,包含 Workspace、Session 和 Plugin 三個選項卡。它支持作用域控制,並提供了 8 種控件類型(toggle, text, color, number, slider, enum, multiselect, path)。

核心功能

  • 作用域與命名空間:支持 session(會話級)、workspace(工作區級)、global(全局級)三種作用域。所有設置通過插件包名進行命名空間隔離,防止鍵名衝突。
  • 控件類型:提供 8 種控件類型,包括文本、數字滑塊、顏色選擇、枚舉和多選等。
  • 無會話支持:在沒有打開會話時,Plugin 作用域依然可用;Global 作用域可以獨立於會話工作。
  • 調試接口:提供 /granular-settings/describe 和 /relay/events 端點用於調試。

安裝

安裝需要 DeepSeek Harness 的檢出目錄和配置文件(如 profile),並且必須先安裝其硬依賴 dsh-event-relay。

mkdir -p ~/dsh-plugins && cd ~/dsh-plugins
git clone https://github.com/joao-paulo-santos/dsh-event-relay.git
git clone https://github.com/joao-paulo-santos/dsh-granular-settings.git

# from the harness checkout
pnpm dsh plugin --profile web add ~/dsh-plugins/dsh-event-relay
pnpm dsh plugin --profile web add ~/dsh-plugins/dsh-granular-settings

典型用法

Host side (註冊控件):
插件可以在 Host 端註冊設置項,指定命名空間、作用域、類型以及默認值。

const gs = ctx.get('granularSettings')
const s = gs.register({
  namespace: 'my-plugin',
  scope: 'session',
  key: 'model',
  type: 'enum',
  label: 'Model',
  owner: 'My Plugin',
  description: 'Which model this session uses',
  options: [{ value: 'a', label: 'Model A' }],
  defaultValue: 'a',
  onChange: (value, target) => {}
})

Browser side (讀取與訂閱):
在瀏覽器端,可以使用 useSetting 鉤子來讀取和設置值。

const gs = ctx.get('granularSettings')
const [model, setModel] = gs.useSetting('my-plugin', 'session', 'model')

注意事項

  • 硬依賴:必須安裝 dsh-event-relay。
  • 環境要求:需要 DeepSeek Harness 的檢出目錄和配置文件。
  • 許可證:MIT。
羽毛球分组比赛记分
小程序二维码

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

小夜