fix: show directive options on query
This commit is contained in:
@@ -159,6 +159,9 @@ describe("directive behavior", () => {
|
|||||||
expect(text).toContain(
|
expect(text).toContain(
|
||||||
"Current queue settings: mode=collect, debounce=1500ms, cap=9, drop=summarize.",
|
"Current queue settings: mode=collect, debounce=1500ms, cap=9, drop=summarize.",
|
||||||
);
|
);
|
||||||
|
expect(text).toContain(
|
||||||
|
"Options: modes steer, followup, collect, steer+backlog, interrupt; debounce:<ms|s|m>, cap:<n>, drop:old|new|summarize.",
|
||||||
|
);
|
||||||
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
|
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -182,6 +185,7 @@ describe("directive behavior", () => {
|
|||||||
|
|
||||||
const text = Array.isArray(res) ? res[0]?.text : res?.text;
|
const text = Array.isArray(res) ? res[0]?.text : res?.text;
|
||||||
expect(text).toContain("Current thinking level: high");
|
expect(text).toContain("Current thinking level: high");
|
||||||
|
expect(text).toContain("Options: off, minimal, low, medium, high.");
|
||||||
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
|
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -204,6 +208,7 @@ describe("directive behavior", () => {
|
|||||||
|
|
||||||
const text = Array.isArray(res) ? res[0]?.text : res?.text;
|
const text = Array.isArray(res) ? res[0]?.text : res?.text;
|
||||||
expect(text).toContain("Current thinking level: off");
|
expect(text).toContain("Current thinking level: off");
|
||||||
|
expect(text).toContain("Options: off, minimal, low, medium, high.");
|
||||||
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
|
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -358,6 +363,7 @@ describe("directive behavior", () => {
|
|||||||
|
|
||||||
const text = Array.isArray(res) ? res[0]?.text : res?.text;
|
const text = Array.isArray(res) ? res[0]?.text : res?.text;
|
||||||
expect(text).toContain("Current thinking level: high");
|
expect(text).toContain("Current thinking level: high");
|
||||||
|
expect(text).toContain("Options: off, minimal, low, medium, high.");
|
||||||
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
|
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -380,6 +386,7 @@ describe("directive behavior", () => {
|
|||||||
|
|
||||||
const text = Array.isArray(res) ? res[0]?.text : res?.text;
|
const text = Array.isArray(res) ? res[0]?.text : res?.text;
|
||||||
expect(text).toContain("Current thinking level: off");
|
expect(text).toContain("Current thinking level: off");
|
||||||
|
expect(text).toContain("Options: off, minimal, low, medium, high.");
|
||||||
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
|
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -403,6 +410,7 @@ describe("directive behavior", () => {
|
|||||||
|
|
||||||
const text = Array.isArray(res) ? res[0]?.text : res?.text;
|
const text = Array.isArray(res) ? res[0]?.text : res?.text;
|
||||||
expect(text).toContain("Current verbose level: on");
|
expect(text).toContain("Current verbose level: on");
|
||||||
|
expect(text).toContain("Options: on, off.");
|
||||||
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
|
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -425,6 +433,7 @@ describe("directive behavior", () => {
|
|||||||
|
|
||||||
const text = Array.isArray(res) ? res[0]?.text : res?.text;
|
const text = Array.isArray(res) ? res[0]?.text : res?.text;
|
||||||
expect(text).toContain("Current reasoning level: off");
|
expect(text).toContain("Current reasoning level: off");
|
||||||
|
expect(text).toContain("Options: on, off, stream.");
|
||||||
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
|
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -458,6 +467,7 @@ describe("directive behavior", () => {
|
|||||||
|
|
||||||
const text = Array.isArray(res) ? res[0]?.text : res?.text;
|
const text = Array.isArray(res) ? res[0]?.text : res?.text;
|
||||||
expect(text).toContain("Current elevated level: on");
|
expect(text).toContain("Current elevated level: on");
|
||||||
|
expect(text).toContain("Options: on, off.");
|
||||||
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
|
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ import {
|
|||||||
} from "./queue.js";
|
} from "./queue.js";
|
||||||
|
|
||||||
const SYSTEM_MARK = "⚙️";
|
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 maskApiKey = (value: string): string => {
|
||||||
const trimmed = value.trim();
|
const trimmed = value.trim();
|
||||||
@@ -417,7 +420,12 @@ export async function handleDirectiveOnly(params: {
|
|||||||
// If no argument was provided, show the current level
|
// If no argument was provided, show the current level
|
||||||
if (!directives.rawThinkLevel) {
|
if (!directives.rawThinkLevel) {
|
||||||
const level = currentThinkLevel ?? "off";
|
const level = currentThinkLevel ?? "off";
|
||||||
return { text: `Current thinking level: ${level}.` };
|
return {
|
||||||
|
text: withOptions(
|
||||||
|
`Current thinking level: ${level}.`,
|
||||||
|
"off, minimal, low, medium, high",
|
||||||
|
),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
text: `Unrecognized thinking level "${directives.rawThinkLevel}". Valid levels: off, minimal, low, medium, high.`,
|
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.hasVerboseDirective && !directives.verboseLevel) {
|
||||||
if (!directives.rawVerboseLevel) {
|
if (!directives.rawVerboseLevel) {
|
||||||
const level = currentVerboseLevel ?? "off";
|
const level = currentVerboseLevel ?? "off";
|
||||||
return { text: `Current verbose level: ${level}.` };
|
return {
|
||||||
|
text: withOptions(`Current verbose level: ${level}.`, "on, off"),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
text: `Unrecognized verbose level "${directives.rawVerboseLevel}". Valid levels: off, on.`,
|
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.hasReasoningDirective && !directives.reasoningLevel) {
|
||||||
if (!directives.rawReasoningLevel) {
|
if (!directives.rawReasoningLevel) {
|
||||||
const level = currentReasoningLevel ?? "off";
|
const level = currentReasoningLevel ?? "off";
|
||||||
return { text: `Current reasoning level: ${level}.` };
|
return {
|
||||||
|
text: withOptions(
|
||||||
|
`Current reasoning level: ${level}.`,
|
||||||
|
"on, off, stream",
|
||||||
|
),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
text: `Unrecognized reasoning level "${directives.rawReasoningLevel}". Valid levels: on, off, stream.`,
|
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." };
|
return { text: "elevated is not available right now." };
|
||||||
}
|
}
|
||||||
const level = currentElevatedLevel ?? "off";
|
const level = currentElevatedLevel ?? "off";
|
||||||
return { text: `Current elevated level: ${level}.` };
|
return {
|
||||||
|
text: withOptions(`Current elevated level: ${level}.`, "on, off"),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
text: `Unrecognized elevated level "${directives.rawElevatedLevel}". Valid levels: off, on.`,
|
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";
|
typeof settings.cap === "number" ? String(settings.cap) : "default";
|
||||||
const dropLabel = settings.dropPolicy ?? "default";
|
const dropLabel = settings.dropPolicy ?? "default";
|
||||||
return {
|
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:<ms|s|m>, cap:<n>, drop:old|new|summarize",
|
||||||
|
),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user