dsh-operating-context:在 DeepSeek Harness 中統一管理模型工作窗口

前言

DeepSeek Harness 通過插件擴展 Web Settings。對於已經接入多個 configured model service 的使用者,上下文窗口大小通常需要分別確認;如果設置得過大,也可能要求模型承載超過其實際能力的內容。

dsh-operating-context 爲 Harness 增加一個“工作窗口”頁面,用於把每個 configured model service 限制到一個 working context window,並保持在模型可承載範圍內。

這是什麼

dsh-operating-context 是一個 DeepSeek Harness 插件,由 AIMFllyYS 維護,採用 MIT 許可證,當前版本爲 v0.1.0。

它是一個 Harness bundle,不能獨立運行;官方入口是:

npx @deepseek-ai/dsh

它的定位是提供 DeepSeek Harness 的“工作窗口”settings page,並複用 adapter、ContextMeter 和 official compaction 已經讀取的 contextWindow。

核心功能

下面介紹 v0.1.0 中已覈實的主要行爲。

  • 提供 DeepSeek Harness 的“工作窗口”settings page。
  • 將每個 configured model service 限制到一個 working context window,且不超過模型可承載範圍。
  • 通過 user layer 的 settings.mutate 寫入,不掛載第二壓縮引擎、不 wrap resolveModel、不使用會覆蓋整行的 bundle patch。
  • 根據 route shape 寫入不同的字段:modelOverrides.<id>.contextWindow、models[].contextWindow 或 defaultContextWindow。
  • 通過 llm.discoverModels 讀取已安裝 catalog 的 ceiling;未知 ceiling 時不猜測。
  • 當選擇的窗口不高於模型 ceiling 時,移除 override,使 apply 冪等並恢復 native capacity。
  • 更新帶 explicit models 列表的 route 時,保留 endpoint、protocol、credential、names、output limits 和 unknown metadata。
  • 安裝 v0.1.0 時提供預構建 lib/ artifacts,安裝不執行 package code。

安裝與啓用

首次使用需要 Node.js ^22.19.0 或 >=24,並且 PATH 中可用 pnpm;dsh plugin 會轉發到 pnpm。

先安裝推薦版本 v0.1.0:

npx @deepseek-ai/dsh plugin --profile web add github:AIMFllyYS/dsh-operating-context#v0.1.0

如果在 DeepSeek Harness 源碼倉庫中操作,使用 pnpm dsh:

pnpm dsh plugin --profile web add github:AIMFllyYS/dsh-operating-context#v0.1.0

安裝完成後,檢查配置層是否出現:

npx @deepseek-ai/dsh --profile web --dump-config

在輸出中查找 # == dsh-operating-context layer。

啓動 Web UI:

npx @deepseek-ai/dsh web

進入 Settings → 工作窗口,選擇 size 並 apply。

如果之後不再需要該插件:

npx @deepseek-ai/dsh plugin --profile web remove dsh-operating-context

注意,寫入值會保留在 ~/.dsh/settings.yaml;移除插件不會回滾這些值。

典型用法

經過上面的步驟,一個常見使用流程是:

1、安裝 v0.1.0 並確認 # == dsh-operating-context layer。

2、運行 npx @deepseek-ai/dsh web 打開 Web UI。

3、打開 Settings → 工作窗口,選擇希望使用的上下文窗口大小。

4、apply 後,再次運行 npx @deepseek-ai/dsh --profile web --dump-config,覈對實際寫入的 modelOverrides、models 或 defaultContextWindow 字段。

5、如果不再使用,執行 remove 命令;已寫入值仍保留在 ~/.dsh/settings.yaml。

適用場景與注意

適合在 DSH Web profile 下管理多個 configured model service 的開發者。它適合需要把上下文窗口集中到一個 settings page 中調整,同時希望寫入值不超過模型已知 ceiling 的場景。

使用前需要注意:

  • 該插件以當前 dsh 進程權限運行,安裝前應檢查源碼與 MIT 許可證。
  • 插件已與 DeepSeek Harness 0.1.0-rc.5(commit 47f943859bef60e4160492346772ded9b24f765a,2026-08-14)做過兼容複覈;Harness plugin surface 仍是 release-candidate,遷移到更新版本時應重新確認。
  • unknown ceilings 和 explicit models lists 不能通過達到已知 native ceiling 的方式重置。
  • 如果 catalog 不再包含仍有 modelOverrides 條目的模型,adapter 會拒絕 stale entry,並可能影響整條 route;頁面會報告將移除的數量,catalog 未知時不嘗試移除。
  • 當前 v0.1.0 包含 compiled lib/ 文件,並且定義無 Git build triggers;舊修訂版 Git install 可能因 frozen-lockfile、autoInstallPeers、allowBuilds 失敗。
  • peerDependencies 包括 @deepseek-ai/cordis、@deepseek-ai/dsh-api-remotes、@deepseek-ai/dsh-client-locale、@deepseek-ai/dsh-client-runtime、@deepseek-ai/dsh-client-schema-form、@deepseek-ai/dsh-client-ui-primitives、@deepseek-ai/dsh-client-ui-settings、@deepseek-ai/dsh-client-ui-slots、@deepseek-ai/dsh-client-web-react 和 react ^18.2.0。

結尾

dsh-operating-context 提供的是一個集中的工作窗口配置頁面:它把每個 configured model service 限制到可承載範圍內,並按 route shape 寫入相應字段。

GitHub:https://github.com/AIMFllyYS/dsh-operating-context

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

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

小夜