diff --git a/src/auto-reply/reply/directives.ts b/src/auto-reply/reply/directives.ts index 15b0dcb1a..7fc659266 100644 --- a/src/auto-reply/reply/directives.ts +++ b/src/auto-reply/reply/directives.ts @@ -1,7 +1,8 @@ -import type { ReasoningLevel } from "../thinking.js"; +import type { NoticeLevel, ReasoningLevel } from "../thinking.js"; import { type ElevatedLevel, normalizeElevatedLevel, + normalizeNoticeLevel, normalizeReasoningLevel, normalizeThinkLevel, normalizeVerboseLevel, @@ -112,6 +113,22 @@ export function extractVerboseDirective(body?: string): { }; } +export function extractNoticeDirective(body?: string): { + cleaned: string; + noticeLevel?: NoticeLevel; + rawLevel?: string; + hasDirective: boolean; +} { + if (!body) return { cleaned: "", hasDirective: false }; + const extracted = extractLevelDirective(body, ["notice", "notices"], normalizeNoticeLevel); + return { + cleaned: extracted.cleaned, + noticeLevel: extracted.level, + rawLevel: extracted.rawLevel, + hasDirective: extracted.hasDirective, + }; +} + export function extractElevatedDirective(body?: string): { cleaned: string; elevatedLevel?: ElevatedLevel; @@ -152,5 +169,5 @@ export function extractStatusDirective(body?: string): { return extractSimpleDirective(body, ["status"]); } -export type { ElevatedLevel, ReasoningLevel, ThinkLevel, VerboseLevel }; +export type { ElevatedLevel, NoticeLevel, ReasoningLevel, ThinkLevel, VerboseLevel }; export { extractExecDirective } from "./exec/directive.js"; diff --git a/src/auto-reply/thinking.ts b/src/auto-reply/thinking.ts index aabb2cf17..a0f712199 100644 --- a/src/auto-reply/thinking.ts +++ b/src/auto-reply/thinking.ts @@ -1,5 +1,6 @@ export type ThinkLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh"; export type VerboseLevel = "off" | "on" | "full"; +export type NoticeLevel = "off" | "on" | "full"; export type ElevatedLevel = "off" | "on" | "ask" | "full"; export type ElevatedMode = "off" | "ask" | "full"; export type ReasoningLevel = "off" | "on" | "stream"; @@ -93,6 +94,16 @@ export function normalizeVerboseLevel(raw?: string | null): VerboseLevel | undef return undefined; } +// Normalize system notice flags used to toggle system notifications. +export function normalizeNoticeLevel(raw?: string | null): NoticeLevel | undefined { + if (!raw) return undefined; + const key = raw.toLowerCase(); + if (["off", "false", "no", "0"].includes(key)) return "off"; + if (["full", "all", "everything"].includes(key)) return "full"; + if (["on", "minimal", "true", "yes", "1"].includes(key)) return "on"; + return undefined; +} + // Normalize response-usage display modes used to toggle per-response usage footers. export function normalizeUsageDisplay(raw?: string | null): UsageDisplayLevel | undefined { if (!raw) return undefined;