import type { TaskManager } from '@pellux/goodvibes-sdk/platform/runtime/tasks/types';
import type { RuntimeEventBus } from '../events/index.js';
import type { RuntimeStore } from '../store/index.js';
/** Thrown when an ops action is rejected because the state machine disallows it. */
export declare class OpsIllegalActionError extends Error {
    readonly targetId: string;
    readonly action: string;
    readonly currentState: string;
    constructor(targetId: string, action: string, currentState: string);
}
/** Thrown when the target task or agent is not found. */
export declare class OpsTargetNotFoundError extends Error {
    readonly targetId: string;
    readonly targetKind: 'task' | 'agent';
    constructor(targetId: string, targetKind: 'task' | 'agent');
}
export declare class OpsControlPlane {
    private readonly _taskManager;
    private readonly _bus;
    private readonly _store;
    private readonly _dispatch;
    private readonly _sessionId;
    constructor(taskManager: TaskManager, bus: RuntimeEventBus, store: RuntimeStore, sessionId: string);
    /**
     * Cancel a task. Only legal from states that allow → cancelled transition.
     *
     * @param taskId - Target task ID.
     * @param note - Optional operator note for the audit log.
     * @throws {OpsTargetNotFoundError} if the task doesn't exist.
     * @throws {OpsIllegalActionError} if the task is in a terminal state.
     */
    cancelTask(taskId: string, note?: string): void;
    /**
     * Pause a running task (transitions running → blocked).
     *
     * Only legal from the 'running' state.
     *
     * @param taskId - Target task ID.
     * @param note - Optional operator note for the audit log.
     * @throws {OpsTargetNotFoundError} if the task doesn't exist.
     * @throws {OpsIllegalActionError} if the task is not running.
     */
    pauseTask(taskId: string, note?: string): void;
    /**
     * Resume a blocked task (transitions blocked → running).
     *
     * Only legal from the 'blocked' state.
     *
     * @param taskId - Target task ID.
     * @param note - Optional operator note for the audit log.
     * @throws {OpsTargetNotFoundError} if the task doesn't exist.
     * @throws {OpsIllegalActionError} if the task is not blocked.
     */
    resumeTask(taskId: string, note?: string): void;
    /**
     * Retry a failed task (transitions failed → queued by re-creating as queued).
     *
     * Re-queues the task via TaskManager, which clears terminal-state fields
     * and transitions it back to 'queued'.
     * This is only permitted from 'failed' or 'cancelled' states.
     *
     * @param taskId - Target task ID.
     * @param note - Optional operator note for the audit log.
     * @throws {OpsTargetNotFoundError} if the task doesn't exist.
     * @throws {OpsIllegalActionError} if the task is not in a retryable state.
     */
    retryTask(taskId: string, note?: string): void;
    /**
     * Cancel a running agent.
     *
     * Only legal for agents in non-terminal states (spawning, running,
     * awaiting_message, awaiting_tool, finalizing).
     *
     * The agent state update is dispatched directly to the store since there is
     * no AgentManager interface with lifecycle methods (agents are managed
     * by their hosting subsystem). The store update signals the UI; the
     * underlying subsystem must observe the store and act accordingly.
     *
     * @param agentId - Target agent ID.
     * @param note - Optional operator note for the audit log.
     * @throws {OpsTargetNotFoundError} if the agent doesn't exist.
     * @throws {OpsIllegalActionError} if the agent is already in a terminal state.
     */
    cancelAgent(agentId: string, note?: string): void;
    /**
     * Returns whether a task action is currently legal given its state.
     * Used by the UI to conditionally render action controls.
     */
    canCancelTask(taskId: string): boolean;
    canPauseTask(taskId: string): boolean;
    canResumeTask(taskId: string): boolean;
    canRetryTask(taskId: string): boolean;
    canCancelAgent(agentId: string): boolean;
    private _makeCtx;
}
//# sourceMappingURL=control-plane.d.ts.map