feat(tui): show session workspace (cwd) in the status bar

SessionWorkspaceBoundEvent already recorded the bound workspace root but
it was never surfaced. Map it to a new session.workspace_bound frame
(sealed ServerMessage variant, auto-registered; re-emitted on reconnect
via the snapshot replay), carry it on Session.WorkspaceRoot, and show it
home-abbreviated in the status bar (⌂ ~/Programs/correx). Golden test
pins the decode.
This commit is contained in:
2026-06-03 01:56:46 +04:00
parent 00b08660bd
commit 5721ed21bb
8 changed files with 82 additions and 33 deletions
@@ -12,6 +12,7 @@ import com.correx.core.events.events.ArtifactCreatedEvent
import com.correx.core.events.events.ChatSessionStartedEvent
import com.correx.core.events.events.ChatTurnEvent
import com.correx.core.events.events.InferenceCompletedEvent
import com.correx.core.events.events.SessionWorkspaceBoundEvent
import com.correx.core.events.events.WorkflowStartedEvent
import com.correx.core.events.events.InferenceStartedEvent
import com.correx.core.events.events.InferenceTimeoutEvent
@@ -69,6 +70,13 @@ suspend fun domainEventToServerMessage(
sessionSequence = sessionSequence,
)
is SessionWorkspaceBoundEvent -> ServerMessage.SessionWorkspaceBound(
sessionId = p.sessionId,
workspaceRoot = p.workspaceRoot,
sequence = seq,
sessionSequence = sessionSequence,
)
is ChatTurnEvent -> ServerMessage.ChatTurn(
sessionId = p.sessionId,
turnId = p.turnId,
@@ -46,6 +46,16 @@ sealed interface ServerMessage {
override val sessionSequence: Long,
) : ServerMessage, SessionMessage
/** The workspace root a session was bound to, from SessionWorkspaceBoundEvent — shown as cwd. */
@Serializable
@SerialName("session.workspace_bound")
data class SessionWorkspaceBound(
val sessionId: SessionId,
val workspaceRoot: String,
override val sequence: Long,
override val sessionSequence: Long,
) : ServerMessage, SessionMessage
/**
* Event-derived conversation turn (USER or ROUTER), from ChatTurnEvent. The client
* rebuilds the chat transcript from these, ordered by [sessionSequence].