refactor(auto-reply): share mode-switch events

This commit is contained in:
Peter Steinberger
2026-02-15 17:03:02 +00:00
parent 9f393a045c
commit ca4c2b33d7
3 changed files with 39 additions and 31 deletions

View File

@@ -21,10 +21,9 @@ import {
import { maybeHandleQueueDirective } from "./directive-handling.queue-validation.js";
import {
formatDirectiveAck,
formatElevatedEvent,
formatElevatedRuntimeHint,
formatElevatedUnavailableText,
formatReasoningEvent,
enqueueModeSwitchEvents,
withOptions,
} from "./directive-handling.shared.js";
@@ -363,20 +362,13 @@ export async function handleDirectiveOnly(
});
}
}
if (elevatedChanged) {
const nextElevated = (sessionEntry.elevatedLevel ?? "off") as ElevatedLevel;
enqueueSystemEvent(formatElevatedEvent(nextElevated), {
sessionKey,
contextKey: "mode:elevated",
});
}
if (reasoningChanged) {
const nextReasoning = (sessionEntry.reasoningLevel ?? "off") as ReasoningLevel;
enqueueSystemEvent(formatReasoningEvent(nextReasoning), {
sessionKey,
contextKey: "mode:reasoning",
});
}
enqueueModeSwitchEvents({
enqueueSystemEvent,
sessionEntry,
sessionKey,
elevatedChanged,
reasoningChanged,
});
const parts: string[] = [];
if (directives.hasThinkDirective && directives.thinkLevel) {