Commit Graph

221 Commits

Author SHA1 Message Date
kami 6770e3bf0a fix(tui): Enter on selected session now enters session view
KeyResolver was swallowing Enter in IDLE state when input text was blank,
so SubmitInput never reached RootReducer to set sessionEntered=true.
Now Enter always dispatches SubmitInput in IDLE — RootReducer handles
blank text by entering the selected session, non-blank by starting a
new session (as before). IN_SESSION and FILTER mode unchanged (blank
Enter still returns null there).
2026-05-26 13:13:57 +04:00
kami c142f146d4 fix(approval): resolve requestId→sessionId lookup in global socket handler
Fix the remaining TODO from 2e3b8e5: replace the TypeId(requestId.value) hack
with a proper requestId→sessionId mapping stored in ApprovalCoordinator and
populated when onApprovalRequested fires from the event store subscription.

Changes across the full bugfix batch (all 9 bugs from TUI rework):
- Bug 1: ApprovalCoordinator broadcasts non-null toolName/preview
- Bug 2: ApprovalDto carries toolName/preview for late-connected clients
- Bug 3: SessionEventBridge.replaySnapshot() preserves toolName/preview
- Bug 4: TUI SessionsReducer processes enriched ApprovalDto fields
- Bug 5: DomainEventMapper passes sessionSequence; GlobalStreamHandler
  tracks per-session counters so live events aren't dropped
- Bug 6: KeyResolver restores Ctrl+L/E/C/N bindings
- Bug 7: SessionSnapshot carries workflowId for display names
- Bug 8: ↑↓ navigates selection only; Enter/sessionEntered gates IN_SESSION
- Bug 9: EventHistoryStrip capped at 4 lines to prevent overflow
- Bonus: ApprovalCoordinator.lookupSession() with proper requestId→sessionId mapping
2026-05-26 13:09:10 +04:00
kami f6ef028883 feat(tui): session display model with DisplayState, input history nav, and StageToolManifest
Restructure the TUI around a DisplayState enum (IDLE, IN_SESSION, APPROVAL) replacing
the previous InputMode-based navigation (NAVIGATE, STEER removed). Key changes:

- **DisplayState model**: New `DisplayState` enum governs per-mode key resolution and UI
  rendering. Removes `ROUTER`/`NAVIGATE`/`STEER`/`FILTER` InputMode complexity.
- **Input history navigation**: Up/Down arrows in IN_SESSION cycle through per-session
  input history (ARCH-HISTORY-2/3). `savedInputBuffer` preserves in-flight text.
- **Input history filter**: `Tab` toggles between ROUTER and FILTER modes; history nav
  disabled while filtering.
- **Ctrl-C → Cancel**: Rebind Ctrl-C from Quit to Cancel across all states.
- **Approval flow**: `ApproveActive`/`RejectActive` moved from SessionsReducer to
  RootReducer via `pendingDecision`/`SubmitApprovalDecision`. Approval overlay
  replaced by `ApprovalSurface` component.
- **Event history strip**: Replaces old overlay with a persistent `EventHistoryStrip`
  component, toggled via Ctrl-E.
- **Background update badge**: New `backgroundUpdateCount` on SessionsState tracks
  events arriving for non-selected sessions (ARCH-BADGE-1).
- **StageToolManifest**: New `ServerMessage.StageToolManifest` and `ToolManifestEntry`
  model for pre-declared tool shapes per stage (RF-3).
- **Cleanup**: Removed `ActiveSession`, `ApprovalPanel`, `ToolsPanel` components.
  Removed `InputMode.NAVIGATE`, `InputMode.STEER`, approval overlay state fields.
  Various reducer simplifications (no more overlaid effects for approval responses).
2026-05-26 01:46:14 +04:00
kami 2e3b8e599c chore(approval): TODO markers for overlay UX and requestId→sessionId lookup
Two follow-ups for the approval refactor:
- InputReducer STEER input mode hardcodes APPROVE; needs the future
  approve/reject overlay UX to let the user pick.
- GlobalStreamHandler derives scopeSessionId from requestId as a
  placeholder; needs a real requestId → sessionId lookup once exposed.
