Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

feat(resume): Restart & Continue button — respawn agent PTY resuming its conversation

Vyapak Goyala0da64e3a05c
diff --git a/src/renderer/src/components/CommandCenterPanel.tsx b/src/renderer/src/components/CommandCenterPanel.tsx
index 8bcb330b..f4345186 100644
--- a/src/renderer/src/components/CommandCenterPanel.tsx
+++ b/src/renderer/src/components/CommandCenterPanel.tsx
@@ -229,7 +229,14 @@ function FloorTab({ seed }: { seed: { text: string; seq: number } }) {
if (seed.seq > 0) setDispatchText(seed.text);
}, [seed.seq, seed.text]);
- const restartWithModel = async (a: Agent, model: string | undefined) => {
+ // Restart an agent's PTY in place. `resume:true` reattaches its prior Claude
+ // conversation (`--resume <sessionId>`, resolved in the main process from the
+ // hive registry by agent id) — this is "Restart & Continue": a clean re-draw
+ // of the TUI in a fresh process WITHOUT losing the thread, which is the escape
+ // hatch for a corrupted/garbled terminal (e.g. xterm reflow after dragging the
+ // window between displays of different sizes). With `resume` unset it's the
+ // old behavior: a model change that starts a fresh session.
+ const restartWithModel = async (a: Agent, model: string | undefined, opts: { resume?: boolean } = {}) => {
if (!a.ptyId) return;
setRestarting(a.id);
try {
@@ -258,8 +265,14 @@ function FloorTab({ seed }: { seed: { text: string; seq: number } }) {
const entry = acquireTerminal(a.ptyId);
let cols = 100, rows = 30;
try { entry.fit.fit(); cols = entry.term.cols; rows = entry.term.rows; } catch { /* host not sized yet */ }
- const res = await window.cth.spawnPty({ id: a.ptyId, cwd: a.cwd, command: exe, args, provider, cols, rows, hive });
- if (res.ok) updateAgent(a.id, { command: command.trim(), provider, model, status: 'idle', action: 'restarting…' });
+ const res = await window.cth.spawnPty({ id: a.ptyId, cwd: a.cwd, command: exe, args, provider, cols, rows, hive, resume: opts.resume });
+ if (res.ok) {
+ // On a pure resume the model is unchanged — don't overwrite it.
+ const patch = opts.resume
+ ? { status: 'idle' as const, action: 'continuing…' }
+ : { command: command.trim(), provider, model, status: 'idle' as const, action: 'restarting…' };
+ updateAgent(a.id, patch);
+ }
} catch { /* noop */ } finally {
setRestarting(null);
}
@@ -490,6 +503,21 @@ function FloorTab({ seed }: { seed: { text: string; seq: number } }) {
? 'model (restarts agent)'
: `${inferAgentProvider(a.command, a.provider)} · model (restarts agent)`}
</span>
+ {/* Restart & Continue — kill + respawn keeping the SAME model and
+ resuming the prior conversation (--resume). Use this to redraw a
+ garbled TUI (e.g. after dragging the window across displays)
+ without losing the thread. */}
+ <span style={{ flex: 1 }} />
+ <PixelButton
+ variant="secondary"
+ size="sm"
+ disabled={restarting === a.id}
+ onClick={() => restartWithModel(a, a.model, { resume: true })}
+ >
+ <span title="Kill and respawn this agent, resuming its current conversation — fixes a corrupted/garbled terminal without losing context">
+ restart &amp; continue
+ </span>
+ </PixelButton>
</div> : (
<div style={{ fontSize: 11, color: 'var(--cth-ink-500)' }}>
provider: {inferAgentProvider(a.command, a.provider)}