mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 10:20:22 +08:00
fix: 版本按提交号标当前,并拦住跨站调用与旧 pin 补丁
同版本号的旧标签不再显示当前。本机接口拒绝跨站请求,更新只接受已知 ref。#41 去掉 dsh-purge:committed 短路。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
566fc3683c
commit
f3afd9a5cb
7 files changed
+172
-43
No files matched your search
+9
-2
@@ -2976,8 +2976,6 @@ const NEW_TOOL_PATCHES = [
|
||||
"\t\t\t...transformed,\n" +
|
||||
"\t\t\tsections: completeSection === void 0 ? transformed.sections : (function (complete, assembled) {\n" +
|
||||
"\t\t\t\tconst sections = assembled.sections || [];\n" +
|
||||
"\t\t\t\tconst committed = sections.find((s) => s && s.name === \"dsh-purge:committed\");\n" +
|
||||
"\t\t\t\tif (committed && String(committed.text || \"\").trim()) return [{ ...complete, name: complete.name, text: committed.text }];\n" +
|
||||
"\t\t\t\tconst inject = sections.filter((s) => String(s && s.name || \"\").startsWith(\"dsh-purge\")).map((s) => String(s.text || \"\")).filter((t) => t.length > 0).join(\"\\n\\n\");\n" +
|
||||
"\t\t\t\tconst folded = sections.find((s) => s && s.name === complete.name);\n" +
|
||||
"\t\t\t\tconst base = folded && typeof folded.text === \"string\" ? { ...complete, text: folded.text } : { ...complete };\n" +
|
||||
@@ -2988,7 +2986,15 @@ const NEW_TOOL_PATCHES = [
|
||||
"\t\t\tcontexts: runtimeContextSuppressed ? [] : transformed.contexts\n" +
|
||||
"\t\t};",
|
||||
},
|
||||
{
|
||||
pattern:
|
||||
"\t\t\t\tconst committed = sections.find((s) => s && s.name === \"dsh-purge:committed\");\n" +
|
||||
"\t\t\t\tif (committed && String(committed.text || \"\").trim()) return [{ ...complete, name: complete.name, text: committed.text }];\n",
|
||||
replace: "",
|
||||
},
|
||||
],
|
||||
// 已打过旧补丁的宿主里还有这行时,不能当成完成,要点一次应用删掉。
|
||||
forbid: ["dsh-purge:committed"],
|
||||
markers: ["[dsh-purge] complete prompt keeps inject"],
|
||||
},
|
||||
{
|
||||
@@ -3533,6 +3539,7 @@ export function sanitizeYamlPersonaScalars(text) {
|
||||
|
||||
function patchApplied(text, patch) {
|
||||
const hay = asLf(text);
|
||||
if (Array.isArray(patch.forbid) && patch.forbid.some((marker) => hay.includes(asLf(marker)))) return false;
|
||||
if (Array.isArray(patch.markers) && patch.markers.length > 0) {
|
||||
// markersAny:任一标记即可;默认要全部命中。
|
||||
const match = patch.markersAny ? "some" : "every";
|
||||
|
||||
Reference in new issue
Block a user