2026-05-25 19:56:07 +04:00
kami 5abf7d1253 refactor(approval): wire ApprovalCoordinator end-to-end
ApprovalCoordinator (added in epic-13) was never instantiated. Its four
capabilities — multi-client fan-out, single-resolver dedupe, request
timeout, and a unified domain mapper — were duplicated piecemeal across
GlobalStreamHandler and SessionStreamHandler, with a STEER-outcome
divergence between them (coordinator mapped STEER → APPROVED while
GlobalStreamHandler mapped STEER → REJECTED). This refactor wires the
coordinator and removes the duplication.

Protocol: drop ApprovalDecision.STEER. STEER is no longer a discriminator;
it's expressed as (APPROVE | REJECT) + non-null steeringNote, so the user
can steer alongside either choice. TUI's current single-keybind STEER
input flow now sends APPROVE + note (matching the original epic-13
intent); a future overlay UX will let the user pick APPROVE or REJECT
explicitly.

Mapper: ClientMessage.ApprovalResponse → DomainApprovalDecision lives in
a single shared `toDomain` helper (apps/server/approval/
ApprovalResponseMapper.kt). Both stream handlers and the coordinator
use it.

Config: delete the duplicate apps/server/approval/ApprovalConfig.kt;
ApprovalCoordinator now takes core.config.ApprovalConfig (already had
timeoutMs=300_000L). ConfigLoader already populates it.

Wiring:
- ServerModule owns a SupervisorJob-backed moduleScope, constructs
  ApprovalCoordinator, and on start() subscribes eventStore.subscribeAll()
  to route ApprovalRequestedEvent payloads to onApprovalRequested.
- GlobalStreamHandler delegates ApprovalResponse to
  approvalCoordinator.handleResponse and registers/unregisters via the
  new registerGlobalClient/unregisterGlobalClient (global sockets aren't
  bound to one SessionId, so broadcasts union session and global sets).
- SessionStreamHandler delegates ApprovalResponse and registers per-session
  via registerClient/unregisterClient.
- Timeout is on by default at 5 minutes via config.timeoutMs.

Tests: ApprovalCoordinatorWiringTest covers delegate path, dedupe
producing ProtocolError, and event-stream subscription routing.
2026-05-25 19:02:51 +04:00
kami 09f47bf8e3 fix(cleanup-04): wire ApproveActive/RejectActive and clear pendingApproval atomically
The cleanup-04 spec's write side was missing: Action.ApproveActive and
Action.RejectActive were dispatched by KeyResolver but had no reducer
branch, making the approve/reject keybindings silent no-ops. STEER
SubmitInput emitted an ApprovalResponse effect without clearing
`pendingApproval` on the selected session, violating the spec invariant
that the effect emission and the clear happen in the same tick.

SessionsReducer now handles both actions via a private
respondToSelectedApproval(sessions, decision, note) helper that reads
state.selectedPendingApproval(), clears the field, and emits
Effect.SendWs(ApprovalResponse(...)). InputReducer's STEER SubmitInput
branch clears `pendingApproval` on the selected session in the same
returned TuiState as the response effect.

Adds four tests covering APPROVE, REJECT, no-pending no-op, and
STEER atomicity.
2026-05-25 17:18:10 +04:00
kami c8a599c64f fix(tui-02): route ApprovalResponse through global socket
Complete the tui-02 spec acceptance criteria: delete the orphan
`connectSession`, `disconnectSession`, `sessionStreamJob`, and
`sessionWsSession` members from TuiWsClient, and remove the `send()`
fallback that previously routed ApprovalResponse over a per-session
socket. All ClientMessage types now travel the single global socket.

Server side: GlobalStreamHandler.handleClientMessage now actually
handles ApprovalResponse (was returning a protocol error), converting
to a domain ApprovalDecision and dispatching to the orchestrator —
mirrors SessionStreamHandler's prior logic.

