(taskId: string, sessionId: string, setAppState: (f: (prev: AppState) => AppState) => void)
| 201 | * the catch block early-returns when status !== 'running'. |
| 202 | */ |
| 203 | export async function stopUltraplan(taskId: string, sessionId: string, setAppState: (f: (prev: AppState) => AppState) => void): Promise<void> { |
| 204 | // RemoteAgentTask.kill archives the session (with .catch) — no separate |
| 205 | // archive call needed here. |
| 206 | await RemoteAgentTask.kill(taskId, setAppState); |
| 207 | setAppState(prev => prev.ultraplanSessionUrl || prev.ultraplanPendingChoice || prev.ultraplanLaunching ? { |
| 208 | ...prev, |
| 209 | ultraplanSessionUrl: undefined, |
| 210 | ultraplanPendingChoice: undefined, |
| 211 | ultraplanLaunching: undefined |
| 212 | } : prev); |
| 213 | const url = getRemoteSessionUrl(sessionId, process.env.SESSION_INGRESS_URL); |
| 214 | enqueuePendingNotification({ |
| 215 | value: `Ultraplan stopped.\n\nSession: ${url}`, |
| 216 | mode: 'task-notification' |
| 217 | }); |
| 218 | enqueuePendingNotification({ |
| 219 | value: 'The user stopped the ultraplan session above. Do not respond to the stop notification — wait for their next message.', |
| 220 | mode: 'task-notification', |
| 221 | isMeta: true |
| 222 | }); |
| 223 | } |
| 224 | |
| 225 | /** |
| 226 | * Shared entry for the slash command, keyword trigger, and the plan-approval |
no test coverage detected