Skip to content

Interface: AgentPaneState

agentmux


agentmux / agent-pane-state-store / AgentPaneState

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

The reducer’s state. Each field maps 1:1 to a Solid signal the agent pane projects from; the reducer enforces invariants ACROSS fields (e.g. no turn enters Submitting/Streaming while the stream is unsubscribed: the TurnStart arm). state.turnPhase.kind is the sole working-state encoding; “is the stream subscribed?” is state.lastEventMs !== null (cleared atomically with the stream on StreamSubscribe/StreamUnsubscribe).

activity: ActivityState

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

What the agent is doing right now (see ActivityState).


attachedTask: AttachedTaskState

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

Live “attached long-running task” state, or null (AttachedTaskState). Deliberately NOT cleared by any TurnPhase transition: a task attached in one turn can outlive it, so only AttachedTaskObserved/AttachedTaskCleared touch it.


compacting: CompactionState

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

Live “compaction in progress” state, or null. See CompactionState.


context: ContextReading

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

The context meter’s reading: tokens, the model’s window and where each came from (context-reading.ts). Set by TokensIn and, only while contextSeedable, by ReconcileContextFromHistory. Unlike turnTokens it is NOT cleared at TurnEnd; it is cleared on TurnReset, ContextInvalidated and CompactionBoundary. Displays read it through plausibleReading, never directly.


contextSeedable: boolean

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

True until something more current than the restored transcript has spoken: a live reading, an invalidation, a compaction or a reset. ReconcileContextFromHistory seeds only while it holds — context being null can’t tell “nothing yet” from “invalidated while history was still loading”, and seeding the latter restores a dead conversation.


currentTool: string

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


currentToolArg: string

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

First significant argument of the active tool (file path, command, etc.). Cleared alongside currentTool on ToolEnd / TurnEnd / TurnReset.


detailsOpen: boolean

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

Whether the composer details panel (the Shell drawer with the interactive terminal) is open. Default false, per session, reset on pane unmount, not persisted. It must NOT auto-collapse on TurnStart: the live shell (AgentShellSubblock) has to survive sending more messages.


failure: PaneFailure

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

Active classified failure for this pane, or null. Set by FailureObserved (which also force-ends a working turn), cleared by FailureCleared or implicitly by the next TurnStart (a fresh turn ends the failure episode). See PaneFailure.


initPhase: InitPhase

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

Init phase: InitPending until history fetch resolves or fails; the failure reason lives in InitFailed’s payload (no separate initError).


lastCompactionBoundaryAt: number

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

Ms of the most recent REAL CompactionBoundary event. The TokensIn ≥50%-drop heuristic checks it before firing its own synthetic context-compacted, so a session that just got a real boundary gets no duplicate. Providers without a structured signal never set it.


lastContextModel: string

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

Resolved model id of the main agent’s latest reply (message.model). The Runtime menu shows it; the context reading is measured on it.


lastEventMs: number

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

Ms of the last observable stream activity (subscribe, flush, tool, tokens); drives the stuck-stream watchdog. Also the “is the stream subscribed?” gate: lastEventMs !== null ⇔ a StreamSubscribe that no later StreamUnsubscribe has cleared.


learnedContextWindows: ContextWindowMap

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

Context windows proven per model by an accepted prompt larger than the window we had (context-reading.ts learnedWindowsAfter). Outlive TurnReset for the same reason as reportedContextWindows.


pending: PendingMessage[]

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


pendingCompactionPing: object

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

A compaction_started ping rejected because turnPhase wasn’t (yet) working, which a later authoritative signal can still promote for THIS turn (ReconcileTurnActive(active: true) or StreamFlushObserved’s promotion arm). Cleared on that promotion, when a signal proves the turn isn’t running, by a fresh unrelated TurnStart, or by any terminal transition that clears compacting.

startedAt: number

trigger: "manual" | "auto"


pendingCompactTurn: boolean

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

True for a turn started to send a manual “/compact”: set on TurnStart when command.content === "/compact", consumed by CompactionBoundary. A manual boundary’s trigger alone is NOT a safe signal that this pane’s turn is the synthetic one (the events have no ordering guarantee against the NDJSON stream) (#2659).


reconnecting: ResumeRetryState

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

Live “reconnecting after a stale --resume session id” state, or null — see ResumeRetryState. Owned exclusively by ResumeRetryStarted/ResumeRetryResolved, dispatched from useResumeRetryStream.ts.


registryAttachedTaskSince: number

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

Earliest started_at_ms among this block’s Running db_background_tasks rows, or null: a separate floor signal from attachedTask (the durable registry can know a task the live transcript doesn’t). Owned EXCLUSIVELY by RegistryAttachedTaskObserved/Cleared (dispatched only from useBackgroundTaskRegistry.ts); the transcript-derived attachedTask effect (agent-view.tsx) only READS it and combines both, earliest start winning (#2685).


reportedContextWindows: ReportedContextWindows

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

Context windows Claude Code reported in result.modelUsage, per model id. They outrank the model-name table for any reading on that model, and outlive TurnReset: a model’s window is a fact about the model.


sessionStats: SessionStats

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


sessionTotals: SessionStats

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

Cumulative cost/tokens/duration across every completed turn in this pane’s lifetime: unlike sessionStats (replaced on each TurnEnd) it sums into the previous value. Feeds the composer-strip “totals” display; cleared only on TurnReset (SPEC_AGENT_SESSION_COST_TOTALS_2026_07_02.md).


streaming: StreamingState

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


turnCarry: TurnCarry

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

Each pass’s own figures (its TurnEnd stats), summed over the turn srv reported it in; the Worked line reports from this for providers whose passes srv doesn’t count (ACP, App Server, one-shot subprocess).


turnLedger: TurnLedger

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

The turn as the user sees it over however many CLI passes: srv’s agentturn event, verbatim (turn-ledger.ts); null until srv has published one. turnPhase and turnTokens stay per pass.


turnPhase: TurnPhase

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

Single-source-of-truth turn phase; consumers use isWorking(state) / isDisconnected(state) / state.turnPhase.kind.


turnTokens: TurnTokens

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

The current turn’s live usage: set by TokensIn; cleared by that turn’s TurnEnd, by StreamSessionStarted (the process died before a result) and by hard ends (disconnect, failure, timeouts, reset). Nothing else clears it on a normal turn end: srv sends the turn-ended push before the result line, so session_end (and sometimes earlier calls) still follow, and a queued turn can start in that gap.