Adds ApprovalResponseGlobalSocketRoundTripTest covering APPROVE and
STEER encode/decode through ProtocolSerializer.
2026-05-25 17:18:01 +04:00
kami 8f20f6aa24 fix(server-05): synchronize subscription before snapshot read
Close the narrow race where `streamGlobal` launched the subscribeAll
collector and immediately read `lastGlobalSequence()` — events appended
in that window were dropped by the replay=0 SharedFlow before the
collector actually subscribed. Now use a CompletableDeferred barrier
signaled via `onSubscription` (SharedFlow) or `onStart` (cold fallback),
awaited before `bridge.replaySnapshot()`.

Closes the remaining gap on finding #1 from
docs/specs/2026-05-24-review-fixes.
2026-05-25 17:17:32 +04:00
kami cdc03b8809 feat(effects-02): route Action.Quit through sub-reducers; Effect.Quit last
Effect.Quit is appended at the tail of the effect list rather than
prepended, so all sub-reducer cleanup effects dispatch before runner
teardown. Combined with the sequential dispatch from effects-01, list
position is a runtime guarantee.

Closes finding #9.
2026-05-25 16:58:33 +04:00
kami 5effe287d4 feat(effects-01): sequential effect dispatch in TuiApp
Replace per-effect launch with a single launch that iterates effects
sequentially via dispatchAll, closing the ordering race (I-E1 invariant).
Add EffectDispatchOrderTest proving sequential preserves order while
fire-and-forget does not.
2026-05-25 16:49:10 +04:00
kami 9ff58b36ad refactor(cleanup-05): remove flat approval/status fields from SessionSnapshot 2026-05-25 16:30:21 +04:00
kami 9dcf6f4c04 refactor(tui): extract selectedPendingApproval() extension and unify call sites
Add TuiState.selectedPendingApproval() extension and replace the three
inline session-lookup expressions in InputReducer and RouterPanel with it.
2026-05-25 16:26:03 +04:00
kami 7d4468f292 refactor(cleanup-03): delete ApprovalReducer and simplify RootReducer
Remove the approvalAction/NoOp wrong-scope filter and the ApprovalReducer
call site from RootReducer. approvalJustArrived is now derived from the
selected session's pendingApproval delta. Delete ApprovalReducer.kt,
ApprovalState.kt, and ApprovalReducerTest.kt; approval truth is
structurally owned by SessionSummary.
2026-05-25 16:18:12 +04:00
kami 1c67993f5d refactor(cleanup-02): move ApprovalRequired write-side into SessionsReducer
SessionsReducer now handles ServerMessage.ApprovalRequired and populates
SessionSummary.pendingApproval directly on the matched session. The
SessionSnapshot handler also propagates approval fields to pendingApproval.
ApprovalReducer's ServerEventReceived branch is removed; approval truth is
now strictly scoped to a single SessionSummary.
2026-05-25 14:52:26 +04:00
kami d2c6789c4d refactor(cleanup-01): move approval truth to SessionSummary.pendingApproval
Add pendingApproval: ApprovalInfo? = null to SessionSummary and remove
the global approval: ApprovalState slot from TuiState. All production
code derives active approval from the selected session; RootReducer
bridges ApprovalState in/out of the selected session for the duration
of the existing ApprovalReducer (removed in Cleanup 03).
2026-05-25 14:24:20 +04:00
kami cba0314197 refactor(tui-04): remove ConnectSession and DisconnectSession from Effect hierarchy 2026-05-25 12:39:50 +04:00
kami 8b8f9c9379 test(tui-04): assert single-consumer contract for ws.messages and ws.connection 2026-05-25 12:33:49 +04:00
kami de069dbf6a refactor(tui-03): remove ConnectSession from SessionStarted, keep on SessionSnapshot
SessionSnapshot is the correct trigger for connectSession() — the client
has enough state to stream live events at that point. SessionStarted fires
pre-snapshot and no longer needs to emit ConnectSession.
2026-05-25 12:25:58 +04:00
kami d6df38418a test(tui-03): verify Disconnected resets snapshot state and reaches ConnectionReducer 2026-05-25 12:25:58 +04:00
kami 919546f23b test(tui-03): add gap detection test for SnapshotPhaseReducer 2026-05-25 12:25:51 +04:00
kami e5df09ef93 feat(tui-03): wire SnapshotPhaseReducer into RootReducer with replay and cursor tracking
SnapshotComplete now flips snapshotPhase, replays buffered events through
SnapshotPhaseReducer for dedup/cursor updates, then through sub-reducers.
2026-05-25 12:25:41 +04:00
kami d841e1c4b2 feat(tui-03): add SnapshotPhaseReducer with buffering and dedup logic
Buffers live events during snapshot phase, drains on SnapshotComplete,
deduplicates live events by per-session cursor, and resets on disconnect.
2026-05-25 11:32:03 +04:00
kami b50d5fc6ee chore(gitignore): add log files to gitignore. 2026-05-25 01:08:36 +04:00
kami d0e3550025 feat(tui-02): complete Channel(UNLIMITED) migration for _connection field in TuiWsClient
Migrate _connection from MutableSharedFlow + tryEmit to Channel(UNLIMITED) + send to ensure no connection events are dropped under high load. Removes unused MutableSharedFlow and asSharedFlow imports. Changes public connection property type from SharedFlow to Flow for consistency with messages field.

