Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions agents/prd/sidebar-typography/prd.md

Large diffs are not rendered by default.

402 changes: 264 additions & 138 deletions design/hide-screens.pen

Large diffs are not rendered by default.

194 changes: 134 additions & 60 deletions design/hide-ui.lib.pen

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions design/review-targets.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
"conditions": {
"themes": ["light", "dark"],
"widths": [292, 240],
"contents": ["reference", "long"],
"scales": [1, 1.25]
"contents": ["reference", "long"]
},
"states": {
"rest": "No pointer on the list and no keyboard focus.",
Expand Down
24 changes: 14 additions & 10 deletions design/tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -608,10 +608,6 @@
"type": "number",
"value": 24
},
"--size-control-regular": {
"type": "number",
"value": 36
},
"--size-checkbox": {
"type": "number",
"value": 16
Expand All @@ -634,11 +630,23 @@
},
"--size-checkout-row": {
"type": "number",
"value": 36
"value": 32
},
"--size-checkout-row-detailed": {
"type": "number",
"value": 44
"value": 48
},
"--size-project-row": {
"type": "number",
"value": 36
},
"--size-sidebar-line": {
"type": "number",
"value": 20
},
"--size-sidebar-line-detail": {
"type": "number",
"value": 16
},
"--size-overview-group-header": {
"type": "number",
Expand Down Expand Up @@ -748,10 +756,6 @@
"type": "number",
"value": 13
},
"--size-compact-agent-leading-inset": {
"type": "number",
"value": 13
},
"--size-compact-agent-row-vpad": {
"type": "number",
"value": 5
Expand Down
4 changes: 2 additions & 2 deletions docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ Closing follows one flow in `web/src/close.ts`: an unknown activity status asks

### Settings and workspace management in the web shell

Settings (`web/src/SettingsSheet.tsx`, rules in `web/src/settings.ts`) opens from the sidebar's gear or ⌥: General reads the `daemon` frame and `status.{herdr,environment,diagnostics}`, Appearance writes `accent_hex` and `font_size` through `ui_state_update`, Agents reads `status.{background_ai,agent_hooks}` and sends `ai_settings` and `install_agent_hooks`, Devices sends `register_device` (with the helper consent the add form asks for and an optional device Herdr socket), `device_host_consent`, `device_host_retry`, `test_device`, `retry_connect`, `focus_device` and `remove_device` (the sidebar's device switcher sends `focus_device` too), Performance sends `agent_sleep_set` (`after_hours`: null for Never, 12, 24 or 72) and counts this machine's sleeping agents from the navigator, and Shortcuts writes the running host's own set (`browser_shortcut_bindings` in a browser, `shortcut_bindings` in the desktop app).
Settings (`web/src/SettingsSheet.tsx`, rules in `web/src/settings.ts`) opens from the sidebar's gear or ⌥: General reads the `daemon` frame and `status.{herdr,environment,diagnostics}`, Appearance writes `accent_hex` and `font_size` through `ui_state_update` (the sidebar's right edge writes `sidebar_width` the same way, 220 to 440, a value outside refused into the diagnostic log), Agents reads `status.{background_ai,agent_hooks}` and sends `ai_settings` and `install_agent_hooks`, Devices sends `register_device` (with the helper consent the add form asks for and an optional device Herdr socket), `device_host_consent`, `device_host_retry`, `test_device`, `retry_connect`, `focus_device` and `remove_device` (the sidebar's device switcher sends `focus_device` too), Performance sends `agent_sleep_set` (`after_hours`: null for Never, 12, 24 or 72) and counts this machine's sleeping agents from the navigator, and Shortcuts writes the running host's own set (`browser_shortcut_bindings` in a browser, `shortcut_bindings` in the desktop app).
Every row shows what the snapshot says; an edit is pending until the snapshot carries it, and a refusal is matched to the edit by the core's `last_error` kind and time.
Every page names the daemon's machine (`host_name`) as the owner of what it stores - appearance, shortcuts, Background AI, hooks and the device list - and says, while a device is selected, that selecting it changes where files, Git and panes run and not where those values live (PRD S5.5 B35); the Agents page then says that hooks and AI settings for the device's agents are set up by Hide on that machine and are never copied or installed over SSH (B37).
A device row shows only what that device reported (its Herdr version, its helper's platform, and the staged connection test's SSH, auth, Herdr, protocol, PTY, SFTP and Git results), and a refused connection names its step (`problem`: `host_key_changed`, `host_key_unknown` or `authentication`, read off the core's own known_hosts and sign-in words by `remote::connection_problem`) with the action it needs; Hide never edits known_hosts or asks for a password (B36, B38).
Expand All @@ -367,7 +367,7 @@ Copy diagnostics carries versions, paths, states and the core's recent diagnosti
`remove_device` removes Hide's own record of a device and nothing on it (PRD S5.5 B26): its registration, its project registrations and pins, its expanded folders, its open file tabs and its closed items go, while its host, Herdr server, panes, agents and folders are left as they are; a dirty tab closed this way leaves its draft in the browser, where a draft no tab stands for is offered to export or discard, and the confirmation counts the projects, tabs and drafts before anything is removed.
Before `remove_device` is sent the page writes every draft of that device's tabs it still has queued, and a draft that could not be stored (B44) holds the removal: the confirmation names it until it is saved or exported (Export releases exactly the text it downloaded, so a later edit holds the removal again, and the confirmation then says that draft leaves only as the exported file, because the page cannot confirm the download was kept), since closing its tab would lose it; once the drafts are being stored the removal can no longer be kept from the dialog.
The web's `ui_state_update` echo omits `workspace_registrations` and `device_registrations`, which their own events own, so a stale echo can never undo a registration.
The accent swatches read the `--color-accent-choice-*` tokens; the chosen value replaces `--color-accent`, and `font_size` scales the interface text tokens through `--interface-scale` while the terminal and editor sizes stay their own.
The accent swatches read the `--color-accent-choice-*` tokens; the chosen value replaces `--color-accent`, and `font_size` scales the interface text tokens through `--interface-scale` while the terminal and editor sizes stay their own, and so does the sidebar: its nav carries the generated `.interface-scale-exempt` rule, which declares the text tokens again at scale 1, because a custom property resolves where it is declared and setting `--interface-scale` on the nav alone would change nothing.

The sidebar's project and checkout rows open a menu on a right-click, or the menu key or ⇧F10 on the focused row (`EntryContextMenu` in `web/src/components/entry-menu.tsx`, rules in `web/src/workspaceManage.ts`): Pin/Unpin and Remove project for a registered project on any device, New worktree for a Git project on any device, a purpose for any checkout, and deletion for a linked worktree whose gate allows it on any device; an action a row cannot use is drawn disabled with its reason.
The dialogs (`web/src/WorkspaceDialogs.tsx`) send `create_worktree`, `set_checkout_purpose` and `remove_worktree` and read only the receipt for their own request (`task_operation` by kind, id and target; `worktree_removal` by checkout and id), so another page's or an older request's answer is never shown as theirs.
Expand Down
4 changes: 2 additions & 2 deletions docs/DESIGN_WORKFLOW.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ It is excluded from the production build `hided` serves.

The gallery also renders production screens on synthetic scenes, one document per scene because a scene seeds the app's own stores.
`/gallery?scene=projects-sidebar` is the shell's real `Sidebar` and `createActions` over `web/src/gallery/sceneData.ts`, a snapshot with the content `Screen / Projects Sidebar` draws; its folds go through the real actions and the scene answers them as the core would.
Its query takes `theme` (`light`, `dark`), `width` (the sidebar's CSS width), `scale` (the interface text scale) and `content` (`reference`, or `long` for long Korean titles).
Its query takes `theme` (`light`, `dark`), `width` (the sidebar's CSS width, seeded as the core's `ui_state.sidebar_width`), `scale` (the interface text scale, which reaches only what lies outside the sidebar, since the sidebar keeps its sizes at every scale) and `content` (`reference`, or `long` for long Korean titles).
Every name, path and count in a scene is invented example data, so a capture of it is safe to publish.

## The flow: scratch to one PR
Expand Down Expand Up @@ -103,7 +103,7 @@ One run, in this order, with each step's real result in `agents/runs/<slug>/desi
2. The current Pen: the bundle's nodes exported from the target's Pen file in this checkout, so a proposal bundle is set against what the checkout now carries.
3. The production screen: the command starts its own Vite dev server and headless Chromium, opens the target's gallery scene under each selected condition, and measures the bundle's rules there through `web/e2e/sidebar-geometry.mjs`, the same geometry the e2e specs assert on.
The rules are the bundle's, never values read back from the code under review: `childIndentPx` (a child's status mark and title start that many pixels per level right of its list's roots), `rootsAligned`, `stableUnderHover` and `stableUnderFocus` (no row moves or resizes while any one row is hovered or keyboard-focused), `noOverlap` (no part of a row overlaps another or runs past the row, no text spills), `sharedColumns` (one column for every time and badge end, one for every chevron) and `noSidewaysOverflow`.
4. Comparisons: for each bundle frame, the reference, the current Pen and the actual screen side by side, captured under that frame's width, theme, text scale, content and state and labelled with them; an image whose width is not the frame's is reported as a different condition, never scaled to look alike.
4. Comparisons: for each bundle frame, the reference, the current Pen and the actual screen side by side, captured under that frame's width, theme, text scale, content and state (a target without `scales` in its conditions is measured at scale 1, as `projects-sidebar` is, because the sidebar does not follow the scale) and labelled with them; an image whose width is not the frame's is reported as a different condition, never scaled to look alike.
5. State sheets: every selected condition and state no Pen frame draws (a narrow width, a larger text size, long titles, hover, focus, a folded parent, a closed checkout) as captures of the actual screen only, labelled as such.

The exit status is 0 for PASS, 1 for FAIL (the static contract or a rule failed) and 3 for INCOMPLETE: a missing Pen or Pen login, a node Pen did not export, a bundle file that no longer matches its hash, or a browser step that did not finish.
Expand Down
18 changes: 15 additions & 3 deletions docs/UI_BEHAVIOR.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ Its second line exists only when the row has something to say, and from the mome
A quiet sentence is never drawn on the row; the row's tooltip carries it with the full title.
In Agents a root row adds a fixed context line naming its project and checkout (`project › checkout`, the project alone for a plain folder), since the list does not otherwise say where the agent works; a row under a checkout in Projects has none, because the rows above it say it.
Hover, keyboard focus, selection and an open badge list change a fill, a ring and a chevron's opacity only; they never add a line or change a row's height, so the row below never moves.
A row's height is a minimum, not a cap: at a larger interface font a row grows to hold its lines rather than letting them run into the next row, and it still holds still under hover and focus at that size.
A sidebar agent row is 28 high, or 44 with its second line: line one is 20 and line two 16, and the title is 12/400 in every state, a change brightening it rather than thickening it.
A row's height is a minimum, not a cap: a row grows to hold its lines rather than letting them run into the next row, and it still holds still under hover and focus.
No row draws a progress number or step the agent did not report.
The Project Overview's agent rows keep their own density: a quiet sentence is revealed on the selected or hovered row over up to two lines, with the whole of it in the tooltip.
Web owner: `web/src/agentRow.ts` (rules, reusable by any list of agents), `web/src/components/sidebar-agent-row.tsx` (the sidebar row), `web/src/components/agent-row.tsx` (the Overview row and the descendant badge both draw), `web/src/components/agent-children-popover.tsx`.
Expand Down Expand Up @@ -418,6 +419,17 @@ The text that results is ordinary Markdown, with nothing hidden or special in it

Core owner: `herdr-core/src/sidebar.rs`, `herdr-core/src/project_context.rs`, `herdr-core/src/worktrees.rs`, `herdr-core/src/disk.rs`, `herdr-core/src/worktree_cleanup.rs`, `herdr-core/src/runtime/projects.rs`. Web owner: `web/src/sidebar.tsx`, `web/src/projects.ts`.

### Sidebar type, rows and width

The sidebar sets its words on three sizes: a project name 13/600, a checkout name, an agent title and a count 12/400, and a second line and a time 11; a section header is 10/500 in sentence case (`Projects · Recent activity · 5`).
A project row, All projects and a one-line plain folder are 36 high, a checkout row 32 or 48 with its second line, an agent row 28 or 44.
A checkout name mutes its prefix up to and including the first slash (`prd/`), so the part that tells checkouts apart reads first; a name with no slash, or one that starts or ends with it, has no prefix.
The checkout whose Workspace is in front turns its name 500 and nothing else about the row.
The sidebar keeps these sizes at every Appearance font size, because its rows are scanned, not read; the font size scales the rest of the interface.
The sidebar's right edge sets its width: under the pointer it shows a line and a column cursor, a drag moves the sidebar over the center between 220 and 440 and stops at either bound, and the release stores the width in the core's ui state, where it survives a reload and a relaunch; the center and its terminals take the new width once, on the release, never on each pointer move.
A double-click on the edge returns the width to 292, and a press that does not move changes nothing.
A width outside the bounds is refused into the diagnostic log: a sent one leaves the width as it was, and a stored one opens the sidebar at 292.

### Sidebar hierarchy

The sidebar hierarchy is Project > Workspace > Agents; a Workspace corresponds to one checkout path, including a plain folder.
Expand Down Expand Up @@ -454,8 +466,8 @@ A plain folder, a project that is not a Git repository and holds one checkout, i
Its first line is the project's folder glyph, name and status badge, set in the checkout row's columns, and the badge stays while its agent rows are open, as a project's does; its second line and trailing chevron are the checkout's, and a plain folder has no commit age.
It has no project fold of its own and keeps the checkout row's right slots; the row opens the checkout and is marked while that checkout's Workspace or the project's Overview is in front, its menu lists the project's items and then the checkout's, and its Overview is reached from All projects, the palette or the Workspace toolbar.
While a checkout's agent rows are closed, its status badge ends line one; opening them takes the badge away, since their own marks now speak, and changes nothing else on the row.
A checkout's second line is its purpose, with the last-commit age ending it on the time column; it is kept wherever agents run even before a purpose is known, because an agent's title becomes the purpose once it is and the row must not grow then.
A checkout with neither a purpose nor agents, or one whose Git facts have not been read yet, is one line, with its age on that line.
A checkout's second line is its purpose, after the parent checkout it was raised from when there is one, with the last-commit age ending it on the time column; it is drawn only while the checkout has a purpose or a raising parent, so a checkout with agents and neither is one line.
A checkout with neither, or one whose Git facts have not been read yet, is one line, with its age on that line.
Workspace disclosure persists across launches and hides only the nested agent rows, preserving selection, running panes, and raised attention rows.
An agent row's title is its identity label at both densities: the rolling task, or the workspace label when no task exists; a Herdr agent name remains a control identifier and never becomes display copy.
A row whose descendants are folded, and every raised row, wears a descendant badge counting live descendants by state before the elapsed time; opening the fold removes the badge because the opened rows carry their own marks.
Expand Down
21 changes: 21 additions & 0 deletions herdr-core/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2019,6 +2019,12 @@ pub struct UiStateSnapshot {
/// The web shell's color theme.
#[serde(default)]
pub theme: ThemePreference,
/// The Projects and Agents sidebar's width in CSS pixels, dragged on its
/// right edge and kept within `SIDEBAR_WIDTH_MIN..=SIDEBAR_WIDTH_MAX`
/// (PRD sidebar-typography D-08, D-09). A store written before the drag
/// existed loads at the default.
#[serde(default = "default_sidebar_width")]
pub sidebar_width: u32,
/// The interface font size, in points, that the Appearance slider sets.
/// It scales the shell's own chrome - every `hideFont` call site - and
/// nothing else. A pane's terminal bytes are sized by `pane_text_scales`
Expand Down Expand Up @@ -2158,6 +2164,7 @@ impl Default for UiStateSnapshot {
device_registrations: Vec::new(),
accent_hex: default_accent_hex(),
theme: ThemePreference::Dark,
sidebar_width: default_sidebar_width(),
font_size: default_font_size(),
pane_text_scales: BTreeMap::new(),
editor_text_scale: DEFAULT_PANE_TEXT_SCALE,
Expand Down Expand Up @@ -2236,6 +2243,20 @@ pub(crate) fn default_accent_hex() -> String {
"#B9FF66".to_owned()
}

/// The narrowest and widest sidebar the drag lands on (`--size-sidebar-min`
/// and `--size-sidebar-max` in design/tokens.json); a width outside is refused.
pub const SIDEBAR_WIDTH_MIN: u32 = 220;
pub const SIDEBAR_WIDTH_MAX: u32 = 440;

/// The sidebar's width until the operator drags it (`--size-sidebar-ideal`).
pub(crate) fn default_sidebar_width() -> u32 {
292
}

pub(crate) fn sidebar_width_fits(width: u32) -> bool {
(SIDEBAR_WIDTH_MIN..=SIDEBAR_WIDTH_MAX).contains(&width)
}

pub(crate) fn default_font_size() -> f32 {
13.0
}
Expand Down
6 changes: 5 additions & 1 deletion herdr-core/src/persistence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize};
use crate::model::{
DeviceRegistration, PaneReadRecord, PetOriginSnapshot, RightPanelSection, SessionsMode,
ThemePreference, UiStateSnapshot, WorkspaceRegistration, default_accent_hex, default_font_size,
default_pane_text_scale, default_panel_visible,
default_pane_text_scale, default_panel_visible, default_sidebar_width,
};

const UI_STATE_SCHEMA_VERSION: u32 = 1;
Expand Down Expand Up @@ -83,6 +83,8 @@ struct StoredUiState {
/// store written before the web theme existed, which loads as Dark.
#[serde(default)]
theme: Option<String>,
#[serde(default = "default_sidebar_width")]
sidebar_width: u32,
#[serde(default = "default_font_size")]
font_size: f32,
#[serde(default)]
Expand Down Expand Up @@ -247,6 +249,7 @@ fn decode(bytes: &[u8]) -> (UiStateSnapshot, PaneTerminalSizes, LoadDisposition)
device_registrations: stored.device_registrations,
accent_hex: stored.accent_hex,
theme,
sidebar_width: stored.sidebar_width,
font_size: stored.font_size,
pane_text_scales: stored.pane_text_scales,
editor_text_scale: stored.editor_text_scale,
Expand Down Expand Up @@ -308,6 +311,7 @@ pub fn save(
device_registrations: state.device_registrations.clone(),
accent_hex: state.accent_hex.clone(),
theme: Some(state.theme.as_str().to_owned()),
sidebar_width: state.sidebar_width,
font_size: state.font_size,
pane_text_scales: state.pane_text_scales.clone(),
editor_text_scale: state.editor_text_scale,
Expand Down
Loading
Loading