/**
 * @fileoverview Centralized SSE event type registry — single source of truth.
 *
 * All Server-Sent Event type strings used by the backend (`broadcast()` calls)
 * and referenced by the frontend (`SSE_EVENTS` in `constants.js`).
 * Both files MUST be kept in sync.
 *
 * 120 event constants organized by category:
 * - **Core** (1): init
 * - **Session lifecycle** (17): created, updated, deleted, terminal, idle, working, ...
 * - **Session: Ralph** (6): ralphLoopUpdate, todoUpdate, completionDetected, ...
 * - **Session: Bash tools** (3): bashToolStart, bashToolEnd, bashToolsUpdate
 * - **Session: Plan** (4): planTaskUpdate, planCheckpoint, planRollback, planTaskAdded
 * - **Tasks** (4): created, completed, failed, updated
 * - **Mux** (4): created, killed, died, statsUpdated
 * - **Respawn** (24): stateChanged, cycleStarted/Completed, step*, aiCheck*, planCheck*, timer*, log, ...
 * - **Subagents** (7): discovered, updated, tool_call, tool_result, progress, message, completed
 * - **Scheduled** (6): created, updated, completed, stopped, log, deleted
 * - **Teams** (4): created, updated, removed, taskUpdated
 * - **Transcript** (4): complete, plan_mode, tool_start, tool_end
 * - **Plan orchestration** (5): started, progress, subagent, completed, cancelled
 * - **Tunnel** (7): started, stopped, progress, error, qrRotated, qrRegenerated, qrAuthUsed
 * - **Image** (1): detected
 * - **Hooks** (6): idle_prompt, permission_prompt, elicitation_dialog, stop, teammate_idle, task_completed
 * - **Orchestrator** (12): stateChanged, planProgress, planReady, phase*, verification, task*, completed, error
 * - **Clipboard** (1): write
 * - **Cases** (4): created, linked, deleted, order-changed
 *
 * Naming convention: `domain:action` (e.g., `session:created`, `respawn:stateChanged`)
 *
 * Key export: `SseEvent` namespace object — import for destructured access.
 *
 * Usage:
 *   import { SseEvent } from './sse-events.js';
 *   ctx.broadcast(SseEvent.SessionCreated, { id: session.id });
 *
 * When adding a new event:
 * 1. Add the constant here with JSDoc
 * 2. Add the matching entry in `src/web/public/constants.js` SSE_EVENTS object
 * 3. Add the frontend listener in the appropriate `addListener()` call
 */
