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.
This commit is contained in:
2026-05-24 18:50:00 +04:00
parent f827685ed0
commit fc7b879891
43 changed files with 525 additions and 211 deletions
@@ -25,7 +25,9 @@ data class ApprovalRequestedEvent(
val sessionId: SessionId,
val stageId: StageId?,
val projectId: ProjectId?,
val userSteering: UserSteering? = null
val userSteering: UserSteering? = null,
val toolName: String? = null,
val preview: String? = null,
) : EventPayload
@Serializable
@@ -37,7 +39,7 @@ data class ApprovalDecisionResolvedEvent(
val tier: Tier,
val resolutionTimestamp: Instant,
val reason: String?,
val userSteering: UserSteering? = null
val userSteering: UserSteering? = null,
) : EventPayload
@Serializable
@@ -49,10 +51,10 @@ data class ApprovalGrantCreatedEvent(
val expiresAt: Instant?,
val sessionId: SessionId,
val stageId: StageId?,
val projectId: ProjectId?
val projectId: ProjectId?,
) : EventPayload
@Serializable
data class ApprovalGrantExpiredEvent(
val grantId: GrantId
val grantId: GrantId,
) : EventPayload
@@ -18,7 +18,6 @@ data class WorkflowCompletedEvent(
val sessionId: SessionId,
val terminalStageId: StageId,
val totalStages: Int,
val workflowId: String,
) : EventPayload
@Serializable
@@ -6,6 +6,7 @@ import kotlinx.serialization.Serializable
@Serializable
data class OrchestrationState(
val workflowId: String = "",
val currentStageId: StageId? = null,
val status: OrchestrationStatus = OrchestrationStatus.IDLE,
val retryCount: Int = 0,
@@ -47,4 +47,10 @@ interface EventStore {
* Intended for batch jobs (e.g. CAS liveness scans). Implementations should stream lazily.
*/
fun allEvents(): Sequence<StoredEvent>
/**
* Return all known session ids in the store.
* Implementations should derive this from the session index, not by scanning allEvents().
*/
fun allSessionIds(): Set<SessionId>
}