import { mkdir, writeFile } from 'node:fs/promises'; import { closeTarget, closeThreadTarget, downloadThreadAttachment, exportThreadSnapshot, sleep, type ThreadCaptureIdentity, type ThreadTargetLifecycle, type ThreadSnapshot } from './chatgpt-thread-lib.mjs'; import { resolveCodexBin, resolveCodexHomeForSession } from './codex-session-lib.mjs'; import { type WakeRecursiveInfo } from './chatgpt-thread-wake-recursive-lib.mjs'; export type { WakeRecursiveInfo } from './chatgpt-thread-wake-recursive-lib.mjs'; export type WakeOptions = { browserEndpoint?: string; captureIdentity?: ThreadCaptureIdentity; captureMetadataPath?: string; chatUrl: string; codexHome?: string; delayMs: number; downloadTimeoutMs?: number; fullAuto?: boolean; outputDir: string; pollJitterMs?: number; pollIntervalMs?: number; pollTimeoutMs?: number; pollUntilComplete?: boolean; recursiveDepth?: number; recursivePrompt?: string; repoDir: string; resumePrompt?: string; sessionId?: string; skipResume?: boolean; tabLifecycle?: WakeTabLifecycle; }; export type WakeTabLifecycle = ThreadTargetLifecycle | 'close-harvested'; export type WakeCompletionStatus = 'checked-once' | 'completed'; export type WakeHandoffKind = 'artifact' | 'text' | 'none'; export type WakeAssistantResponseSource = 'latest-assistant' | 'none'; export type WakeResult = { attemptCount: number; assistantResponseMetaPath?: string; assistantResponsePath?: string; assistantResponseSource?: WakeAssistantResponseSource; assistantResponseTextLength?: number; childSessionPersistence?: 'pending' | 'verified'; childSessionId?: string; childRolloutPath?: string; completionStatus: WakeCompletionStatus; codexBin?: string; codexHome?: string; downloadErrors?: string[]; downloadedArtifacts?: string[]; downloadedPatches: string[]; eventsPath?: string; exportPath: string; handoffKind?: WakeHandoffKind; launcherPid?: number; outputDir: string; recursive?: WakeRecursiveInfo; replayCommandsPath?: string; repoDir: string; stderrPath?: string; resumeOutputPath?: string; sessionId?: string; statusPath?: string; }; type CodexChildSessionLaunch = { childSessionPersistence?: 'pending' | 'verified'; childSessionId?: string; childRolloutPath?: string; eventsPath?: string; launcherPid?: number; resumeOutputPath?: string; stderrPath?: string; }; type WakeDependencies = { closeTarget: typeof closeTarget; closeThreadTarget: typeof closeThreadTarget; downloadThreadAttachment: typeof downloadThreadAttachment; exportThreadSnapshot: typeof exportThreadSnapshot; log: (message: string) => void; mkdir: typeof mkdir; now: () => number; random: () => number; resolveCodexBin: typeof resolveCodexBin; resolveCodexHomeForSession: typeof resolveCodexHomeForSession; runCodexChildSession: typeof runCodexChildSession; sleep: typeof sleep; writeCaptureIdentity: typeof writeCaptureIdentityAtomically; writeFile: typeof writeFile; }; declare function writeCaptureIdentityAtomically(filePath: string, captureIdentity: ThreadCaptureIdentity): Promise; export declare function runCodexChildSession(command: string, args: string[], options: { codexHome: string; cwd?: string; env?: NodeJS.ProcessEnv; eventsPath?: string; launchTimeoutMs?: number; resumeOutputPath?: string; stderrPath?: string; terminationGraceMs?: number; }): Promise; export declare function chatIdFromUrl(chatUrl: string): string; export declare function parseWakeDelayToMs(rawValue: string): number; export declare function formatWakePollSummary(snapshot: ThreadSnapshot, downloadTargetCount: number, options?: { busy?: boolean; busyReason?: string; }): string; export declare function buildWakeFollowupPrompt(input: { assistantResponsePath?: string; assistantResponseTextLength?: number; artifactLabels?: string[]; chatUrl: string; downloadErrors?: string[]; downloadedArtifacts: string[]; exportPath: string; replayCommandsPath?: string; recursive?: WakeRecursiveInfo; resumePrompt?: string; repoDir: string; }): string; export declare function runWakeFlow(options: WakeOptions, dependencies?: Partial): Promise;