Mike0021 commited on
Commit
382163c
·
verified ·
1 Parent(s): b0edcef

Pi Web fork: the chin's branch in code type, on the mode's baseline

Browse files
Files changed (1) hide show
  1. piweb/hf-design.patch +8 -5
piweb/hf-design.patch CHANGED
@@ -8383,10 +8383,10 @@ index 86728a2..98fb8f2 100644
8383
  cursor: pointer;
8384
  diff --git a/app/ui.css b/app/ui.css
8385
  new file mode 100644
8386
- index 0000000..124b268
8387
  --- /dev/null
8388
  +++ b/app/ui.css
8389
- @@ -0,0 +1,631 @@
8390
  +/* The shared components on Base UI (components/ui/*): menus, tooltips,
8391
  + popovers and the composer's suggestion list. Popups are portaled to <body>,
8392
  + so they stack by the positioner's z-index, above every pane. */
@@ -8881,7 +8881,10 @@ index 0000000..124b268
8881
  +.composer-place-trigger .project-picker-name { max-width: 24ch; color: inherit; font-family: inherit; }
8882
  +.composer-place-trigger .project-picker-leaf { color: inherit; }
8883
  +.composer-place-trigger .project-picker-parent { color: var(--text-dim); }
8884
- +.composer-place-trigger .project-picker-path { max-width: 20ch; color: inherit; font-family: inherit; }
 
 
 
8885
  +.composer-place-trigger .is-linked { color: var(--accent); }
