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
3 changes: 2 additions & 1 deletion docs/INDEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Read only the smallest set of files matching your task:
| **Model Providers & Presets** | [`ADR-0063`](adr/0063-model-provider-presets-not-cc-switch.md), [`ADR-0079`](adr/0079-provider-catalog-templates-are-not-import-sources.md), [`ADR-0085`](adr/0085-modelrouter-is-a-webview-side-provider-source.md), [`ADR-0088`](adr/0088-built-in-provider-presets.md) |
| **Pulse Event Automation & Workflows (DAG)** | [`docs/specs/pulse-automation-engine.md`](specs/pulse-automation-engine.md), [`ADR-0092`](adr/0092-pulse-event-driven-automation-and-dual-primitive-workflows.md), [`ADR-0045`](adr/0045-workflows-orchestrate-conversation-turns.md), [`ADR-0049`](adr/0049-workflow-source-artifacts-and-portable-automation-specs.md), [`ADR-0050`](adr/0050-interactive-workflow-debug-runs-and-step-conversations.md), [`ADR-0053`](adr/0053-agent-step-native-session-text-handoff-and-confirmation-projections.md) |
| **Plugins, Plugin SDK/CLI, MCP Runtimes** | [`docs/plugins/README.md`](plugins/README.md), [`docs/plugins/package-v4.md`](plugins/package-v4.md), [`docs/plugins/platform-architecture.md`](plugins/platform-architecture.md), [`docs/plugins/contract-bindings.md`](plugins/contract-bindings.md), [`ADR-0046`](adr/0046-full-stack-plugin-platform-and-isolated-sdk.md), [`ADR-0048`](adr/0048-full-trust-plugin-execution-model.md), [`ADR-0069`](adr/0069-everything-is-a-plugin-platform.md) |
| **Frontend UI / Styling / Dockview / Composer** | [`DESIGN.md`](../DESIGN.md), [`frontend/CLAUDE.md`](../frontend/CLAUDE.md), [`docs/specs/context-menu-surfaces.md`](specs/context-menu-surfaces.md), [`ADR-0039`](adr/0039-adopt-astryx-for-chat-composer-and-message-rendering.md), [`ADR-0042`](adr/0042-conversations-are-first-class-dockview-panels.md), [`ADR-0065`](adr/0065-composer-at-reference-panel.md), [`ADR-0068`](adr/0068-workspace-default-surfaces-and-activity.md) |
| **Frontend UI / Styling / Dockview / Composer** | [`DESIGN.md`](../DESIGN.md), [`frontend/CLAUDE.md`](../frontend/CLAUDE.md), [`docs/specs/context-menu-surfaces.md`](specs/context-menu-surfaces.md), [`docs/specs/workspace-sidebar-and-docking.md`](specs/workspace-sidebar-and-docking.md), [`docs/specs/page-block-tab-strip.md`](specs/page-block-tab-strip.md), [`ADR-0039`](adr/0039-adopt-astryx-for-chat-composer-and-message-rendering.md), [`ADR-0042`](adr/0042-conversations-are-first-class-dockview-panels.md), [`ADR-0065`](adr/0065-composer-at-reference-panel.md), [`ADR-0068`](adr/0068-workspace-default-surfaces-and-activity.md) |
| **IM Channels, Companion Apps & Headless Deploy** | [`docs/guides/headless-server.md`](guides/headless-server.md), [`docs/guides/companion-apps.md`](guides/companion-apps.md), [`ADR-0004`](adr/0004-im-secrets-plaintext-env.md), [`ADR-0041`](adr/0041-native-kotlin-compose-android-companion.md), [`ADR-0056`](adr/0056-chat-channel-and-remote-access-codeg-parity.md), [`ADR-0062`](adr/0062-chat-channel-host-closed-loop.md), [`ADR-0070`](adr/0070-ssh-provisioned-remote-server.md), [`ADR-0084`](adr/0084-native-swiftui-ios-companion.md) |
| **Debugging Agent / Collaboration Failures** | [`docs/guides/agent-troubleshooting.md`](guides/agent-troubleshooting.md), [`ADR-0058`](adr/0058-session-auxiliary-capability-honesty.md), [`ADR-0074`](adr/0074-turn-failure-taxonomy-and-recovery-visibility.md) |
| **Security, Licensing & Third-Party Attribution** | [`docs/security/dependency-license-audit.md`](security/dependency-license-audit.md), [`docs/third-party/codeg-adoption.md`](third-party/codeg-adoption.md), [`THIRD_PARTY_NOTICES.md`](../THIRD_PARTY_NOTICES.md) |
Expand Down Expand Up @@ -74,6 +74,7 @@ Read only the smallest set of files matching your task:
| [`docs/specs/agent-driver-engine.md`](specs/agent-driver-engine.md) | Normative Agent Driver Engine v2.0 spec (dedicated engine adapters, ACP fallback, session lifecycle, error taxonomy). |
| [`docs/specs/agent-orchestration-and-delegation.md`](specs/agent-orchestration-and-delegation.md) | Multi-agent orchestration, `&Agent` delegation, cross-project `thread_launch`, two-phase worktree launch, push completion wakeup, and unified HTTP `/mcp` contract. |
| [`docs/specs/context-menu-surfaces.md`](specs/context-menu-surfaces.md) | Unified right-click context menu contract across Workbench surfaces. |
| [`docs/specs/page-block-tab-strip.md`](specs/page-block-tab-strip.md) | Page-block tab width, close-preview pinning, and in-strip reorder. Excludes the tab bar from edge-split hit testing. |
| [`docs/specs/cross-agent-continuation.md`](specs/cross-agent-continuation.md) | Deterministic cross-agent handoff, binding generations, history segments, and replay semantics. |
| [`docs/specs/instant-session-controls-and-lazy-bind.md`](specs/instant-session-controls-and-lazy-bind.md) | Zero-latency provider capability catalog (bundled baselines, SWR, EventBus push), lazy turn-start session bind, and native engine probe de-blocking. |
| [`docs/specs/prepared-acp-session-controls.md`](specs/prepared-acp-session-controls.md) | Connect-time prepared ACP session controls (mode, model, config options) before first turn. |
Expand Down
165 changes: 165 additions & 0 deletions docs/specs/page-block-tab-strip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# 页块标签栏

