dsh-summary-panel:DeepSeek Harness Web 的可擴展摘要面板

前言

DeepSeek Harness (DSH) Web 強調插件化架構,開發者常需要在多輪對話中追蹤文件變更與上下文狀態。傳統的會話管理缺乏直觀的聚合視圖,導致難以快速定位最近修改的文件。dsh-summary-panel 插件提供了一個 Codex 風格的固定摘要面板,旨在解決這一問題。

核心功能

該插件通過讀取 ui-deliverables 中的成功文件變異,聚合所有已加載的 Turns,並保留每個文件路徑的最終有效狀態。其核心功能包括:

  • 文件聚合展示:按修改時間倒序顯示最近修改的文件,默認展示 5 個,支持展開與摺疊。
  • 交互與佈局:提供 320px 寬度的緊湊彈出窗口,內容超出視口高度時支持滾動。在移動端,該面板會變爲一個可關閉的右側抽屜。
  • 狀態持久化:會話的打開狀態會在會話期間保持。
  • 擴展性:支持通過 Client 插件 API 註冊自定義摘要區域。

安裝與啓用

通過 CLI 安裝該插件,支持遠程提交或本地 tarball 兩種方式。安裝後需重新加載配置並啓動 Web 服務。

dsh plugin --profile <profile> add github:hzthzt/dsh-summary-panel#<commit-sha>
dsh plugin --profile <profile> add ./dsh-summary-panel-0.1.0.tgz

安裝完成後,執行以下命令以應用配置並啓動服務:

dsh --profile <profile> --dump-config
dsh --profile <profile> web

擴展與自定義

插件提供了擴展 API,允許開發者通過 conversation.summary.section 列表槽位註冊自定義的會話級摘要區域。開發者可以通過 SummarySection、SummaryItem 和 SummaryEmpty 等組件構建自定義內容。

以下是基於 TypeScript 的自定義區域註冊示例:

import type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'
import {
  SummaryEmpty,
  SummarySection,
  type SummarySectionComponentProps,
} from 'dsh-summary-panel/client'

function ReviewSection({ presentation, closePanel }: SummarySectionComponentProps) {
  return (
    <SummarySection title="Review" actionLabel="Add review" onAction={() => {}}>
      <SummaryEmpty>Nothing to review</SummaryEmpty>
      <small>{presentation}</small>
      <button type="button" onClick={closePanel}>Close</button>
    </SummarySection>
  )
}

export function apply(ctx: ClientContext): void {
  ctx.slots.inject('conversation.summary.section', () => ctx.slots.register({
    name: 'conversation.summary.section',
    id: 'review',
    order: 30,
  }, ReviewSection))
}

此外,插件還提供了對 ctx.summaryPanel 的增強方法,支持手動控制面板的打開、關閉與切換:

ctx.summaryPanel.open(sessionId)
ctx.summaryPanel.close(sessionId)
ctx.summaryPanel.toggle(sessionId)

環境與依賴

使用該插件需滿足特定的運行時與依賴版本要求:

  • Node.js 版本:要求 Node.js ^24.0.0。
  • DSH 版本:插件版本 0.1.0 針對目標環境 dsh-v0.1.1-rc.2(commit b150a551b8d465e31e418e1b2eaf5e79bbb7d28e)。
  • Peer Dependencies:需要特定版本的 @deepseek-ai/cordis (^4.0.1) 以及多個 dsh-client-runtime 及 UI 相關組件(如 dsh-client-runtime 0.1.1-rc.2)。
  • 許可證:MIT。

總結

dsh-summary-panel 爲 DeepSeek Harness Web 提供了一個結構化的會話文件摘要視圖。它不直接管理文件創建流程,而是專注於讀取與展示已交付的文件變更,適合需要清晰追蹤上下文變更的開發者。更多詳情與源碼,可參考插件目錄頁或 GitHub 倉庫。

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

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

小夜