dsh-coding-preset:DSH coding 模式在 Windows 上使用持久 pwsh 的預設

前言

在 DSH 的插件/預設生態中,coding 模式需要穩定的命令執行環境。已覈實資料給出的官方路徑裏,minimal 預設使用持久 bash;dsh-coding-preset 針對 Windows,將 shell 換成持久 PowerShell 7(pwsh),並保留官方 minimal 的 coding 會話邊界:只暴露 pwsh 與 str_replace_editor。

需要說明:資料標記該包爲 DEPRECATED,並指出 DSH 官方 minimal 模式現在默認提供同類功能。下面按已覈實事實介紹其定位、能力、安裝方式和限制。

這是什麼

Saikel-Orado-Liu/dsh-coding-preset 是一個 Windows 適配的 DSH coding-mode agent preset。它的目標是讓 DSH web profile 在 Windows 上使用持久 pwsh 會話,而不是官方 minimal 預設中的持久 bash。

已覈實資料中的關鍵邊界:

  • 保留官方 minimal persona:You are a helpful software engineer assistant.
  • coding 模式會話只暴露兩個工具:pwsh 和 str_replace_editor
  • 持久 shell 基於 node-pty/ConPTY
  • 許可證爲 MIT
  • README 標記爲 DEPRECATED,建議使用 DSH 官方 minimal 模式

核心能力

持久 pwsh

在 danger-full-access 下,它提供 persistent PTY 執行。同一會話中的變量、函數、別名和當前目錄在調用之間保留。

在 read-only 和 workspace-write 下,執行走一次性 pwsh -Command 路徑,狀態不保留。

沙箱提權

受限命令被拒絕時,可以攜帶 sandbox_permissions 和 justification 發起單次審批,經過 ctx.approval 處理。拒絕或缺少 justification 時按失敗關閉處理。

該提權只作用於單次調用,不改變會話模式。

模式切換

有效 sandbox mode 發生變化時,它會關閉 persistent terminals,並在下一次調用時按新模式重建 shell。

安裝與國際化

安裝到 DSH web profile 時,postinstall 會部署 preset 文件與內部包;也支持手動部署。資料說明包含英文和簡體中文 locale 支持。

安裝與啓用

前置

本機需要有 PowerShell 7(pwsh),不是 Windows PowerShell 5.1(powershell.exe)。

安裝到 web profile

先安裝到 web profile:

npx @deepseek-ai/dsh plugin --profile web add @gamegeek-saikel/dsh-coding-agent-preset

再啓動 DSH:

npx @deepseek-ai/dsh web

如果 DSH CLI 已全局安裝,也可以改用 dsh:

dsh plugin --profile web add @gamegeek-saikel/dsh-coding-agent-preset
dsh web

注意:已覈實資料中的 package.json name 是 @gamegeek-saikel/dsh-coding-preset,與上面安裝命令中的 @gamegeek-saikel/dsh-coding-agent-preset 不一致。本文按資料給出的安裝命令記錄;實際安裝前應確認 npm 上可安裝的包名。

手動部署

如果不用 npm 包安裝,可以手動部署:

1、把 agent.cordis.yml 和 preset.yml 複製到:

~/.dsh/.agent-presets/coding/

2、運行 install.ps1,把兩個內部包複製到:

~/.dsh/profiles/node_modules

以及 harness 的 node_modules。

典型用法

持久性檢查

在 danger-full-access 會話中,可以這樣檢查持久性:

1、運行:

Write-Output "hello"

2、再運行一條讀取上一命令所設變量的命令。

如果第二條命令能讀到第一條命令留下的狀態,說明持久 shell 生效。

受限模式

在 read-only 或 workspace-write 會話中,命令按一次性 pwsh -Command 執行。不要期待變量、函數、別名或當前目錄跨命令保留。

單次提權

如果受限命令因文件訪問被拒絕,輸出中會提示可重試一次並攜帶 sandbox_permissions。重試時使用 justification 說明原因;獲批後僅當前調用生效,會話模式不變。

適用場景與注意

適合:

  • 在 Windows 上使用 DSH coding 模式,並希望命令執行落在持久 pwsh 的開發者
  • 希望 coding 會話只暴露 pwsh 和 str_replace_editor 的使用者
  • 需要在 danger-full-access 與受限模式之間保持明確行爲邊界的使用者

注意:

  • 該包被標記爲 DEPRECATED。如果 DSH 官方 minimal 模式已可用,優先使用官方 minimal 模式。
  • 它要求 pwsh,不要求也不兼容 Windows PowerShell 5.1 的 powershell.exe。
  • 插件/預設會隨當前 DSH 進程運行。安裝前應檢查源碼、依賴、命令包裝、PTY 後端子進程行爲和沙箱邏輯,並確認許可證 MIT 符合使用要求。
  • DSH 的社區目錄是獨立站點,不等同於 DeepSeek 或幻方的官方應用商店;不要把該 preset 理解爲官方應用商店中的默認組件。

結尾

dsh-coding-preset 的價值在於把 DSH coding 模式的 Windows 路徑聚焦到持久 pwsh 和兩個固定工具上。由於資料標明它已棄用,當前更穩妥的做法是先確認 DSH 官方 minimal 模式是否已覆蓋需求;若仍要安裝該 preset,應按本文步驟檢查 pwsh、安裝命令、包名和源碼。

GitHub:https://github.com/Saikel-Orado-Liu/dsh-coding-preset

目錄頁:本文資料未提供固定 URL,可在 DSH 社區目錄中按 dsh-coding-preset 查找。

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

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

小夜