fix: use configured endSymbols in injected prompt and exempt gateway keywords

- buildEndMarkerInstruction() replaces hardcoded END_MARKER_INSTRUCTION,
  dynamically using the resolved policy's endSymbols
- Instruction now explicitly exempts gateway keywords (NO_REPLY, HEARTBEAT_OK)
  from requiring end symbols
- Export resolvePolicy from rules.ts for reuse in before_prompt_build hook
This commit is contained in:
zhi
2026-02-27 15:16:06 +00:00
parent 75d659787c
commit 3749de981f
2 changed files with 13 additions and 4 deletions

View File

@@ -46,7 +46,7 @@ function getLastChar(input: string): string {
return t.length ? t[t.length - 1] : "";
}
function resolvePolicy(config: WhisperGateConfig, channelId?: string, channelPolicies?: Record<string, ChannelPolicy>) {
export function resolvePolicy(config: WhisperGateConfig, channelId?: string, channelPolicies?: Record<string, ChannelPolicy>) {
const globalMode = config.listMode || "human-list";
const globalHuman = config.humanList || config.bypassUserIds || [];
const globalAgent = config.agentList || [];