8886
  +/* On the mode label's baseline: Geist's glyphs at 13px take 15px (a line box of
8887
  + 1, the mode's, would cut the clipped name's descenders; "normal", 16px, sat
@@ -27700,7 +27703,7 @@ index 0000000..60a29b0
27700
  +## Connectors (`lib/mcp-presets.ts`)
27701
  +Settings › MCP is called Connectors. "Add Hugging Face" goes through the ordinary add route (pi syntax kept, so the header's `!command` stays as written): `Authorization` is printed on every connection from `HF_TOKEN` or the token the Space lends the machine (`~/.cache/huggingface/token`). pi resolves header values uncached (`resolveConfigValueUncached`), so a refreshed token is used at the next connection and a token taken back fails the connection instead of leaking a stale one.
27702
  diff --git a/docs/agents/sessions.md b/docs/agents/sessions.md
27703
- index 42e1816..a0f247a 100644
27704
  --- a/docs/agents/sessions.md
27705
  +++ b/docs/agents/sessions.md
27706
  @@ -38,7 +38,7 @@ On mount `useAgentSession` loads the history, then `GET /api/sessions/[id]/state
@@ -27720,7 +27723,7 @@ index 42e1816..a0f247a 100644
27720
  -- One picker, two places: `components/ProjectWorktreePicker.tsx` is the files' project and worktree boxes (`layout="stacked"` in the Files tab, `"row"` below the sessions: one instance, only the prop follows the layout; both are `stacked` inside, `layout !== "inline"`, with the files' extras: the activity dot, the worktree hint, the menus' minimum width) and the bar above a fresh composer (`layout="inline"`, inside `components/NewSessionContextBar.tsx`, which adds only the focus after a move and the home folder for the paths (the menus', a detached checkout's in the worktree button), asked for once per page). The files' are two boxes, main's files-tab look: the header buttons' grey box, 11px, the project's whole path (`~` for the home folder; no icon, no chevron) and the worktree's branch (branch icon, accent for a linked checkout, "main", the count, a chevron) in code type, cut at their left. The Files tab's are full width, one under the other; below the sessions they sit side by side in one 26px row (`.project-picker.is-row`, app/globals.css: the worktree box as wide as its branch and notes up to 55% of the row, a share that is safe there since the row is the head's whole width; the project box takes the rest, its path cut at its left; the worktree box drops the main checkout's "main" note there, which on a narrow sidebar left the branch no room, the icon's color still telling main from linked; its menu, wider than the box, opens from the box's right edge, `align: "end"`, so it grows over the sidebar rather than past it over the chat). The bar's are text on the page (`.project-picker.is-inline`): no box until hovered or open (`--bg-hover`), 12px, 26px high, 2px apart; a 12px folder icon (`--text-dim`), the project's name in code type and a chevron; the branch icon (accent for a linked checkout), the branch and a chevron, with no "main" note and no count. The name is the menus' (`describeProjectChoices()`): the display name, else the folder's, a dim `parent/` before it only where two projects share it, the parent cut first (`flex-shrink: 1000000`, the "/" never) so the name stays whole; the whole path is the tooltip and the desktop menu's rows. Names there, paths in the files: the bar answers which project the session joins, named as its group header will name it, while the files' boxes stand over the folder the explorer lists. The bar's row never wraps: the worktree button gives way first (`flex-shrink: 1000000`; shrinking with their text, a 30-odd-character branch took the last pixels off a short name at 375px, and at 1000 the name still lost 2/64px, enough for its ellipsis), the branch cut at its left, then the name at its end, down to minimum widths of their own (72px, 56px; the branch capped at 32ch, the name at 28ch), never shares of the row (a lone button squeezed to a share of itself once ended up 0px wide). Both take the sidebar's `NewSessionContext` (the files tab a stand-in with `project: null` and every project while there is no cwd: `ProjectWorktreeContext`), both menus are `SidebarMenu`s (a bottom sheet on phones, keyboard navigation, a filter field from 8 choices on; the field and its "no match" status stand outside the `role="menu"` list, inside a dialog), and the menus offer the same in both places: the projects (the one in use checked, names with a parent folder only where names collide, the full path as tooltip; the files tab adds the group headers' `ActivitySummary` per project and a dot in its box for activity elsewhere), then "Use default directory" and "Open another project…"; the worktrees (the current one checked, "main" noted), then "New worktree…" (`WorktreeCreateForm` as the menu's body). Only the files tab passes `onRemoveWorktree`: each linked checkout gets a trash button (`SidebarMenuItem.secondary`); a dirty checkout or a failure turns the menu into a removal body (Force, focus on Cancel: the body's own on a desktop, the sheet's through `focusCancel` on a phone, never Force as the first control; the menu's `id` drops an answer meant for an older body), a removed one goes back to the list. The picker hands `SidebarMenu` one child, null for a list: two conditional children arrive as an array, which `hasCustomMenuBody()` reads through `Children.toArray` so `[false, false]` is still no body. On a desktop both places' menus look as main's dropdowns did (`classic` on `SidebarMenu`, at least as wide as their box): rows divided by lines, 11px, the projects' whole paths and the branches in code type cut at their left, "Custom path…" for another folder, no line before "New worktree…", whose form shows under the list (`footer`) in its place, a dirty checkout's question in that checkout's row (a `custom` entry; its Cancel goes back to the list) and a failure under the list; the project filter shows past 8 projects, as there (`minChoices`). The phone's sheets keep the names and "Open another project…". Picking the checkout in use does nothing in both places, and so does picking the project in use while its worktrees are listed (it would move a worktree back to the root); without the list (a removed worktree's cwd, grouped under its main project, gets a 403 listing) the project in use is the one-click way back to its root, and the owners ignore a pick of the cwd already in use. Each place keeps its own moves through callbacks: the files tab's `handleFilesPick` installs the picked identity (`setValidatedProject`, as `startNewSessionIn` does, so a pinned project without sessions keeps its server key) and moves the sidebar's cwd (the composer is remounted and its draft parked, as for any cwd change), the bar goes through AppShell as below. Both create through the sidebar's `createWorktree()` and move there only while the form is still open; opening a worktree menu refetches the list. The sessions' "Open another project…" goes to the files (`revealFiles("project-list")`: the files tab, or the section below opened) and opens the picker's project menu through its handle (`ProjectWorktreePickerHandle.openMenu`) once they show.
27721
  -- The empty new-session page has a project/worktree bar above the composer (`components/NewSessionContextBar.tsx`, in ChatWindow's `newSessionContextBar` slot, shown only while `isEmptyNew`). The header (`.new-session-hero`, the composer's side padding and width) is two rows on the composer's left edge, nothing on the right: the brand (`.new-session-brand`: the 40px logo, 32px on phones; "Pi Web" in code type, 22px/700, 20px on phones, over one 11px `--text-dim` line: "web v<app>", then "→ v<latest> ↗" while a newer release exists (`NewSessionUpdateLink`, `--accent`), "·" and "pi v<pi>", which alone gives way, its ellipsis, where the line is narrow), then, 20px below (16px on phones), the bar, the header's last child, 6px above the composer card. The bar is a 28px row (36px with a coarse pointer's buttons) pulled left by the project button's own 6px padding, so its folder icon stands on the logo's and the card's edge. It has no visible label: the folder icon says it, and the group keeps its name (`workspace.newSessionContext`). The update link's hover and focus box, and a coarse pointer's taller tap target, are padding offset by equal negative margins: the line never moves; the focus ring is drawn inside that box (`outline-offset: -2px`), clear of the "→" and "·". The update check runs once per page (`checkAppUpdate()`), so the header of each composer a move remounts has the link in its first paint rather than the line growing under the reader's eyes. While the phone keyboard is up only the bar hides (client-platform.md); the brand stays. The sidebar still owns the cwd and the identity: it reports a `NewSessionContext` (`lib/new-session-context.ts`) through `onNewSessionContextChange`, only when its signature (`newSessionContextKey()`) changes, since the tree is rebuilt on every refresh and running poll. Projects are the sidebar's groups in their order (pinned projects without sessions included), then projects that have sessions but no group (`recentProjects` through `mergeProjectChoices()`: all their sessions archived, or pinned in the pinned section while the project itself is not); worktrees are listed only where the files tab offers its switcher (the top of a git checkout), so a subdirectory or non-git folder shows only the project. AppShell renders the bar with `contextForCwd()`, which covers the commit in which the report still describes the previous cwd. A sibling worktree in the report's list is enough there; anything else would show the folder as a project of its own with no worktree button (and the next bar's focus request would fall back to the project button for good), so AppShell keeps the bar's last accepted move (`newSessionMoveRef`: cwd, project, and the branch of a worktree `handleCreateNewSessionWorktree` just made) and passes it along until the sidebar reports that cwd: the move's project is shown, and a checkout of the reported project the list lacks joins it as the current worktree. Opening the worktree menu refetches the list (`refreshWorktrees()`): worktrees come and go from the CLI and other windows.
27722
  +- File tabs belong to a project (worktrees of one project share them; terminal tabs are grouped by working folder, `lib/terminal-tabs.ts`, and the Terminal pane follows the folder by itself). Every project switch (`handleCwdChange`, `handleSelectSession`, `handleNewSession`) goes through `changeFileWorkspace()`: the tabs, the active file and whether the panel showed it are parked by project key in page memory (`switchFileWorkspace()`, `components/file-tab-state.ts`; no file contents, gone on reload) and the target project's come back. Only the active `FileViewer` is mounted, and it reports its mode, wrap and scroll as it unmounts, which is after the switch: the report carries the workspace generation it rendered in (also part of its `key`, so a same-path tab in the next project remounts), and one from an earlier generation goes to the parked tabs (`saveParkedFileViewerState()`), never to a restored tab with the same path. A restored tab whose file is gone shows the viewer's error, as an open tab does.
27723
- +- One picker, two places: `components/ProjectWorktreePicker.tsx` is the files' project and worktree boxes (`layout="stacked"` in the Files tab, `"row"` below the sessions: one instance, only the prop follows the layout; both are `stacked` inside, `layout !== "chin"`, with the files' extras: the activity dot, the worktree hint, the menus' minimum width) and the buttons in a fresh composer's chin (`layout="chin"`, inside `components/NewSessionContextBar.tsx`, which adds only the focus after a move and the home folder for the paths (the menus', a detached checkout's in the worktree button), asked for once per page). The files' are two boxes, main's files-tab look: the header buttons' grey box, 11px, the project's whole path (`~` for the home folder; no icon, no chevron) and the worktree's branch (branch icon, accent for a linked checkout, "main", the count, a chevron) in code type, cut at their left. The Files tab's are full width, one under the other; below the sessions they sit side by side in one 26px row (`.project-picker.is-row`, app/globals.css: the worktree box as wide as its branch and notes up to 55% of the row, a share that is safe there since the row is the head's whole width; the project box takes the rest, its path cut at its left; the worktree box drops the main checkout's "main" note there, which on a narrow sidebar left the branch no room, the icon's color still telling main from linked; its menu, wider than the box, opens from the box's right edge, `align: "end"`, so it grows over the sidebar rather than past it over the chat). The chin's are the mode's own buttons (`ui-btn ui-btn--sm composer-place-trigger`, app/ui.css), 28px, 2px apart: a 14px Carbon folder icon, the project's name in the chin's type and a 12px chevron; the branch icon (accent for a linked checkout), the branch and a chevron, with no "main" note and no count; their menus open upward (`side: "above"` on the anchor, below only without room), as the chin's others do. The name is the menus' (`describeProjectChoices()`): the display name, else the folder's, a dim `parent/` before it only where two projects share it, the parent cut first (`flex-shrink: 1000000`, the "/" never) so the name stays whole; the whole path is the tooltip and the desktop menu's rows. Names there, paths in the files: the bar answers which project the session joins, named as its group header will name it, while the files' boxes stand over the folder the explorer lists. The chin's row never wraps: the worktree button gives way first (`flex-shrink: 1000000`; shrinking with their text, a 30-odd-character branch took the last pixels off a short name at 375px, and at 1000 the name still lost 2/64px, enough for its ellipsis), the branch cut at its left, then the name at its end, down to minimum widths of their own (28px, 52px; the branch capped at 20ch, the name at 24ch; in a chin under 400px the branch is its icon and the name 12ch), never shares of the row (a lone button squeezed to a share of itself once ended up 0px wide). Both take the sidebar's `NewSessionContext` (the files tab a stand-in with `project: null` and every project while there is no cwd: `ProjectWorktreeContext`), both menus are `SidebarMenu`s (a bottom sheet on phones, keyboard navigation, a filter field from 8 choices on; the field and its "no match" status stand outside the `role="menu"` list, inside a dialog), and the menus offer the same in both places: the projects (the one in use checked, names with a parent folder only where names collide, the full path as tooltip; the files tab adds the group headers' `ActivitySummary` per project and a dot in its box for activity elsewhere), then "Use default directory" and "Open another project…"; the worktrees (the current one checked, "main" noted), then "New worktree…" (`WorktreeCreateForm` as the menu's body). Only the files tab passes `onRemoveWorktree`: each linked checkout gets a trash button (`SidebarMenuItem.secondary`); a dirty checkout or a failure turns the menu into a removal body (Force, focus on Cancel: the body's own on a desktop, the sheet's through `focusCancel` on a phone, never Force as the first control; the menu's `id` drops an answer meant for an older body), a removed one goes back to the list. The picker hands `SidebarMenu` one child, null for a list: two conditional children arrive as an array, which `hasCustomMenuBody()` reads through `Children.toArray` so `[false, false]` is still no body. On a desktop both places' menus look as main's dropdowns did (`classic` on `SidebarMenu`, at least as wide as their box): rows divided by lines, 11px, the projects' whole paths and the branches in code type cut at their left, "Custom path…" for another folder, no line before "New worktree…", whose form shows under the list (`footer`) in its place, a dirty checkout's question in that checkout's row (a `custom` entry; its Cancel goes back to the list) and a failure under the list; the project filter shows past 8 projects, as there (`minChoices`). The phone's sheets keep the names and "Open another project…". Picking the checkout in use does nothing in both places, and so does picking the project in use while its worktrees are listed (it would move a worktree back to the root); without the list (a removed worktree's cwd, grouped under its main project, gets a 403 listing) the project in use is the one-click way back to its root, and the owners ignore a pick of the cwd already in use. Each place keeps its own moves through callbacks: the files tab's `handleFilesPick` installs the picked identity (`setValidatedProject`, as `startNewSessionIn` does, so a pinned project without sessions keeps its server key) and moves the sidebar's cwd (the composer is remounted and its draft parked, as for any cwd change), the bar goes through AppShell as below. Both create through the sidebar's `createWorktree()` and move there only while the form is still open; opening a worktree menu refetches the list. The sessions' "Open another project…" goes to the files (`revealFiles("project-list")`: the files tab, or the section below opened) and opens the picker's project menu through its handle (`ProjectWorktreePickerHandle.openMenu`) once they show.
27724
  +- The empty new-session page has the brand above the composer and the project/worktree picker in the composer's chin, after "+" and before the mode (`components/NewSessionContextBar.tsx`, ChatWindow's `newSessionContextBar` slot passed to ChatInput's `placePicker`, shown only while `isEmptyNew`), as Claude Code Desktop's start page puts its folder and branch in the composer's environment bar (desktop-shell.md, "The chin"). The header (`.new-session-hero`) has the composer shell's sides (app/ui.css, with `.chat-input-shell`: 16px, 26px on the right on a desktop for the message list's scrollbar gutter) and the column's width, so the logo stands on the card's left edge, nothing on the right: the brand (`.new-session-brand`: the 40px logo, 32px on phones; "Pi Web" in code type, 22px/700, 20px on phones, over one 11px `--text-dim` line: "web v<app>", then "→ v<latest> ↗" while a newer release exists (`NewSessionUpdateLink`, `--accent`), "·" and "pi v<pi>", which alone gives way, its ellipsis, where the line is narrow), 20px above the composer card (16px on phones). The picker has no visible label: the folder icon says it, and the group keeps its name (`workspace.newSessionContext`). The update link's hover and focus box, and a coarse pointer's taller tap target, are padding offset by equal negative margins: the line never moves; the focus ring is drawn inside that box (`outline-offset: -2px`), clear of the "→" and "·". The update check runs once per page (`checkAppUpdate()`), so the header of each composer a move remounts has the link in its first paint rather than the line growing under the reader's eyes. While the phone keyboard is up the chin's left side hides, the picker with it (client-platform.md); the brand stays. The sidebar still owns the cwd and the identity: it reports a `NewSessionContext` (`lib/new-session-context.ts`) through `onNewSessionContextChange`, only when its signature (`newSessionContextKey()`) changes, since the tree is rebuilt on every refresh and running poll. Projects are the sidebar's groups in their order (pinned projects without sessions included), then projects that have sessions but no group (`recentProjects` through `mergeProjectChoices()`: all their sessions archived, or pinned in the pinned section while the project itself is not); worktrees are listed only where the files tab offers its switcher (the top of a git checkout), so a subdirectory or non-git folder shows only the project. AppShell renders the picker with `contextForCwd()`, which covers the commit in which the report still describes the previous cwd. A sibling worktree in the report's list is enough there; anything else would show the folder as a project of its own with no worktree button (and the next bar's focus request would fall back to the project button for good), so AppShell keeps the bar's last accepted move (`newSessionMoveRef`: cwd, project, and the branch of a worktree `handleCreateNewSessionWorktree` just made) and passes it along until the sidebar reports that cwd: the move's project is shown, and a checkout of the reported project the list lacks joins it as the current worktree. Opening the worktree menu refetches the list (`refreshWorktrees()`): worktrees come and go from the CLI and other windows.
27725
  - Every move from the bar goes through AppShell's `handlePickNewSessionContext()`, which refuses unless the composer is fresh and the target differs from its cwd, then calls `SessionSidebarControl.startNewSessionIn({ …, carryComposer: true })` (the sidebar's imperative handle, made once, calling the newest closures): identity, cwd, then `handleNewSession(…, { carryComposer })` as for any new session, so `handleCwdChange` sees the following report as no switch. With `carryComposer`, `handleNewSession` moves the fresh composer's draft (text and images, the live value through `ChatInputHandle.rekeyDraft`) to the new key instead of parking it; a draft parked in the target cwd comes back only when nothing was carried, never merged. "Open another project…" opens the sidebar's `DirectoryPicker` with `customPathOpen === "new-session"`: the validated folder goes to a callback that runs the same guard (`pickNewSessionContextRef`), and the sidebar's cwd moves only through it. "Use default directory" is `openDefaultDirectoryForNewSession()` on the handle: `/api/default-cwd`, then the same validation (`commitCustomPath(…, { purpose: "new-session" })`) and the same callback; a failure says nothing, as in the files tab. "New worktree…" is `createWorktree()` on the handle: it lists the new worktree at once and refetches even if the bar went away meanwhile; the session starts there only while the bar is mounted and that form is still open. The Files tab's own project and worktree switches still remount the composer and park its draft.
27726
  - The remount would reset the fresh composer's own picks, so they travel with the draft: useAgentSession reports `NewSessionChoices` (model and reasoning overrides) through `onNewSessionChoicesChange`, `handleNewSession` hands the last report to the next composer as `initialNewSessionChoices`, which seeds both the selectors and the refs `ensureNewSession()` sends; the new composer's first report clears it. A picked model the folder does not list (one carried from another project's `enabledModels`, or one since scoped out) goes back to automatic when the model list loads; a kept one gets its own pinned reasoning level. An empty list keeps the pick: a failed load answers 200 with no models (`withSafeModelLoadFailure`), and a transient failure must not drop the user's choice. The tool preset needs nothing: every fresh composer starts from the stored pick (`tool-preset-preference`). Known limits: an image still being compressed at the switch is dropped; an `ensure_session` wrapper already started in the old cwd (System or Tools opened) idles out; `@`-mentions move as plain text.
 
8383
  cursor: pointer;
8384
  diff --git a/app/ui.css b/app/ui.css
8385
  new file mode 100644
8386
+ index 0000000..69db8d7
8387
  --- /dev/null
8388
  +++ b/app/ui.css
8389
+ @@ -0,0 +1,634 @@
8390
  +/* The shared components on Base UI (components/ui/*): menus, tooltips,
8391
  + popovers and the composer's suggestion list. Popups are portaled to <body>,
8392
  + so they stack by the positioner's z-index, above every pane. */
 
