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
998 changes: 692 additions & 306 deletions design/hide-screens.pen

Large diffs are not rendered by default.

290 changes: 215 additions & 75 deletions design/hide-ui.lib.pen

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions design/tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,10 @@
"type": "number",
"value": 12
},
"--size-status-mark": {
"type": "number",
"value": 7
},
"--size-badge-height": {
"type": "number",
"value": 16
Expand Down
1 change: 1 addition & 0 deletions docs/UI_BEHAVIOR.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ Clicking the lifecycle icon, or choosing `Open PR #N` from the checkout context
### Project ordering and inactive folding

Projects and their checkouts sort by the latest authoritative agent activity timestamp or Git commit timestamp, descending; missing activity sorts after known activity, and no UI interaction or local clock invents recency.
Inside a project the primary checkout comes first whatever its activity, because it is the one checkout that never folds, and the rest follow in that activity order.
Activity orders projects inside one device group and never across two.
A project's merged, closed, or seven-day-inactive secondary checkouts move behind a trailing `Inactive N` disclosure, while its primary checkout and every checkout with live work, local changes, unpushed commits, or current focus remain visible.
When every checkout in a project is inactive, the project itself moves behind the device's `Inactive projects N` disclosure.
Expand Down
1 change: 1 addition & 0 deletions docs/status-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ They remain separate badges or Git indicators and never select the agent status
Agent rows, focused-agent tab marks, and Workspace summaries use the same status mark and semantic color mapping.
Working uses a fixed blue status token, independent of the user's accent color; Done uses green, so running and completed work remain distinct.
The symbol and accessible text accompany color, so color alone never carries the distinction.
Every surface draws the mark in one box of one size: `●` and `○` as a filled dot and a ring of the same diameter, because the two glyphs render at different sizes in every face, and every other mark as its glyph in that box (`web/src/components/status-mark.tsx`).

| Agent condition | Mark | Color | Text and behavior |
| --- | --- | --- | --- |
Expand Down
43 changes: 39 additions & 4 deletions herdr-core/src/project_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,14 @@ pub(crate) fn sort_projects(
recent = recent.max(key);
keys.insert(checkout.id.clone(), key);
}
// The primary checkout leads its project whatever its activity: it is
// the one checkout that never folds, so the list starts at the same
// place every time. The rest follow by activity.
let project_path = project.path.clone();
project.checkouts.sort_by(|left, right| {
keys[&right.id]
.cmp(&keys[&left.id])
is_primary(right, &project_path)
.cmp(&is_primary(left, &project_path))
.then_with(|| keys[&right.id].cmp(&keys[&left.id]))
.then_with(|| left.id.cmp(&right.id))
});
// The order's own reason, carried to the shell so the row can show it.
Expand Down Expand Up @@ -106,6 +111,11 @@ pub(crate) fn sort_projects(
})
}

/// The checkout that is the project's own folder rather than a linked worktree.
fn is_primary(checkout: &CheckoutSnapshot, project_path: &str) -> bool {
!checkout.is_worktree && checkout.path == project_path
}

fn checkout_has_live_exception(
checkout: &CheckoutSnapshot,
focused_checkout_id: Option<&str>,
Expand Down Expand Up @@ -181,8 +191,7 @@ pub(crate) fn refresh_inactive_groups(
.checkouts
.iter()
.filter(|checkout| {
let is_primary = !checkout.is_worktree && checkout.path == workspace.path;
!is_primary
!is_primary(checkout, &workspace.path)
&& checkout_is_inactive(checkout, &by_pane, focused_checkout_id, now_unix_ms)
})
.map(|checkout| checkout.id.clone())
Expand Down Expand Up @@ -473,6 +482,32 @@ mod tests {
assert_eq!(projects[1].last_activity_unix_ms, None);
}

/// The primary checkout leads its project even when a linked worktree
/// moved more recently; the linked ones keep their activity order, and
/// the project still carries the newest activity of any of them.
#[test]
fn primary_checkout_leads_its_project_whatever_its_activity() {
let mut herdr = project("herdr", "local", Some(1_000), &[]);
herdr.checkouts[0].path = herdr.path.clone();
herdr
.checkouts
.push(make_worktree_checkout("herdr", "older", Some(2_000)));
herdr
.checkouts
.push(make_worktree_checkout("herdr", "newer", Some(3_000)));
let mut projects = vec![herdr];

assert!(sort_projects(&mut projects, &[]));

let order: Vec<_> = projects[0]
.checkouts
.iter()
.map(|c| c.id.as_str())
.collect();
assert_eq!(order, ["herdr", "newer", "older"]);
assert_eq!(projects[0].last_activity_unix_ms, Some(3_000_000));
}

/// B2, B6, B9, B16. Git merge, settled PR, and the seven-day boundary
/// decide membership. The primary stays outside its project's checkout
/// fold, and a checkout with no known activity is not guessed stale.
Expand Down
55 changes: 42 additions & 13 deletions scripts/pen-screens.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,34 @@ function screenField(id, label, control) {
]);
}