状态:已实现。宽度在 `frontend/src/utils/tabStripGeometry.ts`,关闭冻结、让位空档和 500ms 回稳在 `frontend/src/utils/tabStripController.ts`,标签栏命中排除在 `ideLayoutDockviewListeners.ts`。页块分裂比例仍以 [`workspace-sidebar-and-docking.md`](workspace-sidebar-and-docking.md) 为准。

## 1. 目标

一个页块的标签栏对齐 Chrome 的关闭预瞄和 VS Code 的同高标签。

- 放得下时,每个标签同一高度、同一基线、同一默认宽度。选中只多一层填充、字重,以及底边向外接到内容区的圆角。
- 放不下时才压缩。所有标签平分剩余宽度,最窄只剩圆点与关闭键。选中标签没有单独的宽度。
- 指针还在标签栏里时,关闭中间标签不重新分配宽度。后一个标签的关闭键落到刚关掉的那个关闭键上,连续关闭不用挪鼠标。
- 关掉的是最右一个、或它右边已经没有标签时,才把剩下的标签平均放宽,并且不超过默认宽度。放宽量只够让新的最右关闭键到达当前鼠标。
- 指针离开标签栏并持续 500ms 后,才动画到稳定宽度。
- 在同一页块的标签栏里拖动时,其他标签让出一条空位。标签栏矩形内不触发页块分裂,也不触发工作区贴边。

## 2. 常量

标签字号沿用 `--dv-tabs-and-actions-container-font-size: 12px`。一个汉字按 12px 计。

