import type { CodexAppTurnInput } from '../types.js'; export declare const CODEX_APP_INPUT_PREFIX = "::botmux-codex-app:"; export interface CodexAppRunnerInput { type: 'message'; content: string; codexAppInput?: CodexAppTurnInput; /** Immutable botmux/Lark message id used only for reply routing. */ replyTurnId?: string; /** Explicit positive: this plain-human-interactive turn may `turn/steer` into * an already-active Codex App turn. Missing/false ⇒ forced serial (start its * own turn only when the runner is idle). */ codexAppSteerable?: true; } export interface CodexAppFinalMarker { content: string; startedAtMs?: number; completedAtMs?: number; /** Codex app-server turn id, used for protocol matching and deduplication. */ appTurnId?: string; /** botmux/Lark message id, used to select the Feishu reply destination. */ replyTurnId?: string; /** Pre-steer Codex App and Mira markers used one id for both domains. */ legacyTurnId?: string; /** Per-turn token usage (four mutually-exclusive buckets), when the turn's * thread/tokenUsage/updated notifications yielded a coherent total. Omitted * when no usage was observed / a protocol anomaly was detected. */ usage?: { inputTokens: number; outputTokens: number; cacheReadTokens: number; cacheCreateTokens: number; }; } interface CodexAppLifecycleBase { atMs: number; queueLength?: number; appTurnId?: string; replyTurnId?: string; } export type CodexAppLifecycleOperation = 'turn/start' | 'turn/steer' | 'runner'; export type CodexAppLifecycleCategory = 'definite_rejection' | 'steer_in_flight' | 'transport' | 'rpc' | 'protocol' | 'runtime'; /** * The requested thread is still owned by another Codex app-server writer. This * is an expected handoff conflict, not a generic runner crash. */ export declare const CODEX_APP_ACTIVE_WRITER_EXIT_CODE = 75; export type CodexAppLifecycleEvent = (CodexAppLifecycleBase & { kind: 'input_queued' | 'turn_start_attempt'; queueLength: number; }) | (CodexAppLifecycleBase & { kind: 'turn_started' | 'steer_attempt' | 'steer_accepted'; appTurnId: string; }) | (CodexAppLifecycleBase & { kind: 'steer_rejected_fallback'; appTurnId: string; category: 'definite_rejection'; }) | (CodexAppLifecycleBase & { kind: 'completion_race'; appTurnId: string; category: 'steer_in_flight'; }) | (CodexAppLifecycleBase & { kind: 'unknown_outcome'; operation: 'turn/start' | 'turn/steer'; category: 'transport' | 'rpc' | 'protocol'; }) | (CodexAppLifecycleBase & { kind: 'fatal'; operation: CodexAppLifecycleOperation; category: 'transport' | 'rpc' | 'protocol' | 'runtime'; }); export interface AppRunnerFinalIds { lastUuid: string; turnId: string; } export declare function decodeCodexAppRunnerInput(line: string): CodexAppRunnerInput | undefined; export declare function normalizeAppRunnerFinalMarker(payload: unknown): CodexAppFinalMarker | undefined; /** Accept the four-bucket usage only when every field is a non-negative integer * (a token count), else drop it (daemon omits usage rather than persisting a * negative/fractional/partial value that a compromised or buggy runner sent). */ export declare function normalizeFinalUsage(raw: unknown): CodexAppFinalMarker['usage'] | undefined; export declare function normalizeCodexAppLifecycleEvent(payload: unknown): CodexAppLifecycleEvent | undefined; export declare function projectAppRunnerFinalIds(marker: CodexAppFinalMarker, fallbackTurnId: string | undefined, generatedFallbackId: string): AppRunnerFinalIds; export {}; //# sourceMappingURL=codex-app-runner-protocol.d.ts.map