refactor(tui): event-loop foundation — actions, reducers, effects, Panel

Tasks 1.1–3.3 of docs/plans/2026-05-17-tui-refactor.md:

- Mosaic 0.13 → 0.18; Kotlin 2.0.21 → 2.2.10 (required by Mosaic).
  Fix MaxLineLength regressions in core/kernel orchestration logs.
- Input: drop raw System.in reader and ANSI escape parser. Wire
  Modifier.onKeyEvent at root; MosaicKeyMapper → KeyResolver → Action.
- State: split TuiState into Connection/Sessions/Input/Approval/Provider
  slices. Add InputMode.SteeringNote; delete handleSteer/System.console.
- Reducers: pure RootReducer composes slice reducers returning
  (state, List<Effect>). Effect is sealed (SendWs, Quit). Single
  dispatch(action) point in TuiApp; one coroutine drains effects.
- TuiWsClient now exposes messages/connection SharedFlows; suspend
  callbacks gone. ConnectionEvent sealed type added.
- Rendering: Panel(title){…} composable with LocalTerminalSize
  composition local; drop BOX_WIDTH and hand-padding from every
  component. Poll stty size every 500ms.
- Tests: KeyResolver (18) + 5 reducer suites (37). 55 total in :apps:tui.

Pending tasks 4.1–5.2 tracked in
docs/plans/2026-05-17-tui-refactor.progress.md.
This commit is contained in:
2026-05-17 02:57:54 +04:00
parent f77efce10b
commit b95135eb3b
42 changed files with 1512 additions and 291 deletions
+4 -4
View File
@@ -3,15 +3,15 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id 'org.jetbrains.kotlin.jvm' version '2.0.21' apply false
id 'org.jetbrains.kotlin.plugin.serialization' version '2.0.21' apply false
id 'org.jetbrains.kotlin.plugin.compose' version '2.0.21' apply false
id 'org.jetbrains.kotlin.jvm' version '2.2.10' apply false
id 'org.jetbrains.kotlin.plugin.serialization' version '2.2.10' apply false
id 'org.jetbrains.kotlin.plugin.compose' version '2.2.10' apply false
id "io.gitlab.arturbosch.detekt" version "1.23.7"
id "org.jetbrains.kotlinx.kover" version "0.8.3"
}
ext {
kotlin_version = '2.0.21'
kotlin_version = '2.2.10'
kotlinx_coroutines_version = '1.9.0'
kotlinx_serialization_version = '1.7.3'
kotlinx_datetime_version = '0.6.2'