From 455723375e0b741e65fad042dd28e2c52eab9666 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 9 Jan 2026 01:40:44 +0100 Subject: [PATCH] fix: show directive options on query --- src/auto-reply/reply.directive.test.ts | 10 ++++++++ src/auto-reply/reply/directive-handling.ts | 30 ++++++++++++++++++---- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/src/auto-reply/reply.directive.test.ts b/src/auto-reply/reply.directive.test.ts index 55ed6edec..a690ad505 100644 --- a/src/auto-reply/reply.directive.test.ts +++ b/src/auto-reply/reply.directive.test.ts @@ -159,6 +159,9 @@ describe("directive behavior", () => { expect(text).toContain( "Current queue settings: mode=collect, debounce=1500ms, cap=9, drop=summarize.", ); + expect(text).toContain( + "Options: modes steer, followup, collect, steer+backlog, interrupt; debounce:, cap:, drop:old|new|summarize.", + ); expect(runEmbeddedPiAgent).not.toHaveBeenCalled(); }); }); @@ -182,6 +185,7 @@ describe("directive behavior", () => { const text = Array.isArray(res) ? res[0]?.text : res?.text; expect(text).toContain("Current thinking level: high"); + expect(text).toContain("Options: off, minimal, low, medium, high."); expect(runEmbeddedPiAgent).not.toHaveBeenCalled(); }); }); @@ -204,6 +208,7 @@ describe("directive behavior", () => { const text = Array.isArray(res) ? res[0]?.text : res?.text; expect(text).toContain("Current thinking level: off"); + expect(text).toContain("Options: off, minimal, low, medium, high."); expect(runEmbeddedPiAgent).not.toHaveBeenCalled(); }); }); @@ -358,6 +363,7 @@ describe("directive behavior", () => { const text = Array.isArray(res) ? res[0]?.text : res?.text; expect(text).toContain("Current thinking level: high"); + expect(text).toContain("Options: off, minimal, low, medium, high."); expect(runEmbeddedPiAgent).not.toHaveBeenCalled(); }); }); @@ -380,6 +386,7 @@ describe("directive behavior", () => { const text = Array.isArray(res) ? res[0]?.text : res?.text; expect(text).toContain("Current thinking level: off"); + expect(text).toContain("Options: off, minimal, low, medium, high."); expect(runEmbeddedPiAgent).not.toHaveBeenCalled(); }); }); @@ -403,6 +410,7 @@ describe("directive behavior", () => { const text = Array.isArray(res) ? res[0]?.text : res?.text; expect(text).toContain("Current verbose level: on"); + expect(text).toContain("Options: on, off."); expect(runEmbeddedPiAgent).not.toHaveBeenCalled(); }); }); @@ -425,6 +433,7 @@ describe("directive behavior", () => { const text = Array.isArray(res) ? res[0]?.text : res?.text; expect(text).toContain("Current reasoning level: off"); + expect(text).toContain("Options: on, off, stream."); expect(runEmbeddedPiAgent).not.toHaveBeenCalled(); }); }); @@ -458,6 +467,7 @@ describe("directive behavior", () => { const text = Array.isArray(res) ? res[0]?.text : res?.text; expect(text).toContain("Current elevated level: on"); + expect(text).toContain("Options: on, off."); expect(runEmbeddedPiAgent).not.toHaveBeenCalled(); }); }); diff --git a/src/auto-reply/reply/directive-handling.ts b/src/auto-reply/reply/directive-handling.ts index cdc2fc8ac..30c71ccf1 100644 --- a/src/auto-reply/reply/directive-handling.ts +++ b/src/auto-reply/reply/directive-handling.ts @@ -54,6 +54,9 @@ import { } from "./queue.js"; const SYSTEM_MARK = "⚙️"; +const formatOptionsLine = (options: string) => `Options: ${options}.`; +const withOptions = (line: string, options: string) => + `${line}\n${formatOptionsLine(options)}`; const maskApiKey = (value: string): string => { const trimmed = value.trim(); @@ -417,7 +420,12 @@ export async function handleDirectiveOnly(params: { // If no argument was provided, show the current level if (!directives.rawThinkLevel) { const level = currentThinkLevel ?? "off"; - return { text: `Current thinking level: ${level}.` }; + return { + text: withOptions( + `Current thinking level: ${level}.`, + "off, minimal, low, medium, high", + ), + }; } return { text: `Unrecognized thinking level "${directives.rawThinkLevel}". Valid levels: off, minimal, low, medium, high.`, @@ -426,7 +434,9 @@ export async function handleDirectiveOnly(params: { if (directives.hasVerboseDirective && !directives.verboseLevel) { if (!directives.rawVerboseLevel) { const level = currentVerboseLevel ?? "off"; - return { text: `Current verbose level: ${level}.` }; + return { + text: withOptions(`Current verbose level: ${level}.`, "on, off"), + }; } return { text: `Unrecognized verbose level "${directives.rawVerboseLevel}". Valid levels: off, on.`, @@ -435,7 +445,12 @@ export async function handleDirectiveOnly(params: { if (directives.hasReasoningDirective && !directives.reasoningLevel) { if (!directives.rawReasoningLevel) { const level = currentReasoningLevel ?? "off"; - return { text: `Current reasoning level: ${level}.` }; + return { + text: withOptions( + `Current reasoning level: ${level}.`, + "on, off, stream", + ), + }; } return { text: `Unrecognized reasoning level "${directives.rawReasoningLevel}". Valid levels: on, off, stream.`, @@ -447,7 +462,9 @@ export async function handleDirectiveOnly(params: { return { text: "elevated is not available right now." }; } const level = currentElevatedLevel ?? "off"; - return { text: `Current elevated level: ${level}.` }; + return { + text: withOptions(`Current elevated level: ${level}.`, "on, off"), + }; } return { text: `Unrecognized elevated level "${directives.rawElevatedLevel}". Valid levels: off, on.`, @@ -483,7 +500,10 @@ export async function handleDirectiveOnly(params: { typeof settings.cap === "number" ? String(settings.cap) : "default"; const dropLabel = settings.dropPolicy ?? "default"; return { - text: `Current queue settings: mode=${settings.mode}, debounce=${debounceLabel}, cap=${capLabel}, drop=${dropLabel}.`, + text: withOptions( + `Current queue settings: mode=${settings.mode}, debounce=${debounceLabel}, cap=${capLabel}, drop=${dropLabel}.`, + "modes steer, followup, collect, steer+backlog, interrupt; debounce:, cap:, drop:old|new|summarize", + ), }; }