feat(ui-workspace): reorder ungrouped sessions

This commit is contained in:
_Kerman
2026-08-11 19:14:57 +08:00
parent 94897de821
commit 5bb70d7cf2
10 changed files with 156 additions and 43 deletions

View File

@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write .agents/notes/implemented/feature/2026-08-11-workspace-sidebar-order-and-folding.md
2026-08-11-workspace-sidebar-order-and-folding.md: 78d8399b2f5cb1f8f33ffe3ba89ff27944ae8e63
2026-08-11-workspace-sidebar-order-and-folding.zh.md: 87449ddd7265a6bcb11d7a2e4ffc8ac2a5c9257c
2026-08-11-workspace-sidebar-order-and-folding.md: ad011d313dfea3e0c1992946230e3d9577646520
2026-08-11-workspace-sidebar-order-and-folding.zh.md: a3391113869e4c9002ee0a803bb40fc11c523f68

View File

@@ -20,9 +20,9 @@ The client installs a Workspace drag optimistically. Request and frame generatio
### Session folding and view order
Each Workspace persists one browser-local open state: closed means zero Session rows and open means up to five. When more Sessions exist, **Show more** reveals the remainder only for the current mount; closing the whole Workspace clears this transient expansion, so reopening returns to five. The current Session's group opens automatically only when the user has not already stored an explicit state for that Workspace. After a ready Workspace baseline changes, the browser removes expansion, order, and observed-timestamp records for ids absent from that baseline while retaining the Ungrouped expansion key.
Each Workspace persists one browser-local open state: closed means zero Session rows and open means up to five. When more Sessions exist, **Show more** reveals the remainder only for the current mount; closing the whole Workspace clears this transient expansion, so reopening returns to five. The current Session's group opens automatically only when the user has not already stored an explicit state for that Workspace. After a ready Workspace baseline changes, the browser removes expansion, order, and observed-timestamp records for ids absent from that baseline while retaining the Ungrouped key for expansion, order, and observed timestamps.
The combined view menu offers **Manual** and **Last updated** over one browser-local, persisted per-Workspace order initialized from `WorkspaceView.sessionIds`. Entering Last updated performs one complete recency sort; a later user prompt or steer promotes that Session once, and dragging may edit the resulting order. Returning to Manual preserves the current order and only disables later activity promotion. Manual-mode drags also write the Host Session account, while activity promotion remains a browser-local presentation choice. The flat list uses recency because it has no single Workspace account for durable Session drag.
The combined view menu offers **Manual** and **Last updated** over one browser-local persisted order per group. A real Workspace initializes from `WorkspaceView.sessionIds`; Ungrouped initializes from recency and has no Host Session account. Entering Last updated performs one complete recency sort; a later user prompt or steer promotes that Session once, and dragging may edit the resulting order. Returning to Manual preserves the current order and only disables later activity promotion. Manual-mode drags for a real Workspace also write the Host Session account, while Ungrouped drags and activity promotion remain browser-local. The flat list uses recency because it has no single group account for Session drag.
### Drag and compact chrome
@@ -46,11 +46,11 @@ Search is a header action while collapsed and expands across the title and trail
## Consequences
- Workspace order is durable and shared through the Host, while grouping, open state, the shared Session view order, and query state remain browser-local presentation preferences.
- Workspace order is durable and shared through the Host, while grouping, open state, per-group Session view order, and query state remain browser-local presentation preferences. Ungrouped supports the same drag and promotion rules, but its order is browser-local because no Workspace owns those Sessions.
- Last updated performs a complete recency sort on entry, then preserves manual adjustments until a user prompt or steer advances one Session and moves it to the front. Returning to Manual preserves every current position.
- Opening a Workspace never shows more than five Sessions without an explicit **Show more** gesture, and closing it resets only that transient gesture.
- The Host Session account retains the manual-order meaning established by [Session List Browsing and Manual Workspace Order](2026-07-25-session-list-browsing-and-manual-order.md).
## Testing
Domain and Host tests cover durable Workspace moves, no-op and invalid anchors, restart recovery, full-order RPC responses, order frames, and one Workspace snapshot per Host-stream baseline. Runtime tests cover optimistic order, frame/response precedence, overlapping rejection rollback to Host-confirmed order, reconnect baselines, and New Session target priority. UI tests cover five-row folding, transient expansion reset, pruning persisted state after Workspace removal, order-preserving mode switches, one-time recent-update promotion, selected view indicators, expanded-section Workspace hit testing, an unclipped first insertion boundary, outside-list Workspace and Session drops, search collapse rules, and compact CSS dimensions.
Domain and Host tests cover durable Workspace moves, no-op and invalid anchors, restart recovery, full-order RPC responses, order frames, and one Workspace snapshot per Host-stream baseline. Runtime tests cover optimistic order, frame/response precedence, overlapping rejection rollback to Host-confirmed order, reconnect baselines, and New Session target priority. UI tests cover five-row folding, transient expansion reset, pruning persisted state after Workspace removal, order-preserving mode switches, one-time recent-update promotion, browser-local Ungrouped drag persistence in both modes, selected view indicators, expanded-section Workspace hit testing, an unclipped first insertion boundary, outside-list Workspace and Session drops, search collapse rules, and compact CSS dimensions.

View File

