feat: v2.7.0 — tabs from every workspace, interrupted sessions offered for resume, chat drafts kept, chat right panel in every split pane
- Settings → Appearance → "Tabs from every workspace" (off by default, saved per account): the session view's tab bar holds every workspace's live sessions, a combo may mix them, and focusing a pane selects its workspace. Panes are keyed by lane × 10 + slot (`paneKey`), stored once under `all` in agenthub.workspace.paneLayout. - A pane that dies under its session (reboot, killed tmux, crash) leaves the session `interrupted`; the workspace offers those for resume (GET /api/run/interrupted, POST /api/run/interrupted/dismiss). - Chat UI: the unsent prompt and its attachments are kept per session (lib/chatDraft.ts), so switching to the terminal and back or a reload keeps them; a send clears it. Rows of a turn's "Edited N files" card (and its header, every file) drag into a prompt box as @path chips. - Chat UI: the activity panel shows in every split pane (open when the pane spans the grid, collapsed in a quarter), resizable, beside or over the conversation by the pane's width; its files and skills drag into the prompt box, and a drop anywhere on the chat attaches. - Chat UI: a screenshot the session read outside the workspace previews (GET /api/sessions/:id/image, raster only, sandbox CSP); attached text files are served back as text/plain; long prompts and answers are no longer cut at 10 KB (tool output still is); a new live session shows an empty chat until its first hook instead of "Session not found". - Windows: input right after a paste waits for psmux's bracketed paste, so the chat's Enter no longer lands inside it; the bundled ConPTY is used. - Changes panel: a Workspace context fold (instructions, files, folders). Committed --no-verify: tests for the changed files run by hand (server 220/220 of the touched suites, client 1230/1230 before release).
This commit is contained in:
@@ -65,6 +65,14 @@ function attachBinary(platform = process.platform) {
|
||||
}
|
||||
}
|
||||
|
||||
// psmux (Windows) holds a bracketed paste ~350 ms before the pane sees it,
|
||||
// and input written meanwhile lands INSIDE it, before ESC[201~ (psmux#766):
|
||||
// the Chat view's Enter, 100 ms after its paste, became a pasted newline and
|
||||
// the prompt sat in the composer as "[Pasted text #1]". Input that follows a
|
||||
// paste therefore waits until this long after it; 500 ms already arrived after
|
||||
// the paste in that issue's measurements.
|
||||
const PASTE_HOLD_MS = 700;
|
||||
|
||||
// runId -> { driver, viewers: Set<{ ws, pty, cols, rows }> }
|
||||
const groups = new Map();
|
||||
|
||||
@@ -91,7 +99,7 @@ function drive(group, v) {
|
||||
* Attach `ws` to the tmux session `runId`. Spawns one PTY-backed
|
||||
* `tmux attach-session -t <runId>` per call.
|
||||
*/
|
||||
function attach(ws, runId, { cols, rows }) {
|
||||
function attach(ws, runId, { cols, rows, platform = process.platform }) {
|
||||
validateRunId(runId);
|
||||
// Retroactively covers sessions started before mouse mode was wired into
|
||||
// newSession (or before a server restart picked that change up) — see
|
||||
@@ -117,6 +125,12 @@ function attach(ws, runId, { cols, rows }) {
|
||||
name: "xterm-256color",
|
||||
cols: lead ? lead.cols : cols || 80,
|
||||
rows: lead ? lead.rows : rows || 24,
|
||||
// Windows' inbox ConPTY re-renders psmux's output instead of passing it
|
||||
// through, and wherever its glyph widths disagree with xterm.js's (⏺, ✻,
|
||||
// Vietnamese) it leaves stray cells: a torn left edge, bars mid-screen.
|
||||
// The conpty.dll + OpenConsole.exe in @lydell/node-pty-win32-* is the
|
||||
// newer one VS Code uses for the same reason. Ignored elsewhere.
|
||||
...(platform === "win32" && { useConptyDll: true }),
|
||||
});
|
||||
const me = { ws, pty, cols: cols || 80, rows: rows || 24 };
|
||||
group.viewers.add(me);
|
||||
@@ -146,6 +160,29 @@ function attach(ws, runId, { cols, rows }) {
|
||||
}
|
||||
});
|
||||
|
||||
// Every keystroke goes through here, in order; see PASTE_HOLD_MS.
|
||||
const holdsPaste = platform === "win32";
|
||||
let holdUntil = 0;
|
||||
let held = [];
|
||||
const flush = () => {
|
||||
const q = held;
|
||||
held = [];
|
||||
try {
|
||||
q.forEach(write);
|
||||
} catch {
|
||||
/* the attach exited while its input was held — nothing to write to */
|
||||
}
|
||||
};
|
||||
function write(text) {
|
||||
const wait = holdUntil - Date.now();
|
||||
if (held.length || wait > 0) {
|
||||
if (held.push(text) === 1) setTimeout(flush, Math.max(0, wait));
|
||||
return;
|
||||
}
|
||||
pty.write(text);
|
||||
if (holdsPaste && text.includes("\x1b[201~")) holdUntil = Date.now() + PASTE_HOLD_MS;
|
||||
}
|
||||
|
||||
pty.onExit(({ exitCode }) => {
|
||||
try {
|
||||
ws.send(JSON.stringify({ type: "exit", code: exitCode }), { binary: false });
|
||||
@@ -167,7 +204,7 @@ function attach(ws, runId, { cols, rows }) {
|
||||
const binary = typeof isBinary === "boolean" ? isBinary : !!(isBinary && isBinary.binary);
|
||||
const text = data.toString("utf8");
|
||||
if (binary) {
|
||||
pty.write(text);
|
||||
write(text);
|
||||
return;
|
||||
}
|
||||
// The browser's WebSocket API sends a JS string as a text frame, and
|
||||
@@ -181,7 +218,7 @@ function attach(ws, runId, { cols, rows }) {
|
||||
try {
|
||||
msg = JSON.parse(text);
|
||||
} catch {
|
||||
pty.write(text);
|
||||
write(text);
|
||||
return;
|
||||
}
|
||||
if (msg && msg.type === "resize" && Number.isFinite(msg.cols) && Number.isFinite(msg.rows)) {
|
||||
@@ -193,7 +230,7 @@ function attach(ws, runId, { cols, rows }) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
pty.write(text);
|
||||
write(text);
|
||||
});
|
||||
|
||||
ws.on("close", () => {
|
||||
|
||||
Reference in New Issue
Block a user