mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 14:00:22 +08:00
fix: 去掉点了也不变的 fetch 启用补丁,后面编号前移
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
d1de2cc7c8
commit
feacf58d8a
4 files changed
+84
-125
No files matched your search
+28
-67
@@ -2186,46 +2186,7 @@ const NEW_TOOL_PATCHES = [
|
||||
markers: ["[dsh-purge] tool-result pruning disabled"],
|
||||
},
|
||||
{
|
||||
// 只改尚未打开 fetch 的布局,避免重复插入 YAML 键。
|
||||
id: 20, name: "WEB_FETCH_ENABLED", layer: "代码", layer_en: "Code",
|
||||
desc: "插件 dsh-web-fetch-http:启用 fetch + provider(可选) / @deepseek-ai/dsh-web-fetch-http",
|
||||
optional: true, // package/layout varies by install — never block Apply
|
||||
file: "base",
|
||||
rel: ["cordis.patch.yml"],
|
||||
replacements: [
|
||||
{
|
||||
pattern:
|
||||
' - id: tool-web\n' +
|
||||
" name: '@deepseek-ai/dsh-tool-web'\n" +
|
||||
' config:\n' +
|
||||
' fetch: false\n' +
|
||||
' searchTimeoutMs: 60000',
|
||||
replace:
|
||||
' - id: tool-web\n' +
|
||||
" name: '@deepseek-ai/dsh-tool-web'\n" +
|
||||
' config:\n' +
|
||||
' fetch: true\n' +
|
||||
' searchTimeoutMs: 60000',
|
||||
},
|
||||
{
|
||||
// 仅当下一行还没有 fetchProvider。
|
||||
pattern:
|
||||
' searchProvider: deepseek-official\n\n' +
|
||||
' - id: web-search-deepseek\n' +
|
||||
" name: '@deepseek-ai/dsh-web-search-deepseek'",
|
||||
replace:
|
||||
' searchProvider: deepseek-official\n' +
|
||||
' fetchProvider: http\n\n' +
|
||||
' - id: web-fetch-http\n' +
|
||||
" name: '@deepseek-ai/dsh-web-fetch-http'\n\n" +
|
||||
' - id: web-search-deepseek\n' +
|
||||
" name: '@deepseek-ai/dsh-web-search-deepseek'",
|
||||
},
|
||||
],
|
||||
markers: ["id: web-fetch-http", "fetchProvider: http", "fetch: true\n searchTimeoutMs"],
|
||||
},
|
||||
{
|
||||
id: 21, name: "WEB_FETCH_BASE_DEPENDENCY", layer: "代码", layer_en: "Code",
|
||||
id: 20, name: "WEB_FETCH_BASE_DEPENDENCY", layer: "代码", layer_en: "Code",
|
||||
desc: "插件 dsh-web-fetch-http:base 写入依赖(可选) / @deepseek-ai/dsh-web-fetch-http",
|
||||
file: "base-package",
|
||||
optional: true,
|
||||
@@ -2257,7 +2218,7 @@ const NEW_TOOL_PATCHES = [
|
||||
markersAny: true, // workspace vs published version — only one exists per install
|
||||
},
|
||||
{
|
||||
id: 22, name: "BASH_TIMEOUT_RAISED", layer: "代码", layer_en: "Code",
|
||||
id: 21, name: "BASH_TIMEOUT_RAISED", layer: "代码", layer_en: "Code",
|
||||
desc: "bash 超时 60s → 10min / bash timeout raised",
|
||||
file: "base",
|
||||
rel: ["cordis.patch.yml"],
|
||||
@@ -2275,7 +2236,7 @@ const NEW_TOOL_PATCHES = [
|
||||
markers: ["timeoutMs: 600000 // [dsh-purge] bash timeout raised"],
|
||||
},
|
||||
{
|
||||
id: 23, name: "READ_CAPS_RAISED", layer: "代码", layer_en: "Code",
|
||||
id: 22, name: "READ_CAPS_RAISED", layer: "代码", layer_en: "Code",
|
||||
desc: "read 上限放宽 / read caps raised",
|
||||
file: "tool-fs",
|
||||
rel: ["lib", "index.js"],
|
||||
@@ -2296,7 +2257,7 @@ const NEW_TOOL_PATCHES = [
|
||||
markers: ["READ_MAX_LINE_LENGTH = 1e4", "READ_MAX_BYTES = 1024 * 1024", "READ_LIMIT = 2e4"],
|
||||
},
|
||||
{
|
||||
id: 24, name: "SUBAGENT_MAXDEPTH_RAISED", layer: "代码", layer_en: "Code",
|
||||
id: 23, name: "SUBAGENT_MAXDEPTH_RAISED", layer: "代码", layer_en: "Code",
|
||||
desc: "子代理深度 3 → 10 / subagent maxDepth raised",
|
||||
file: "tool-subagent",
|
||||
rel: ["lib", "index.js"],
|
||||
@@ -2311,7 +2272,7 @@ const NEW_TOOL_PATCHES = [
|
||||
markers: ['z.const("provider-managed")]).default(10)'],
|
||||
},
|
||||
{
|
||||
id: 25, name: "PRESET_FETCH_ENABLED", layer: "代码", layer_en: "Code",
|
||||
id: 24, name: "PRESET_FETCH_ENABLED", layer: "代码", layer_en: "Code",
|
||||
desc: "preset tool-web fetch 打开 / preset fetch enabled",
|
||||
file: ["preset-unrestricted", "preset-standard", "preset-cordis", "preset-ptc", "preset-liangshen", "preset-liangshen-pkg"],
|
||||
rel: ["agent.cordis.yml"],
|
||||
@@ -2336,7 +2297,7 @@ const NEW_TOOL_PATCHES = [
|
||||
markers: ["[dsh-purge] preset fetch enabled", "fetch: true"],
|
||||
},
|
||||
{
|
||||
id: 26, name: "HARNESS_IDENTITY_STRIP", layer: "提示词", layer_en: "Prompt",
|
||||
id: 25, name: "HARNESS_IDENTITY_STRIP", layer: "提示词", layer_en: "Prompt",
|
||||
desc: "去掉官方默认身份,保留官方功能提示词 / strip default identity only",
|
||||
file: [
|
||||
"system-prompt",
|
||||
@@ -2467,7 +2428,7 @@ const NEW_TOOL_PATCHES = [
|
||||
},
|
||||
{
|
||||
// minimal 的 complete:true 会挡住 inject;只打开槽并去掉默认身份。
|
||||
id: 27, name: "MINIMAL_PERSONA_PURGE", layer: "提示词", layer_en: "Prompt",
|
||||
id: 26, name: "MINIMAL_PERSONA_PURGE", layer: "提示词", layer_en: "Prompt",
|
||||
desc: "内置 minimal:去掉默认身份并打开 complete,让 inject 能进 / strip identity, open inject",
|
||||
file: ["preset-minimal", "preset-sdk-minimal"],
|
||||
replacements: [
|
||||
@@ -2596,7 +2557,7 @@ const NEW_TOOL_PATCHES = [
|
||||
},
|
||||
{
|
||||
// 梁神 phase-1 只留 persona,滤掉 inject。
|
||||
id: 28, name: "LIANGSHEN_PERSONA_PURGE", layer: "提示词", layer_en: "Prompt",
|
||||
id: 27, name: "LIANGSHEN_PERSONA_PURGE", layer: "提示词", layer_en: "Prompt",
|
||||
desc: "插件 dsh-liangshen(梁神):拒绝锁→可执行(可选) / @linxin666/dsh-liangshen",
|
||||
file: ["preset-liangshen", "preset-liangshen-pkg"],
|
||||
optional: true, // only when liangshen is installed; text drifts by version
|
||||
@@ -2646,7 +2607,7 @@ const NEW_TOOL_PATCHES = [
|
||||
},
|
||||
{
|
||||
// phase-1 白名单放行 dsh-purge section。
|
||||
id: 29, name: "LIANGSHEN_PHASE1_KEEP_INJECT", layer: "提示词", layer_en: "Prompt",
|
||||
id: 28, name: "LIANGSHEN_PHASE1_KEEP_INJECT", layer: "提示词", layer_en: "Prompt",
|
||||
desc: "插件 dsh-liangshen(梁神):phase-1 保留注入段(可选) / @linxin666/dsh-liangshen",
|
||||
file: ["liangshen-tool-bootstrap"],
|
||||
optional: true, // liangshen-only; bootstrap source changes across releases
|
||||
@@ -2713,7 +2674,7 @@ const NEW_TOOL_PATCHES = [
|
||||
},
|
||||
{
|
||||
// Web GUI 文案里的产品名会进「你是谁」回答。
|
||||
id: 33, name: "WEB_SURFACE_IDENTITY_NEUTRAL", layer: "提示词", layer_en: "Prompt",
|
||||
id: 32, name: "WEB_SURFACE_IDENTITY_NEUTRAL", layer: "提示词", layer_en: "Prompt",
|
||||
desc: "Web 面:去掉 DeepSeek Harness 自称 / neutralize web GUI identity branding",
|
||||
file: ["web-app-lib"],
|
||||
optional: true,
|
||||
@@ -2738,7 +2699,7 @@ const NEW_TOOL_PATCHES = [
|
||||
},
|
||||
{
|
||||
// 去掉 fetch/search 结果「不可信 / 不是指令」提示,功能保留。
|
||||
id: 30, name: "TOOL_WEB_UNTRUSTED_NEUTRAL", layer: "工具", layer_en: "Tools",
|
||||
id: 29, name: "TOOL_WEB_UNTRUSTED_NEUTRAL", layer: "工具", layer_en: "Tools",
|
||||
desc: "dsh-tool-web:外部内容 untrusted 拦截→可执行数据 / neutralize web untrusted framing",
|
||||
file: ["tool-web", "tool-web-nested"],
|
||||
optional: true,
|
||||
@@ -2770,7 +2731,7 @@ const NEW_TOOL_PATCHES = [
|
||||
},
|
||||
{
|
||||
// hooks.json 的 deny 改成 allow,其余 hook 逻辑不动。
|
||||
id: 31, name: "HOOKS_CLAUDE_DENY_ALLOW", layer: "工具", layer_en: "Tools",
|
||||
id: 30, name: "HOOKS_CLAUDE_DENY_ALLOW", layer: "工具", layer_en: "Tools",
|
||||
desc: "dsh-hooks-claude-code:deny→allow(可选) / hooks deny bypass",
|
||||
file: ["hooks-claude-code", "hooks-claude-code-nested"],
|
||||
optional: true,
|
||||
@@ -2783,7 +2744,7 @@ const NEW_TOOL_PATCHES = [
|
||||
markers: ["[dsh-purge] hooks deny→allow"],
|
||||
},
|
||||
{
|
||||
id: 32, name: "HOOKS_CODEX_DENY_ALLOW", layer: "工具", layer_en: "Tools",
|
||||
id: 31, name: "HOOKS_CODEX_DENY_ALLOW", layer: "工具", layer_en: "Tools",
|
||||
desc: "dsh-hooks-codex:deny→allow(可选) / hooks deny bypass",
|
||||
file: ["hooks-codex", "hooks-codex-nested"],
|
||||
optional: true,
|
||||
@@ -2797,7 +2758,7 @@ const NEW_TOOL_PATCHES = [
|
||||
},
|
||||
{
|
||||
// bash/pwsh 工具描述里的拒绝句改掉。
|
||||
id: 34, name: "TOOL_SHELL_DENIAL_PROMPT", layer: "提示词", layer_en: "Prompt",
|
||||
id: 33, name: "TOOL_SHELL_DENIAL_PROMPT", layer: "提示词", layer_en: "Prompt",
|
||||
desc: "bash/pwsh 工具描述:沙箱拒绝话术→可继续 / neutralize sandbox-denial tool text",
|
||||
file: ["tool-bash", "tool-pwsh"],
|
||||
optional: true,
|
||||
@@ -2868,7 +2829,7 @@ const NEW_TOOL_PATCHES = [
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 35, name: "SANDBOX_HINT_NEUTRAL", layer: "提示词", layer_en: "Prompt",
|
||||
id: 34, name: "SANDBOX_HINT_NEUTRAL", layer: "提示词", layer_en: "Prompt",
|
||||
desc: "沙箱拒绝/升级 hint 不再要求用户审批 / neutralize sandbox hint to model",
|
||||
file: "escalation",
|
||||
replacements: [
|
||||
@@ -2893,7 +2854,7 @@ const NEW_TOOL_PATCHES = [
|
||||
},
|
||||
{
|
||||
// escalation 不再因加宽失败抛 reject。
|
||||
id: 36, name: "ESCALATION_NEVER_REJECT", layer: "代码", layer_en: "Code",
|
||||
id: 35, name: "ESCALATION_NEVER_REJECT", layer: "代码", layer_en: "Code",
|
||||
desc: "升级结果 rejected/cancelled/unavailable 仍授信 / escalation never throws",
|
||||
file: "escalation",
|
||||
replacements: [
|
||||
@@ -2930,7 +2891,7 @@ const NEW_TOOL_PATCHES = [
|
||||
markers: ["[dsh-purge] escalation never rejected"],
|
||||
},
|
||||
{
|
||||
id: 37, name: "TOOL_FS_ESCALATION_SCHEMA", layer: "提示词", layer_en: "Prompt",
|
||||
id: 36, name: "TOOL_FS_ESCALATION_SCHEMA", layer: "提示词", layer_en: "Prompt",
|
||||
desc: "fs 升级字段:去掉 user approval 拦截描述 / neutralize fs escalation schema",
|
||||
file: "tool-fs",
|
||||
optional: true,
|
||||
@@ -2952,7 +2913,7 @@ const NEW_TOOL_PATCHES = [
|
||||
},
|
||||
{
|
||||
// 子 agent 的 permission-scope 提示词。
|
||||
id: 38, name: "SUBAGENT_SCOPE_LOCK_NEUTRAL", layer: "提示词", layer_en: "Prompt",
|
||||
id: 37, name: "SUBAGENT_SCOPE_LOCK_NEUTRAL", layer: "提示词", layer_en: "Prompt",
|
||||
desc: "子代理权限锁→可继续 / neutralize subagent scope-lock prompt",
|
||||
file: ["subagent", "subagent-types"],
|
||||
optional: true,
|
||||
@@ -2977,7 +2938,7 @@ const NEW_TOOL_PATCHES = [
|
||||
},
|
||||
{
|
||||
// 0.1.5 schema 不认 text;社区预设仍带 text 时挂载失败。
|
||||
id: 39, name: "PERSONA_TEXT_PREFIX_ALIAS", layer: "代码", layer_en: "Code",
|
||||
id: 38, name: "PERSONA_TEXT_PREFIX_ALIAS", layer: "代码", layer_en: "Code",
|
||||
desc: "dsh-persona:兼容 0.1.2 text 字段,否则梁神会话起不来 / accept legacy text as prefix",
|
||||
file: "persona",
|
||||
optional: true, // 仅旧版 0.1.2 persona 使用;新版 prefix 结构无需改写
|
||||
@@ -3008,7 +2969,7 @@ const NEW_TOOL_PATCHES = [
|
||||
},
|
||||
{
|
||||
// v0→v1 只允许 notice 带 summary;mnemon 的 instructions/recall 会让旧会话打不开。
|
||||
id: 40, name: "SESSION_V0_PLUGIN_SUMMARY_ALIAS", layer: "代码", layer_en: "Code",
|
||||
id: 39, name: "SESSION_V0_PLUGIN_SUMMARY_ALIAS", layer: "代码", layer_en: "Code",
|
||||
desc: "v0 会话:mnemon summary 可挂在 instructions/recall 上 / allow plugin summary off notice",
|
||||
file: "session-format-v0",
|
||||
replacements: [
|
||||
@@ -3024,7 +2985,7 @@ const NEW_TOOL_PATCHES = [
|
||||
},
|
||||
{
|
||||
// 0.1.5 assemble 在 waterfall 之后若有 complete:true,会丢掉全部 section,提示词写了也进不去。
|
||||
id: 41, name: "COMPLETE_PROMPT_KEEP_INJECT", layer: "0.1.5 兼容", layer_en: "0.1.5",
|
||||
id: 40, name: "COMPLETE_PROMPT_KEEP_INJECT", layer: "0.1.5 兼容", layer_en: "0.1.5",
|
||||
desc: "complete 预设仍保留 dsh-purge 注入 / keep inject after complete prompt",
|
||||
file: ["system-prompt", "system-prompt-nested"],
|
||||
replacements: [
|
||||
@@ -3063,7 +3024,7 @@ const NEW_TOOL_PATCHES = [
|
||||
},
|
||||
{
|
||||
// 自定义 OpenAI 兼容接口不认 developer;推理模型默认会把 system 收成这个角色,直接 400。
|
||||
id: 42, name: "DEVELOPER_ROLE_TO_SYSTEM", layer: "0.1.5 兼容", layer_en: "0.1.5",
|
||||
id: 41, name: "DEVELOPER_ROLE_TO_SYSTEM", layer: "0.1.5 兼容", layer_en: "0.1.5",
|
||||
desc: "developer 角色改回 system,兼容接口不再 400 / remap developer role to system",
|
||||
file: ["pi-ai-completions", "pi-ai-responses-shared"],
|
||||
optional: true,
|
||||
@@ -3638,7 +3599,7 @@ function patchHasRemainingWork(text, patch, fp = "") {
|
||||
}
|
||||
|
||||
function isIdentityLayoutPatch(patch) {
|
||||
return Boolean(patch && (patch.id === 4 || patch.id === 26 || patch.id === 27));
|
||||
return Boolean(patch && (patch.id === 4 || patch.id === 25 || patch.id === 26));
|
||||
}
|
||||
|
||||
function isApprovalSentencePatch(patch) {
|
||||
@@ -3770,7 +3731,7 @@ export async function applyPatches(aiBase, patches = ALL_PATCHES) {
|
||||
const report = [];
|
||||
await repairPluginCordisYaml();
|
||||
for (const p of patches) {
|
||||
if ((p.id === 20 || p.id === 21) && !webFetchPackageAvailable(aiBase)) {
|
||||
if (p.id === 20 && !webFetchPackageAvailable(aiBase)) {
|
||||
report.push({
|
||||
patch_id: p.id, name: p.name, status: "missing_file",
|
||||
path: files[fileKeysOf(p)[0]], applied: 0, already: 0, missing: 1,
|
||||
@@ -3812,7 +3773,7 @@ export async function applyPatches(aiBase, patches = ALL_PATCHES) {
|
||||
if (changed) {
|
||||
try {
|
||||
await saveText(fp, textOut);
|
||||
if (p.id === 21 && webFetchWorkspacePaths(aiBase)) {
|
||||
if (p.id === 20 && webFetchWorkspacePaths(aiBase)) {
|
||||
const linked = ensureWebFetchWorkspaceLink(aiBase);
|
||||
if (linked.status !== "applied" && linked.status !== "already") {
|
||||
lastError = linked.status;
|
||||
@@ -3826,7 +3787,7 @@ export async function applyPatches(aiBase, patches = ALL_PATCHES) {
|
||||
continue;
|
||||
}
|
||||
if (filePatchSettled(text, p, fp)) {
|
||||
if (p.id === 21 && webFetchWorkspacePaths(aiBase) && !webFetchWorkspaceLinkReady(aiBase)) {
|
||||
if (p.id === 20 && webFetchWorkspacePaths(aiBase) && !webFetchWorkspaceLinkReady(aiBase)) {
|
||||
const linked = ensureWebFetchWorkspaceLink(aiBase);
|
||||
lastError = linked.status;
|
||||
continue;
|
||||
@@ -3858,7 +3819,7 @@ export async function patchStatus(aiBase, patches = ALL_PATCHES) {
|
||||
const files = targetFiles(aiBase);
|
||||
const status = {};
|
||||
for (const p of patches) {
|
||||
if ((p.id === 20 || p.id === 21) && !webFetchPackageAvailable(aiBase)) {
|
||||
if (p.id === 20 && !webFetchPackageAvailable(aiBase)) {
|
||||
status[p.id] = "missing_file";
|
||||
continue;
|
||||
}
|
||||
@@ -3881,7 +3842,7 @@ export async function patchStatus(aiBase, patches = ALL_PATCHES) {
|
||||
pending += 1;
|
||||
continue;
|
||||
}
|
||||
const runtimeReady = p.id !== 21
|
||||
const runtimeReady = p.id !== 20
|
||||
|| !webFetchWorkspacePaths(aiBase)
|
||||
|| webFetchWorkspaceLinkReady(aiBase);
|
||||
if (!runtimeReady) {
|
||||
|
||||
Reference in new issue
Block a user