From 3089bcd4372eda63c894ea24a86b12428c3c6212 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Thu, 3 Dec 2026 23:07:16 +0000 Subject: [PATCH] Chat stack groups: the dragged chat shrinks onto a drop target; notes Over another item's middle the lifted item shrinks (as over the close button), so the target's grown ring stays visible; a group's pile is 0.88 of a chat's disc. Notes for groups and the open-chat group field. Co-Authored-By: Claude Opus 5.5 --- .../features/chat/stack/chat_stack_drag.dart | 14 ++++++- .../chat/stack/chat_stack_group_pile.dart | 2 +- app/notes/chat-open-workspace-sync.md | 8 +++- app/notes/chat-stack.md | 39 ++++++++++++++++++- .../stack/chat_stack_group_screen_test.dart | 5 +++ 5 files changed, 63 insertions(+), 5 deletions(-) diff --git a/app/lib/features/chat/stack/chat_stack_drag.dart b/app/lib/features/chat/stack/chat_stack_drag.dart index 371380b0..c481b8e2 100644 --- a/app/lib/features/chat/stack/chat_stack_drag.dart +++ b/app/lib/features/chat/stack/chat_stack_drag.dart @@ -28,8 +28,16 @@ class ChatStackDrag extends ChangeNotifier { ); hover = AnimationController(vsync: vsync, duration: chatStackHoverDuration) ..addListener(_paintLifted); + _ontoAny = AnimationController( + vsync: vsync, + duration: chatStackHoverDuration, + )..addListener(_paintLifted); } + /// 1 while the item is over another's middle: it shrinks onto it, so the + /// target's grown ring shows around it. + late final AnimationController _ontoAny; + final TickerProvider _vsync; /// The distance between neighbouring slots. @@ -154,6 +162,7 @@ class ChatStackDrag extends ChangeNotifier { if (onto != null) HapticFeedback.selectionClick(); if (before != null) _run(glow(order[before]) as AnimationController, 0); if (onto != null) _run(glow(order[onto]) as AnimationController, 1); + _run(_ontoAny, onto == null ? 0 : 1); } if (slot != _slot) { if (slot != null && _slot != null) HapticFeedback.selectionClick(); @@ -213,6 +222,7 @@ class ChatStackDrag extends ChangeNotifier { if (_over) HapticFeedback.selectionClick(); _over = false; _onto = null; + clearGlowAtOnce ? _ontoAny.value = 0 : _run(_ontoAny, 0); for (final glow in _glows.values) { clearGlowAtOnce ? glow.value = 0 : _run(glow, 0); } @@ -259,7 +269,8 @@ class ChatStackDrag extends ChangeNotifier { // rim shows around it. final scale = lerpDouble(1, chatStackLiftScale, _curve.transform(lift.value))! * - lerpDouble(1, chatStackOverRemoveScale, hover.value)!; + lerpDouble(1, chatStackOverRemoveScale, hover.value)! * + lerpDouble(1, chatStackOverRemoveScale, _ontoAny.value)!; final offset = _order != null ? _pointer : _residual * (1 - _curve.transform(settle.value)); @@ -318,6 +329,7 @@ class ChatStackDrag extends ChangeNotifier { settle.dispose(); removeShown.dispose(); hover.dispose(); + _ontoAny.dispose(); for (final controller in [..._shifts.values, ..._glows.values]) { controller.dispose(); } diff --git a/app/lib/features/chat/stack/chat_stack_group_pile.dart b/app/lib/features/chat/stack/chat_stack_group_pile.dart index f890b008..1b34d2e7 100644 --- a/app/lib/features/chat/stack/chat_stack_group_pile.dart +++ b/app/lib/features/chat/stack/chat_stack_group_pile.dart @@ -7,7 +7,7 @@ import 'chat_stack_pose.dart'; /// A group's pile is the collapsed stack's, this much smaller, so it keeps /// inside its slot. -const double chatStackGroupPileScale = .8; +const double chatStackGroupPileScale = .88; /// How many of a group's chats its pile draws. const int chatStackGroupLayers = 3; diff --git a/app/notes/chat-open-workspace-sync.md b/app/notes/chat-open-workspace-sync.md index cd21250a..b894a3bf 100644 --- a/app/notes/chat-open-workspace-sync.md +++ b/app/notes/chat-open-workspace-sync.md @@ -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`: diff --git a/app/notes/chat-stack.md b/app/notes/chat-stack.md index 13f3d3c1..417a0f48 100644 --- a/app/notes/chat-stack.md +++ b/app/notes/chat-stack.md @@ -60,13 +60,50 @@ starts each chat test on Quick switch (`debugUse`); the stack's tests pick it. 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 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`. diff --git a/app/test/features/chat/stack/chat_stack_group_screen_test.dart b/app/test/features/chat/stack/chat_stack_group_screen_test.dart index a1c58d4f..c98a650b 100644 --- a/app/test/features/chat/stack/chat_stack_group_screen_test.dart +++ b/app/test/features/chat/stack/chat_stack_group_screen_test.dart @@ -188,6 +188,11 @@ void main() { tester.getRect(_chat(tester, 'b')).width, closeTo(b.width * chatStackOntoScale, .5), ); + // The dragged chat shrinks onto it, so the target's ring shows around. + expect( + tester.getRect(_chat(tester, 'a')).width, + closeTo(b.width * chatStackLiftScale * chatStackOverRemoveScale, .5), + ); await gesture.up(); await tester.pumpAndSettle(); await tester.enterText(