// -- the status mark --------------------------------------------------------------
// status-mark.tsx: `●` and `○` are a dot and a ring of one diameter, and every other
// mark is its glyph in the same box, so no mark renders larger than another. The two
// masters that carry a mark (Agent identity, Checkout row) hold the three as siblings
// in one box, and a row's mark enables the one it draws.
const MARK_NODES = {
identity: {dot: 'sWhWS', ring: 'i9p0pi', glyph: 'PCeNa'},
checkout: {dot: 'J5xdha', ring: 'G3d9T', glyph: 'aFPLo'},
};

function markOverrides(nodes, symbol, fill) {
if (symbol === '●') return {[nodes.dot]: {enabled: true, fill}, [nodes.ring]: {enabled: false}, [nodes.glyph]: {enabled: false}};
if (symbol === '○') return {[nodes.dot]: {enabled: false}, [nodes.ring]: {enabled: true, stroke: fill}, [nodes.glyph]: {enabled: false}};
return {[nodes.dot]: {enabled: false}, [nodes.ring]: {enabled: false}, [nodes.glyph]: {enabled: true, content: symbol, fill}};
}

// The same mark for a row this document draws itself rather than from a master.
function screenStatusMark(tokens, id, symbol, fill) {
const box = num(tokens, '--size-agent-mark');
const size = num(tokens, '--size-status-mark');
const shape = symbol === '●'
? {type: 'ellipse', id: `${id}-dot`, name: 'Dot', width: size, height: size, fill}
: symbol === '○'
? {type: 'ellipse', id: `${id}-ring`, name: 'Ring', width: size, height: size, stroke: fill, strokeWidth: num(tokens, '--size-hairline'), strokeAlignment: 'inner'}
: text(`${id}-glyph`, symbol, {fill, mono: true, size: '$--text-caption'});
return frame(id, 'Status mark', {width: box, height: box, layout: 'horizontal', justifyContent: 'center', alignItems: 'center'}, [shape]);
}

