JUSTMONIKA2022/dsh-sandbox-escalation-fix 预览 preview

JUSTMONIKA2022/dsh-sandbox-escalation-fix

插件Plugin ⭐ 12 MIT security

Session-aware sandbox escalation compatibility plugin for DeepSeek Harness/DSH第三方模型会话沙箱升级兼容插件

编辑导读Editor's Brief

## 核心特性
- 根据每个会话实时的 Sandbox Mode 和 Approval Policy,投影模型可见的 bashpwshwriteedit 工具 schema。
- 当会话已经处于 danger-full-access 或 approval policy 为 never 时,从面向模型的 schema 中移除 sandbox_permissionsjustification
- 在允许审批的 read-onlyworkspace-write 会话中,仅暴露真正更宽泛的升级目标。
- 仅当请求模式等于有效模式时,移除执行时的 sandbox_permissionsjustification 成对字段;降级、未知目标、未配对以及真实升级请求仍交由 DSH 正常校验。
- 当不存在可行升级目标时,从 Shell 工具描述中剥离升级指引,并从 Shell、filesystem、Code Mode 和 job_output 结果中移除不可能的升级提示。

## 使用场景
- All Access 会话中,第三方模型在工具执行前因无效 justification 或非放宽型 sandbox 升级错误而反复失败的场景。
- 使用 approval=never 的会话中,已暴露的升级字段无法成功并可能导致重试循环。
- read-onlyworkspace-write 会话中,模型应只看到严格宽于当前模式的升级目标。
- 使用动态 Preset restrictions 的 Agent,需要 wrapper 可见性随工具可用性变化,而无需重建 Agent。

## 技术细节
- Schema 投影发生在每个 Agent Exact Scope 内,因此 Native tool schemas 和 Code Mode SDK 定义会读取到相同的会话特定结果。
- 插件监听 Agent 创建、销毁、Preset 变更、restrictions 和工具变更,并随着工具面变化恢复或挂起 wrappers。
- 启动校验会检查已安装的 @deepseek-ai/dsh-* 包版本,并拒绝混合或未知的 DSH 版本,而不是继续使用不兼容的工具定义。
- Wrapper 协调使用显式的 Symbol.for('dsh.tool-wrapper.v1') 协议,未知的同名 wrapper 会导致 Agent 注册失败。

## 注意事项
- DSH rc8 已通过 approval=never 运行时指令部分解决该问题,因此 RC8 用户在安装此插件前应先复现所述故障。
- 该插件需要 Node.js ^22.19.0>=24.0.0@deepseek-ai/cordis 4.0.1,以及 DSH 0.1.0-rc.50.1.0-rc.8
- 基于 Git 的安装会执行包的 prepare 脚本,并可能需要在 Profile 的 pnpm-workspace.yaml 中添加 allowBuilds 条目。

## Core Features
- Projects the model-visible tool schema for bash, pwsh, write, and edit from each session's live Sandbox Mode and Approval Policy.
- Removes sandbox_permissions and justification from the model-facing schema when the session is already at danger-full-access or when the approval policy is never.
- Advertises only genuinely wider escalation targets in read-only and workspace-write sessions where approval is allowed.
- Removes an execution-time sandbox_permissions and justification pair only when the requested mode equals the effective mode, while leaving downgrade, unknown-target, unpaired, and genuine escalation requests for normal DSH validation.
- Strips escalation guidance from Shell tool descriptions and removes impossible escalation hints from Shell, filesystem, Code Mode, and job_output results when no viable escalation target exists.

## Use Cases
- All Access sessions where third-party models repeatedly fail on invalid justification or non-widening sandbox escalation errors before tool execution.
- Sessions using approval=never where advertised escalation fields cannot succeed and may cause retry loops.
- read-only or workspace-write sessions where the model should see only escalation targets that are strictly wider than the current mode.
- Agents using dynamic Preset restrictions that require wrapper visibility to follow tool availability without recreating the Agent.

## Technical Details
- Schema projection occurs inside each Agent Exact Scope, so Native tool schemas and Code Mode SDK definitions read the same session-specific result.
- The plugin listens to Agent creation, disposal, Preset changes, restrictions, and tool changes, restoring or suspending wrappers as the tool surface changes.
- Startup verification checks installed @deepseek-ai/dsh-* package versions and rejects mixed or unknown DSH releases instead of continuing with incompatible tool definitions.
- Wrapper coordination uses the explicit Symbol.for('dsh.tool-wrapper.v1') protocol, and unknown same-name wrappers cause Agent registration to fail.

## Notes
- DSH rc8 partially addresses the issue through an approval=never runtime instruction, so RC8 users should reproduce the described failures before installing this plugin.
- The plugin requires Node.js ^22.19.0 or >=24.0.0, @deepseek-ai/cordis 4.0.1, and DSH 0.1.0-rc.5 through 0.1.0-rc.8.
- Git-based installation executes the package prepare script and may require an allowBuilds entry in the Profile's pnpm-workspace.yaml.

安装Install

dsh plugin --profile web add github:JUSTMONIKA2022/dsh-sandbox-escalation-fix

JUSTMONIKA2022/dsh-sandbox-escalation-fix 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

上一个 Prev ikanban 下一个 Next dsh-token-usage