import { type CallbackRouteV1 } from "./callback-transport.js"; import { type NativeOutboxDependencies } from "./codex-native-outbox.js"; import { type CodexNativeTaskRecord } from "./codex-native-state-store.js"; import type { CodexNativeIdentity, CodexNativeReceipt, CodexNativeSnapshot, CodexNativeTurn } from "./codex-native-types.js"; export interface CodexNativeTaskInput { target: CodexNativeIdentity; nativeId: string; controllerSession: string; callbackRoute?: CallbackRouteV1; timeoutMs?: number; } export interface CodexNativeSendInput extends CodexNativeTaskInput { messageId: string; text: string; } export interface CodexNativeTransportPort { observe(identity: CodexNativeIdentity, exactTurnId?: string): Promise; start(identity: CodexNativeIdentity, input: { text: string; clientUserMessageId: string; beforeDispatch?(snapshot: CodexNativeSnapshot): Promise; }): Promise; } export interface CodexNativeTaskServiceDependencies extends CodexNativeTransportPort, NativeOutboxDependencies { /** Briefly observe a returned native receipt while history materializes; never retry the send. */ acceptancePollAttempts?: number; acceptancePollIntervalMs?: number; sleep?(milliseconds: number): Promise; } export declare class CodexNativeTaskError extends Error { readonly code: string; readonly dispatchState?: "not_sent" | undefined; constructor(code: string, message: string, dispatchState?: "not_sent" | undefined); } export interface CodexNativeTaskService { send(input: CodexNativeSendInput): Promise; watch(input: CodexNativeTaskInput): Promise; status(id: string): CodexNativeTaskRecord; list(): CodexNativeTaskRecord[]; reconcile(id: string): Promise; reconcileAll(): Promise<{ tasks: CodexNativeTaskRecord[]; errors: { id: string; error_code: string; }[]; }>; unwatch(id: string, input: { controllerSession: string; }): CodexNativeTaskRecord; close(id: string, input: { controllerSession: string; reason?: string; }): CodexNativeTaskRecord; renew(id: string, input: { controllerSession: string; timeoutMs?: number; }): Promise; recover(id: string, input: { controllerSession: string; }): Promise; retryCallback(id: string, input: { controllerSession: string; notificationId?: string; }): Promise; } export declare const nativeDigest: (value: unknown) => string; export declare function codexNativeTaskNeedsReconciliation(task: CodexNativeTaskRecord): boolean; export declare function nativeErrorCode(error: unknown): string; export declare function nativeTurn(snapshot: CodexNativeSnapshot, turnId: string): CodexNativeTurn | undefined; export declare function createCodexNativeTaskService(deps: CodexNativeTaskServiceDependencies): CodexNativeTaskService;