- Replace MutableSharedFlow with Channel(UNLIMITED) for _connection
- Convert all _connection.tryEmit() calls to _connection.send()
- Update public connection property to use receiveAsFlow()
- Add TuiWsClientConnectionChannelTest with 10k event no-drop verification
2026-05-25 01:08:35 +04:00
kami 2e11b7c0d0 feat(tui-02): replace SharedFlow + tryEmit with Channel(UNLIMITED) in TuiWsClient to eliminate silent message drops
Replace MutableSharedFlow + tryEmit pattern in _messages field with Channel(UNLIMITED) + receiveAsFlow() to guarantee no message loss under high throughput. The extraBufferCapacity-based SharedFlow silently dropped messages when subscribers were slow; Channel(UNLIMITED) provides deterministic FIFO behavior with no drops.

Updated public messages property type from SharedFlow to Flow for compatibility.
Changed both message emission sites (connect() and connectSession()) from tryEmit() to send().
Added TuiWsClientChannelTest with 10k message no-drop verification.

Acceptance criteria:
- Channel(UNLIMITED) used for _messages instead of SharedFlow
- receiveAsFlow() converts channel to Flow
- send() replaces tryEmit() for message emission
- connectSession/disconnectSession/sessionStreamJob/sessionWsSession intact
- 10k message test verifies no-drop guarantee
2026-05-25 01:02:18 +04:00
kami 78379d244f feat(tui-01): add snapshot phase, pending events, and cursor tracking to TuiState
Add three new fields to support the snapshot/live streaming protocol phase:
- snapshotPhase: Boolean (true during initial snapshot)
- pendingEvents: List<ServerMessage> (FIFO buffer during snapshot)
- cursors: Map<String, Long> (per-session high-water marks for deduplication)

All fields include KDoc documenting their invariants and purpose. Additive
change only; all existing tests continue to pass.
2026-05-25 00:31:49 +04:00
kami 1f742c0dfd feat(server-05): replace snapshot-then-subscribe with buffer-then-drain in GlobalStreamHandler
Establishes subscribeAll() before replaySnapshot() so no event can slip between the
projection read and live forwarding. Removes liveStreamJobs map and per-session forwarder
spawn from handleStartSession; all live forwarding flows through the single global
subscription. Closes findings #1 (race) and #5 (truth sources).

