import { type RunLoopResult } from './loop.js';
import type { WorkflowRuntimeContext } from './runtime.js';
import type { WorkflowDefinition } from './definition.js';
import type { EventLog } from './events/append.js';
import { type Snapshot } from './events/replay.js';
import { type RequestCancelActor } from './cancel.js';
export type CancelWorkflowRunInput = {
    ctx: WorkflowRuntimeContext;
    reason: string;
    by: string;
    actor?: RequestCancelActor;
    maxTicks?: number;
};
export type CancelWorkflowRunResult = {
    snapshot: Snapshot;
    loopResult?: RunLoopResult;
    cancelEventId?: string;
    cancelAlreadyRequested: boolean;
    alreadyTerminal: boolean;
};
export type CancelWorkflowRunChatScopeResult = {
    ok: true;
} | {
    ok: false;
    error: 'bad_run_id' | 'unknown_run' | 'wrong_chat';
    status?: string;
};
/**
 * IM cancel is scoped to the chat that created the run.  This is a pure
 * guard: callers must run it before writing cancelRequested.
 */
export declare function guardWorkflowRunCancelChatScope(runsDir: string, runId: string, expectedChatId: string): Promise<CancelWorkflowRunChatScopeResult>;
/**
 * Shared run-level cancel operation used by CLI and dashboard/daemon IPC.
 *
 * The operation is idempotent:
 * - terminal runs write zero events;
 * - repeated cancels reuse the existing run-level cancel intent;
 * - parent node/run cancel terminal events are written only once by replay
 *   intent markers.
 */
export declare function cancelWorkflowRun(input: CancelWorkflowRunInput): Promise<CancelWorkflowRunResult>;
export declare function finalizeRunCancelIfPossible(log: EventLog, def: WorkflowDefinition, snapshot: Snapshot): Promise<void>;
export declare function isTerminalRunStatus(status: string): boolean;
//# sourceMappingURL=cancel-run.d.ts.map