| 符号 | 值 | 含义 |
| ---- | -- | ---- |
| `D` | 168px | 默认宽度,也是上限。16px 图标 + 8px 间距 + 8 个汉字 96px + 16px 关闭键 + 左右内边距 32px |
| `F` | 36px | 压缩下限。左侧 8px 圆点区 + 16px 关闭键 + 两侧余量 12px |
| `c` | 14px | 关闭键中心到标签右缘的距离 |
| `H` | 36px | 标签栏高度,即 `--dv-tabs-and-actions-container-height` |
| `T` | 500ms | 指针离开标签栏后的稳定延迟 |

坐标:标签栏内容区左缘为 `x = 0`,右缘为 `x = W`。`W` 是去掉两侧动作按钮后的标签行内宽。关闭键中心是 `tab.right - c`。

## 3. 实现位置

- 稳定宽度、关闭后的宽度、拖动空位下标:`frontend/src/utils/tabStripGeometry.ts`。
- 把这些宽度写到标签上、关闭时冻结、指针离开 500ms 后回到稳定宽度:`frontend/src/utils/tabStripController.ts`。它挂在 `installDockviewPointerTabDnd` 上。
- 同一页块内的空位和放置下标:`frontend/src/utils/dockviewPointerTabDnd.ts`。源标签在拖动中收成 0 宽,空位是 `.workspace-tab-drop-gap`。标签栏上的合成拖拽事件不冒泡,避免工作区根上的边缘放置把排序抢走。
- 指针落在 `.dv-tabs-and-actions-container` 内时,`ideLayoutDockviewListeners.ts` 取消贴边和页块分裂预览。
- 选中与未选中共用标签栏高度。选中只多一层填充和字重。关闭键始终占在标签右缘,中心距右缘 14px。

## 4. 稳定宽度

指针不在关闭或拖动会话里时,标签行使用稳定宽度。

放得下,`n * D <= W`:每个标签宽 `D`,高 `H`,顶对齐。右侧留下 `W - n * D`。选中与未选中的宽和高相同。

```text
W = 600,n = 3,3 * 168 = 504 <= 600

x: 0 168 336 504 600
|-- A --|-- B --|-- C --| 空白 96px
```

放不下,`n * D > W`:每个标签取 `W / n`,再夹到 `[F, D]`。选中与未选中同宽。

```text
W = 600,n = 5,5 * 168 = 840 > 600
每个标签 600 / 5 = 120(120 在 36 和 168 之间)

x: 0 120 240 360 480 600
|-- A --|-- B --|-- C --|-- D --|-- E --|
```

若 `W < n * F`,全部停在 `F`,多出来的标签进入现有溢出控制,不再窄于圆点加关闭键。

## 5. 关闭时的宽度冻结

指针位于标签栏矩形内时,进入关闭会话。会话期间各标签的像素宽度冻结,不回到第 4 节的公式。

### 5.1 关掉的不是最右标签

设被关标签占 `[L, R]`,宽度 `w = R - L`,关闭键在 `R - c`。它右边还有标签。

1. 去掉该标签。
2. 紧邻的后一个标签在会话结束前改用宽度 `w`,右缘放在 `R`。它的关闭键仍在 `R - c`。
3. 更后面的标签改为紧贴这个新右缘,各自保持冻结宽度。

若不把后一个标签临时收成 `w`,只按自身宽度左移,关闭键会对不齐。下面这组数就是这个差别。

冻结布局与第 4 节的挤满例子相同,五个标签各宽 120。鼠标点在 B 的关闭键 `x = 226`(`240 - 14`)。

```text
关 B 之前
x: 0 120 240 360 480 600
|-- A --|-- B --|-- C --|-- D --|-- E --|
^
关闭键 226

关 B 之后,C 占据 B 的槽,宽 120,右缘仍是 240
D、E 贴着 C 的新右缘,宽度仍是 120

x: 0 120 240 360 480 600
|-- A --|-- C --|-- D --|-- E --| 空白 120px
^
关闭键仍是 226
```