// ─── Core ────────────────────────────────────────────────────────────────────
/** Sent to each SSE client on initial connection with full app state. */
export const Init = 'init';
// ─── Session Lifecycle ───────────────────────────────────────────────────────
/** New session spawned. */
export const SessionCreated = 'session:created';
/** Session state changed (status, config, tokens, etc.). */
export const SessionUpdated = 'session:updated';
/** Session permanently removed. */
export const SessionDeleted = 'session:deleted';
/** Raw PTY terminal output chunk. */
export const SessionTerminal = 'session:terminal';
/** Client should re-fetch the full terminal buffer (e.g. after reconnect). */
export const SessionNeedsRefresh = 'session:needsRefresh';
/** Terminal buffer cleared (e.g. /clear command). */
export const SessionClearTerminal = 'session:clearTerminal';
/** Claude finished a prompt — includes result and cost. */
export const SessionCompletion = 'session:completion';
/** Session-level error. */
export const SessionError = 'session:error';
/** Claude CLI process exited. */
export const SessionExit = 'session:exit';
/** Session transitioned to idle (waiting for input). */
export const SessionIdle = 'session:idle';
/** Session transitioned to working (Claude is processing). */
export const SessionWorking = 'session:working';
/** Auto-clear triggered for the session. */
export const SessionAutoClear = 'session:autoClear';
/** Auto-compact triggered for the session. */
export const SessionAutoCompact = 'session:autoCompact';
/** Usage-limit pause detected; auto-resume scheduled. */
export const SessionLimitPauseScheduled = 'session:limitPauseScheduled';
/** Auto-resume prompt sent after a usage-limit reset. */
export const SessionLimitResume = 'session:limitResume';
/** Pending usage-limit auto-resume cancelled (session resumed or feature disabled). */
export const SessionLimitResumeCancelled = 'session:limitResumeCancelled';
/** CLI version/model info detected from session output. */
export const SessionCliInfo = 'session:cliInfo';
/** General session message (e.g. status text). */
export const SessionMessage = 'session:message';
/** Session entered interactive mode (claude or shell). */
export const SessionInteractive = 'session:interactive';
/** Prompt sent to session for execution. */
export const SessionRunning = 'session:running';
// ─── Session: Ralph ──────────────────────────────────────────────────────────
/** Ralph loop state changed (enabled/disabled, iteration count). */
export const SessionRalphLoopUpdate = 'session:ralphLoopUpdate';
/** Ralph todo items updated. */
export const SessionRalphTodoUpdate = 'session:ralphTodoUpdate';
/** Ralph completion phrase detected in output. */
export const SessionRalphCompletionDetected = 'session:ralphCompletionDetected';
/** Ralph status block parsed from output. */
export const SessionRalphStatusUpdate = 'session:ralphStatusUpdate';
/** Circuit breaker state changed (CLOSED/HALF_OPEN/OPEN). */
export const SessionCircuitBreakerUpdate = 'session:circuitBreakerUpdate';
/** Exit gate condition met (e.g. completion phrase found). */
export const SessionExitGateMet = 'session:exitGateMet';
// ─── Session: Bash Tools ─────────────────────────────────────────────────────
/** Bash tool invocation started. */
export const SessionBashToolStart = 'session:bashToolStart';
/** Bash tool invocation completed. */
export const SessionBashToolEnd = 'session:bashToolEnd';
/** Active bash tools list changed. */
export const SessionBashToolsUpdate = 'session:bashToolsUpdate';
// ─── Session: Plan ───────────────────────────────────────────────────────────
/** Plan task status updated. */
export const SessionPlanTaskUpdate = 'session:planTaskUpdate';
/** Plan checkpoint created. */
export const SessionPlanCheckpoint = 'session:planCheckpoint';
/** Plan rolled back to a previous version. */
export const SessionPlanRollback = 'session:planRollback';
/** New task added to plan. */
export const SessionPlanTaskAdded = 'session:planTaskAdded';
// ─── Tasks ───────────────────────────────────────────────────────────────────
/** Background task created. */
export const TaskCreated = 'task:created';
/** Background task completed successfully. */
export const TaskCompleted = 'task:completed';
/** Background task failed. */
export const TaskFailed = 'task:failed';
/** Background task state updated. */
export const TaskUpdated = 'task:updated';
// ─── Mux (tmux) ──────────────────────────────────────────────────────────────
/** tmux session created. */
export const MuxCreated = 'mux:created';
/** tmux session killed. */
export const MuxKilled = 'mux:killed';
/** tmux session died unexpectedly. */
export const MuxDied = 'mux:died';
/** tmux session stats refreshed. */
export const MuxStatsUpdated = 'mux:statsUpdated';
// ─── Respawn ─────────────────────────────────────────────────────────────────
/** Respawn loop started for a session. */
export const RespawnStarted = 'respawn:started';
/** Respawn loop stopped. */
export const RespawnStopped = 'respawn:stopped';
/** Respawn state machine transitioned. */
export const RespawnStateChanged = 'respawn:stateChanged';
/** New respawn cycle started. */
export const RespawnCycleStarted = 'respawn:cycleStarted';
/** Respawn cycle completed. */
export const RespawnCycleCompleted = 'respawn:cycleCompleted';
/** Respawn blocked (e.g. by circuit breaker or active teammates). */
export const RespawnBlocked = 'respawn:blocked';
/** Respawn step sent to session (update prompt, clear, kickstart). */
export const RespawnStepSent = 'respawn:stepSent';
/** Respawn step completed. */
export const RespawnStepCompleted = 'respawn:stepCompleted';
/** Idle/completion detection status updated. */
export const RespawnDetectionUpdate = 'respawn:detectionUpdate';
/** Auto-accept sent for permission prompt. */
export const RespawnAutoAcceptSent = 'respawn:autoAcceptSent';
/** AI idle check started. */
export const RespawnAiCheckStarted = 'respawn:aiCheckStarted';
/** AI idle check completed with result. */
export const RespawnAiCheckCompleted = 'respawn:aiCheckCompleted';
/** AI idle check failed. */
export const RespawnAiCheckFailed = 'respawn:aiCheckFailed';
/** AI check cooldown state changed. */
export const RespawnAiCheckCooldown = 'respawn:aiCheckCooldown';
/** Plan completion check started. */
export const RespawnPlanCheckStarted = 'respawn:planCheckStarted';
/** Plan completion check completed with result. */
export const RespawnPlanCheckCompleted = 'respawn:planCheckCompleted';
/** Plan completion check failed. */
export const RespawnPlanCheckFailed = 'respawn:planCheckFailed';
/** Respawn timer started (idle, duration, etc.). */
export const RespawnTimerStarted = 'respawn:timerStarted';
/** Respawn timer cancelled. */
export const RespawnTimerCancelled = 'respawn:timerCancelled';
/** Respawn timer completed. */
export const RespawnTimerCompleted = 'respawn:timerCompleted';
/** Respawn action logged (for monitor UI). */
export const RespawnActionLog = 'respawn:actionLog';
/** Respawn debug log message. */
export const RespawnLog = 'respawn:log';
/** Respawn error occurred. */
export const RespawnError = 'respawn:error';
/** Respawn configuration updated. */
export const RespawnConfigUpdated = 'respawn:configUpdated';
// ─── Subagents ───────────────────────────────────────────────────────────────
/** New subagent (background agent) discovered. */
export const SubagentDiscovered = 'subagent:discovered';
/** Subagent state updated. */
export const SubagentUpdated = 'subagent:updated';
/** Subagent tool call detected. */
export const SubagentToolCall = 'subagent:tool_call';
/** Subagent tool result received. */
export const SubagentToolResult = 'subagent:tool_result';
/** Subagent progress update. */
export const SubagentProgress = 'subagent:progress';
/** Subagent message (assistant text). */
export const SubagentMessage = 'subagent:message';
/** Subagent finished. */
export const SubagentCompleted = 'subagent:completed';
// ─── Scheduled Runs ──────────────────────────────────────────────────────────
/** Scheduled run created. */
export const ScheduledCreated = 'scheduled:created';
/** Scheduled run state updated. */
export const ScheduledUpdated = 'scheduled:updated';
/** Scheduled run completed. */
export const ScheduledCompleted = 'scheduled:completed';
/** Scheduled run stopped. */
export const ScheduledStopped = 'scheduled:stopped';
/** Scheduled run log entry added. */
export const ScheduledLog = 'scheduled:log';
/** Scheduled run deleted. */
export const ScheduledDeleted = 'scheduled:deleted';
// ─── Teams ───────────────────────────────────────────────────────────────────
/** Agent team created. */
export const TeamCreated = 'team:created';
/** Agent team config updated (e.g. new member joined). */
export const TeamUpdated = 'team:updated';
/** Agent team removed. */
export const TeamRemoved = 'team:removed';
/** Agent team task updated. */
export const TeamTaskUpdated = 'team:taskUpdated';
// ─── Transcript ──────────────────────────────────────────────────────────────
/** Transcript complete event detected. */
export const TranscriptComplete = 'transcript:complete';
/** Plan mode detected in transcript. */
export const TranscriptPlanMode = 'transcript:plan_mode';
/** Tool invocation started in transcript. */
export const TranscriptToolStart = 'transcript:tool_start';
/** Tool invocation ended in transcript. */
export const TranscriptToolEnd = 'transcript:tool_end';
// ─── Plan Orchestration ──────────────────────────────────────────────────────
/** Plan generation started. */
export const PlanStarted = 'plan:started';
/** Plan generation progress update. */
export const PlanProgress = 'plan:progress';
/** Plan subagent event (research or planner agent). */
export const PlanSubagent = 'plan:subagent';
/** Plan generation completed. */
export const PlanCompleted = 'plan:completed';
/** Plan generation cancelled. */
export const PlanCancelled = 'plan:cancelled';
// ─── Tunnel ──────────────────────────────────────────────────────────────────
/** Cloudflare tunnel started. */
export const TunnelStarted = 'tunnel:started';
/** Cloudflare tunnel stopped. */
export const TunnelStopped = 'tunnel:stopped';
/** Tunnel startup progress. */
export const TunnelProgress = 'tunnel:progress';
/** Tunnel error. */
export const TunnelError = 'tunnel:error';
/** QR code rotated (new token generated). */
export const TunnelQrRotated = 'tunnel:qrRotated';
/** QR code force-regenerated. */
export const TunnelQrRegenerated = 'tunnel:qrRegenerated';
/** QR auth token consumed by a client. */
export const TunnelQrAuthUsed = 'tunnel:qrAuthUsed';
// ─── Image ───────────────────────────────────────────────────────────────────
/** New image file detected (e.g. screenshot upload). */
export const ImageDetected = 'image:detected';
/** New document/image attachment detected in a session working directory. */
export const AttachmentDetected = 'attachment:detected';
// ─── Hooks ───────────────────────────────────────────────────────────────────
/** Claude Code hook: session idle, waiting for input. */
export const HookIdlePrompt = 'hook:idle_prompt';
/** Claude Code hook: tool requesting permission. */
export const HookPermissionPrompt = 'hook:permission_prompt';
/** Claude Code hook: elicitation dialog (Claude asking a question). */
export const HookElicitationDialog = 'hook:elicitation_dialog';
/** Claude Code hook: response complete. */
export const HookStop = 'hook:stop';
/** Claude Code hook: teammate went idle. */
export const HookTeammateIdle = 'hook:teammate_idle';
/** Claude Code hook: teammate task completed. */
export const HookTaskCompleted = 'hook:task_completed';
// ─── Orchestrator ────────────────────────────────────────────────────────────
/** Orchestrator state machine transitioned. */
export const OrchestratorStateChanged = 'orchestrator:stateChanged';
/** Orchestrator plan generation progress update. */
export const OrchestratorPlanProgress = 'orchestrator:planProgress';
/** Orchestrator plan generated and ready for approval. */
export const OrchestratorPlanReady = 'orchestrator:planReady';
/** Orchestrator phase started executing. */
export const OrchestratorPhaseStarted = 'orchestrator:phaseStarted';
/** Orchestrator phase completed successfully. */
export const OrchestratorPhaseCompleted = 'orchestrator:phaseCompleted';
/** Orchestrator phase failed. */
export const OrchestratorPhaseFailed = 'orchestrator:phaseFailed';
/** Orchestrator verification result for a phase. */
export const OrchestratorVerification = 'orchestrator:verification';
/** Orchestrator task assigned to session. */
export const OrchestratorTaskAssigned = 'orchestrator:taskAssigned';
/** Orchestrator task completed. */
export const OrchestratorTaskCompleted = 'orchestrator:taskCompleted';
/** Orchestrator task failed. */
export const OrchestratorTaskFailed = 'orchestrator:taskFailed';
/** All orchestrator phases completed successfully. */
export const OrchestratorCompleted = 'orchestrator:completed';
/** Orchestrator error. */
export const OrchestratorError = 'orchestrator:error';
// ─── Clipboard ──────────────────────────────────────────────────────────────
/** Clipboard content pushed to browser. */
export const ClipboardWrite = 'clipboard:write';
// ─── Cases ───────────────────────────────────────────────────────────────────
/** New case directory created. */
export const CaseCreated = 'case:created';
/** Existing directory linked as a case. */
export const CaseLinked = 'case:linked';
/** Case deleted or unlinked. */
export const CaseDeleted = 'case:deleted';
/** Case ordering changed. */
export const CaseOrderChanged = 'case:order-changed';
// ─── Namespace Re-export ─────────────────────────────────────────────────────
/**
 * All SSE event types as a namespace object.
 * Convenient for destructured imports or passing as a group.
 */
