Skip to content

Type Alias: AgentPaneEvent

agentmux


agentmux / agent-pane-state-store / AgentPaneEvent

AgentPaneEvent = { type: "init-ready"; } | { reason: string; type: "init-failed"; } | { at: number; type: "stream-subscribed"; } | { at: number; type: "stream-unsubscribed"; } | { at: number; lastKind: KindBeforeDisconnect; reason: DisconnectReason; type: "stream-disconnected"; } | { addedCount: number; type: "stream-flush-observed"; } | { idleSinceMs: number; recoverThresholdMs: number; thresholdMs: number; type: "stream-stuck"; } | { idleSinceMs: number; thresholdMs: number; type: "working-recovered"; } | { at: number; type: "turn-started"; } | { type: "turn-active-reconciled"; } | { at: number; type: "turn-inactive-reconciled"; } | { tokens: number; type: "context-reconciled-at-mount"; } | { model: string | null; reason: string; source: ContextSource; tokens: number; type: "context-reading-rejected"; window: number | null; } | { model: string; reported: number; tokens: number; type: "context-window-refuted"; window: number; } | { outcome: TurnOutcome; statsMerged: boolean; stoppingCleared: boolean; type: "turn-ended"; } | { type: "turn-reset"; } | { type: "turn-start-failed"; } | { reason: string; type: "turn-start-suppressed"; } | { name: string; type: "tool-started"; } | { type: "tool-ended"; } | { input: number | null; output: number | null; type: "tokens-updated"; } | { boundaryUuid?: string | null; durationMs?: number; frameTimestamp?: string | null; source: "real" | "heuristic"; tokensAfter: number; tokensBefore: number; trigger?: "manual" | "auto"; type: "context-compacted"; } | { trigger: "manual" | "auto"; type: "compaction-started"; } | { trigger: "manual" | "auto"; type: "compaction-started-buffered"; } | { reason: "rate_limited"; type: "provider-waiting"; } | { code: AgentFailure["code"]; turnWasEnded: boolean; type: "failure-observed"; } | { reason?: FailureClearReason; type: "failure-cleared"; } | { at: number; type: "stop-requested"; } | { type: "stop-failed"; } | { deadlineMs: number; type: "schedule-interrupt-timeout"; } | { at: number; type: "interrupt-timed-out"; } | { deadlineMs: number; type: "schedule-submit-timeout"; } | { at: number; type: "submit-timed-out"; } | { id: string; type: "pending-flush-started"; } | { ahead: number; id: string; type: "pending-waiting"; } | { id: string; type: "pending-queued"; } | { id: string; type: "pending-accepted"; wasPresent: boolean; } | { id: string; type: "pending-rejected"; wasPresent: boolean; } | { ageMs: number; id: string; queuedAt: number; type: "pending-expired"; wasPresent: boolean; } | { question?: string; questionCount?: number; type: "waiting-for-input"; } | { reason: "submitted" | "typing" | "closed"; type: "waiting-ended"; } | { at: number; type: "attached-task-observed"; } | { type: "attached-task-cleared"; } | { at: number; type: "registry-attached-task-observed"; } | { type: "registry-attached-task-cleared"; } | { at: number; type: "resume-retry-started"; } | { type: "resume-retry-resolved"; }

Defined in: agent-pane-state/types.ts:813

{ type: "init-ready"; }


{ reason: string; type: "init-failed"; }


{ at: number; type: "stream-subscribed"; }


{ at: number; type: "stream-unsubscribed"; }


{ at: number; lastKind: KindBeforeDisconnect; reason: DisconnectReason; type: "stream-disconnected"; }

The stream tore down while a turn was in flight; emitted alongside stream-unsubscribed, only on the working-set → Disconnected transition (not on idle unsubscribes), so the view can drive a “Disconnected — reconnecting…” banner.


{ addedCount: number; type: "stream-flush-observed"; }


{ idleSinceMs: number; recoverThresholdMs: number; thresholdMs: number; type: "stream-stuck"; }

idleSinceMs: number

recoverThresholdMs: number

