/** * Print mode (single-shot): Send prompts, output result, exit. * * Used for: * - `gjc -p "prompt"` - text output * - `gjc --mode json "prompt"` - JSON event stream */ import { type ImageContent } from "@gajae-code/ai/core"; import type { AgentSession } from "../session/agent-session"; /** * Options for print mode. */ export interface PrintModeOptions { /** Output mode: "text" for final response only, "json" for all events */ mode: "text" | "json"; /** Array of additional prompts to send after initialMessage */ messages?: string[]; /** First message to send (may contain @file content) */ initialMessage?: string; /** Images to attach to the initial message */ initialImages?: ImageContent[]; /** * When true, a terminal assistant error/abort leaves process exit status * untouched so the caller can run its own finalization and status handling. */ suppressProcessExit?: boolean; } /** * Exit code used when a non-interactive **text-mode** run (`gjc -p`) terminates * because the model context window is exhausted and automatic compaction could * not bring the request under the limit. Distinct from the generic failure code * (1) so text-mode callers can detect context exhaustion specifically instead of * parsing the raw provider error string. * * Scope: text-mode final-response path only. JSON mode (`--mode json`) streams * events from the subscription and does not run this terminal-error branch, so * it is intentionally NOT covered by this exit code. */ export declare const CONTEXT_OVERFLOW_EXIT_CODE = 78; /** * Run in print (single-shot) mode. * Sends prompts to the agent and outputs the result. */ export declare function runPrintMode(session: AgentSession, options: PrintModeOptions): Promise;