feat(events): idea capture/discard events

IdeaCapturedEvent(ideaId, sessionId, text, timestampMs) + IdeaDiscardedEvent
(ideaId, sessionId) tombstone, registered in eventModule. The cross-session idea
board is rebuilt from these via eventStore.allEvents(); discard hides without
deleting (invariant #1).
This commit is contained in:
2026-06-14 14:21:40 +04:00
parent b563d9841d
commit 3ac0a140ec
2 changed files with 37 additions and 0 deletions
@@ -0,0 +1,33 @@
package com.correx.core.events.events
import com.correx.core.events.types.SessionId
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
/**
* An idea the operator surfaced while rubber-ducking with the router, captured to a cross-session
* scratchpad. Recorded as a fact (invariant #1) so the board is rebuilt from the log via
* `eventStore.allEvents()`. Non-authoritative: an idea informs the router's context but never drives
* the kernel — it is a note, not a decision.
*/
@Serializable
@SerialName("IdeaCaptured")
data class IdeaCapturedEvent(
val ideaId: String,
val sessionId: SessionId,
val text: String,
val timestampMs: Long,
) : EventPayload
/**
* The operator removed an idea from the board. The event log is append-only (invariant #1), so this
* is a tombstone — the original [IdeaCapturedEvent] stays in the log (and replays), but the idea-board
* projection filters out any [ideaId] that has a discard. [sessionId] is wherever the discard was
* issued (often a different session than the capture).
*/
@Serializable
@SerialName("IdeaDiscarded")
data class IdeaDiscardedEvent(
val ideaId: String,
val sessionId: SessionId,
) : EventPayload
@@ -23,6 +23,8 @@ import com.correx.core.events.events.ExecutionPlanLockedEvent
import com.correx.core.events.events.ExecutionPlanRejectedEvent
import com.correx.core.events.events.HealthDegradedEvent
import com.correx.core.events.events.HealthRestoredEvent
import com.correx.core.events.events.IdeaCapturedEvent
import com.correx.core.events.events.IdeaDiscardedEvent
import com.correx.core.events.events.JournalCompactedEvent
import com.correx.core.events.events.FileWrittenEvent
import com.correx.core.events.events.L3MemoryRetrievedEvent
@@ -123,6 +125,8 @@ val eventModule = SerializersModule {
subclass(ClarificationRequestedEvent::class)
subclass(ClarificationAnsweredEvent::class)
subclass(WorkflowProposedEvent::class)
subclass(IdeaCapturedEvent::class)
subclass(IdeaDiscardedEvent::class)
}
}