Chore: format + lint fixes
parent
85917d4769
commit
53c1674382
|
|
@ -76,7 +76,11 @@ function parsePiJson(raw: string): AgentParseResult {
|
|||
}
|
||||
: undefined;
|
||||
|
||||
return { texts, toolResults: toolResults.length ? toolResults : undefined, meta };
|
||||
return {
|
||||
texts,
|
||||
toolResults: toolResults.length ? toolResults : undefined,
|
||||
meta,
|
||||
};
|
||||
}
|
||||
|
||||
export const piSpec: AgentSpec = {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,17 @@ function normalizeThinkLevel(raw?: string | null): ThinkLevel | undefined {
|
|||
return "low";
|
||||
if (["med", "medium", "thinkharder", "think-harder", "harder"].includes(key))
|
||||
return "medium";
|
||||
if (["high", "ultra", "ultrathink", "think-hard", "thinkhardest", "highest", "max"].includes(key))
|
||||
if (
|
||||
[
|
||||
"high",
|
||||
"ultra",
|
||||
"ultrathink",
|
||||
"think-hard",
|
||||
"thinkhardest",
|
||||
"highest",
|
||||
"max",
|
||||
].includes(key)
|
||||
)
|
||||
return "high";
|
||||
if (["think"].includes(key)) return "minimal";
|
||||
return undefined;
|
||||
|
|
@ -67,9 +77,7 @@ function extractThinkDirective(body?: string): {
|
|||
} {
|
||||
if (!body) return { cleaned: "", hasDirective: false };
|
||||
// Match the longest keyword first to avoid partial captures (e.g. "/think:high")
|
||||
const match = body.match(
|
||||
/\/(?:thinking|think|t)\s*:?\s*([a-zA-Z-]+)\b/i,
|
||||
);
|
||||
const match = body.match(/\/(?:thinking|think|t)\s*:?\s*([a-zA-Z-]+)\b/i);
|
||||
const thinkLevel = normalizeThinkLevel(match?.[1]);
|
||||
const cleaned = match
|
||||
? body.replace(match[0], "").replace(/\s+/g, " ").trim()
|
||||
|
|
@ -262,7 +270,7 @@ export async function getReplyFromConfig(
|
|||
(sessionEntry?.thinkingLevel as ThinkLevel | undefined) ??
|
||||
(reply?.thinkingDefault as ThinkLevel | undefined);
|
||||
|
||||
let resolvedVerboseLevel =
|
||||
const resolvedVerboseLevel =
|
||||
inlineVerbose ??
|
||||
(sessionEntry?.verboseLevel as VerboseLevel | undefined) ??
|
||||
(reply?.verboseDefault as VerboseLevel | undefined);
|
||||
|
|
@ -559,10 +567,10 @@ export async function getReplyFromConfig(
|
|||
// If verbose is enabled and this is a new session, prepend a session hint.
|
||||
const sessionIdHint =
|
||||
resolvedVerboseLevel === "on" && isNewSession
|
||||
? sessionId ??
|
||||
? (sessionId ??
|
||||
meta.agentMeta?.sessionId ??
|
||||
templatingCtx.SessionId ??
|
||||
"unknown"
|
||||
"unknown")
|
||||
: undefined;
|
||||
if (sessionIdHint) {
|
||||
finalPayloads = [
|
||||
|
|
|
|||
|
|
@ -810,7 +810,11 @@ describe("config and templating", () => {
|
|||
};
|
||||
|
||||
const ack = await index.getReplyFromConfig(
|
||||
{ Body: "[Dec 1 00:00] [🦞 same-phone] /think:high", From: "+1", To: "+2" },
|
||||
{
|
||||
Body: "[Dec 1 00:00] [🦞 same-phone] /think:high",
|
||||
From: "+1",
|
||||
To: "+2",
|
||||
},
|
||||
undefined,
|
||||
cfg,
|
||||
runSpy,
|
||||
|
|
@ -863,7 +867,7 @@ describe("config and templating", () => {
|
|||
);
|
||||
|
||||
expect(runSpy).not.toHaveBeenCalled();
|
||||
expect(ack?.text).toContain("Unrecognized thinking level \"big\"");
|
||||
expect(ack?.text).toContain('Unrecognized thinking level "big"');
|
||||
|
||||
// Send another message; state should not carry any level.
|
||||
const second = await index.getReplyFromConfig(
|
||||
|
|
|
|||
Loading…
Reference in New Issue