The bar that would force this turn back to Idle: always larger than thresholdMs, and larger still under a rate-limit backoff.

thresholdMs: number

The WARNING bar (STUCK_THRESHOLD_MS). Crossing it is cosmetic.

type: "stream-stuck"

Stream has been silent for idleSinceMs while subscribed — exceeds thresholdMs. Surfaced for diagnostics / UI badge.


{ idleSinceMs: number; thresholdMs: number; type: "working-recovered"; }

idleSinceMs: number

thresholdMs: number

type: "working-recovered"

The watchdog force-recovered a hung Streaming turn to Idle after idleSinceMs ≥ LIVENESS_RECOVERY_MS (its session_end was never observed). For telemetry; the phase change is the real effect.


{ at: number; type: "turn-started"; }


{ type: "turn-active-reconciled"; }

ReconcileTurnActive promoted the phase to Streaming (from the mount-default Idle or a settled Done.completed episode). For diagnostics: distinguishes this from a user-initiated turn-started.


{ at: number; type: "turn-inactive-reconciled"; }

ReconcileTurnActive demoted a stuck Streaming phase to Idle: the backend reported the turn over while the frontend never saw session_end. For telemetry; the phase change is the real effect.


{ tokens: number; type: "context-reconciled-at-mount"; }

ReconcileContextFromHistory seeded context from the restored transcript’s last main-agent call at mount. Surfaced for diagnostics only.


{ model: string | null; reason: string; source: ContextSource; tokens: number; type: "context-reading-rejected"; window: number | null; }

A reading that can’t be true (more tokens than its window, or than any known window with none) was refused or will not display. Logged by the pane store; the meter shows nothing rather than a wrong number. See context-reading.ts implausibleReason.


{ model: string; reported: number; tokens: number; type: "context-window-refuted"; window: number; }

An accepted prompt was larger than the window Claude Code reported for its model, so the reported window can’t be right; the meter uses the next known tier above the prompt. Logged once per model by the pane store (context-reading.ts refutedReportedWindow).


{ outcome: TurnOutcome; statsMerged: boolean; stoppingCleared: boolean; type: "turn-ended"; }

outcome: TurnOutcome

statsMerged: boolean

stoppingCleared: boolean

type: "turn-ended"

A turn finished and the phase became Done. Carries outcome directly so consumers (notification sounds, telemetry) needn’t snapshot the slot (SPEC_SOUND_NOTIFICATIONS_2026_06_05.md §3.2).


{ type: "turn-reset"; }


{ type: "turn-start-failed"; }


{ reason: string; type: "turn-start-suppressed"; }

reason: string

type: "turn-start-suppressed"

Invariant fire: TurnStart while streaming inactive OR initPhase.kind === “InitPending” — dropped.


{ name: string; type: "tool-started"; }


{ type: "tool-ended"; }


{ input: number | null; output: number | null; type: "tokens-updated"; }


{ boundaryUuid?: string | null; durationMs?: number; frameTimestamp?: string | null; source: "real" | "heuristic"; tokensAfter: number; tokensBefore: number; trigger?: "manual" | "auto"; type: "context-compacted"; }

source: "real": an authoritative CompactionBoundary event (trigger / durationMs present). source: "heuristic": inferred from a ≥50% drop in TokensIn (both absent).

optional boundaryUuid?: string | null

source: "real" only — see CompactionBoundary command’s doc comment.

optional durationMs?: number

optional frameTimestamp?: string | null

source: "real" only — see CompactionBoundary command’s doc comment.

source: "real" | "heuristic"

tokensAfter: number

tokensBefore: number

optional trigger?: "manual" | "auto"

type: "context-compacted"


{ trigger: "manual" | "auto"; type: "compaction-started"; }

CompactionStarted landed — compaction is in progress.


{ trigger: "manual" | "auto"; type: "compaction-started-buffered"; }

CompactionStarted arrived before turnPhase was confirmed working — buffered onto state.pendingCompactionPing rather than dropped. See SPEC_COMPACTION_STARTED_RECONCILIATION_RACE_2026_09_02.md.


