/**
 * Feature State Derivation
 *
 * Derives UI node state and progress from the Feature domain model
 * and its associated AgentRun status (mirrors CLI feat ls logic).
 */
import { NotificationEventType } from '../../../../../../packages/core/src/domain/generated/index.js';
import type { Feature, AgentRun } from '../../../../../../packages/core/src/domain/generated/index.js';
import type { FeatureNodeState, FeatureLifecyclePhase } from './feature-node-state-config.js';
/**
 * Derives the visual node state from a Feature and its optional AgentRun.
 *
 * Priority (mirrors CLI formatStatus):
 * 1. Agent waiting_approval → action-required
 * 2. Agent failed → error
 * 3. Agent interrupted/cancelled → error
 * 4. Agent completed + Maintain lifecycle → done
 * 5. Agent running/pending → running
 * 6. No agent run → fall back to plan tasks / lifecycle
 */
export declare function deriveNodeState(feature: Feature, agentRun?: AgentRun | null, options?: {
    isPidAlive?: boolean;
}): FeatureNodeState;
/**
 * Derives progress percentage from Feature.plan.tasks.
 *
 * Returns the percentage of tasks in Done state.
 * Returns 100 for Maintain lifecycle, 0 if no plan.
 */
export declare function deriveProgress(feature: Feature): number;
/** Maps a NotificationEventType to the corresponding FeatureNodeState for optimistic UI updates. */
export declare function mapEventTypeToState(eventType: NotificationEventType): FeatureNodeState;
/** Map domain SdlcLifecycle enum values to UI FeatureLifecyclePhase. */
export declare const sdlcLifecycleMap: Record<string, FeatureLifecyclePhase>;
/**
 * Derives the UI lifecycle phase from a Feature + AgentRun.
 * Shared by build-feature-node-data.ts and build-graph-nodes.ts.
 */
export declare function deriveLifecycle(feature: Feature, run: AgentRun | null): FeatureLifecyclePhase;
export interface SseEventUpdate {
    featureId: string;
    state: FeatureNodeState | undefined;
    lifecycle: FeatureLifecyclePhase | undefined;
    eventType: NotificationEventType;
    phaseName?: string;
}
/**
 * Resolves state/lifecycle updates from a batch of SSE events, applying
 * the WaitingApproval batch-suppression rule: when WaitingApproval and
 * PhaseCompleted arrive in the same batch for a feature, PhaseCompleted
 * is fully suppressed to prevent lifecycle regression.
 */
export declare function resolveSseEventUpdates(events: readonly {
    featureId: string;
    eventType: NotificationEventType;
    phaseName?: string;
}[]): SseEventUpdate[];
export declare function mapPhaseNameToLifecycle(phaseName: string | undefined): FeatureLifecyclePhase | undefined;
//# sourceMappingURL=derive-feature-state.d.ts.map