/** * Multi-recipient (broadcast) handoff — atomic fan-out with compensating * rollback. * * See session-hierarchy.md §6.2 (Multi-recipient broadcast flow — atomic), * §5.4 (broadcast source-session post-fan-out), §6.5 (capacity enforcement). * * **Atomicity contract** — one transaction boundary: either the full fan-out * commits (source CAS-lock + N assignments + N sub-sessions + N worktrees), * or none of it is externally observable. On any step failure the kernel * executes a compensating rollback and emits `onBroadcastRollback` with * accurate `partialState` counts. The rollback itself is idempotent per * roadmap Risk #3. * * Commit / rollback sequence (pattern doc §6.2): * ``` * COMMIT: idle → locked(CAS) → N assignments → N sub-sessions → N worktrees → awaiting_merge * ROLLBACK: ( ← tear down partial worktrees ← delete partial sub-sessions ← * delete partial assignments ← release CAS ) emit broadcast.rollback; * source → idle * ``` */ import { type TopicManagerDependency } from '../../manager/topic/dependency.js'; import type { 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'; import type { TurnStatusResolver } from './single.js'; interface BroadcastHandoffBaseDeps { store: SessionStore; workspaceRegistry: WorkspaceBackendRegistry; capacity: CapacityValidator; events: HandoffEventSink; /** * Required, for the reason `SingleHandoffDeps.turnStatus` is: the default * that used to stand in here reported every session unblocked. */ turnStatus: TurnStatusResolver; } /** Dependencies for a multi-recipient handoff. */ export type BroadcastHandoffDeps = BroadcastHandoffBaseDeps & TopicManagerDependency; /** * Executes a broadcast fan-out. All assignments MUST share the same * `sourceSessionId`, `expectedOwnerVersion`, `broadcastId`, and `projectId`. * Duplicate recipients (same actor kind + id) are rejected before any write. * * Returns one {@link HandoffOutcome} per recipient on success. On failure the * source session is restored, every provisioned resource is torn down, and * the underlying error propagates after `onBroadcastRollback` is emitted. */ export declare function executeBroadcastHandoff(deps: BroadcastHandoffDeps, assignments: readonly HandoffAssignment[], tenantId: TenantId): Promise; export {}; //# sourceMappingURL=broadcast.d.ts.map