/**
 * Single-recipient handoff flow — `idle → locked → CAS → commit | revert`.
 *
 * See session-hierarchy.md §6.1 (single-recipient flow) and §6.4 (concurrent
 * CAS). Function-based per Convention #9 — dependencies arrive as an
 * explicit `deps` envelope so tests can inject mocks and production code
 * composes flows without a class hierarchy.
 *
 * Flow (pattern doc §5.1 + §6.1):
 *   1. Load source session; verify tenant.
 *   2. Check status (must be `idle`); no non-terminal Runs.
 *   3. Validate capacity (depth + width).
 *   4. Transition source `idle → locked` with CAS on `ownerVersion`.
 *   5. Emit `onLocked`.
 *   6. Spawn recipient sub-session + provision isolated workspace.
 *   7. On any step 6 failure: compensating revert (`locked → idle`, version
 *      unchanged, dispose any partial worktree), emit `onUnlocked`, rethrow.
 *   8. On success: commit `locked → idle` with updated `currentActor` +
 *      appended `previousActors` + bumped `ownerVersion`.
 *   9. Emit `onCommitted` with the new version.
 */
import type { ThreadManager } from '../../manager/thread/lifecycle.js';
import type { SessionId, TenantId } from '../../types/ids/index.js';
import type { SessionStore } from '../../types/session/store.js';
import type { WorkspaceBackendRegistry } from '../workspace/registry.js';
import type { HandoffAssignment, HandoffOutcome } from './assignment.js';
import type { CapacityValidator } from './capacity.js';
import type { HandoffEventSink } from './events.js';
/**
 * Minimal surface the handoff flow queries for Run fan-in status. A Run is
 * considered "blocking" if it is in any non-terminal status that prevents the
 * source session from transitioning to `locked` (session-hierarchy.md §5.1).
 *
 * The flow injects the resolver so Phase 4 stays decoupled from Phase 6's
 * Run persistence refactor. Production wires the real Run store; tests stub.
 */
export interface RunStatusResolver {
    /**
     * Returns the reason the session has a non-terminal Run, or `null` when
     * all Runs are terminal and the lock is allowed.
     */
    blockingRun(sessionId: SessionId, tenantId: TenantId): Promise<{
        reason: 'active_run' | 'pending_hitl' | 'pending_subsession';
    } | null>;
}
/** Null resolver — treats every session as unblocked. Used by tests that do not exercise Run fan-in. */
export declare const NOOP_RUN_STATUS_RESOLVER: RunStatusResolver;
export interface SingleHandoffDeps {
    store: SessionStore;
    workspaceRegistry: WorkspaceBackendRegistry;
    capacity: CapacityValidator;
    events: HandoffEventSink;
    runStatus?: RunStatusResolver;
    /**
     * Gate the recipient-session creation on the Thread being `'open'`.
     * Added in Phase 2.6 to mirror spawn — a handoff into an archived
     * Thread would otherwise undermine `ThreadManager.archive`.
     */
    threadManager: ThreadManager;
}
/**
 * Executes a single-recipient handoff against `deps.store`. Throws
 * {@link HandoffLockRejected}, {@link HandoffVersionConflict},
 * {@link TenantIsolationError}, or {@link DelegationCapacityExceeded} on
 * invariant violations. Workspace provisioning failures surface as
 * {@link WorkspaceBackendError} after the compensating revert.
 */
export declare function executeSingleHandoff(deps: SingleHandoffDeps, assignment: HandoffAssignment, tenantId: TenantId): Promise<HandoffOutcome>;
//# sourceMappingURL=single.d.ts.map