Tests cover happy path, race (x100), empty sessions, and shutdown/leak cases.
2026-05-25 00:19:22 +04:00
kami 850c6df743 fix(build): resolve three failing tests across integration and tui modules
SessionOrchestratorIntegrationTest: wire approvalRepository into
OrchestratorRepositories constructor which gained the field in the kernel
refactor. TambouiKeyMapperTest: correct ctrl-h to alt-h — the mapper has
always placed ToggleApprovalOverlay under the Alt branch, not Ctrl.
SessionOrchestrator.emit: replace substring(0,7) with take(7) to avoid
StringIndexOutOfBoundsException when session IDs are shorter than 7 chars.
2026-05-24 23:11:17 +04:00
kami 14141f2f72 feat(server-04): fix snapshot cursor order, deterministic approvals, unconditional SnapshotComplete
Capture lastGlobalSequence() before any projection read to anchor the
buffer-drain window; capture lastSequence(sessionId) before each session's
projection read. SessionSnapshot.lastSequence now carries the global cursor
shared across all sessions in the batch. pendingApprovals populated from
filtered approval state and sorted by (timestamp, requestId) for deterministic
ordering. SnapshotComplete emitted unconditionally including the zero-sessions
case. Four new tests: zero-sessions, SnapshotComplete-last ordering, global
cursor isolation, and per-session cursor value.
2026-05-24 23:01:21 +04:00
kami ac05ad8733 chore(clean up): remove unused imports, unnecessary object impls, concurrency/coroutine issues, trailing commas, etc. 2026-05-24 22:56:19 +04:00
kami 71aac8afc9 feat(server-03): log unmapped events at DEBUG in DomainEventMapper
Adds a file-private SLF4J logger and replaces the silent else->null branch
with a debug log line that names the payload type, sessionId, and sequence.
Test extended with a log-capture case that verifies exactly one DEBUG event
is emitted containing the payload class name for unrecognised event types.
2026-05-24 22:36:59 +04:00
kami 70420083ac feat(server-02): promote EventStore to global-sequence store with subscribeAll
StoredEvent gains sessionSequence: Long (per-session monotonic); existing
sequence field becomes the global monotonic cursor across the entire store.
SqliteEventStore allocates both counters inside the same BEGIN IMMEDIATE
transaction and emits to a global MutableSharedFlow after commit.
InMemoryEventStore mirrors this with an AtomicLong global counter and a
suspend-on-overflow SharedFlow. EventStore interface gains subscribeAll()
and lastGlobalSequence(). Contract tests updated and extended to cover
global-sequence and cross-session subscribeAll invariants.
2026-05-24 22:23:43 +04:00
kami 0cfb784187 feat(server-01): extend wire protocol with sequence cursors and SnapshotComplete
Every event-derived ServerMessage gains sequence (global) and sessionSequence
(per-session) cursor fields. SessionSnapshot adds lastSequence and
lastSessionSequence at projection-read time. SnapshotComplete data object
terminates the snapshot phase and is registered in the polymorphic module.
replaySnapshot() now emits SnapshotComplete after all SessionSnapshot messages.
SessionStarted audit deferred with TODO comment. DomainEventMapper propagates
both cursors to all mapped messages including InferenceCompleted.
2026-05-24 22:23:35 +04:00
kami fc7b879891 feature(event-sourcing): baseline for the architecture review fixes.
- fixed the tool overlay in tui.
- fixed tool calling - added schemas.
- getting all sessionIds via event store.
- instead of sending all events on the replay - there's a new way for replaying.
- session snapshot is now a thing getting sent for previously created sessions.
- added logging to important parts.
- revert workflowId from WorkflowCompletedEvent.
2026-05-24 18:57:56 +04:00
kami f827685ed0 chore(damn): detekt, build, tests, formatting
fixed detekt issues where possible.
fixed disttar failing build because tools is added twice in the server module.
added workflowId where required.
fixed some tests not being recognized because of runBlocking without explicit return type.
formatting + imports.
2026-05-22 00:10:05 +04:00
kami 2c459da009 feat(router): implement Epic 14 — core:router module
Implements the full conversational router facade: RouterState, RouterReducer,
RouterProjector, RouterRepository, RouterContextBuilder, RouterFacade, protocol
types, WebSocket wiring, infrastructure factory, and deterministic test suite.

Also fixes spec divergences found in post-implementation review:
- Add SteeringNote domain object to core:context (epic prerequisite)
- Rename RouterFacade.handleChat → onUserInput per spec interface contract
- Add in-memory ConcurrentHashMap conversation history to DefaultRouterFacade
- Make RouterRepository.getRouterState suspend
- Rename RouterConfig.keepLast → conversationKeepLast, fix defaults (6, 4096)
- Refactor InfrastructureModule.createRouterFacade to self-assemble internally
- Fix FileReadTool: allowedPaths was dead constructor param (@SuppressUnusedParameter);
  now stored as private val and enforced in validateRequest
