mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-30 12:00:22 +08:00
把角色扮演给放开了,不再说是coding agent
This commit is contained in:
1 parent
9107b5830a
commit
2ca0f6344d
7 files changed
+125
-14
No files matched your search
+15
-4
@@ -12,6 +12,10 @@ import { spawn } from "node:child_process";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import * as core from "./core.js";
|
||||
import * as rules from "./rules.js";
|
||||
import {
|
||||
GLOBAL_PROMPT_ORDER,
|
||||
rewritePromptAssembly,
|
||||
} from "./identity.js";
|
||||
|
||||
export const name = "dsh-purge";
|
||||
|
||||
@@ -22,12 +26,10 @@ const DEFAULTS = {
|
||||
autoApplyOnStart: true,
|
||||
autoRevertOnMissing: false,
|
||||
postPrompt: "",
|
||||
postPromptOrder: 1000,
|
||||
postPromptOrder: 5100,
|
||||
verbose: false,
|
||||
};
|
||||
|
||||
const GLOBAL_PROMPT_ORDER = -40;
|
||||
|
||||
const log = (config, ...args) => {
|
||||
if (config?.verbose) console.log("[dsh-purge]", ...args);
|
||||
};
|
||||
@@ -111,6 +113,14 @@ export function registerPromptSections(ctx, config, injectFile) {
|
||||
});
|
||||
}
|
||||
|
||||
function installIdentityOverride(ctx) {
|
||||
if (typeof ctx.on !== "function") return;
|
||||
ctx.on("system-prompt/assemble", async (_assembly, _context, next) => {
|
||||
const assembled = typeof next === "function" ? await next() : _assembly;
|
||||
return rewritePromptAssembly(assembled);
|
||||
}, { global: true, prepend: true });
|
||||
}
|
||||
|
||||
// ── 自动重洗 ──────────────────────────────────────────────────────
|
||||
|
||||
async function autoApply(config) {
|
||||
@@ -349,7 +359,8 @@ export function apply(ctx, config) {
|
||||
.catch((e) => console.warn("[dsh-purge] rules init error:", String(e)));
|
||||
});
|
||||
|
||||
// 2. systemPrompt 注入(注入用户"全局提示词"内容;默认空则什么都不注入)
|
||||
// 2. systemPrompt 注入(操作员提示词放在 persona 之后,避免被 coding agent 盖住)
|
||||
installIdentityOverride(ctx);
|
||||
const injectFile = core.findOverrideFile(core.findDshHome());
|
||||
registerPromptSections(ctx, cfg, injectFile);
|
||||
|
||||
|
||||
Reference in new issue
Block a user