File tree Expand file tree Collapse file tree 3 files changed +35
-1
lines changed
arbigent-ui/src/main/kotlin/io/github/takahirom/arbigent/ui Expand file tree Collapse file tree 3 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -164,6 +164,9 @@ private fun MainScreen(
164
164
onExecute = {
165
165
appStateHolder.run (it)
166
166
},
167
+ onDebugExecute = {
168
+ appStateHolder.runDebug(it)
169
+ },
167
170
onCancel = {
168
171
appStateHolder.cancel()
169
172
scenarioStateHolderAndDepth.first.cancel()
Original file line number Diff line number Diff line change @@ -141,6 +141,24 @@ class ArbigentAppStateHolder(
141
141
}
142
142
}
143
143
144
+ fun runDebug (scenarioStateHolder : ArbigentScenarioStateHolder ) {
145
+ job?.cancel()
146
+ allScenarioStateHoldersStateFlow.value.forEach { it.cancel() }
147
+ recreateProject()
148
+ job = coroutineScope.launch {
149
+ // Create a regular scenario and then modify it to only include the current task
150
+ val scenario = scenarioStateHolder.createScenario(allScenarioStateHoldersStateFlow.value)
151
+ // Modify the scenario to only include the last task (the current scenario's task)
152
+ val lastTask = scenario.agentTasks.last()
153
+ val debugScenario = scenario.copy(
154
+ agentTasks = listOf (lastTask)
155
+ )
156
+ executeScenario(debugScenario)
157
+ selectedScenarioIndex.value =
158
+ sortedScenariosAndDepths().indexOfFirst { it.first.id == scenarioStateHolder.id }
159
+ }
160
+ }
161
+
144
162
145
163
private fun recreateProject () {
146
164
projectStateFlow.value?.cancel()
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ fun Scenario(
68
68
scenarioCountById : (String ) -> Int ,
69
69
onStepFeedback : (StepFeedbackEvent ) -> Unit ,
70
70
onExecute : (ArbigentScenarioStateHolder ) -> Unit ,
71
+ onDebugExecute : (ArbigentScenarioStateHolder ) -> Unit ,
71
72
onCancel : (ArbigentScenarioStateHolder ) -> Unit ,
72
73
onRemove : (ArbigentScenarioStateHolder ) -> Unit ,
73
74
) {
@@ -97,7 +98,19 @@ fun Scenario(
97
98
hint = Size (28 )
98
99
) {
99
100
Text (
100
- text = " Run" ,
101
+ text = " Run with the dependent scenarios" ,
102
+ )
103
+ }
104
+ IconActionButton (
105
+ key = AllIconsKeys .Actions .StartDebugger ,
106
+ onClick = {
107
+ onDebugExecute(scenarioStateHolder)
108
+ },
109
+ contentDescription = " Debug Run" ,
110
+ hint = Size (28 )
111
+ ) {
112
+ Text (
113
+ text = " Run only this scenario" ,
101
114
)
102
115
}
103
116
IconActionButton (
You can’t perform that action at this time.
0 commit comments