feat(server): intent input channel — StartSession.input seeds decision journal

This commit is contained in:
2026-06-04 02:16:23 +04:00
parent 6393d578fd
commit fe561ada09
7 changed files with 63 additions and 2 deletions
@@ -0,0 +1,18 @@
package com.correx.core.events.events
import com.correx.core.events.types.SessionId
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
/**
* The freeform user request that kicked off a workflow run (e.g. "add an auth layer to the
* account service"). Recorded once at session start so it flows into the decision journal and
* is pinned into every stage's context — the input channel for intent-driven pipelines.
* Optional: fixed-task workflows (e.g. healthcheck) start without one.
*/
@Serializable
@SerialName("InitialIntent")
data class InitialIntentEvent(
val sessionId: SessionId,
val intent: String,
) : EventPayload
@@ -16,6 +16,7 @@ import com.correx.core.events.events.EventPayload
import com.correx.core.events.events.FileWrittenEvent
import com.correx.core.events.events.L3MemoryRetrievedEvent
import com.correx.core.events.events.InferenceCompletedEvent
import com.correx.core.events.events.InitialIntentEvent
import com.correx.core.events.events.InferenceFailedEvent
import com.correx.core.events.events.InferenceStartedEvent
import com.correx.core.events.events.InferenceTimeoutEvent
@@ -58,6 +59,7 @@ val eventModule = SerializersModule {
subclass(ToolCallAssessedEvent::class)
subclass(FileWrittenEvent::class)
subclass(SteeringNoteAddedEvent::class)
subclass(InitialIntentEvent::class)
subclass(StageFailedEvent::class)
subclass(StageCompletedEvent::class)
subclass(TransitionExecutedEvent::class)
@@ -2,6 +2,7 @@ package com.correx.core.journal
import com.correx.core.events.events.ApprovalDecisionResolvedEvent
import com.correx.core.events.events.ArtifactValidatedEvent
import com.correx.core.events.events.InitialIntentEvent
import com.correx.core.events.events.RetryAttemptedEvent
import com.correx.core.events.events.StageFailedEvent
import com.correx.core.events.events.SteeringNoteAddedEvent
@@ -14,6 +15,11 @@ import com.correx.core.journal.model.DecisionRecord
class DefaultDecisionJournalReducer : DecisionJournalReducer {
override fun reduce(state: DecisionJournalState, event: StoredEvent): DecisionJournalState {
val record = when (val p = event.payload) {
is InitialIntentEvent -> DecisionRecord(
sequence = event.sessionSequence,
kind = DecisionKind.INTENT,
summary = "Goal: ${p.intent}",
)
is SteeringNoteAddedEvent -> DecisionRecord(
sequence = event.sessionSequence,
kind = DecisionKind.STEERING,
@@ -2,7 +2,7 @@ package com.correx.core.journal.model
import kotlinx.serialization.Serializable
enum class DecisionKind { STEERING, APPROVAL, TRANSITION, RETRY, FAILURE, ARTIFACT }
enum class DecisionKind { INTENT, STEERING, APPROVAL, TRANSITION, RETRY, FAILURE, ARTIFACT }
/**
* One distilled decision. [sequence] is the source event's sessionSequence, used for