mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-12-01 03:40:22 +08:00
release: 1.3.6 适配 dsh 0.1.5-rc.1,修复工作区清空与历史会话
persona text→prefix、mnemon v0 summary 可迁移,身份只认 prompt-inject;README 补严正合规声明。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
9d05cc7340
commit
678955c130
8 files changed
+429
-195
No files matched your search
+2
-21
@@ -15,7 +15,6 @@ import * as core from "./core.js";
|
||||
import * as rules from "./rules.js";
|
||||
import {
|
||||
GLOBAL_PROMPT_ORDER,
|
||||
buildIdentityCard,
|
||||
rewritePromptAssembly,
|
||||
} from "./identity.js";
|
||||
|
||||
@@ -89,31 +88,13 @@ function readInjectFile(injectFile) {
|
||||
}
|
||||
|
||||
export function registerPromptSections(ctx, config, injectFile) {
|
||||
// Identity card at harness:identity order so it outranks product branding.
|
||||
const identityOrder =
|
||||
typeof ctx.systemPrompt.getSectionOrder === "function"
|
||||
? ctx.systemPrompt.getSectionOrder("HARNESS_IDENTITY")
|
||||
: -1000;
|
||||
ctx.systemPrompt.section({
|
||||
name: "dsh-purge:identity",
|
||||
order: Number.isFinite(identityOrder) ? identityOrder : -1000,
|
||||
text: () => {
|
||||
if (!config.enabled) return "";
|
||||
return buildIdentityCard(readInjectFile(injectFile));
|
||||
},
|
||||
});
|
||||
|
||||
// Only inject when prompt-inject.md has content.
|
||||
// Empty/missing = no inject section → cleaned official baseline only.
|
||||
// Non-empty = inject verbatim (user prompt is primary), card first.
|
||||
// prompt-inject.md verbatim. No plugin identity card.
|
||||
ctx.systemPrompt.section({
|
||||
name: "dsh-purge",
|
||||
order: GLOBAL_PROMPT_ORDER,
|
||||
text: () => {
|
||||
if (!config.enabled) return "";
|
||||
const raw = readInjectFile(injectFile);
|
||||
if (!raw) return "";
|
||||
return `${buildIdentityCard(raw)}\n\n${raw}`;
|
||||
return readInjectFile(injectFile);
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user