mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-30 17:50:22 +08:00
fix: 0.2.0 system prompt修复 + patch89 + override状态机 + 提示词优化
- core.js: isKeepableUserOverride重排序, markOverrideCustomized不写hash(explicitSave), commitOverrideOnApply读盘, patch89 SYSTEM_FIELD_EXTRACT - index.js: system_field_extracted状态字段(status/apply/override端点) - default-prompt-inject.en.md: 优化英文版提示词 - default-prompt-inject.zh.md: 优化中文版提示词 - docs/修改文档.md: 完整修改文档+还原说明 - pi-ai anthropic-messages.js: system从顶层字段改为messages里role:system消息
This commit is contained in:
1 parent
6c1d638d1b
commit
e1d8e59087
24 files changed
+3353
-1198
No files matched your search
@@ -11,6 +11,7 @@ import { homedir } from 'node:os'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { readPresetDefinition } from './preset-composition.js'
|
||||
import { clearOwnedSelectedDefault } from '../preset-default.js'
|
||||
|
||||
/** Cordis 插件名。 */
|
||||
export const name = 'dsh-purge-redteam'
|
||||
@@ -571,6 +572,7 @@ export function apply(ctx) {
|
||||
if (timer) clearInterval(timer)
|
||||
if (stop) clearTimeout(stop)
|
||||
void undeclare()
|
||||
try { clearOwnedSelectedDefault({ ctx }) } catch { /* 清默认失败不挡停用 */ }
|
||||
}
|
||||
}, 'dsh-purge-redteam: declare agent preset')
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
import { existsSync, readFileSync } from 'node:fs'
|
||||
import { join } from 'node:path'
|
||||
import { isRedteamSession } from '../identity.js'
|
||||
import { isChildAgentContext, isRedteamSession } from '../identity.js'
|
||||
import { redteamRoot } from './platform-config.js'
|
||||
|
||||
const ROLE_TAG = /^[ \t]*redteamRole:[ \t]*(recon|assess|vuln-scan|exploit|internal)[ \t]*$/im
|
||||
@@ -50,9 +50,8 @@ function remember(agent, role) {
|
||||
}
|
||||
|
||||
function isRedteamChild(session, agent) {
|
||||
const header = session?.header
|
||||
if (header?.origin !== 'subagent' && !((header?.delegationDepth ?? 0) > 0)) return false
|
||||
return isRedteamSession({ session, agent: agent ? { ...agent, session } : { session } })
|
||||
const wrapped = { session, agent: agent ? { ...agent, session } : { session } }
|
||||
return isChildAgentContext(wrapped) && isRedteamSession(wrapped)
|
||||
}
|
||||
|
||||
export function noteClaimedMessage(payload) {
|
||||
|
||||
Reference in new issue
Block a user