{ reason: "rate_limited"; type: "provider-waiting"; }


{ code: AgentFailure["code"]; turnWasEnded: boolean; type: "failure-observed"; }

A failure was observed and recorded on state.failure. turnWasEnded is true iff the turn was actually working at the time (for diagnostics: a genuine mid-turn failure vs a stray late event after idle).


{ reason?: FailureClearReason; type: "failure-cleared"; }

state.failure was cleared (explicit dismiss, or implicitly by TurnStart).


{ at: number; type: "stop-requested"; }


{ type: "stop-failed"; }


{ deadlineMs: number; type: "schedule-interrupt-timeout"; }

Reducer signal: a turn has just entered Interrupting. The dispatch layer starts the INTERRUPT_TIMEOUT_MS timer and fires InterruptTimeoutElapsed on expiry, gated by a shared cancel flag so a later RequestStop doesn’t double-fire. deadlineMs is at + INTERRUPT_TIMEOUT_MS.


{ at: number; type: "interrupt-timed-out"; }

Reducer signal: the bounded Interrupting → Done.{interrupted} force-transition fired because no graceful ack arrived within INTERRUPT_TIMEOUT_MS. The view can surface this as “interrupt timed out — assuming dead” if needed. Spec §8.


{ deadlineMs: number; type: "schedule-submit-timeout"; }

Reducer signal: a turn has just entered Submitting. The dispatch layer starts the SUBMIT_TIMEOUT_MS timer and fires SubmitTimeoutElapsed on expiry, gated by a shared cancel flag so a promotion to Streaming cancels it first. deadlineMs is at + SUBMIT_TIMEOUT_MS.


{ at: number; type: "submit-timed-out"; }

Reducer signal: the bounded Submitting → Done.{errored} force transition fired because no stream activity arrived within SUBMIT_TIMEOUT_MS. Carries the firing wall-clock for audit (spec §8, #728 gap 2).


{ id: string; type: "pending-flush-started"; }


{ ahead: number; id: string; type: "pending-waiting"; }


{ id: string; type: "pending-queued"; }


{ id: string; type: "pending-accepted"; wasPresent: boolean; }


{ id: string; type: "pending-rejected"; wasPresent: boolean; }


{ ageMs: number; id: string; queuedAt: number; type: "pending-expired"; wasPresent: boolean; }

ageMs: number

id: string

queuedAt: number

type: "pending-expired"

Pending entry expired and was removed; queuedAt for log/audit.

wasPresent: boolean


{ question?: string; questionCount?: number; type: "waiting-for-input"; }

Emitted when the pane enters the waiting-for-input state (turn completed with a question, composer empty); the sound service starts the looping ambient tone on it (SPEC_AGENT_WAITING_AMBIENT_SOUND_2026_06_19.md §6.3).

optional question?: string

Text of the first pending question, when known. Consumed by the OS notification bridge, which forwards it to the srv router for redaction (SPEC_OS_NOTIFICATIONS_SYSTEM_2026_09_24.md §9.2).

optional questionCount?: number

How many questions the pending call asks — the toast adds ” (+N more)” when it’s more than one.

type: "waiting-for-input"


{ reason: "submitted" | "typing" | "closed"; type: "waiting-ended"; }

Emitted when the waiting state ends — user submitted or started typing, pane closed, or the 5-minute safety cutoff fired.


{ at: number; type: "attached-task-observed"; }

AttachedTaskObserved set state.attachedTask (0→1 edge).


{ type: "attached-task-cleared"; }

AttachedTaskCleared cleared state.attachedTask (1→0 edge).


{ at: number; type: "registry-attached-task-observed"; }

RegistryAttachedTaskObserved set state.registryAttachedTaskSince.


{ type: "registry-attached-task-cleared"; }

RegistryAttachedTaskCleared cleared state.registryAttachedTaskSince.


{ at: number; type: "resume-retry-started"; }

ResumeRetryStarted set state.reconnecting (0→1 edge).


{ type: "resume-retry-resolved"; }

ResumeRetryResolved cleared state.reconnecting (1→0 edge).