mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 07:40:22 +08:00
fix: 发布 1.1.44,提示词按模式注入并让子代理吃到同一份。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
0f91546cc0
commit
c29d78b291
10 files changed
+816
-221
No files matched your search
+10
-6
@@ -2,6 +2,7 @@ import fs from "node:fs";
|
||||
import { promises as fsp } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { findDshHome, findOverrideFile, normalizeOverride } from "./core.js";
|
||||
import { modePromptText } from "./identity.js";
|
||||
|
||||
const RULE_ID_RE = /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,63}$/;
|
||||
const MAX_RULE_BYTES = 256 * 1024;
|
||||
@@ -191,15 +192,18 @@ export function resolveInjectText(dshHome) {
|
||||
return { text: "", source: "none", ruleId };
|
||||
}
|
||||
|
||||
/** 红队在当前正文之外,再带上另一份没有重复的提示词或规则集。 */
|
||||
/**
|
||||
* 官方始终用默认提示词全文,含 CTF,不读规则集。
|
||||
* 红队开了规则集就只用规则集,不带默认提示词。
|
||||
* 红队没开规则集时用默认提示词,去掉 CTF。操作说明由组装接在后面。
|
||||
* 禁区说明不进模型。
|
||||
*/
|
||||
export function resolveModeInject(dshHome, redteam) {
|
||||
const prompt = normalizeOverride(overrideFileText(dshHome));
|
||||
if (!redteam) return modePromptText(prompt, false);
|
||||
const rule = normalizeOverride(activeRuleText(dshHome));
|
||||
if (!redteam) return rule || prompt;
|
||||
const parts = [];
|
||||
if (prompt) parts.push(prompt);
|
||||
if (rule && rule !== prompt) parts.push(rule);
|
||||
return parts.join("\n\n");
|
||||
if (rule) return modePromptText(rule, true);
|
||||
return modePromptText(prompt, true);
|
||||
}
|
||||
|
||||
export async function activateRule(dshHome, id) {
|
||||
|
||||
Reference in new issue
Block a user