fix: allow inline directives to continue and add mixed-message test

This commit is contained in:
Peter Steinberger
2025-12-05 22:57:52 +00:00
parent d7a188fb34
commit 3241d81ce5
2 changed files with 39 additions and 34 deletions

View File

@@ -451,8 +451,8 @@ export async function getReplyFromConfig(
return { text: ack };
}
// If any directive (think/verbose) is present anywhere, acknowledge immediately and skip agent execution.
if (!isHeartbeat && (hasThinkDirective || hasVerboseDirective)) {
// If directives are inline with other text: persist levels, then continue to agent (no early ack).
if (hasThinkDirective || hasVerboseDirective) {
if (sessionEntry && sessionStore && sessionKey) {
if (hasThinkDirective && inlineThink) {
if (inlineThink === "off") {
@@ -475,36 +475,6 @@ export async function getReplyFromConfig(
await saveSessionStore(storePath, sessionStore);
}
}
const parts: string[] = [];
if (hasThinkDirective) {
if (!inlineThink) {
parts.push(
`⚙️ Unrecognized thinking level "${rawThinkLevel ?? ""}". Valid levels: off, minimal, low, medium, high.`,
);
} else {
parts.push(
inlineThink === "off"
? "⚙️ Thinking disabled."
: `⚙️ Thinking level set to ${inlineThink}.`,
);
}
}
if (hasVerboseDirective) {
if (!inlineVerbose) {
parts.push(
`⚙️ Unrecognized verbose level "${rawVerboseLevel ?? ""}". Valid levels: off, on.`,
);
} else {
parts.push(
inlineVerbose === "off"
? "⚙️ Verbose logging disabled."
: "⚙️ Verbose logging enabled.",
);
}
}
const ack = parts.join(" ");
cleanupTyping();
return { text: ack };
}
// Optional allowlist by origin number (E.164 without whatsapp: prefix)