鼠标不用动,下一次点击打在 C 的关闭键上。

### 5.2 关掉的是最右标签

右边没有能替补的标签。设点击时鼠标为 `mouseX`,剩下 `n` 个标签,当前最右缘为 `right`。

```text
desiredRight = mouseX + c
delta = desiredRight - right
```

`delta <= 0` 时不放宽。`delta > 0` 时,每个剩下的标签增加 `delta / n`,然后各自不超过 `D`。被 `D` 截住的部分不再分给别人。关闭键因此可能停在鼠标左边,这是上限,不是再做一次重排。

```text
W = 600,六个标签各宽 100,D = 168
x: 0, 100, 200, 300, 400, 500, 600
关掉最右标签,鼠标在它的关闭键 mouseX = 586

去掉之后最右缘是 500,关闭键在 486
desiredRight = 586 + 14 = 600
delta = 100,剩下 5 个,每个 +20
新宽度 120,120 <= 168
新最右缘 600,关闭键 586,与鼠标重合
```

再看会被默认宽度截住的情况:

```text
四个标签各宽 150,关掉最右一个,鼠标关闭键对应 desiredRight = 600
去掉之后最右缘 450,delta = 150,剩下 3 个,每个 +50 = 200
200 > 168,截到 168
实际最右缘 3 * 168 = 504,关闭键 490
鼠标在 586,差 96px。停在这里。
```

## 6. 离开后的稳定

关闭、拖动排序,或其他会改标签行几何的操作,都保持冻结宽度。

指针离开 `.dv-tabs-and-actions-container` 后开始 500ms 计时。500ms 内重新进入则取消。计时结束,用一帧动画过渡到第 4 节的稳定宽度。动画期间如果指针再次进入,停在当前像素,重新进入会话。

## 7. 页块之间的拖动

每个页块的标签都是同一个拖动对象。指针在任意页块的标签栏里时,用同一套空位,不区分来源页块和目标页块:

- 源标签离开原位,两侧标签合拢。
- 指针所在的那个标签栏在插入点空出一段宽度 `min(D, 被拖标签的稳定宽度)`。空位就是放置提示。
- 指针在某个标签左半区,空位出现在该标签左边;右半区则出现在右边。空白的标签行尾部表示插到最后。
- 松开后按空位写入顺序。落到别的页块时,标签加入那个页块的对应位置。然后继续冻结,直到第 6 节的离开计时。

指针不在任何标签栏里时,空位收起,分裂和贴边仍按第 8 节。

从侧边栏对话列表拖出一条对话时,拖动预览和落点与拖动标签相同:标签栏里让出空位并按空位插入,页块内容区中部放入该页块,页块边缘则分裂出新页块。

标签栏矩形内的指针不参与页块分裂,也不参与工作区贴边。分裂带从内容区顶缘重新计量,不从页块顶缘计量。

```text
同上页块:内容区 y = 116 .. 560,高 444
顶部分裂带改为 y = 116 .. 116 + 0.30 * 444 = 249
y = 80 .. 116 只属于标签栏

指针 (x=400, y=100) 在标签栏内:排序或关闭
指针 (x=400, y=180) 在内容区、且在顶部分裂带内:向上分裂
指针 (x=400, y=320) 在内容区中部:放入这个页块,不分裂
```

工作区顶边缘带同样从内容区顶缘起算。贴着工作区顶边的页块,标签栏那 36px 不再算进 20% 边缘带。

## 8. 与页块分裂合同的边界

标签拖出标签栏之后,仍按 [`workspace-sidebar-and-docking.md`](workspace-sidebar-and-docking.md) 第 7 节决定放入页块、分裂页块或贴工作区边缘。本节只把标签栏矩形从那些命中区去掉,不改变边缘带的比例。
Loading
Loading