import { Cn as AcpRuntimePromptMode, Sn as AcpRuntimeHandle, Tn as AcpRuntimeStatus, _n as AcpRuntime, i as OpenClawConfig, vn as AcpRuntimeCapabilities, wn as AcpRuntimeSessionMode, xn as AcpRuntimeEvent } from "./types.openclaw-CpnoYlBx.js"; import { a as SessionEntry, c as AcpSessionRuntimeOptions, l as SessionAcpIdentity, u as SessionAcpMeta } from "./types-CCX1gTNG.js"; import { i as requireAcpRuntimeBackend, n as getAcpRuntimeBackend, o as AcpRuntimeError } from "./registry-B1rtjxjQ.js"; //#region src/acp/runtime/session-meta.d.ts /** ACP metadata joined with its legacy session-store row and config context. */ type AcpSessionStoreEntry = { cfg: OpenClawConfig; storePath: string; sessionKey: string; storeSessionKey: string; entry?: SessionEntry; acp?: SessionAcpMeta; storeReadFailed?: boolean; }; declare function readAcpSessionEntry(params: { sessionKey: string; cfg?: OpenClawConfig; clone?: boolean; env?: NodeJS.ProcessEnv; databasePath?: string; }): AcpSessionStoreEntry | null; declare function listAcpSessionEntries(params: { cfg?: OpenClawConfig; env?: NodeJS.ProcessEnv; clone?: boolean; databasePath?: string; }): Promise; declare function upsertAcpSessionMeta(params: { sessionKey: string; cfg?: OpenClawConfig; env?: NodeJS.ProcessEnv; databasePath?: string; now?: () => number; skipMaintenance?: boolean; takeCacheOwnership?: boolean; mutate: (current: SessionAcpMeta | undefined, entry: SessionEntry | undefined) => SessionAcpMeta | null | undefined; }): Promise; //#endregion //#region src/acp/control-plane/manager.types.d.ts /** Result of resolving persisted ACP metadata for a session key. */ type AcpSessionResolution = { kind: "none"; sessionKey: string; } | { kind: "stale"; sessionKey: string; error: AcpRuntimeError; } | { kind: "ready"; sessionKey: string; meta: SessionAcpMeta; }; /** Input required to create or resume an ACP runtime session. */ type AcpInitializeSessionInput = { cfg: OpenClawConfig; sessionKey: string; agent: string; mode: AcpRuntimeSessionMode; resumeSessionId?: string; runtimeOptions?: Partial; cwd?: string; backendId?: string; }; type AcpTurnAttachment = { mediaType: string; data: string; }; /** Input for one ACP prompt turn routed through the manager. */ type AcpRunTurnInput = { cfg: OpenClawConfig; sessionKey: string; text: string; attachments?: AcpTurnAttachment[]; mode: AcpRuntimePromptMode; requestId: string; signal?: AbortSignal; onLifecycle?: (event: AcpTurnLifecycleEvent) => Promise | void; onEvent?: (event: AcpRuntimeEvent) => Promise | void; }; type AcpTurnLifecycleEvent = { type: "prompt_submitted"; at: number; }; /** Input for closing, resetting, or cleaning up an ACP session. */ type AcpCloseSessionInput = { cfg: OpenClawConfig; sessionKey: string; reason: string; discardPersistentState?: boolean; clearMeta?: boolean; allowBackendUnavailable?: boolean; requireAcpSession?: boolean; }; type AcpCloseSessionResult = { runtimeClosed: boolean; runtimeNotice?: string; metaCleared: boolean; }; /** User-facing session status assembled from persisted metadata and runtime status. */ type AcpSessionStatus = { sessionKey: string; backend: string; agent: string; identity?: SessionAcpIdentity; state: SessionAcpMeta["state"]; mode: AcpRuntimeSessionMode; runtimeOptions: AcpSessionRuntimeOptions; capabilities: AcpRuntimeCapabilities; runtimeStatus?: AcpRuntimeStatus; lastActivityAt: number; lastError?: string; }; /** Process-local ACP manager counters exposed for diagnostics. */ type AcpManagerObservabilitySnapshot = { runtimeCache: { activeSessions: number; idleTtlMs: number; evictedTotal: number; lastEvictedAt?: number; }; turns: { active: number; queueDepth: number; completed: number; failed: number; averageLatencyMs: number; maxLatencyMs: number; }; errorsByCode: Record; }; type AcpStartupIdentityReconcileResult = { checked: number; resolved: number; failed: number; }; type AcpSessionManagerDeps = { listAcpSessions: typeof listAcpSessionEntries; readSessionEntry: typeof readAcpSessionEntry; upsertSessionMeta: typeof upsertAcpSessionMeta; getRuntimeBackend: typeof getAcpRuntimeBackend; requireRuntimeBackend: typeof requireAcpRuntimeBackend; }; //#endregion //#region src/acp/control-plane/manager.core.d.ts /** Coordinates ACP session metadata, runtime handles, per-session queues, and turn execution. */ declare class AcpSessionManager { private readonly actorQueue; private readonly runtimeHandles; private readonly activeTurnBySession; private readonly turnLatencyStats; private readonly errorCountsByCode; private readonly deps; constructor(deps?: AcpSessionManagerDeps); resolveSession(params: { cfg: OpenClawConfig; sessionKey: string; }): AcpSessionResolution; getObservabilitySnapshot(cfg: OpenClawConfig): AcpManagerObservabilitySnapshot; reconcilePendingSessionIdentities(params: { cfg: OpenClawConfig; }): Promise; initializeSession(input: AcpInitializeSessionInput): Promise<{ runtime: AcpRuntime; handle: AcpRuntimeHandle; meta: SessionAcpMeta; }>; getSessionStatus(params: { cfg: OpenClawConfig; sessionKey: string; signal?: AbortSignal; }): Promise; setSessionRuntimeMode(params: { cfg: OpenClawConfig; sessionKey: string; runtimeMode: string; }): Promise; setSessionConfigOption(params: { cfg: OpenClawConfig; sessionKey: string; key: string; value: string; }): Promise; updateSessionRuntimeOptions(params: { cfg: OpenClawConfig; sessionKey: string; patch: Partial; }): Promise; resetSessionRuntimeOptions(params: { cfg: OpenClawConfig; sessionKey: string; }): Promise; runTurn(input: AcpRunTurnInput): Promise; cancelSession(params: { cfg: OpenClawConfig; sessionKey: string; reason?: string; }): Promise; closeSession(input: AcpCloseSessionInput): Promise; private ensureRuntimeHandle; private runtimeOptionCommandServices; private enforceConcurrentSessionLimit; private recordTurnCompletion; private recordErrorCode; private resolveRuntimeCapabilities; private evictIdleRuntimeHandles; private applyRuntimeControls; private setSessionState; private reconcileRuntimeSessionIdentifiers; private writeSessionMeta; private withSessionActor; private throwIfAborted; } //#endregion export { readAcpSessionEntry as i, AcpSessionResolution as n, AcpSessionStoreEntry as r, AcpSessionManager as t };