feat(events,sessions): ProjectProfileBoundEvent reduced into session state

This commit is contained in:
2026-06-10 21:47:30 +04:00
parent 5eda64949f
commit 4389163c5c
7 changed files with 120 additions and 0 deletions
@@ -0,0 +1,7 @@
package com.correx.core.sessions
data class BoundProjectProfile(
val about: String,
val conventions: List<String>,
val commands: Map<String, String>,
)
@@ -1,6 +1,7 @@
package com.correx.core.sessions
import com.correx.core.events.events.OperatorProfileBoundEvent
import com.correx.core.events.events.ProjectProfileBoundEvent
import com.correx.core.events.events.SessionWorkspaceBoundEvent
import com.correx.core.events.events.StageCompletedEvent
import com.correx.core.events.events.StageFailedEvent
@@ -51,12 +52,22 @@ class DefaultSessionReducer : SessionReducer {
else -> state.boundProfile
}
val boundProjectProfile = when (payload) {
is ProjectProfileBoundEvent -> BoundProjectProfile(
about = payload.about,
conventions = payload.conventions,
commands = payload.commands,
)
else -> state.boundProjectProfile
}
return state.copy(
status = newStatus,
createdAt = createdAt,
updatedAt = event.metadata.timestamp,
boundWorkspace = boundWorkspace,
boundProfile = boundProfile,
boundProjectProfile = boundProjectProfile,
)
}
}
@@ -9,4 +9,5 @@ data class SessionState(
val invalidTransitions: Int = 0,
val boundWorkspace: BoundWorkspace? = null,
val boundProfile: BoundProfile? = null,
val boundProjectProfile: BoundProjectProfile? = null,
)