@@ -20,9 +20,9 @@ Workspace 注册表持有持久 `workspaceIds` 顺序,并提供采用 DOM `ins
### Session 折叠与视图顺序
每个 Workspace 持久化一项浏览器本地打开状态:关闭表示零条 Session 行,打开表示最多五条。存在更多 Session 时,**展开其余**只在当前挂载期间显示剩余项;关闭整个 Workspace 会清除此临时展开,因此重新打开时恢复为五条。只有在用户尚未为该 Workspace 存储明确状态时,当前 Session 所在分组才会自动打开。就绪的 Workspace 基线发生变化后,浏览器会移除基线中不存在 id 的展开状态、顺序和已观察时间戳记录,同时保留 Ungrouped 的展开键。
每个 Workspace 持久化一项浏览器本地打开状态:关闭表示零条 Session 行,打开表示最多五条。存在更多 Session 时,**展开其余**只在当前挂载期间显示剩余项;关闭整个 Workspace 会清除此临时展开,因此重新打开时恢复为五条。只有在用户尚未为该 Workspace 存储明确状态时,当前 Session 所在分组才会自动打开。就绪的 Workspace 基线发生变化后,浏览器会移除基线中不存在 id 的展开状态、顺序和已观察时间戳记录,同时 Ungrouped 保留展开、顺序和已观察时间戳所用的键。
组合视图菜单在同一份按 Workspace 持久于浏览器本地、由 `WorkspaceView.sessionIds` 初始化的顺序上提供**手动排序**和**最近更新**。进入最近更新时会执行一次完整的时间排序;后续 user prompt 或 steer 会将对应 Session 置顶一次,拖拽仍可编辑所得顺序。返回手动排序会保留当前顺序,只停用后续活动置顶。手动模式下的拖拽还会写入 Host Session 记账,而活动置顶仍属于浏览器本地呈现选择。平铺列表没有可承载持久 Session 拖拽的单一 Workspace 记账,因此使用最近更新顺序。
组合视图菜单在每个分组各自的一份浏览器本地持久顺序上提供**手动排序**和**最近更新**。真实 Workspace `WorkspaceView.sessionIds` 初始化Ungrouped 从最近更新时间顺序初始化,且没有 Host Session 记账。进入最近更新时会执行一次完整的时间排序;后续 user prompt 或 steer 会将对应 Session 置顶一次,拖拽仍可编辑所得顺序。返回手动排序会保留当前顺序,只停用后续活动置顶。真实 Workspace 在手动模式下的拖拽还会写入 Host Session 记账,而 Ungrouped 拖拽和活动置顶保留在浏览器本地。平铺列表没有可承载 Session 拖拽的单一分组记账,因此使用最近更新顺序。
### 拖拽与紧凑界面
@@ -46,11 +46,11 @@ Workspace 命中测试使用完整渲染分组区段,包括可见 Session 行
## 后果
- Workspace 顺序通过 Host 持久并共享;分组方式、打开状态、共享 Session 视图顺序和查询状态仍是浏览器本地呈现偏好。
- Workspace 顺序通过 Host 持久并共享;分组方式、打开状态、每个分组的 Session 视图顺序和查询状态仍是浏览器本地呈现偏好。Ungrouped 支持相同的拖拽与置顶规则,但因没有 Workspace 持有其中的 Session其顺序只保存在浏览器本地。
- 最近更新模式会在进入时执行完整时间排序,随后保持手动调整,直到 user prompt 或 steer 推进某条 Session 并将其置顶。返回手动排序会保留所有当前位置。
- 未执行明确的**展开其余**手势时,打开 Workspace 最多显示五条 Session关闭分组只重置这项临时手势。
- Host Session 记账继续采用[会话列表浏览与 Workspace 手动排序](2026-07-25-session-list-browsing-and-manual-order.md)确立的手动顺序含义。
## 测试
领域与 Host 测试覆盖持久 Workspace 移动、无操作与无效锚点、重启恢复、完整顺序 RPC 响应、顺序帧以及每条 Host stream 基线只读取一份 Workspace 快照。运行时测试覆盖乐观顺序、帧/响应优先级、重叠拒绝后恢复 Host 已确认顺序、重连基线以及 New Session 目标优先级。UI 测试覆盖五行折叠、临时展开重置、Workspace 移除后清理持久状态、保持顺序的模式切换、一次性最近更新置顶、当前视图标记、展开区段的 Workspace 命中、未裁切的第一条插入边界、列表外 Workspace 与 Session 松手、搜索收起规则和紧凑 CSS 尺寸。
领域与 Host 测试覆盖持久 Workspace 移动、无操作与无效锚点、重启恢复、完整顺序 RPC 响应、顺序帧以及每条 Host stream 基线只读取一份 Workspace 快照。运行时测试覆盖乐观顺序、帧/响应优先级、重叠拒绝后恢复 Host 已确认顺序、重连基线以及 New Session 目标优先级。UI 测试覆盖五行折叠、临时展开重置、Workspace 移除后清理持久状态、保持顺序的模式切换、一次性最近更新置顶、两种模式下的浏览器本地 Ungrouped 拖拽持久化、当前视图标记、展开区段的 Workspace 命中、未裁切的第一条插入边界、列表外 Workspace 与 Session 松手、搜索收起规则和紧凑 CSS 尺寸。