Repository navigation
feat(herdr-core): rename, split and move workspaces and tabs where Ovis keeps the layout - #2799
Conversation
…is keeps the layout hc has no workspace, tab or split API. On a core whose herdr-app document was never written (the desktop app's own core), the adapter keeps names, splits and a pane's move to another workspace in terminal labels, and ping reports which layout calls it answers. The UI gates each layout action on that offer instead of one herdr-core boolean.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 31 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
…e on new tabs, refuse a helper's move to Other terminals Review round: a split records the pane it split (ovis.split=<dir>:<pane>) and a label-made tab is tiled as that split tree; tab.create and pane.split carry the workspace's name; moving a helper to Other terminals is refused, as its parent's tab would still show it.
Reviews and manual QA (head cdfae32)Reviews: omo (BLOCK, no HIGH) and Codex Terra 6.1 fast xhigh (one unreproduced HIGH), each on both heads. One fix round was done (cdfae32): a workspace's name is kept on new tabs and splits, a helper's move to Other terminals is refused, and splits are recorded as Manual QA on a real Ovis server, isolated hc 0.1.17 core (own session and state, loopback)
Row 8 (blocking): split panes collapse. On a label-kept tab, each pane's layout rect is its terminal's own grid. The pane canvas sizes each cell from those rects, and the terminal attach then resizes the terminal to the cell, which changes the rect again. Within seconds, one pane's real terminal went 200x120, then 15x1, 12x1 and 8x1, leaving a one-row shell. Main never reached this, because Other findings (not fixed in this PR)
|
…eir own Panes of a label-kept tab take their rects from their terminals' grids, and the attach sizes each terminal to its cell, so split panes shrank each other (a shell went to one row). ping now reports layout.split false, pane.split stays unsupported, and the split-tree layout goes until top-down geometry lands.
…aces # Conflicts: # src/components/CommandPalette.tsx # src/components/PaneCanvas.appLayout.test.tsx
…ent, laid out top down (#2830) Fixes #2812 Follows #2799 (merged); this branch has origin/main merged in. ## What On a herdr-core no Herdr app arranges (the desktop app's own core), Ovis now keeps the layout itself, and split panes no longer shrink each other: - **One Ovis-owned hc document, `ovis-layout`** (schema 1): ordered `workspaces[]`, each with ordered `tabs[]`, each tab a split tree (`{leaf}` or `{split: right|down, ratio, first, second}`) and `zoomed`. Written as `doc.get` -> edit -> `doc.set(version)`, with one retry on `conflict`. Membership and names stay in terminal labels (`herdr.space`, `herdr.tab`, `ovis.*`), so a Herdr app started later still adopts the terminals. - **Top-down geometry**: every tab is cut from a fixed 1000x1000 area by its tree and never by terminal `cols`/`rows`. This also applies to tabs from the Herdr app's document, laid out by `size.weight`, with a `stack` showing its active child and `hidden` nodes skipped. `splits[]` is filled with herdr's path ids (`split_<n>_<path>`), so divider drag and keyboard resize work unchanged. - **Reconcile on every snapshot**: a leaf whose terminal is gone is pruned, a terminal labeled into a tab without a leaf is appended to its right, and a core with labels but no document (#2799's state) is laid out from the labels. The document is first written on the first layout change. - **Re-enabled on Ovis-kept tabs**: `pane.split`, `layout.set_split_ratio`, `pane.resize`, `pane.swap` (neighbour or explicit), `pane.zoom`, `tab.move`, `workspace.move`, `pane.rename` (`ovis.pane` label). `ping` reports `layout.split`/`layout.arrange` only where hc's hello lists `doc.set` (capabilities come from `hello.methods`, never from version strings). `HelloInfo` now carries `methods`. - **Read-only where the Herdr app arranges the core**: Ovis never writes `herdr-app`. A `ovis-layout` written in an unknown schema is neither read nor overwritten. - UI: `LayoutOffer` gains `worktrees` (always false on herdr-core), so `arrange` can turn on without offering worktrees. ## Why Issue #2812: a pane's rect was its terminal's grid, the attach resized the terminal to its cell, and the next snapshot read that grid back, so nested splits collapsed (a shell went to 8x1). Labels alone can't hold order, ratios or zoom, and they can't be written atomically across terminals. That's why the order and tree live in one CAS document. Public contract: `docs/herdr-core-layout.md` (labels table, document format, reconcile and write rules); `docs/guide.md` herdr-core section updated. ## Validation - Failing first: the new `snapshot.test.ts` #2812 replay (split right, then left pane down, viewers size terminals to their cells, three snapshots must have identical rects) fails on #2799's head 2e9c37a (rects follow the grids) and passes now. - `bun test server/herdr-core/`: 165 pass, 0 fail (with the review-round fixes, see the PR comment). The new adapter cases cover split right/down as one tree, the CAS retry, ratio/resize/swap/zoom, reorder with Other terminals last, prune/append, a foreign-schema document and the app document refusing writes, and pane names. - Live (`server/herdr-core/live.test.ts`, isolated hc core: own session, state and socket): hc 0.1.14 (CI's pin) 7 pass / 0 fail. On hc 0.1.17 everything passes except the existing schema-pin test (it pins 0.1.14, as noted in #2799). The live case splits right then down, attaches each terminal at 15x1 / 56x29 (#2812's sizes) and checks the rects are unchanged across snapshots. - UI gating tests (CommandPalette, Sidebar, TabStrip, PaneCanvas, layoutActions): pass. - `bun run check fast`: pass on the merge with origin/main 89405e8 (unit 11312 pass, 0 fail). Review rounds and their fixes: see the PR comments. - Not run: `check full`, a manual desktop-app session. ## Follow-ups / known limits - Two viewers of one terminal at different sizes (phone + desktop) still trade `cols`/`rows`. That's a viewer-policy issue, not geometry. - A Herdr app started later on an Ovis-arranged core adopts the terminals and their grouping but not split ratios or order (documented in the guide).
What
On herdr-core, Ovis can now rename workspaces and tabs and move a one-pane tab to another workspace, wherever no Herdr app keeps the core's layout. The UI offers each layout action only where the PC's herdr answers it. Splitting stays off on herdr-core for now (#2812).
Why
The desktop app runs the server with
OVIS_RUNTIME=herdr-coreon its own hc session (ovis). No Herdr app arranges that core, yet every layout action was refused asunsupportedand hidden behind oneappLayoutboolean.What hc offers (0.1.17 OpenRPC schema)
hc has terminals, labels (
terminal.label, wherekey=removes a label) and opaque docs. It has no workspace, tab or split methods. The adapter already groups terminals into workspaces and tabs by theherdr.spaceandherdr.tablabels when theherdr-appdocument does not place them, so:workspace.create,tab.create,*.closeworkspace.rename,tab.renameovis.workspace/ovis.tablabel on each terminal in itunsupported(names are the app's)pane.move(new_tab)unsupportedpane.splitunsupported: rects come from terminal grids, so split panes shrink each other (#2812)unsupportedtab.move,workspace.move, zoom, swap, resize, focus, worktreesunsupported(no order or geometry in hc)unsupported"Ovis keeps the layout" is a fact read from hc:
doc.get herdr-apphas a null value (never written, or deleted).pingreports it ascapabilities.layout = { rename, split, move }, withsplitalways false for now. The client turns this intoHerdrIdentity.layout(shared/machines.tsHerdrCoreLayout), and each call checks the same fact again before it changes anything.UI
AppLayoutContextnow carries aLayoutOffer(rename,split,move,arrange) instead of a boolean.appLayoutOfreturns cached frozen objects, so the context value and hook dependencies keep the same identity between renders.The menus are unchanged; they only follow VS Code-style
whengating (an action is listed only where it can run).Validation
server/herdr-core/live.test.ts, real isolated hc core) and each new adapter case failed before its change.OVIS_TEST_HC_BIN=<hc 0.1.14> bun test server/herdr-core/plus the UI gating tests: 179 pass, 0 fail.bun run check fast: pass on the final head (unit 11265 pass, 0 fail; typecheck, build, generated types and themes fresh).check full, and a manual desktop-app session.Follow-ups