npx -y cc-safety-net@latest install --deepseek-harness。它会把 CC Safety Net 作为插件 bundle 添加到 web profile 和 desktop profile。该 bundle 注册一个只能拒绝的工具 guard:它可以阻止工具调用,但从不批准调用。bundle 加载失败时只会发出警告,因此该 profile 会在没有保护的情况下运行。安装后运行 npx cc-safety-net doctor,确认 bundle 已生效。
在 DeepSeek Harness 中安装 CC Safety Net
1
打开一次桌面应用,然后退出
打开一次 DeepSeek Harness 桌面应用,然后退出。
2
确认 pnpm 在 PATH 上
确保
pnpm 在你的 PATH 上。3
运行安装程序
4
确认 bundle 已生效
desktop profile 已存在时,安装才会覆盖它,所以要先打开一次桌面应用。之所以要退出,是因为桌面应用的插件只能在应用关闭时改动。DeepSeek Harness 需要 PATH 上有 pnpm 才能添加 bundle。
安装成功会报告 Added cc-safety-net to the DeepSeek Harness Desktop and web profiles.。只覆盖 web profile 时,消息中的 the Desktop and web profiles 会换成 the web profile。
DeepSeek Harness 安装会改动什么
DeepSeek Harness 把 CC Safety Net 作为 profile 插件 bundle 加载,而不是 hook 进程,因此它没有对应的hook 选项。安装会向每个 profile 添加 cc-safety-net,版本与你运行的安装程序相同。之后,每个 profile 的 package.json 都会列出 cc-safety-net 依赖,并启用它的 bundle。
安装覆盖的 DeepSeek Harness profile
一次安装覆盖两个 profile:webprofile,由npx @deepseek-ai/dsh web和全局安装共用desktopprofile,由桌面应用使用(仅当该 profile 已存在时)
acp、headless、sdk、sdk-minimal profile 以及之后新建的 profile 都不受 CC Safety Net 保护,需要你自己为每个 profile 添加插件:
desktop profile,安装会运行桌面应用自带的 dsh,并在以下位置查找该程序:
DeepSeek Harness 工具 guard 检查什么
DeepSeek Harness 在其他所有tools/pre-execute 监听器(包括审批和 Auto review)之后运行该 guard。
bash调用交给 POSIX 分析器。pwsh调用交给 PowerShell 分析器。- 文件类和搜索类工具调用由路径保护和机密保护检查。
command。见插件 shell 工具未被检查时。
插件 shell 工具未被检查时
插件可以给智能体添加自带的 shell 工具,例如dsh-ops 插件的 ops_bash。在你声明它之前,CC Safety Net 从不读取它的 command,因此 ops_bash 执行 git reset --hard 不会产生任何决策。声明办法见社区 shell 工具。
未声明的工具第一次执行非空 command 时,无论宿主接受还是阻止了这次调用,CC Safety Net 都会在 DeepSeek Harness 返回给智能体的结果中附上一条提示。提示要求智能体:
- 根据工具描述,或 profile 目录中
<profile>/node_modules下的插件源码,查明该工具在哪里执行命令 - 它在本机执行命令时,用
npx -y cc-safety-net rule tool add <tool-name>声明它;它的工作目录参数不是workdir、cwd或working_directory时,还要加上--cwd-arg <name> - 它在别处(例如远程主机)执行命令,或无法判断时,用
npx -y cc-safety-net rule tool add <tool-name> --no-cwd-arg声明它,这样它的命令就按在会话工作区中执行来检查 - 用
npx -y cc-safety-net rule tool list确认声明已生效,而不是执行破坏性命令来验证 - 无论结果如何,都把查明的情况告诉你
bash 和 pwsh 以及文件类和搜索类工具不会触发提示。CC Safety Net 从会话的工作目录读取你的声明,会话没有工作目录时则从启动 DeepSeek Harness 的目录读取。读取失败时,它不发出提示,直接返回宿主自己的结果。
DeepSeek Harness 检查失败时会怎样
CC Safety Net 的 guard 出错时,DeepSeek Harness 会阻止该调用。如果插件 bundle 加载失败,DeepSeek Harness 只会打印一条警告,该 profile 将在没有任何检查的情况下运行。DeepSeek Harness 的覆盖限制
- 其他 profile。 只有
web和desktopprofile 会装上 bundle。见安装覆盖的 DeepSeek Harness profile。 - 加载失败的 bundle。 可选插件的导入或
apply()失败时,DeepSeek Harness 只当作警告处理并继续运行,因此该 profile 没有保护。doctor读取的是磁盘上的 manifest,而不是正在运行的宿主,所以仍会把该 profile 报告为已配置。 - 桌面应用的崩溃恢复。 桌面应用的崩溃恢复操作会禁用第三方 bundle,在你从 Plugins 页面重新启用之前,它们一直处于关闭状态。
- PTC 模式下的
run_code。 PTC 模式默认关闭。开启后,run_code会运行模型编写的 TypeScript,这些代码可以直接调用 Node.js API。只有这些代码发起的工具调用会到达 guard,因此它通过node:fs进行的写入不会得到任何决策。 terminal_send。 需要手动开启的终端工具会把terminal_send文本直接写入持久 shell,不经分析。持久的bash或pwshshell 会在多次调用之间保留目录切换,而 CC Safety Net 以会话工作区为基准检查每次调用,因此两者可能不一致。- Windows 桌面应用。 Windows 上的桌面应用路径未经测试,包括上面的
dsh.cmd路径,以及安装用来判断桌面应用是否正在运行的%APPDATA%\@deepseek-ai\dsh-desktop\lockfile。web profile 不受影响。
从 DeepSeek Harness 卸载 CC Safety Net
web 和 desktop profile 的 manifest 中列有该 bundle,卸载会将其移除;你自行添加到其他 profile 的副本保持不动。与安装一样,桌面应用运行时卸载会停止。
这两个 profile 都没有该 bundle 时,卸载会停止并输出:
在 DeepSeek Harness 中更新 CC Safety Net
update 会为每个 profile 重新运行安装,因此桌面应用打开时它会失败。请先退出桌面应用。
DeepSeek Harness 的 profile 存放位置
设置了DSH_HOME 时,DeepSeek Harness 把 profile 放在 $DSH_HOME/profiles,否则放在 <home>/.dsh/profiles。DSH_HOME 开头的 ~ 会按你的主目录展开。
DeepSeek Harness 故障排除
Quit DeepSeek Harness Desktop, then run this command again: Desktop plugins can only change while it is closed.桌面应用正在运行。在你退出它之前,安装和卸载都会停止。DeepSeek Harness Desktop is not in its default location, so add cc-safety-net from its Plugins page.desktopprofile 已存在,但桌面应用不在上表所列的路径中。安装仍会覆盖 web profile,桌面应用这边请自行从其 Plugins 页面添加插件。DeepSeek Harness installed cc-safety-net in the web profile but did not enable it. Enable it from the Plugins page.DeepSeek Harness 添加了 bundle 却没有启用它,因此它不提供任何保护。请从 Plugins 页面启用它。消息中会写出安装覆盖的 profile。doctor报告cc-safety-net is installed in the <name> profile but its bundle is disabled。 该 profile 的package.json列有cc-safety-net依赖,但dsh.profile.bundles中没有它。请从 Plugins 页面启用该 bundle。
桌面应用不在默认位置时卸载
如果 Desktop profile 中有该 bundle,但桌面应用不在默认位置,卸载会先移除 web profile 中的副本,然后以1 退出: