Replies: 2 comments
|
Hey timkjr thanks for this input! |
|
Sorry this took a day longer than I said on the PR. Answer first: yes, I want the in-page divider, alongside the pop-out window, not instead of it. #453 goes in. Why both. The pop-out (the ⧉ on a tab, What I am agreeing to, so the scope is on record:
v2, so nobody builds the wrong thing next:
On #453 itself: the two items from my last pass (a split against a |
Uh oh!
There was an error while loading. Please reload this page.
Codeman's terminal area shows exactly one active session at a time — switching panes rebinds the single xterm instance and WebSocket to a different session. Multi-monitor spanning and detached windows solve adjacent problems (a bigger window, or two separate windows), but there's no way to see two live sessions side-by-side in one window today.
Proposal (v1, scoped deliberately small): from the active session, open a second, independent, fully live session in a pane beside it via an explicit "Split" button + picker, with a draggable divider. Closing the second pane collapses back to the normal single-pane view.
Key scoping decisions, all deliberate:
It's implemented and tested; a PR referencing this thread is up. Flagging here first since it's a genuinely new feature, per the contributing guide.
Full design spec
Problem
Codeman's terminal area shows exactly one active session (pane) at a time — switching panes re-binds the single xterm instance and the single WebSocket to a different session. Multi-monitor spanning (
scripts/span-codeman.sh/span-codeman.ps1) turned out to solve a different problem: it makes one browser window bigger, but that window still shows one session; floating subagent windows are draggable overlays on top of it, not tiled panes. There is no way today to see two live sessions (e.g.w1-codemanandw1-mcp-memory) side-by-side in one window, even on a monitor wide enough to fit both.Goal (v1)
From the active session, open a second, independent, fully live session in a pane beside it — draggable divider, side-by-side only. Closing the second pane collapses back to today's normal single-pane view. No persistence: a page reload always returns to single-pane. Floating subagent/Ultracode windows keep their current behavior unchanged (global, unconstrained across the whole viewport, split or not).
Explicitly out of scope for v1 (v2 candidates, not designed here):
Current architecture (why this isn't a CSS change)
terminal-ui.jsis built entirely around singleton state:this.terminal(one xterm instance),this._ws/this._wsSessionId(one WebSocket, rebound on every pane switch), athis._xtermSnapshotsmap used only to restore scrollback into that one terminal when switching back to a session. Roughly 280 references to this singleton state exist across the file (input handling, resize/fit, sizing-token claims, mobile touch gestures, CJK IME, local-echo overlay wiring, keyboard accessory bar, link providers, etc.).Showing two sessions at once therefore requires a second, independently alive xterm + WebSocket pair running concurrently — not a layout change to one shared instance.
Related prior art:
detachSession(id)already opens one session in a genuinely separate browser window with its own independent WebSocket, and two of those can already be snapped side-by-side today with zero new code. That covers "two sessions visible at once" but not what this spec is for: one Codeman window with two panes and a divider you can drag without leaving your seat, each still a full participant in that window's floating subagent windows, header, and settings.Server-side check (done, not just assumed):
MAX_WS_PER_SESSION = 5, scoped byclientId:tabNonce. Splitting always opens a different session in the second pane (self-splitting is disallowed), so this is two sessions each getting their normal one connection — the existing cap needs no server change.Key design decision: Pane B is deliberately plainer than Pane A
Porting all ~280 singleton behaviors to a second, symmetric pane is not worth it for v1 — most of that code is input-quality-of-life for mobile/touch, and this feature is desktop-only by nature. So:
SplitTerminalPaneobject: its own xterm instance + fit addon, its own WebSocket, resize-on-divider-drag, and plain keyboard input. No local-echo overlay, CJK IME, touch/mobile handlers, or keyboard accessory bar.If this asymmetry actually bothers you in daily use, promoting Pane B to full parity is a scoped v2 (extract shared logic once there are two call sites to compare).
Components
SplitTerminalPane(terminal-split.js): one instance per secondary pane —constructor(sessionId, mountEl),connect(),fit(),destroy(). No snapshot/scrollback-restore map needed since Pane B is destroyed on close, not hidden-and-restored.Split container:
.terminal-split-container(flex row) wraps.terminal-wrap(Pane A, untouched) +.split-divider(draggable) +.terminal-pane-b. Default 50/50, divider drag updates both panes'flex-basislive and refits both terminals, clamped 20%/80%.Trigger UI: a "Split" header button (opt-in, off by default) opens a picker of other open sessions, excluding the active one. Picking one creates the split; closing collapses it back.
Edge cases
.terminal-wrap's layout.All reactions