// -- composite Component masters: themedXref restates every internal default color,
// so only content (and any state that changes what the master would not restate on
// its own, like the status dot's color) needs to be named at each call site. -------
Expand All @@ -272,9 +300,9 @@ function screenField(id, label, control) {
// of the canvas instead of flowing in this frame, so they stay at the master's
// own disabled default and only the flowing fields (status, relationship count)
// carry location/age content in this proposal.
function screenAgentIdentity(id, {title, status, statusColor = '$--agent-working'}) {
function screenAgentIdentity(id, {title, status, symbol = '●', statusColor = '$--agent-working'}) {
return themedXref(id, 'HXWFK', title, {width: 260}, {
PCeNa: {fill: statusColor}, x0h40: {content: title}, X6LdE: {content: status},
...markOverrides(MARK_NODES.identity, symbol, statusColor), x0h40: {content: title}, X6LdE: {content: status},
});
}

Expand Down Expand Up @@ -363,7 +391,7 @@ function buildMain(tokens) {
function build(suffix) {
const sidebar = screenSidebar(tokens, 'main-sidebar', suffix, [
{title: '두 번째 에이전트', status: 'Working'},
{title: 'Agent one', status: 'Seen', statusColor: '$--muted-foreground'},
{title: 'Agent one', status: 'Seen', symbol: '○', statusColor: '$--muted-foreground'},
]);
const list = frame(`main-list-${suffix}`, 'Projects', {width: 480, layout: 'vertical', gap: '$--spacing-md'}, [
frame(`main-listhdr-${suffix}`, 'Header', {layout: 'horizontal', justifyContent: 'space_between', alignItems: 'center'}, [
Expand Down Expand Up @@ -391,7 +419,7 @@ function buildProjectOverview(tokens) {
function agentRow(id, {mark, markFill, title, time, detail, detailFill, width}) {
return frame(id, 'Agent row', {layout: 'vertical', gap: '$--spacing-xxs', width}, [
frame(`${id}-line`, 'Line', {layout: 'horizontal', gap: '$--spacing-xs', alignItems: 'center', width}, [
text(`${id}-mark`, mark, {fill: markFill, mono: true}),
screenStatusMark(tokens, `${id}-mark`, mark, markFill),
frame(`${id}-kind`, 'Provider', {width: 16, height: 16, fill: '$--secondary', cornerRadius: '$--radius-xs'}, []),
text(`${id}-title`, title, {weight: '500'}),
frame(`${id}-gap`, 'Spacer', {width: 'fill_container', height: 1}, []),
Expand Down Expand Up @@ -504,7 +532,7 @@ function buildWorkspace(tokens) {
function chrome(suffix) {
const sidebar = screenSidebar(tokens, 'ws-sidebar', suffix, [
{title: 'Agent two', status: 'Working'},
{title: 'Agent one', status: 'Seen', statusColor: '$--muted-foreground'},
{title: 'Agent one', status: 'Seen', symbol: '○', statusColor: '$--muted-foreground'},
]);
const crumb = frame(`ws-crumb-${suffix}`, 'Breadcrumb', {layout: 'horizontal', gap: '$--spacing-xs', alignItems: 'center'}, [
text(`ws-c1-${suffix}`, 'Main', {fill: '$--muted-foreground'}),
Expand Down Expand Up @@ -759,7 +787,7 @@ function buildPalette(tokens) {
text(id('side-sect'), 'NEEDS YOU · 1', {size: '$--text-micro', fill: '$--muted-foreground'}),
]),
frame(id('side-a0'), 'Agent row', {layout: 'horizontal', gap: '$--spacing-xs', alignItems: 'center', padding: ['$--spacing-xs', '$--spacing-md']}, [
text(id('side-a0s'), '?', {size: '$--text-caption', fill: '$--warning', mono: true}),
screenStatusMark(tokens, id('side-a0s'), '?', '$--warning'),
mark('side-a0m', 'claude'),
text(id('side-a0t'), 'hcoord 원격 에이전트 구현', {weight: '500'}),
]),
Expand Down Expand Up @@ -916,6 +944,7 @@ function buildProjectsSidebar(tokens) {
const markSlot = num(tokens, '--size-agent-mark');
const artwork = provider => `../web/src/assets/agent-${provider}.png`;
const STATUS = {working: '$--agent-working', asking: '$--warning', done: '$--success', seen: '$--muted-foreground'};
const SYMBOL = {working: '●', asking: '?', done: '✓', seen: '○'};
const KIND = {
primary: {icon: 'house', fill: '$--subtle-foreground'},
branch: {icon: 'git-branch', fill: '$--subtle-foreground'},
Expand Down Expand Up @@ -946,7 +975,7 @@ function buildProjectsSidebar(tokens) {
const summary = agents
? {
FtZyp: {enabled: true},
J5xdha: {fill: STATUS[agents.status]},
...markOverrides(MARK_NODES.checkout, SYMBOL[agents.status], STATUS[agents.status]),
N7YbJ: {fill: {type: 'image', enabled: true, url: artwork(agents.provider ?? 'claude'), mode: 'fit'}},
fklVZ: {enabled: false},
ExMsH: agents.more ? {content: `+${agents.more}`, enabled: true} : {enabled: false},
Expand Down Expand Up @@ -987,9 +1016,9 @@ function buildProjectsSidebar(tokens) {
}

// agent-row.tsx's AgentRowItem at the name column: mark, provider, title, age.
function agentRow(id, {title, status, symbol, provider = 'claude', age}) {
function agentRow(id, {title, status, provider = 'claude', age}) {
return frame(id, 'Agent row', {width, layout: 'horizontal', gap: '$--spacing-xs', alignItems: 'center', padding: ['$--spacing-xs', '$--spacing-md', '$--spacing-xs', nameColumn]}, [
text(`${id}-mark`, symbol, {fill: STATUS[status], mono: true, size: '$--text-caption'}),
screenStatusMark(tokens, `${id}-mark`, SYMBOL[status], STATUS[status]),
frame(`${id}-art`, 'Provider', {width: 16, height: 16, cornerRadius: '$--radius-xs', fill: {type: 'image', enabled: true, url: artwork(provider), mode: 'fit'}}, []),
text(`${id}-title`, title, {fill: '$--subtle-foreground'}),
frame(`${id}-gap`, 'Spacer', {width: 'fill_container', height: 1}, []),
Expand Down Expand Up @@ -1021,12 +1050,12 @@ function buildProjectsSidebar(tokens) {
folderRow(`psb-p-notes-${s}`, {name: 'team-notes', meta: '1 agent · 2h', agents: {status: 'seen'}, purpose: '회의록 요약 정리'}),
section(`psb-sec-recent-${s}`, 'PROJECTS · RECENT ACTIVITY · 12'),
projectRow(`psb-p-herdr-${s}`, {name: 'herdr-ide', meta: '11 agents · now', expanded: true, hover: true}),
checkoutRow(`psb-c1-${s}`, {name: 'electron-shortcut-bindings', kind: 'open', age: '2h', agents: {status: 'working'}, purpose: 'Electron desktop host for the we…'}),
checkoutRow(`psb-c2-${s}`, {name: 'main', kind: 'primary', age: 'now', agents: {status: 'working', more: 1, provider: 'codex'}, expanded: true, selected: true}),
agentRow(`psb-a1-${s}`, {title: 'S5.5 PRD 초안 정리', status: 'working', symbol: '●', provider: 'codex', age: '3m'}),
agentRow(`psb-a2-${s}`, {title: '후속 UX 계획 인터뷰', status: 'seen', symbol: '○', age: '1h'}),
agentRow(`psb-a1-${s}`, {title: 'S5.5 PRD 초안 정리', status: 'working', provider: 'codex', age: '3m'}),
agentRow(`psb-a2-${s}`, {title: '후속 UX 계획 인터뷰', status: 'seen', age: '1h'}),
checkoutRow(`psb-c3-${s}`, {name: 'quick/155-browser-display', age: '40m', agents: {status: 'asking'}, purpose: '#155 browser display (WebCon…'}),
checkoutRow(`psb-c4-${s}`, {name: 'quick/154-search-palette', kind: 'draft', age: '1h', agents: {status: 'done'}, purpose: '#154 ⌘K search palette UI'}),
checkoutRow(`psb-c1-${s}`, {name: 'electron-shortcut-bindings', kind: 'open', age: '2h', agents: {status: 'working'}, purpose: 'Electron desktop host for the we…'}),
checkoutRow(`psb-c5-${s}`, {name: 'design/workspace-ux-prop…', age: '5h', purpose: 'Workspace UX 제안과 상태 소유…'}),
checkoutRow(`psb-c6-${s}`, {name: 'fix/registered-projects-only', age: '1d'}),
checkoutRow(`psb-c7-${s}`, {name: 'legacy-shell', kind: 'missing'}),
Expand All @@ -1049,7 +1078,7 @@ function buildProjectsSidebar(tokens) {
]);
return [frame(`psb-sidebar-${s}`, 'Sidebar', {width, layout: 'vertical', fill: '$--sidebar', clip: true}, [header, list, footer])];
}
return screenSheet('screen-projects-sidebar', 'Screen / Projects Sidebar', 'sidebar.tsx, projects.ts: the Projects tab. A project row folds its checkouts from its chevron and opens the Overview from the rest of the row; a checkout row opens the checkout, and its trailing chevron, shown only when agents run there, opens their rows in place of line two. Line two is the agents (the representative’s mark and provider, +N) and the purpose. The kind glyph is the pull request’s lifecycle when GitHub knows one, else folder, primary, detached or branch; a missing folder is danger with no age.', build, build);
return screenSheet('screen-projects-sidebar', 'Screen / Projects Sidebar', 'sidebar.tsx, projects.ts: the Projects tab. A project’s primary checkout comes first, then the rest by activity. A project row folds its checkouts from its chevron and opens the Overview from the rest of the row; a checkout row opens the checkout, and its trailing chevron, shown only when agents run there, opens their rows in place of line two. Line two is the agents (the representative’s mark and provider, +N) and the purpose. The kind glyph is the pull request’s lifecycle when GitHub knows one, else folder, primary, detached or branch; a missing folder is danger with no age.', build, build);
}

// -- assembly ---------------------------------------------------------------------
Expand Down
5 changes: 4 additions & 1 deletion web/e2e/projects-sidebar.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// The sidebar's Projects tab on an isolated pinned Herdr and hided: a Git
// project with an agent in its primary checkout and one in a worktree, and a
// plain folder with one agent. The rows name their kind and last-commit age;
// plain folder with one agent. The primary checkout leads its project, and
// the rows name their kind and last-commit age;
// a checkout's agent rows start closed, where its second line names them, and
// open on its chevron; a plain folder is one row that opens its checkout; a
// project folds its checkouts; both folds are the core's ui state, so they
Expand Down Expand Up @@ -94,6 +95,8 @@ test("the Projects tab: kind, age, agent line, opened checkouts and folded proje
const feature = project.locator("[data-checkout-row]", { hasText: "feature/sidebar-rows" });
await expect(primary.locator("[data-checkout]")).toHaveAttribute("data-checkout-kind", "primary");
await expect(feature.locator("[data-checkout]")).toHaveAttribute("data-checkout-kind", "branch");
// The primary checkout leads its project although the worktree moved later.
await expect(project.locator("[data-checkout]").first()).toHaveAttribute("data-checkout-kind", "primary");
// The worktree's commit was just made: its age is the first minute.
await expect(feature.locator("[data-checkout-age]")).toHaveText("now");

Expand Down
8 changes: 7 additions & 1 deletion web/e2e/sidebar-status.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ test("a root waiting on its child, the badge's child list, and the progress line
const parentRow = page.locator(`[data-agent-list] [data-pane="${parent}"]`);
await expect(parentRow).toHaveAttribute("data-waiting", "true", { timeout: 20_000 });
await expect(page.locator(`[data-agent-group="working"] [data-pane="${parent}"]`)).toBeVisible();
await expect(parentRow.locator('[data-badge-part="working"]')).toHaveText("●1");
const workingPart = parentRow.locator('[data-badge-part="working"]');
await expect(workingPart).toHaveText("1");
// One mark size: the waiting root's ring and the badge's working dot are
// drawn shapes of one diameter, not two glyphs that render apart.
const ring = await parentRow.locator('[data-agent-status-mark="waiting"][data-mark="○"] > span').boundingBox();
const dot = await workingPart.locator('[data-mark="●"] > span').boundingBox();
expect(ring && [ring.width, ring.height]).toEqual(dot && [dot.width, dot.height]);
// The heading counts the folded child with its parent.
await expect(page.locator("#agent-group-working")).toHaveText(/· 2$/);
// Folded by default: the delegated child is drawn under its parent only once unfolded.
Expand Down
5 changes: 2 additions & 3 deletions web/src/PaneRelations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { AgentMark } from "./AgentMark";
import { Button } from "./components/ui/button";
import { Hint } from "./components/ui/tooltip";
import { EntryPointMenu, type MenuEntry } from "./components/entry-menu";
import { StatusMark } from "./components/status-mark";
import { chipTitle, chipTone, directChildren, parentStep, relationEntries, relationState } from "./lineage";
import type { PaneRow } from "./snapshot";
import { useShellStore } from "./store";
Expand Down Expand Up @@ -82,9 +83,7 @@ export function ChildChipRow({ pane, actions }: { pane: PaneRow; actions: Action
if (!pending) actions.followRelation(pane.id, chip.pane_id, chip.label);
}}
>
<span className={`font-mono ${chipTone(chip)}`} aria-hidden="true">
{pending ? "…" : chip.symbol}
</span>
<StatusMark symbol={pending ? "…" : chip.symbol} className={chipTone(chip)} />
<AgentMark kind={chip.agent_kind} />
<span className="truncate">{chip.label}</span>
</button>
Expand Down
Loading
Loading