File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
mpp-core/src/commonMain/kotlin/cc/unitmesh/agent/plan Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,8 @@ class PlanStateService {
9494 val plan = _currentPlan .value ? : return
9595 val task = plan.getTask(taskId) ? : return
9696 task.updateStatus(status)
97+ // Trigger StateFlow update by creating a new plan instance with updated timestamp
98+ _currentPlan .value = plan.copy(updatedAt = kotlinx.datetime.Clock .System .now().toEpochMilliseconds())
9799 notifyTaskUpdated(task)
98100 }
99101
@@ -103,6 +105,8 @@ class PlanStateService {
103105 fun completeStep (taskId : String , stepId : String ) {
104106 val plan = _currentPlan .value ? : return
105107 plan.completeStep(taskId, stepId)
108+ // Trigger StateFlow update by creating a new plan instance with updated timestamp
109+ _currentPlan .value = plan.copy(updatedAt = kotlinx.datetime.Clock .System .now().toEpochMilliseconds())
106110 notifyStepCompleted(taskId, stepId)
107111 }
108112
@@ -113,6 +117,8 @@ class PlanStateService {
113117 val plan = _currentPlan .value ? : return
114118 val task = plan.getTask(taskId) ? : return
115119 task.updateStepStatus(stepId, status)
120+ // Trigger StateFlow update by creating a new plan instance with updated timestamp
121+ _currentPlan .value = plan.copy(updatedAt = kotlinx.datetime.Clock .System .now().toEpochMilliseconds())
116122 notifyTaskUpdated(task)
117123 }
118124
You can’t perform that action at this time.
0 commit comments