dsh-ui-settings-icons:DeepSeek Harness 設置側邊欄自定義圖標插件

DeepSeek Harness (DSH) 的設置界面目前沒有爲每個功能模塊提供獨立的圖標支持。這導致側邊欄導航在視覺上較爲單調,開發者難以通過圖標快速識別特定的功能模塊。dsh-ui-settings-icons 是一個 DSH UI 插件,它通過引入一個新的插槽機制,爲設置側邊欄添加了自定義圖標能力,併爲部分已知能力包提供了預設圖標。

該插件由 suntianc 維護,歸類爲“趣味換裝”類別。它主要解決的是 DSH 設置導航側邊欄的圖標顯示問題。

核心功能

Keyed Icon Slot

插件在 settings shell 下聲明瞭新的鍵值子插槽 settings.section.icon。任何在 settings.section 下注冊設置分區的第三方插件,都可以通過匹配 section id 的 key 來注入自定義的 SVG 或 React 圖標組件。插槽具有動態響應性,圖標更新會自動觸發重渲染,無需重啓 web 界面。

內置預設與回退

插件內置了 16x16 矢量圖標,用於 codex-auth/GPT Auth、antigravity-auth、以及 DSH 標準部分如 models、agent-presets、plugins。當分區未提供自定義圖標且不匹配預設時,會優雅地回退到 DSH 的標準齒輪圖標。

Chrome 與可訪問性一致性

插件保留了與 DSH 默認設置外殼 100% 的功能和視覺一致性。支持鍵盤導航(Escape 關閉對話框並恢復焦點)、ARIA 對話框屬性、寬/緊湊側邊欄觸發器狀態,以及配置文件啓動器的原生支持。

零衝突 Cordis 組合

通過 cordis.patch.yml 替換默認的 ui-settings-general 行,防止了插槽聲明衝突。它嚴格遵循 DSH 的純生命週期模型,確保插件卸載時所有子插槽、字典和存儲訂閱都能正確清理。

安裝與啓用

  1. 確保目標 Host 使用 DSH 0.1.5-rc.1 版本,且依賴圖一致。
  2. 停止 dsh web 進程。
  3. 執行安裝命令:
dsh plugin --profile web add dsh-ui-settings-icons@0.1.3-rc.1
dsh plugin --profile web list

安裝完成後,刷新瀏覽器即可生效。

典型用法

若開發者想在插件中爲設置分區添加自定義導航圖標,需註冊設置分區並注入圖標插槽:

import type { Context } from '@deepseek-ai/cordis'
import type {} from '@deepseek-ai/dsh-client-ui-renderer/client'
import type {} from '@deepseek-ai/dsh-client-ui-settings/client'
import type {} from 'dsh-ui-settings-icons/client'
import { MyPluginIcon } from './MyPluginIcon.tsx'
import { MySettingsPanel } from './MySettingsPanel.tsx'

export function apply(ctx: Context): void {
  // 1. 註冊設置分區主體
  ctx.slots.inject('settings.section', () => ctx.slots.register({
    name: 'settings.section',
    id: 'my-plugin',
    order: 50,
    label: () => 'My Plugin',
  }, MySettingsPanel))

  // 2. 註冊自定義導航圖標(key 需匹配 section id)
  ctx.slots.inject('settings.section.icon', () => ctx.slots.register({
    name: 'settings.section.icon',
    key: 'my-plugin',
  }, MyPluginIcon))
}

適用場景與注意

  • 版本依賴: 插件需要 DeepSeek Harness 0.1.5-rc.1 作爲開發和最低支持基線。需要 Node.js ^22.19.0 或 >=24.0.0。
  • 安裝前準備: 安裝前必須停止 dsh web 進程。
  • 兼容性: 0.1.2 及之前的插件版本針對已廢棄的 DSH 0.1.1-rc.1 客戶端拓撲,無法在 0.1.2-alpha.5 上加載。

總結

通過引入 settings.section.icon 插槽,該插件讓 DSH 設置頁面的圖標定製變得可行,提升了界面的可識別性。更多細節可參考 GitHub。

羽毛球分组比赛记分
小程序二维码

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

小夜