/** * Child mode bootstrap — detect and self-identify as a spawned agent. * Spec: §4.5 — Child Mode Bootstrap */ import type { AgentIsolation, AgentLifecycle, Labels } from "@pi-orca/core"; /** * Child identity populated from the orca:agent-instance entry. * Spec: §4.5.1 — full mirror of parent-side seeding (§3.1.2(b)) */ export interface ChildIdentity { agentId: string; templateName: string; sessionPath: string; parentSessionPath: string; rootSessionPath: string; model: string; isolation: AgentIsolation; labels: Labels; parentNotifySockPath: string; originalTask: string; /** Spec §5.13. Defaults to "one-shot" for legacy instance entries. */ lifecycle: AgentLifecycle; /** * Per-child control socket path (process/tmux persistent agents). * Empty string when one-shot or not provided. */ childControlSockPath: string; } /** * Module-scoped terminal-flush deduplication state. * Spec: §4.5.3 + §11 W11 — multiple paths (turn_end drain, abort handler, * session_shutdown) all want to write terminal status. The boolean ensures * exactly one write. */ export declare const terminalFlush: { alreadyFlushed: boolean; }; /** * Module-scoped drain flag for graceful-stop coordination. * Spec: §6.1.4 — set by agent-control: graceful-stop, read by turn_end handler. */ export declare const drainFlag: { _set: boolean; reason: string | undefined; set(reason: string): void; isSet(): boolean; reset(): void; }; /** * Cached latest assistant text from turn_end events. * Spec: §4.5.3 W4 — when the closing turn is all tool calls, fall back to * the most recent text-bearing turn so the completion result isn't empty. */ export declare const lastAssistantText: { value: string; }; /** * Get the current child identity, or null if running in parent mode. * * @returns Child identity or null */ export declare function getChildIdentity(): ChildIdentity | null; /** * Check if the extension is running as a spawned agent. * * @returns True if in child mode */ export declare function isChildAgent(): boolean; /** * Detect child mode by scanning session entries for orca:agent-instance. * Spec: §4.5.2 — must be called from session_start AFTER bindSession(ctx). * * @param entries - Session entries from ctx.sessionManager.getEntries() * @returns True if child mode detected (and childIdentity populated) */ export declare function detectChildMode(entries: any[]): boolean; /** * Reset all child-mode module state. * Spec: §4.5.2 — called on session_before_switch / session_before_fork * so the next session_start starts from a clean slate. */ export declare function resetChildModeState(): void; /** * Extract concatenated assistant text from an AgentMessage's content parts. * Spec: §4.5.3 — used by turn_end drain handler to capture result text. * * @param message - AgentMessage from TurnEndEvent.message * @returns Concatenated text, or empty string if no text parts */ export declare function extractAssistantText(message: any): string; //# sourceMappingURL=child-mode.d.ts.map