import { type ActionSurfaces } from './actionSpecs.js';
import type { ActionId } from './actionIds.js';
import type { ActionUiPlacement } from './actionUiPlacements.js';
import type { MemorySearchQueryV1, MemorySearchResultV1 } from '../memory/memorySearch.js';
import type { MemoryWindowV1 } from '../memory/memoryWindow.js';
import { type ApprovalRequestV1 } from '../approvals/approvalRequestV1.js';
import type { PromptRegistryConfiguredSourceV1 } from '../promptLibrary/promptRegistriesV1.js';
import type { SessionRollbackTarget } from '../sessionRollback.js';
import { type SessionHandoffWorkspaceTransfer } from '../sessionControl/handoff/handoffSchemas.js';
export type ActionExecuteResult = Readonly<{
    ok: true;
    result: unknown;
}> | Readonly<{
    ok: false;
    errorCode: string;
    error: string;
}>;
export type ActionExecutorContext = Readonly<{
    /**
     * Used when ActionSpec input permits an optional sessionId and the caller
     * wants to default to a current/active session.
     */
    defaultSessionId?: string | null;
    /**
     * Optional explicit server routing hint. When omitted, deps may resolve serverId
     * from local caches given a sessionId.
     */
    serverId?: string | null;
    /**
     * Invocation surface (UI / voice / MCP / CLI). Used for fail-closed per-surface gating.
     */
    surface?: keyof ActionSurfaces | null;
    /**
     * UI placement hint (session header, command palette, etc). Used for fail-closed
     * placement gating when desired.
     */
    placement?: ActionUiPlacement | null;
    /**
     * Internal escape hatch used when executing an action *because it has already been approved*.
     *
     * When true, the executor will still enforce surface/placement enablement, but it will not
     * route the underlying action through the approvals queue again. This prevents nested
     * approvals (and recursion) when `approval.request.decide` executes an approved action
     * on the same surface that originally required approvals.
     */
    bypassApprovals?: boolean;
}>;
export type ActionExecutorDeps = Readonly<{
    executionRunStart: (sessionId: string, request: any, opts?: Readonly<{
        serverId?: string | null;
    }>) => Promise<unknown>;
    executionRunList: (sessionId: string, request: any, opts?: Readonly<{
        serverId?: string | null;
    }>) => Promise<unknown>;
    executionRunGet: (sessionId: string, request: any, opts?: Readonly<{
        serverId?: string | null;
    }>) => Promise<unknown>;
    executionRunSend: (sessionId: string, request: any, opts?: Readonly<{
        serverId?: string | null;
    }>) => Promise<unknown>;
    executionRunStop: (sessionId: string, request: any, opts?: Readonly<{
        serverId?: string | null;
    }>) => Promise<unknown>;
    executionRunAction: (sessionId: string, request: any, opts?: Readonly<{
        serverId?: string | null;
    }>) => Promise<unknown>;
    executionRunWait: (sessionId: string, request: any, opts?: Readonly<{
        serverId?: string | null;
    }>) => Promise<unknown>;
    sessionOpen: (args: Readonly<{
        sessionId: string;
    }>) => Promise<unknown>;
    sessionFork: (args: Readonly<{
        sessionId: string;
        serverId?: string | null;
    }>) => Promise<unknown>;
    sessionRollback: (args: Readonly<{
        sessionId: string;
        serverId?: string | null;
        target?: SessionRollbackTarget;
    }>) => Promise<unknown>;
    sessionHandoffStart?: (args: Readonly<{
        sessionId: string;
        targetMachineId: string;
        targetSessionStorageMode?: 'direct' | 'persisted';
        workspaceTransfer?: SessionHandoffWorkspaceTransfer;
        serverId?: string | null;
    }>) => Promise<unknown>;
    sessionSpawnNew: (args: Readonly<{
        tag?: string;
        agentId?: string;
        modelId?: string;
        backendTargetKey?: string;
        title?: string;
        path?: string;
        host?: string;
        initialMessage?: string;
    }>) => Promise<unknown>;
    sessionSpawnPicker: (args: Readonly<{
        tag?: string;
        agentId?: string;
        modelId?: string;
        initialMessage?: string;
    }>) => Promise<unknown>;
    pathsListRecent: (args: Readonly<{
        machineId?: string;
        limit?: number;
    }>) => Promise<unknown>;
    machinesList: (args: Readonly<{
        limit?: number;
    }>) => Promise<unknown>;
    serversList: (args: Readonly<{
        limit?: number;
    }>) => Promise<unknown>;
    reviewEnginesList: (args: Readonly<{
        sessionId: string;
        includeDisabled?: boolean;
    }>) => Promise<unknown>;
    agentsBackendsList: (args: Readonly<{
        includeDisabled?: boolean;
        limit?: number;
    }>) => Promise<unknown>;
    agentsModelsList: (args: Readonly<{
        agentId: string;
        machineId?: string;
        limit?: number;
        backendTargetKey?: string;
    }>) => Promise<unknown>;
    sessionSendMessage: (args: Readonly<{
        sessionId: string;
        message: string;
        permissionModeOverride?: string;
        modelOverride?: string | null;
        wait?: boolean;
        timeoutSeconds?: number;
        serverId?: string | null;
    }>) => Promise<unknown>;
    sessionTitleSet?: (args: Readonly<{
        sessionId: string;
        title: string;
        serverId?: string | null;
    }>) => Promise<unknown>;
    sessionStop?: (args: Readonly<{
        sessionId: string;
        serverId?: string | null;
    }>) => Promise<unknown>;
    sessionPermissionModeSet?: (args: Readonly<{
        sessionId: string;
        permissionMode: string;
        serverId?: string | null;
    }>) => Promise<unknown>;
    sessionModelSet?: (args: Readonly<{
        sessionId: string;
        modelId: string;
        serverId?: string | null;
    }>) => Promise<unknown>;
    sessionArchiveSet?: (args: Readonly<{
        sessionId: string;
        archived: boolean;
        serverId?: string | null;
    }>) => Promise<unknown>;
    sessionStatusGet?: (args: Readonly<{
        sessionId: string;
        live?: boolean;
        serverId?: string | null;
    }>) => Promise<unknown>;
    sessionHistoryGet?: (args: Readonly<{
        sessionId: string;
        limit?: number;
        format?: 'compact' | 'raw';
        includeMeta?: boolean;
        includeStructuredPayload?: boolean;
        serverId?: string | null;
    }>) => Promise<unknown>;
    sessionWaitIdle?: (args: Readonly<{
        sessionId: string;
        timeoutSeconds?: number;
        serverId?: string | null;
    }>) => Promise<unknown>;
    sessionPermissionRespond?: (args: Readonly<{
        sessionId: string;
        decision: 'allow' | 'deny';
        requestId?: string | null;
        serverId?: string | null;
    }>) => Promise<unknown>;
    sessionUserActionAnswer?: (args: Readonly<{
        sessionId: string;
        requestId?: string | null;
        answers: readonly Readonly<{
            question: string;
            answer: string;
        }>[];
        decision?: 'approve' | 'reject' | 'request_changes';
        reason?: string;
        updatedPermissions?: unknown;
        serverId?: string | null;
    }>) => Promise<unknown>;
    sessionModeSet: (args: Readonly<{
        sessionId: string;
        modeId: string;
    }>) => Promise<unknown>;
    sessionModesList: (args: Readonly<{
        sessionId: string;
    }>) => Promise<unknown>;
    sessionTargetPrimarySet: (args: Readonly<{
        sessionId: string | null;
    }>) => Promise<unknown>;
    sessionTargetTrackedSet: (args: Readonly<{
        sessionIds: readonly string[];
    }>) => Promise<unknown>;
    sessionList: (args: Readonly<{
        limit?: number;
        cursor?: string | null;
        includeLastMessagePreview?: boolean;
        activeOnly?: boolean;
        archivedOnly?: boolean;
        includeSystem?: boolean;
        resumableOnly?: boolean;
    }>) => Promise<unknown>;
    sessionActivityGet: (args: Readonly<{
        sessionId: string;
        windowSeconds?: number;
    }>) => Promise<unknown>;
    sessionRecentMessagesGet: (args: Readonly<{
        sessionId: string;
        defaultSessionId?: string | null;
        limit?: number;
        cursor?: string | null;
        includeUser?: boolean;
        includeAssistant?: boolean;
        maxCharsPerMessage?: number | null;
    }>) => Promise<unknown>;
    resetGlobalVoiceAgent: () => Promise<void> | void;
    teleportVoiceAgentToSessionRoot?: (args: Readonly<{
        sessionId: string;
    }>) => Promise<unknown>;
    daemonMemorySearch: (args: Readonly<{
        machineId: string;
        query: MemorySearchQueryV1;
        serverId?: string | null;
    }>) => Promise<MemorySearchResultV1>;
    daemonMemoryGetWindow: (args: Readonly<{
        machineId: string;
        sessionId: string;
        seqFrom: number;
        seqTo: number;
        serverId?: string | null;
    }>) => Promise<MemoryWindowV1>;
    daemonMemoryEnsureUpToDate: (args: Readonly<{
        machineId: string;
        sessionId?: string;
        serverId?: string | null;
    }>) => Promise<unknown>;
    approvalsCreate?: (args: Readonly<{
        request: ApprovalRequestV1;
        serverId?: string | null;
    }>) => Promise<{
        artifactId: string;
    }>;
    approvalsGet?: (args: Readonly<{
        artifactId: string;
        serverId?: string | null;
    }>) => Promise<ApprovalRequestV1 | null>;
    approvalsUpdate?: (args: Readonly<{
        artifactId: string;
        request: ApprovalRequestV1;
        serverId?: string | null;
    }>) => Promise<{
        ok: true;
    } | {
        ok: false;
        errorCode: string;
        error: string;
    }>;
    promptDocUpdate?: (args: Readonly<{
        artifactId: string;
        title: string;
        markdown: string;
        folderId?: string | null;
        tags?: readonly string[];
    }>) => Promise<unknown>;
    promptBundleUpdate?: (args: Readonly<{
        artifactId: string;
        title: string;
        skillMarkdown: string;
        folderId?: string | null;
        tags?: readonly string[];
    }>) => Promise<unknown>;
    promptAssetExport?: (args: Readonly<{
        artifactId: string;
        machineId: string;
        assetTypeId: string;
        scope: 'user' | 'project';
        serverId?: string | null;
        directory?: string;
        targetPath?: string;
        targetName?: string;
        installMode?: 'copy' | 'symlink';
    }>) => Promise<unknown>;
    promptRegistryInstall?: (args: Readonly<{
        machineId: string;
        sourceId: string;
        itemId: string;
        configuredSources: readonly PromptRegistryConfiguredSourceV1[];
        serverId?: string | null;
        installTarget?: Readonly<{
            assetTypeId: string;
            scope: 'user' | 'project';
            directory?: string;
            targetName: string;
            installMode?: 'copy' | 'symlink';
        }>;
    }>) => Promise<unknown>;
    isActionEnabled?: (actionId: ActionId, ctx: ActionExecutorContext) => boolean;
    /**
     * Optional approvals routing policy hook.
     *
     * When true, the executor will create an approval request instead of executing the action.
     */
    isActionApprovalRequired?: (actionId: ActionId, ctx: ActionExecutorContext) => boolean;
    resolveServerIdForSessionId?: (sessionId: string) => string | null;
}>;
export declare function createActionExecutor(deps: ActionExecutorDeps): Readonly<{
    execute: (actionId: ActionId, input: unknown, context?: ActionExecutorContext) => Promise<ActionExecuteResult>;
}>;
//# sourceMappingURL=actionExecutor.d.ts.map