mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-30 15:50:22 +08:00
fix: #4/#26/#27 官方无身份副本不再挡别人 Apply
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
92dc408aa3
commit
a697ad8a2b
1 file changed
+25
-4
+25
-4
@@ -1435,6 +1435,21 @@ const PATCHES = [
|
|||||||
" You are a coding agent powered by the {{model}} model.",
|
" You are a coding agent powered by the {{model}} model.",
|
||||||
replace: 'prefix: ""',
|
replace: 'prefix: ""',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
pattern:
|
||||||
|
" You are a coding agent powered by the {{model}} model, running on the DeepSeek Harness.\n\n",
|
||||||
|
replace: IDENTITY_STRIP,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pattern:
|
||||||
|
"You are a coding agent powered by the {{model}} model, running on the DeepSeek Harness.",
|
||||||
|
replace: IDENTITY_STRIP,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pattern:
|
||||||
|
"You are a coding agent powered by the {{model}} model. Your working directory is {{cwd}}.",
|
||||||
|
replace: IDENTITY_STRIP,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
pattern:
|
pattern:
|
||||||
"personaPrefix: >-\n" +
|
"personaPrefix: >-\n" +
|
||||||
@@ -3050,10 +3065,14 @@ function patchHasRemainingWork(text, patch) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isIdentityLayoutPatch(patch) {
|
||||||
|
return Boolean(patch && (patch.id === 4 || patch.id === 26 || patch.id === 27));
|
||||||
|
}
|
||||||
|
|
||||||
function filePatchSettled(text, patch) {
|
function filePatchSettled(text, patch) {
|
||||||
if (patchApplied(text, patch)) return true;
|
if (patchApplied(text, patch)) return true;
|
||||||
// #26/#27 扫多份官方副本:有的本来没有身份段,不能当成 pattern 失败。
|
// #4/#26/#27 会扫多份官方副本:有的本来没有身份段,不能当成失败。
|
||||||
if (patch.id === 26 || patch.id === 27) return !patchHasRemainingWork(text, patch);
|
if (isIdentityLayoutPatch(patch)) return !patchHasRemainingWork(text, patch);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3085,9 +3104,9 @@ function applyReplacementsToText(text, patch) {
|
|||||||
return { text: out, changed };
|
return { text: out, changed };
|
||||||
}
|
}
|
||||||
|
|
||||||
function rollupPatchStatus({ applied, already, missing, notFound, lastError, keyCount }) {
|
function rollupPatchStatus({ applied, already, missing, notFound, lastError, keyCount, layoutSoft }) {
|
||||||
if (applied > 0) return "applied";
|
if (applied > 0) return "applied";
|
||||||
if (already > 0 && notFound === 0) return "already";
|
if (already > 0 && (notFound === 0 || layoutSoft)) return "already";
|
||||||
if (missing === keyCount) return "missing_file";
|
if (missing === keyCount) return "missing_file";
|
||||||
if (lastError) return lastError;
|
if (lastError) return lastError;
|
||||||
return "pattern_not_found";
|
return "pattern_not_found";
|
||||||
@@ -3101,6 +3120,7 @@ export function isPatchResultSoftOk(row, patch = null) {
|
|||||||
if (ALWAYS_SOFT_STATUSES.has(row.status)) return true;
|
if (ALWAYS_SOFT_STATUSES.has(row.status)) return true;
|
||||||
const p = patch || ALL_PATCHES.find((x) => x.id === row.patch_id || x.id === row.id);
|
const p = patch || ALL_PATCHES.find((x) => x.id === row.patch_id || x.id === row.id);
|
||||||
if (p?.optional && row.status === "pattern_not_found") return true;
|
if (p?.optional && row.status === "pattern_not_found") return true;
|
||||||
|
if (isIdentityLayoutPatch(p) && row.status === "pattern_not_found") return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3193,6 +3213,7 @@ export async function applyPatches(aiBase, patches = ALL_PATCHES) {
|
|||||||
}
|
}
|
||||||
const status = rollupPatchStatus({
|
const status = rollupPatchStatus({
|
||||||
applied, already, missing, notFound, lastError, keyCount: keys.length,
|
applied, already, missing, notFound, lastError, keyCount: keys.length,
|
||||||
|
layoutSoft: isIdentityLayoutPatch(p),
|
||||||
});
|
});
|
||||||
report.push({
|
report.push({
|
||||||
patch_id: p.id,
|
patch_id: p.id,
|
||||||
|
|||||||
Reference in new issue
Block a user