/** * Foundational types and constants for pi-run-mode. Zero business-logic deps: * every other module may import from here, but this file imports from none of * them. */ import { homedir } from "node:os"; import { join } from "node:path"; export type Mode = "ask" | "plan" | "auto"; export const MODES: Mode[] = ["ask", "plan", "auto"]; export const DEFAULT_MODE: Mode = "ask"; export type ThinkingLevel = | "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max"; export const THINKING_LEVELS: ThinkingLevel[] = [ "off", "minimal", "low", "medium", "high", "xhigh", "max", ]; export type ModelRef = { provider: string; id: string; thinkingLevel?: ThinkingLevel; }; // A mode switch. Defined here so plan/ and modes/ share it without coupling. export type SetMode = (newMode: Mode) => Promise; // Session log customType — kept stable so old sessions still restore mode. export const STATE_ENTRY_TYPE = "agent-mode-state"; export const STATE_FILE_PATH = join( homedir(), ".pi", "agent", "pi-run-mode.json", );