- Disable koverVerify on modules tested via testing/ submodules or with
  hardware/integration dependencies (24 modules); build gate now passes clean
2026-05-21 15:06:20 +04:00
kami ac5ee9c3e0 feat(tui): redesign layout per spec v2 — 3-panel top row, 4-mode input bar, tamboui 0.3.0
- Layout: status bar (borderless), horizontal top row (sessions 30% / active 30% / tools 40%), router fill, input bar fixed
- Components: rewrote all 5 + added ToolsPanel; all accept TuiState directly
- InputBar: 4 modes (ROUTER/NAVIGATE/FILTER/STEER) with context-sensitive keybind hints
- RouterPanel: inline approval/event overlays as last-child text panels
- StatusBar: borderless row with model, providerType, session count, approval badge
- SessionList: manual column/row rendering, no list widget, overflow truncation
- tamboui bumped to 0.3.0
- TambouiKeyMapper: ctrl+key required for all keybinds, bare chars always
  go to input buffer.
- KeyResolver: Quit is ROUTER-only (not global); NavUp/NavDown handled in
  ROUTER as well as NAVIGATE; Filter in ROUTER maps to OpenFilter; CharInput
  in ROUTER returns null (semantic chars handled upstream by mapper).
2026-05-20 01:24:26 +04:00
kami a855eaee45 fix(tui): update tests to match refactored InputMode and flat TuiState
Sync all TUI reducer and input tests with the state model refactor:
InputMode.None/WorkflowId/SteeringNote/Filter → ROUTER/NAVIGATE/STEER/FILTER;
InputState(mode, text) → TuiState(inputMode, inputBuffer); fix SessionStarted
effect assertion to expect ConnectSession.
2026-05-20 00:48:14 +04:00
kami 7ac3a1ff79 feat(tui): enrich state model and refactor input mode into TuiState
Lifts inputMode/inputBuffer out of InputState into top-level TuiState,
renames InputMode variants to ROUTER/NAVIGATE/FILTER/STEER, adds
TuiToolRecord and TuiEventEntry for per-session tool/event history,
expands SessionsReducer to track tool lifecycle and recent events, and
adds ToggleApprovalOverlay/ToggleEventOverlay/EnterSteer actions.
2026-05-20 00:36:46 +04:00
kami bc755572bd fix(kernel): complete artifact lifecycle and fix transition artifact state lookup
Two issues causing "no transition condition matched":

1. emitToolArtifacts only emitted ArtifactCreatedEvent; the artifact_validated
   transition condition requires VALIDATED phase, which needs the full lifecycle
   (Created → Validating → Validated). Tool success is sufficient grounds for
   auto-validation, so emit all three events.

2. DefaultSessionOrchestrator was building stageArtifacts from LiveArtifactRepository
   which uses a hot async subscription — cache was always empty at lookup time.
   Now reads ArtifactValidatedEvents directly from the synchronous EventStore.read().
2026-05-19 15:48:32 +04:00
kami f149eff5bc fix(kernel): emit ArtifactCreatedEvent for tool-produced slots and fix verifyProduces race
LiveArtifactRepository uses a hot subscription that does not replay history,
so its cache was always empty when verifyProduces ran immediately after emit.
Fix by reading directly from EventStore (synchronous) instead of the repository.

Also emit ArtifactCreatedEvent for non-llmEmitted produces slots after stage
validation passes, and fix tool parameter decoding to use JsonPrimitive.content
so escape sequences like \n are resolved rather than passed as literal backslash-n.
2026-05-19 14:42:44 +04:00
kami 157aa1f63a chore(gitignore): add analysis components to .gitignore 2026-05-19 13:44:31 +04:00
kami 3365208d3a chore(cleanup): remove dead Module stubs and unused imports; restore deferred files
Deletes 21 Module.kt scaffolding objects that were never wired into any DI
registry. Removes unused imports across 8 production and 3 test files.

