import type { CliDeps } from "../../cli/deps.types.js"; import { createLazyImportLoader } from "../../shared/lazy-promise.js"; import type { getRemoteSkillEligibility } from "../../skills/runtime/remote.js"; import type { resolveReusableWorkspaceSkillSnapshot } from "../../skills/runtime/session-snapshot.js"; type AttemptExecutionRuntime = typeof import("./attempt-execution.runtime.js"); export type AgentAttemptResult = Awaited>; type AcpManagerRuntime = typeof import("../../acp/control-plane/manager.js"); type AcpPolicyRuntime = typeof import("../../acp/policy.js"); type AcpRuntimeErrorsRuntime = typeof import("../../acp/runtime/errors.js"); type AcpSessionIdentifiersRuntime = typeof import("@openclaw/acp-core/runtime/session-identifiers"); type DeliveryRuntime = typeof import("./delivery.runtime.js"); type SessionStoreRuntime = typeof import("./session-store.runtime.js"); type CliCompactionRuntime = typeof import("./cli-compaction.js"); type AgentRunnerMemoryRuntime = typeof import("../../auto-reply/reply/agent-runner-memory.js"); type TranscriptResolveRuntime = typeof import("../../config/sessions/transcript-resolve.runtime.js"); type TranscriptAppendRuntime = typeof import("../../config/sessions/transcript.runtime.js"); type CliDepsRuntime = typeof import("../../cli/deps.js"); type ExecDefaultsRuntime = typeof import("../exec-defaults.js"); type SkillsRuntime = { getRemoteSkillEligibility: typeof getRemoteSkillEligibility; resolveReusableWorkspaceSkillSnapshot: typeof resolveReusableWorkspaceSkillSnapshot; }; const attemptExecutionRuntimeLoader = createLazyImportLoader( () => import("./attempt-execution.runtime.js"), ); const acpManagerRuntimeLoader = createLazyImportLoader( () => import("../../acp/control-plane/manager.js"), ); const acpPolicyRuntimeLoader = createLazyImportLoader( () => import("../../acp/policy.js"), ); const acpRuntimeErrorsRuntimeLoader = createLazyImportLoader( () => import("../../acp/runtime/errors.js"), ); const acpSessionIdentifiersRuntimeLoader = createLazyImportLoader( () => import("@openclaw/acp-core/runtime/session-identifiers"), ); const deliveryRuntimeLoader = createLazyImportLoader( () => import("./delivery.runtime.js"), ); const sessionStoreRuntimeLoader = createLazyImportLoader( () => import("./session-store.runtime.js"), ); const cliCompactionRuntimeLoader = createLazyImportLoader( () => import("./cli-compaction.js"), ); const agentRunnerMemoryRuntimeLoader = createLazyImportLoader( () => import("../../auto-reply/reply/agent-runner-memory.js"), ); const transcriptResolveRuntimeLoader = createLazyImportLoader( () => import("../../config/sessions/transcript-resolve.runtime.js"), ); const transcriptAppendRuntimeLoader = createLazyImportLoader( () => import("../../config/sessions/transcript.runtime.js"), ); const cliDepsRuntimeLoader = createLazyImportLoader( () => import("../../cli/deps.js"), ); const execDefaultsRuntimeLoader = createLazyImportLoader( () => import("../exec-defaults.js"), ); const skillsRuntimeLoader = createLazyImportLoader(async () => { const [remote, sessionSnapshot] = await Promise.all([ import("../../skills/runtime/remote.js"), import("../../skills/runtime/session-snapshot.js"), ]); return { getRemoteSkillEligibility: remote.getRemoteSkillEligibility, resolveReusableWorkspaceSkillSnapshot: sessionSnapshot.resolveReusableWorkspaceSkillSnapshot, }; }); export function loadAttemptExecutionRuntime(): Promise { return attemptExecutionRuntimeLoader.load(); } export function loadAcpManagerRuntime(): Promise { return acpManagerRuntimeLoader.load(); } export function loadAcpPolicyRuntime(): Promise { return acpPolicyRuntimeLoader.load(); } export function loadAcpRuntimeErrorsRuntime(): Promise { return acpRuntimeErrorsRuntimeLoader.load(); } export function loadAcpSessionIdentifiersRuntime(): Promise { return acpSessionIdentifiersRuntimeLoader.load(); } export function loadDeliveryRuntime(): Promise { return deliveryRuntimeLoader.load(); } export function loadSessionStoreRuntime(): Promise { return sessionStoreRuntimeLoader.load(); } export function loadCliCompactionRuntime(): Promise { return cliCompactionRuntimeLoader.load(); } export function loadAgentRunnerMemoryRuntime(): Promise { return agentRunnerMemoryRuntimeLoader.load(); } export function loadTranscriptResolveRuntime(): Promise { return transcriptResolveRuntimeLoader.load(); } export function loadTranscriptAppendRuntime(): Promise { return transcriptAppendRuntimeLoader.load(); } export function loadExecDefaultsRuntime(): Promise { return execDefaultsRuntimeLoader.load(); } export function loadSkillsRuntime(): Promise { return skillsRuntimeLoader.load(); } export async function resolveAgentCommandDeps(deps: CliDeps | undefined): Promise { if (deps) { return deps; } const { createDefaultDeps } = await cliDepsRuntimeLoader.load(); return createDefaultDeps(); }