import type { AgentClientType, CanonContactRequest, ExecutionEnvironmentMode } from './types.js'; export type LocalRuntimeKind = AgentClientType | 'sdk'; export type LocalRuntimeStatus = 'running' | 'offline' | 'stale' | 'manual' | 'embedded'; export type LocalRuntimeReviveCapability = 'revivable' | 'manual' | 'embedded' | 'missing-profile'; export interface LocalRuntimeSessionState { conversationId: string; workspaceId?: string; baseCwd: string; executionMode?: ExecutionEnvironmentMode; codexPolicyFingerprint?: string; threadId?: string; claudeSessionId?: string; hermesSessionId?: string; lastInboundMessageId?: string; updatedAt: string; } export interface LocalRuntimeCatalogEntry { id: string; runtime: LocalRuntimeKind; profile: string | null; agentId?: string; agentName?: string; cwd: string; baseCwd?: string; workspaceRoots?: string[]; workspaces?: string[]; launchCommand: string[]; pid?: number; status: LocalRuntimeStatus; reviveCapability: LocalRuntimeReviveCapability; surfaceMode?: 'host' | 'channel' | 'embedded'; lastStartedAt?: string; lastHeartbeatAt?: string; lastStoppedAt?: string; lastAuthError?: string; lastError?: string; sessions?: Record; /** Bounded durable dedup for requester-side terminal contact lifecycle events. */ contactLifecycleEventKeys?: string[]; /** Events retained until the agent's next natural owner-started turn. */ pendingContactLifecycleEvents?: CanonContactRequest[]; /** Rollout baseline prevents old terminal requests from appearing once on upgrade. */ contactLifecycleBaselineComplete?: boolean; /** Opaque `(updatedAt, requestId)` high-water mark for incremental recovery. */ contactLifecycleCursor?: string; /** @deprecated Read compatibility for PR builds that used synthetic wakes. */ terminalContactWakeKeys?: string[]; /** @deprecated Read compatibility for PR builds that used synthetic wakes. */ terminalContactWakeBaselineComplete?: boolean; } export declare const RUNTIMES_DIR: string; export declare const MAX_CONTACT_LIFECYCLE_EVENT_KEYS = 512; export declare const MAX_PENDING_CONTACT_LIFECYCLE_EVENTS = 100; export declare function buildLocalRuntimeId(input: { runtime: LocalRuntimeKind; profile?: string | null; cwd: string; launchCommand?: string[]; }): string; export declare function readLocalRuntimeEntry(id: string): LocalRuntimeCatalogEntry | null; export declare function upsertLocalRuntimeEntry(entry: LocalRuntimeCatalogEntry): LocalRuntimeCatalogEntry; export declare function heartbeatLocalRuntimeEntry(id: string, patch?: Partial): LocalRuntimeCatalogEntry | null; export declare function markLocalRuntimeStopped(id: string, patch?: Partial): LocalRuntimeCatalogEntry | null; /** * Atomically (within the single host process) claim one deterministic * `requestId:phase` wake key. The profile lock prevents two hosts from owning * the same runtime file concurrently; bounding keeps this breadcrumb from * growing forever across reconnects. */ export declare function recordLocalRuntimeContactLifecycleEvent(id: string, request: CanonContactRequest, options?: { pending?: boolean; }): boolean; export declare function takeLocalRuntimeContactLifecycleEvents(id: string, sourceConversationId: string): CanonContactRequest[]; export declare function completeLocalRuntimeContactLifecycleBaseline(id: string): void; export declare function saveLocalRuntimeContactLifecycleCursor(id: string, cursor: string): void; export declare function listLocalRuntimeEntries(options?: { runtime?: LocalRuntimeKind; }): LocalRuntimeCatalogEntry[]; export declare function loadRuntimeSessionState(runtimeId: string, input: { conversationId: string; baseCwd: string; executionMode?: ExecutionEnvironmentMode; workspaceId?: string; }): LocalRuntimeSessionState | null; export declare function saveRuntimeSessionState(runtimeId: string, input: Omit): LocalRuntimeSessionState; export declare function clearRuntimeSessionState(runtimeId: string, input: { conversationId: string; baseCwd?: string; executionMode?: ExecutionEnvironmentMode; workspaceId?: string; preserveInboundCursor?: boolean; }): void; export declare function describeProfileLock(profile: string): string;