fix: 发布 1.1.44,提示词按模式注入并让子代理吃到同一份。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
叫我小杨同学andCursor committed 2026-10-01 19:18:15 +08:00
1 parent 0f91546cc0
commit c29d78b291
10 files changed
+816 -221

No files matched your search

+7 -5
View File
@@ -8,6 +8,7 @@
*/
import { existsSync, readFileSync } from 'node:fs'
import { join } from 'node:path'
import { isRedteamSession } from '../identity.js'
import { redteamRoot } from './platform-config.js'
const ROLE_TAG = /^[ \t]*redteamRole:[ \t]*(recon|assess|vuln-scan|exploit|internal)[ \t]*$/im
@@ -33,15 +34,16 @@ function remember(agent, role) {
for (const id of ids) roleBySession.set(String(id), role)
}
function isRedteamChild(session) {
function isRedteamChild(session, agent) {
const header = session?.header
return header?.origin === 'subagent' && header?.agentPreset === 'redteam'
if (header?.origin !== 'subagent' && !((header?.delegationDepth ?? 0) > 0)) return false
return isRedteamSession({ session, agent: agent ? { ...agent, session } : { session } })
}
export function noteClaimedMessage(payload) {
const agent = payload?.agent
const session = agent?.session
if (!isRedteamChild(session)) return
if (!isRedteamChild(session, agent)) return
const role = parseRedteamRole(textOfMessage(payload?.message))
if (!role) return
remember(agent, role)
@@ -99,9 +101,9 @@ function readRoleFile(engagementId, role) {
export function resolveSubagentRoleText(context) {
try {
const session = context?.agent?.session || context?.session
if (!isRedteamChild(session)) return ''
const agent = context?.agent
const session = agent?.session || context?.session
if (!isRedteamChild(session, agent)) return ''
const sessionId = session?.id ?? agent?.id
let role = sessionId !== undefined && sessionId !== null
? roleBySession.get(String(sessionId)) || ''