export const SseEvent = {
    // Core
    Init,
    // Session lifecycle
    SessionCreated,
    SessionUpdated,
    SessionDeleted,
    SessionTerminal,
    SessionNeedsRefresh,
    SessionClearTerminal,
    SessionCompletion,
    SessionError,
    SessionExit,
    SessionIdle,
    SessionWorking,
    SessionAutoClear,
    SessionAutoCompact,
    SessionLimitPauseScheduled,
    SessionLimitResume,
    SessionLimitResumeCancelled,
    SessionCliInfo,
    SessionMessage,
    SessionInteractive,
    SessionRunning,
    // Session: Ralph
    SessionRalphLoopUpdate,
    SessionRalphTodoUpdate,
    SessionRalphCompletionDetected,
    SessionRalphStatusUpdate,
    SessionCircuitBreakerUpdate,
    SessionExitGateMet,
    // Session: Bash tools
    SessionBashToolStart,
    SessionBashToolEnd,
    SessionBashToolsUpdate,
    // Session: Plan
    SessionPlanTaskUpdate,
    SessionPlanCheckpoint,
    SessionPlanRollback,
    SessionPlanTaskAdded,
    // Tasks
    TaskCreated,
    TaskCompleted,
    TaskFailed,
    TaskUpdated,
    // Mux
    MuxCreated,
    MuxKilled,
    MuxDied,
    MuxStatsUpdated,
    // Respawn
    RespawnStarted,
    RespawnStopped,
    RespawnStateChanged,
    RespawnCycleStarted,
    RespawnCycleCompleted,
    RespawnBlocked,
    RespawnStepSent,
    RespawnStepCompleted,
    RespawnDetectionUpdate,
    RespawnAutoAcceptSent,
    RespawnAiCheckStarted,
    RespawnAiCheckCompleted,
    RespawnAiCheckFailed,
    RespawnAiCheckCooldown,
    RespawnPlanCheckStarted,
    RespawnPlanCheckCompleted,
    RespawnPlanCheckFailed,
    RespawnTimerStarted,
    RespawnTimerCancelled,
    RespawnTimerCompleted,
    RespawnActionLog,
    RespawnLog,
    RespawnError,
    RespawnConfigUpdated,
    // Subagents
    SubagentDiscovered,
    SubagentUpdated,
    SubagentToolCall,
    SubagentToolResult,
    SubagentProgress,
    SubagentMessage,
    SubagentCompleted,
    // Scheduled runs
    ScheduledCreated,
    ScheduledUpdated,
    ScheduledCompleted,
    ScheduledStopped,
    ScheduledLog,
    ScheduledDeleted,
    // Teams
    TeamCreated,
    TeamUpdated,
    TeamRemoved,
    TeamTaskUpdated,
    // Transcript
    TranscriptComplete,
    TranscriptPlanMode,
    TranscriptToolStart,
    TranscriptToolEnd,
    // Plan orchestration
    PlanStarted,
    PlanProgress,
    PlanSubagent,
    PlanCompleted,
    PlanCancelled,
    // Tunnel
    TunnelStarted,
    TunnelStopped,
    TunnelProgress,
    TunnelError,
    TunnelQrRotated,
    TunnelQrRegenerated,
    TunnelQrAuthUsed,
    // Image
    ImageDetected,
    AttachmentDetected,
    // Hooks
    HookIdlePrompt,
    HookPermissionPrompt,
    HookElicitationDialog,
    HookStop,
    HookTeammateIdle,
    HookTaskCompleted,
    // Orchestrator
    OrchestratorStateChanged,
    OrchestratorPlanProgress,
    OrchestratorPlanReady,
    OrchestratorPhaseStarted,
    OrchestratorPhaseCompleted,
    OrchestratorPhaseFailed,
    OrchestratorVerification,
    OrchestratorTaskAssigned,
    OrchestratorTaskCompleted,
    OrchestratorTaskFailed,
    OrchestratorCompleted,
    OrchestratorError,
    // Clipboard
    ClipboardWrite,
    // Cases
    CaseCreated,
    CaseLinked,
    CaseDeleted,
    CaseOrderChanged,
};
//# sourceMappingURL=sse-events.js.map