fix: /compact masked by room role header in both runners

prependRoomRoleHeader was called BEFORE /compact detection, turning
"/compact" into "[PAIRED ROOM: owner]\n/compact" which failed the
exact match check. Now session commands are detected first.
This commit is contained in:
Eyejoker
2026-03-29 21:14:04 +09:00
parent 83ddc4faff
commit 787c05a561
2 changed files with 14 additions and 7 deletions

View File

@@ -1037,14 +1037,15 @@ async function main(): Promise<void> {
log(`Draining ${pending.length} pending IPC messages into initial prompt`);
prompt += '\n' + pending.join('\n');
}
prompt = prependRoomRoleHeader(prompt, containerInput.roomRoleContext);
// --- Slash command handling ---
// Only known session slash commands are handled here. This prevents
// accidental interception of user prompts that happen to start with '/'.
// Check BEFORE prepending room role header so /compact isn't masked.
const KNOWN_SESSION_COMMANDS = new Set(['/compact']);
const isSessionSlashCommand = KNOWN_SESSION_COMMANDS.has(containerInput.prompt.trim());
if (!isSessionSlashCommand) {
prompt = prependRoomRoleHeader(prompt, containerInput.roomRoleContext);
}
const trimmedPrompt = prompt.trim();
const isSessionSlashCommand = KNOWN_SESSION_COMMANDS.has(trimmedPrompt);
if (isSessionSlashCommand) {
log(`Handling session command: ${trimmedPrompt}`);