Restores StageExecutor, CyclePolicyResolver, PolicyValidation, and
ReplayContractTest — these are deferred features, not dead code.
2026-05-19 13:43:21 +04:00
kami 1c70511436 chore(cleanup): delete confirmed-dead files with no live references
Removes 6 files audited as fully unused: StageExecutor interface (shadowed
by kernel), CyclePolicyResolver and PolicyValidation (deferred cycle policy),
ApprovalRoutes (never registered), TuiNavigation (superseded by reducer),
and ReplayContractTest abstract class (no concrete subclasses).

ArtifactRelationshipType and CyclePolicy were audited but retained —
both are actively referenced by production code.
2026-05-19 12:55:27 +04:00
kami 71a73a4fa2 chore(audit): tool path resolution, config file, dead code removal, static analysis cleanup
Tool fixes:
- FileWriteTool, FileEditTool: resolve relative paths against workingDir instead of JVM cwd
- FileReadTool: remove allowedPaths restriction — reads are unrestricted
- ShellTool: add workingDir for ProcessBuilder, remove environment().clear(), fail-open when allowedExecutables empty

Config:
- Add [tools] section to config.toml: sandbox_root, working_dir, shell_allowed_executables, default_system_prompt_path
- Three-level resolution: env var > config file > hardcoded default
- OrchestrationConfig sandboxRoot and defaultSystemPromptPath now sourced from CorrexConfig
- Single defaultOrchestrationConfig in ServerModule, shared by SessionRoutes and GlobalStreamHandler

Dead code:
- Delete EventTypes.kt — orphaned string constants duplicating serialization annotations

Static analysis:
- Remove 10 unused imports across 9 files
- Remove redundant return in ReplayOrchestrator
- Remove redundant suspend from ApprovalCoordinator.handleResponse
- Fix unreachable InputMode.None branch in InputBar
- Enable full detekt rule sets in detekt.yml
2026-05-19 12:48:47 +04:00
kami c0efa0ef03 fix(kernel+infra): tool approval gate and executor cleanup
- SessionOrchestrator: wire T2/T3/T4 approval gate before tool execution;
  emit OrchestrationPausedEvent/ApprovalRequestedEvent, await decision,
  return rejection as ERROR context entry so LLM sees the denial;
  propagate tool ERROR entries as StageExecutionResult.Failure
- SandboxedToolExecutor: remove dead code and simplify
- InfrastructureModule: minor wiring cleanup
- LlamaCppInferenceProvider / build.gradle: related build fixes
2026-05-19 00:05:08 +04:00
kami f32d400138 feat(server+tui): event bridge — live streaming and historical replay
- SessionEventBridge: replaySnapshot() sends all historical events on connect;
  streamLive(sessionId) subscribes to live event flow per session
- DomainEventMapper: maps 14 domain event types to ServerMessage; reads
  InferenceCompleted response text from ArtifactStore with empty-string fallback
- GlobalStreamHandler: wires bridge on connect for replay, launches per-session
  live-stream job on StartSession, cancels all jobs on disconnect; removes
  ProtocolError("ping") heartbeat hack
- SessionStreamHandler: fixes replay to use DomainEventMapper instead of
  emitting SessionStarted for every event; injects real artifactStore;
  removes ProtocolError("ping") heartbeat; adds structured logging throughout
- Main: startup log block showing port, model config, sandbox, stores, tools,
  providers
- SessionsReducer: StageCompleted/StageFailed now clears currentStage; adds
  5 missing tests (InferenceCompleted, StageStarted, ToolCompleted, SessionPaused)
- RouterPanel: new TUI widget rendering active session's lastResponseText
- TuiWsClient: remove println that was polluting the TUI on WS connect failure
2026-05-19 00:03:53 +04:00
kami 03615dc5b9 fix(server): wire tool registry and executor into OrchestratorEngines so LLM receives tool definitions 2026-05-18 22:03:31 +04:00
kami d2518849d7 fix(apps): send workflowId not path from CLI; wire sandboxRoot and systemPromptPath in server; update prompts and fixtures 2026-05-18 21:40:17 +04:00
kami 5c3a8fda63 feat(core:kernel): tool call dispatch loop, tool definitions wiring, sandboxRoot and defaultSystemPromptPath in config 2026-05-18 21:39:50 +04:00