Overview
Two UX improvements for the debug console that make iterative testing much faster:
1. Restart button
A Restart button in the header that kills the current agent session and starts a fresh one without reloading the page.
- Clears message history, tool log, usage counters, and error list
- Keeps the current user/model/API key/base URL settings
- Sends a
POST /restart (or reuses /send with a special flag) to the backend, which cancels the running engine goroutine and resets Console state
- Button is disabled while no session is active (nothing to restart)
- Optional: confirm prompt if agent is mid-run ("Agent is running — restart anyway?")
Backend: Console needs a cancel context wired to the engine goroutine so it can be stopped cleanly. A new POST /restart handler cancels the context, waits for the goroutine to exit, then emits a clear SSE event so all connected frontends reset.
2. Save / restore session
A Save button (and matching Load) that snapshots the current conversation and lets the user restore it later.
Save
- Downloads a JSON file containing: messages, tool log, config (model, user, system prompt), usage totals
- File name:
session-YYYY-MM-DD-HH-MM.json
- Pure frontend — no backend changes needed
Restore / Load
- A file-picker button that loads a previously saved JSON
- Replays the messages and tool log into the frontend state (no LLM calls — display only)
- Useful for sharing sessions or comparing runs
Implementation notes
- Backend restart: add
runCtx context.Context + runCancel context.CancelFunc to Console[S]; handleSend uses runCtx for the engine goroutine; handleRestart calls runCancel(), waits for running to go false, then resets and emits clear
- Frontend save:
JSON.stringify(state) → Blob → URL.createObjectURL → auto-click <a download>
- Frontend load:
<input type="file"> → JSON.parse → dispatch synthetic actions to rebuild state
Open questions
- Should Load also send the session to the backend (so the agent sees conversation history on its next run)?
- Should the restart button optionally accept a new task prompt (like a "re-run with different input" flow)?
Overview
Two UX improvements for the debug console that make iterative testing much faster:
1. Restart button
A Restart button in the header that kills the current agent session and starts a fresh one without reloading the page.
POST /restart(or reuses/sendwith a special flag) to the backend, which cancels the running engine goroutine and resetsConsolestateBackend:
Consoleneeds a cancel context wired to the engine goroutine so it can be stopped cleanly. A newPOST /restarthandler cancels the context, waits for the goroutine to exit, then emits aclearSSE event so all connected frontends reset.2. Save / restore session
A Save button (and matching Load) that snapshots the current conversation and lets the user restore it later.
Save
session-YYYY-MM-DD-HH-MM.jsonRestore / Load
Implementation notes
runCtx context.Context+runCancel context.CancelFunctoConsole[S];handleSendusesrunCtxfor the engine goroutine;handleRestartcallsrunCancel(), waits forrunningto go false, then resets and emitsclearJSON.stringify(state)→Blob→URL.createObjectURL→ auto-click<a download><input type="file">→JSON.parse→ dispatch synthetic actions to rebuild stateOpen questions