/**
 * Shared types for the StreamAgentEventsUseCase and its pure helper modules.
 *
 * Extracted from the monolithic use case as part of the clean-arch cleanup
 * (spec 089, file size violation #30). These types are consumed by the
 * orchestrator use case AND by the per-delta helper functions that live
 * next to it.
 */
import type { AgentMessageKind, AgentQuestionAnswerer, AgentQuestionKind, AgentQuestionStatus, ApplicationStatus, CloudDeploymentProvider, NotificationEvent, SupervisorVerdict } from '../../../../domain/generated/output.js';
import { AgentRunStatus, InteractiveSessionStatus } from '../../../../domain/generated/output.js';
import { InteractiveSessionEventType, NotificationEventType, NotificationSeverity } from '../../../../domain/generated/output.js';
/**
 * Payload shape for an interactive-session lifecycle transition. Mirrors the
 * historical `InteractiveSessionEvent` type emitted by the SSE route so the
 * client contract is preserved byte-for-byte.
 */
export interface InteractiveSessionStreamEvent {
    kind: 'interactive-session';
    type: InteractiveSessionEventType;
    sessionId: string;
    featureId: string;
}
/**
 * Envelope for a `NotificationEvent`. The optional `cloudDeployment` field is
 * preserved for cloud deploy broadcasts which historically piggy-back on the
 * notification channel with an extra `cloudDeployment` property.
 */
export interface NotificationStreamEvent {
    kind: 'notification';
    event: NotificationEvent & {
        cloudDeployment?: {
            applicationId: string;
            provider: string;
            status: string;
            url?: string;
            error?: string;
        };
    };
}
/**
 * Envelope for an inter-agent message published on {@link IAgentMessageBus}
 * (spec 093). Forwarded to every connected client via the existing SSE
 * pipeline so the web UI can render the agent activity feed in real time.
 */
export interface AgentMessageStreamEvent {
    kind: 'agent_message';
    messageId: string;
    appId?: string;
    repositoryId?: string;
    featureId?: string;
    fromActor: string;
    fromAgentRunId?: string;
    toTarget: string;
    toKind: string;
    messageKind: AgentMessageKind;
    /** Raw JSON-encoded payload — clients parse on the receiving end. */
    payload: string;
    correlationId?: string;
    createdAt: string;
}
/**
 * Envelope for an {@link AgentQuestion} lifecycle event (spec 093,
 * task 18). Two `transition` values are emitted:
 *  - `new`     — the question just appeared in the polled set.
 *  - `status`  — the question's status changed from its previous value
 *                (e.g., pending → answered).
 *
 * Forwarded to every connected client via the existing SSE pipeline so
 * the unified question inbox can render the row in real time.
 */
export interface AgentQuestionStreamEvent {
    kind: 'agent_question';
    questionId: string;
    appId?: string;
    repositoryId?: string;
    featureId?: string;
    agentRunId: string;
    questionKind: AgentQuestionKind;
    answerer: AgentQuestionAnswerer;
    status: AgentQuestionStatus;
    prompt: string;
    optionsJson?: string;
    answer?: string;
    answeredBy?: string;
    answeredAt?: string;
    transition: 'new' | 'status';
    createdAt: string;
}
/**
 * Envelope for a {@link SupervisorDecision} (spec 093, task 30).
 *
 * Forwarded to every connected client via the existing SSE pipeline so
 * the supervisor "Why?" drawer and audit views can render decisions in
 * real time. Decisions are immutable, so we only emit a `new` event —
 * unlike {@link AgentQuestionStreamEvent} there is no status transition
 * to track.
 */
export interface SupervisorDecisionStreamEvent {
    kind: 'supervisor_decision';
    decisionId: string;
    scopeType: string;
    scopeId?: string;
    featureId?: string;
    supervisorRunId: string;
    sourceEventKind: string;
    sourceEventId: string;
    verdict: SupervisorVerdict;
    rationale: string;
    modelId: string;
    promptVersion: string;
    ruleRef?: string;
    confidence?: number;
    createdAt: string;
}
export type StreamedAgentEvent = NotificationStreamEvent | InteractiveSessionStreamEvent | AgentMessageStreamEvent | AgentQuestionStreamEvent | SupervisorDecisionStreamEvent;
/** Per-connection cached state for a single feature. */
export interface CachedFeatureState {
    status: AgentRunStatus | null;
    lifecycle: string;
    completedPhases: Set<string>;
    featureName: string;
    prStatus: string | undefined;
    prMergeable: boolean | undefined;
    prCiStatus: string | undefined;
    /** Set once we've detected and emitted a crash event for this feature. */
    crashEmitted?: boolean;
}
/** Per-connection cached state for an interactive session. */
export interface CachedSessionState {
    status: InteractiveSessionStatus;
}
/** Per-connection cached state for an application row. */
export interface CachedApplicationState {
    setupComplete: boolean;
    status: ApplicationStatus;
    gitRemoteUrl: string | undefined;
    cloudDeploymentProvider: CloudDeploymentProvider | undefined;
}
/**
 * Mapping table from terminal-ish `AgentRunStatus` values to the notification
 * they should produce. Exported so helper modules can share one source of
 * truth with the orchestrator.
 */
export declare const STATUS_TO_EVENT: Partial<Record<AgentRunStatus, {
    eventType: NotificationEventType;
    severity: NotificationSeverity;
}>>;
/** Map agent graph node name from `AgentRun.result` to a phase name. */
export declare function resultToPhase(result: string | undefined): string | undefined;
/**
 * Map interactive session status → event type. Stays pure so helper modules
 * can call it without hitting tsyringe.
 */
export declare function statusToInteractiveEventType(status: InteractiveSessionStatus): InteractiveSessionEventType;
//# sourceMappingURL=stream-agent-events.types.d.ts.map