Merge main (Notebook design) into Glass

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-04 00:12:44 +00:00
304 changed files with 13450 additions and 5590 deletions
+6 -2
View File
@@ -3,8 +3,12 @@
## Behaviour
The authenticated `/connect` protocol stores one bounded ordered open-chat set
per server scope (`default`). Entries hold only an operator session id and a
floating bit; split ratios, pane ids and window rectangles stay on the device.
per server scope (`default`). Entries hold only an operator session id, a
floating bit and an optional chat stack `group` name (entries sharing a name
form one group; trimmed, printable, at most 80 characters, refused otherwise;
older clients ignore it); split ratios, pane ids and window rectangles stay on
the device. The `group` field needs the server rebuilt and restarted: an
older server drops it.
* `chat_open_workspace` without `chat_open_workspace_request` reads the set.
With a request it replaces the set as a compare-and-swap on `base_revision`:
+97 -12
View File
@@ -2,27 +2,49 @@
## Setting
Settings → Mobile chat navigation: Quick switch (default, the next chat's
peek under the current one) or Chat stack. Per device
(`pipelines.mobile-chat-navigation.v1`, `MobileChatNavigationController`,
restored in `bootstrap.dart`), applied live, and only on a phone-width layout
(`!showsListBesideDetail`). A wide window keeps its panes and shows no stack.
Settings → Mobile chat navigation: Chat stack (the default without a stored
choice) or Quick switch (the next chat's peek under the current one). Per
device (`pipelines.mobile-chat-navigation.v1`, `MobileChatNavigationController`,
restored in `bootstrap.dart`; a stored choice is kept), applied live. It
applies on a phone-width layout (`!showsListBesideDetail`); the Chat stack
also stays on a wide layout on Android or iOS (an unfolded foldable, a
tablet, a browser on one), floating above the active pane beside the list
(`chatStackOnMobile`). A wide desktop or web window keeps its panes alone.
Widget tests run as Android: `test/features/chat/flutter_test_config.dart`
starts each chat test on Quick switch (`debugUse`); the stack's tests pick it.
## Behaviour
- The stack's chats are the workspace's panes: the same open-chat set the
server syncs (`ChatOpenWorkspaceController`). Choosing one opens it as a tap
on its list row does (`_openBySelection`); Add chat is the pane menu's Add
chat pane picker (searchable, the list's own rows) titled "Add chat";
long press removes the chat's pane, with an Undo snack bar that re-adds it
and keeps the chat on screen.
chat pane picker (searchable, the list's own rows) titled "Add chat".
- Drag: in the open column a 300 ms hold (a quicker tap still opens) lifts
a chat with its pill: a medium haptic, 1.1x scale and a deeper shadow
(flat designs: a primary-colour frame instead). Dragged up or down, the
others slide aside (200 ms ease-out) to open its slot, with a selection
tick per slot; dropping commits through `ChatWorkspaceController.movePane`
(the pane order the server syncs as the open-chat order). The close
button at the stack's slot is the remove target while dragging: its "×"
turns the error colour, and over it (a reach of 0.7 slot around its
centre, short of item 0 a pitch above) it grows 1.2x and fills with the
error colour, and the chat shrinks into it. Dropping there removes the pane with the Undo snack bar; Undo re-adds
it at its old index and keeps the chat on screen. A drop far to the side
(more than 1.5 pitches) or Escape or a cancelled pointer puts it back.
Add chat never lifts and is never a slot. Semantics: Move up, Move down,
Remove from open chats as custom actions on each chat. Reduced motion:
neighbours swap at once, the lift and settle are instant, the "×" only
fades and does not grow.
- Collapsed: up to four avatars piled with small offsets and turns, the chat
on screen on top; a count badge when more are open, and a bell when another
open chat waits on the operator. It sits bottom-end in the active chat's
transcript area, just above the composer, so it never covers Send; the
transcript pads its last line and Jump to latest above it. It hides while
the on-screen keyboard is up (the window's view insets).
- Expanded: a scrim, and a column rising from the stack's slot. The chats keep
- Expanded: a scrim; the pile turns into a close button ("×", a quarter
turn and scale in, `ChatStackCloseTarget`) exactly where it was, so a
second tap on the same spot folds the column; the column rises from one
pitch above it. The chats keep
the open-chat order bottom-up (stable positions for muscle memory); the chat
on screen wears a ring in its colour; each avatar keeps its list badges
(waiting, working, background tasks) and has a name pill tinted with its
@@ -31,21 +53,84 @@ restored in `bootstrap.dart`), applied live, and only on a phone-width layout
- Motion: one controller, 280 ms open (staggered, a slight-overshoot ease),
220 ms fold (top first). Items move through `ChatStackPoseTransition`, a
repaint-only transform render object that reuses its matrix and layer; no
per-frame rebuilds, no blur. Reduced motion: a 120 ms plain fade in place.
per-frame rebuilds, no blur. A drag adds `ChatStackDragShift` (same idea,
driven by a per-item notifier, no layer at rest); the column rebuilds only
when a drag starts and ends. Reduced motion: a 120 ms plain fade in place.
- Design tokens: circle discs with a short shadow under Default; the design's
square corners and no shadow under flat designs (Terminal, Paper); label
pills take the design radius and frame.
## Groups
- A group is a named set of open chats (`ChatStackGroups`, sessionId → name);
it travels with the open-chat set as each entry's `group`, so it persists
and syncs across devices like the order. Two chats at least: one left
alone leaves its group. Its chats stay together in the open-chat order.
- Top level: each group is one item where its first chat is, its chats piled
as the collapsed stack piles (0.88 scale, the chat on screen on top), the
pill showing its name and count, the bell aggregated. A tap opens it: the
top level fades out (no input) and the group's chats rise from its pile
(280 ms, the same motion as the stack), under a header (back arrow, the
name, a ⋯ menu). The header, the scrim, Back and Escape return to the top
level; a second tap outside folds the stack. Folding always ends on the
top level.
- Drag: the middle half of another item is a drop onto it (it grows 1.14x
and rings in the primary colour, a selection tick); its outer quarters
move the gap (`chatStackDropTarget`: the gap holds within half a slot, so
an item sliding aside never lands back under the finger). Chat onto chat:
a new group ("Group N", the name dialog opens at once, selected); chat
onto group: joins, last; group onto chat: takes it in; group onto group:
merges. In an open group a chat dropped on the header leaves the group
(placed right after it), and the close button removes it from the open
chats. A group dropped on the close button is ungrouped, with Undo.
- Menu (header ⋯) and semantic actions on a group: Rename group, Ungroup,
Close all chats in group (with Undo, restoring order and group). On a
chat: Move up / Move down (within its level), Move to group… (when groups
exist), Remove from group (in a group), Remove from open chats.
- Server: `internal/protocol/chat_open_workspace.go` (`Group`),
`internal/pipeline/chat_open_workspace.go` (validation, stored in the
entries JSON, compared as part of the entry), `internal/server` (copied
through). Needs a server restart.
## Structure
- `lib/features/chat/stack/`: setting, pose, motion, disc/label, column, FAB,
- `lib/features/chat/stack/`: setting, pose, motion, disc/label, column and
its items, drag (session, shift render object, handles, remove target), FAB,
anchor (a `LayerLink` the active pane's transcript marks; the one stack
above the workspace follows it, so it survives switching chats).
- `lib/features/chat/chat_screen_stack.dart`: entries, open/add/remove.
- Groups: `chat_stack_groups.dart` (model), `chat_stack_node.dart` (top-level
items), `chat_stack_group_ops.dart` (orders after a drop),
`chat_stack_drop_target.dart`, `chat_stack_group_pile.dart`,
`chat_stack_group_dialogs.dart`, `chat_stack_column_groups.dart`.
- `lib/features/chat/chat_screen_stack.dart`: entries, open/add/remove;
`chat_screen_stack_groups.dart`: join/leave/rename/ungroup/close all.
- `chat_thread_view.dart`: anchor target, bottom clearance, Jump offset.
- `tool/search_selection_probe_entry.dart`: `?chatNav=stack`.
## Floating chats on a phone
A phone layout (Quick switch or Chat stack) ignores floating: windows are
hidden below `kListDetailMinWidth`, so each floating chat is held as an
ordinary pane (`_phoneDocked` in `chat_screen_workspace.dart`) and the
server's set keeps it `floating`. Widening the window (a foldable opened, a
desktop resized) floats those chats again; closing one on the phone drops
it from the open chats. Tests: `test/features/chat/chat_floating_phone_test.dart`.
## Captures
Drag captures use the kit's mouse `drag` with `press: 700`: with Flutter
web semantics on (the kit turns it on), the engine's click debouncer holds a
press on a tappable node for about 200 ms before the framework sees it, so
a 300 ms hold needs about 500 ms in the browser. Not an issue on a device
without a screen reader.
## Not verified
On-device behaviour (Android keyboard insets, haptics) was not run on a
device; web captures used Chrome's touch emulation at 390x844.
Drag limits: no auto-scroll while dragging; when the column is taller than
the screen it scrolls and clips, so a lifted chat cannot leave the clipped
column to reach the "×" there (Move and Remove remain as semantic actions).
The drag captures used the mouse (CDP), not touch; on-device haptics and the
hold feel are unverified.
+99
View File
@@ -0,0 +1,99 @@
# Notebook design
A notebook IDE look (Settings > Design > Notebook, id `notebook`): the chat
as numbered Jupyter-style In/Out cells with tool calls as collapsible
sub-cells, a white page (neutral charcoal in dark), light grey cells,
hairline borders, 5px corners, the device's interface sans for chrome and
the bundled RobotoMono for code, tool sub-cells and gutter labels.
## Tokens and modes
`notebookTheme()` (`lib/ui/theme/notebook_theme.dart`, palette and controls
beside it) sets:
- `transcript: TranscriptStyle.cells` (new). Other designs never take it.
- `composer: ComposerStyle.cell` (new): `composer_cell.dart`.
- `selectedRow: washed` (left accent bar plus a light fill), `radius: 5`,
`flat`, `frame: outlineVariant`, `panel`: white (raised grey in dark),
Notebook ANSI accents, `chatColorSaturation: 0.7`.
- `reading`: the interface sans at 15/16 of `bodyLarge`, line height 1.5.
Both new enum values are additions; every existing design keeps its own
value, so nothing else changes. Exhaustive switches on `TranscriptStyle`
gained a `cells` case (bubble, activity view, automated prompt).
## The cells transcript
`lib/features/chat/ui/transcript/notebook/`:
- `notebook_gutter.dart`: `NotebookGutterRow`, a fixed-width gutter (ten
monospace characters at 0.8 of the reading size, scaled with text, plus an
8px gap) holding the right-aligned label on the cell's first-line strut, so
it shares that line's baseline. Below 600px of row width (a phone) the label moves
inline above the cell. Rows that are not cells (shell runs, notices,
activity groups) get an empty gutter (`chat_thread_view.dart`), and a
`NotebookGutterScope` stops nested rows indenting twice.
- `notebook_input_cell.dart`: the operator's `In [n]:` cell (cell grey, 7%
of the chat colour, 3px bar in the chat colour, else the accent); the
scheduled cell for follow-ups, auto-continues (tag `scheduled`) and account
switches (tag `switched`) with an outline bar; `NotebookTag`.
- `notebook_tool_cells.dart` / `notebook_tool_cell.dart`: each tool call a
sub-cell: chevron, bold name and dim arguments, duration and a status icon
on the right (painted `NotebookGlyph`s, not Icons); collapsed it previews
the output's first line with "+N lines" at that line's end; the header
expands it in place (input and up to 400 output
lines, built only when open). The latest 8 calls show, earlier ones behind
"Show N earlier tool calls". The status line under them ("Used 6 tools ·
1 failed", or the live label and seconds) opens Activity details.
- `notebook_cell_frame.dart`: one `CustomPainter` per cell (fill, clipped
leading bar, 1px border), no layers.
- Sub-cell headers and the status line are a `GestureDetector` with the
click cursor and a Semantics button, not an `InkWell`: an InkWell per
sub-cell roughly doubled the elements a tool-heavy row builds and put the
design over the per-row rebuild budget. Keyboard users reach the same
content through Activity details; no hover ink on headers.
Numbering: `chatCellNumbers()` (`domain/chat_cell_numbers.dart`) numbers
operator turns from 1 in transcript order and gives each following answer
its prompt's number. It is derived, not stored, so a reload numbers the same;
with older history not yet loaded, numbering starts at the oldest loaded
turn (the server sends no absolute turn index). Queued or unsent prompts read
`In [ ]:`. A running answer shows `[*]` under its `Out [n]:`. The thread view
passes the number into `ChatMessageView.cell` (and the row cache's deps),
only under the cells transcript.
Under cells, answers keep their Read aloud/Copy on the footer line (shown on
hover) rather than the left Copy gutter, so short Out cells keep the
In/Out rhythm: 6px above an In cell, 3px between In and Out, 6px under an
Out cell.
## Composer
`ComposerCell`: `In [ ]:` in the same gutter, the field in a cell-grey frame
whose border and bar take the chat's accent on focus; a 2px running line at
its foot while a turn runs. Padding is the pill's 4px edge gap plus 3px, so
the usage ring (40px send button, 3px gap, following the 5px radius) clears
the cell's hairline. The send keys are unchanged.
## Still default
Markdown inside answers (headings, lists, code blocks) uses the standard
transcript styling in the interface font; chips, permission cards, task
cards, the chat stack discs and the graph follow the generic flat/radius/
panel/frame tokens with no Notebook-specific code. Typography is Material's
apart from semibold, tighter titles.
## Perf
Widget bench (`test/perf/design_bench_test.dart`): scrollRebuildsPerRow
about 99 against Default's 83.5 (budget 105.3); layers 8.2/frame, no
clipPath or saveLayer beyond Default's opacity count. Browser bench
(`design_bench.mjs --designs notebook`, skwasm CPU): PASS, notebook's
build/raster means below Default's in every scenario. The per-frame theme
switch test (`compact_switch_test.dart`) includes Notebook.
No `saveLayer`, blur or clip layers: cells paint in one picture each; the
expanded output is built only when opened; a tool cell memoises its preview
so a running turn's one-second tick does not resplit outputs. The theme is
value-equal on rebuild (identity-compared resolvers and indicators cached
per colour). Run the design budget (tool/perf/README.md) after changes.
+54
View File
@@ -0,0 +1,54 @@
# Graph stage popover
## Change
- Tapping (or pressing Enter on) a stage in the pipeline graph or the run graph,
inline or full screen, opens a small card anchored to the node with a nub
pointing at it. It no longer navigates straight to the definition page.
- The card shows: the name, a type chip (Model, Check, Delivery gate, Findings
gate, Human, End), config chips (harness, short model name, effort, timeout,
retries, budget), tools as chips (the server's default set is labelled
`Tools · default` when no block is declared), permission allow-lists behind a
collapsed `Permissions` line, skills, then the prompt as markdown clamped to
ten lines with a fade and `Show all`. A check stage lists its commands, a
findings gate its severity and origin, a human stage its operator
instructions. Limits and outgoing routes close it.
- In a run it also shows the latest status, `×N` visits, the latest visit's
duration, reported tokens/cost over all visits, the latest verdict, the first
line of the handoff and the failure diagnostic when the latest visit failed.
- Actions: `Open definition` (the old tap target) and, for a visited run stage,
`Open visit` (the old run-graph tap target). An unvisited run stage now opens
its declaration too; it simply has no `Open visit`.
- The open stage is marked selected and its routes get a soft highlight; edge
hover and the edge tooltip work as before.
## Decisions
- Follows the node on pan and zoom instead of closing: the card lays out in
the overlay against the live viewport transform, so a drag, wheel or pinch
keeps it on its node. Only a tap (down and up within touch slop) outside the
card and its node, Escape, the close button or tapping the node again closes
it; tapping another node replaces it.
- Placement: above, else below, else right, else left, else the roomier of
above/below with the body scrolling. The card stays inside the viewport and
clear of floating bars (the canvas's MediaQuery padding); 400 px wide and at
most 560 px tall.
- Below a 440 px wide (or 300 px tall) viewport the same content opens in a
modal bottom sheet.
- Surface follows the design tokens: Classic is a raised card with a hairline
and 14 px corners; flat designs (Terminal, Paper, Compact) use their panel
fill, frame and radius with no shadow. No blur. Route arrows are icons since
the Terminal face has no U+2192.
- Built lazily: nothing is built while closed, and the global pointer route
and transform listener exist only while a card is open.
Changed paths (under `app/`): `lib/features/graph/{domain/stage_summary.dart,
domain/stage_run_facts.dart, painting/stage_edges_highlight.dart,
painting/run_graph_edge_layer.dart, viewport/graph_viewport_scope.dart,
viewport/graph_viewport.dart, widgets/graph_stage_popover.dart,
widgets/stage_popover_position.dart, widgets/stage_popover_card.dart,
widgets/stage_popover_parts.dart, widgets/stage_popover_chips.dart,
widgets/run_graph_parts.dart, widgets/run_graph_canvas.dart,
widgets/run_graph_view.dart, widgets/definition_graph_canvas.dart,
widgets/definition_graph_view.dart}`, `tool/perf/perf_fixture.dart` (the
`graph=1` fixture now has a prompt, configs, tools and a check stage).
+1 -1
View File
@@ -5,7 +5,7 @@
- `android/.../notify/NotificationThreads.kt` (new): `ThreadEntry`, `ThreadHistory`
(bounded per-thread entries, bounded thread count, persisted through the
ledger's `LedgerStore` under `threads.history`), and naming helpers. Threads are
keyed by the server `group` (`chat:<id>` or `run:<id>`, per `docs/ntfy.md`).
keyed by the server `group` (`chat:<id>` or `run:<id>`, per `docs/notifications.md`).
- `NotificationPresenter.kt`: a grouped notification posts one conversation
notification per thread with a stable id (`thread:<group>`), the latest 5 lines
(sender = chat title, run title for runs), the unread count (`setNumber`), and a
+32
View File
@@ -0,0 +1,32 @@
# ntfy removal (app side)
Operator decision: ntfy is removed from Pipelines. Every client gets
notifications from the server's own app notification stream: browser
Notification on web, the "Receive notifications in Pipelines" background
service or the in-app bridge on Android, the in-app bridge on iOS/macOS.
## Change
- Settings "Phone notifications" (ntfy) section replaced by **Notification
events** (`lib/features/settings/settings_notification_settings_section.dart`,
controller `notification_settings_controller.dart`; section id
`notification-events`, still in the phone-first order). It shows the three
server-stored switches `run_finished`, `chat_needs_you`,
`chat_reply_finished` with the subtitle "What the server notifies about.
Stored on the server, so these apply to every device signed in to it."
- The `ntfy_enabled` switch is gone; a reply that still carries it is ignored
(only the three known keys are decoded) and writes send only the toggled key.
- Search keywords no longer mention ntfy.
- "Notifications in Pipelines" note no longer mentions the ntfy app.
- Comments in `agent_notice.dart` (docs/notifications.md, priority 1-5),
`notification_service_bridge.dart`, `AndroidManifest.xml`,
`NotificationService.kt`, `NotificationProtocol.kt` drop ntfy.
- `chat_shown_notify_row.dart` still renders a `phone` channel for transcript
entries recorded before the change; new entries only carry `apps`.
## Checks
- `tool/analyze.sh`: clean.
- memwatch `test/features/settings`: 216 passed; `test/features/attention`:
159 passed; `test/features/notification_service`: 11 passed.
- No browser capture taken for the renamed section.
+1 -1
View File
@@ -11,7 +11,7 @@ not only on the web and then I have to clear again on mobile."
device has open, records a per-session `chat_seen` watermark in epoch ms.
ntfy notifications already shown on a phone cannot be retracted (see
`docs/ntfy.md`, "Clearing notifications across devices").
`docs/notifications.md`, "Clearing notifications across devices").
## Protocol (server, `internal/protocol/attention_acks.go`)