8881
  +.composer-place-trigger .project-picker-name { max-width: 24ch; color: inherit; font-family: inherit; }
8882
  +.composer-place-trigger .project-picker-leaf { color: inherit; }
8883
  +.composer-place-trigger .project-picker-parent { color: var(--text-dim); }
8884
+ +/* A branch is code, as everywhere (the design system's type): 12px code type.
8885
+ + Centred, Geist Mono's baseline sits 1px above Geist's at 13px: a 2px top
8886
+ + margin moves the centred box down that 1px, onto the mode's baseline. */
8887
+ +.composer-place-trigger .project-picker-path { max-width: 20ch; margin-top: 2px; color: inherit; font-family: var(--font-mono); font-size: 12px; }
8888
  +.composer-place-trigger .is-linked { color: var(--accent); }
8889
  +/* On the mode label's baseline: Geist's glyphs at 13px take 15px (a line box of
8890
  + 1, the mode's, would cut the clipped name's descenders; "normal", 16px, sat
 
27703
  +## Connectors (`lib/mcp-presets.ts`)
27704
  +Settings › MCP is called Connectors. "Add Hugging Face" goes through the ordinary add route (pi syntax kept, so the header's `!command` stays as written): `Authorization` is printed on every connection from `HF_TOKEN` or the token the Space lends the machine (`~/.cache/huggingface/token`). pi resolves header values uncached (`resolveConfigValueUncached`), so a refreshed token is used at the next connection and a token taken back fails the connection instead of leaking a stale one.
27705
  diff --git a/docs/agents/sessions.md b/docs/agents/sessions.md
27706
+ index 42e1816..3dbf55f 100644
27707
  --- a/docs/agents/sessions.md
27708
  +++ b/docs/agents/sessions.md
27709
  @@ -38,7 +38,7 @@ On mount `useAgentSession` loads the history, then `GET /api/sessions/[id]/state
 
27723
  -- One picker, two places: `components/ProjectWorktreePicker.tsx` is the files' project and worktree boxes (`layout="stacked"` in the Files tab, `"row"` below the sessions: one instance, only the prop follows the layout; both are `stacked` inside, `layout !== "inline"`, with the files' extras: the activity dot, the worktree hint, the menus' minimum width) and the bar above a fresh composer (`layout="inline"`, inside `components/NewSessionContextBar.tsx`, which adds only the focus after a move and the home folder for the paths (the menus', a detached checkout's in the worktree button), asked for once per page). The files' are two boxes, main's files-tab look: the header buttons' grey box, 11px, the project's whole path (`~` for the home folder; no icon, no chevron) and the worktree's branch (branch icon, accent for a linked checkout, "main", the count, a chevron) in code type, cut at their left. The Files tab's are full width, one under the other; below the sessions they sit side by side in one 26px row (`.project-picker.is-row`, app/globals.css: the worktree box as wide as its branch and notes up to 55% of the row, a share that is safe there since the row is the head's whole width; the project box takes the rest, its path cut at its left; the worktree box drops the main checkout's "main" note there, which on a narrow sidebar left the branch no room, the icon's color still telling main from linked; its menu, wider than the box, opens from the box's right edge, `align: "end"`, so it grows over the sidebar rather than past it over the chat). The bar's are text on the page (`.project-picker.is-inline`): no box until hovered or open (`--bg-hover`), 12px, 26px high, 2px apart; a 12px folder icon (`--text-dim`), the project's name in code type and a chevron; the branch icon (accent for a linked checkout), the branch and a chevron, with no "main" note and no count. The name is the menus' (`describeProjectChoices()`): the display name, else the folder's, a dim `parent/` before it only where two projects share it, the parent cut first (`flex-shrink: 1000000`, the "/" never) so the name stays whole; the whole path is the tooltip and the desktop menu's rows. Names there, paths in the files: the bar answers which project the session joins, named as its group header will name it, while the files' boxes stand over the folder the explorer lists. The bar's row never wraps: the worktree button gives way first (`flex-shrink: 1000000`; shrinking with their text, a 30-odd-character branch took the last pixels off a short name at 375px, and at 1000 the name still lost 2/64px, enough for its ellipsis), the branch cut at its left, then the name at its end, down to minimum widths of their own (72px, 56px; the branch capped at 32ch, the name at 28ch), never shares of the row (a lone button squeezed to a share of itself once ended up 0px wide). Both take the sidebar's `NewSessionContext` (the files tab a stand-in with `project: null` and every project while there is no cwd: `ProjectWorktreeContext`), both menus are `SidebarMenu`s (a bottom sheet on phones, keyboard navigation, a filter field from 8 choices on; the field and its "no match" status stand outside the `role="menu"` list, inside a dialog), and the menus offer the same in both places: the projects (the one in use checked, names with a parent folder only where names collide, the full path as tooltip; the files tab adds the group headers' `ActivitySummary` per project and a dot in its box for activity elsewhere), then "Use default directory" and "Open another project…"; the worktrees (the current one checked, "main" noted), then "New worktree…" (`WorktreeCreateForm` as the menu's body). Only the files tab passes `onRemoveWorktree`: each linked checkout gets a trash button (`SidebarMenuItem.secondary`); a dirty checkout or a failure turns the menu into a removal body (Force, focus on Cancel: the body's own on a desktop, the sheet's through `focusCancel` on a phone, never Force as the first control; the menu's `id` drops an answer meant for an older body), a removed one goes back to the list. The picker hands `SidebarMenu` one child, null for a list: two conditional children arrive as an array, which `hasCustomMenuBody()` reads through `Children.toArray` so `[false, false]` is still no body. On a desktop both places' menus look as main's dropdowns did (`classic` on `SidebarMenu`, at least as wide as their box): rows divided by lines, 11px, the projects' whole paths and the branches in code type cut at their left, "Custom path…" for another folder, no line before "New worktree…", whose form shows under the list (`footer`) in its place, a dirty checkout's question in that checkout's row (a `custom` entry; its Cancel goes back to the list) and a failure under the list; the project filter shows past 8 projects, as there (`minChoices`). The phone's sheets keep the names and "Open another project…". Picking the checkout in use does nothing in both places, and so does picking the project in use while its worktrees are listed (it would move a worktree back to the root); without the list (a removed worktree's cwd, grouped under its main project, gets a 403 listing) the project in use is the one-click way back to its root, and the owners ignore a pick of the cwd already in use. Each place keeps its own moves through callbacks: the files tab's `handleFilesPick` installs the picked identity (`setValidatedProject`, as `startNewSessionIn` does, so a pinned project without sessions keeps its server key) and moves the sidebar's cwd (the composer is remounted and its draft parked, as for any cwd change), the bar goes through AppShell as below. Both create through the sidebar's `createWorktree()` and move there only while the form is still open; opening a worktree menu refetches the list. The sessions' "Open another project…" goes to the files (`revealFiles("project-list")`: the files tab, or the section below opened) and opens the picker's project menu through its handle (`ProjectWorktreePickerHandle.openMenu`) once they show.
27724
  -- The empty new-session page has a project/worktree bar above the composer (`components/NewSessionContextBar.tsx`, in ChatWindow's `newSessionContextBar` slot, shown only while `isEmptyNew`). The header (`.new-session-hero`, the composer's side padding and width) is two rows on the composer's left edge, nothing on the right: the brand (`.new-session-brand`: the 40px logo, 32px on phones; "Pi Web" in code type, 22px/700, 20px on phones, over one 11px `--text-dim` line: "web v<app>", then "→ v<latest> ↗" while a newer release exists (`NewSessionUpdateLink`, `--accent`), "·" and "pi v<pi>", which alone gives way, its ellipsis, where the line is narrow), then, 20px below (16px on phones), the bar, the header's last child, 6px above the composer card. The bar is a 28px row (36px with a coarse pointer's buttons) pulled left by the project button's own 6px padding, so its folder icon stands on the logo's and the card's edge. It has no visible label: the folder icon says it, and the group keeps its name (`workspace.newSessionContext`). The update link's hover and focus box, and a coarse pointer's taller tap target, are padding offset by equal negative margins: the line never moves; the focus ring is drawn inside that box (`outline-offset: -2px`), clear of the "→" and "·". The update check runs once per page (`checkAppUpdate()`), so the header of each composer a move remounts has the link in its first paint rather than the line growing under the reader's eyes. While the phone keyboard is up only the bar hides (client-platform.md); the brand stays. The sidebar still owns the cwd and the identity: it reports a `NewSessionContext` (`lib/new-session-context.ts`) through `onNewSessionContextChange`, only when its signature (`newSessionContextKey()`) changes, since the tree is rebuilt on every refresh and running poll. Projects are the sidebar's groups in their order (pinned projects without sessions included), then projects that have sessions but no group (`recentProjects` through `mergeProjectChoices()`: all their sessions archived, or pinned in the pinned section while the project itself is not); worktrees are listed only where the files tab offers its switcher (the top of a git checkout), so a subdirectory or non-git folder shows only the project. AppShell renders the bar with `contextForCwd()`, which covers the commit in which the report still describes the previous cwd. A sibling worktree in the report's list is enough there; anything else would show the folder as a project of its own with no worktree button (and the next bar's focus request would fall back to the project button for good), so AppShell keeps the bar's last accepted move (`newSessionMoveRef`: cwd, project, and the branch of a worktree `handleCreateNewSessionWorktree` just made) and passes it along until the sidebar reports that cwd: the move's project is shown, and a checkout of the reported project the list lacks joins it as the current worktree. Opening the worktree menu refetches the list (`refreshWorktrees()`): worktrees come and go from the CLI and other windows.
27725
  +- File tabs belong to a project (worktrees of one project share them; terminal tabs are grouped by working folder, `lib/terminal-tabs.ts`, and the Terminal pane follows the folder by itself). Every project switch (`handleCwdChange`, `handleSelectSession`, `handleNewSession`) goes through `changeFileWorkspace()`: the tabs, the active file and whether the panel showed it are parked by project key in page memory (`switchFileWorkspace()`, `components/file-tab-state.ts`; no file contents, gone on reload) and the target project's come back. Only the active `FileViewer` is mounted, and it reports its mode, wrap and scroll as it unmounts, which is after the switch: the report carries the workspace generation it rendered in (also part of its `key`, so a same-path tab in the next project remounts), and one from an earlier generation goes to the parked tabs (`saveParkedFileViewerState()`), never to a restored tab with the same path. A restored tab whose file is gone shows the viewer's error, as an open tab does.
27726
+ +- One picker, two places: `components/ProjectWorktreePicker.tsx` is the files' project and worktree boxes (`layout="stacked"` in the Files tab, `"row"` below the sessions: one instance, only the prop follows the layout; both are `stacked` inside, `layout !== "chin"`, with the files' extras: the activity dot, the worktree hint, the menus' minimum width) and the buttons in a fresh composer's chin (`layout="chin"`, inside `components/NewSessionContextBar.tsx`, which adds only the focus after a move and the home folder for the paths (the menus', a detached checkout's in the worktree button), asked for once per page). The files' are two boxes, main's files-tab look: the header buttons' grey box, 11px, the project's whole path (`~` for the home folder; no icon, no chevron) and the worktree's branch (branch icon, accent for a linked checkout, "main", the count, a chevron) in code type, cut at their left. The Files tab's are full width, one under the other; below the sessions they sit side by side in one 26px row (`.project-picker.is-row`, app/globals.css: the worktree box as wide as its branch and notes up to 55% of the row, a share that is safe there since the row is the head's whole width; the project box takes the rest, its path cut at its left; the worktree box drops the main checkout's "main" note there, which on a narrow sidebar left the branch no room, the icon's color still telling main from linked; its menu, wider than the box, opens from the box's right edge, `align: "end"`, so it grows over the sidebar rather than past it over the chat). The chin's are the mode's own buttons (`ui-btn ui-btn--sm composer-place-trigger`, app/ui.css), 28px, 2px apart: a 14px Carbon folder icon, the project's name in the chin's type and a 12px chevron; the branch icon (accent for a linked checkout), the branch in 12px code type (a branch is code everywhere; a 2px top margin puts Geist Mono's centred baseline on Geist's) and a chevron, with no "main" note and no count; their menus open upward (`side: "above"` on the anchor, below only without room), as the chin's others do. The name is the menus' (`describeProjectChoices()`): the display name, else the folder's, a dim `parent/` before it only where two projects share it, the parent cut first (`flex-shrink: 1000000`, the "/" never) so the name stays whole; the whole path is the tooltip and the desktop menu's rows. Names there, paths in the files: the bar answers which project the session joins, named as its group header will name it, while the files' boxes stand over the folder the explorer lists. The chin's row never wraps: the worktree button gives way first (`flex-shrink: 1000000`; shrinking with their text, a 30-odd-character branch took the last pixels off a short name at 375px, and at 1000 the name still lost 2/64px, enough for its ellipsis), the branch cut at its left, then the name at its end, down to minimum widths of their own (28px, 52px; the branch capped at 20ch, the name at 24ch; in a chin under 400px the branch is its icon and the name 12ch), never shares of the row (a lone button squeezed to a share of itself once ended up 0px wide). Both take the sidebar's `NewSessionContext` (the files tab a stand-in with `project: null` and every project while there is no cwd: `ProjectWorktreeContext`), both menus are `SidebarMenu`s (a bottom sheet on phones, keyboard navigation, a filter field from 8 choices on; the field and its "no match" status stand outside the `role="menu"` list, inside a dialog), and the menus offer the same in both places: the projects (the one in use checked, names with a parent folder only where names collide, the full path as tooltip; the files tab adds the group headers' `ActivitySummary` per project and a dot in its box for activity elsewhere), then "Use default directory" and "Open another project…"; the worktrees (the current one checked, "main" noted), then "New worktree…" (`WorktreeCreateForm` as the menu's body). Only the files tab passes `onRemoveWorktree`: each linked checkout gets a trash button (`SidebarMenuItem.secondary`); a dirty checkout or a failure turns the menu into a removal body (Force, focus on Cancel: the body's own on a desktop, the sheet's through `focusCancel` on a phone, never Force as the first control; the menu's `id` drops an answer meant for an older body), a removed one goes back to the list. The picker hands `SidebarMenu` one child, null for a list: two conditional children arrive as an array, which `hasCustomMenuBody()` reads through `Children.toArray` so `[false, false]` is still no body. On a desktop both places' menus look as main's dropdowns did (`classic` on `SidebarMenu`, at least as wide as their box): rows divided by lines, 11px, the projects' whole paths and the branches in code type cut at their left, "Custom path…" for another folder, no line before "New worktree…", whose form shows under the list (`footer`) in its place, a dirty checkout's question in that checkout's row (a `custom` entry; its Cancel goes back to the list) and a failure under the list; the project filter shows past 8 projects, as there (`minChoices`). The phone's sheets keep the names and "Open another project…". Picking the checkout in use does nothing in both places, and so does picking the project in use while its worktrees are listed (it would move a worktree back to the root); without the list (a removed worktree's cwd, grouped under its main project, gets a 403 listing) the project in use is the one-click way back to its root, and the owners ignore a pick of the cwd already in use. Each place keeps its own moves through callbacks: the files tab's `handleFilesPick` installs the picked identity (`setValidatedProject`, as `startNewSessionIn` does, so a pinned project without sessions keeps its server key) and moves the sidebar's cwd (the composer is remounted and its draft parked, as for any cwd change), the bar goes through AppShell as below. Both create through the sidebar's `createWorktree()` and move there only while the form is still open; opening a worktree menu refetches the list. The sessions' "Open another project…" goes to the files (`revealFiles("project-list")`: the files tab, or the section below opened) and opens the picker's project menu through its handle (`ProjectWorktreePickerHandle.openMenu`) once they show.
27727
  +- The empty new-session page has the brand above the composer and the project/worktree picker in the composer's chin, after "+" and before the mode (`components/NewSessionContextBar.tsx`, ChatWindow's `newSessionContextBar` slot passed to ChatInput's `placePicker`, shown only while `isEmptyNew`), as Claude Code Desktop's start page puts its folder and branch in the composer's environment bar (desktop-shell.md, "The chin"). The header (`.new-session-hero`) has the composer shell's sides (app/ui.css, with `.chat-input-shell`: 16px, 26px on the right on a desktop for the message list's scrollbar gutter) and the column's width, so the logo stands on the card's left edge, nothing on the right: the brand (`.new-session-brand`: the 40px logo, 32px on phones; "Pi Web" in code type, 22px/700, 20px on phones, over one 11px `--text-dim` line: "web v<app>", then "→ v<latest> ↗" while a newer release exists (`NewSessionUpdateLink`, `--accent`), "·" and "pi v<pi>", which alone gives way, its ellipsis, where the line is narrow), 20px above the composer card (16px on phones). The picker has no visible label: the folder icon says it, and the group keeps its name (`workspace.newSessionContext`). The update link's hover and focus box, and a coarse pointer's taller tap target, are padding offset by equal negative margins: the line never moves; the focus ring is drawn inside that box (`outline-offset: -2px`), clear of the "→" and "·". The update check runs once per page (`checkAppUpdate()`), so the header of each composer a move remounts has the link in its first paint rather than the line growing under the reader's eyes. While the phone keyboard is up the chin's left side hides, the picker with it (client-platform.md); the brand stays. The sidebar still owns the cwd and the identity: it reports a `NewSessionContext` (`lib/new-session-context.ts`) through `onNewSessionContextChange`, only when its signature (`newSessionContextKey()`) changes, since the tree is rebuilt on every refresh and running poll. Projects are the sidebar's groups in their order (pinned projects without sessions included), then projects that have sessions but no group (`recentProjects` through `mergeProjectChoices()`: all their sessions archived, or pinned in the pinned section while the project itself is not); worktrees are listed only where the files tab offers its switcher (the top of a git checkout), so a subdirectory or non-git folder shows only the project. AppShell renders the picker with `contextForCwd()`, which covers the commit in which the report still describes the previous cwd. A sibling worktree in the report's list is enough there; anything else would show the folder as a project of its own with no worktree button (and the next bar's focus request would fall back to the project button for good), so AppShell keeps the bar's last accepted move (`newSessionMoveRef`: cwd, project, and the branch of a worktree `handleCreateNewSessionWorktree` just made) and passes it along until the sidebar reports that cwd: the move's project is shown, and a checkout of the reported project the list lacks joins it as the current worktree. Opening the worktree menu refetches the list (`refreshWorktrees()`): worktrees come and go from the CLI and other windows.
27728
  - Every move from the bar goes through AppShell's `handlePickNewSessionContext()`, which refuses unless the composer is fresh and the target differs from its cwd, then calls `SessionSidebarControl.startNewSessionIn({ …, carryComposer: true })` (the sidebar's imperative handle, made once, calling the newest closures): identity, cwd, then `handleNewSession(…, { carryComposer })` as for any new session, so `handleCwdChange` sees the following report as no switch. With `carryComposer`, `handleNewSession` moves the fresh composer's draft (text and images, the live value through `ChatInputHandle.rekeyDraft`) to the new key instead of parking it; a draft parked in the target cwd comes back only when nothing was carried, never merged. "Open another project…" opens the sidebar's `DirectoryPicker` with `customPathOpen === "new-session"`: the validated folder goes to a callback that runs the same guard (`pickNewSessionContextRef`), and the sidebar's cwd moves only through it. "Use default directory" is `openDefaultDirectoryForNewSession()` on the handle: `/api/default-cwd`, then the same validation (`commitCustomPath(…, { purpose: "new-session" })`) and the same callback; a failure says nothing, as in the files tab. "New worktree…" is `createWorktree()` on the handle: it lists the new worktree at once and refetches even if the bar went away meanwhile; the session starts there only while the bar is mounted and that form is still open. The Files tab's own project and worktree switches still remount the composer and park its draft.
27729
  - The remount would reset the fresh composer's own picks, so they travel with the draft: useAgentSession reports `NewSessionChoices` (model and reasoning overrides) through `onNewSessionChoicesChange`, `handleNewSession` hands the last report to the next composer as `initialNewSessionChoices`, which seeds both the selectors and the refs `ensureNewSession()` sends; the new composer's first report clears it. A picked model the folder does not list (one carried from another project's `enabledModels`, or one since scoped out) goes back to automatic when the model list loads; a kept one gets its own pinned reasoning level. An empty list keeps the pick: a failed load answers 200 with no models (`withSafeModelLoadFailure`), and a transient failure must not drop the user's choice. The tool preset needs nothing: every fresh composer starts from the stored pick (`tool-preset-preference`). Known limits: an image still being compressed at the switch is dropped; an `ensure_session` wrapper already started in the old cwd (System or Tools opened) idles out; `@`-mentions move as plain text.