Просмотр исходного кода

chore: sync ZCode source

Source-Commit: 5a082039a1a3b1edfe8364a33c8978689c0d68bf
Source-Sync: zcode-open-source-v1
ZCode Source Sync Bot 1 месяц назад
Родитель
Сommit
3c5b227649
100 измененных файлов с 4181 добавлено и 1656 удалено
  1. 1 0
      DESIGN.md
  2. 1 0
      README.en.md
  3. 1 0
      README.md
  4. 3 2
      apps/zcode-cli/docs/design/v2/skill.md
  5. 8 0
      apps/zcode-cli/docs/design/v2/tool/00-tool-change-chain.md
  6. 21 0
      apps/zcode-cli/docs/design/v2/tool/04-bash.md
  7. 11 0
      apps/zcode-cli/packages/adapters/src/exec/execution-adapter-types.ts
  8. 37 22
      apps/zcode-cli/packages/adapters/src/exec/node-execution-adapter-lifecycle.ts
  9. 135 12
      apps/zcode-cli/packages/adapters/src/exec/node-execution-adapter-run.ts
  10. 14 4
      apps/zcode-cli/packages/adapters/src/plugins/marketplace.ts
  11. 256 3
      apps/zcode-cli/packages/adapters/tests/bash-direct-execution.test.ts
  12. 40 3
      apps/zcode-cli/packages/adapters/tests/bash-shutdown.test.ts
  13. 4 0
      apps/zcode-cli/packages/bootstrap/src/app/bundled-plugins.ts
  14. 2 0
      apps/zcode-cli/packages/bootstrap/src/app/create-app.ts
  15. 6 0
      apps/zcode-cli/packages/bootstrap/src/app/official-plugin-definitions.ts
  16. 2 0
      apps/zcode-cli/packages/bootstrap/src/app/script-workflow-child-runtime.ts
  17. 35 6
      apps/zcode-cli/packages/bootstrap/src/app/workflow-concurrency-governor.ts
  18. 2 0
      apps/zcode-cli/packages/bootstrap/src/app/workflow-facade.ts
  19. 5 1
      apps/zcode-cli/packages/bootstrap/src/plugins.ts
  20. 8 8
      apps/zcode-cli/packages/bootstrap/src/zcode-protocol/plugins.ts
  21. 7 3
      apps/zcode-cli/packages/bootstrap/src/zcode-protocol/server-operations.ts
  22. 21 0
      apps/zcode-cli/packages/bootstrap/src/zcode-protocol/transport.ts
  23. 2 1
      apps/zcode-cli/packages/bootstrap/src/zcode-protocol/v4-bridge.ts
  24. 69 5
      apps/zcode-cli/packages/bootstrap/tests/embedded-search-native.e2e.test.ts
  25. 82 0
      apps/zcode-cli/packages/bootstrap/tests/plugins-protocol.test.ts
  26. 44 0
      apps/zcode-cli/packages/bootstrap/tests/plugins.test.ts
  27. 7 0
      apps/zcode-cli/packages/bootstrap/tests/provider-registry-app-runtime.test.ts
  28. 9 0
      apps/zcode-cli/packages/bootstrap/tests/script-workflow-child-runtime.test.ts
  29. 294 222
      apps/zcode-cli/packages/bootstrap/tests/v4-cold-resume.test.ts
  30. 37 2
      apps/zcode-cli/packages/bootstrap/tests/workflow-concurrency-governor.test.ts
  31. 7 0
      apps/zcode-cli/packages/bootstrap/tests/workflow-effective-selection.test.ts
  32. 8 0
      apps/zcode-cli/packages/bootstrap/tests/workflow-fault-matrix.stop.test.ts
  33. 52 0
      apps/zcode-cli/packages/bootstrap/tests/zcode-protocol-transport.test.ts
  34. 1 1
      apps/zcode-cli/packages/dynamic-workflow/docs/execution-engine.md
  35. 25 0
      architecture-policy.yaml
  36. 2 2
      docs/analysis/credentials-json-code-audit.md
  37. 2 1
      docs/architecture/r2-server-cli-and-daemon-test-plan.md
  38. 14 0
      docs/architecture/r2-server-cli-and-daemon.md
  39. 4 0
      docs/architecture/r3-source-server-remote-architecture.md
  40. 2 2
      docs/architecture/remote-device-connection-ux-spec.md
  41. 24 0
      docs/claude-code-marketplace-plugin-compat.md
  42. 17 1
      docs/composer-model-thinking.md
  43. 18 7
      docs/conversation-session-case-catalog.md
  44. 2 2
      docs/desktop/windows-taskbar-unread-badge.md
  45. 11 2
      docs/dynamic-workflow/authoring.md
  46. 14 1
      docs/dynamic-workflow/concurrency.md
  47. 41 33
      docs/dynamic-workflow/launch.md
  48. 1 1
      docs/performance/runtime-communication-repro.md
  49. 12 0
      docs/plugin-management-lifecycle-case-catalog.md
  50. 7 1
      docs/plugins/plugin-market-interactions-scope.md
  51. 18 0
      docs/remote/project-first-remote-navigation-spec.md
  52. 4 0
      docs/settings-storage-management.md
  53. 17 4
      docs/subagent-session-side-tabs.md
  54. 27 0
      docs/superpowers/specs/2026-09-09-virtual-project-design.md
  55. 11 3
      docs/superpowers/specs/2026-09-11-archive-management.md
  56. 25 8
      docs/testing/conversation-session-e2e-coverage-matrix.md
  57. 7 0
      docs/testing/plugin-management-lifecycle-e2e-coverage-matrix.md
  58. 2 2
      docs/testing/r3-remote-automation-case-matrix.md
  59. 1 1
      docs/testing/r3-remote-server-harness.md
  60. 84 3
      docs/testing/side-pane-tabs-e2e-case-catalog.md
  61. 24 0
      docs/testing/side-pane-tabs-e2e-coverage-matrix.md
  62. 1 1
      docs/testing/unit-test-review/ui-tail.jsonl
  63. 15 14
      docs/testing/workspace-file-tree-e2e-coverage.md
  64. 33 16
      docs/tmpdir-storage-paths-spec.md
  65. 1 0
      docs/ui/project-task-draft-lifecycle.md
  66. 140 0
      docs/ui/side-pane-full-view.md
  67. 1 0
      docs/ui/side-pane-tabs.md
  68. 2 2
      docs/ui/workspace-file-tree.md
  69. 3 4
      docs/v4-session-workbench-groups.md
  70. 5 3
      docs/v4-split-pane-workbench.md
  71. 29 9
      docs/web-remote-control/relay-v2-pairing.md
  72. 20 2
      docs/web-remote-control/web-remote-login.md
  73. 2 2
      package-lock.json
  74. 1 1
      package.json
  75. 46 31
      packages/desktop/src/main/desktopTray.ts
  76. 30 8
      packages/desktop/src/main/desktopWindowLifecycle.ts
  77. 81 3
      packages/desktop/src/main/unreadBadge.ts
  78. 71 46
      packages/desktop/test/desktopTrayBadge.test.ts
  79. 321 0
      packages/desktop/test/e2e/conversation-session/conversation-session-side-pane-full-view.test.ts
  80. 22 0
      packages/desktop/test/e2e/conversation-session/conversation-session-v4-composer-toolbar.test.ts
  81. 35 6
      packages/desktop/test/e2e/conversation-session/manual-review/pending/conversation-session-archive-management.test.ts
  82. 52 5
      packages/desktop/test/e2e/conversation-session/manual-review/pending/conversation-session-dynamic-workflow-gray-disabled.test.ts
  83. 16 2
      packages/desktop/test/e2e/conversation-session/manual-review/pending/conversation-session-project-upgrade-order.test.ts
  84. 29 1
      packages/desktop/test/e2e/conversation-session/manual-review/pending/conversation-session-r3-daemon-detached.test.ts
  85. 19 3
      packages/desktop/test/e2e/conversation-session/manual-review/pending/conversation-session-r3-install-environment.test.ts
  86. 141 8
      packages/desktop/test/e2e/conversation-session/manual-review/pending/conversation-session-r3-subagent.test.ts
  87. 86 6
      packages/desktop/test/e2e/conversation-session/manual-review/pending/conversation-session-remote-device-cards.test.ts
  88. 0 222
      packages/desktop/test/e2e/conversation-session/manual-review/pending/conversation-session-runtime-communication-performance.test.ts
  89. 9 12
      packages/desktop/test/e2e/conversation-session/manual-review/pending/conversation-session-virtual-project-mobile.test.ts
  90. 56 0
      packages/desktop/test/e2e/fixtures/cases/conversation-session/conversation-session-r3-subagent.json
  91. 0 104
      packages/desktop/test/e2e/fixtures/cases/conversation-session/conversation-session-runtime-communication-performance.json
  92. 54 0
      packages/desktop/test/e2e/fixtures/cases/conversation-session/conversation-session-side-pane-full-view.json
  93. 207 0
      packages/desktop/test/e2e/fixtures/upstream/conversation-session/conversation-session-r3-subagent.json
  94. 0 434
      packages/desktop/test/e2e/fixtures/upstream/conversation-session/conversation-session-runtime-communication-performance.json
  95. 166 0
      packages/desktop/test/e2e/fixtures/upstream/conversation-session/conversation-session-side-pane-full-view.json
  96. 22 5
      packages/desktop/test/e2e/helpers/project-upgrade-order-fixture.ts
  97. 0 286
      packages/desktop/test/e2e/helpers/v4-conversation.ts
  98. 55 0
      packages/desktop/test/e2e/plugins/manual-review/pending/plugin-builtin-ui-uninstall.test.ts
  99. 122 51
      packages/desktop/test/e2e/plugins/manual-review/pending/plugin-concurrent-install.test.ts
  100. 640 0
      packages/desktop/test/e2e/ui-shell/side-pane-full-view.test.ts

+ 1 - 0
DESIGN.md

@@ -385,6 +385,7 @@ The following explicit exceptions may retain `rounded-2xl`; do not extend them t
 
 - **Main chat input shell**: the actual `ChatPromptEditor` input shell may use `rounded-2xl`. Its drag overlay matches the shell because it covers the same surface, rather than introducing a nested container.
 - **Conversation status floating panel**: the shared shell may retain `rounded-2xl` across collapsed and expanded presentations.
+- **Side Pane full-view floating composer**: in Side Pane full view the main chat input shell floats on its own (no outer frame); the drawer that slides out from behind it and the answer bubble shown above it use `rounded-2xl` to match the shell; the minimized state and the answer bubble's close button are deliberate circles (`rounded-full`).
 - **Toast**: the independent notification shell may retain `rounded-2xl`.
 - **Brand icon backplates**: welcome-screen brand art and plugin-detail icons may retain `rounded-2xl` as part of their icon shape. This is not a general exception for icon buttons or content cards.
 

+ 1 - 0
README.en.md

@@ -15,6 +15,7 @@ ZCode is an AI coding workspace with desktop, browser, and terminal interfaces.
 
 ## Updates
 
+- **2026-10-19**: Updated to ZCode v3.16.2.
 - **2026-10-16**: Updated to ZCode v3.16.1.
 - 2026-10-10: Updated to ZCode v3.15.1.
 - 2026-9-23: Updated to ZCode v3.14.3.

+ 1 - 0
README.md

@@ -15,6 +15,7 @@ ZCode 是 AI 编程工作台,提供桌面应用、浏览器界面和终端 Age
 
 ## 更新
 
+- **2026-10-19**:更新至 ZCode v3.16.2 版本。
 - **2026-10-16**:更新至 ZCode v3.16.1 版本。
 - 2026-10-10:更新至 ZCode v3.15.1 版本。
 - 2026-9-23:更新至 ZCode v3.14.3 版本。

+ 3 - 2
apps/zcode-cli/docs/design/v2/skill.md

@@ -164,8 +164,9 @@ Project discovery 使用 nearest-first 语义:先检查当前 working director
   `apps/zcode-cli/packages/bundled-skills/skills/`,以 `source: "bundled"`、`scope: "system"`
   进入发现,与 plugin roots 并列注入 runtime、`zcode skills list` 与协议 skill catalog。它不是
   插件:不进市场目录、没有启停开关、不能卸载、不出现在 Settings 与 `$` 引用面板
-  (`skills/referenceCatalog` 过滤 `bundled`)。开发态/桌面态沿官方插件同款候选目录在入口旁
-  原地读取;SEA 按内容 hash 一次性解压到 `~/.zcode/cli/bundled-skills/<hash>/`。包内每个
+  (`skills/referenceCatalog` 过滤 `bundled`)。开发态/桌面态/ZCode Server 发行包沿官方插件同款
+  候选目录在入口旁原地读取(Server 发行包 stage 在 `runtime/packages/bundled-skills`);SEA
+  按内容 hash 一次性解压到 `~/.zcode/cli/bundled-skills/<hash>/`。包内每个
   文件都是必需资产,缺一拒绝整包并告警。首个成员是 `dynamic-workflows`
   (`docs/dynamic-workflow/authoring.md`)。
 - plugin-provided skill roots。

+ 8 - 0
apps/zcode-cli/docs/design/v2/tool/00-tool-change-chain.md

@@ -1,5 +1,13 @@
 # Tool Change Chain Spec
 
+## Bash 临时输出路径隔离
+
+主应用及 workflow 子运行时装配 tmp 父目录 → execution adapter 实际准备具名输出文件 →
+不可用时复用原 storageRoot 文件准备 → 确定唯一输出路径 → 现有前后台执行、进度、结果与文件入口。
+模型 schema 和 App 协议不变,stdout/stderr 仍直接写 fd。覆盖降级、取消/关闭与准备竞争、
+前后台路径一致性、Windows 原生搜索自引用及崩溃后的具名文件保留;不迁移历史输出。
+存储统计仍限现有数据根,完整合同见 `04-bash.md` 和根目录 `docs/tmpdir-storage-paths-spec.md`。
+
 ## 自定义 Agent Memory 工具投影(2026-10-15)
 
 Runtime 从当前父轮 Agent definitions 快照派生有效工具,启动配置、注入 reader 和 Host

+ 21 - 0
apps/zcode-cli/docs/design/v2/tool/04-bash.md

@@ -199,6 +199,27 @@ Windows 执行 adapter 的最低兼容规则:
 
 ## ExecutionPort v1 契约
 
+### Bash 输出路径准备
+
+产品装配入口向 adapter 注入可选 `bashOutputTempDir`,先在系统临时目录的私有
+`zcode-bash-<随机标识>/<session>/<tool>-stdout.log` 创建并打开具名文件。
+目录不可用时复用原 `outputRootDir`,包括自定义 storageRoot;未注入该选项的 adapter 保持原行为。
+具体降级错误集合和保留规则见根目录 `docs/tmpdir-storage-paths-spec.md`。
+
+```mermaid
+flowchart LR
+    A[准备 Bash 输出] --> B{tmp 文件打开成功}
+    B -->|成功| D[实际路径、文件对象和编码]
+    B -->|目录不可用| C[原 storageRoot 文件准备]
+    C --> D
+    D --> E[记录后台路径并启动一次命令]
+    E --> F[stdout/stderr 直写同一 fd]
+```
+
+实际路径在准备后确定,再传入执行链路;移交后台不再次打开文件。准备期间取消或关闭须释放
+本次文件,不能启动子进程。初始化快照和启动脚本仍使用原根目录;不改搜索外壳与 watchdog。
+临时输出不随 adapter 关闭归档或批量删除,接受系统清理;App 存储占用暂不统计 tmp。
+
 `Bash` 不直接调用 `child_process`。所有子进程副作用必须收敛到 `ExecutionPort`,由 adapter 负责平台差异、进程生命周期和输出预算。
 
 输入语义:

+ 11 - 0
apps/zcode-cli/packages/adapters/src/exec/execution-adapter-types.ts

@@ -1,4 +1,5 @@
 import type { SpawnOptions } from "node:child_process";
+import type { BashFileOutput } from "./bash-file-output.js";
 import type { ZCodeToolExecResource } from "@zcode/shared";
 import type { NetworkEgressEnvPolicy } from "../network/subprocess-env.js";
 import type { ResolvedSpawnCommand } from "./execution-command.js";
@@ -33,6 +34,7 @@ export interface ExecutionOutputPaths {
 }
 
 export interface InternalExecutionRunOptions extends ExecutionRunOptions {
+  preparedBashOutput?: PreparedBashOutput;
   onOutputEncodingResolved?: (encoding: string | null) => void;
   /** Bash 移交时停止前台预览并重启文件 watchdog;不复制进程或输出。 */
   bashLifecycle?: {
@@ -46,6 +48,13 @@ export interface InternalExecutionRunOptions extends ExecutionRunOptions {
   shouldRetainExecutionAfterRootExit?: () => boolean;
 }
 
+export interface PreparedBashOutput {
+  file: BashFileOutput;
+  legacyOutputEncoding: string | null;
+  /** 准备与执行交接期间仍由 close() 等待,执行接管后释放准备记录。 */
+  releasePreparation: () => void;
+}
+
 export type BashBackgroundLifecycleMode = "explicit" | "auto_on_timeout";
 
 export type BashBackgroundLifecycleResult =
@@ -74,6 +83,8 @@ export interface ActiveExecutionRecord {
 export interface NodeExecutionAdapterOptions {
   onToolExecResource?: (sample: ZCodeToolExecResource) => void;
   outputRootDir?: string;
+  /** 仅 Bash 输出优先使用的临时父目录;不可用时复用 outputRootDir。 */
+  bashOutputTempDir?: string;
   maxPersistedOutputBytes?: number;
   network?: NetworkEgressEnvPolicy;
   platform?: NodeJS.Platform;

+ 37 - 22
apps/zcode-cli/packages/adapters/src/exec/node-execution-adapter-lifecycle.ts

@@ -28,10 +28,15 @@ export class NodeExecutionAdapterLifecycle extends NodeExecutionAdapterRun {
       throw new Error("Execution adapter is shutting down");
     }
 
+    const preparation = this.usesBashTempOutput(request)
+      ? await this.prepareBashOutput(request, options)
+      : undefined;
+
     const taskId = `exec_${crypto.randomUUID()}`;
     const controller = new AbortController();
     const startedAt = new Date();
-    const outputPaths = this.outputPathsForRequest(request);
+    const outputPaths =
+      preparation && "result" in preparation ? {} : this.outputPathsForRequest(request);
     const runRequest =
       request.captureCwdAfterSuccess === true
         ? { ...request, captureCwdAfterSuccess: undefined }
@@ -57,21 +62,28 @@ export class NodeExecutionAdapterLifecycle extends NodeExecutionAdapterRun {
       record.externalAbort = externalAbort;
     }
 
-    void this.run(runRequest, {
-      ...options,
-      signal: controller.signal,
-      onOutputEncodingResolved: (encoding) => {
-        record.legacyOutputEncoding = encoding;
-      },
-      shouldRetainExecutionAfterRootExit: () => true,
-      ...(isBashMergedOutputRequest(runRequest)
-        ? { bashLifecycle: { isBackgrounded: () => true } }
-        : {}),
-      onEvent: (event) => {
-        this.updateBackgroundTaskRecordFromEvent(record, event);
-        return options.onEvent?.(event);
-      },
-    } as InternalExecutionRunOptions).then(
+    if (preparation && "result" in preparation) this.emitResult(options, preparation.result);
+    const running =
+      preparation && "result" in preparation
+        ? Promise.resolve(preparation.result)
+        : this.run(runRequest, {
+            ...options,
+            preparedBashOutput:
+              preparation && "prepared" in preparation ? preparation.prepared : undefined,
+            signal: controller.signal,
+            onOutputEncodingResolved: (encoding) => {
+              record.legacyOutputEncoding = encoding;
+            },
+            shouldRetainExecutionAfterRootExit: () => true,
+            ...(isBashMergedOutputRequest(runRequest)
+              ? { bashLifecycle: { isBackgrounded: () => true } }
+              : {}),
+            onEvent: (event) => {
+              this.updateBackgroundTaskRecordFromEvent(record, event);
+              return options.onEvent?.(event);
+            },
+          } as InternalExecutionRunOptions);
+    void running.then(
       (result) => {
         this.finalizeBackgroundTaskRecord(record, result);
         if (record.externalAbort) {
@@ -130,6 +142,13 @@ export class NodeExecutionAdapterLifecycle extends NodeExecutionAdapterRun {
         persistOutput: "always",
       },
     };
+    const preparation = this.usesBashTempOutput(runRequest)
+      ? await this.prepareBashOutput(runRequest, options)
+      : undefined;
+    if (preparation && "result" in preparation) {
+      this.emitResult(options, preparation.result);
+      return { kind: "foreground", result: preparation.result };
+    }
     const outputPaths = this.outputPathsForRequest(runRequest);
     if (!isBashMergedOutputRequest(runRequest)) {
       await this.ensureBackgroundOutputFiles(outputPaths);
@@ -223,6 +242,7 @@ export class NodeExecutionAdapterLifecycle extends NodeExecutionAdapterRun {
 
     const backgroundRunOptions: InternalExecutionRunOptions = {
       ...options,
+      preparedBashOutput: preparation?.prepared,
       signal: controller.signal,
       onOutputEncodingResolved: (encoding) => {
         record.legacyOutputEncoding = encoding;
@@ -302,12 +322,7 @@ export class NodeExecutionAdapterLifecycle extends NodeExecutionAdapterRun {
     sessionId: string,
   ): Promise<BackgroundBashOutputResult> {
     const record = this.backgroundTasks.get(workId);
-    if (
-      !record ||
-      record.sessionId !== sessionId ||
-      !record.isBash ||
-      !record.outputPath
-    )
+    if (!record || record.sessionId !== sessionId || !record.isBash || !record.outputPath)
       return { kind: "unavailable", workId };
     // 先冻结状态,再读文件;若读取期间退出,下次查询才能返回终态及其最终尾窗。
     const snapshot = this.snapshot(record);

+ 135 - 12
apps/zcode-cli/packages/adapters/src/exec/node-execution-adapter-run.ts

@@ -1,4 +1,6 @@
 import { spawn, type ChildProcess } from "node:child_process";
+import { mkdtemp } from "node:fs/promises";
+import { basename, dirname, join } from "node:path";
 import { BashFileOutput } from "./bash-file-output.js";
 import { readCapturedCwd } from "./cwd-capture.js";
 import { defaultCwdDialect } from "./execution-command.js";
@@ -10,10 +12,12 @@ import {
   abortSignalReason,
   isBashMergedOutputRequest,
   isExpectedChildStdinClosureError,
+  resolveDefaultOutputRootDir,
 } from "./execution-utils.js";
 import type {
   ExitState,
   InternalExecutionRunOptions,
+  PreparedBashOutput,
   StopReason,
 } from "./execution-adapter-types.js";
 import type {
@@ -23,7 +27,107 @@ import type {
   ExecutionShellDialect,
 } from "@zcode/contracts";
 
+const BASH_TEMP_DIRECTORY_PREFIX = "zcode-bash-";
+const BASH_TEMP_UNAVAILABLE_CODES = new Set([
+  "EACCES",
+  "EPERM",
+  "EROFS",
+  "ENOENT",
+  "ENOTDIR",
+  "ENOSPC",
+  "EDQUOT",
+]);
+
 export class NodeExecutionAdapterRun extends NodeExecutionAdapterProcess {
+  private bashTempRoot?: Promise<string>;
+
+  protected usesBashTempOutput(request: ExecutionRequest): boolean {
+    return this.options.bashOutputTempDir !== undefined && isBashMergedOutputRequest(request);
+  }
+
+  private getBashTempRoot(): Promise<string> {
+    if (!this.bashTempRoot) {
+      const pending = mkdtemp(join(this.options.bashOutputTempDir!, BASH_TEMP_DIRECTORY_PREFIX));
+      this.bashTempRoot = pending;
+      void pending.catch(() => {
+        if (this.bashTempRoot === pending) this.bashTempRoot = undefined;
+      });
+    }
+    return this.bashTempRoot;
+  }
+
+  protected async prepareBashOutput(
+    request: ExecutionRequest,
+    options: ExecutionRunOptions,
+  ): Promise<{ prepared: PreparedBashOutput } | { result: ExecutionResult }> {
+    const startedAt = new Date();
+    let stopped = false;
+    const executionId = this.registerActiveExecution(() => {
+      stopped = true;
+    });
+    const releasePreparation = () => this.completeActiveExecution(executionId);
+    const isStopped = () => stopped || this.closePromise !== undefined || options.signal?.aborted;
+    let file: BashFileOutput | undefined;
+    const cancelled = async () => {
+      await file?.discard();
+      releasePreparation();
+      return {
+        result: this.createStoppedResult(
+          startedAt,
+          "cancelled",
+          "Execution cancelled before spawn",
+        ),
+      };
+    };
+    try {
+      if (isStopped()) return await cancelled();
+      const legacyOutputEncoding = resolveLegacyExecutionOutputEncoding({
+        platform: this.platform,
+        processEnv: this.processEnv,
+      });
+      const knownPath = this.outputPathForRequest(request, "stdout")!;
+      // 请求可能被复用;缓存保存的是实际路径,降级根必须始终来自原有配置。
+      const fallbackPath = join(
+        this.options.outputRootDir ?? resolveDefaultOutputRootDir(this.options.processEnv),
+        basename(dirname(knownPath)),
+        basename(knownPath),
+      );
+      try {
+        const root = await this.getBashTempRoot();
+        if (isStopped()) return await cancelled();
+        const path = join(root, basename(dirname(fallbackPath)), basename(fallbackPath));
+        file = new BashFileOutput(path, this.platform, legacyOutputEncoding);
+        await file.prepare();
+      } catch (error) {
+        if (isStopped()) return await cancelled();
+        if (!BASH_TEMP_UNAVAILABLE_CODES.has((error as NodeJS.ErrnoException).code ?? ""))
+          throw error;
+        await file?.discard();
+        // 搜索数据目录会把正在写入的输出再次读回;优先隔离到 tmp,失败后完整复用旧文件实现。
+        file = new BashFileOutput(fallbackPath, this.platform, legacyOutputEncoding);
+        await file.prepare();
+      }
+      if (isStopped()) return await cancelled();
+      // 路径必须在后台记录和文件入口发布之前确定,不能在 spawn 后再降级或重新打开。
+      this.outputPathsByRequest.set(request, {
+        outputPath: file.path,
+        stdoutPersistedOutputPath: file.path,
+      });
+      return { prepared: { file, legacyOutputEncoding, releasePreparation } };
+    } catch (error) {
+      await file?.discard();
+      releasePreparation();
+      if (isStopped()) return await cancelled();
+      return {
+        result: this.createStoppedResult(
+          startedAt,
+          "spawn_error",
+          this.toFailure("spawn_error", error).message,
+        ),
+      };
+    }
+  }
+
   async run(
     request: ExecutionRequest,
     options: ExecutionRunOptions = {},
@@ -33,6 +137,15 @@ export class NodeExecutionAdapterRun extends NodeExecutionAdapterProcess {
     let requestStop: (reason: StopReason) => void = () => undefined;
     let outputLimitExceeded = false;
     const internalOptions = options as InternalExecutionRunOptions;
+    let preparedOutput = internalOptions.preparedBashOutput;
+    if (!preparedOutput && this.usesBashTempOutput(request)) {
+      const preparation = await this.prepareBashOutput(request, options);
+      if ("result" in preparation) {
+        this.emitResult(options, preparation.result);
+        return preparation.result;
+      }
+      preparedOutput = preparation.prepared;
+    }
     const aggregatePersistedBudget = internalOptions.sharePersistedOutputLimitAcrossStreams
       ? {
           bytes: 0,
@@ -41,10 +154,14 @@ export class NodeExecutionAdapterRun extends NodeExecutionAdapterProcess {
       : undefined;
 
     if (this.closePromise) {
+      await preparedOutput?.file.discard();
+      preparedOutput?.releasePreparation();
       return this.createStoppedResult(startedAt, "cancelled", "Execution adapter is shutting down");
     }
 
     if (options.signal?.aborted) {
+      await preparedOutput?.file.discard();
+      preparedOutput?.releasePreparation();
       return this.createStoppedResult(startedAt, "cancelled", "Execution cancelled before spawn");
     }
 
@@ -65,19 +182,23 @@ export class NodeExecutionAdapterRun extends NodeExecutionAdapterProcess {
             }
           }
         : undefined;
-    const legacyOutputEncoding = resolveLegacyExecutionOutputEncoding({
-      platform: this.platform,
-      processEnv: this.processEnv,
-    });
+    const legacyOutputEncoding = preparedOutput
+      ? preparedOutput.legacyOutputEncoding
+      : resolveLegacyExecutionOutputEncoding({
+          platform: this.platform,
+          processEnv: this.processEnv,
+        });
     // 任务记录单独解析会重复同步执行 Windows chcp;复用执行时的编码值。
     internalOptions.onOutputEncodingResolved?.(legacyOutputEncoding);
-    const file = useBashMergedOutput
-      ? new BashFileOutput(
-          this.outputPathForRequest(request, "stdout")!,
-          this.platform,
-          legacyOutputEncoding,
-        )
-      : undefined;
+    const file =
+      preparedOutput?.file ??
+      (useBashMergedOutput
+        ? new BashFileOutput(
+            this.outputPathForRequest(request, "stdout")!,
+            this.platform,
+            legacyOutputEncoding,
+          )
+        : undefined);
     const stdout = file
       ? undefined
       : this.createOutputCollector(
@@ -167,6 +288,7 @@ export class NodeExecutionAdapterRun extends NodeExecutionAdapterProcess {
     };
 
     const executionId = this.registerActiveExecution(requestStop);
+    preparedOutput?.releasePreparation();
     const abortHandler = () => {
       const reason = abortSignalReason(options.signal);
       requestStop(reason === "output_limit" ? "output_limit" : "cancelled");
@@ -184,11 +306,12 @@ export class NodeExecutionAdapterRun extends NodeExecutionAdapterProcess {
 
       const stoppedAfterCommandPreparation = stoppedBeforeSpawn();
       if (stoppedAfterCommandPreparation) {
+        if (preparedOutput) await file?.discard();
         return stoppedAfterCommandPreparation;
       }
 
       if (file) {
-        await file.prepare();
+        if (!preparedOutput) await file.prepare();
         const stoppedAfterOutputPreparation = stoppedBeforeSpawn();
         if (stoppedAfterOutputPreparation) {
           await file.discard();

+ 14 - 4
apps/zcode-cli/packages/adapters/src/plugins/marketplace.ts

@@ -950,6 +950,8 @@ export async function describeMarketplacePlugin(input: {
   marketplace: string;
   name: string;
   storageRoot: string;
+  /** 只包住会写 known/manifest 的懒加载分支;其余只读路径不进锁。 */
+  withWriteLock?: <T>(write: () => Promise<T>) => Promise<T>;
 }): Promise<DescribeMarketplacePluginResult> {
   const diagnostics: PluginValidationDiagnostic[] = [];
   const pluginId = `${input.name}@${input.marketplace}`;
@@ -977,11 +979,19 @@ export async function describeMarketplacePlugin(input: {
 
   let manifest: PluginMarketplaceManifest | null = null;
   try {
-    await ensureMarketplaceManifestAvailable({
-      marketplace: input.marketplace,
-      storageRoot: input.storageRoot,
-    });
     manifest = loadMarketplaceManifestSync(input.storageRoot, input.marketplace);
+    if (!manifest) {
+      // Bugfix:describe 曾整体持 storage lock,安装下载期间所有详情都排在锁后。
+      // 只有 manifest 缺失时才写 known/manifest,此时必须与安装、市场刷新串行。
+      const withWriteLock = input.withWriteLock ?? ((write) => write());
+      await withWriteLock(() =>
+        ensureMarketplaceManifestAvailable({
+          marketplace: input.marketplace,
+          storageRoot: input.storageRoot,
+        }),
+      );
+      manifest = loadMarketplaceManifestSync(input.storageRoot, input.marketplace);
+    }
   } catch (error) {
     diagnostics.push(toValidationDiagnostic(error, pluginId));
     return { components: [], diagnostics };

+ 256 - 3
apps/zcode-cli/packages/adapters/tests/bash-direct-execution.test.ts

@@ -1,6 +1,7 @@
 import { mkdtemp, mkdir, open, readFile, rm, writeFile } from "node:fs/promises";
 import { tmpdir } from "node:os";
-import { join } from "node:path";
+import { join, relative, dirname } from "node:path";
+import * as fsPromises from "node:fs/promises";
 import { setTimeout as sleep } from "node:timers/promises";
 import { afterEach, describe, expect, it, vi } from "vitest";
 import { NodeExecutionAdapter } from "../src/exec/node-execution-adapter.js";
@@ -37,15 +38,18 @@ afterEach(async () => {
   vi.restoreAllMocks();
 });
 
-async function fixture(shell: ExecutionShellSelection, code: string) {
+async function fixture(shell: ExecutionShellSelection, code: string, useTmp = false) {
   const root = await mkdtemp(join(tmpdir(), "zcode-direct-"));
   const cwd = join(root, "中文 with spaces");
   await mkdir(cwd);
+  const tempParent = join(root, "temporary-output");
+  if (useTmp) await mkdir(tempParent);
   const script = join(cwd, "writer.cjs");
   const release = join(cwd, "release");
   await writeFile(script, code);
   const adapter = new NodeExecutionAdapter({
     outputRootDir: root,
+    ...(useTmp ? { bashOutputTempDir: tempParent } : {}),
     progressThresholdMs: 0,
     progressIntervalMs: 20,
   });
@@ -77,7 +81,7 @@ async function fixture(shell: ExecutionShellSelection, code: string) {
       attributes: { toolCallId: "direct" },
     } as ExecutionRequest["trace"],
   };
-  return { adapter, request, release, path: join(root, "probe", "direct-stdout.log") };
+  return { adapter, request, release, tempParent, path: join(root, "probe", "direct-stdout.log") };
 }
 
 const gatedWriter = `const fs = require('node:fs');
@@ -384,3 +388,252 @@ spawn(process.execPath, ['-e', "const fs=require('node:fs');const t=setInterval(
     await sleep(20);
   });
 });
+
+describe.each(shells)("temporary Bash output $display.name", (shell) => {
+  it.each(["run", "foreground", "explicit", "auto_on_timeout", "start"] as const)(
+    "publishes one prepared file across the entire execution (%s)",
+    async (mode) => {
+      const { adapter, request, release, tempParent, path } = await fixture(
+        shell,
+        gatedWriter,
+        true,
+      );
+      const prepare = vi.spyOn(BashFileOutput.prototype, "prepare");
+      const append = vi.spyOn(OutputCollector.prototype, "append");
+      const watch = vi.spyOn(BashFileOutput.prototype, "watchLimit");
+      const encoding = vi.spyOn(outputEncoding, "resolveLegacyExecutionOutputEncoding");
+      let actualPath: string;
+      if (mode === "run" || mode === "foreground") {
+        await writeFile(release, "go");
+        const result =
+          mode === "run"
+            ? await adapter.run(request)
+            : await adapter
+                .runBashWithBackgroundLifecycle(request, { mode: "auto_on_timeout" })
+                .then((outcome) => {
+                  if (outcome.kind !== "foreground") throw new Error("expected foreground");
+                  return outcome.result;
+                });
+        expect(result.status).toBe("completed");
+        actualPath = result.stdout.artifactPath!;
+      } else {
+        request.timeoutMs = mode === "auto_on_timeout" ? 20 : 10_000;
+        const task =
+          mode === "start"
+            ? await adapter.start(request)
+            : await adapter.runBashWithBackgroundLifecycle(request, { mode }).then((outcome) => {
+                if (outcome.kind !== "backgrounded") throw new Error("expected background");
+                return outcome.task;
+              });
+        actualPath = task.outputPath!;
+        expect(task.stdoutPersistedOutputPath).toBe(actualPath);
+        // Windows Git Bash 启动可能超过默认的一秒;仍以实际输出标记确认就绪。
+        await vi.waitFor(
+          async () => expect(await readFile(actualPath, "utf8")).toContain("stderr-first"),
+          { timeout: 5_000 },
+        );
+        expect(await adapter.readBackgroundBashOutput(task.taskId, "probe")).toMatchObject({
+          kind: "output",
+          outputPath: actualPath,
+          status: "running",
+        });
+        await writeFile(release, "go");
+        const done = await adapter.waitForBackgroundTask(task.taskId);
+        expect(done?.result?.stdout.artifactPath).toBe(actualPath);
+      }
+      expect(relative(tempParent, actualPath)).toMatch(
+        /^zcode-bash-[^/\\]+[/\\]probe[/\\]direct-stdout\.log$/,
+      );
+      expect(prepare).toHaveBeenCalledTimes(1);
+      expect(encoding).toHaveBeenCalledTimes(1);
+      expect(append).not.toHaveBeenCalled();
+      expect(watch).toHaveBeenCalled();
+      expect(watch.mock.instances.every((file) => file === prepare.mock.instances[0])).toBe(true);
+      expect(await readFile(actualPath, "utf8")).toBe(
+        "file:true:true\nstderr-first\nlast-no-newline",
+      );
+      await expect(fsPromises.stat(path)).rejects.toMatchObject({ code: "ENOENT" });
+      await adapter.close();
+      expect(await readFile(actualPath, "utf8")).toContain("last-no-newline");
+    },
+  );
+
+  it.each(["EACCES", "EPERM", "EROFS", "ENOENT", "ENOTDIR", "ENOSPC", "EDQUOT"])(
+    "reuses the configured fallback after a tmp open failure (%s)",
+    async (code) => {
+      const { adapter, request, release, tempParent, path } = await fixture(
+        shell,
+        gatedWriter,
+        true,
+      );
+      const original = BashFileOutput.prototype.prepare;
+      const attempts: string[] = [];
+      vi.spyOn(BashFileOutput.prototype, "prepare").mockImplementation(async function () {
+        attempts.push(this.path);
+        if (this.path.startsWith(tempParent))
+          throw Object.assign(new Error("tmp unavailable"), { code });
+        return original.call(this);
+      });
+      await writeFile(release, "go");
+      const started = vi.fn();
+      const result = await adapter.run(request, {
+        onEvent: (event) => {
+          if (event.type === "started") started();
+        },
+      });
+      expect(result.status).toBe("completed");
+      expect(result.stdout.artifactPath).toBe(path);
+      expect(await readFile(path, "utf8")).toBe("file:true:true\nstderr-first\nlast-no-newline");
+      expect(attempts).toHaveLength(2);
+      expect(attempts[1]).toBe(path);
+      expect(started).toHaveBeenCalledTimes(1);
+    },
+  );
+
+  it.each(["small", "large"])("preserves foreground %s output retention in tmp", async (size) => {
+    const { adapter, request, release, tempParent } = await fixture(shell, gatedWriter, true);
+    request.outputLimit = {
+      persistOutput: "on_truncate",
+      maxInlineBytes: size === "small" ? 30_000 : 16,
+    };
+    const prepare = vi.spyOn(BashFileOutput.prototype, "prepare");
+    await writeFile(release, "go");
+    const outcome = await adapter.runBashWithBackgroundLifecycle(request, {
+      mode: "auto_on_timeout",
+    });
+    if (outcome.kind !== "foreground") throw new Error("expected foreground");
+    expect(outcome.result.status).toBe("completed");
+    const path = prepare.mock.instances[0]!.path;
+    expect(path.startsWith(tempParent)).toBe(true);
+    if (size === "small") {
+      expect(outcome.result.stdout.artifactPath).toBeUndefined();
+      await expect(fsPromises.stat(path)).rejects.toMatchObject({ code: "ENOENT" });
+    } else {
+      expect(outcome.result.stdout.artifactPath).toBe(path);
+      expect(await readFile(path, "utf8")).toContain("last-no-newline");
+    }
+  });
+
+  it.each(["unexpected", "both-fail"])(
+    "does not spawn after preparation failure (%s)",
+    async (mode) => {
+      const { adapter, request, tempParent } = await fixture(shell, gatedWriter, true);
+      const attempts: string[] = [];
+      vi.spyOn(BashFileOutput.prototype, "prepare").mockImplementation(async function () {
+        attempts.push(this.path);
+        throw Object.assign(new Error("open failed"), {
+          code: mode === "both-fail" && this.path.startsWith(tempParent) ? "EACCES" : "EMFILE",
+        });
+      });
+      const events: ExecutionEvent[] = [];
+      const result = await adapter.runBashWithBackgroundLifecycle(
+        request,
+        { mode: "explicit" },
+        {
+          onEvent: (event) => {
+            events.push(event);
+          },
+        },
+      );
+      expect(result).toMatchObject({ kind: "foreground", result: { status: "spawn_error" } });
+      expect(events.some((event) => event.type === "started")).toBe(false);
+      expect(attempts).toHaveLength(mode === "both-fail" ? 2 : 1);
+    },
+  );
+
+  it("does not cache a failed tmp directory creation and shares a successful directory", async () => {
+    const { adapter, request, release, tempParent, path } = await fixture(shell, gatedWriter, true);
+    await rm(tempParent, { recursive: true });
+    await writeFile(release, "go");
+    expect((await adapter.run(request)).stdout.artifactPath).toBe(path);
+    await mkdir(tempParent);
+    const next = () => ({
+      ...request,
+      trace: { ...request.trace!, attributes: { toolCallId: crypto.randomUUID() } },
+    });
+    const results = await Promise.all([adapter.run(next()), adapter.run(next())]);
+    expect(results.every((result) => result.status === "completed")).toBe(true);
+    expect(results[0].stdout.artifactPath!.startsWith(tempParent)).toBe(true);
+    expect(dirname(results[0].stdout.artifactPath!)).toBe(dirname(results[1].stdout.artifactPath!));
+    expect(await fsPromises.readdir(tempParent)).toHaveLength(1);
+  });
+
+  it("reports preparation errors through the generic background event and result paths", async () => {
+    const { adapter, request } = await fixture(shell, gatedWriter, true);
+    vi.spyOn(BashFileOutput.prototype, "prepare").mockRejectedValue(
+      Object.assign(new Error("too many open files"), { code: "EMFILE" }),
+    );
+    const events: ExecutionEvent[] = [];
+    const task = await adapter.start(request, {
+      onEvent: (event) => {
+        events.push(event);
+      },
+    });
+    const result = await adapter.waitForBackgroundTask(task.taskId);
+    expect(result?.status).toBe("spawn_error");
+    expect(task.outputPath).toBeUndefined();
+    expect(events.some((event) => event.type === "started")).toBe(false);
+    expect(events.some((event) => event.type === "failed")).toBe(true);
+  });
+
+  it.each(["abort", "close"] as const)(
+    "releases a file when %s wins during preparation",
+    async (mode) => {
+      const { adapter, request } = await fixture(shell, gatedWriter, true);
+      const controller = new AbortController();
+      let release!: () => void;
+      let ready!: () => void;
+      const gate = new Promise<void>((resolve) => {
+        release = resolve;
+      });
+      const opened = new Promise<void>((resolve) => {
+        ready = resolve;
+      });
+      const original = BashFileOutput.prototype.prepare;
+      let file!: BashFileOutput;
+      vi.spyOn(BashFileOutput.prototype, "prepare").mockImplementation(async function () {
+        file = this;
+        await original.call(this);
+        ready();
+        await gate;
+      });
+      const events: ExecutionEvent[] = [];
+      const running = adapter.runBashWithBackgroundLifecycle(
+        request,
+        { mode: "explicit" },
+        {
+          signal: controller.signal,
+          onEvent: (event) => {
+            events.push(event);
+          },
+        },
+      );
+      await opened;
+      let closing: Promise<void> | undefined;
+      try {
+        if (mode === "abort") controller.abort();
+        else closing = adapter.close();
+      } finally {
+        release();
+      }
+      expect(await running).toMatchObject({ kind: "foreground", result: { status: "cancelled" } });
+      await closing;
+      expect(events.some((event) => event.type === "started")).toBe(false);
+      expect(file.fd).toBeUndefined();
+      await expect(fsPromises.stat(file.path)).rejects.toMatchObject({ code: "ENOENT" });
+    },
+  );
+
+  it("keeps the configured fallback when a request is reused after a tmp success", async () => {
+    const { adapter, request, release, tempParent, path } = await fixture(shell, gatedWriter, true);
+    await writeFile(release, "go");
+    expect((await adapter.run(request)).stdout.artifactPath!.startsWith(tempParent)).toBe(true);
+    const original = BashFileOutput.prototype.prepare;
+    vi.spyOn(BashFileOutput.prototype, "prepare").mockImplementation(async function () {
+      if (this.path.startsWith(tempParent))
+        throw Object.assign(new Error("tmp denied"), { code: "EACCES" });
+      return original.call(this);
+    });
+    expect((await adapter.run(request)).stdout.artifactPath).toBe(path);
+  });
+});

+ 40 - 3
apps/zcode-cli/packages/adapters/tests/bash-shutdown.test.ts

@@ -35,7 +35,7 @@ async function main() {
     setInterval(() => {}, 1000);
     return;
   }
-  const adapter = new NodeExecutionAdapter({ outputRootDir: root });
+  const adapter = new NodeExecutionAdapter({ outputRootDir: root, ...(mode === 'crash' ? { bashOutputTempDir: root } : {}) });
   const controller = new AbortController();
   const request = {
     command: {
@@ -51,10 +51,10 @@ async function main() {
   const options = { signal: controller.signal, onEvent: (event) => {
     if (event.type === 'started') console.log('ROOT_PID ' + event.pid);
   } };
-  const pending = mode === 'background'
+  const pending = mode === 'background' || mode === 'crash'
     ? adapter.runBashWithBackgroundLifecycle(request, { mode: 'explicit' }, options)
     : adapter.run(request, options);
-  const background = mode === 'background' ? await pending : undefined;
+  const background = mode === 'background' || mode === 'crash' ? await pending : undefined;
   if (background) console.log('ROOT_PID ' + background.task.pid);
   const deadline = Date.now() + 5000;
   while (true) {
@@ -62,6 +62,11 @@ async function main() {
     if (Date.now() >= deadline) throw new Error('Worker did not start');
     await sleep(20);
   }
+  if (mode === 'crash') {
+    console.log('OUTPUT_PATH ' + background.task.outputPath);
+    await new Promise(() => {});
+    return;
+  }
   if (mode === 'abort') controller.abort();
   if (mode === 'background') await adapter.cancelBackgroundTask(background.task.taskId);
   // 后台 Stop 的 ACK 可早于最终 result;close 后再读取完整结算。
@@ -105,6 +110,38 @@ describe.skipIf(process.platform === "win32")("Bash shutdown in an isolated Node
     if (directory) await rm(directory, { recursive: true, force: true });
   });
 
+  it("keeps named tmp output when the host is killed without cleanup", async () => {
+    const root = join(directory, "crash");
+    await mkdir(root);
+    const child = spawn(process.execPath, [driver, "crash", root], {
+      stdio: ["ignore", "pipe", "pipe"],
+    });
+    let stdout = "";
+    child.stdout!.on("data", (chunk) => {
+      stdout += chunk;
+    });
+    const closed = new Promise<void>((resolve) => child.once("close", () => resolve()));
+    try {
+      await vi.waitFor(() => expect(stdout).toContain("OUTPUT_PATH "), { timeout: 10_000 });
+      const path = /OUTPUT_PATH ([^\r\n]+)/u.exec(stdout)![1]!;
+      expect(path).toContain("zcode-bash-");
+      expect(await readFile(path, "utf8")).toBe("root output");
+      child.kill("SIGKILL");
+      await closed;
+      expect(await readFile(path, "utf8")).toBe("root output");
+    } finally {
+      child.kill("SIGKILL");
+      const pid = Number(/ROOT_PID (\d+)/u.exec(stdout)?.[1]);
+      if (pid > 1) {
+        try {
+          process.kill(-pid, "SIGKILL");
+        } catch {
+          /* 清理测试子进程。 */
+        }
+      }
+    }
+  }, 15_000);
+
   it.each(["abort", "close", "background", "timeout", "output_limit"])(
     "finishes cleanup before process exit after %s",
     async (mode) => {

+ 4 - 0
apps/zcode-cli/packages/bootstrap/src/app/bundled-plugins.ts

@@ -428,6 +428,10 @@ function writeOfficialMarketplace(storageRoot: string, source: OfficialPluginSee
         const description = readSeedPluginDescription(source, plugin);
         return {
           cachePath: officialPluginCacheRoot(storageRoot, plugin.definition),
+          // 未安装/已卸载时商店读目录条目的 componentTypes 判断「UI 插件」;缺失会掉进分类分组。
+          ...(plugin.definition.componentTypes
+            ? { componentTypes: [...plugin.definition.componentTypes] }
+            : {}),
           ...(description ? { description } : {}),
           name: plugin.definition.name,
           source: source.kind,

+ 2 - 0
apps/zcode-cli/packages/bootstrap/src/app/create-app.ts

@@ -1,6 +1,7 @@
 import { subagentProfilesFromSnapshot } from "../runtime-subagents/index.js";
 import { CliDefaultSelection } from "./cli-default-selection.js";
 import { isAbsolute, join, resolve } from "node:path";
+import { tmpdir } from "node:os";
 import {
   createInMemorySessionEventStore,
   createNodeToolArtifactStore,
@@ -437,6 +438,7 @@ export async function createZCodeApp(options: ZCodeAppOptions): Promise<ZCodeApp
           caCertFile: configResult.config.network.caCertFile,
         },
         outputRootDir: join(storageRoot, "cli", "exec"),
+        bashOutputTempDir: tmpdir(),
         processEnv: options.env ?? process.env,
       });
     const ownsExecutionPort = options.executionPort === undefined;

+ 6 - 0
apps/zcode-cli/packages/bootstrap/src/app/official-plugin-definitions.ts

@@ -35,6 +35,11 @@ export const OFFICIAL_CUA_PLUGIN_NAME = "computer-use";
 export const OFFICIAL_CUA_PLUGIN_ID = `${OFFICIAL_CUA_PLUGIN_NAME}@${ZCODE_OFFICIAL_PLUGIN_MARKETPLACE}`;
 
 export interface OfficialPluginDefinition {
+  /**
+   * 卸载(抑制)后的可恢复条目没有运行时信息,商店只能靠这里判断是否归入「UI 插件」。
+   * 插件包 manifest 声明 ui.surfaces 时必须同时声明 "ui",由 bootstrap 测试校验一致。
+   */
+  componentTypes?: readonly string[];
   // 内容型 plugin (无 MCP server / 无系统依赖) 可以设为 true,
   // 这样用户首次 `/skill <name>` 就能用,不必先 `zcode plugins enable`。
   // 默认 false 保持 ios-simulator / android-emulator 这类重负载 plugin 原来行为。
@@ -212,6 +217,7 @@ export const OFFICIAL_PLUGIN_DEFINITIONS: readonly OfficialPluginDefinition[] =
     ] as const
   ).map(
     ([name, skill, displayName, chineseName, version]): OfficialPluginDefinition => ({
+      componentTypes: ["ui"],
       defaultEnabled: true,
       listing: {
         author: ZAI_AUTHOR,

+ 2 - 0
apps/zcode-cli/packages/bootstrap/src/app/script-workflow-child-runtime.ts

@@ -1,4 +1,5 @@
 import { join } from "node:path";
+import { tmpdir } from "node:os";
 import { createNodeContextSourceAdapter } from "@zcode/adapters/context";
 import { createNodeExecutionAdapter } from "@zcode/adapters/exec";
 import { createNodeFileSystemAdapter } from "@zcode/adapters/fs";
@@ -243,6 +244,7 @@ function createRuntimeDeps(
           caCertFile: deps.configResult.config.network.caCertFile,
         },
         outputRootDir: join(deps.storageRoot, "cli", "exec"),
+        bashOutputTempDir: tmpdir(),
         processEnv: deps.appOptions.env ?? process.env,
       }),
     fileSystemPort: deps.appOptions.fileSystemPort ?? createNodeFileSystemAdapter(),

+ 35 - 6
apps/zcode-cli/packages/bootstrap/src/app/workflow-concurrency-governor.ts

@@ -14,11 +14,14 @@
 // 这里是治理器里**唯一**会碰时钟与定时器的地方:控制器只收 `now`;冷却到期要唤醒等待者,
 // 所以需要一个 setTimeout(可注入,unref)。
 
-import type {
-  ModelNetworkStatusEvent,
-  ModelRequestAdmission,
-  ModelRequestAdmissionTicket,
-  ModelRequestTarget,
+import { resolveWorkflowModelFailurePolicy } from "@zcode/adapters/model";
+import {
+  ModelErrorCode,
+  type ModelNetworkStatusEvent,
+  type ModelRequestAdmission,
+  type ModelRequestAdmissionTicket,
+  type ModelRequestFailedStatusEvent,
+  type ModelRequestTarget,
 } from "@zcode/contracts";
 import {
   ConcurrencyController,
@@ -271,9 +274,17 @@ export function createWorkflowConcurrencyGovernor(
           case "model_request_failed":
             // retryable:true 的 failed 紧随一条 retry_scheduled——那条才是信号。
             if (event.retryable) return;
+            // Stop 集(配额、认证…)不是并发信号,只终结尝试。曾经配额 429 走下面的限流分支:
+            // 1308 带的 Retry-After 指到额度窗口结束(可达数小时),冷却冻住整个桶、活得比停下的 run
+            // 还久;用户用重置卡恢复额度后 resume,子代理全卡在闸门上一个请求不发,主代理(observer
+            // 不看冷却)却照常工作,换模型(换桶)才继续。何时再试由用户决定,与 driver 读同一张策略表。
+            if (isWorkflowStopFailure(event)) {
+              settle((at) => bucket.controller.ended(at));
+              return;
+            }
             // 不可重试的限流:
             // 主对话 / 工具侧撞上 3008 这类被分类器判终止的 429,仍是一次字面意义上的并发信号——
-            // 只当「链结束」会让 cap 从未因它降过。配额码也走这一支:多减一次半,run 随即停下,无害。
+            // 只当「链结束」会让 cap 从未因它降过。
             if (event.reason === "rate_limited") {
               settle((at) =>
                 bucket.controller.throttled(at, epoch, "rate_limited", event.retryAfterMs),
@@ -419,6 +430,24 @@ export function createWorkflowConcurrencyGovernor(
   };
 }
 
+/**
+ * 不可重试的失败是否落在 workflow 策略表的 Stop 集里(docs/dynamic-workflow/concurrency.md
+ * 「Retry budget and the model-error policy」)。runner 与 driver 读的是同一个函数,三层对 Stop 集的
+ * 判断不会分叉;缺 `errorCode` 时按通用请求失败读,配额判定只看业务码。
+ */
+function isWorkflowStopFailure(event: ModelRequestFailedStatusEvent): boolean {
+  return (
+    resolveWorkflowModelFailurePolicy(
+      {
+        code: event.errorCode ?? ModelErrorCode.ModelRequestFailed,
+        reason: event.reason,
+        retryable: event.retryable,
+      },
+      event.providerErrorCode,
+    ).decision === "stop"
+  );
+}
+
 function abortedError(signal: AbortSignal): Error {
   const reason = signal.reason;
   if (reason instanceof Error) return reason;

+ 2 - 0
apps/zcode-cli/packages/bootstrap/src/app/workflow-facade.ts

@@ -1,4 +1,5 @@
 import { join } from "node:path";
+import { tmpdir } from "node:os";
 import { createNodeContextSourceAdapter } from "@zcode/adapters/context";
 import { createNodeExecutionAdapter } from "@zcode/adapters/exec";
 import { createNodeFileSystemAdapter } from "@zcode/adapters/fs";
@@ -312,6 +313,7 @@ function createWorkflowChildRuntime(
             caCertFile: deps.configResult.config.network.caCertFile,
           },
           outputRootDir: join(deps.storageRoot, "cli", "exec"),
+          bashOutputTempDir: tmpdir(),
           processEnv: deps.appOptions.env ?? process.env,
         }),
       fileSystemPort: deps.appOptions.fileSystemPort ?? createNodeFileSystemAdapter(),

+ 5 - 1
apps/zcode-cli/packages/bootstrap/src/plugins.ts

@@ -221,6 +221,7 @@ export interface ValidateZCodePluginOptions extends ResolveZCodePluginsOptions {
 export interface DescribeZCodePluginOptions extends ResolveZCodePluginsOptions {
   marketplace: string;
   pluginName: string;
+  withWriteLock?: <T>(write: () => Promise<T>) => Promise<T>;
 }
 
 export interface ZCodePluginInstallData {
@@ -355,6 +356,8 @@ export function getZCodePluginsOverview(
       marketplace: ZCODE_OFFICIAL_PLUGIN_MARKETPLACE,
       version: def.version,
       installed: false,
+      // Bugfix:可恢复条目只带 listing 时丢了 "ui",卸载后的文档插件从「UI 插件」掉进分类分组。
+      ...(def.componentTypes ? { componentTypes: [...def.componentTypes] } : {}),
       ...(listing ? { listing } : {}),
     };
   });
@@ -1017,11 +1020,12 @@ export async function describeZCodePlugin(
   options: DescribeZCodePluginOptions,
 ): Promise<DescribeMarketplacePluginResult> {
   const { pluginStorageRoot } = resolvePluginContext(options);
-  ensureDefaultPluginMarketplaces(pluginStorageRoot);
+  // 默认市场登记由 ensureMarketplaceManifestAvailable 在写锁内完成;这里不再无锁写 known 列表。
   return describeMarketplacePlugin({
     marketplace: options.marketplace,
     name: options.pluginName,
     storageRoot: pluginStorageRoot,
+    ...(options.withWriteLock ? { withWriteLock: options.withWriteLock } : {}),
   });
 }
 

+ 8 - 8
apps/zcode-cli/packages/bootstrap/src/zcode-protocol/plugins.ts

@@ -506,14 +506,14 @@ export async function describePlugin(
 ): Promise<ZCodePluginsDescribeResult> {
   const params = parseParams(zcodePluginsDescribeParamsSchema, rawParams);
   const pluginStorageRoot = resolvePluginStorageRoot(params.workspace.workspacePath);
-  const result = await withPluginStorageLock(pluginStorageRoot, async () =>
-    describeZCodePlugin({
-      logger: context.logger,
-      marketplace: params.marketplace,
-      pluginName: params.pluginName,
-      workingDirectory: params.workspace.workspacePath,
-    }),
-  );
+  // 已安装目录、已缓存 manifest 与临时 source 解析都不持锁;只有懒加载 manifest 写入进锁。
+  const result = await describeZCodePlugin({
+    logger: context.logger,
+    marketplace: params.marketplace,
+    pluginName: params.pluginName,
+    withWriteLock: (write) => withPluginStorageLock(pluginStorageRoot, write),
+    workingDirectory: params.workspace.workspacePath,
+  });
   const components: ZCodePluginComponentGroup[] = result.components.map((group) => ({
     kind: group.kind,
     items: group.items.map((item) => ({

+ 7 - 3
apps/zcode-cli/packages/bootstrap/src/zcode-protocol/server-operations.ts

@@ -1,4 +1,8 @@
-import { OFF_PEAK_EXECUTION_TOOL_DENYLIST } from "@zcode/shared";
+import {
+  isAuxiliarySessionKind,
+  isReadonlyAgentSessionKind,
+  OFF_PEAK_EXECUTION_TOOL_DENYLIST,
+} from "@zcode/shared";
 /* eslint-disable max-lines -- ZCode Protocol 的 session/workspace 方法共享同一个 server context 与 snapshot helpers,迁移期先集中维护。 */
 import { observeSessionDebug } from "./session-debug.js";
 import {
@@ -1716,7 +1720,7 @@ export async function listSessions(context: ZCodeProtocolAgentServerContext, raw
         // 可凭持久化父链证明归属。目录或显式身份不同就拒绝,不回写身份、不激活 runtime。
         if (
           !params.sessionIds ||
-          current.taskType !== "subagent_child" ||
+          !isAuxiliarySessionKind(current.taskType) ||
           !current.parentID ||
           path !== params.workspace.workspacePath ||
           (current.workspaceID?.trim() && key !== path)
@@ -2009,7 +2013,7 @@ export async function sendPrompt(context: ZCodeProtocolAgentServerContext, rawPa
   const params = parseParams(zcodeSessionSendParamsSchema, rawParams);
   const record = requireSession(context, params.sessionId);
   // legacy 输入入口同样必须保持子代理只读,不能绕过 V4 用户输入准入。
-  if (record.taskType === "subagent_child") {
+  if (isReadonlyAgentSessionKind(record.taskType)) {
     throw new ProtocolRequestError(-32010, "Subagent sessions are read-only", {
       reasonCode: "guard.subagentReadOnly",
     });

+ 21 - 0
apps/zcode-cli/packages/bootstrap/src/zcode-protocol/transport.ts

@@ -25,6 +25,14 @@ type ZCodeProtocolMessageHandler = (
 ) => Promise<ZCodeProtocolOutgoingMessage | undefined>;
 
 const PROTOCOL_EOF_DRAIN_MS = 100;
+// 插件读请求收到即处理,不排在安装/更新之后。describe 写 manifest 的分支自带 storage lock;
+// list/overview 是同步 handler,执行中不让出事件循环,seed 只在内容变化时写盘,
+// 不会与安装跨 await 的读改写交错。
+const PLUGIN_READ_IMMEDIATE_METHODS = new Set<string>([
+  zcodeProtocolMethods.pluginsDescribe,
+  zcodeProtocolMethods.pluginsList,
+  zcodeProtocolMethods.pluginsOverview,
+]);
 // MCP App 的请求由实例凭证和 callId 隔离;若与普通命令一起等待完成,
 // uiCallTool 会挡住自己的 cancel/close,真实 stdio 链路将死锁。
 const MCP_APP_CONCURRENT_METHODS = new Set<string>([
@@ -216,6 +224,19 @@ export class ZCodeProtocolNdjsonConnection {
       });
       return;
     }
+    if (
+      "id" in message &&
+      "method" in message &&
+      PLUGIN_READ_IMMEDIATE_METHODS.has(message.method)
+    ) {
+      // Bugfix:插件详情与列表曾排在串行队列里,安装 A 下载期间打开详情卡在组件 loading,
+      // 新建右侧标签页(新 store 首次加载 list/overview)卡在骨架屏。读请求不依赖前序请求的
+      // 执行结果,因此也不等 lastQueuedMessageStarted:否则 B 排在 A 后面时仍要等到 A 完成。
+      void this.handleMessage(message).catch((error: unknown) => {
+        this.fail(error instanceof Error ? error : new Error(String(error)));
+      });
+      return;
+    }
     if (this.shouldBypassProcessingQueue(message)) {
       // 停止/取消控制必须等它前面的普通请求真正进入 handler、建立 abort
       // controller,再越过该请求的异步执行;只延后一轮微任务会让控制请求提前成为空操作。

+ 2 - 1
apps/zcode-cli/packages/bootstrap/src/zcode-protocol/v4-bridge.ts

@@ -1,3 +1,4 @@
+import { isReadonlyAgentSessionKind } from "@zcode/shared";
 import { readBackgroundBashOutputFromOwner } from "./background-work-owner.js";
 // v4 网关 binder。
 // 定位:ConversationV4Gateway 是域无关的通道运行时,本文件把它绑到协议服务器上下文:
@@ -1809,7 +1810,7 @@ export function createConversationV4Gateway(
         const taskType =
           context.sessions.get(envelope.sessionId)?.taskType ??
           (await context.deps.sessionStore?.getSession(envelope.sessionId as SessionId))?.taskType;
-        if (taskType === "subagent_child") {
+        if (isReadonlyAgentSessionKind(taskType)) {
           throw Object.assign(new Error("Subagent sessions are read-only"), {
             reasonCode: "guard.subagentReadOnly",
           });

+ 69 - 5
apps/zcode-cli/packages/bootstrap/tests/embedded-search-native.e2e.test.ts

@@ -1,6 +1,6 @@
 import { spawnSync } from "node:child_process";
 import { createWriteStream } from "node:fs";
-import { chmod, mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
+import { chmod, mkdir, mkdtemp, readFile, rm, stat, writeFile } from "node:fs/promises";
 import { tmpdir } from "node:os";
 import { basename, delimiter, dirname, join } from "node:path";
 import { pipeline } from "node:stream/promises";
@@ -244,10 +244,7 @@ describe.skipIf(!nativeE2eEnabled)("native embedded search E2E", () => {
 
     expect(
       outputLines(normalizeNativeSearchResultPaths(outputSection(result.stdout, "RG_FILES"))),
-    ).toEqual([
-      "src/alpha.ts:2:needle alpha",
-      "src/deep/beta.ts:1:needle beta",
-    ]);
+    ).toEqual(["src/alpha.ts:2:needle alpha", "src/deep/beta.ts:1:needle beta"]);
     expect(outputSection(result.stdout, "RG_HIDDEN")).toBe(".hidden.ts:1:needle hidden");
     expect(outputSection(result.stdout, "RG_STDIN")).toBe("needle from rg stdin");
     expect(outputLines(outputSection(result.stdout, "RG_MATCHERS"))).toEqual([
@@ -293,6 +290,73 @@ describe.skipIf(!nativeE2eEnabled)("native embedded search E2E", () => {
     expect(result.stderr).toBe("");
   });
 
+  it.each(["ugrep-direct", "ugrep-pipe", "system-grep-pipe"])(
+    "isolates live output from recursive search (%s)",
+    async (mode) => {
+      const searchRoot = join(fixtureRoot, `self-search-${mode}`);
+      const tempParent = join(fixtureRoot, `temporary-${mode}`);
+      await mkdir(searchRoot);
+      await mkdir(tempParent);
+      await writeFile(join(searchRoot, "00-seed.txt"), "self_search_needle\n".repeat(200_000));
+      const shellPath = (path: string) =>
+        process.platform === "win32" ? windowsPathToGitBashPath(path) : path;
+      // 只允许读回种子输出及一条嵌套匹配;另设大小和时长保护,不能把测试变成磁盘耗尽事故。
+      const grep =
+        mode === "system-grep-pipe"
+          ? "command grep -rn -m200001 self_search_needle ."
+          : "grep -J1 --sort=name -rn -m200001 self_search_needle .";
+      const command = `cd ${quoteShellValue(shellPath(searchRoot))} && ${grep}${mode.endsWith("pipe") ? " | cut -c 1-4096" : ""}`;
+      for (const useTmp of [false, true]) {
+        const outputRoot = join(searchRoot, "zz-output");
+        const execution = new NodeExecutionAdapter({
+          outputRootDir: outputRoot,
+          ...(useTmp ? { bashOutputTempDir: tempParent } : {}),
+          processEnv: { ...process.env, PATH: nativeShellPathEntries().join(delimiter) },
+        });
+        const deadline = setTimeout(() => void execution.close(), 10_000);
+        const controlPath = join(
+          outputRoot,
+          "native-search-e2e",
+          "tool_native_search_e2e-stdout.log",
+        );
+        const sizeGuard = setInterval(() => {
+          void stat(controlPath).then(
+            (file) => {
+              if (file.size >= 64 * 1024 * 1024) return execution.close();
+            },
+            () => undefined,
+          );
+        }, 25);
+        try {
+          const result = await runBashToolCall(command, backend, execution);
+          expectToolCallExit(result, 0);
+          const outputPath = result.persistedOutputPath!;
+          expect(outputPath).toBeTruthy();
+          expect((await stat(outputPath)).size).toBeLessThan(64 * 1024 * 1024);
+          const text = await readFile(outputPath, "utf8");
+          const nested = /stdout\.log:\d+:/u.test(text);
+          if (useTmp) {
+            expect(outputPath.startsWith(tempParent)).toBe(true);
+            expect(nested).toBe(false);
+            expect(text.match(/self_search_needle/g)).toHaveLength(200_000);
+          } else if (
+            mode === "ugrep-pipe" ||
+            process.platform === "win32" ||
+            (mode === "system-grep-pipe" && process.platform === "linux")
+          ) {
+            expect(nested).toBe(true);
+          }
+        } finally {
+          clearTimeout(deadline);
+          clearInterval(sizeGuard);
+          await execution.close();
+          await rm(outputRoot, { recursive: true, force: true });
+        }
+      }
+    },
+    30_000,
+  );
+
   async function runBashToolCall(
     command: string,
     selectedBackend: EmbeddedSearchBackend = backend,

+ 82 - 0
apps/zcode-cli/packages/bootstrap/tests/plugins-protocol.test.ts

@@ -40,6 +40,7 @@ import { getCliStorageRoot, getPluginStorageRoot } from "../src/app/paths.js";
 import { installZCodeMarketplacePlugin } from "../src/plugins.js";
 import {
   addPluginMarketplace,
+  describePlugin,
   getPluginsOverview,
   installPlugin,
   listPlugins,
@@ -107,6 +108,87 @@ describe("plugins protocol contracts", () => {
     }
   });
 
+  it("describes a cached marketplace candidate while a long install holds the storage lock", async () => {
+    const root = await mkdtemp(join(tmpdir(), "zcode-protocol-describe-lock-"));
+    const previousStorageDir = process.env.ZCODE_STORAGE_DIR;
+    process.env.ZCODE_STORAGE_DIR = join(root, "storage");
+    const pluginStorageRoot = getPluginStorageRoot(
+      getCliStorageRoot(process.env.ZCODE_STORAGE_DIR),
+    );
+    const marketplaceDir = join(pluginStorageRoot, "marketplaces", "e2e-describe");
+    await writeTestFile(
+      join(marketplaceDir, "marketplace.json"),
+      JSON.stringify({ name: "e2e-describe", plugins: [{ name: "local", source: "./local" }] }),
+    );
+    await writeTestFile(
+      join(marketplaceDir, "local", "skills", "describe-marker", "SKILL.md"),
+      "---\nname: describe-marker\ndescription: Describe marker\n---\n",
+    );
+    const lock = Promise.withResolvers<void>();
+    const entered = Promise.withResolvers<void>();
+    // 模拟长时间安装占住存储锁:详情读取已缓存 manifest 时不能排在它后面。
+    const blocker = withPluginStorageLock(pluginStorageRoot, async () => {
+      entered.resolve();
+      await lock.promise;
+    });
+    try {
+      await entered.promise;
+      const result = await Promise.race([
+        describePlugin({} as ZCodeProtocolAgentServerContext, {
+          workspace: { workspacePath: root, workspaceKey: root },
+          marketplace: "e2e-describe",
+          pluginName: "local",
+        }),
+        new Promise<"blocked">((resolve) => setTimeout(() => resolve("blocked"), 1000)),
+      ]);
+      expect(result).not.toBe("blocked");
+      expect(JSON.stringify(result)).toContain("describe-marker");
+    } finally {
+      lock.resolve();
+      await blocker;
+      if (previousStorageDir === undefined) delete process.env.ZCODE_STORAGE_DIR;
+      else process.env.ZCODE_STORAGE_DIR = previousStorageDir;
+      await rm(root, { force: true, recursive: true });
+    }
+  });
+
+  it("keeps describe behind the storage lock when the marketplace manifest must be written", async () => {
+    const root = await mkdtemp(join(tmpdir(), "zcode-protocol-describe-fetch-lock-"));
+    const previousStorageDir = process.env.ZCODE_STORAGE_DIR;
+    process.env.ZCODE_STORAGE_DIR = join(root, "storage");
+    const pluginStorageRoot = getPluginStorageRoot(
+      getCliStorageRoot(process.env.ZCODE_STORAGE_DIR),
+    );
+    const lock = Promise.withResolvers<void>();
+    const entered = Promise.withResolvers<void>();
+    const blocker = withPluginStorageLock(pluginStorageRoot, async () => {
+      entered.resolve();
+      await lock.promise;
+    });
+    try {
+      await entered.promise;
+      const describe = describePlugin({} as ZCodeProtocolAgentServerContext, {
+        workspace: { workspacePath: root, workspaceKey: root },
+        marketplace: "missing-marketplace",
+        pluginName: "missing",
+      }).then(() => "resolved");
+      expect(
+        await Promise.race([
+          describe,
+          new Promise<"blocked">((resolve) => setTimeout(() => resolve("blocked"), 50)),
+        ]),
+      ).toBe("blocked");
+      lock.resolve();
+      expect(await describe).toBe("resolved");
+    } finally {
+      lock.resolve();
+      await blocker;
+      if (previousStorageDir === undefined) delete process.env.ZCODE_STORAGE_DIR;
+      else process.env.ZCODE_STORAGE_DIR = previousStorageDir;
+      await rm(root, { force: true, recursive: true });
+    }
+  });
+
   it("registers plugin management methods", () => {
     expect(zcodeProtocolMethods.pluginsList).toBe("plugins/list");
     expect(zcodeProtocolMethods.pluginsSetEnabled).toBe("plugins/setEnabled");

+ 44 - 0
apps/zcode-cli/packages/bootstrap/tests/plugins.test.ts

@@ -195,6 +195,22 @@ describe("ZCode plugins", () => {
     }
   });
 
+  it("declares the ui component type exactly for bundled plugins with UI surfaces", async () => {
+    const packagesRoot = fileURLToPath(new URL("../../", import.meta.url));
+
+    for (const plugin of OFFICIAL_PLUGIN_DEFINITIONS) {
+      const packageRoot = join(packagesRoot, basename(plugin.rootCandidates[0] ?? ""));
+      const pluginManifest = JSON.parse(
+        await readFile(join(packageRoot, ".zcode-plugin", "plugin.json"), "utf8"),
+      ) as { ui?: { surfaces?: unknown[] } };
+      // 卸载后的可恢复条目没有运行时信息,商店只能靠定义里的 componentTypes 归入「UI 插件」。
+      expect(
+        plugin.componentTypes?.includes("ui") ?? false,
+        plugin.name,
+      ).toBe((pluginManifest.ui?.surfaces?.length ?? 0) > 0);
+    }
+  });
+
   it("rejects an incomplete Browser Use filesystem or SEA seed", () => {
     const browserUse = OFFICIAL_PLUGIN_DEFINITIONS.find((plugin) => plugin.name === "browser-use");
     if (!browserUse) throw new Error("missing Browser Use official plugin definition");
@@ -552,6 +568,34 @@ describe("ZCode plugins", () => {
     }
   });
 
+  it("keeps the ui component type on a suppressed bundled document plugin", async () => {
+    const root = await mkdtemp(join(tmpdir(), "zcode-bootstrap-restorable-ui-"));
+    const pluginStorageRoot = join(root, "plugins");
+    const userConfigPath = join(root, "config.json");
+    const documentsId = "documents@zcode-plugins-official";
+
+    try {
+      await writeFile(
+        userConfigPath,
+        JSON.stringify({ plugins: { enabled: true, suppressedBuiltins: [documentsId] } }),
+      );
+      const overview = getZCodePluginsOverview({
+        pluginStorageRoot,
+        userConfigPath,
+        workingDirectory: root,
+      });
+      // UI 合并时优先保留目录条目的 summary,所以目录条目与可恢复条目都必须带 "ui"。
+      expect(
+        overview.availablePlugins.find((plugin) => plugin.id === documentsId)?.componentTypes,
+      ).toContain("ui");
+      expect(
+        overview.restorableBuiltins.find((plugin) => plugin.id === documentsId)?.componentTypes,
+      ).toEqual(["ui"]);
+    } finally {
+      await rm(root, { force: true, recursive: true });
+    }
+  });
+
   it("includes the merged ZCode official marketplace and Claude marketplace for empty storage", async () => {
     const root = await mkdtemp(join(tmpdir(), "zcode-bootstrap-default-marketplace-"));
 

+ 7 - 0
apps/zcode-cli/packages/bootstrap/tests/provider-registry-app-runtime.test.ts

@@ -1,3 +1,5 @@
+import { tmpdir } from "node:os";
+import * as executionAdapters from "@zcode/adapters/exec";
 import { createSqliteSessionStore } from "@zcode/adapters/storage";
 import {
   SESSION_ENTRY_MODEL_SELECTION,
@@ -51,6 +53,7 @@ describe("ZCode App Provider Registry runtime", () => {
       skipUserConfig: true,
     } as const;
 
+    const execution = vi.spyOn(executionAdapters, "createNodeExecutionAdapter");
     const configured = await createZCodeApp({
       ...common,
       configuredDefaultModelSelection: {
@@ -59,6 +62,10 @@ describe("ZCode App Provider Registry runtime", () => {
         options: { reasoningLevel: "low" },
       },
     });
+    expect(execution).toHaveBeenCalledWith(
+      expect.objectContaining({ bashOutputTempDir: tmpdir() }),
+    );
+    execution.mockRestore();
     expect(configured.getModel()).toBe("provider-a/model-b");
     expect(configured.getThoughtLevel()).toBe("low");
     await configured.close?.();

+ 9 - 0
apps/zcode-cli/packages/bootstrap/tests/script-workflow-child-runtime.test.ts

@@ -1,3 +1,4 @@
+import * as executionAdapters from "@zcode/adapters/exec";
 import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
 import { tmpdir } from "node:os";
 import { join } from "node:path";
@@ -142,7 +143,15 @@ describe("script workflow child runtime — actor transcript 直播通道", () =
   }
 
   it("actor runtime 与父 runtime 共享 event store", async () => {
+    const execution = vi.spyOn(executionAdapters, "createNodeExecutionAdapter");
     const actorRuntime = await makeActorRuntime();
+    expect(execution).toHaveBeenCalledWith(
+      expect.objectContaining({
+        bashOutputTempDir: tmpdir(),
+        outputRootDir: join(tempRoot, "cli", "exec"),
+      }),
+    );
+    execution.mockRestore();
     expect(actorRuntime.getSessionEventStore()).toBe(parentStore);
 
     await actorRuntime.ensureSessionPersistedForExternalActivity("workflow actor a#1@1");

+ 294 - 222
apps/zcode-cli/packages/bootstrap/tests/v4-cold-resume.test.ts

@@ -1138,7 +1138,13 @@ describe("v4 冷恢复(集成:真 sqlite + server + binder)", () => {
   async function seedPersistedSession(
     dbPath: string,
     workspaceIdentity?: WorkspaceId,
-    taskType: "interactive" | "fork" | "subagent_child" = "interactive",
+    taskType:
+      | "interactive"
+      | "fork"
+      | "subagent_child"
+      | "workflow_child"
+      | "nested_workflow_child"
+      | "selection_side_chat" = "interactive",
   ): Promise<void> {
     const store = await createSqliteSessionStore({ dbPath });
     try {
@@ -2006,180 +2012,238 @@ describe("v4 冷恢复(集成:真 sqlite + server + binder)", () => {
     }
   });
 
-  for (const clientMode of ["desktop-continuous", "web-remote-replayable"] as const) {
-    for (const lifecycle of ["warm", "grace", "parent-release", "cold"] as const) {
-      it(`SAT27/SAT28: ${clientMode} child ${lifecycle} 重开保持隐藏且拒绝用户输入`, async () => {
-        const dbPath = join(tempRoot, "sessions.db");
-        await seedPersistedSession(dbPath, undefined, "subagent_child");
-        const sentInputs: Array<{ text: string }> = [];
-        const options: ZCodeAppOptions[] = [];
-        const { server, store } = await bootRestartedServer(dbPath, sentInputs, undefined, options);
-        const { v4Gateway: gateway } = (
-          server as unknown as {
-            context: { v4Gateway: ConversationV4Gateway };
+  for (const childKind of ["subagent_child", "workflow_child", "nested_workflow_child"] as const) {
+    for (const clientMode of ["desktop-continuous", "web-remote-replayable"] as const) {
+      for (const lifecycle of ["warm", "grace", "parent-release", "cold"] as const) {
+        it(`SAT27/SAT28: ${clientMode} ${childKind} ${lifecycle} 重开保持隐藏且拒绝用户输入`, async () => {
+          const dbPath = join(tempRoot, "sessions.db");
+          await seedPersistedSession(dbPath, undefined, childKind);
+          const sentInputs: Array<{ text: string }> = [];
+          const options: ZCodeAppOptions[] = [];
+          const { server, store } = await bootRestartedServer(
+            dbPath,
+            sentInputs,
+            undefined,
+            options,
+          );
+          const { v4Gateway: gateway } = (
+            server as unknown as {
+              context: { v4Gateway: ConversationV4Gateway };
+            }
+          ).context;
+          async function subscribe(id: string, topic: string) {
+            await requestResult(server, {
+              id,
+              method: V4_METHODS.conversationSubscribe,
+              params: { topic, connectionId: id, clientMode },
+            });
+            return takeInitialFrameParams(server, id);
           }
-        ).context;
-        async function subscribe(id: string, topic: string) {
-          await requestResult(server, {
-            id,
-            method: V4_METHODS.conversationSubscribe,
-            params: { topic, connectionId: id, clientMode },
-          });
-          return takeInitialFrameParams(server, id);
-        }
-        try {
-          await subscribe("index-before", sessionsIndexTopic(WORKSPACE_PATH));
-          if (lifecycle !== "cold") {
-            gateway.ingestDetachedLiveSession(
-              SESSION_ID,
-              makeEvent(SESSION_ID, 1, SessionEventType.SessionCreated, {
-                mode: "default",
-                contextWindow: 200_000,
-              }),
-              PARENT_SESSION_ID,
-            );
-            gateway.ingestDetachedLiveSession(
-              SESSION_ID,
-              {
-                ...makeEvent(SESSION_ID, 2, SessionEventType.TurnStarted, {
-                  turnNumber: 1,
-                  input: "child task",
-                }),
-                turnId: "child-turn",
-              },
-              PARENT_SESSION_ID,
-            );
-            gateway.ingestDetachedLiveSession(
-              SESSION_ID,
-              {
-                ...makeEvent(SESSION_ID, 3, SessionEventType.ModelStreaming, {
-                  kind: "text_delta",
-                  delta: "child done",
-                  done: false,
-                }),
-                turnId: "child-turn",
-              },
-              PARENT_SESSION_ID,
-            );
-            gateway.ingestDetachedLiveSession(
-              SESSION_ID,
-              {
-                ...makeEvent(SESSION_ID, 4, SessionEventType.TurnComplete, {
-                  duration: 1,
-                  response: "done",
-                  resultType: "success",
-                  tokenCount: 1,
-                  toolCallCount: 0,
+          try {
+            await subscribe("index-before", sessionsIndexTopic(WORKSPACE_PATH));
+            if (lifecycle !== "cold") {
+              gateway.ingestDetachedLiveSession(
+                SESSION_ID,
+                makeEvent(SESSION_ID, 1, SessionEventType.SessionCreated, {
+                  mode: "default",
+                  contextWindow: 200_000,
                 }),
-                turnId: "child-turn",
-              },
-              PARENT_SESSION_ID,
-            );
-          }
-          if (lifecycle === "grace")
-            expect(gateway.pruneDetachedChildPublishers(Date.now() + 180_000)).toBe(1);
-          if (lifecycle === "parent-release") gateway.deactivateSession(PARENT_SESSION_ID);
-          const child = conversationTopicFrameSchema.parse(
-            await subscribe("child", conversationTopic(SESSION_ID)),
-          );
-          if (child.payload.kind !== "snapshot") throw new Error("expected child snapshot");
-          expect(child.payload.snapshot.rows.window.length).toBeGreaterThan(0);
-          const index = sessionsIndexTopicFrameSchema.parse(
-            await subscribe("index-after", sessionsIndexTopic(WORKSPACE_PATH)),
-          );
-          if (index.payload.kind !== "snapshot") throw new Error("expected index snapshot");
-          expect(index.payload.snapshot.sessions.map((session) => session.sessionId)).not.toContain(
-            SESSION_ID,
-          );
-          const legacy = (await requestResult(server, {
-            id: "legacy-list",
-            method: zcodeProtocolMethods.sessionList,
-            params: { workspace },
-          })) as { sessions: Array<{ sessionId: string }> };
-          expect(legacy.sessions.map((session) => session.sessionId)).not.toContain(SESSION_ID);
-          expect((await store.getSession(SESSION_ID))?.taskType).toBe("subagent_child");
-          if (lifecycle !== "warm")
-            expect(
-              options.find((option) => option.sessionId === SESSION_ID)?.runtimeConfig?.taskType,
-            ).toBe("subagent_child");
-          for (const type of [
-            "sendText",
-            "sendGoalCommand",
-            "compact",
-            "retryTurn",
-            "editUserQuery",
-          ] as const) {
-            const targetRow = child.payload.snapshot.rows.window.findLast(
-              (row) => row.kind === (type === "editUserQuery" ? "userInput" : "assistantText"),
-            );
-            const ack = commandAckSchema.parse(
-              await requestResult(server, {
-                id: type,
-                method: V4_METHODS.command,
-                params: {
-                  commandId: `child-${type}`,
-                  clientId: "child-test",
-                  sessionId: SESSION_ID,
-                  type,
-                  baseRevision: child.payload.snapshot.revision,
-                  baseLogEpoch: child.payload.snapshot.logEpoch,
-                  payload:
-                    type === "sendText" || type === "sendGoalCommand"
-                      ? { text: "continue child" }
-                      : type === "retryTurn" || type === "editUserQuery"
-                        ? {
-                            target: {
-                              rowId: targetRow?.rowId ?? 1,
-                              entityId: targetRow?.entityId ?? "missing",
-                            },
-                            ...(type === "editUserQuery" ? { newText: "edit child" } : {}),
-                          }
-                        : {},
-                  issuedAt: Date.now(),
+                PARENT_SESSION_ID,
+              );
+              gateway.ingestDetachedLiveSession(
+                SESSION_ID,
+                {
+                  ...makeEvent(SESSION_ID, 2, SessionEventType.TurnStarted, {
+                    turnNumber: 1,
+                    input: "child task",
+                  }),
+                  turnId: "child-turn",
+                },
+                PARENT_SESSION_ID,
+              );
+              gateway.ingestDetachedLiveSession(
+                SESSION_ID,
+                {
+                  ...makeEvent(SESSION_ID, 3, SessionEventType.ModelStreaming, {
+                    kind: "text_delta",
+                    delta: "child done",
+                    done: false,
+                  }),
+                  turnId: "child-turn",
                 },
-              }),
+                PARENT_SESSION_ID,
+              );
+              gateway.ingestDetachedLiveSession(
+                SESSION_ID,
+                {
+                  ...makeEvent(SESSION_ID, 4, SessionEventType.TurnComplete, {
+                    duration: 1,
+                    response: "done",
+                    resultType: "success",
+                    tokenCount: 1,
+                    toolCallCount: 0,
+                  }),
+                  turnId: "child-turn",
+                },
+                PARENT_SESSION_ID,
+              );
+            }
+            if (lifecycle === "grace")
+              expect(gateway.pruneDetachedChildPublishers(Date.now() + 180_000)).toBe(1);
+            if (lifecycle === "parent-release") gateway.deactivateSession(PARENT_SESSION_ID);
+            const child = conversationTopicFrameSchema.parse(
+              await subscribe("child", conversationTopic(SESSION_ID)),
             );
-            expect(ack).toMatchObject(
-              lifecycle === "warm"
-                ? { status: "rejected", reasonCode: "proto.sessionNotFound" }
-                : { status: "failed", reasonCode: "guard.subagentReadOnly" },
+            if (child.payload.kind !== "snapshot") throw new Error("expected child snapshot");
+            expect(child.payload.snapshot.rows.window.length).toBeGreaterThan(0);
+            const index = sessionsIndexTopicFrameSchema.parse(
+              await subscribe("index-after", sessionsIndexTopic(WORKSPACE_PATH)),
             );
+            if (index.payload.kind !== "snapshot") throw new Error("expected index snapshot");
+            expect(
+              index.payload.snapshot.sessions.map((session) => session.sessionId),
+            ).not.toContain(SESSION_ID);
+            const legacy = (await requestResult(server, {
+              id: "legacy-list",
+              method: zcodeProtocolMethods.sessionList,
+              params: { workspace },
+            })) as { sessions: Array<{ sessionId: string }> };
+            expect(legacy.sessions.map((session) => session.sessionId)).not.toContain(SESSION_ID);
+            expect((await store.getSession(SESSION_ID))?.taskType).toBe(childKind);
+            if (lifecycle !== "warm")
+              expect(
+                options.find((option) => option.sessionId === SESSION_ID)?.runtimeConfig?.taskType,
+              ).toBe(childKind);
+            for (const type of [
+              "sendText",
+              "sendGoalCommand",
+              "compact",
+              "retryTurn",
+              "editUserQuery",
+            ] as const) {
+              const targetRow = child.payload.snapshot.rows.window.findLast(
+                (row) => row.kind === (type === "editUserQuery" ? "userInput" : "assistantText"),
+              );
+              const ack = commandAckSchema.parse(
+                await requestResult(server, {
+                  id: type,
+                  method: V4_METHODS.command,
+                  params: {
+                    commandId: `child-${type}`,
+                    clientId: "child-test",
+                    sessionId: SESSION_ID,
+                    type,
+                    baseRevision: child.payload.snapshot.revision,
+                    baseLogEpoch: child.payload.snapshot.logEpoch,
+                    payload:
+                      type === "sendText" || type === "sendGoalCommand"
+                        ? { text: "continue child" }
+                        : type === "retryTurn" || type === "editUserQuery"
+                          ? {
+                              target: {
+                                rowId: targetRow?.rowId ?? 1,
+                                entityId: targetRow?.entityId ?? "missing",
+                              },
+                              ...(type === "editUserQuery" ? { newText: "edit child" } : {}),
+                            }
+                          : {},
+                    issuedAt: Date.now(),
+                  },
+                }),
+              );
+              expect(ack).toMatchObject(
+                lifecycle === "warm"
+                  ? { status: "rejected", reasonCode: "proto.sessionNotFound" }
+                  : { status: "failed", reasonCode: "guard.subagentReadOnly" },
+              );
+            }
+            expect(await store.listSessionInputs({ sessionID: SESSION_ID })).toEqual([]);
+            expect(sentInputs).toEqual([]);
+          } finally {
+            gateway.dispose();
+            store.close();
           }
-          expect(await store.listSessionInputs({ sessionID: SESSION_ID })).toEqual([]);
-          expect(sentInputs).toEqual([]);
-        } finally {
-          gateway.dispose();
-          store.close();
-        }
-      });
+        });
+      }
     }
   }
 
-  it("SAT28: legacy session/send 同样拒绝 child 续聊", async () => {
-    const dbPath = join(tempRoot, "sessions.db");
-    await seedPersistedSession(dbPath, undefined, "subagent_child");
-    const { server, store } = await bootRestartedServer(dbPath, []);
-    try {
-      await requestResult(server, {
-        id: "open-child",
-        method: V4_METHODS.conversationSubscribe,
-        params: {
-          topic: conversationTopic(SESSION_ID),
-          connectionId: "legacy-child",
-          clientMode: "desktop-continuous",
-        },
-      });
-      const result = await server.handleMessage({
-        id: "legacy-send",
-        method: zcodeProtocolMethods.sessionSend,
-        params: { sessionId: SESSION_ID, content: "continue child", queryId: "legacy-child-send" },
-      });
-      expect(result).toMatchObject({ error: { data: { reasonCode: "guard.subagentReadOnly" } } });
-      expect(await store.listSessionInputs({ sessionID: SESSION_ID })).toEqual([]);
-    } finally {
-      store.close();
-    }
-  });
+  it.each(["subagent_child", "workflow_child", "nested_workflow_child"] as const)(
+    "SAT28: legacy session/send 同样拒绝 %s 续聊",
+    async (childKind) => {
+      const dbPath = join(tempRoot, "sessions.db");
+      await seedPersistedSession(dbPath, undefined, childKind);
+      const { server, store } = await bootRestartedServer(dbPath, []);
+      try {
+        await requestResult(server, {
+          id: "open-child",
+          method: V4_METHODS.conversationSubscribe,
+          params: {
+            topic: conversationTopic(SESSION_ID),
+            connectionId: "legacy-child",
+            clientMode: "desktop-continuous",
+          },
+        });
+        const result = await server.handleMessage({
+          id: "legacy-send",
+          method: zcodeProtocolMethods.sessionSend,
+          params: {
+            sessionId: SESSION_ID,
+            content: "continue child",
+            queryId: "legacy-child-send",
+          },
+        });
+        expect(result).toMatchObject({ error: { data: { reasonCode: "guard.subagentReadOnly" } } });
+        expect(await store.listSessionInputs({ sessionID: SESSION_ID })).toEqual([]);
+      } finally {
+        store.close();
+      }
+    },
+  );
+
+  it.each(["desktop-continuous", "web-remote-replayable"] as const)(
+    "SAT30: selection side chat remains writable after cold resume on %s",
+    async (clientMode) => {
+      const dbPath = join(tempRoot, "sessions.db");
+      await seedPersistedSession(dbPath, undefined, "selection_side_chat");
+      const sentInputs: Array<{ text: string }> = [];
+      const { server, store } = await bootRestartedServer(dbPath, sentInputs);
+      try {
+        await requestResult(server, {
+          id: "open-side",
+          method: V4_METHODS.conversationSubscribe,
+          params: { topic: conversationTopic(SESSION_ID), connectionId: "side-test", clientMode },
+        });
+        const frame = conversationTopicFrameSchema.parse(
+          takeInitialFrameParams(server, "open-side"),
+        );
+        if (frame.payload.kind !== "snapshot") throw new Error("expected snapshot");
+        const ack = await requestResult(server, {
+          id: "send-side",
+          method: V4_METHODS.command,
+          params: {
+            commandId: "side-send",
+            clientId: "side-test",
+            sessionId: SESSION_ID,
+            type: "sendText",
+            baseRevision: frame.payload.snapshot.revision,
+            baseLogEpoch: frame.payload.snapshot.logEpoch,
+            payload: { text: "continue side chat" },
+            issuedAt: Date.now(),
+          },
+        });
+        expect(ack).toMatchObject({ status: "accepted" });
+        await vi.waitFor(() =>
+          expect(sentInputs).toContainEqual(
+            expect.objectContaining({ text: "continue side chat" }),
+          ),
+        );
+        expect((await store.getSession(SESSION_ID))?.taskType).toBe("selection_side_chat");
+      } finally {
+        store.close();
+      }
+    },
+  );
 
   it("SAT29: 显式 session/list 按 workspace 查询隐藏身份,不激活 child;普通列表保留 fork", async () => {
     const dbPath = join(tempRoot, "sessions.db");
@@ -2221,63 +2285,71 @@ describe("v4 冷恢复(集成:真 sqlite + server + binder)", () => {
     }
   });
 
-  it.each(["valid", "foreign-parent", "missing-parent", "foreign-cwd", "foreign-child", "cycle"])(
-    "SAT30: explicit remote child metadata resolves persisted lineage (%s) without activation",
-    async (scenario) => {
-      const dbPath = join(tempRoot, "sessions.db");
-      await seedPersistedSession(
-        dbPath,
-        scenario === "foreign-child"
-          ? ("remote:server:other:/workspace/cold-resume" as WorkspaceId)
-          : undefined,
-        "subagent_child",
-      );
-      const options: ZCodeAppOptions[] = [];
-      const { server, store } = await bootRestartedServer(dbPath, [], undefined, options);
-      try {
-        if (scenario !== "missing-parent") {
-          await store.createSession({
-            id: PARENT_SESSION_ID,
-            ...(scenario === "cycle"
-              ? { parentID: SESSION_ID }
-              : {
-                  workspaceID:
-                    scenario === "foreign-parent"
-                      ? ("remote:server:other:/workspace/cold-resume" as WorkspaceId)
-                      : REMOTE_WORKSPACE_IDENTITY,
-                }),
-            taskType: scenario === "cycle" ? "subagent_child" : "interactive",
-            projectID: "project" as ProjectId,
-            slug: "parent",
-            title: "parent",
-            directory: scenario === "foreign-cwd" ? `${WORKSPACE_PATH}-other` : WORKSPACE_PATH,
-            path: scenario === "foreign-cwd" ? `${WORKSPACE_PATH}-other` : WORKSPACE_PATH,
-            version: "test",
-          });
-        }
-        const explicit = (await requestResult(server, {
-          id: "legacy-child",
-          method: zcodeProtocolMethods.sessionList,
-          params: { workspace: remoteWorkspace, sessionIds: [SESSION_ID] },
-        })) as { sessions: Array<{ sessionId: string; workspace: unknown }> };
-        expect(explicit.sessions.map((session) => session.sessionId)).toEqual(
-          scenario === "valid" ? [SESSION_ID] : [],
+  describe.each([
+    "subagent_child",
+    "workflow_child",
+    "selection_side_chat",
+    "nested_workflow_child",
+  ] as const)("SAT30 %s", (childKind) => {
+    it.each(["valid", "foreign-parent", "missing-parent", "foreign-cwd", "foreign-child", "cycle"])(
+      "SAT30: explicit remote child metadata resolves persisted lineage (%s) without activation",
+      async (scenario) => {
+        const dbPath = join(tempRoot, "sessions.db");
+        await seedPersistedSession(
+          dbPath,
+          scenario === "foreign-child"
+            ? ("remote:server:other:/workspace/cold-resume" as WorkspaceId)
+            : undefined,
+          childKind,
         );
-        if (scenario === "valid") expect(explicit.sessions[0]?.workspace).toEqual(remoteWorkspace);
-        const normal = (await requestResult(server, {
-          id: "normal-list",
-          method: zcodeProtocolMethods.sessionList,
-          params: { workspace: remoteWorkspace },
-        })) as { sessions: Array<{ sessionId: string }> };
-        expect(normal.sessions.some((session) => session.sessionId === SESSION_ID)).toBe(false);
-        expect(options).toEqual([]);
-        if (scenario !== "foreign-child")
-          expect((await store.getSession(SESSION_ID))?.workspaceID).toBeUndefined();
-      } finally {
-        store.close();
-      }
-    },
-  );
+        const options: ZCodeAppOptions[] = [];
+        const { server, store } = await bootRestartedServer(dbPath, [], undefined, options);
+        try {
+          if (scenario !== "missing-parent") {
+            await store.createSession({
+              id: PARENT_SESSION_ID,
+              ...(scenario === "cycle"
+                ? { parentID: SESSION_ID }
+                : {
+                    workspaceID:
+                      scenario === "foreign-parent"
+                        ? ("remote:server:other:/workspace/cold-resume" as WorkspaceId)
+                        : REMOTE_WORKSPACE_IDENTITY,
+                  }),
+              taskType: scenario === "cycle" ? childKind : "interactive",
+              projectID: "project" as ProjectId,
+              slug: "parent",
+              title: "parent",
+              directory: scenario === "foreign-cwd" ? `${WORKSPACE_PATH}-other` : WORKSPACE_PATH,
+              path: scenario === "foreign-cwd" ? `${WORKSPACE_PATH}-other` : WORKSPACE_PATH,
+              version: "test",
+            });
+          }
+          const explicit = (await requestResult(server, {
+            id: "legacy-child",
+            method: zcodeProtocolMethods.sessionList,
+            params: { workspace: remoteWorkspace, sessionIds: [SESSION_ID] },
+          })) as { sessions: Array<{ sessionId: string; workspace: unknown }> };
+          expect(explicit.sessions.map((session) => session.sessionId)).toEqual(
+            scenario === "valid" ? [SESSION_ID] : [],
+          );
+          if (scenario === "valid")
+            expect(explicit.sessions[0]?.workspace).toEqual(remoteWorkspace);
+          const normal = (await requestResult(server, {
+            id: "normal-list",
+            method: zcodeProtocolMethods.sessionList,
+            params: { workspace: remoteWorkspace },
+          })) as { sessions: Array<{ sessionId: string }> };
+          expect(normal.sessions.some((session) => session.sessionId === SESSION_ID)).toBe(false);
+          expect(options).toEqual([]);
+          if (scenario !== "foreign-child")
+            expect((await store.getSession(SESSION_ID))?.workspaceID).toBeUndefined();
+        } finally {
+          store.close();
+        }
+      },
+    );
+  });
 
   it("重启后冷订阅:transcript 合成重建历史 + 可交互 + sendText 再发一轮成功", async () => {
     const dbPath = join(tempRoot, "sessions.db");

+ 37 - 2
apps/zcode-cli/packages/bootstrap/tests/workflow-concurrency-governor.test.ts

@@ -369,7 +369,7 @@ describe("workflow concurrency governor — ticket 上的事件映射(决策 2
   });
 
   it("retryable:false 的 rate_limited failed(主对话 / 工具侧撞 3008)→ 一次 throttled(apps/zcode-cli/packages/dynamic-workflow/docs/execution-engine.md)", () => {
-    const { governor, admitNow } = makeGovernor();
+    const { governor, admitNow, clock } = makeGovernor();
     const ticket = admitNow();
     outcome.started(ticket);
     void ticket.publish(
@@ -378,12 +378,47 @@ describe("workflow concurrency governor — ticket 上的事件映射(决策 2
         reason: "rate_limited",
         retryable: false,
         message: "[3008] user concurrency limit exceeded",
+        errorCode: "model_rate_limited",
+        providerErrorCode: "3008",
         retryAfterMs: 5_000,
       } as never),
     );
-    expect(governor.snapshot(KEY_A)).toMatchObject({ inFlight: 0, cap: 6 });
+    expect(governor.snapshot(KEY_A)).toMatchObject({
+      inFlight: 0,
+      cap: 6,
+      cooldownUntil: clock.now() + 5_000,
+    });
   });
 
+  // 配额 429(1308 + Retry-After)是 Stop 集:run 停下、由用户决定何时再试。它若按限流记,
+  // Retry-After(常指到额度窗口结束)会冻住整个桶,用户用重置卡恢复额度后 resume 仍卡在闸门上。
+  it.each([
+    ["run 的 ticket", "run"],
+    ["主代理 observer 的 ticket", "observer"],
+  ] as const)(
+    "Stop 集失败(配额 1308 带 Retry-After,来自%s)不动 cap 也不冷却:resume 立即准入(docs/dynamic-workflow/concurrency.md「Reading a ticket」)",
+    async (_label, source) => {
+      const { governor, admitNow, observe } = makeGovernor();
+      const ticket = source === "run" ? admitNow() : await observe();
+      outcome.started(ticket);
+      void ticket.publish(
+        statusEvent({
+          type: "model_request_failed",
+          reason: "rate_limited",
+          retryable: false,
+          message: "[1308] 已达到 5 小时的使用上限",
+          errorCode: "model_rate_limited",
+          providerErrorCode: "1308",
+          retryAfterMs: 3 * 60 * 60 * 1000,
+        } as never),
+      );
+      const snapshot = governor.snapshot(KEY_A)!;
+      expect(snapshot).toMatchObject({ inFlight: 0, cap: CEILING });
+      expect(snapshot.cooldownUntil).toBeUndefined();
+      expect(governor.tryAdmit("resumed-run", KEY_A)).toBeDefined();
+    },
+  );
+
   it("retryable:false 的 failed 只减 inFlight,不动 cap 与 streak", () => {
     const { governor, admitNow } = makeGovernor();
     for (let i = 0; i < 3; i++) outcome.completed(admitNow());

+ 7 - 0
apps/zcode-cli/packages/bootstrap/tests/workflow-effective-selection.test.ts

@@ -1,3 +1,4 @@
+import * as executionAdapters from "@zcode/adapters/exec";
 import { mkdtemp, rm } from "node:fs/promises";
 import { tmpdir } from "node:os";
 import { join } from "node:path";
@@ -28,6 +29,7 @@ describe("Workflow 内显式 Subagent 的有效选择", () => {
       const resolve = vi.fn(() => ({ effectiveSelection: effective }));
       const executed: string[] = [];
       let requestedChild = false;
+      const execution = vi.spyOn(executionAdapters, "createNodeExecutionAdapter");
       const app = await createRegistryBackedTestApp({
         env: { ZCODE_HOME: root },
         skipUserConfig: true,
@@ -85,6 +87,10 @@ describe("Workflow 内显式 Subagent 的有效选择", () => {
       });
       try {
         await app.runExpertWorkflow({ task: "Research with the researcher." });
+        expect(execution.mock.calls.length).toBeGreaterThanOrEqual(2);
+        for (const [options] of execution.mock.calls) {
+          expect(options?.bashOutputTempDir).toBe(tmpdir());
+        }
         expect(resolve).toHaveBeenCalledWith(original);
         expect(executed).toContain("new-account");
         expect(executed).not.toContain("old-account");
@@ -92,6 +98,7 @@ describe("Workflow 内显式 Subagent 的有效选择", () => {
         expect(app.runtime.getSessionModelSelection()).toEqual(parent);
         expect(app.runtime.getMode()).toBe(mode);
       } finally {
+        execution.mockRestore();
         await app.close?.();
         store.close();
         await rm(root, { recursive: true, force: true });

+ 8 - 0
apps/zcode-cli/packages/bootstrap/tests/workflow-fault-matrix.stop.test.ts

@@ -164,6 +164,14 @@ for (const row of STOP_ROWS) {
             false,
           );
           expect(obs.governor.snapshot(obs.key)?.inFlight ?? 0).toBe(0);
+          // Stop 集不是并发信号:桶既不降 cap 也不冷却,resume(额度恢复后)同一模型立即准入,
+          // 而不是在闸门上静默等到 Retry-After 指的额度窗口结束。
+          const snapshot = obs.governor.snapshot(obs.key);
+          expect(snapshot?.cooldownUntil).toBeUndefined();
+          expect(snapshot?.cap).toBe(snapshot?.initial);
+          const resumed = obs.governor.tryAdmit("resumed-run", obs.key);
+          expect(resumed).toBeDefined();
+          resumed?.release();
         } finally {
           await server.close();
         }

+ 52 - 0
apps/zcode-cli/packages/bootstrap/tests/zcode-protocol-transport.test.ts

@@ -690,6 +690,58 @@ describe("ZCodeProtocolNdjsonConnection", () => {
     input.end();
     await connection.waitForClose();
   });
+
+  it("answers plugin read requests while an install runs and another install waits behind it", async () => {
+    const input = new PassThrough();
+    const output = new PassThrough();
+    const installEntered = Promise.withResolvers<void>();
+    const finishInstall = Promise.withResolvers<void>();
+    const readsAnswered = Promise.withResolvers<void>();
+    const readMethods: string[] = [
+      zcodeProtocolMethods.pluginsDescribe,
+      zcodeProtocolMethods.pluginsList,
+      zcodeProtocolMethods.pluginsOverview,
+    ];
+    const order: string[] = [];
+    const connection = new ZCodeProtocolNdjsonConnection({
+      handleMessage: async (message) => {
+        if (!("method" in message) || !("id" in message)) return undefined;
+        order.push(`${message.method}#${message.id}`);
+        if (message.id === 1) {
+          installEntered.resolve();
+          await finishInstall.promise;
+        }
+        if (order.length === 1 + readMethods.length) readsAnswered.resolve();
+        return { id: message.id, result: {} };
+      },
+      input,
+      output,
+    });
+    connection.start();
+    try {
+      input.write(frame({ id: 1, method: zcodeProtocolMethods.pluginsInstall, params: {} }));
+      await installEntered.promise;
+      // B 排在 A 后面时,详情和新标签页的列表加载也不能等「最后排队请求开始」这个屏障。
+      input.write(
+        frame({ id: 2, method: zcodeProtocolMethods.pluginsInstall, params: {} }) +
+          readMethods
+            .map((method, index) => frame({ id: index + 3, method, params: {} }))
+            .join(""),
+      );
+      await readsAnswered.promise;
+      expect(order).toEqual([
+        "plugins/install#1",
+        "plugins/describe#3",
+        "plugins/list#4",
+        "plugins/overview#5",
+      ]);
+    } finally {
+      finishInstall.resolve();
+      input.end();
+      await connection.waitForClose();
+    }
+    expect(order.at(-1)).toBe("plugins/install#2");
+  });
 });
 
 function frame(message: ZCodeProtocolMessage): string {

+ 1 - 1
apps/zcode-cli/packages/dynamic-workflow/docs/execution-engine.md

@@ -856,7 +856,7 @@ Shapes are small scripts that differ only in parallelism, subagent count, and as
 | zero requests after stop | any request that reaches the server after `run-settled` plus a 10 ms wire grace is matched by a `cancelled` echo from the runner |
 | in-flight bound | the server's peak in-flight count never exceeds the cell's ceiling (8) |
 
-Two lifecycle cells exercise "Engine ownership" on the same bed: B18 closes the service under a live run, B19 writes a foreign terminal row under a live engine. The quick matrix runs in the default bootstrap suite; the full matrix runs when `ZCODE_FAULT_MATRIX=full` is set, with a 30 s ceiling per cell. Two production seams exist for this bed: the driver clock (`now`, `schedule`, `stallAfterMs`, `quiesceMs`) is injectable, and the adapter keeps `retryAfterMs` on its normalized error.
+The quota cell (B11) also checks what a resume will meet: right after the stop, a new request on the same provider and model is admitted at once, because a `stop`-class failure moves neither the governor's cap nor its cooldown (`docs/dynamic-workflow/concurrency.md`, "Reading a ticket"). Two lifecycle cells exercise "Engine ownership" on the same bed: B18 closes the service under a live run, B19 writes a foreign terminal row under a live engine. The quick matrix runs in the default bootstrap suite; the full matrix runs when `ZCODE_FAULT_MATRIX=full` is set, with a 30 s ceiling per cell. Two production seams exist for this bed: the driver clock (`now`, `schedule`, `stallAfterMs`, `quiesceMs`) is injectable, and the adapter keeps `retryAfterMs` on its normalized error.
 
 ## Alternatives not taken
 

+ 25 - 0
architecture-policy.yaml

@@ -718,6 +718,20 @@ modules:
     layers:
       app: .
     owner: desktop
+  # side-pane-full-view:由 architecture:adopt 登记
+  - id: side-pane-full-view
+    roots:
+      - packages/ui/src/side-pane-full-view
+    managed: true
+    requires:
+      - shared
+      - ui
+    publicEntrypoints:
+      - packages/ui/src/side-pane-full-view/index.ts
+      - packages/ui/src/side-pane-full-view/contract.ts
+    layers:
+      ui: .
+    owner: conversation
 
 global:
   # 临时时间戳(2026-09-10):unmanaged-new-file 只约束此日期之后首次入库的文件。
@@ -733,6 +747,10 @@ global:
   acceptedUpstreamSnapshot: scripts/architecture/upstream-snapshot.json
 
 exceptions:
+  - id: side-pane-full-view-shortcut-command-edit
+    rule: unmanaged-new-file
+    paths: [packages/shared/src/shortcutCommands.ts]
+    reason: 已准入的快捷键命令表只追加一条 toggleSidePaneFullView 命令(Side Pane 完整视图,docs/ui/side-pane-full-view.md);命令表仍是唯一数据源,签名与模块边界不变,接管整个 shared 包不在本次范围内。
   - id: opensource-cua-test-project-config
     rule: unmanaged-new-file
     paths: [packages/zcode-cua/vitest.config.ts]
@@ -861,3 +879,10 @@ exceptions:
       - apps/zcode-cli/packages/adapters/src/model/endpoint-routing-edition/index.ts
       - apps/zcode-cli/packages/adapters/src/model/provider-endpoint-routing-options.ts
     reason: Existing upstream routing assembly files gain the endpoint origin and injected JWT reader; adopting the full CLI model adapter directory needs a separate module boundary refactor.
+  - id: workflow-mode-user-choice-unmanaged-edit
+    rule: unmanaged-new-file
+    paths:
+      - packages/shared/src/dynamic-workflow-feature.ts
+      - packages/ui/src/settings/DynamicWorkflowModeSetting.tsx
+      - packages/ui/src/store/dynamicWorkflowAvailabilityStore.ts
+    reason: Admitted upstream files edited only to let the user's dynamic workflow mode choice always win and keep the settings row visible; adopting packages/shared/src and packages/ui/src needs a separate module boundary refactor.

+ 2 - 2
docs/analysis/credentials-json-code-audit.md

@@ -64,7 +64,7 @@ Server remote
 
 浏览器自身 OAuth
     `-- BrowserOAuthCredentialRepo --------------------------> localStorage
-        pending nonce --------------------------------------> sessionStorage
+        pending login(nonce/provider/回调地址)-------------> localStorage
 ```
 
 - `ICredentialService` 公开 `load/save/delete`;UI 使用 `useCredentials()` 等 hook。泛用存储层不理解 OAuth provider、账号或 workspace,只接受 key/value。[接口](../../packages/services/src/credential/credential.ts#L11)、[hook](../../packages/ui/src/hooks/useCredentials.ts#L8)。
@@ -348,7 +348,7 @@ Host credentials.json / CredentialService
 
 ### Web 浏览器同名字段的独立边界
 
-Web `BrowserOAuthCredentialRepo` 将同名 ZAI 字段放在 **localStorage**,不是磁盘 credentials.json;`oauth_pending_nonce` 放 sessionStorage。当前浏览器实现只支持 ZAI active provider。浏览器 token 交换直接将后端 `data.zai.access_token` 保存,未经过 Desktop `ZaiBusinessTokenResolver` 的业务转换,因此同名 `oauth:zai:access_token` 在两套存储中的来源语义不能直接混同。
+Web `BrowserOAuthCredentialRepo` 将同名 ZAI 字段放在 **localStorage**,不是磁盘 credentials.json;进行中的登录记录 `oauth_pending_logins` 同在 localStorage,按 nonce 区分。当前浏览器实现只支持 ZAI active provider。浏览器 token 交换直接将后端 `data.zai.access_token` 保存,未经过 Desktop `ZaiBusinessTokenResolver` 的业务转换,因此同名 `oauth:zai:access_token` 在两套存储中的来源语义不能直接混同。
 
 浏览器 cached restore 要求 active 为 zai、JWT/access/user_info 全部存在;任何残缺态、用户 JSON 不合法都会 clearAll;JWT 明确过期返回 reauthentication-required。浏览器 logout 仅清自己的 localStorage;它不是 Desktop credentialService 的 OAuth logout。远控 attachment / Host 权威及 credential 转发限制由远控章节说明。
 

+ 2 - 1
docs/architecture/r2-server-cli-and-daemon-test-plan.md

@@ -35,7 +35,7 @@ CLI 命令解析 ── JSONL control contract ──> Supervisor
 | R2-CLI-14       | `platform.test.ts` 三平台 descriptor 使用 stable launcher 并携带绝对 server root;`pathsAndRelease.test.ts`/`contracts.test.ts` Node 22 runtime manifest 校验;`packaging.test.ts` staging 布局(bundle 裸依赖扫描、生产依赖闭包、node-pty 交叉打包白名单、@lydell linux prebuild 补齐、spawn-helper 执行位、manifest entrypoints、Windows cmd/zip);`agentWiring.test.ts` 验证接线计算和显式配置优先,`runtimeUpdateIntegration.test.ts` 用真实 old/new Core 子进程验证 update 后按 release runtime 重算 wiring 与 data root                                                                                                                                                                                                                                                                                                                   |
 | P0-01           | `packaging.test.ts` 六平台 staging、Windows cmd/zip、runtime/tools、runtime/packages、agent 外置依赖闭包                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
 | P0-02           | `releaseDownload.test.ts` catalog、SHA-256、超时、临时文件清理和目标校验                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
-| P0-03           | `releaseInstaller.test.ts` immutable archive install、stable launcher、pending/current 原子切换、并发复用及 incoming 清理                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
+| P0-03           | `releaseInstaller.test.ts` immutable archive install、stable launcher、pending/current 原子切换、并发复用及 incoming 清理;`$HOME` 经符号链接时 POSIX launcher 仍执行 canonical release                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
 | P1-01           | `componentCache.test.ts` 五组件内容寻址缓存、archive SHA/内容双校验、变化组件覆盖、恶意链接拒绝、最终 release 一致性与 immutable target 复用                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
 | P1-02           | `serviceManager.test.ts` root-scoped descriptor identity + launchctl/systemctl/schtasks executor adapter;`cli.test.ts` 验证注册失败不伪装成功、显式 fallback 报告未注册、已有 idle fallback 可迁移到 OS service、service entry 不重复注册;launchd descriptor 验证正常 stop 不因 `KeepAlive` 立即重启                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
 
@@ -92,6 +92,7 @@ ssh status → stop → stopped          ✓
 - update 的候选 Core ready 只完成第一阶段验证;旧 Supervisor 退出、目标 release daemon ready 且 control runtime identity 全部一致后才能返回成功。identity 不一致必须停止候选 daemon、恢复 previous pointer 并重启旧 release。
 - `serve --daemon` 只允许一个 OS service owner;服务 entry 不得重复注册或并行启动第二个 Supervisor,注册失败必须返回错误,显式 fallback 必须报告 `serviceRegistered=false`。
 - service descriptor 必须使用 `<serverRoot>/bin/zcode` 稳定入口并显式携带 `--server-root`;service identity 与 descriptor 文件名按 canonical root 隔离,自定义 root 的真实 daemon 测试必须确认默认 root 没有副作用。
+- POSIX stable launcher 必须用物理路径计算 root,与写入 `current.json` 的 canonical root 一致;经符号链接别名调用时仍执行 `releases/` 下的合法 release,越界 release 仍 fail-closed。
 - Core-local activity tracker 必须从 Agent turn lifecycle facts 同时统计 desktop continuous 与 Web replayable;测试不得只伪造 Task facade 的 `activePromptInputIds`。
 - launchd 正常 stop 不得因无条件 KeepAlive 被自动拉起;异常退出仍保留服务管理器的重启能力。
 - 组件增量更新必须删除新 manifest 已移除组件的旧文件。

+ 14 - 0
docs/architecture/r2-server-cli-and-daemon.md

@@ -334,6 +334,13 @@ staging 由 `packages/zcode-server-cli/src/packaging/stage.ts` 实现,
   `ZCODE_SERVER_RUNTIME_ROOT` 解析;`runtime/packages` 包含当前官方插件定义中需要 seed 的七个
   plugin(browser-use、document-skills、skill-creator、zcode-guide、android-emulator、
   ios-simulator、restore-legacy-sessions)。
+- 内置技能包不变量:`stageRelease` 从独立的 `bundledSkillsDir` 参数发布
+  `runtime/packages/bundled-skills`(生产入口传入 `apps/zcode-cli/packages/bundled-skills`),
+  只复制 `README.md` 与 `skills/`,排除其他顶层文件。Agent 在
+  `zcode.cjs` 旁按官方插件同款候选目录原地读取它,`/workflow` 依赖的 `dynamic-workflows` 技能
+  只在这里。它只属于 `agent-runtime` 组件并参与其内容哈希与归档,不写入 manifest 的 `plugins`。
+  官方插件目录不提供也不覆盖技能包,发布不依赖插件缓存中是否存在同名目录。
+  `stageRelease` 按 Agent 的必需文件清单 fail-closed 校验,缺任一文件时 staging 失败。
 - 官方插件 MCP runtime 不变量:凡 `plugin.json` 的 `mcpServers` 通过 `${ZCODE_PLUGIN_ROOT}/...`
   引用的文件(当前为 android-emulator、ios-simulator、browser-use 的 `dist/mcp/server.js`)必须随
   archive 一起发布。这些 dist 不入库,由 `scripts/build-desktop-agent-cli.mjs` 的 MCP runtime 清单在
@@ -457,6 +464,13 @@ endpoint、status、release、service descriptor 和 uninstall 均从该参数
 同时获得对应的 `ZCODE_DATA_BASE_DIR`。因此自定义 data root 的 daemon 不得在默认 root 创建第二份
 status、lock、Core 或 SQLite。
 
+POSIX 稳定入口 `bin/zcode` 读取 `current.json.releaseDir`,只执行 `<root>/releases/` 下的 release;
+越界时输出 `Invalid current ZCode Server release` 并以 1 退出。该边界必须和写入方比较同一种路径:
+生命周期命令写 `current.json` 前已把 server root 收敛为 canonical(`realpath`)路径,launcher 也必须
+用物理路径(`cd -P` + `pwd -P`)计算 root。远端以 `"$HOME/.zcode/server/bin/zcode"` 调用入口,
+`$HOME` 可能经过符号链接(例如 NAS 的 `/var/services/homes -> /volume1/homes`、`/home -> /var/home`),
+这种别名不得让合法 release 被判为越界。
+
 组件增量组装先从旧 release 复制,再删除所有已变化或已移除组件声明的旧路径,之后解压新组件并
 校验新 manifest;这样新 manifest 移除插件/工具等组件时不会把旧文件带入新 release。
 

+ 4 - 0
docs/architecture/r3-source-server-remote-architecture.md

@@ -346,10 +346,14 @@ serve --daemon
 - “服务管理器不可访问”是能力事实,不等于安装失败:常见于 SSH 进入容器、最小系统、未启动 user manager,或 macOS SSH 会话没有可访问的 launchd user domain。
 - 自动 fallback 不改变 Source/Task/Session 权威;Desktop 断开只释放 attachment。fallback 进程在远端环境存活期间继续运行,宿主/容器重启后由既有启动重连或手动连接重新拉起。
 - Linux SSH 若 `/run/user/<uid>/bus` 存在,即使 sshd 未注入 `XDG_RUNTIME_DIR`/`DBUS_SESSION_BUS_ADDRESS`,也应使用该用户 bus 完成 service 探测和注册;不得把“环境变量缺失”误判为“systemd 不存在”。
+- Linux 能力探测读取 `systemctl --user show --property=Version`,只有退出码为 0 且返回非空 `Version` 属性才确认 user manager 可访问。chroot / offline 环境可能跳过命令并返回 0;这种没有属性响应的结果必须进入既有 detached fallback,不能依赖本地化 stderr 文案判断,也不能覆盖用户的离线环境设置。
+- 能力探测沿用 2 秒进程超时。命令被信号终止后,执行器必须关闭本端 stdout/stderr 管道并返回失败,不能继续等待持有管道的 D-Bus 辅助进程退出;正常退出仍等到 `close` 后读取完整响应。该收口不改变服务注册错误传播,也不新增启动路径。
+- 探测成功后的真实注册错误仍直接返回;不得把权限、服务文件或启动错误统一吞掉。daemon 启动 owner 仍由 Server CLI 在 OS service 与 detached Supervisor 之间选择,不新增重试、状态缓存或并行启动路径。
 - `serve --daemon --json` 非零退出时,Adapter 必须优先解析 stdout 的结构化 `{ error, code?, retryable? }`,再把 stderr 作为补充诊断。Node warning、登录 banner 或 shell 噪音不得覆盖真实 CLI 错误。
 - Server CLI `--json` 的结果(成功或失败)是 stdout 中最后一个单行 JSON 对象;Adapter 读取结果时跳过其前后的纯文本行。部分 SSH 堡垒机会把远端 stderr 合并进 stdout,并在 stdout 结束后才投递,Node warning 因此可能排在结果行之后,不能把最后一个非空行当作结果。
 - Source Server bootstrap 可执行文件放在最终可执行根(`~/.zcode/server`)的临时 staging 内,不从常见 `noexec` 的 `/tmp` 执行;archive 临时文件仍须在成功、失败和取消后清理。
 - 远端直下只把 curl/wget、tar 和 SHA-256 工具作为必需能力;awk/wc/date 等仅用于增强进度,缺失时降级为无速度进度而不是阻断下载。Desktop 下载后上传同样必须在上传前探测 tar,避免传完大 archive 才失败。
+- archive 内置官方 Node 22 Linux 构建,动态链接要求 glibc 2.28 及以上。probe 在同一次只读 round-trip 中读取 `getconf GNU_LIBC_VERSION`;Linux 远端(含 WSL、Docker)低于 2.28 时(如 CentOS 7、RHEL 7、Ubuntu 18.04),probe 以预检失败拒绝,不进入安装确认、上传或远端直下,消息写明实测版本和所需版本。读不到 glibc 版本(musl、缺 getconf、输出无法识别)时不拦截,沿用原安装链。
 - macOS 构建 POSIX archive 时必须显式禁用 bsdtar xattr/PAX metadata;仅设置 `COPYFILE_DISABLE=1` 不足以移除 `LIBARCHIVE.xattr.*`,否则 Linux 解压会按条目刷出数千行 unknown extended header 并掩盖真实错误。
 
 ### 5.3 发现、安装与升级链

+ 2 - 2
docs/architecture/remote-device-connection-ux-spec.md

@@ -154,7 +154,7 @@ stateDiagram-v2
   - 主进程和 host 对每一次传输或部署失败,都产出错误码集合中的一个错误码,外加一条非空消息。
   - 适配器已经确认的领域错误码优先于 `cause` 的文本推断;未明确分类的 `AggregateError` 和阶段包装继续查找内层错误码。
   - 消息为空或无法识别时,归入"未知"类,绝不因为 schema 校验失败而丢弃错误响应。这正是"拒绝连接时永远停在正在连接"的根因。
-  - 探测(probe)只把远端环境检查本身的失败归入"预检失败":探测脚本非零退出、远端平台不受支持。建立连接或执行探测命令时的传输失败(如握手超时、握手前连接断开)不做阶段兜底,识别不了时归入"未知";断线自动恢复耗尽预算时据此显示"自动恢复已停止",不提示安装环境问题。
+  - 探测(probe)只把远端环境检查本身的失败归入"预检失败":探测脚本非零退出、远端平台不受支持、Linux 远端 glibc 低于 Source Server 运行下限(2.28)。建立连接或执行探测命令时的传输失败(如握手超时、握手前连接断开)不做阶段兜底,识别不了时归入"未知";断线自动恢复耗尽预算时据此显示"自动恢复已停止",不提示安装环境问题。
   - 共享类型和运行时 schema 同步扩展。UI 遇到不认识的错误码时退回"未知"类的通用文案,保持向后兼容。
 - **分类与展示:**
 
@@ -321,7 +321,7 @@ after:  Adapter upload/extract -> CLI verify-archive/extract/verify/restart
 
 - **标题行**:中性连接方式图标、名称、五态状态与主操作/编辑/更多。主操作由展示模型决定;已连接时主操作“断开”降为 ghost 按钮,“断开后远端任务继续运行”只作为该按钮的提示(title),不再常驻成一行说明。
 - **连接行**:连接描述使用类型 token,优先展示实际在线连接;后接远端版本,离线时再接“最近在线”。设备只有一条连接时不显示“当前 / 默认”;有多条连接时用同一种中性小标签标记“当前”“默认”。
-- **最近项目**:小标题“最近项目”下按 `lastOpenedAt` 倒序列出已知项目,每行为文件夹图标、显示名、完整远端路径(等宽、截断、title 给出全文)、相对打开时间;该项目已在本窗口打开时加“已打开”标签。默认显示 3 行,超出时提供“显示全部 (N)”在卡内展开,不能出现无法打开的 +N。点击走保留目录的既有连接意图(preferredProfileId + preferredDirectoryPath),复用向导的连接后自动打开路径,不假设已有唯一 attachment。没有项目时显示“0 个项目”。
+- **最近项目**:小标题“最近项目”下按 `lastOpenedAt` 倒序列出已知项目,每行为文件夹图标、显示名、完整远端路径(等宽、截断、title 给出全文)、相对打开时间;该项目已在本窗口打开时加“已打开”标签。默认显示 3 行,超出时提供“显示全部 (N)”在卡内展开,不能出现无法打开的 +N。点击先从共享项目目录按 Source 与目录解析唯一已有入口,传递 preferredProjectEntryId、preferredProfileId 与 preferredDirectoryPath,连接后直接打开原项目,不进入创建器;无法确定原入口时保留当前页面并提示从侧栏选择。入口与连接完成校验见[项目导航](../remote/project-first-remote-navigation-spec.md#2-入口与连接顺序)。没有项目时显示“0 个项目”。
 - **页脚**:卡片底部一条分隔线下放“其他连接 (N)”与“最近日志”两个折叠入口,展开内容依次显示在页脚下方。最近日志默认收起;设备展示状态为失败时默认展开,用户手动切换后以用户选择为准。日志框使用 `bg-surface`,不再加边框,避免卡中卡。其余连接展开后操作常驻、可换行,无第二层卡片边框。
 - 设备信息(主机名、系统用户、设备 ID)与复制 ID 留在更多菜单;版本已在连接行展示。
 - **页面顺序**:说明文案与“新建连接” → “设备 (N)”小标题与设备卡(保持快照顺序,不按状态重排,避免用户操作后卡片跳动) → 无 sourceServerId 的“未完成的连接”(默认折叠,支持重试、删除和确认后清理) → 已归档连接 → 连接偏好。已识别设备即使离线或需重装仍保留设备卡。

+ 24 - 0
docs/claude-code-marketplace-plugin-compat.md

@@ -200,6 +200,30 @@ skills、commands、agents、hooks、MCP servers 名称与可选描述。它不
 hooks,也不解析运行时变量。已安装插件必须优先读本地 cache/安装目录;未安装候选才可
 按需解析 marketplace source。
 
+调度约束:插件读请求 `plugins/describe`、`plugins/list`、`plugins/overview` 不进入 Agent
+连接的串行请求队列,也不等待此前排队请求开始,收到后立即处理,所以详情页和新建右侧标签页的
+推荐区不会排在长时间安装、更新之后。describe 只在 marketplace manifest 缺失、需要拉取并写入时
+进入 plugin storage lock。list/overview 是同步 handler,执行中不让出事件循环;内置插件 seed
+只在内容变化时写盘,并有跨进程 seed 锁,因此不会与安装跨 await 的读改写交错。install、update、
+setEnabled、configure 等写操作仍保持串行:setEnabled、configure 不持存储锁,靠串行队列与安装的
+配置写入错开。
+
+```mermaid
+sequenceDiagram
+  participant UI
+  participant Q as 串行队列
+  participant L as storage lock
+  participant D as 读请求分支
+  UI->>Q: plugins/install A(下载中)
+  Q->>L: 持锁
+  UI->>Q: plugins/install B
+  Note over Q: B 等 A 完成
+  UI->>D: plugins/describe、list、overview(立即处理)
+  D-->>UI: 组件与列表(不等安装)
+  L-->>Q: A 完成后释放
+  Q->>L: B 持锁
+```
+
 Bugfix 约束:`plugins/describe` 的 MCP 与 hook 枚举口径必须对齐真实 plugin loader,
 不能只读取 `plugin.json` 内联字段。MCP server 名称需要来自插件根目录 `.mcp.json` 与
 `manifest.mcpServers` 的合并结果;Hook 事件名需要来自 `hooks/hooks.json` 与

+ 17 - 1
docs/composer-model-thinking.md

@@ -32,6 +32,22 @@ Provider 行左侧依次为当前供应商图标、名称、接入方式标识
 
 切换 Provider 立即选择该分组按目录顺序的第一个未锁定模型,沿用已有 onSelectModel 更新 Composer,Think 由既有模型切换逻辑同步为有效档位,弹层保持打开。重复选择当前 Provider 保留其当前可用模型。没有可用模型的 Provider 仍可浏览和配置,但不覆盖当前模型,Think 禁用。滑杆按 Option Spec 的原始顺序逐格选择,不排序、不转换成 Token Budget。仅 Off 单档隐藏整个 Effort 区域及分割线;其他单档禁用滑杆但显示档位;无模型/无有效档位不制造默认选择。选择档位保持弹层打开,点击外部或 Escape 收起。桌面关闭后恢复输入焦点;手机不主动弹出软键盘。
 
+### 模型菜单关闭
+
+- 点击或键盘确认可用模型后保持菜单打开,包括重复选择当前模型,便于继续调整思考档位;锁定模型不提交、不关闭。切换 Provider 和调档仍保持菜单打开。
+- 普通输入框、全屏插件中的浮动输入框共用同一个菜单打开状态。点击菜单外侧一次即关闭,包括插件 webview 所占区域;该次点击只关闭菜单,不触发底下插件操作。Escape 保持关闭行为。
+- 菜单关闭后沿用现有焦点规则:桌面恢复输入框,手机不主动弹出软键盘。不改变模型选择 owner、提交和协议。
+
+```text
+确认可用模型 → 既有模型选择回调 → 菜单保持打开
+菜单外侧指针 → 宿主菜单外部交互 → 菜单 open=false
+Provider / Effort 操作 → 原有选择链路 → 菜单保持打开
+```
+
+外侧点击回归原因:Radix 打开 modal 菜单后将 body 的 pointer-events 设为 none,但插件 webview 显式设置 auto,继续接收点击;guest 内事件不冒泡到宿主 document,因此菜单没有收到外部 pointerdown。Electron 事件采样确认该次点击执行了插件按钮,菜单仍为打开态。合并菜单打开期间提供透明指针层,放在插件页面之上、Composer 和浮窗之下,复用 Radix 的外部关闭逻辑,保留工具栏菜单互切。该层与菜单共用 open,不保存额外状态。
+
+回归验证:菜单组件单测 47 条、Electron webview / 手机宽度 iframe 深浅主题交互 4 条、完整桌面工具栏 11 条通过,覆盖选模型后保持打开及随后一次外侧点击关闭。浏览器候选通过 `node --test packages/ui/test/browser/manual-review/pending/composer-menu-dismiss.test.mjs` 运行,产物在 `packages/desktop/.e2e-artifacts/composer-menu-dismiss/`。未覆盖 Windows/Linux 原生窗口、手机真机和远控连接;插件资源采用测试页,不验证插件安装或 Agent 握手。
+
 ## 整体压缩优先级
 
 统一由 useComposerToolbarFit 测量全部左右控件及间距,每一级仍溢出才进入下一级:
@@ -59,7 +75,7 @@ ModelSelectionView(支持的模型与档位)
 
 ## 验证
 
-- 组件交互:Provider 自动选择可用模型、跳过锁定模型、重复选择当前 Provider、无可用模型、模型选中后菜单不关闭、视觉标签、离散滑杆、单档/无效档、继承的连接方式和管理入口。
+- 组件交互:Provider 自动选择可用模型、跳过锁定模型、重复选择当前 Provider、无可用模型、模型选中后菜单保持打开、视觉标签、离散滑杆、单档/无效档、继承的连接方式和管理入口。
 - 布局:各级收缩与逆向恢复、缺失 Computer/Plan、最终图标+绿条;真实浏览器桌面与手机宽度、深浅主题。
 - Desktop E2E:模型与档位修改仍更新 Composer;普通模式不再渲染独立 Think 入口;合并菜单与 Mode 互斥。
 

+ 18 - 7
docs/conversation-session-case-catalog.md

@@ -1200,6 +1200,11 @@ replayable 不创建、恢复、持久化或消费 group。
 
 ## SAT. Subagent Session Side Tabs / 子会话右侧标签
 
+2026-10-19 类型回归:SAT30 覆盖 subagent_child、workflow_child、selection_side_chat 与历史 nested_workflow_child;
+项目父链继承与只读准入分开。SAT28 只拒绝三类 agent child,辅助对话继续发送;SAT29 清理四类隐藏索引,保留 fork 与未确认身份。
+远端 UI 候选已通过 macOS 客户端 → SSH → Linux arm64 Server 发布包回归(`r3-server-workflow-hotfix-2f5c48dd`):工作流 actor 正文可读且只读、显式 GLM-5.3 路由、辅助对话首发与续发、主列表不泄漏;模型回复使用回放。辅助对话 Recent 查所属主会话项目,命令仍发给 child。
+Server 启动时须设置开发态 `ZCODE_DYNAMIC_WORKFLOW_MODE=alwaysOn`,WDIO 为该独立文件设置相同前置;常驻 Server 不继承客户端环境。保持 manual-review pending,不据此声明手机 UI 或 Linux x64 实测;桌面 continuous / 手机 replayable 的身份和准入由协议回归覆盖。
+
 SAT30(远端项目归属回归):远端子会话运行中及完成后可查看,重订阅复用 Agent 持久化父链解析主任务项目;
 child 不进入主任务索引。desktop-continuous 与 web-remote-replayable 共用服务入口;普通无项目远端任务、
 缺失/成环/跨 workspace 父链仍拒绝。服务回归在 `zcodeAgentService.v4.test.ts`;
@@ -3910,6 +3915,8 @@ VP22(accepted/pending,2026-09-11):编辑器零 root 空态与有 root 
 
 VP28(accepted/pending,2026-09-11):首次升级前在隔离 HOME 写入旧 settings 项目顺序与无 migration ledger 的历史 tasks。真实启动升级后,侧栏项目集合必须与 lastWorkspaceSession 中保留的本地项目相同且顺序一致,历史额外目录不创建项目;历史任务保留原 cwd 与归档/删除状态,未归档未删除任务进入任务区;刷新保留。新增 pending conversation-session-project-upgrade-order.test.ts,不请求模型;重复目录、conversation 排除、Group 不转项目、settings 缺失/空列表及升级后项目和手动排序不被 settings 覆盖由 storage 单测补充。
 
+VP28 混排补充(2026-10-19,accepted/pending):3.15 首次升级夹具中 remote 位于第 2 项,真实迁移、离线首屏和刷新均保留本地/remote 混排位置。仅本轮首次转换的入口记录初始位置;已有项目迁移 ledger 不回填。连接解析、Host 身份绑定后原位替换旧排序键,手动拖动和重启不被初始位置覆盖,由存储及 React 回归补充;共享手机目录复用同一字段,不新增连接行为。无模型请求。
+
 VP28 旧后端补充(2026-10-15,accepted/pending):升级 fixture 含旧后端置顶行及当前 CLI 的新导入会话;升级/刷新后只显示后者,允许取消置顶与归档,旧行在库内原样保留。project-storage 单测覆盖首次/已有 ledger、普通/置顶/归档、本地/远端 owner。VP13 手机 shared-host 增补已迁移旧行隐藏和正常会话操作。
 
 VP29(accepted/pending,2026-09-11):项目折叠的真实高度/透明度动画、快速反向切换及展开不导航;任务行(项目/置顶/未归类)hover 无文件树按钮,项目行三个入口保留。更新 project-behavior 的 VP24/VP25 与新增动效断言,替代 VP25 旧任务文件树要求;保留归档/置顶与明暗/390px 回归。最终 `desktop-e2e-20260911063454327-p73583-868e8aab51e45e6a` 4/4 通过,逐帧轨迹验证稳定收起 188→0px、展开 0→188px 与两向渐变透明度,快速反向后仍为展开;项目/置顶行无文件树按钮且项目入口可用。该运行报告动效 ID 原为 VP28,整理时更名 VP29 以避免与升级顺序用例重号。相关单测 28 文件 / 101 项通过。保持 pending,不计真实手机链路覆盖。
@@ -3924,7 +3931,7 @@ ARM01–ARM05(accepted/pending,2026-09-11):设置/数据与统计新增
 
 ARM06(accepted/pending,2026-09-15):归档分组名称右侧显示折叠箭头,默认全部收起、不挂载聊天内容;鼠标/键盘独立展开与收起,收起立即卸载行;数量、搜索和折叠组批量动作仍按全部匹配项处理。复用同一 spec 和 pending E2E,覆盖中英文/明暗/窄屏的收起与展开布局;本页状态不持久化。
 
-ARM07(accepted/pending,2026-09-15):自动归档开关和保留时长从常规页移到归档管理顶部;开关/时长真实落盘并在刷新后恢复,关闭时长禁用但保留值。复用 archive-management pending E2E 与 ARM05 中英文/明暗/390px 截图;AMT02 同步改用归档管理入口。设置 owner 和 Host 扫描不变,手机不新增设置入口。
+ARM07(accepted/pending,2026-09-15):自动归档开关和保留时长从常规页移到归档管理顶部;开关/时长真实落盘并在刷新后恢复。2026-10-19 起默认关闭/30 天,关闭时也可切换并保存时长,开启后使用已保存的值;已有天数与已归档会话保持原样。复用 archive-management pending E2E 与 ARM05 中英文/明暗/390px 截图;AMT02 同步改用归档管理入口。设置 owner 和 Host 扫描不变,手机不新增设置入口。
 
 ARM08(accepted/pending,2026-09-15):归档管理公共页头位于自动归档设置之前;页内固定文案统一会话/session,用户内容保持原样;覆盖搜索、数量、空态与删除确认,复用 ARM05 中英文/明暗/1200/390px 布局验证。
 
@@ -4276,12 +4283,12 @@ R3A-UI-04 / RDUX-11-04 回归(2026-10-12 macOS 真实 SSH 1/1 PASS,仍 pendi
 
 ### RDUX-13 设置设备卡与更新(accepted)
 
-| 用例       | 设置、动作与断言                                                                 | 证据入口                                                                                                        |
-| ---------- | -------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
-| RDUX-13-01 | 真实 SSH 成功后设备卡显示连接、项目,项目可打开;更多菜单含设备信息              | `manual-review/pending/conversation-session-remote-device-cards.test.ts`                                        |
-| RDUX-13-02 | 未占用端口连接失败 → 设置页无新增设备卡 → 默认折叠未完成区域 → 展开、删除/清理   | 同上                                                                                                            |
-| RDUX-13-03 | 浅色/深色 × 1440/900/480px,设备卡与未完成列表截图                               | 同上;480px 是桌面窄屏,手机不开放设备管理                                                                      |
-| RDUX-13-04 | 同设备跨连接/重连/重启去重;稍后仅本次运行;可选更新不弹 toast;强制更新任务清单 | `sourceServerUpdateNotifications`、`sourceServerUpdatePreferences`、`sourceServerManagementPanel` 组件/单元回归 |
+| 用例       | 设置、动作与断言                                                                                                                      | 证据入口                                                                                                        |
+| ---------- | ------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
+| RDUX-13-01 | 真实 SSH 成功后设备卡显示连接、项目;在线缺少草稿缓存、断线后残留其他项目缓存时,点击最近项目直接打开原项目并校正草稿范围,项目 ID 与入口数不变,不出现创建弹窗;更多菜单含设备信息 | `manual-review/pending/conversation-session-remote-device-cards.test.ts`                                        |
+| RDUX-13-02 | 未占用端口连接失败 → 设置页无新增设备卡 → 默认折叠未完成区域 → 展开、删除/清理                                                        | 同上                                                                                                            |
+| RDUX-13-03 | 浅色/深色 × 1440/900/480px,设备卡与未完成列表截图                                                                                    | 同上;480px 是桌面窄屏,手机不开放设备管理                                                                      |
+| RDUX-13-04 | 同设备跨连接/重连/重启去重;稍后仅本次运行;可选更新不弹 toast;强制更新任务清单                                                      | `sourceServerUpdateNotifications`、`sourceServerUpdatePreferences`、`sourceServerManagementPanel` 组件/单元回归 |
 
 新增 E2E 保持 pending,不自动人工转正。远控 management 门禁、任务 continuous/replayable 合同不变。
 
@@ -4742,3 +4749,7 @@ SPR01 是连接隔离 Electron 的独立 `node:test` / CDP E2E,保持 pending
 - Desktop:`packages/desktop/test/e2e/ui-shell/manual-review/pending/sidebar-tooltips.test.ts`,完整应用的项目行、分区、搜索/筛选、底部及文件树入口。
 
 验证(2026-10-16):浏览器 Tooltip 12 项及 SPT03 性能回归 4 项通过,包含桌面/手机布局、中英文、深浅主题、触屏点击和键盘 focus;新增分组操作断言复测通过。macOS 完整桌面 E2E 通过,12 个入口实测 304–309ms,覆盖相邻提示切换、提前移出、文件树菜单和清空搜索。受影响单测 285 文件 / 3671 项、typecheck、E2E typecheck、lint、架构及改动代码格式检查通过。候选保持 pending;未覆盖 Windows/Linux 整机或真实手机远控传输。
+
+## R3A-BLD-07:用户服务探测被跳过(2026-10-19)
+
+沿用 `conversation-session-r3-daemon-detached.test.ts` 的 accepted / pending 场景:独立 Linux SSH 目标首次以 detached 模式连接;桌面断开不杀 daemon。终止 daemon 后,在该目标的非交互 shell 设置 `SYSTEMD_OFFLINE=1`,确认真实 `systemctl --user show --property=Version` 退出 0 但没有属性响应,再通过桌面设备重连。必须进入 ready、`serviceRegistered=false`,Supervisor/Core 均换代,原任务可续发;最后恢复 shell 配置。禁止以替换 systemctl 或直接设置 ZCode 跳过注册开关代替该场景。

+ 2 - 2
docs/desktop/windows-taskbar-unread-badge.md

@@ -38,8 +38,8 @@ syncApplicationUnreadBadge(map)                     desktopWindowLifecycle.ts
 Electron 在 Windows 通过 `BrowserWindow.setOverlayIcon(image, description)` 支持任务栏角标(Shell `ITaskbarList3::SetOverlayIcon`)。与 `setBadgeCount` 不同,**overlay 不负责渲染数字**,必须自绘徽章图。
 
 - **位置**:overlay 由系统固定绘制在任务栏按钮右下角(与 Windows 更新盾牌、Outlook 同步状态同一机制),API 无位置参数,无法绘制右上角效果;右上角只在托盘角标上可行(自绘可控)。
-- **观感**:32×32 画布(100% DPI 下系统缩放为 16×16),圆内加透明边距(半径 12,占画布约 75%)控制视觉尺寸;红底圆 + 白色数字,`>= 10` 显示 `9+`。运行时用内置 5×7 点阵字体直接构造预乘 BGRA 像素并 `nativeImage.createFromBitmap`,不引入图片资源与运行时 canvas 依赖,主进程可单测像素逻辑。
-- **托盘角标**:Windows/Linux 托盘(`Tray`)在应用图标**右上圆角缺口**合成**纯红点**(无数字)——Logo 是圆角方块,32×32 画布右上直角处天然有约 4×4 透明缺口,9×9 红点(画布 10、radius 4)嵌进缺口、边缘与圆弧相切,Logo 满幅不缩不放。托盘实际显示仅 16×16,塞数字必然不可读;精确数量由任务栏气泡与任务列表承担。计数变化时 `tray.setImage` 换图,归零恢复原图;合成用预乘 alpha 混合(`blendBadgeIntoBitmap`,纯逻辑可单测),底图取托盘图标源文件。macOS 无托盘(平台返回 null),由 Dock 角标承担。
+- **观感**:任务栏 overlay 按 Windows 固定显示尺寸提供原生 1x(16×16)与 2x(32×32)`NativeImage` representation,不再把普通 32px 硬边圆交给 Shell 盲缩。红点为纯红、无描边、4× 超采样抗锯齿,逻辑直径约 7px。同一个安装包运行时按系统 build 自动选画布圆心:Win10(build < 22000)在画布内右下锚定,补偿旧任务栏的 overlay 落点;Win11(build ≥ 22000)在画布内居中,避免 Shell 已放到图标角上后再次右下锚定造成二次偏移。无障碍 description 仍携带具体数量(如 "3 unread tasks")。
+- **托盘角标**:Windows/Linux 托盘(`Tray`)在应用图标右上圆角缺口合成纯红点(无数字)。尺寸与任务栏独立,保持约 8px;同样提供原生 1x(16px)与 2x(32px)表示并用 4× 超采样抗锯齿,解决硬边 32px 合成图被 Shell 缩放后的模糊。计数变化时 `tray.setImage` 换图,归零恢复原始多分辨率图标;macOS 无托盘(平台返回 null),由 Dock 角标承担。
 - **多窗口**:所有窗口统一显示全局未读总数(与 macOS Dock 显示应用级总数一致,符合"完成了几个会话就显示几"的直觉)。无任务栏按钮的窗口(CUA 指示器、更新状态窗等 skipTaskbar 窗口)设置 overlay 无副作用,不单独排除。
 - **清零**:`count = 0` 时任务栏传 `null` image 移除角标,托盘恢复原图。
 - **性能**:角标只在"任务完成 / 用户查看任务"时变化,更新频率为事件级;徽章图按 label 缓存在内存,单次更新是一次查表 + 一次 Shell 调用 / 一次托盘换图。

+ 11 - 2
docs/dynamic-workflow/authoring.md

@@ -606,8 +606,17 @@ How the pack reaches each runtime:
 - Development and the Electron desktop resolve `packages/bundled-skills` on disk next to the
   CLI entry, through the same candidate-directory walk official plugins use, and read it in
   place; nothing is copied. `packages/desktop/scripts/prepare-agent-node-bundle.mjs` stages
-  it beside `resources/glm/zcode.cjs`; `scripts/prepare-prebuilds.mjs` stages it for remote
-  hosts.
+  it beside `resources/glm/zcode.cjs`.
+- ZCode Server releases (headless Server and SSH / WSL / Docker Source Server) use
+  `stageRelease` to stage the pack's `README.md` and `skills/` from `bundledSkillsDir` at
+  `runtime/packages/bundled-skills`, beside `runtime/zcode.cjs`. Other top-level files are
+  excluded. The pack belongs only to the `agent-runtime` component, including its content
+  hash and archive, and is not listed in the manifest's `plugins`. Official plugin staging
+  neither supplies nor overwrites the pack. Development remote
+  deployment stages the same directory beside its agent bundle, includes every pack file
+  in the deployment hash and checks the required files before reusing a remote installation.
+  Both paths reject a missing or incomplete pack before publishing or uploading. They do
+  not depend on an old plugin cache or on the server's working directory.
 - SEA binaries embed `skills/**` under the `zcode-bundled-skills/` asset prefix
   (`cli/scripts/sea-bundled-skill-assets.mjs`) with a manifest whose hash covers every file.
   On start the CLI extracts the pack once into `~/.zcode/cli/bundled-skills/<hash>/`; the

+ 14 - 1
docs/dynamic-workflow/concurrency.md

@@ -564,10 +564,23 @@ The ticket maps the attempt's status events onto controller signals, and settles
 | `model_retry_scheduled`, reason `reasoning_signature_repair` or `auth_refresh` | `ended` (not a provider failure; the streak survives) |
 | `model_retry_scheduled`, any other reason | `failedTransient` |
 | `model_request_failed`, `retryable: true` | nothing; the retry-scheduled event that follows is the signal |
+| `model_request_failed`, `retryable: false`, and the model-error policy (below) says `stop` | `ended`: neither the cap nor the cooldown moves |
 | `model_request_failed`, `retryable: false`, reason `rate_limited` | `throttled(epoch, "rate_limited", retryAfterMs)`: a 429 the classifier calls terminal is still a concurrency signal |
 | `model_request_failed`, `retryable: false`, other | `ended` |
 | `release()` before any of the above | `ended` |
 
+The rows are read in order, so the policy check comes before the `rate_limited` row. A
+`stop`-class failure — a quota code such as `1308`, an auth failure — says the account
+cannot be served at all, not that the provider wants fewer requests at once. The run it
+belongs to stops (`ProviderStop`), and the user decides when to try again: after a top-up or
+a quota reset, a resume must reach the provider at once. A quota 429 usually carries a
+Retry-After pointing at the end of the quota window; read as a throttle, it would freeze the
+shared bucket until then, past the stop and past any reset the user bought, and every later
+run on that model would wait at the gate without sending a request. The main agent's quota
+429s go through the same rule. The ticket asks the very function the runner and the driver
+use (`resolveWorkflowModelFailurePolicy`), so the three layers cannot disagree about which
+failures are `stop`.
+
 The off-peak queue (`offpeak_queued`) is a 429 with a Retry-After from a provider's idle
 plan; it counts as a throttle and, in the runner, does not consume a retry attempt.
 
@@ -821,7 +834,7 @@ carries it.
 |---|---|
 | `dynamic-workflow/tests/engine/concurrency.test.ts` | the constants; current-epoch throttle cuts by 0.75 to the floor and turns the epoch; a cut clears `lastGood` and records `lastBad`; old-epoch throttles move nothing, emit nothing, still reset the streak; thirteen epoch-0 refusals cut once; Retry-After cooldown, including from old epochs; K current-epoch successes prove `lastGood` with or without waiters; a raise needs waiters and headroom; old-epoch successes do not count; `failedTransient` and `ended`; idle reset after five minutes with nothing in flight, back to `initial`; growth stops at `growthLimit`, a raised limit is climbed step by step, a lowered one pulls the cap down (`limit_lowered`) and turns the epoch; `seed` jumps to the target within the growth limit, clears `lastGood` so the next refusal cuts by the factor, and is refused for a target at or below the cap or within five minutes of any refusal; the 16→12→13 and 13→9→6→4→5→6→5 sequences |
 | `dynamic-workflow/tests/engine/engine-concurrency-observations.test.ts` | the three sink methods each record one event and are ignored after settlement |
-| `bootstrap/tests/workflow-concurrency-governor.test.ts` | buckets per key; first run starts at D; auto-growth stops at 2D; a registered bound above 2D lifts the growth limit only for keys that run used and seeds the cap to it at once, a refusal in the last five minutes suppresses the seed, a default run never seeds, and clearing it pulls a higher cap down with `limit_lowered` fanned out to the runs still engaged; the observer never lifts it; a new run inherits a cap the observer's 429s lowered; idle reset; `tryAdmit` misses while anyone waits; round-robin across runs; the ticket's event mapping and double-count guard; `release()` as `ended`; abort dequeues; fan-out only to engaged runs; cooldown wake |
+| `bootstrap/tests/workflow-concurrency-governor.test.ts` | buckets per key; first run starts at D; auto-growth stops at 2D; a registered bound above 2D lifts the growth limit only for keys that run used and seeds the cap to it at once, a refusal in the last five minutes suppresses the seed, a default run never seeds, and clearing it pulls a higher cap down with `limit_lowered` fanned out to the runs still engaged; the observer never lifts it; a new run inherits a cap the observer's 429s lowered; idle reset; `tryAdmit` misses while anyone waits; round-robin across runs; the ticket's event mapping and double-count guard; a `stop`-class failure (quota code with a Retry-After) moves neither the cap nor the cooldown, from a run's ticket or the observer's, while a terminal 429 outside the stop set still throttles; `release()` as `ended`; abort dequeues; fan-out only to engaged runs; cooldown wake |
 | `bootstrap/tests/workflow-driver-concurrency.test.ts` | slot and backoff waits, executing on the first and post-wait `started`, per-ask reset; chain aggregation with parallel tool requests; wait deduplication; the driver-side policy split (stop / `ContextLimit` / redrive); the stall clock's 19-minute silence, 20-minute fire, and re-arm |
 | `dynamic-workflow/tests/engine/engine-retune-concurrency.test.ts`, `dynamic-workflow-runtime/tests/control.test.ts` | the setter: a raise pumps and dispatches within the same slice, a cut leaves live asks alone and stops the next dispatch, an unchanged value and a settled run both answer false and write neither row nor event; one `run-caps-changed` carrying `caps` and `previous`, one `updateRunCaps`; the scheduler reads `host.caps` on every pump, so a bound changed between two pumps is the one the second pump enforces; the harness binds the control to the engine it just built, and a binding never bound answers false |
 | `bootstrap/tests/workflow-seat-gate.test.ts` | the gate alone: park on a turn step over the limit (`tryAcquire` misses → `model_request_queued` → `waiting(slot)`), seat before governor, FIFO unpark on an ask settling and on a raise, one at a time; `activeAsks = working + parked`; limit 1 keeps one subagent working and deadlocks nothing; a tool-side request never parks and a subagent with no live ask never parks; abort dequeues, rejects with the signal's reason and returns the subagent to `working`, its later settlement frees no phantom seat, an already-aborted signal never enters the FIFO, and a settle that beats the abort refuses the waiter without freeing a seat; a settle for an instance never seen started is a strict no-op; a cut inside the `ensureSession` window still parks the late subagent and counts nobody twice; two asks in a row on one subagent join idempotently; a run never lowered is a pure pass-through and the governor sees every call |

+ 41 - 33
docs/dynamic-workflow/launch.md

@@ -1526,7 +1526,8 @@ section heading 「已保存的工作流」 with the total count, and, on the ri
 「工作流设置」 (Workflow settings) followed by the current mode's label in the tertiary text
 colour, then a refresh button 「刷新」 that makes every group reload past its cache. The
 settings button opens Settings › 常规, where the mode row lives (see "The user's choice"),
-and is present exactly when that row is: when the feature is offered.
+and is present exactly when that row is, which is whenever the hub is shown, except for a
+snapshot from an older Host.
 
 ### Groups
 
@@ -2479,12 +2480,11 @@ follows: on a team plan it is a UUID.
 
 ## Gray release: the `dynamicWorkflow` feature key
 
-Status: implemented. The server decides, per client, whether dynamic workflows are offered
-at all, and which mode a user gets by default. The key is `data.configs.dynamicWorkflow.mode`
+Status: implemented. The server decides, per client, which mode a user gets by default. The key is `data.configs.dynamicWorkflow.mode`
 in the `/api/v1/client/configs` response, with the values `"disabled" | "onDemand" |
-"alwaysOn"`. Where the server offers the feature, the user can pick another of the three
-modes in Settings (see "The user's choice"). The server offers; the user picks among what is
-offered.
+"alwaysOn"`. The user can pick any of the three modes in Settings (see "The user's choice"),
+and an explicit choice always wins. The server only sets the default: the mode of a user who
+has not chosen.
 
 ### What each mode means
 
@@ -2497,9 +2497,10 @@ offered mode.
 | `onDemand` | Every door of `alwaysOn`, with the model-facing tool surface deferred. The `/workflow` command stays in the slash catalog (so the composer's plus-menu entry and `/` panel entry stay), the `dynamic-workflows` skill stays discoverable, the automations page keeps its 「工作流」 tab and every Resume affordance is offered; but the ten workflow tools are **not registered for the model, and the `Agent`/`Task` descriptions carry no CreateWorkflow line, until the session is activated** by its first `/workflow`, by a Resume or Configure of one of its runs, or by resuming a session whose records already hold a workflow. Once activated a session stays activated. See "On demand: activation". `enabled = mode !== "disabled"` (`isDynamicWorkflowModeEnabled` in `packages/shared/src/dynamic-workflow-feature.ts`) still answers every "is the feature offered at all" question; only the registration gate reads the mode itself. |
 | `alwaysOn` | Everything this document describes; the ten tools are registered from the session's first request. |
 
-The key absent, malformed, or the request failed: `disabled`. A server that stops sending
-the key has turned the feature off; a stale "on" snapshot is never carried forward past a
-successful response that lacks it. The terminal UI and headless `-p` runs never consult the
+The key absent, malformed, or the request failed: the offer is `disabled`. A server that
+stops sending the key has turned the default off; a stale "on" snapshot is never carried
+forward past a successful response that lacks it. A user's explicit choice still applies on
+top (see "The user's choice"). The terminal UI and headless `-p` runs never consult the
 key: the standalone CLI does not read `/client/configs`. Its mode comes from the
 `--workflow-mode` flag and is `disabled` when the flag is absent (see "The standalone CLI:
 `--workflow-mode`").
@@ -2542,11 +2543,14 @@ policy sync, session create and resume in that process reuses it. The user's cho
 latched: it is applied to the latched offer at every use. A server flip therefore
 takes effect at the next app start, the same rule as the desktop context prompt gray. The
 latch is what keeps a session create from waiting on a network timeout when the machine is
-offline; the cost is that a Host that started offline stays disabled until restart. The
+offline; the cost is that a Host that started offline offers `disabled` until restart, so
+a user who never chose a mode has the feature off until then (an explicit choice still
+applies, see "The user's choice"). The
 provider's own 1 h envelope cache and `forceRefresh` serve the renderer's refresh, not the
 CLI gate. Remote Hosts over SSH, WSL and Docker evaluate the key themselves through their own
-`/client/configs` request, so a remote machine that cannot reach the server is disabled
-unless the override reaches it (below). The CLI never reads the key or the override;
+`/client/configs` request, so a remote machine that cannot reach the server offers
+`disabled`: the feature is off there unless the user's choice (pushed by the desktop) or the
+override (below) turns it on. The CLI never reads the key or the override;
 it only consumes what the Host sends, the way `offPeakToolEnabled` works. Old CLIs that do
 not know the policy method answer method-not-found, which the Host logs and ignores, and
 their `z.object` schemas drop the unknown session flag, so the pairing degrades to disabled.
@@ -2648,17 +2652,21 @@ Status: implemented. One app-wide setting, `dynamicWorkflowMode` in the shared s
 file, holds the user's choice. Absent means "follow the offer". It holds one of the three
 modes otherwise.
 
-**Precedence.** The server (or the local override) decides the *offer*: whether the feature
-is available (`offeredMode` is a known mode other than `disabled`, `isDynamicWorkflowOffered`)
-and which mode is the default. A snapshot without a readable `offeredMode` counts as not
-offered: it comes from an older Host (a newer UI bundle, such as the phone remote, attached
-to an older desktop), which ignores the choice, so neither the row nor the hub's settings
-button appears. The user's choice
-applies only when the feature is available, and then replaces the offered mode. A choice
-never turns the feature on where the offer is `disabled`: the stored value stays in the file
-and applies again if a later offer makes the feature available. The shared helper
-`applyDynamicWorkflowUserMode(offer, choice)` is the only place this rule is written; the
-Host calls it, and the renderer only reads its result.
+**Precedence.** The user's choice always wins. The server (or the local override) decides
+only the *offer*, `offeredMode`: the default mode, which is the effective mode while the user
+has not chosen. An offer of `disabled` is a default like the others, so a user can turn the
+feature on where the server does not send the key, where the request failed, or on a remote
+machine that cannot reach the server. A Host without a resolver for the offer at all (one
+that does not wire the feature) stays `disabled` whatever the choice. The server therefore
+has no remote off switch for a user who chose a mode; the feature is generally available, and
+the key only moves the default. The shared helper `applyDynamicWorkflowUserMode(offer, choice)`
+is the only place this rule is written; the Host calls it, and the renderer only reads its
+result.
+
+A snapshot without a readable `offeredMode` (`readDynamicWorkflowOfferedMode` returns
+nothing) comes from an older Host (a newer UI bundle, such as the phone remote, attached to an
+older desktop), which ignores the choice, so neither the row nor the hub's settings button
+appears for it.
 
 **Clear on default.** Picking the option that equals the offered mode deletes the stored
 value (the patch carries the empty string, which the settings patch normalizer turns into a
@@ -2680,10 +2688,10 @@ description that wraps inside the list:
 | `alwaysOn` | 始终开启 / Always on | 除了 /workflow 命令,模型也会根据你的意图主动运行工作流。 |
 
 The option equal to the offered mode carries a 「默认」 (Default) tag; the trigger shows the
-effective mode's title only. The row is not rendered while the availability snapshot is
-loading, when it failed, or when the offer is `disabled`: the gray release stays invisible,
-and a user whose server never offered the feature sees nothing that mentions it. The row
-has no note about timing; open sessions keeping their tools is the rule below, not something
+effective mode's title only. The row is always rendered once the availability snapshot is
+ready, whatever the offer: under an offer of `disabled` the trigger shows 关闭 and the tag
+sits on 关闭. It is not rendered while the snapshot is loading, when reading it failed, or for
+a snapshot from an older Host (above). The row has no note about timing; open sessions keeping their tools is the rule below, not something
 the row explains.
 
 **When it takes effect.** The same rule as a server flip: sessions created or resumed after
@@ -2717,8 +2725,8 @@ once that resolves, reloads its availability snapshot.
 mode's label (see "The hub page"). It is shown only while the hub itself is shown, that is,
 while the effective mode is not `disabled`. Under `disabled` the page reverts to the plain
 「自动化」 title and nothing points at the setting; the way back is Settings › 常规, where the
-user turned it off. A user who chose Off and a user who was never offered the feature see
-the same automations page.
+row is always present. A user who chose Off and a user whose default is Off see the same
+automations page.
 
 ### The local override
 
@@ -2821,12 +2829,12 @@ enabling the hub fixture must not change unrelated specs or the fail-closed prod
 | DWG-15 | Flag scope: `--workflow-mode` with `app-server`, `agent-server`, `login`, `skills` → exit 1 with the scope error; with `-p`, `--target`, `tui` or no command → accepted |
 | DWG-16 | TUI under `disabled`: the `/` suggestions and `/help` have no `workflow`; `/workflow x` answers the disabled notice without calling `submitPrompt`; `/dwf list` and `/dwf cancel` work; `/dwf resume <id>` answers the notice without calling `resumeWorkflowRun`. Under `onDemand` and `alwaysOn`: `/workflow` is suggested and submitted as before |
 | DWG-17 | Headless under `disabled`: `-p "/workflow x"` → the notice on stderr, exit 1, no app created; `-p "/help"` lists no `/workflow`. With `--workflow-mode alwaysOn` the command rides the plain-prompt path and the settle-wait as before |
-| DWG-18 | `applyDynamicWorkflowUserMode`: offer `onDemand` + choice `alwaysOn` → mode `alwaysOn`, `offeredMode` `onDemand`, `userMode` `alwaysOn`; offer `disabled` + any choice → `disabled`, no `userMode`; no choice → the offer unchanged; an invalid stored value is ignored |
+| DWG-18 | `applyDynamicWorkflowUserMode`: offer `onDemand` + choice `alwaysOn` → mode `alwaysOn`, `offeredMode` `onDemand`, `userMode` `alwaysOn`; offer `disabled` + choice `alwaysOn` → mode `alwaysOn`, enabled, `offeredMode` `disabled`; no choice → the offer unchanged; an invalid stored value is ignored. `readDynamicWorkflowOfferedMode` returns the offered mode, `disabled` included, and nothing for a snapshot without a readable `offeredMode` |
 | DWG-19 | Settings patch: `dynamicWorkflowMode: ""` deletes the stored value; a mode is stored as is; an unknown stored value does not break reading the file |
-| DWG-20 | Host: with a latched offer `alwaysOn`, a stored choice `onDemand` makes the next session create carry `dynamicWorkflowMode: "onDemand"` without a new server read; a choice `disabled` makes it carry no workflow fields; `syncDynamicWorkflowUserMode` re-sends the policy to every live workspace (`enabled: false` for `disabled`) only when the effective mode changed, in call order |
+| DWG-20 | Host: with a latched offer `alwaysOn`, a stored choice `onDemand` makes the next session create carry `dynamicWorkflowMode: "onDemand"` without a new server read; a choice `disabled` makes it carry no workflow fields; with a latched offer `disabled`, or an offer read that threw, a stored choice `alwaysOn` sends the policy `enabled: true` and makes session create carry the mode; without an offer resolver the choice is ignored; `syncDynamicWorkflowUserMode` re-sends the policy to every live workspace (`enabled: false` for `disabled`) only when the effective mode changed, in call order |
 | DWG-21 | Desktop-attached remote Host: without a local settings resolver it applies the last pushed value; the desktop pushes the settings value when it builds the remote workspace services and forwards later changes to live remote connections |
-| DWG-22 | UI Settings row: absent while loading, on failure, when the offer is `disabled`, and for a snapshot with no readable `offeredMode` (an older Host), where the hub's settings button is absent too; shows the effective mode; the 「默认」 tag sits on the offered mode; picking the offered mode writes `""`, picking another writes that mode; the store reloads after a change |
-| DWG-23 | Desktop E2E against a mock `/client/configs` sending `alwaysOn`: the row shows 始终开启 with the tag; choosing 关闭 removes the 「工作流」 title word and, in a new draft, the plus-menu entry; choosing 始终开启 again clears the stored value. Offer `disabled`: no row |
+| DWG-22 | UI Settings row: absent while loading, on failure, and for a snapshot with no readable `offeredMode` (an older Host), where the hub's settings button is absent too; present under an offer `disabled`, showing 关闭 with the tag; with an offer `disabled` and a choice `alwaysOn` the hub shows its settings button; shows the effective mode; the 「默认」 tag sits on the offered mode; picking the offered mode writes `""`, picking another writes that mode; the store reloads after a change |
+| DWG-23 | Desktop E2E against a mock `/client/configs` sending `alwaysOn`: the row shows 始终开启 with the tag; choosing 关闭 removes the 「工作流」 title word and, in a new draft, the plus-menu entry; choosing 始终开启 again clears the stored value. Offer `disabled`: the row shows 关闭 with the tag; choosing 始终开启 stores it and brings back the 「工作流」 tab and, in a new draft, the plus-menu entry |
 
 ## Alternatives not taken
 

+ 1 - 1
docs/performance/runtime-communication-repro.md

@@ -34,7 +34,7 @@ All cases in this document use desktop `desktop-continuous`. They must not be us
 | ID | Purpose | Setup | Action | Evidence |
 | --- | --- | --- | --- | --- |
 | PERF01 | Isolate one visible pane under high-frequency stream traffic. | One v4 pane, one session, synthetic recorded-stream fixture with many text/reasoning/tool-input chunks. | Send one prompt and keep the stream open long enough for CPU sampling. | Network artifact with chunk timeline, optional CDP profile, UI remains responsive. |
-| PERF02 | Reproduce visible four-pane runtime fanout with tools and subagents. | Four v4 panes in one workbench, each bound to a different session. | Send four prompts that each trigger an `Agent` tool, a child subagent streamed response, then a streamed parent final response. | Electron window recording, replay artifact with multiple overlapping `/messages` streams, all panes reach final markers. |
+| PERF02(2026-10-16 退役) | Reproduce visible four-pane runtime fanout with tools and subagents. 分屏入口下线后用户无法再创建四 pane 布局,spec、fixture 与 `openV4SplitFromSidebar` helper 已删除;下文命令与结论仅作历史记录。 | Four v4 panes in one workbench, each bound to a different session. | Send four prompts that each trigger an `Agent` tool, a child subagent streamed response, then a streamed parent final response. | Electron window recording, replay artifact with multiple overlapping `/messages` streams, all panes reach final markers. |
 
 ## Recording And Profiling
 

+ 12 - 0
docs/plugin-management-lifecycle-case-catalog.md

@@ -166,3 +166,15 @@ PLM-LC-018(管理列表本地化)、PLM-LC-019(双入口创建插件草稿
 连续点击两个不同插件的安装按钮,两者都保持安装中且不能重复提交。任一完成或失败后,另一项继续安装中;两者结束后恢复各自最终状态。补充同名并发及切换上下文后同名操作的隔离回归。
 
 浏览器候选用例:`packages/ui/test/browser/manual-review/pending/plugin-concurrent-install.test.mjs`,真实 store 与共享安装按钮,受控服务完成,390/1200px × 中英文 × 深浅主题。桌面候选用例:`packages/desktop/test/e2e/plugins/manual-review/pending/plugin-concurrent-install.test.ts`,真实个人来源与 CLI 安装,通过本地 HTTP 响应门控制失败顺序。均保持 pending,不自动晋升。
+
+## PLM-DETAIL-DURING-INSTALL
+
+插件 A 的安装下载未完成时,打开其他未安装插件的详情,组件区按 `plugins/describe` 正常加载;插件列表与总览(新建右侧标签页首次加载使用)也立即返回,不等待 A 的安装结束;A 仍保持安装中。卡片“更新”和详情“恢复用户默认”只在自身插件操作中禁用。
+
+桌面候选用例:作为 PLM-CONCURRENT-INSTALL 桌面用例中的一步,真实个人来源与 CLI,HTTP 响应门挂起 A 的下载、B 排在 A 后面时打开本地插件详情,返回后两项仍为安装中;同一时刻经桌面服务链路请求 list/overview,10 秒内返回。单测覆盖 transport 立即派发 describe/list/overview、manifest 已缓存时不等存储锁、manifest 缺失时仍进锁,以及两处按钮的按插件禁用。保持 pending,不自动晋升。
+
+## PLM-BUILTIN-UI-UNINSTALL
+
+卸载内置 UI 插件(如 Word 文档)后,可恢复卡片仍在「UI 插件」专区,不掉进「生产力」等分类分组。已安装时同样在专区。
+
+桌面候选用例:`packages/desktop/test/e2e/plugins/manual-review/pending/plugin-builtin-ui-uninstall.test.ts`,真实 CLI,经卡片菜单卸载 `documents@zcode-plugins-official`,等待总览进入 `restorableBuiltins` 后断言卡片在 `plugin-store-ui-section` 内。bootstrap 单测校验内置定义的 `ui` 组件类型与插件包 `ui.surfaces` 一致,且卸载后官方目录与可恢复列表都带 `ui`。保持 pending,不自动晋升。

+ 7 - 1
docs/plugins/plugin-market-interactions-scope.md

@@ -42,6 +42,7 @@
 - 在现有 Store Listing 类型、运行时 schema、目录解析和插件查询中贯通可选 `publisherType` 字段,不修改 `source` 的安装语义。
 - 公开 = 官方市场中官方维护的插件;社区 = 官方市场中社区维护的插件;个人 = 用户自行添加的来源。
 - 分类查询、精选、UI 插件专区和搜索都先限定当前分段,避免同一条目跨分段重复展示。
+- UI 插件专区按条目的 `ui` 组件类型归组;内置 UI 插件(Word、PDF、PPT、表格)卸载后的可恢复条目没有运行时信息,组件类型由内置定义随官方目录与可恢复列表下发,仍留在专区而不掉进分类分组。
 - 兼容旧目录:官方市场缺少归属字段时暂保留原有公开展示;内置插件明确属于官方。新发布目录必须生成完整字段,历史条目核对后随目录刷新进入正确分段。
 - 不迁移用户安装目录、插件 ID 或全局 / 项目配置,不把插件归属当作执行权限或可信度等级。
 
@@ -198,7 +199,12 @@ flowchart LR
 - 已安装但当前项目未启用:显示“启用”,写入当前工作区覆盖。
 - 已安装且启用:显示“打开”;点击时重新查询真实面板,不能用配置构造资源地址。
 - 安装、启用成功只刷新状态,不自动打开;用户再次点击才打开。失败保留原状态并提示,允许重试。
-- 操作中禁止重复点击;切换工作区、服务或会话后,旧操作不能触发新目标的动作或错误提示。
+- 推荐区与市场共用按插件判定的操作状态:安装或恢复 A 时,B 仍可提交安装,已启用的 C 仍可点击打开;只禁止同一插件重复操作,同插件的多个 surface 共用进度。
+- 忙碌态读取既有插件管理 store,不在推荐 hook 中另建全局操作锁。排队中的安装沿用市场的“安装中”展示;不同插件的安装仍按提交顺序串行执行,本期不提供取消安装。
+- 安装进行中可打开任意插件详情(包括正在安装的插件);组件区读 `plugins/describe`,不等待安装完成。
+- 安装进行中新建右侧标签页,推荐区按 `plugins/list`、`plugins/overview` 加载,不等待安装完成,不停在骨架屏。
+- 卡片“更新”、详情“恢复用户默认”同样按插件判定忙碌,只禁用自身操作中的插件;同插件保存配置期间也视为忙碌。
+- 切换工作区、服务或会话后,旧操作不能触发新目标的动作或错误提示,也不能清理新目标的忙碌态。
 - 草稿仍不展示。手机/Web/远程可安装或启用,打开仍遵守原有平台能力限制。
 
 ```mermaid

+ 18 - 0
docs/remote/project-first-remote-navigation-spec.md

@@ -59,6 +59,8 @@ flowchart TD
 
 - 无明确目录的手动入口统一进入目录选择;不创建或激活远程无项目聊天草稿。
 - 已有项目、最近目录入口必须保留原项目意图;需要补凭据、安装或升级时,在向导内完成后继续原项目。
+- 设置页设备卡的「最近项目」按 Source 身份和目录从本机已保存入口解析原项目,连接前固定入口 ID;在线点击和离线重连都复用已有项目恢复链路,不进入项目创建器、不新增项目。不能只传目录把打开意图降为创建意图;入口缺失或同目录有多个入口而无法唯一确定时报告无法确定原项目,保留当前页面,不猜选项目。连接完成仍按原入口及 Host 成员资格复验,移除后不复活。
+- 原项目恢复在连接后从所属 Host 的项目树解析入口对应的有效项目,将其 projectId 显式传入草稿初始化并更新草稿范围;本地草稿缓存缺失或仍指向同目录其他项目时,不能替代原项目身份。旧入口复用目录 owner 的唯一匹配规则;项目缺失、已删除或目录不符时停止恢复。仅恢复已有会话的重连继续保留会话选择。
 - 已保存项目不要求已存在 Renderer tab。桌面菜单由 Root 分派,未加载项目从本机成员目录解析;凭据齐全时只恢复设备。需要交互时携带精确 Profile 和原项目入口,处理完成直接绑定原目录,不进入新建项目编辑。交接及完成前验证成员仍存在;Profile 连接意图不同时携带 Source“连接后选目录”意图。
 - 未加载 tab 的已保存项目,其操作线路沿用 Host 的默认 Profile 选择规则;其他线路的失败只参与设备展示,不得替换默认线路或阻止其连接。交接只使用操作线路的状态和错误。
 - 原项目完成意图固定 entryId 与 host membershipId。目录绑定等异步步骤返回后,从成员目录复验原实例,再提交连接历史与导航;入口移除或成员换代使原意图取消,不回退新建目录选择,不释放其他项目复用的 attachment。
@@ -259,6 +261,22 @@ Source online
 
 ## 9. 验证记录与限制
 
+### 设置页最近项目恢复(2026-10-16)
+
+根因是设置入口只传 Profile 与目录,Root 未收到已保存入口 ID,因而跳过原项目恢复分支。修复复用侧栏目录 owner,在点击时按 Source 与目录固定唯一入口 ID;连接完成继续原有成员复验与导航,不新增状态缓存或重试。
+
+同日评审补充修复:入口校验后仍未传递 projectId,草稿会沿用本地缓存,缺失时成为未归类,过期时指向其他项目。恢复现从所属 Host 解析有效项目,把项目 ID 交给 Root 草稿 owner,同时更新内存与持久化范围;显式项目草稿与恢复旧会话选择互斥。
+
+- 回归先确认缓存缺失与错误缓存两项失败,再验证正确缓存、持久化范围及同 tab 后台重连交叉场景;最终以 `1d187f8f691a9e9e5cf27156ef2826d435d87ec9` 为起点选中的 43 个受影响测试文件 / 535 项通过,定向回归同时覆盖旧入口解析与成员失效。typecheck、Lint(0 errors)、架构和变更代码格式检查通过。
+- 最终源码的 macOS Desktop + 全新 Linux SSH 容器 E2E run `desktop-e2e-20261016141425114-p13665-2cfa998be7b5adba` PASS:在线缺少草稿缓存、离线残留其他项目缓存时均恢复原项目并校正持久化范围,入口集合不变,无创建弹窗。深浅主题与三档宽度截图沿用 RDUX-13-03;未发送模型请求。
+- 首轮 run `desktop-e2e-20261016140536472-p84812-8785189417c54ffb` 在首次打开项目时出现 renderer attachment 未就绪,随后超时,尚未进入新增缓存断言;该次失败原因未定,保留记录且不计为功能通过。重新构建的第二轮及上述最终轮通过。未实跑 Windows/Linux Desktop、WSL、Docker transport 或手机;设置设备管理入口仅桌面开放,候选 E2E 仍为 pending。
+
+- 先修改 RDUX-13-01 E2E,在修复前的 macOS Desktop + 全新 Linux SSH 容器中确认创建弹窗断言失败(run `desktop-e2e-20261016134122289-p3441-1b5b8c7e11c117a8`)。
+- 修复后完整 E2E run `desktop-e2e-20261016134749964-p14872-919a9a258f3e5144` PASS:通过本机 Docker 新建的独立 SSH 容器完成真实安装、连接、在线点击和断线后点击;原 workspace identity、项目 ID 与本机入口集合保持不变,无创建弹窗。深浅主题 × 1440/900/480px 截图保存在该 artifact。未发送模型请求。
+- 首次修复后运行已通过最近项目断言,随后旧的历史连接折叠检查因仍有后台流程而失败;测试改为关闭失败流程后验证默认折叠,保留原断言。另一次复用构建运行在 Host 启动时失败,未进入业务场景;重新构建后的上述完整运行通过,不将启动失败计为功能通过。
+- `pnpm typecheck`、Desktop E2E 类型检查、Lint(0 errors)、架构门禁、变更代码格式检查通过;以起点 `38c8129a54edc615c7c41950ea929e7a539427e7` 选择的 478 个受影响单测文件 / 5108 项通过。定向测试覆盖跨 Source 同路径隔离、无 tab、旧入口、入口/Host 缺失和歧义;已有恢复交接回归继续覆盖成员失效。
+- 本轮未实跑 Windows/Linux Desktop、WSL、Docker transport 或手机端;设备管理页只在桌面开放,shared-host、continuous/replayable、Host 与 CLI 均未修改。候选 E2E 保持 pending,未人工转正或加入 CI。
+
 ### 连接意图隔离回归(2026-09-16)
 
 已有项目进入向导时,外部偏好只初始化一次当前连接意图;后续补凭据、安装、升级和重试读取向导的 `pendingCompletionIntentRef`。设备页明确选择「新建连接」或另一条线路时,取消旧项目目录和 Root 持有的 `preferredWorkspaceTabId` 恢复互斥,未指定目录的连接成功后必须进入目录选择。

+ 4 - 0
docs/settings-storage-management.md

@@ -1,5 +1,9 @@
 # 存储管理(Storage Management)规划
 
+> Bash 输出优先写入系统 tmp,目录不可用时复用 `cli/exec`。本页统计仍仅覆盖现有 `.zcode` 数据根:
+> tmp 输出暂不计入占用数字,也不增加清理入口;历史及降级的 `cli/exec` 继续归入工具输出与临时缓存。
+> 文件读取和打开入口使用实际输出路径,不受统计范围影响。路径合同见 `tmpdir-storage-paths-spec.md`。
+
 > 状态:**已实现(2026-09-10)**。裁决记录见 §8,实现落点见 §11。
 > 位置:**资源管理器窗口 → 「存储」tab**(2026-09-10 裁决:从设置页「数据与统计」整体迁入资源管理器,与 CPU / 内存并列;设置页不再有入口)。窗口本身的架构见 `docs/electron/resource-manager.md`。
 

+ 17 - 4
docs/subagent-session-side-tabs.md

@@ -183,12 +183,25 @@ publisher(parent) -> parent timeline/index/legacy delivery
 
 子会话不进入主任务索引,不能用 childSessionId 查询主任务项目归属来决定能否订阅。
 Host 使用同一 Agent 的只读 `session/list(sessionIds)` 查询持久化类型与父子关系;
-仅确认 `subagent_child` 后沿父链找到主任务,再由现有项目服务校验项目、Host 和目录。
+按下表确认辅助会话类型后沿父链找到主任务,再由现有项目服务校验项目、Host 和目录。
 子会话未单独保存 workspace identity 时,CLI 精确 ID 查询只在 child cwd 相同且持久化父链证明
 属于请求 workspace 后返回;显式的不同身份仍拒绝。普通列表继续排除 child,查询不回写身份或激活 runtime。
 每个会话必须与当前 attachment 的 workspace identity 和 cwd 相符;父关系缺失、成环或跨工作区时拒绝。
 普通远端主任务仍必须有项目,不按 ID 前缀或旧索引行识别子会话,不补建子会话 task 行,也不扩大目录范围。
 
+| 持久化类型 | 项目解析 | 主列表 | 用户输入 |
+| --- | --- | --- | --- |
+| `interactive`、`fork`、`workflow_parent` | 自身任务的项目 | 可见 | 保持原有准入 |
+| `subagent_child`、`workflow_child` | 校验父链后使用所属主任务项目 | 隐藏 | 只读 |
+| `selection_side_chat` | 校验父链后使用所属主任务项目 | 隐藏 | 可聊天,保留辅助对话自己的命令限制 |
+| `nested_workflow_child` | 按持久化工作流子会话处理;不新增创建入口 | 隐藏 | 只读 |
+
+2026-10-19 回归:原修复仅识别 `subagent_child`,工作流与辅助对话仍以 child ID 查项目。
+项目继承与只读准入分别判断类型,不能用 `parentID` 或同一个只读开关代替;混合父链逐层校验,
+即使旧 child 索引有项目也不能跳过 CLI 父链。普通 fork 可拥有自己的项目,必须在 fork 处停止继承。
+辅助对话续发前保存 Recent 配置时,UI 使用侧栏记录的所属主会话查询项目,发送目标仍是 child;
+不能拿未入主索引的 child 查询项目,也不能把普通会话或 fork 的 Recent 改写到父项目。
+
 ```text
 桌面 continuous / 手机 replayable → 同一 Host → Agent 持久化会话类型
   ├─ 主任务 → 原项目目录校验
@@ -218,20 +231,20 @@ child 完成 → publisher 回收 → subscribe → 读取持久化 taskType →
 ```
 
 用户发起的 sendText、retry/edit、goal 续跑等输入命令在 session_input / input_history 写入前
-拒绝 subagent_child;已激活 child 返回 reasonCode `guard.subagentReadOnly`,尚无独立 record 的
+拒绝 subagent_child、workflow_child、nested_workflow_child;已激活 child 返回 reasonCode `guard.subagentReadOnly`,尚无独立 record 的
 运行中 child 沿用既有 `proto.sessionNotFound` 拒绝,绝不为发送输入额外激活 runtime。Agent 工具正常派发 child
 仍由父 runtime 驱动,不经过用户协议输入准入;workspace-only 文件撤销保留既有边界。
 
 历史污染修复由 Host task index syncer 在 workspace 首次权威 sessions-index 基线到达后执行:
 对本地已有而基线缺失的 task 分批调用只读 session/list(sessionIds),从 Agent 持久化元数据
-确认 subagent_child 后,仅标记对应 task index 为不可见并清理分组/排序引用;不删除 Agent
+确认表中隐藏的辅助会话类型后,仅标记对应 task index 为不可见并清理分组/排序引用;不删除 Agent
 session、message、part。查询不创建 runtime、不读取 transcript、不改变归属。远端身份必须
 贯穿 workspaceIdentity / remoteSessionId,异步结果仅应用于仍有效的订阅代际;旧 Agent 不支持
 显式查询、缺失 session 或查询失败时保留索引,下一次 workspace 基线再尝试。不得根据基线缺失
 或 parentID 单独删除。普通 session/list 继续只返回主列表类型;显式 sessionIds 查询返回匹配
 workspace 的持久化身份(含隐藏类型),单批最多 64 个,includeArchived 沿用现有含义。
 
-完整 snapshot 同步也不得将 subagent_child 写成主任务;对于已打开的旧污染标签页,后端
+完整 snapshot 同步也不得将表中隐藏类型写成主任务;对于已打开的旧污染只读子代理标签页,后端
 准入仍拒绝输入。修复不新增 accepted queue、timer、owner,不改变 continuous/replayable 边界。
 
 验收:SAT27 覆盖 warm / grace 回收 / 父释放 / 冷启动后的详情重开及列表隔离;SAT28 覆盖用户

+ 27 - 0
docs/superpowers/specs/2026-09-09-virtual-project-design.md

@@ -16,6 +16,15 @@
 > 而远端未归类会话不进入侧栏,升级后选择原目录只能新建空项目。现按 F8 例外处理:
 > 持库 owner 不是 local 时,首次迁移也按历史任务目录建单 root 项目并归入。
 > 已执行过 `0005_projects` 的库不补跑、不修复;migration ID 与 SQL checksum 不变。
+>
+> 2026-10-19 止血补充(同机多持库 owner):同一台机器上本机桌面(owner=local)与 Source Server
+> (owner=server)共用 `~/.zcode/v2/tasks-index.sqlite`。`0005_projects` 按库只执行一次,只写入
+> 首个打开者的 host 行;后打开的 owner 缺少自己的 hosts 行,新建项目因 `projects.host_id` 外键失败。
+> 每个 owner 每次启动在 `reconcileLegacy` 中幂等补齐自己的 host 行(`INSERT OR IGNORE`),
+> 不改 schema、migration ID 与 checksum,不改任何任务的 `host_id` 与项目归属。
+> 遗留问题(未修复):旧行 `host_id IS NULL` 由首个处理者认领;local 按 workspace_key 形态判定,
+> server 不看 key 全部归自己,A 本机旧会话可能被 Source Server 认领、SSH 旧会话可能被本机归入
+> ssh 地址 host。认领规则与已错归数据的修正另行裁决。
 
 状态:**实施中**(2026-09-10)。第 3 节是裁决记录(2026-09-09 至 09-10 与 维护者 逐条对齐),第 4 节起是按裁决展开的方案。实现前若发现与裁决冲突,以裁决记录为准并回来更新本文。实施边界、测试与进度见 [实施记录](../plans/2026-09-10-virtual-project-implementation.md)。
 
@@ -747,6 +756,24 @@ runner(备份只为迁移失败恢复;未触及的表迁移前后是同一
 
 ### 7.2 步骤
 
+2026-10-19 首次升级排序补充:从 3.15 尚未执行项目迁移的控制端升级时,保留旧
+`lastWorkspaceSession` 的本地/远程混排顺序。本地复用 `projects.position`,远程入口保存
+可空的 `initial_position`,仅供侧栏首次排序初始化;不把控制端位置写到远端项目。
+新增独立加法 migration,只有同一迁移事务实际执行了 `0005_projects` 时才写初始位置,
+已有 `0005_projects` 或旧 ID `0001_projects` 的数据库不补排,不改旧 checksum。
+仅带此次迁移标记的远程入口在 `legacy:<entryId>` 解析成真实项目 ID 时原位替换排序键;
+沿用现有排序算法和偏好 owner,不全局切换排序身份。首屏离线、连接完成、Host 身份绑定、
+刷新以及升级后手动拖动均保持位置;失败回滚后可重试,重复启动不覆盖新排序。
+
+```text
+3.15 的 A → Remote R → B → 首次事务保存 0/1/2 → 现有侧栏偏好
+                                      legacy:R → project:R(同一排序槽位)
+```
+
+VP28 补充验证:真实冷启动迁移本地/remote 混排与离线刷新;SQLite 和 React 回归覆盖
+连接后身份替换、同路径不同 Host、手动排序、旧 ledger 不回填与迁移幂等。沿用 shared-host
+手机目录及同一排序逻辑,不改 CLI、会话归属、continuous/replayable 或连接调度。
+
 ```text
 M0 探测:tasks-index 无 schema_migration 或缺 '0001_projects' → 进入迁移;否则跳过
 M1 备份:按 7.1 表级备份两库 → ~/.zcode/backup/<ver>-<ts>/

+ 11 - 3
docs/superpowers/specs/2026-09-11-archive-management.md

@@ -5,7 +5,7 @@
 ## 行为与边界
 
 - 页面名与顶部页面标题均为“归档管理”,位于自动归档设置之前;列表标题为“已归档的会话”。只显示 Host readTree 的 archived 行;CLI 删除镜像排除已删除任务,不能从 sessions-index 补行。
-- 自动归档设置统一放在“归档管理”顶部、已归档聊天列表之前:“自动归档旧会话”和“归档保留时长”保持同一设置卡片,常规页移除这两项。沿用现有设置键、默认关闭/7 天、3/7/14/30 天选项及关闭时禁用时长的行为。2026-10-14 起,旧配置的开启状态一次性归位为关闭,保留天数,用户重新开启后才执行;迁移合同见 virtual-project-design 的“自动归档修复后的重新开启”。中英文、明暗和窄屏布局沿用公共设置行。
+- 自动归档设置统一放在“归档管理”顶部、已归档聊天列表之前:“自动归档旧会话”和“归档保留时长”保持同一设置卡片,常规页移除这两项。沿用现有设置键和 3/7/14/30 天选项。2026-10-19 起默认关闭、保留 30 天;已有天数不覆盖。关闭时也允许选择并保存时长,关闭期间只保存配置、不执行归档;开启后按已保存时长执行。开启时修改时长沿用设置变更补扫,已归档会话不会因时长变化自动恢复。2026-10-14 起,旧配置的开启状态一次性归位为关闭,保留天数,用户重新开启后才执行;迁移合同见 virtual-project-design 的“自动归档修复后的重新开启”。中英文、明暗和窄屏布局沿用公共设置行。
 - 页内固定文案统一使用“会话”,覆盖自动归档标签/说明、列表标题、搜索、数量、加载/空态/失败提示和删除确认;英文对应统一为 session。用户自定义会话标题与项目名称原样展示。标题复用 SettingsPage 公共页头与 archives.nav,列表仍使用 archives.title;仅展示调整,不改状态 owner、命令、持久化或失败语义,无迁移。
 - 默认更新时间/所有项目,搜索标题(不区分大小写);用户明确中间下拉是“排序方式”,只提供更新时间、创建时间,均倒序。搜索与项目筛选取交集。
 - 筛选区复用公共 Select:触发框仅显示当前选项与下拉箭头;“排序方式”标签放在排序框外左侧,不显示排序或项目装饰图标。外部排序标签关联 Select,保留键盘操作与可访问名称;窄屏换行、中英文和明暗主题保持可用。只调整展示,筛选状态继续由 ArchiveManagementContent 持有,不新增组件或状态同步路径。
@@ -35,7 +35,7 @@ Host readTree -> 单一 ProjectDirectoryProvider -> sidebar / composer / archive
 
 ```text
 归档管理设置卡片 → SettingsPage 原回调 → SettingService.update
-                                      ├→ 原 Host 扫描调度
+                                      ├→ 原 Host 扫描调度:关闭则退出,开启则按已存天数扫描
                                       └→ 保存成功 → SettingsPage 更新展示值
 ```
 
@@ -63,10 +63,18 @@ Host readTree -> 单一 ProjectDirectoryProvider -> sidebar / composer / archive
 | ARM04 | 同 projectId/任务 ID/真实路径不同 Host→路由→完整 identity/source/attachment 保留;本地与远端隔离                       | accepted;unit;真实远端/手机 GUI 待验             |
 | ARM05 | 长标题、50+列表、中英文、390px、明暗→搜索/更多/按钮/滚动可用                                                           | accepted;unit + E2E 共享 renderer,不冒充手机配对 |
 | ARM06 | 默认全部收起→鼠标/键盘展开与收起→只挂载展开组;折叠组数量和批量动作仍完整有效                                          | accepted;unit + pending E2E                       |
-| ARM07 | 常规页无自动归档项→归档管理顶部开启并切换时长→真实设置落盘、刷新恢复;关闭禁用时长且保留原值                           | accepted;pending E2E;复用 ARM05 布局覆盖          |
+| ARM07 | 常规页无自动归档项→归档管理默认关闭/30 天→关闭时切换并保存时长、刷新恢复→开启后使用已存时长;关闭后仍可修改                           | accepted;pending E2E;复用 ARM05 布局覆盖          |
 
 E2E 放 manual-review/pending,fixture 在隔离 HOME/工作区创建;只用历史数据无需模型,provider policy=none。功能与批量语义按用户请求及既有命令约束确定;未改流协议,formal-proof 消息状态组合剪枝。不晋升 formal/Docker,等待人工 review。
 
+### 2026-10-19:默认 30 天,关闭时可预设时长
+
+默认设置、SettingsPage 初始值/缺省值及 Host 扫描缺省值统一为 30 天,不迁移已有天数。移除时长下拉框与开关的禁用绑定;继续通过原 SettingService 保存,关闭时扫描退出,开启后读取已存值,不新增状态或同步路径。
+
+先运行新增默认值断言,旧实现的 schema 与设置服务均返回 7 天;旧桌面构建的 ARM07 在“关闭时下拉框可用”断言失败。修改后运行 `desktop-e2e-20261019062710421-p61805-cfee647173bf3a00`,ARM07、ARM08、ARM01/05/06 共 3/3 通过:默认关闭/30 天、关闭时改 7 天并刷新、开启保留 7 天、开启时改 14 天、再次关闭后改 30 天、已有归档不恢复;中英文 × 明暗 × 1200/390px 布局验证通过并检查截图。用例保持 pending,窄屏不等同真实手机/远端 Host 验证。旧构建的额外 ARM02/ARM03 取消归档用例已失败,本次没有修改这些动作,不将其计入通过范围。
+
+验证:root/E2E typecheck、fixture check、格式检查、架构检查(0 违规)通过;lint 0 errors / 188 warnings。从任务起点运行受影响单测,选中 1432/2496 文件,首次 16152 项通过、2 项失败、6 项跳过;失败均在 subagentsService 测试,分别为 afterEach 清理超时和随后临时文件 ENOENT,该文件完整复跑 29/29 通过。没有修改失败用例或放宽超时,也没有将首次整批运行记为全通过。
+
 ## 验证结果
 
 验证:相关单测 12 文件 / 67 项通过;最终 Electron `desktop-e2e-20260911073549408-p8673-2d528e9e7a8486a5` 3/3 通过,包含真实创建/更新时间反向排序、虚拟项目筛选、取消归档回写、删除确认取消、CLI time_deleted 与 Host cli_deleted、重新打开后的持久化结果、搜索范围批量删除、分组取消归档,以及 1200/390px 明暗截图和溢出检查。root typecheck、E2E typecheck、fixture check、lint(48 个既有 warnings / 0 errors)与架构门禁(baseline 0 / new 0)通过。真实手机配对/远端 Host/Windows/Linux 未运行,不能以窄屏截图替代。

+ 25 - 8
docs/testing/conversation-session-e2e-coverage-matrix.md

@@ -3144,7 +3144,7 @@ WFA01:pending,`manual-review/pending/workflow-face-motion.test.mjs`。独立
 | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
 | DWG-08-A(disabled)       | `packages/desktop/test/e2e/conversation-session/manual-review/pending/conversation-session-dynamic-workflow-gray-disabled.test.ts`              | 服务端不下发 key 时 `/` 面板无 `workflow`、`+` 菜单无「工作流」、自动化页无标题标签;`goal` 在场作正向对照;provider 无请求                                                                                                                                                                                                                                                                                                                                                               | pending,未 promotion |
 | DWG-08-B(alwaysOn)       | `packages/desktop/test/e2e/conversation-session/manual-review/pending/conversation-session-dynamic-workflow-gray-always-on.test.ts`             | 服务端下发 `alwaysOn` 时三个入口都在场,且 `workflow` / 「工作流」紧随 `goal` / 「目标」;provider 无请求                                                                                                                                                                                                                                                                                                                                                                                 | pending,未 promotion |
-| DWG-23(用户选择)         | `packages/desktop/test/e2e/conversation-session/manual-review/pending/conversation-session-dynamic-workflow-gray-always-on-user-choice.test.ts` | 服务端 `alwaysOn` 时设置 › 常规的模式行显示「始终开启」且「默认」只在它上面;选「关闭」写进设置、自动化页无「工作流」、新草稿 `+` 菜单无「工作流」;选回默认删除选择、「工作流」回来;disabled 档(DWG-08-A 第 4 步)无模式行;provider 无请求                                                                                                                                                                                                                                            | pending,未 promotion |
+| DWG-23(用户选择)         | `packages/desktop/test/e2e/conversation-session/manual-review/pending/conversation-session-dynamic-workflow-gray-always-on-user-choice.test.ts` | 服务端 `alwaysOn` 时设置 › 常规的模式行显示「始终开启」且「默认」只在它上面;选「关闭」写进设置、自动化页无「工作流」、新草稿 `+` 菜单无「工作流」;选回默认删除选择、「工作流」回来;disabled 档(DWG-08-A 文件里的 DWG-23 用例)模式行照样出现、显示「关闭」且「默认」在它上面,选「始终开启」写进设置、自动化页「工作流」与新草稿 `+` 菜单「工作流」都回来;provider 无请求                                                                                                            | pending,未 promotion |
 | DWS-01(保存确认窗长内容) | `packages/desktop/test/e2e/conversation-session/manual-review/pending/conversation-session-dynamic-workflow-gray-always-on-save-window.test.ts` | 合成回放让模型以超长说明、40 个实参、长脚本调用 `SaveWorkflow`:确认窗不超过 min(72% 视口, 42rem) 且整窗在视口内、确认按钮点得到;窗内纵向可滚的只有选项以上那一个滚动区(展开全部实参与脚本后仍是);说明/whenToUse 各有「展开」、实参只显示前 8 行;第一个选项上 Shift+Tab 回到滚动区的脚本开关、再到「显示全部」,回车展开(键盘可达);滚轮只动滚动区、到底不链到时间线;实参表头贴住滚动区上沿;内容区降到 36rem 以下时整窗退回唯一的滚动区、滚到底确认可点;拒绝后不写盘、turn 收口 | pending,未 promotion |
 
 灰度档位由 case-local 配置网关 `packages/desktop/test/e2e/helpers/dynamic-workflow-config-mock-server.ts` 提供:
@@ -3289,6 +3289,10 @@ VP22(accepted/pending,2026-09-11):编辑器零 root 空态与有 root 
 
 VP28(accepted/pending):conversation-session/manual-review/pending/conversation-session-project-upgrade-order.test.ts,冷启动前预置旧 settings/未升级 tasks-index,断言真实迁移后仅保留 settings 项目及原顺序,历史额外目录不建项目,历史任务及归档/删除状态保留,刷新稳定。Host 隔离、Group 不转项目、settings 缺失/空列表与不覆盖升级后项目及手动排序由 project-storage contract 覆盖;不计为跨 Host 混排或手机配对验证。
 
+VP28 混排补充(2026-10-19,accepted/pending):remote 第 2 项的 3.15 首次升级、离线首屏及刷新由真实 Electron/SQLite 验证;连接后的排序身份替换、手动排序、跨 Host 同路径和已有 ledger 不回填由存储/React 回归验证。实际远端连接与手机配对证据另列,不由离线夹具推定。
+
+验证:`desktop-e2e-20261019052603635-p90733-49f318d88a398947` 桌面升级 2/2、既有手机 shared-host 回归 1/1 通过,桌面升级和刷新截图已核对。隔离 Personal 夹具刷新后复用现有 API Key 进入步骤;VP13 文件入口断言同步为当前右侧 Files 标签。受影响单测 355 文件 / 4625 项通过(1 项既有跳过),typecheck、E2E typecheck、lint、架构、schema 兼容及代码格式检查通过。手机为 390px 浏览器连接真实 Main/Host,外部账号/relay/provider 使用隔离 fixture;不代表物理手机、真实 SSH/WSL 连接升级或 Windows/Linux GUI 实测。保持 pending。
+
 VP28 旧后端补充(2026-10-15,accepted/pending):升级 fixture 含旧后端置顶行及当前 CLI 的新导入会话;升级/刷新后只显示后者,允许取消置顶与归档,旧行在库内原样保留。project-storage 单测覆盖首次/已有 ledger、普通/置顶/归档、本地/远端 owner。VP13 手机 shared-host 增补已迁移旧行隐藏和正常会话操作。
 
 验证:桌面升级 `desktop-e2e-20261015050956912-p71132-c54a18f1bcfc6d52` 2/2、手机 shared-host `desktop-e2e-20261015051352075-p73274-e69ead6215d1a3c3` 1/1 通过。前者校验升级/刷新、真实取消置顶/归档及 SQLite 旧行不变;后者校验已迁移旧行隐藏、正常导入会话操作和既有导航链路。手机为 390px 浏览器连接真实 Main/Host,外部账号/relay/provider 使用隔离 fixture;不代表物理手机或真实 SSH/WSL、Windows/Linux GUI 验证。保持 pending。
@@ -3315,7 +3319,7 @@ ARM01–ARM05(accepted/pending,2026-09-11):设置/数据与统计新增
 
 ARM06(accepted/pending,2026-09-15):归档分组名称右侧显示折叠箭头,默认全部收起、不挂载聊天内容;鼠标/键盘独立展开与收起,收起立即卸载行;数量、搜索和折叠组批量动作仍按全部匹配项处理。复用同一 spec 和 pending E2E,覆盖中英文/明暗/窄屏的收起与展开布局;本页状态不持久化。
 
-ARM07(accepted/pending,2026-09-15):自动归档开关和保留时长从常规页移到归档管理顶部;开关/时长真实落盘并在刷新后恢复,关闭时长禁用但保留值。复用 archive-management pending E2E 与 ARM05 中英文/明暗/390px 截图;AMT02 同步改用归档管理入口。设置 owner 和 Host 扫描不变,手机不新增设置入口。
+ARM07(accepted/pending,2026-09-15):自动归档开关和保留时长从常规页移到归档管理顶部;开关/时长真实落盘并在刷新后恢复。2026-10-19 起默认关闭/30 天,关闭时也可切换并保存时长,开启后使用已保存的值;已有天数与已归档会话保持原样。复用 archive-management pending E2E 与 ARM05 中英文/明暗/390px 截图;AMT02 同步改用归档管理入口。设置 owner 和 Host 扫描不变,手机不新增设置入口。
 
 ARM08(accepted/pending,2026-09-15):归档管理公共页头位于自动归档设置之前;页内固定文案统一会话/session,用户内容保持原样;覆盖搜索、数量、空态与删除确认,复用 ARM05 中英文/明暗/1200/390px 布局验证。
 
@@ -3549,6 +3553,11 @@ RPN-16 回归(2026-09-16):`remoteWorkspacePreparation.test.ts` 覆盖真
 
 ## SAT27–SAT29:子代理冷恢复与主列表隔离(3.12.2)
 
+2026-10-19 类型回归:SAT30 覆盖 subagent_child、workflow_child、selection_side_chat 与历史 nested_workflow_child;
+项目父链继承与只读准入分开。SAT28 只拒绝三类 agent child,辅助对话继续发送;SAT29 清理四类隐藏索引,保留 fork 与未确认身份。
+远端 UI 候选已通过 macOS 客户端 → SSH → Linux arm64 Server 发布包回归(`r3-server-workflow-hotfix-2f5c48dd`):工作流 actor 正文可读且只读、显式 GLM-5.3 路由、辅助对话首发与续发、主列表不泄漏;模型回复使用回放。辅助对话 Recent 查所属主会话项目,命令仍发给 child。
+Server 启动时须设置开发态 `ZCODE_DYNAMIC_WORKFLOW_MODE=alwaysOn`,WDIO 为该独立文件设置相同前置;常驻 Server 不继承客户端环境。保持 manual-review pending,不据此声明手机 UI 或 Linux x64 实测;桌面 continuous / 手机 replayable 的身份和准入由协议回归覆盖。
+
 SAT30(远端子会话项目目录):`zcodeAgentService.v4.test.ts` 覆盖运行中/已完成、两种 clientMode、
 Agent 重启后的重订阅、旧 child 索引、无项目主任务及缺失/成环/跨 workspace 父链;
 CLI `v4-cold-resume.test.ts` 覆盖无独立 workspace identity 的 child 按持久化父链查询及拒绝分支,查询不激活 runtime。
@@ -3734,12 +3743,12 @@ R3A-UI-04 / RDUX-11-04 回归(2026-10-12 macOS 真实 SSH 1/1 PASS,仍 pendi
 
 场景、运行批次及未验证边界统一见[case 目录](../conversation-session-case-catalog.md#rdux-13-设置设备卡与更新accepted);保留原 pending/候选状态,不代表转正或 CI 准入。
 
-| 用例       | [见目录](../conversation-session-case-catalog.md#rdux-13-设置设备卡与更新accepted) | 证据入口                                                                                                        |
-| ---------- | ---------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
-| RDUX-13-01 | [见目录](../conversation-session-case-catalog.md#rdux-13-设置设备卡与更新accepted) | `manual-review/pending/conversation-session-remote-device-cards.test.ts`                                        |
-| RDUX-13-02 | [见目录](../conversation-session-case-catalog.md#rdux-13-设置设备卡与更新accepted) | 同上                                                                                                            |
-| RDUX-13-03 | [见目录](../conversation-session-case-catalog.md#rdux-13-设置设备卡与更新accepted) | 同上;480px 是桌面窄屏,手机不开放设备管理                                                                      |
-| RDUX-13-04 | [见目录](../conversation-session-case-catalog.md#rdux-13-设置设备卡与更新accepted) | `sourceServerUpdateNotifications`、`sourceServerUpdatePreferences`、`sourceServerManagementPanel` 组件/单元回归 |
+| 用例       | [见目录](../conversation-session-case-catalog.md#rdux-13-设置设备卡与更新accepted)                                                    | 证据入口                                                                                                        |
+| ---------- | ------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
+| RDUX-13-01 | [见目录](../conversation-session-case-catalog.md#rdux-13-设置设备卡与更新accepted);在线/离线最近项目在草稿缓存缺失或过期时保持项目身份、入口数且无创建弹窗 | `manual-review/pending/conversation-session-remote-device-cards.test.ts`                                        |
+| RDUX-13-02 | [见目录](../conversation-session-case-catalog.md#rdux-13-设置设备卡与更新accepted)                                                    | 同上                                                                                                            |
+| RDUX-13-03 | [见目录](../conversation-session-case-catalog.md#rdux-13-设置设备卡与更新accepted)                                                    | 同上;480px 是桌面窄屏,手机不开放设备管理                                                                      |
+| RDUX-13-04 | [见目录](../conversation-session-case-catalog.md#rdux-13-设置设备卡与更新accepted)                                                    | `sourceServerUpdateNotifications`、`sourceServerUpdatePreferences`、`sourceServerManagementPanel` 组件/单元回归 |
 
 ### 2026-09-30 评审修复回归证据
 
@@ -4268,3 +4277,11 @@ Linux Electron 重建后 run `desktop-e2e-20261014-120739-442`,TD01/03/04 1/1
 - Desktop:`packages/desktop/test/e2e/ui-shell/manual-review/pending/sidebar-tooltips.test.ts`,完整应用的项目行、分区、搜索/筛选、底部及文件树入口。
 
 验证(2026-10-16):浏览器 Tooltip 12 项及 SPT03 性能回归 4 项通过,包含桌面/手机布局、中英文、深浅主题、触屏点击和键盘 focus;新增分组操作断言复测通过。macOS 完整桌面 E2E 通过,12 个入口实测 304–309ms,覆盖相邻提示切换、提前移出、文件树菜单和清空搜索。受影响单测 285 文件 / 3671 项、typecheck、E2E typecheck、lint、架构及改动代码格式检查通过。候选保持 pending;未覆盖 Windows/Linux 整机或真实手机远控传输。
+
+## R3A-BLD-07:用户服务探测被跳过(2026-10-19)
+
+- Spec:`manual-review/pending/conversation-session-r3-daemon-detached.test.ts`,保持 pending,不自动转正。
+- Setup:独立 Linux SSH 目标无 user manager;首次正常 detached 连接后终止 daemon,再向 SSH 非交互 shell 注入 `SYSTEMD_OFFLINE=1`。
+- Action:确认真实 systemctl 探测退出 0 且属性响应为空,然后通过桌面设备行重连并续发任务。
+- Assertions:新 Supervisor/Core ready、`serviceRegistered=false`、Host 数不变、任务仍属原 workspace;恢复远端 shell 配置。
+- 验证(2026-10-19):macOS Desktop → Linux ARM64 SSH 定向回放 1/1 PASS,run `r3-server-zct-probe-fix2`;真实 systemd 正常注册、非交互环境恢复、offline/chroot 能力判断均通过。受影响单测 6 文件 / 62 项、typecheck、E2E typecheck、lint、架构与改动代码格式检查通过。候选保持 pending;未复现用户原设备,也未运行 Windows/Linux Desktop 或手机实机回归。

+ 7 - 0
docs/testing/plugin-management-lifecycle-e2e-coverage-matrix.md

@@ -221,4 +221,11 @@ React 面板等待连接后自动运行、无错误闪现和重复实例。2026-
 - 浏览器候选:`packages/ui/test/browser/manual-review/pending/plugin-concurrent-install.test.mjs`。真实 store 和安装按钮,390/1200px × 中英文 × 深浅主题共 8 组通过;旧实现 8 组均在第二次安装清掉第一次忙碌态处失败。日志和截图写入系统临时目录的 `zcode-plugin-concurrent-install/`。
 - 桌面候选:`plugins/manual-review/pending/plugin-concurrent-install.test.ts`。macOS Electron + 真实 CLI,个人来源本地 HTTP 下载响应门验证两项同时安装中、第一项失败不清理第二项、两项失败后均可重试;运行 `desktop-e2e-20261015143344848-p62610-27dafbf8f737df99` 通过。截图位于 `.e2e-artifacts/plugin-management/plm-concurrent-install/both-pending.png`。
 - 离线执行:`ZCODE_E2E_MANUAL_REVIEW=1 E2E_PROVIDER_HTTP_MODE=replay E2E_PROVIDER_REPLAY_FIXTURE_PATH=packages/desktop/test/e2e/fixtures/upstream/common.json pnpm --filter @zcode/desktop test:e2e -- --spec './test/e2e/plugins/manual-review/pending/plugin-concurrent-install.test.ts'`。
+- PLM-DETAIL-DURING-INSTALL:同一桌面用例中,A 下载被响应门挂起、B 排在 A 后面时打开本地插件详情,组件区 30 秒内渲染技能,返回后两项仍为安装中。修复后运行 `desktop-e2e-20261019044431890-p93406-b0458048236a975f` 通过,截图 `.e2e-artifacts/plugin-management/plm-detail-during-install/detail-loaded.png`;还原 CLI 修复后运行 `desktop-e2e-20261019044633752-p3203-b44c097feed8ea0d` 在组件区等待处失败。
+- 新建右侧标签页骨架屏(list/overview 排队):同一桌面用例在 A 下载挂起、B 排队时经桌面服务链路请求 `listPlugins` 与 `getPluginsOverview`,要求 10 秒内返回。修复后运行 `desktop-e2e-20261019062945458-p57938-d3a0c643c27817e2` 通过;只还原 transport 的 list/overview 立即派发后,运行 `desktop-e2e-20261019063058281-p64564-98a2c55f0e022488` 在该步失败(`plugins/list and plugins/overview waited for the install`)。现场证据:dev 日志 `listPlugins`/`getPluginsOverview` 耗时 14569 ms,在第二次安装结束 1.4 秒后才返回。
 - store 回归覆盖成功乱序、失败、同名操作及上下文切换隔离、来源校验与安装交叠。浏览器成功路径使用受控服务,不等于真实下载成功验证。手机真机/远控、Windows/Linux 未执行;用例 pending,未人工晋升及 CI 准入。
+
+## PLM-BUILTIN-UI-UNINSTALL:内置 UI 插件卸载后的分组
+
+- 桌面候选:`plugins/manual-review/pending/plugin-builtin-ui-uninstall.test.ts`。macOS Electron + 真实 CLI,卸载 `documents@zcode-plugins-official` 后卡片仍在 UI 插件专区。修复后运行 `desktop-e2e-20261019071852360-p65132-d5426628aee5a21e` 通过,截图 `.e2e-artifacts/plugin-management/plm-builtin-ui-uninstall/restorable-in-ui-section.png`;还原 CLI 修复后运行 `desktop-e2e-20261019072006864-p72979-1022c7e87a447a4e` 在 restorable 阶段失败(卡片不在 UI 插件专区)。
+- bootstrap 单测:内置定义 `ui` 组件类型与插件包 `ui.surfaces` 一致;卸载后官方目录与可恢复列表都带 `ui`。两条旧实现失败、新实现通过。Windows/Linux、手机远控未执行;用例 pending。

+ 2 - 2
docs/testing/r3-remote-automation-case-matrix.md

@@ -27,9 +27,9 @@
 | R3A-BLD-04 | P0        | 本地 descriptor/归档缺失、size/SHA 错误各独立 fixture             | UI 发起本地下载连接                           | 明确失败,不回退使用未知旧包;无新 ready attachment;旧安装保持可对账                                                                                     | E+I/UFL   |
 | R3A-BLD-05 | P1        | archive 内 ESM CLI 与真实依赖闭包                                 | 执行包内版本 probe、首装和重启                | 无 yazl require(fs) 启动崩溃;CLI/Core 可实际运行;builtin config 不污染 immutable release                                                                | I/PLF     |
 | R3A-BLD-06 | P1        | 目标不存在安装,或更新尚待确认                                    | UI 取消确认,再重新连接确认                   | 取消前无 release/service/Directory 提交;重试成功且无遗留 pending 会话                                                                                    | E/URPF    |
-| R3A-BLD-07 | P1        | 缺 user manager 的独立目标                                        | 安装、断开桌面、重启该容器后重连              | detached、serviceRegistered=false;普通断开不杀 daemon;环境重启后由 ensureDaemon 拉起                                                                    | E/UPRL    |
+| R3A-BLD-07 | P1        | 缺 user manager 的独立目标;重连前进入 systemd offline 环境       | 安装、断开桌面、终止 daemon 后重连            | detached、serviceRegistered=false;普通断开不杀 daemon;被跳过且返回 0 的探测不能误判可用;重连由 ensureDaemon 拉起新 daemon                              | E/UPRL    |
 | R3A-BLD-08 | P1        | E-SVC 可用 user bus;另有缺 XDG/DBUS 环境和真实注册失败 fixture   | 分别安装启动                                  | 成功注册为 true;按既有能力探测恢复环境;真实注册失败不以 detached 假成功                                                                                 | E+I/UPRL  |
-| R3A-BLD-09 | P1        | 隔离 /tmp noexec、缺 tar、缺进度工具、损坏 archive                | 分别执行安装                                  | staging 使用可执行 server root;tar 必需时早失败;仅进度降级;不破坏旧 current                                                                            | E+I/UPFL  |
+| R3A-BLD-09 | P1        | 隔离 /tmp noexec、缺 tar、缺进度工具、glibc<2.28、损坏 archive    | 分别执行安装                                  | staging 使用可执行 server root;tar 必需时早失败;glibc 过低在 probe 拒绝、不确认不上传;仅进度降级;不破坏旧 current                                     | E+I/UPFL  |
 | R3A-CON-01 | P0/S      | 解析 linux-amd64-dev 的有效 target;正确密码在受控环境            | UI 密码连接、选目录                           | 路径/RPC/identity 正确,一个 Window Host;敏感值不进 tab/日志                                                                                             | E/URPNL   |
 | R3A-CON-02 | P1        | 独立 sshd,无锁号影响                                             | 错误密码失败后改正确密码重试                  | 有可读错误,无可用 logical session/Agent;重试不沿用旧 credential                                                                                         | E/URPL    |
 | R3A-CON-03 | P1        | 控制代理让首连接停在 pending                                      | 停止连接后立即重试同 target                   | 旧请求取消,迟到成功不发布;新请求使用新关联 ID,Host 保持正确                                                                                            | E/URPN    |

+ 1 - 1
docs/testing/r3-remote-server-harness.md

@@ -295,7 +295,7 @@ Host / Agent 最大数量各为 1。RSS 首尾采样 1220 / 1211 MB;这只是
 | 10 Bot 远程 workspace        | 无容器                                     | BOT-E2E-RW-01(synthetic fixture 契约)                                                                                                                      |
 | 11 移动端                    | `a` + chromium + relay                     | mobile / mobile-permission                                                                                                                                   |
 | 12 soak                      | `a`                                        | soak-reconnect(10 轮) / soak-dual(10 分钟)                                                                                                                   |
-| 13 受限环境安装              | `d` / `e` / `f`                            | noexec-tmp / no-tar / no-forwarding                                                                                                                          |
+| 13 受限环境安装              | `d` / `e` / `f` / `g`                      | noexec-tmp / no-tar / no-forwarding / old-glibc(注入返回 `glibc 2.17` 的 getconf)                                                                          |
 | 14 live                      | `a`,docker transport 用 `dt`              | live-zapi / live-bigmodel-team / docker-transport                                                                                                            |
 
 覆盖门禁:`packages/desktop/scripts/r3-remote-spec-inventory.mjs` 是远程 spec 清单单点,

+ 84 - 3
docs/testing/side-pane-tabs-e2e-case-catalog.md

@@ -64,12 +64,12 @@
 ### SPT-E2E-007 插件面板的空态与新标签页双入口
 
 - Setup:真实 `AnimatedSidePanePanel`、插件发现 hook 与打开动作;fixture 通过 `activateNewTabSidePane` 和统一归属函数创建并激活标签。推荐名单收录两个 surface,另一个开发 surface 不推荐;覆盖 1200px/en-US/亮色与 390px/zh-CN/暗色。
-- Action:从空态 launcher 打开插件,再点击「+」创建 new-tab,从 active tabpanel 的 launcher 重复打开同一插件;新建另一个标签,使用 Tab/Enter 打开第二个插件。
+- Action:从首次展开的默认 new-tab launcher 打开插件,再点击「+」创建 new-tab,从 active tabpanel 的 launcher 重复打开同一插件;新建另一个标签,使用 Tab/Enter 打开第二个插件。
 - Assertions:两入口展示相同推荐与本地化标题;请求保留工作区/会话字段,重复打开复用 plugin tab;安装、启用后必须另点打开。草稿会话隐藏整个应用插件区及分隔线、查看所有插件入口;已有会话从默认空态或显式新标签页进入市场均可返回来源,默认空态返回后保持面板展开。无宿主、无 bridge 无插件项;推荐为空或配置失败显示空态;冷加载显示 skeleton。新标签页保持可见,窄屏无横向溢出。
-- 操作进度回归:控制安装/启用响应,确认只有目标插件显示加载,其他未安装、未启用与已启用插件保留原文案;列表在操作期间继续禁用。失败后恢复并切换另一插件重试,成功后清除进度且不自动打开。覆盖空态与新标签页、桌面亮色英文与手机暗色中文。
+- 操作进度回归:控制安装/启用响应,确认只有目标插件显示加载并禁用,其他插件保留原文案与可点击状态。连续提交两个不同插件安装,各自保留进度;一个失败或成功只清理自身,已启用插件仍可打开。同一插件重复点击只提交一次,失败可重试,成功不自动打开。覆盖空态与新标签页、桌面亮色英文与手机暗色中文。
 - 加载图标回归:等待响应期间,目标入口显示可见的旋转图标与 `aria-busy`;成功或失败后全部清除。同一插件的两个 surface 同步显示进度,其他插件无进度;减少动画偏好下图标保留但不旋转。
 - 边界:服务由浏览器 fixture 注入,在 plugin tab owner 边界检查请求,不启动沙箱、Agent 或真实手机远控。
-- 当前验证:2026-10-15 自动浏览器 E2E 12/12 通过,包含 8 组操作进度与加载图标回归,以及同插件多 surface / 减少动画偏好用例;仍为 manual-review/pending,不代表插件沙箱或真实手机远控验证。
+- 当前验证:2026-10-19 自动浏览器 E2E 16/16 通过,含 4 组并发安装与操作互不阻塞、8 组操作进度,以及同插件多 surface / 减少动画偏好回归。夹具按当前面板 owner 初始化默认 new-tab;仍为 manual-review/pending,不代表真实 Agent 安装、插件沙箱或手机远控验证。
 
 ### SPT-E2E-008 对话隔离的关闭与恢复(manual-review/pending)
 
@@ -107,3 +107,84 @@
 - 范围:桌面交互及共享 UI 状态,跨 scope 和异步关闭由 hook 回归补充。
 
 SPT-E2E-009 补充:末标签关闭后面板收起且无补建;重新展开创建新标签页。真实关闭菜单命令关闭唯一新标签页后,下一次关闭上下文事件不被 App 拦截,可进入关窗 fallback。
+
+## 完整视图(SPFV,spec:`docs/ui/side-pane-full-view.md`)
+
+### 状态维度与剪枝
+
+| 维度     | 等价类                               | 决策                                                                 |
+| -------- | ------------------------------------ | -------------------------------------------------------------------- |
+| 入口     | 按钮 / 快捷键                        | 两者都覆盖进入与退出                                                 |
+| surface  | 对话 tab / 面板 tab / 无可见面板 tab | 前两类覆盖;无可见 tab 时启动页由组件逻辑承接,不单独覆盖            |
+| 浮窗形态 | 收起 / 收起 + 操作栏 / 展开 / 最小化 | 全部覆盖                                                             |
+| 退出方式 | 按钮 / 快捷键 / ◫ / 关闭最后一个 tab | 前三类覆盖;关闭最后一个 tab 复用既有收起逻辑,由 owner 记忆单测覆盖 |
+| owner    | 同 session 切回 / 不同 session       | 由 provider 用例覆盖                                                 |
+| 阻塞交互 | 收起态出现 / 最小化时出现            | 最小化时出现覆盖(同时证明卡片在浮窗内)                             |
+| 客户端   | 桌面 / Web / 手机远控                | 只做桌面;Web 与远控不渲染入口,由组件条件单测覆盖                   |
+
+### SPFV-E2E-001 进入、退出与单实例
+
+- Setup:桌面草稿,打开 Side Pane 并新建一个 Terminal tab;给主 SessionPane 根节点打上 DOM 标记。
+- Action:点「进入完整视图」;再用快捷键退出;再点按钮进入。
+- Assertions:完整视图中左侧任务列表宽度不变、左上角按钮组仍在、WorkspaceHeader 不存在、Side Pane 外框宽度接近 `#content` 宽度;tab 栏第一个为对话 tab,且计算样式 `-webkit-app-region` 为 `no-drag`(真实鼠标可点击);退出后侧栏和面板宽度回到进入前;全过程 SessionPane 根节点仍带同一 DOM 标记(未重新挂载)。
+
+### SPFV-E2E-002 对话 tab 全宽与面板 tab 浮窗
+
+- Setup:接 001,完整视图中当前为 Terminal tab。
+- Action:点对话 tab;再点 Terminal tab。
+- Assertions:对话 tab 激活时对话宿主覆盖 slot(误差 2px 内),浮窗不存在,输入框为两行布局(`data-composer-layout=stacked`)且有草稿项目栏;回到 Terminal tab 后浮窗出现在 slot 右下角(距边 16px),只露出输入区:输入区与浮窗同宽、底边对齐,没有外层留白,抽屉不可见;输入框为单行(`data-composer-layout=inline`,浮窗高度不超过 64px,「+」、输入区、发送按钮从左到右排在同一行、垂直居中误差 2px 内,输入区至少占一半宽度),没有草稿项目栏;切换前打在输入框节点上的 DOM 标记仍在(编辑器未重新挂载)。
+
+### SPFV-E2E-003 操作栏、最小化与恢复
+
+- Setup:接 002,浮窗收起态。
+- Action:点击浮窗输入框并输入文字;点击面板空白处;再聚焦输入框后点「−」;点击圆形按钮。
+- Assertions:输入框有焦点时抽屉滑出、操作栏可见且不含标题(空闲时也没有 loading),抽屉一直延伸到输入框底边(底边误差 1.5px 内,两侧没有凹口);失焦后隐藏;「−」后只剩圆形按钮;点击后恢复收起态并且输入框获得焦点、文字仍在;切到对话 tab 后主输入框显示同一段文字。
+
+### SPFV-E2E-004 拖动吸附与菜单
+
+- Setup:接 003,浮窗收起态。
+- Action:拖动 ⠿ 到 slot 左上区域松手;点击 ⠿ 打开菜单,选「在完整视图中打开」。
+- Assertions:松手后浮窗贴 slot 左上(16px);全局偏好 `zcode:side-pane-full-view:floating-anchor` 写为 `top-left`;菜单项选择后切到对话 tab,且浮窗展开态不被菜单点击改变(回归:portal 事件沿 React 树冒泡)。
+
+### SPFV-MODEL-001 浮窗模型菜单关闭(pending)
+
+- Setup:完整视图浮窗,背后为独立插件页面;有两个可用模型及一个锁定模型。
+- Action:打开模型菜单后点击插件区域;再次打开并选择模型(包括当前模型和键盘确认),再点击外侧关闭;调档和切换 Provider;Escape 关闭。
+- Assertions:一次外侧点击关闭菜单,且不触发底层插件操作;可用模型被选择后选择生效、菜单保持打开,锁定模型不关闭;调档与 Provider 导航保持打开;选模型后仍可点击外侧一次关闭,关闭后插件仍可交互。桌面 Electron 使用真实 webview,浏览器手机宽度使用独立 iframe,覆盖深浅主题。
+- 候选自动化:`packages/ui/test/browser/manual-review/pending/composer-menu-dismiss.test.mjs`;配合既有 `ui-shell/side-pane-full-view.test.ts` 验证完整 App 的浮窗行为。组件级夹具不覆盖插件安装、Agent 握手和远控连接。
+
+### SPFV-E2E-005 展开与收起消息流
+
+- Setup:浮窗收起 + 操作栏。
+- Action:点「⌃」按钮;再点「⌄」按钮。
+- Assertions:展开后浮窗高度大于 400px 且时间线可见,按钮 `aria-expanded=true`;消息滚动容器底边在输入区顶边之上至少 8px(滚动条不延伸到输入框后面);再点回到收起态。
+
+### SPFV-E2E-009 插件页面层不被面板外框遮挡
+
+- Setup:接 005,完整视图浮窗形态,当前为 Terminal tab。
+- Action:按 `pluginUiPagePlane` 的同一套样式,在 `body` 末尾的停靠层(`[data-sandbox-page-parking]`,`position:fixed; inset:0`,无 z-index)放入一个 `position:fixed; z-index:10`、覆盖 slot 的页面节点;在 slot 右下区域取 `elementFromPoint`。
+- Assertions:命中该页面节点,不是面板外框内的元素(回归:外框 `z-10` 遮住插件 UI,插件 tab 空白)。
+
+### SPFV-E2E-006 面板开关退出
+
+- Setup:完整视图。
+- Action:点面板开关 ◫;再点 WorkspaceHeader 上的面板开关重新打开。
+- Assertions:关闭后回到普通布局;重新打开后仍是普通视图(不回到完整视图)。
+
+### SPFV-E2E-007 浮窗发送与按 session 记忆(provider)
+
+- Setup:已有会话 A(首条消息完成),打开 Terminal tab,进入完整视图。
+- Action:在浮窗输入框发送一条消息;完整视图下用命令面板(⌘K → New task)新建草稿;在左侧任务列表切回 A。
+- Assertions:消息出现在 A 的时间线并收到回复;回答结束后浮窗上方弹出回答气泡,只含回答正文(无图标、无标题);草稿为普通视图;切回 A 后恢复完整视图与浮窗,气泡仍在(只有 × 或点击才消失);点气泡后浮窗展开、气泡消失,收起后不再出现(回归:切换会话不出现 React #185,面板不停在收起态)。
+
+### SPFV-E2E-008 最小化时出现 AskUserQuestion(provider)
+
+- Setup:接 007,会话 A 在完整视图,当前为 Terminal tab。
+- Action:在浮窗发送触发 AskUserQuestion 的提示(回放延迟 4s),用户消息出现后立即最小化,等待问答请求。
+- Assertions:用户消息出现后(问答请求到达前,对话运行中)操作栏「⌃ / ⌄」右侧显示 loading,输入框占位文字为「工作中 N 秒」/ `Working for …`,与流式消息最后一行运行时长文本完全相同;浮窗自动恢复为收起态,问答卡片显示在浮窗内;提交回答后卡片消失、输入框恢复;回答结束弹出新气泡(`spfv-ask-done`),点 × 后气泡消失、浮窗保持收起;对话空闲后聚焦浮窗,操作栏可见但没有 loading。
+
+### 不变量
+
+- 完整视图切换不得重新挂载 SessionPane,不得写入面板占比或侧栏宽度持久化。
+- 浮窗与对话 tab 共用同一份草稿。
+- 面板 tab 的 webview / 终端实例在 surface 切换时保持挂载。

+ 24 - 0
docs/testing/side-pane-tabs-e2e-coverage-matrix.md

@@ -15,6 +15,8 @@
 
 - 2026-10-12 rebase 回归:保留侧栏 scope 修复,网页权限沿用当前基线;E2E 改用当前 `activeTaskId` 对话选择接口、通用会话准备和无账号启动,页面 fixture 只提供两个本地站点。macOS Electron SPT-E2E-008 1/1 通过(`desktop-e2e-20261012032035626-p33390-08ac35a2e03ad569`);受影响单测、根/E2E typecheck、lint、architecture check 通过。补齐插件侧栏的 parentSessionId 归属断言,仍保持 manual-review/pending;未新增 Windows/Linux 或手机实机验证。
 
+- 2026-10-19 SPT-E2E-007 并发安装回归:推荐区删除独立全局锁,与市场共用管理 store 的按插件忙碌判定。浏览器 16/16 通过,覆盖两个不同插件同时待处理、后一次失败不清理前一次、安装中打开其他已启用插件,以及原有重复点击、同插件双 surface、启用、失败恢复和减少动画偏好;1200px/英文/Zai Light 与 390px/中文/Zai Dark,默认新标签页和主动新增标签页均覆盖。Hook 定向 8/8 通过,含服务切换后旧操作完成隔离;最终 affected 90 个文件、1379 条通过。根 typecheck、architecture 和变更文件格式检查通过;lint 无错误,188 条警告与原基线一致。夹具按当前面板 owner 初始化默认 new-tab,避免旧空面板状态不再挂载入口。服务仍由 fixture 注入,未启动真实 Agent/沙箱或手机远控,保留 pending。
+
 - SPT-E2E-007:`packages/ui/test/browser/manual-review/pending/side-pane-plugin-menu.test.mjs`,空态 launcher + active new-tab launcher 使用真实 reducer 创建标签,覆盖鼠标、Tab/Enter、作用域与重复打开、安装/启用、草稿/无宿主门禁及冷加载;1200px/en-US/亮色与 390px/zh-CN/暗色。2026-10-14 自动浏览器 E2E 11/11 通过,其中 8 组以可控响应验证安装/启用进度仅归属目标插件、其他插件保留原文案、全局禁用、失败后换插件重试及成功后不自动打开。仍为 pending,未提升 CI admission,未声明插件沙箱或真实手机远控覆盖。
 - Logo 样式迁移:SPT-E2E-000 在 Windows/Linux 验证旧 28px 点击区域及位置、18px 底座、11px 静态 SVG、真实 hover 和点击收起/恢复 Sidebar。Windows 实测通过:`desktop-e2e-20261009065750634-p17396-21ed3ac7f4753068`,1/1;Linux 真机待补,平台条件由组件测试覆盖。
 
@@ -61,3 +63,25 @@
 - macOS Electron 本轮 9 通过、1 平台条件跳过(Windows 菜单),含 SPT-E2E-009 与 SPT-E2E-000 深浅主题截图;run `desktop-e2e-20261016082511861-p45212-c004286dcc3d9c01`。手机实机、Windows/Linux 真机和卡顿归因未验证。
 
 2026-10-16 评审修复:SPT-E2E-009 定向通过(1/1),run `desktop-e2e-20261016-091135-357`。覆盖末标签关闭收起、再次展开补建、真实关闭菜单命令,以及后续关闭上下文事件不被 App 拦截;测试未实际关闭宿主窗口。受影响单测 79 文件、1320 条通过。此前整文件运行其余 8 条通过、1 条平台跳过;009 的菜单回调和动画等待问题在上述定向重跑中修正。手机实机、Windows/Linux 真机未新增验证。
+
+## 完整视图(SPFV,2026-10-16)
+
+| Case ID      | 入口/退出     | surface      | 浮窗形态               | 拖动吸附 | owner 记忆 | 阻塞交互 | Spec                                                                    |
+| ------------ | ------------- | ------------ | ---------------------- | -------- | ---------- | -------- | ----------------------------------------------------------------------- |
+| SPFV-E2E-001 | 按钮 + 快捷键 | n/a          | n/a                    | n/a      | n/a        | n/a      | `ui-shell/side-pane-full-view.test.ts`                                  |
+| SPFV-E2E-002 | n/a           | 对话 / 面板  | 收起(单行)           | n/a      | n/a        | n/a      | `ui-shell/side-pane-full-view.test.ts`                                  |
+| SPFV-E2E-003 | n/a           | 对话 / 面板  | 收起 + 操作栏 / 最小化 | n/a      | n/a        | n/a      | `ui-shell/side-pane-full-view.test.ts`                                  |
+| SPFV-E2E-004 | n/a           | 菜单切到对话 | 收起                   | 左上     | n/a        | n/a      | `ui-shell/side-pane-full-view.test.ts`                                  |
+| SPFV-E2E-005 | n/a           | 面板         | 展开 / 收起            | n/a      | n/a        | n/a      | `ui-shell/side-pane-full-view.test.ts`                                  |
+| SPFV-E2E-006 | ◫ 退出        | n/a          | n/a                    | n/a      | n/a        | n/a      | `ui-shell/side-pane-full-view.test.ts`                                  |
+| SPFV-E2E-009 | n/a           | 面板         | 收起                   | n/a      | n/a        | n/a      | `ui-shell/side-pane-full-view.test.ts`                                  |
+| SPFV-E2E-007 | 按钮          | 面板         | 收起(发送)           | n/a      | covered    | n/a      | `conversation-session/conversation-session-side-pane-full-view.test.ts` |
+| SPFV-E2E-008 | n/a           | 面板         | 最小化 → 自动恢复      | n/a      | n/a        | covered  | `conversation-session/conversation-session-side-pane-full-view.test.ts` |
+
+- 2026-10-16 macOS Electron:ui-shell 6/6(`desktop-e2e-20261016132641383-p65282-482172e91cde062d`);provider 2/2(`desktop-e2e-20261016132902337-p68218-55a5106a8275c319`,replay `common.json` + case fixture);SPT 回归 8/8。ui-shell 用例存了深浅主题截图(展开、收起 + 操作栏、最小化)。仍为 manual-review/pending,未加入 Docker preset;Windows/Linux 未执行。
+- 运行时定位记录:选菜单项曾因 portal 事件沿 React 树冒泡切换展开态(004 回归断言);用 CSS 压缩对话列 flex 会让 react-resizable-panels 的 group 尺寸为 0、展开 resize 得到 NaN(007 切回会话覆盖);controller 引用不稳定会让 memo 的 WorkspaceShellLayout 在切换会话时出现 React #185(单测 + 007 覆盖)。
+- 2026-10-16 第二轮(保留侧栏、抽屉、单行输入框、loading、恢复动画、滚动条、插件层)macOS Electron:ui-shell 7/7(`desktop-e2e-20261016152650322-p89798-2c5c15bc8942f302`,含深浅主题截图);provider 2/2(`desktop-e2e-20261016152827854-p91091-9383fec55304cbe0`);SPT 回归 8/8。仍为 manual-review/pending;Windows/Linux 未执行。
+- 第二轮运行时定位记录:恢复动画逐帧采样显示浮窗宽 48px 时单行输入框折行到 258px,随宽度变大回落到 46px(003 断言每帧高度不超过最终值);插件 UI 空白由外框 `z-10` 盖住 body 级停靠层造成,009 在旧构建上命中 `browser`、改为 `z-0` 后命中插件页面;004 的偶发失败是测试在宿主几何过渡中读坐标,改为等待宿主 `getAnimations()` 结束。
+- 2026-10-17 转正(用户确认 review):ui-shell 移到 `ui-shell/side-pane-full-view.test.ts`;provider 用例经 `e2e:promote --reviewed --apply` 移到 `conversation-session/conversation-session-side-pane-full-view.test.ts`,`audit:conversation-session-coverage` 通过,正式路径 `e2e:fixture:check` 通过。新增断言:运行中占位「工作中 N 秒」与流式消息同值(008)、回答气泡弹出 / 切回仍在 / 点击展开 / × 关闭(007、008)。macOS Electron 正式路径:provider 显式回放 2/2(`desktop-e2e-20261016172121606-p45655-10a0c044cbc26349`)、默认回放 2/2、ui-shell 7/7、SPT 8/8。Docker 隔离运行与 preset 准入未执行(本机 Docker daemon 未启动);Windows/Linux 未执行。
+- 转正时的运行时定位:正式回放下回答很快,整轮在一次渲染批次里结束,`data-running` 从未为 true;气泡改为「基线之后出现的已结束回合才弹出」,不再要求观察到运行中。
+- provider 用例需要 case-local 的标题与 compact 响应:manual-review 小上下文窗口每轮都会自动 compact,compact 失败会退避重试并把后续输入留在队列。

+ 1 - 1
docs/testing/unit-test-review/ui-tail.jsonl

@@ -50,7 +50,7 @@
 {"path":"packages/ui/test/workspaceCatalogContextStores.test.ts","sha256":"7f46cccb3338c89c553af8f6c449fba17668bebf96121bc8b48ca19961200998","linesRead":67,"decision":"keep","behaviorGroups":["All67 lines full agent and service builders. Concurrent samepath twoSSHidentity initialize produce independently differenthostnames under actual keyA/keyB with2servicecalls; no fake selfcomparison."],"implementationPaths":["packages/ui/src/store/subagentsContextStore.ts"],"reason":"Keep genuine per-identity concurrency isolation and actual store outputs.","removeCases":[],"removeAssertions":[],"retainedEvidence":[],"renameCases":[],"cleanup":[],"batch":"048","applied":false,"finalSha256":"7f46cccb3338c89c553af8f6c449fba17668bebf96121bc8b48ca19961200998"}
 {"path":"packages/ui/test/workspaceConnectionRegistry.test.ts","sha256":"7be26a03fd32ee371a062079fd7776459155815b44e461798feb21639a875078","linesRead":598,"decision":"keep","behaviorGroups":["All598 lines full mocked service/hello/snapshot/schema shapes and replacingservices emitting actual wireframes. Keyendpoint+identity, samekey layer/transport reuse+one listener, keepwarm boundary-1/revival/cancel/expiry, idempotentrelease andendpointisolated.","Real remote servicegeneration: shared leases remain valid, commands old→new after explicitcommit activation, oldservice untouched afterswitch. Both continuous/replayable existingstore restore exactnew snapshot and baseepoch/seq, oneoldunsubscribe/newsubscribe.","Three-generation staleconsumer cannot revert latest, oldpending subscribe and oldpending unsubscribe do not block replacement. Localkeepwarm servicechange disposes oldlayer andregistry cleanup. All actualawait checkpoints retained."],"implementationPaths":["packages/ui/src/v4/workspaceConnectionRegistry.ts","packages/ui/src/v4/replaceableConversationTransport.ts"],"reason":"Keep full owner/refcount/commit/recovery matrix; alias equality alone cannot prove shared data did not mutate and does not replace snapshot or command observations.","removeCases":[],"removeAssertions":[],"retainedEvidence":[],"renameCases":[],"cleanup":[],"batch":"048","applied":false,"finalSha256":"7be26a03fd32ee371a062079fd7776459155815b44e461798feb21639a875078"}
 {"path":"packages/ui/test/workspaceContextPath.test.ts","sha256":"a21e2f592974e58310144dc1d2a1cae20aa5027a46644be24200f4b7854b23d1","linesRead":20,"decision":"keep","behaviorGroups":["All20 lines suppliedhosthome exact/descendant abbreviation and prefixcollision preservation; missinghome keepsremote path; Windows separators normalized."],"implementationPaths":["packages/ui/src/WorkspaceHeaderSections/workspaceContextPathFormat.ts"],"reason":"Keep concrete path delimiter/home authority/platform boundaries.","removeCases":[],"removeAssertions":[],"retainedEvidence":[],"renameCases":[],"cleanup":[],"batch":"048","applied":false,"finalSha256":"a21e2f592974e58310144dc1d2a1cae20aa5027a46644be24200f4b7854b23d1"}
-{"path":"packages/ui/test/workspaceDraftProvider.test.ts","sha256":"5db6a9fcfb6aee1fab7092f8751fd2d8646bff64b2cb4f699d88ee5f26b621c1","linesRead":27,"decision":"keep","behaviorGroups":["All 27 lines cover the target default-state fixture. An existing workspace keeps its remembered provider instead of the current selection; a new workspace inherits the current provider."],"implementationPaths":["packages/ui/src/lib/workspaceDraftProvider.ts"],"reason":"Keep actual targetworkspace selection priority; these current helper outputs are distinct rawprovider values, no constant normalization in this function.","removeCases":[],"removeAssertions":[],"retainedEvidence":[],"renameCases":[],"cleanup":[],"batch":"048","applied":false,"finalSha256":"5db6a9fcfb6aee1fab7092f8751fd2d8646bff64b2cb4f699d88ee5f26b621c1"}
+{"path":"packages/ui/test/workspaceDraftProvider.test.ts","sha256":"5db6a9fcfb6aee1fab7092f8751fd2d8646bff64b2cb4f699d88ee5f26b621c1","linesRead":27,"decision":"keep","behaviorGroups":["All 27 lines target the default state fixture. An existing workspace keeps its remembered provider; a new workspace inherits the current provider."],"implementationPaths":["packages/ui/src/lib/workspaceDraftProvider.ts"],"reason":"Keep actual targetworkspace selection priority; these current helper outputs are distinct rawprovider values, no constant normalization in this function.","removeCases":[],"removeAssertions":[],"retainedEvidence":[],"renameCases":[],"cleanup":[],"batch":"048","applied":false,"finalSha256":"5db6a9fcfb6aee1fab7092f8751fd2d8646bff64b2cb4f699d88ee5f26b621c1"}
 {"path":"packages/ui/test/workspaceDragOverlay.test.ts","sha256":"533390a6f42879d209929895b5230fc7f4c81c7bad8daa0e183636b0d4395408","linesRead":53,"decision":"keep","behaviorGroups":["All53 lines realSSR renderer andsource-display hook fixture. Remote canonicalsourceID displays actualdevice+project, local hidesdevice marker; legacySSH explicitprojectedrenameddisplay overrideslegacytarget."],"implementationPaths":["packages/ui/src/project-sidebar/WorkspaceDragOverlay.tsx"],"reason":"Keep distinct remote-source/legacy/local display authority; staticSSR here exercises current selection branches.","removeCases":[],"removeAssertions":[],"retainedEvidence":[],"renameCases":[],"cleanup":[],"batch":"048","applied":false,"finalSha256":"533390a6f42879d209929895b5230fc7f4c81c7bad8daa0e183636b0d4395408"}
 {"path":"packages/ui/test/workspaceEditorSelection.test.ts","sha256":"da392cfa612932f4a2f8b1dde0feba8293fcaeadb4df7a8675f42ed481619b6a","linesRead":102,"decision":"keep","behaviorGroups":["All102 lines complete editorfactory. SSH remoteVSCodefallback mustnotpersist localcursor preference, local keepscursor; WSLvscode+explorer orderedfallback, Docker empty; onlyWSLcanExplorerfilemanager, SSH/Docker null."],"implementationPaths":["packages/ui/src/lib/workspaceEditorSelection.ts"],"reason":"Keep real filtering, platform mapping and preference persistence rules.","removeCases":[],"removeAssertions":[],"retainedEvidence":[],"renameCases":[],"cleanup":[],"batch":"048","applied":false,"finalSha256":"da392cfa612932f4a2f8b1dde0feba8293fcaeadb4df7a8675f42ed481619b6a"}
 {"path":"packages/ui/test/workspaceFileDrag.test.ts","sha256":"998cbeee3f2fd40ff3ef38e47ec85e4e678bf1575ab5af6593994b13eb89face","linesRead":167,"decision":"keep","behaviorGroups":["All167 lines file/directory completepayload roundtrip, malformedJSON/incomplete/unknownkind refusal; DataTransfertypes beforedatareadable. Actual CustomEvent sequence [true,false], sameworkspace relative versus foreignabsolute mentions; composer realappend args/data/focus andtextcallback."],"implementationPaths":["packages/ui/src/lib/workspaceFileDrag.ts","packages/ui/src/lib/workspaceFileComposer.ts"],"reason":"Keep IO-free wire parsing/event/identity/routing behavior with real consumers; no same-reference assumptions.","removeCases":[],"removeAssertions":[],"retainedEvidence":[],"renameCases":[],"cleanup":[],"batch":"048","applied":false,"finalSha256":"998cbeee3f2fd40ff3ef38e47ec85e4e678bf1575ab5af6593994b13eb89face"}

+ 15 - 14
docs/testing/workspace-file-tree-e2e-coverage.md

@@ -2,25 +2,26 @@
 
 ## Accepted Cases
 
-| Case | Spec | User issue covered | Assertions |
-| --- | --- | --- | --- |
-| `workspace-file-tree-refresh` | `packages/desktop/test/e2e/workspace-file-tree-refresh.test.ts` | 1. ZCode 重命名文件后,刷新文件树仍显示旧路径;3. 点击刷新文件树按钮文件没有刷新出来 | 子目录展开加载后先折叠,真实文件系统重命名文件,再点击刷新并重新展开;文件树显示新路径、旧路径消失,并且新文件可以打开预览。 |
-| `workspace-file-tree-refresh` | `packages/desktop/test/e2e/workspace-file-tree-refresh.test.ts` | 2. 展开目录新增文件后文件树不实时更新,必须重启 ZCode | 在真实 workspace 文件系统中向当前展开目录新增文件,等待 `fs.watch` 链路触发后文件树自动出现新文件。 |
-| `workspace-file-tree-compact-hierarchy` | `packages/desktop/test/e2e/workspace-file-tree/workspace-file-tree-compact-hierarchy.test.ts` | 多层空目录压缩后,后代目录与内容不缩进,后代目录也不吸顶 | 使用真实 workspace 文件构造两级 compact folders;展开后断言后代每层增加 `12px`、层级引导线 depth 正确,滚动后父级与后代目录都进入无额外间隙的 sticky folders。 |
-| `workspace-file-tree-shared-search` | `packages/desktop/test/e2e/workspace-file-tree/workspace-file-tree-shared-search.test.ts` | 左侧文件树搜索深层 Java / workspace 文件时,经常搜不到 `@` 能引用的文件 | 构造未展开的深层源码文件,左侧文件树输入类名或相对路径可命中;搜索态与 `@` 使用同一 `listWorkspaceFiles` 候选和 fuzzy 排序,点击文件打开 `PreviewPane`,不会向 Composer 插入 mention。 |
+| Case                                               | Spec                                                                                          | User issue covered                                                                   | Assertions                                                                                                                                                                             |
+| -------------------------------------------------- | --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `workspace-file-tree-refresh`                      | `packages/desktop/test/e2e/workspace-file-tree-refresh.test.ts`                               | 1. ZCode 重命名文件后,刷新文件树仍显示旧路径;3. 点击刷新文件树按钮文件没有刷新出来 | 子目录展开加载后先折叠,真实文件系统重命名文件,再点击刷新并重新展开;文件树显示新路径、旧路径消失,并且新文件可以打开预览。                                                           |
+| `workspace-file-tree-refresh`                      | `packages/desktop/test/e2e/workspace-file-tree-refresh.test.ts`                               | 2. 展开目录新增文件后文件树不实时更新,必须重启 ZCode                                | 在真实 workspace 文件系统中向当前展开目录新增文件,等待 `fs.watch` 链路触发后文件树自动出现新文件。                                                                                    |
+| `workspace-file-tree-compact-hierarchy`            | `packages/desktop/test/e2e/workspace-file-tree/workspace-file-tree-compact-hierarchy.test.ts` | 多层空目录压缩后,后代目录与内容不缩进,后代目录也不吸顶                             | 使用真实 workspace 文件构造两级 compact folders;展开后断言后代每层增加 `12px`、层级引导线 depth 正确,滚动后父级与后代目录都进入无额外间隙的 sticky folders。                         |
+| `workspace-file-tree-shared-search`                | `packages/desktop/test/e2e/workspace-file-tree/workspace-file-tree-shared-search.test.ts`     | 左侧文件树搜索深层 Java / workspace 文件时,经常搜不到 `@` 能引用的文件              | 构造未展开的深层源码文件,左侧文件树输入类名或相对路径可命中;搜索态与 `@` 使用同一 `listWorkspaceFiles` 候选和 fuzzy 排序,点击文件打开 `PreviewPane`,不会向 Composer 插入 mention。 |
+| `workspace-file-tree-navigation-visibility-memory` | `packages/desktop/test/e2e/workspace-file-tree/workspace-file-tree-shared-search.test.ts`     | 用户显式收起文件导航后,打开其他文件或重启 App 又自动展开                            | 在同一 workspace 打开文件 A 并收起目录,通过命令中心打开文件 B 后仍保持收起;完整重启 Electron 并再次打开文件后继续恢复该 workspace 的收起偏好。                                       |
 
 - MR !2897 / CR-01:打开、关闭并等待退场完成后,文件面板业务内容必须卸载;再次打开重新加载。减少动态效果路径立即卸载。目录 watcher 释放及未触发的 debounce 取消由数据层单测核对。
 
 ## Coverage Decisions
 
-| Decision | Status | Reason |
-| --- | --- | --- |
-| 本地 desktop + 多段 compact folders + 展开 + 向下滚动 | accepted | 同时覆盖物理 depth、展示 offset、虚拟滚动和 sticky ancestor 选择,是本次回归的最小完整链路。 |
-| 普通目录(不发生 compact) | pruned | 现有文件树展开路径和 helper/unit 覆盖普通 depth;不能证明本次 compact offset 回归。 |
-| Zai Light / Zai Dark 分别执行 | pruned | 引导线与缩进共用同一 DOM 和设计 token,本 case 断言结构与几何,不做主题像素截图。 |
-| Web / 手机 Web 重复执行 | pruned | `WorkspaceFileTreeRowView` 为共享渲染实现;本 case 不涉及平台服务、remote delivery 或触控专属行为。 |
-| SSH / WSL / Docker workspace | pruned | 本次缺陷位于 renderer 展示 depth;远端文件读取和 `workspaceIdentity` 隔离不在该 case 的行为边界内。 |
-| 完整默认过滤器矩阵 | pruned | `.git`、`node_modules`、`.env`、隐藏目录后代和编译产物过滤由 service 单测与文件搜索过滤 E2E 覆盖;文件树共享搜索 case 只证明它复用同一索引和排序,不复制黑名单断言。 |
+| Decision                                              | Status   | Reason                                                                                                                                                               |
+| ----------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| 本地 desktop + 多段 compact folders + 展开 + 向下滚动 | accepted | 同时覆盖物理 depth、展示 offset、虚拟滚动和 sticky ancestor 选择,是本次回归的最小完整链路。                                                                         |
+| 普通目录(不发生 compact)                            | pruned   | 现有文件树展开路径和 helper/unit 覆盖普通 depth;不能证明本次 compact offset 回归。                                                                                  |
+| Zai Light / Zai Dark 分别执行                         | pruned   | 引导线与缩进共用同一 DOM 和设计 token,本 case 断言结构与几何,不做主题像素截图。                                                                                    |
+| Web / 手机 Web 重复执行                               | pruned   | `WorkspaceFileTreeRowView` 为共享渲染实现;本 case 不涉及平台服务、remote delivery 或触控专属行为。                                                                  |
+| SSH / WSL / Docker workspace                          | pruned   | 本次缺陷位于 renderer 展示 depth;远端文件读取和 `workspaceIdentity` 隔离不在该 case 的行为边界内。                                                                  |
+| 完整默认过滤器矩阵                                    | pruned   | `.git`、`node_modules`、`.env`、隐藏目录后代和编译产物过滤由 service 单测与文件搜索过滤 E2E 覆盖;文件树共享搜索 case 只证明它复用同一索引和排序,不复制黑名单断言。 |
 
 ## Out Of Scope
 

+ 33 - 16
docs/tmpdir-storage-paths-spec.md

@@ -6,31 +6,48 @@
 
 ## 目标
 
-- 产品运行时不再把可控的 ZCode 临时/持久化文件写入系统 `TMPDIR`。
-- 新路径统一落在 ZCode 数据根目录下,默认是 `~/.zcode`。
-- 不迁移、不读取、不兼容旧 `TMPDIR` 残留数据。
+- 除下述 Bash 输出例外外,可控的 ZCode 临时/持久化文件落在数据根目录下,默认是 `~/.zcode`。
+- Bash 输出优先使用系统临时目录,目录不可用时复用数据根下的原有输出实现。
+- 不迁移历史文件,不额外扫描旧 `TMPDIR` 布局;已有输出引用仍沿用实际路径读取。
 - 本次不修改 remote asset fallback,也不修改官方 iOS / Android 模拟器插件路径。
 
 ## 路径规范
 
-| 场景                      | 新路径                          | 生命周期                         |
-| ------------------------- | ------------------------------- | -------------------------------- |
-| zcode-cli Bash 持久化输出 | `~/.zcode/cli/exec`             | 按 session/task 输出保留         |
-| zcode-cli 剪贴板图片      | `~/.zcode/clipboard`            | 单次读取后删除                   |
-| 日志导出 staging          | `~/.zcode/export-log-stage`     | 打包完成后删除,异常退出允许残留 |
-| 日志导出结果              | `~/.zcode/export-log`           | 用户可见导出结果,默认保留       |
-| feedback 附件和日志包     | `~/.zcode/feedback`             | 上传完成后删除                   |
-| Git checkpoint 临时 index | `~/.zcode/git-checkpoint-index` | checkpoint 构建完成后删除        |
-| Desktop 编辑器图标转换    | `~/.zcode/editor-icon`          | 单次转换后删除                   |
+| 场景                      | 新路径                                                                                             | 生命周期                                       |
+| ------------------------- | -------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
+| zcode-cli Bash 持久化输出 | `<os.tmpdir()>/zcode-bash-<随机标识>/<session>/<tool>-stdout.log`;降级到 `<storageRoot>/cli/exec` | 具名临时文件,沿用前后台保留规则,接受系统清理 |
+| zcode-cli 剪贴板图片      | `~/.zcode/clipboard`                                                                               | 单次读取后删除                                 |
+| 日志导出 staging          | `~/.zcode/export-log-stage`                                                                        | 打包完成后删除,异常退出允许残留               |
+| 日志导出结果              | `~/.zcode/export-log`                                                                              | 用户可见导出结果,默认保留                     |
+| feedback 附件和日志包     | `~/.zcode/feedback`                                                                                | 上传完成后删除                                 |
+| Git checkpoint 临时 index | `~/.zcode/git-checkpoint-index`                                                                    | checkpoint 构建完成后删除                      |
+| Desktop 编辑器图标转换    | `~/.zcode/editor-icon`                                                                             | 单次转换后删除                                 |
 
 ## 约束
 
-- 写入前必须确保父目录存在,不能依赖 `mkdtemp` 自动创建父目录。
-- 短生命周期目录必须使用单次唯一子目录,结束后在 `finally` 中清理。
-- 失败清理不能影响主流程结果,但残留必须留在上述可控目录中,便于后续“完全清理”功能删除。
-- zcode-cli 主流程仍优先使用配置解析后的 `storageRoot`;只有 adapter 默认兜底才使用默认 `~/.zcode/cli/exec`。
+- 写入前须准备业务子目录,不能依赖 `mkdtemp` 自动创建父目录。Bash 的系统 tmp 父目录不存在时按 `ENOENT` 降级,不自行创建系统 tmp 根。
+- 短生命周期目录必须使用单次唯一子目录,结束后在 `finally` 中清理;Bash retained 输出不随 adapter 关闭删除。
+- 失败清理不能影响主流程结果。Bash tmp 输出暂不纳入 App 存储占用统计或清理,其余目录沿用现有管理范围。
+- Bash 的自定义 `ZCODE_STORAGE_DIR` / `storageRoot` 也仅作为降级位置;其他文件仍优先使用解析后的 `storageRoot`。
 - service / desktop 侧使用现有 data base dir 语义,默认落到 `~/.zcode`,配置了 `ZCODE_DATA_BASE_DIR` 时落到 `{dataBaseDir}/.zcode`。
 
+## Bash 输出例外
+
+递归搜索数据目录会读到正在写入的输出文件;搜索结果又写回同一文件,形成自引用。
+主应用及 workflow 子运行时向 execution adapter 注入 `bashOutputTempDir = os.tmpdir()`。
+每个 adapter 按需异步 `mkdtemp` 创建私有目录,仅复用成功的创建结果;未传该选项的直接调用保持原行为。
+shell 初始化快照、启动脚本与非 Bash 输出继续使用原 `outputRootDir`。
+
+必须实际创建并打开输出文件,不能用 `access` 预检查。仅 tmp 准备阶段的
+`EACCES`、`EPERM`、`EROFS`、`ENOENT`、`ENOTDIR`、`ENOSPC`、`EDQUOT` 允许降级。
+降级调用原有 `<storageRoot>/cli/exec` 文件准备逻辑;其他错误和降级失败沿现有失败链路结束。
+命令启动后不切换路径、不重跑。降级或直接搜索 tmp 时仍可能自引用,此风险不属于本次修复承诺。
+
+文件准备完成后才能发布实际路径。前后台、监控、结果和文件入口共用该路径及已打开的 fd,
+stdout/stderr 继续直接写同一文件,输出编码只解析一次。准备期间取消或关闭须释放句柄并禁止 spawn。
+前台小输出和超限文件沿用 best-effort 清理,大输出与后台文件沿用保留规则;不 unlink、不退出归档、
+不保证系统清理或重启后仍可读取,不改变 5 GiB / 5 秒软阈值。
+
 ## 非目标
 
 - 不清理已有 `$TMPDIR/zcode-*` 残留。

+ 1 - 0
docs/ui/project-task-draft-lifecycle.md

@@ -45,6 +45,7 @@
 
 仅真实用户发送被接纳时更新 Recent;模型回复完成不是边界。改菜单、预热、权限确认、读取历史、打开设置、失败发送不更新 Recent。
 已有 session 的真实发送也更新其发送时所属项目或未归类任务范围;从权威组织态读取归属,不从 cwd 猜项目。
+辅助对话不在主任务索引中,续发使用侧栏记录的所属主会话查询 Recent 项目归属,命令仍发送给辅助 child;普通会话和 fork 仍查询自身任务。
 发送前冻结归属与完整配置;迟到回执只更新该归属,不因当前导航变化改写其他项目。
 跨 Pane 按发起顺序保留最近已接纳提交,旧回执不能覆盖较新的已接纳配置。
 其他发送更新 Recent 时不覆盖正在编辑的草稿。

+ 140 - 0
docs/ui/side-pane-full-view.md

@@ -0,0 +1,140 @@
+# Side Pane 完整视图
+
+状态:已实现(2026-10-16),E2E 已转正(2026-10-17):`ui-shell/side-pane-full-view.test.ts`、`conversation-session/conversation-session-side-pane-full-view.test.ts`。仅桌面 Electron;普通 Web、手机远控 `/remote` 不提供入口。代码模块:`packages/ui/src/side-pane-full-view/`(managed,见其 `CONTRACT.md`)。
+
+## 目标
+
+右侧面板可以临时占满左侧任务列表以外的全部区域。中间对话区不再占布局空间,对话变成面板 tab 栏里的第一个 tab,并在面板 tab 上方提供一个浮动的输入窗口。左侧任务列表与左上角按钮组(切换侧边栏、后退、前进、新建对话)保持原样。
+
+## 入口与退出
+
+| 动作                                                                       | 结果                                                     |
+| -------------------------------------------------------------------------- | -------------------------------------------------------- |
+| 面板右上角「进入完整视图」按钮(位于面板开关左侧)、`⇧⌘F` / `Ctrl+Shift+F` | 进入完整视图,当前 tab 保持为面板 tab,浮窗为收起态      |
+| 同一按钮(此时为「退出完整视图」)、同一快捷键                             | 退出完整视图,回到原三栏布局                             |
+| 面板开关 ◫                                                                 | 关闭面板,同时退出完整视图;再次打开面板不会回到完整视图 |
+| 关闭最后一个面板 tab                                                       | 面板按既有规则收起,同时退出完整视图                     |
+| 面板关闭时按快捷键                                                         | 打开面板并进入完整视图                                   |
+
+- 快捷键命令 id 为 `toggleSidePaneFullView`,可在设置页改键;Web 端不注册处理器,也不在设置页显示。
+- 退出完整视图不修改任何原有状态:侧栏显隐、侧栏宽度、面板宽度、终端开合都沿用进入前的值。
+
+## 布局
+
+```
+普通视图                                   完整视图
+┌────────┬────────────────┬────────────┐   ┌────────┬───────────────────────────────┐
+│ 任务列表 │ WorkspaceHeader │ [tabs][⤢][◫] │   │ 任务列表 │ [💬 对话][tab…][+]   [⤡][◫] │
+│        │ 对话            │ 面板内容      │   │        │ 面板内容(或对话全宽)           │
+│        │ 终端            │             │   │        │              ┌─────────────┐ │
+└────────┴────────────────┴────────────┘   │        │              │ 浮动输入框    │ │
+                                           └────────┴──────────────┴─────────────┴─┘
+```
+
+- 左侧任务列表、左上角按钮组照常显示,侧边栏开关照常生效。侧边栏收起时,tab 栏左侧按 `WorkspaceHeader` 的同一规则为按钮组留白;侧边栏展开时不留白。
+- `WorkspaceHeader` 不显示,面板 tab 栏取代它成为内容区顶栏;Windows/Linux 的窗口按钮仍在面板右上角。
+- 对话 tab 固定在第一位:聊天图标 + 当前任务标题(草稿显示「新任务」),不能关闭、不能拖动排序,没有「⋯」菜单(任务菜单仍在退出完整视图后的标题栏)。tab 栏是窗口拖拽区(`app-region: drag`),对话 tab 必须显式标为 `no-drag`,否则真实鼠标点击会被当成拖动窗口。
+- 点对话 tab:对话在面板内容区全宽显示(含底部终端)。点任意面板 tab:显示该 tab,同时出现浮动输入窗口。
+- 面板外框在完整视图中是 `absolute inset-0 z-0`:只建立自己的层叠上下文,不抬高层级。插件 UI 页面不在面板 DOM 里,而是挂在 `body` 末尾的 fixed 停靠层(`[data-sandbox-page-parking]`,无 z-index)并按 tab 占位元素的坐标摆放;外框若用正的 z-index,会把不透明背景画在插件页面上面。对话内容都在宿主(`fixed z-30`)里,浮窗仍在插件页面之上。
+- 面板展开后的空标签集合由 `useAppPanels` 补建「新标签页」tab(见 `docs/ui/side-pane-tabs.md`),完整视图沿用;补建前的瞬间内容区显示同一个启动页,tab 栏只有对话 tab 与「+」。
+
+## 单实例原则
+
+对话区只保留一个 `SessionPane` 实例。完整视图只改变它所在容器的定位方式,不移动 DOM、不重新挂载、不复制第二个 composer。
+
+```
+WorkspaceShellLayout(React 树结构在三种形态下相同)
+└─ #content / ResizablePanelGroup(已保存的面板占比不改)
+   ├─ conversation-column
+   │   └─ 完整视图宿主(固定存在的包装层)
+   │       ├─ 普通视图:静态布局,h-full
+   │       ├─ 完整视图 + 对话 tab:position: fixed,铺满面板内容区(slot)
+   │       └─ 完整视图 + 面板 tab:position: fixed,按吸附位置浮在 slot 内
+   ├─ ResizableHandle:完整视图中隐藏
+   └─ 面板 panel:完整视图中占满宽度
+```
+
+原因:
+
+- 两个 composer 绑定同一 session 时各自持有草稿副本,最后写入者覆盖另一份;附件上传控制器也按实例保存。
+- 换容器会重新挂载 SessionPane,丢失滚动位置、焦点和上传中的附件。
+- 权限 / 问答卡片依赖对话 context,必须留在原 React 树内。
+- Esc 停止只在焦点位于对话 DOM 内时生效,浮窗仍是同一份 DOM,所以在浏览器 tab 里按 Esc 不会停止 agent。
+- 内嵌浏览器是 DOM `<webview>`,HTML 浮层可以盖在网页上。
+
+slot 是面板 tab 栏下方的内容区。宿主通过 ResizeObserver 读取 slot 的窗口坐标,写到宿主 style 上;这只是 DOM 布局投影,不是业务状态。
+
+面板宽度:完整视图不改 react-resizable-panels 管理的 flex,面板外框改为 `absolute inset-0`,以 PanelGroup 为定位容器铺满整行。库按各 panel 的 `offsetWidth` 之和计算 group 尺寸,若用 CSS 把对话列压成 0,面板从收起展开时 group 尺寸为 0,resize 失败。
+
+## 状态归属
+
+```
+按 session 记忆:taskSidePaneMemory.sidePaneFullViewByOwner[ownerTaskId ?? "__draft__"]
+└─ { surface: "conversation" | "side-pane", floating: "collapsed" | "expanded" | "minimized" } | 缺省
+
+全局偏好:localStorage「zcode:side-pane-full-view:floating-anchor」
+└─ 7 个吸附位置之一,默认 bottom-right
+
+宿主组件内临时状态(不记忆)
+└─ 拖动中的坐标、操作栏是否显示、底部输入区高度
+
+只读派生
+├─ 完整视图生效 = 桌面 && 非远控 && 面板打开 && 当前 owner 有记录
+├─ WorkspaceHeader 显示 = !完整视图生效
+└─ 浮窗显示 = 完整视图生效 && surface === "side-pane"
+```
+
+- owner 与 `sidePaneCollapsedByOwner` 相同:正式任务用 taskId,草稿用 `__draft__`。切走再切回同一 session,完整视图、当前 surface 和浮窗形态都保留。
+- 与面板 tab 一样只存在内存里,按 workspace 做 LRU;刷新或重启应用后不保留。
+- 同一 owner 下面板从打开变为关闭时清除该 owner 的记录(◫、关闭最后一个 tab 都走这条)。切换 owner 时面板开合变化不清除任何记录。
+- 窗口变窄时的自动收起策略只在普通视图生效;完整视图中对话由宿主定位,对话列宽度不代表可见对话区,不能据此收起面板或侧栏。
+
+## 浮动输入窗口
+
+浮窗由两层组成:前面是输入框本身,后面是一个抽屉。收起态只看得到输入框,没有外层边框和留白;抽屉藏在输入框后面,聚焦时从输入框后面向上滑出,露出操作栏;展开时抽屉继续向上拉高,里面是窄消息流。
+
+```
+ 收起(失焦)             收起 + 操作栏(聚焦)          展开
+                        ┌──────────────────────┐   ┌──────────────────────┐
+                        │ [−] [⌃] ◌        [⠿] │   │ [−] [⌄] ◌        [⠿] │
+                        │╭────────────────────╮│   │ 窄消息流               │
+ ╭────────────────────╮ ││[+] 输入…   [控件][↑]││   │╭────────────────────╮│
+ │[+] 输入…   [控件][↑]│ │╰────────────────────╯│   ││[+] 输入…   [控件][↑]││
+ ╰────────────────────╯ └──────────────────────┘   │╰────────────────────╯│
+                          ▲ 抽屉从输入框后面向上滑出    └──────────────────────┘
+
+ ◌ = 对话运行中的 loading,空闲时不显示
+ 焦点进入浮窗 ─▶ 抽屉滑出(收起 + 操作栏);焦点离开浮窗 ─▶ 抽屉收回输入框后面
+ 点 [⌃] ─▶ 展开;点 [⌄] ─▶ 收起
+ 任一形态 ──「−」或菜单「最小化编辑器」──▶ 最小化(圆形按钮,显示运行状态)
+ 圆形按钮 ── 点击 ──▶ 收起 + 操作栏,输入框获得焦点
+ 最小化时出现新的权限 / 问答请求 ──▶ 自动恢复为收起态,卡片替换输入框
+ 拖 ⠿ 或拖圆形按钮 ── 松手 ──▶ 吸附到最近的位置
+```
+
+- 输入框层:只露出 SessionPane 底部输入区(`data-v4-composer-dock`),浮窗形态下输入区不留内边距,输入框外壳就是浮窗最外层,并带 `shadow-lg`。内部 SessionPane 保持展开态的固定高度并贴底,输入区上方内容被裁掉但仍然挂载。权限 / 问答卡片出现时输入区变高,浮窗随之变高,行为与桌面主对话一致。
+- 浮窗形态下输入区不在消息滚动容器里:它仍是同一个 DOM 节点(不重新挂载),但从 sticky 改为相对时间线根节点贴底;滚动容器底边让出「输入区高度 + 12px」,消息底部再留 16px 空白,滚动条止于输入框上方,不再延伸到输入框后面。浮窗形态下消息层不加底部渐隐遮罩(消息不会经过输入框)。对话 tab 与普通视图仍是 sticky 输入区。
+- 浮窗形态下对话不使用空会话居中布局,输入区始终贴底,草稿推荐提示和草稿顶部的「选择项目 / 分支」栏都不显示(切到对话 tab 可选择项目)。
+- 输入框在浮窗形态下是单行布局:`[+] [输入区] [模式 / 模型等控件] [发送]` 排在同一行。输入区至少占一半宽度;控件放不下时沿用主输入框工具栏的逐级收起规则(先收文字,最后只留图标)。文字超过一行时输入区向上长高,左右按钮贴底。附件等 `topContent` 单独占输入行上方一整行。
+- 单行与普通两行布局共用同一棵 DOM 树,只切换样式:编辑器节点位置不变,在浮窗和对话 tab 之间切换不会重新挂载编辑器,草稿、光标和撤销历史都保留。只有「+」菜单按钮会换位置重新挂载。
+- 运行中占位:浮窗形态下对话运行时,输入框占位文字显示「工作中 {时长}」(`chat.history.workingFor`),时长与流式消息里运行中 work segment 的「工作中 N 秒」同值(同一个 `workStatus.durationMs`,每秒刷新),用同一个格式化函数(`formatConversationWorkDuration`,天 / 时 / 分 / 秒后缀,最多两段)。时长尚未产生时沿用原占位;对话 tab 与普通视图不变。
+- 回答气泡:浮窗形态下,一轮回答结束(出现一个已结束、最终回答为 complete、且不同于基线的回合)时,在浮窗上方(顶部吸附位置时在下方)显示一个气泡,只显示回答正文的纯文本前两行,不显示图标和标题。基线:浮窗第一次看到某个会话时,已结束的回合算看过,正在运行的回合不算;离开浮窗形态时清空基线,回到浮窗重新建立,所以在对话 tab 里看过的回答不会弹出。不要求看到「运行中」:回放或很快的回答可能在一次渲染里就从未开始变成已结束。
+  - 只有两种方式让气泡消失:点左上角 ×;点气泡本身(同时把浮窗切到展开态显示消息流)。发送下一条消息时气泡保留,下一轮回答结束后替换为新回答。
+  - 气泡按会话记录(只在内存里),切走再切回仍在;只在浮窗收起态显示,展开态和最小化时隐藏但不清除。
+  - 数据来源唯一:时间线最后一个回合(render unit)同时给出 turnKey、运行状态、运行时长和最终回答,经 `reportFloatingStatus` 一次性上报,避免运行状态与回答来自两个源时出现先后不一致。
+- 抽屉层:与输入框同宽,`rounded-2xl`、`bg-background`、`border-border`、`shadow-lg`。失焦时整个藏在输入框后面;操作栏可见时一直向下延伸到输入框底边,两侧边线连续到底,输入框顶部圆角外露出的是抽屉背景(只伸到输入框后面一小段时,抽屉底角和输入框顶角会对出一个凹口)。高度随浮窗尺寸过渡,形成从输入框后面滑出的效果。
+- 操作栏只有按钮:左侧「−」最小化、「⌃ / ⌄」展开或收起消息流,右侧 ⠿ 是拖动柄与菜单二合一。不显示任务标题(标题在对话 tab 上)。对话运行中(`snapshot.control.canStop`,与圆形按钮同一状态源)时,「⌃ / ⌄」右侧显示一个旋转的 loading 图标,空闲时不显示。操作栏空白处没有点击行为,按下时不夺走输入框焦点。
+- 操作栏在收起态只在浮窗内有焦点或菜单打开时显示;展开态始终显示。
+- ⠿ 悬停提示「拖动以移动 · 点击查看选项」。点击(移动不足 4px)打开菜单:「在完整视图中打开」切到对话 tab;「最小化编辑器」进入最小化。拖动超过 4px 时浮窗跟随指针,松手吸附。⠿ 菜单 portal 的点击会沿 React 树冒泡,操作栏容器不能挂点击行为。
+- 最小化与恢复之间切换时,浮窗尺寸直接到位,不做宽高过渡;改为从圆形按钮所在的吸附角缩放(0.92 → 1)并淡入,150ms。最小化期间输入层保持浮窗宽度排版(不可见),不随 48px 的按钮重排。原因:宽度从 48px 过渡到 560px 时单行输入框会折成多行,测得的输入区高度先变大再缩回,浮窗背景会先变高再往下掉。
+- 吸附位置:左上、右上、左中、右中、左下、下中、右下;与 slot 边缘保持 16px。顶部位置向下展开,底部位置向上展开,中部位置居中。
+- 展开态宽 560px、高 min(640px, slot 高度 − 32px),消息流在窗口内滚动;收起态同宽;slot 过窄时宽度收缩到 slot 宽度 − 32px。
+
+## 拆分 pane 入口下线
+
+本功能同时下线对话区拆分 pane 的全部入口(见 `docs/v4-split-pane-workbench.md`):任务行右键「在分屏打开」、把任务行拖到对话区边缘创建拆分。任务行拖到项目上移动任务仍保留。已经存在的拆分布局仍可正常显示与关闭。完整视图浮窗只显示当前焦点 pane。
+
+## 验证
+
+- 单元测试:吸附位置计算、最近吸附点、owner 记忆与退出规则、快捷键表。
+- 桌面 E2E(正式):见 `docs/testing/side-pane-tabs-e2e-case-catalog.md` 的 SPFV 用例。

+ 1 - 0
docs/ui/side-pane-tabs.md

@@ -79,6 +79,7 @@ flowchart LR
 - side pane 的 tabs、折叠态、Git source 选择和 Browser 当前 URL 按 `workspaceIdentity?.trim() || workspacePath` 缓存在内存中,跨 workspace 切换后恢复;刷新或重启应用后不保留
 - 多 Browser tab 的 URL 按 `browser tab id -> URL` 记录,避免多个 webview 共用同一份恢复地址
 - 桌面端 `Cmd/Ctrl+W` 走“关闭当前上下文”语义:右侧 side pane 展开且存在 active tab 时优先关闭该 tab;否则回退到关闭当前窗口。该快捷键由 main 进程转发给 renderer 判断,避免 Electron 原生 `close` role 绕过 side pane 状态直接关闭窗口。
+- 桌面端面板右上角提供「进入完整视图」(`⇧⌘F` / `Ctrl+Shift+F`),面板占满窗口、对话变为第一个 tab 并提供浮动输入窗口,完整合同见 `docs/ui/side-pane-full-view.md`。
 
 ### 新标签页展示
 

+ 2 - 2
docs/ui/workspace-file-tree.md

@@ -1,8 +1,8 @@
 # Workspace File Tree
 
-Workspace 文件树入口位于项目和任务行的操作区,也可从右侧内置应用中的“文件”打开。入口在右侧创建独立文件标签页,左侧任务列表保持可用。文件预览在左、目录在右;目录宽度可拖拽调整,分割线与边框重合。收起目录后预览填满区域,展开恢复目录宽度,并保留目录搜索、展开状态和滚动位置。面包屑、文件操作和目录开关共用一行,不再重复显示项目绝对路径。
+Workspace 文件树入口位于项目和任务行的操作区,也可从右侧内置应用中的“文件”打开。入口在右侧创建独立文件标签页,左侧任务列表保持可用。文件预览在左、目录在右;目录宽度可拖拽调整,分割线与边框重合。收起目录后预览填满区域,展开恢复目录宽度,并保留目录搜索、展开状态和滚动位置。用户通过目录开关选择的显隐状态按 `workspaceIdentity?.trim() || workspacePath` 持久化:同一 workspace 的所有文件标签与 session 共用最后状态,关闭并重启 App 后仍恢复;不同 workspace 互不影响。面包屑、文件操作和目录开关共用一行,不再重复显示项目绝对路径。
 
-窄面板及手机视图中,目录和预览交替显示;选择文件后收起目录。标签页导航只更新对应实例,不改变任务归属或激活其他标签。内置应用按文件、浏览器、终端、审查、辅助对话排列;不支持的入口仍按现有能力条件隐藏。
+窄面板及手机视图中,目录和预览交替显示;选择文件后只临时收起当前紧凑布局中的目录,不改写 workspace 的显式显隐偏好,恢复宽屏后继续使用该偏好。标签页导航只更新对应实例,不改变任务归属或激活其他标签。内置应用按文件、浏览器、终端、审查、辅助对话排列;不支持的入口仍按现有能力条件隐藏。
 
 跨工作区文件入口先激活目标工作区,再由目标工作区恢复后的 side-pane owner 消费一次性请求;不得用来源工作区或来源任务给标签补归属。请求只保存在窗口导航 store,不写入持久化设置。临时外部目录继续属于发起入口的工作区。手机 Home 的同工作区入口同时进入 Chat;跨工作区入口将 Chat 与文件打开意图交给新 Root,旧页面不再重复创建标签。
 

+ 3 - 4
docs/v4-session-workbench-groups.md

@@ -1,9 +1,8 @@
 # v4 Session Workbench Groups
 
-状态:**已实现,2026-07-17 再次确认产品边界**。Task 列表向对话区边缘拖拽
-仍是正式分屏入口,支持跨 workspace 组合和 renderer-local group 恢复;
-2026-07-13 只下线 pane chrome 上的显式“向右拆分 / 向下拆分”按钮,不代表
-workbench 整体退役。
+状态:**创建入口已全部下线(2026-10-16)**。Task 列表拖到对话区边缘与右键
+「在分屏打开」不再创建或扩展 group(见 `docs/v4-split-pane-workbench.md`);
+已有 group 仍可恢复、聚焦和关闭 pane。下文保留原设计作为现有 group 的行为合同。
 
 ## 功能摘要
 

+ 5 - 3
docs/v4-split-pane-workbench.md

@@ -1,8 +1,10 @@
 # v4 多 pane 跨 workspace 工作台(分屏二期)
 
-状态:**已实现,2026-07-17 再次确认产品边界**。Task 列表拖拽 session 到
-对话区边缘仍会创建/恢复 workbench group;2026-07-13 仅临时下线 pane chrome
-的“向右拆分 / 向下拆分”显式按钮。
+状态:**入口已全部下线(2026-10-16)**。Task 列表拖到对话区边缘创建拆分、
+侧栏会话项「在分屏打开」两个入口随 Side Pane 完整视图(`docs/ui/side-pane-full-view.md`)
+一起移除;pane chrome 的“向右拆分 / 向下拆分”按钮自 2026-07-13 起已不显示。
+已经存在的拆分布局与 workbench group 仍按本文渲染、聚焦和关闭,不做迁移。
+Task 列表拖到项目上移动任务不受影响。
 
 ## 目标
 

+ 29 - 9
docs/web-remote-control/relay-v2-pairing.md

@@ -257,7 +257,7 @@ sequenceDiagram
 
 回调模式先于普通入口;生产回调地址由 endpoint origin 推导,本地调试仍经允许的私网 `return_to=/remote/v4` 转发,只有显式启用开发转发的构建接受它。`app_return_to` 只允许同源 `/remote/v4`、保留的 `/remote/__test__`(均可有尾斜杠)和已有分享路径;远控 query 仅放行 `app_version`、`sid`、`mid`、`name`,其他参数与 fragment 不进入 OAuth 安全回跳。测试入口复用 `/remote/v4` 回调后返回原测试链接,不新增 OAuth 或私网 callback 路径;验收见 [测试入口登录回跳](./web-remote-login.md#独立测试入口的登录回跳)。
 
-发起授权时,回调地址与私网 return_to 同样保留上述白名单参数,保证网关在加载 JS 前能按 app_version 选取资源。凭据仓储保存本次完整回调地址,nonce 校验后按该地址交换 token;旧 pending 会话无保存地址时沿用固定配置。具体边界与回归见 [回调保留扫码参数](./web-remote-login.md#回调保留扫码参数)。
+发起授权时,回调地址与私网 return_to 同样保留上述白名单参数,保证网关在加载 JS 前能按 app_version 选取资源。凭据仓储在同源 localStorage 按 nonce 保存本次登录记录(含完整回调地址),回调取出匹配记录后按该地址交换 token。具体边界与回归见 [回调保留扫码参数](./web-remote-login.md#回调保留扫码参数) 与 [回调落到同一浏览器的其他标签页](./web-remote-login.md#回调落到同一浏览器的其他标签页)。
 
 有 SID 直接认证,不先查询设备列表。V1 hash/t 链接显示 invalid-mobile-connection,不计算 HMAC。每次重连重新读 JWT、申请并消费一次性 terminal token;transport 使用共享 V2 心跳(5秒±1秒/15秒 watchdog)、pair_status 映射和 KICKED 窗口。手机网络/5xx 保留 500ms×2ⁿ、最大10秒退避;桌面保留既有1秒起步/最大30秒/jitter。首次 KICKED 随机2~5秒后恢复,60秒内第二次终止为 session-conflict,回前台不能绕过该终态。
 
@@ -265,6 +265,25 @@ HTTP401 或重连前 JWT 缺失:关闭连接、清除本地会话、回登录
 
 前后台恢复继续先探测同一 socket,必要时重新申请 token;重配对后按原顺序校验桌面版本、恢复 bootstrap/mobile-view-state、bridge、ACK 未确认帧与 snapshot/gap。桌面 `desktop-continuous`、手机 `web-remote-replayable` 的业务 owner、workspaceIdentity 和恢复顺序不变。
 
+### 浏览器 HTTP 取消兼容
+
+terminal token 与设备列表 HTTP adapter 不依赖 `AbortSignal.any()`、`AbortSignal.timeout()` 或 `throwIfAborted()`。缺少这些方法时,仍须完成真实请求和配对,不能在构造请求参数时抛错并持续重连。
+
+两个 adapter 共用请求作用域的 `AbortController`,将调用方取消和既有 15 秒期限连接到同一请求信号。期限覆盖 fetch 和完整正文读取;收到响应头时不能提前释放。调用方已取消时不发请求;成功、HTTP/业务错误、网络失败、取消或超时后,均清理定时器和调用方监听。提前拒绝 HTTP 状态时也终止未读正文,避免取消期限后留下无期限请求。HTTP 401、业务错误与可重试网络错误沿用原分类,不吞错或返回部分正文。
+
+```text
+修复前:token / list → 缺少静态 API → fetch 未执行 → 重连 / 列表失败
+修复后:入口 / transport 的取消信号 → 请求内 AbortController → fetch + 完整正文
+                                               ├─ 15 秒期限
+                                               └─ finally 清理计时器 / 监听
+```
+
+helper 只拥有一次 HTTP 请求的取消资源;导航由 Entry 持有,socket/generation/重试由 transport 持有。配对协议、账号隔离、桌面 continuous 和手机 replayable 的状态归属不变。
+
+回归:两种静态 API 分别缺失及同时缺失时,token/list 成功;取消覆盖请求头和正文阶段,已取消输入零请求,正文期限与成功/异常清理均有 adapter 测试;真实 loopback relay 验证配对和 bootstrap 透传。ML08 pending 浏览器用例覆盖扫码直连、无码选设备到配对发送 bootstrap,矩阵为三种 API 缺失 × 两入口 × 手机/宽屏 × 深浅主题,交错使用中英文。此证据不替代真机浏览器、生产 relay 或用户现场事故验证。
+
+2026-10-19 本地验证:修复前兼容回归 27 项失败,浏览器缺少 `any` 时 token/WS/bootstrap 均为零;候选的未读错误正文清理另以 2 项失败测试确认。最终受影响 UT 为 21 文件、223 项通过;ML08 的 24 组浏览器回归均只取一次 token、建立一次 WS 并配对发送 bootstrap,证据在 `.tmp/remote-abort-api-compat-e2e/`。正常环境、缺少 `any`、缺少 `timeout` 的真实 HTTP/WS 探针均配对成功。typecheck、桌面 E2E typecheck、lint、architecture 和改动文件格式检查通过;lint 告警位于未修改文件。真机与生产环境仍未验证,用例保持 pending。
+
 ### 手机文案与截图验收
 
 以下表格保留 05 阶段文案;06 已以设备列表替代无 SID 扫码占位,并启用“选择其他设备”。当前设备列表及归属失败动作以 06 为准;失败页次级动作在主按钮下方使用 Button ghost。
@@ -288,14 +307,15 @@ HTTP401 或重连前 JWT 缺失:关闭连接、清除本地会话、回登录
 
 截图矩阵:登录门禁 / 无 SID / device-not-owned × 390px / 1024px × Zai Light / Zai Dark × zh-CN / en-US,共24张;pending 用例 `packages/web/test/e2e/manual-review/pending/remote-login-v2.mjs`,不自动转正。测试接缝沿用本票已定义的前置编排 + 注入 auth/fetch/location/storage/transport,以及真实 loopback 假 relay。
 
-| 用例 | 行为与断言                                                                                                      | 自动化层级                       |
-| ---- | --------------------------------------------------------------------------------------------------------------- | -------------------------------- |
-| ML01 | 无 JWT 显示双平台登录门禁,零 token/WS;24张矩阵中的8张                                                         | pending 浏览器                   |
-| ML02 | 已登录无 SID 查询设备并显示列表,选定前零 token/WS;06 更新为混合/空列表16张                                    | pending 浏览器                   |
-| ML03 | AUTH_FAILED 展示归属失败;切换账号清会话且保留 URL;8张                                                         | pending 浏览器                   |
-| ML04 | 两平台 × 手机/宽屏保留回调的扫码参数,保存 nonce/provider/回调地址,按原地址换 token 并回跳、配对发送 bootstrap | pending 浏览器,受控 OAuth/relay |
-| ML05 | 已登录直接 terminal token/auth_init/配对发送 bootstrap                                                          | pending 浏览器                   |
-| ML06 | token401 清凭据回登录并保留 URL,无 WS                                                                          | pending 浏览器                   |
+| 用例 | 行为与断言                                                                                                      | 自动化层级                                    |
+| ---- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------- |
+| ML01 | 无 JWT 显示双平台登录门禁,零 token/WS;24张矩阵中的8张                                                         | pending 浏览器                                |
+| ML02 | 已登录无 SID 查询设备并显示列表,选定前零 token/WS;06 更新为混合/空列表16张                                    | pending 浏览器                                |
+| ML03 | AUTH_FAILED 展示归属失败;切换账号清会话且保留 URL;8张                                                         | pending 浏览器                                |
+| ML04 | 两平台 × 手机/宽屏保留回调的扫码参数,保存 nonce/provider/回调地址,按原地址换 token 并回跳、配对发送 bootstrap | pending 浏览器,受控 OAuth/relay              |
+| ML05 | 已登录直接 terminal token/auth_init/配对发送 bootstrap                                                          | pending 浏览器                                |
+| ML06 | token401 清凭据回登录并保留 URL,无 WS                                                                          | pending 浏览器                                |
+| ML08 | 缺少 AbortSignal 静态 API 时,扫码直连和设备列表选择均完成 token/WS/auth/配对并发送 bootstrap                   | pending 浏览器,`remote-abort-api-compat.mjs` |
 
 ### 环境验收记录
 

+ 20 - 2
docs/web-remote-control/web-remote-login.md

@@ -6,7 +6,7 @@
 
 - `code` / `authCode` + `state`(或 OAuth `error` + `state`)优先渲染现有 `WebCallbackPage`,由 `WebAuthService` 校验 nonce、交换 token、写入同源 localStorage,再 replace 安全 app_return_to。
 - OAuth 回调地址以构建 endpoint origin 的 `/remote/v4` 为基址,保留登录前同源远控 URL 的 `app_version/sid/mid/name` 参数(含空值与编码后的设备名)。不复制未知参数、旧凭据、历史 code/authCode/state/error 或 fragment;分享登录保持独立回调地址。Z.AI 使用 `redirect_uri`,BigModel 使用 `redirect`,授权 origin 随构建环境变化。
-- `WebAuthService` 在发起授权时通过 `BrowserOAuthCredentialRepo` 将本次完整回调地址与 nonce/provider 一起保存在 sessionStorage;地址记录绑定本次 nonce,防止旧页面发起新登录时误用遗留地址。跨页后校验 nonce,再用匹配的地址交换 token 并清理 pending 地址。不得从含授权参数的回调 URL 拼出 token 请求地址。升级前没有匹配 pending 地址的登录继续使用原固定回调配置。
+- `WebAuthService` 在发起授权时通过 `BrowserOAuthCredentialRepo` 把本次登录记录(nonce、provider、完整回调地址)保存在同源 localStorage,按 nonce 区分。回调只取出 state 中 nonce 对应的那一条,取出即删除,再用该记录的 provider 与地址交换 token;找不到记录时报 CSRF 失败,不请求 token,也不改动其他记录。不得从含授权参数的回调 URL 拼出 token 请求地址。原因与边界见[回调落到同一浏览器的其他标签页](#回调落到同一浏览器的其他标签页)。
 - 无 JWT 时展示与桌面一致的 Z.AI / BigModel 两个 OAuth 入口(Z.AI 在前,使用桌面同款图标、连接文案与全球/中国标签),提示使用与电脑相同的平台和账号。登录卡片页头左侧为桌面端标题栏同款应用 logo 图标(40px,装饰性图片),右侧为“ZCode”品牌文字与标题;不再使用强调色方块里的字母占位。设备列表页与扫码占位页页头使用同一 logo 的 20px 版本加“ZCode”文字,见 [设备列表规格](./relay-v2-pairing.md#列表排布与文本线框)。选择后同时禁用两个按钮,所选 provider 经入口编排传入现有 WebAuthService;回调按 pending provider 交换并保存凭据。不增加 API Key 入口,因为远控需要账号身份;二维码不携带凭据或推断登录平台。
 - 无 JWT 时渲染登录页;appReturnTo 为当前完整 URL。安全回跳只保留同源 `/remote/v4`、`/remote/__test__`(均含尾斜杠)和既有分享路径,query 白名单为 app_version/sid/mid/name。
 - 有 JWT、有 SID 直接申请 terminal token 并连接 V2;无 SID 时按当前账号读取设备,最近 SID 在线则直连;最近 SID 不在线但同一台电脑(最近 MID)恰好只有一个在线连接时直连该连接;否则显示设备列表(规则见[落点](./relay-v2-pairing.md#落点状态归属与刷新))。离线设备不可点击;选中在线设备回写 sid/mid/name/app_version 后连接,支持手动和回前台刷新。设备页标题下显示当前登录账号与平台,“切换”打开下文的切换账号确认弹窗。
@@ -31,7 +31,7 @@
 
 ## 存储与边界
 
-`BrowserOAuthCredentialRepo` 是认证 storage 唯一边界,继续使用 zcodejwttoken、oauth:zai:access_token、oauth:zai:user_info、oauth:active_provider 以及已有 BigModel 独立键。残缺或已过期会话清理后视为未登录。前置编排通过 WebAuthService 读取 JWT,不复制认证缓存;token 不持久化,不进入 QR、日志或业务 payload。
+`BrowserOAuthCredentialRepo` 是认证 storage 唯一边界,继续使用 zcodejwttoken、oauth:zai:access_token、oauth:zai:user_info、oauth:active_provider 以及已有 BigModel 独立键;进行中的登录记录使用 `oauth_pending_logins`。残缺或已过期会话清理后视为未登录;清理登录凭据或退出不删除进行中的登录记录。前置编排通过 WebAuthService 读取 JWT,不复制认证缓存;token 不持久化,不进入 QR、日志或业务 payload。
 
 ## 开发回调转发
 
@@ -86,3 +86,21 @@
 ```
 
 复用 ML04 浏览器用例:两平台 × 手机/宽屏均从实际授权 URL 取回调地址,断言扫码参数完整保留,追加授权参数后导航,并核对 token 请求的 redirect_uri 与授权时一致。单测补充 Unicode/空值、未知及历史授权参数剔除、跨页恢复、nonce 失败、旧 pending 会话兼容与私网转发。此变更仅涉及 Web OAuth;桌面登录、continuous/replayable 与业务 owner 不变。发布后需真机验证两平台允许并保留带 query 的回调地址;缺少 app_version 的入口仍依赖 latest,不能据此宣称已修复线上旧资源。
+
+## 回调落到同一浏览器的其他标签页
+
+部分手机浏览器在 OAuth 往返后,回调页不在发起登录的标签页里,或标签页被系统回收后重建(例如切到短信 App 查看短信验证码)。登录记录原先只存在发起页的 sessionStorage,回调页读不到,就在换 token 前报 “OAuth CSRF 检测失败”;点“重新登录”在同一环境中仍会失败,换浏览器才能完成。
+
+```text
+修复前:Tab A 写 sessionStorage[A].nonce=N → provider 登录 → 回调落在 Tab B / 重建后的 Tab A
+        → sessionStorage 为空 → null≠N → CSRF 失败(不请求 token)
+修复后:Tab A 写 localStorage.oauth_pending_logins += {N, provider, redirectUri}
+        → provider 登录 → 回调落在同源任意标签页 → 取出并删除 N 对应记录 → 换 token → 安全回跳
+```
+
+- 记录按 nonce 区分,多个标签页同时发起登录互不覆盖;最多保留最近 5 条,放弃的登录不会无限累积。
+- nonce 仍随机、同源可见、只能用一次。state 中的 nonce 找不到记录时拒绝,并保留其他记录。
+- 回调落到另一个浏览器 App 时仍拒绝:该浏览器没有本次登录记录,这是 CSRF 校验应有的结果。
+- 不再读取旧版本写在 sessionStorage 的 `oauth_pending_nonce` / `oauth_pending_provider` / `oauth_pending_redirect_uri`。网关按 `app_version` 为发起页和回调页加载同一版本目录,只有部署切换时正在进行的登录会受影响,用户重新登录即可。
+
+验收:`browserOAuthCredentialRepo.test.ts` 覆盖跨标签页取回、只取匹配 nonce、取出即删、条数上限与损坏记录;`webAuthService.test.ts` 覆盖回调页使用空 sessionStorage 时两平台完成登录、nonce 不匹配时不请求 token 且保留记录、两个标签页并行登录各自完成。浏览器回归 `remote-login-v2.mjs` ML07 在同一浏览器 context 的新标签页完成回调,断言 token 请求参数、回跳与 terminal 配对。受控浏览器证据不替代真实手机浏览器验收。

+ 2 - 2
package-lock.json

@@ -1,12 +1,12 @@
 {
   "name": "zcode",
-  "version": "3.16.1",
+  "version": "3.16.2",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "zcode",
-      "version": "3.16.1",
+      "version": "3.16.2",
       "devDependencies": {
         "@vitest/coverage-v8": "^4.1.1",
         "concurrently": "^9.1.2",

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "zcode",
-  "version": "3.16.1",
+  "version": "3.16.2",
   "private": true,
   "type": "module",
   "scripts": {

+ 46 - 31
packages/desktop/src/main/desktopTray.ts

@@ -11,7 +11,7 @@ import {
 } from "@zcode/shared";
 import {
   blendBadgeIntoBitmap,
-  renderTaskbarBadgePixels,
+  renderAntialiasedStatusDotPixels,
   resolveBadgeOverlayLabel,
 } from "./unreadBadge.js";
 
@@ -19,14 +19,10 @@ let desktopTray: Tray | null = null;
 let rebuildDesktopTrayContextMenu: (() => void) | null = null;
 let trayLogger: { warn: (...args: unknown[]) => void } | null = null;
 
-// 托盘红点合成参数:画布 32×32,Logo 满幅;Logo 是圆角方块,右上直角处天然有约
-// 4×4 的透明缺口,9×9 红点(画布 10、radius 4)圆心 (28.5, 3.5) 嵌进缺口,
-// 与图片上边缘、右边缘正切,最外缘再往外就会被画布裁掉。
+// 托盘图在 Windows 通知区域实际显示约 16px。为避免把普通 32px 合成图交给 Shell
+// 盲缩导致红点发糊,分别合成原生 1x(16px) 与 2x(32px) 表示;红点尺寸独立于任务栏。
 // spec 见 docs/desktop/windows-taskbar-unread-badge.md
-const TRAY_IMAGE_SIZE = 32;
-const TRAY_BADGE_SIZE = 10;
-const TRAY_BADGE_ORIGIN_X = 24;
-const TRAY_BADGE_ORIGIN_Y = -1;
+const TRAY_LOGICAL_SIZE = 16;
 
 let trayBaseImage: NativeImage | null = null;
 const trayBadgeImageCache = new Map<string, NativeImage>();
@@ -156,16 +152,15 @@ function loadTrayBaseImage(): NativeImage | null {
   return trayBaseImage.isEmpty() ? null : trayBaseImage;
 }
 
-function composeTrayBadgeImage(label: string, baseImage: NativeImage): NativeImage | null {
-  const cached = trayBadgeImageCache.get(label);
-  if (cached) {
-    return cached;
-  }
-
-  const resized = baseImage.resize({ width: TRAY_IMAGE_SIZE, height: TRAY_IMAGE_SIZE });
+function composeTrayBadgeRepresentation(
+  label: string,
+  baseImage: NativeImage,
+  scale: 1 | 2,
+): Buffer | null {
+  const size = TRAY_LOGICAL_SIZE * scale;
+  const resized = baseImage.resize({ width: size, height: size });
   const bitmap = resized.toBitmap();
-  // 位深防御:toBitmap 尺寸与预期不符时放弃合成,保持无红点底图,避免托盘出花屏。
-  if (bitmap.length !== TRAY_IMAGE_SIZE * TRAY_IMAGE_SIZE * 4) {
+  if (bitmap.length !== size * size * 4) {
     trayLogger?.warn(
       `[desktop-tray] unexpected tray bitmap size ${bitmap.length}, skip badge compose`,
     );
@@ -173,25 +168,45 @@ function composeTrayBadgeImage(label: string, baseImage: NativeImage): NativeIma
   }
 
   const canvas = new Uint8Array(bitmap);
-  // 托盘实际显示仅 16×16,数字不可读:只画红点提示"有未读",数量看任务栏气泡/任务列表。
-  // 红点嵌进 Logo 圆角留下的右上透明缺口,边缘与圆弧相切(见顶部常量注释)。
-  const badge = renderTaskbarBadgePixels(label, {
-    size: TRAY_BADGE_SIZE,
-    glyphScale: 1,
-    padding: 0,
-    dot: true,
+  // 托盘保持约 8px 逻辑直径,右上角完整圆;4× 超采样后按原生尺寸合成。
+  const dotSize = 5 * scale;
+  const badge = renderAntialiasedStatusDotPixels({
+    size: dotSize,
+    centerX: 2.75 * scale,
+    centerY: 2.25 * scale,
+    radius: 1.875 * scale,
   });
   blendBadgeIntoBitmap({
     base: canvas,
-    size: TRAY_IMAGE_SIZE,
+    size,
     badge,
-    badgeSize: TRAY_BADGE_SIZE,
-    originX: TRAY_BADGE_ORIGIN_X,
-    originY: TRAY_BADGE_ORIGIN_Y,
+    badgeSize: dotSize,
+    originX: size - dotSize,
+    originY: 0,
+  });
+  return Buffer.from(canvas);
+}
+
+function composeTrayBadgeImage(label: string, baseImage: NativeImage): NativeImage | null {
+  const cached = trayBadgeImageCache.get(label);
+  if (cached) return cached;
+
+  const oneX = composeTrayBadgeRepresentation(label, baseImage, 1);
+  const twoX = composeTrayBadgeRepresentation(label, baseImage, 2);
+  if (!oneX || !twoX) return null;
+
+  const image = nativeImage.createEmpty();
+  image.addRepresentation({
+    scaleFactor: 1,
+    width: 16,
+    height: 16,
+    buffer: oneX,
   });
-  const image = nativeImage.createFromBitmap(Buffer.from(canvas), {
-    width: TRAY_IMAGE_SIZE,
-    height: TRAY_IMAGE_SIZE,
+  image.addRepresentation({
+    scaleFactor: 2,
+    width: 32,
+    height: 32,
+    buffer: twoX,
   });
   trayBadgeImageCache.set(label, image);
   return image;

+ 30 - 8
packages/desktop/src/main/desktopWindowLifecycle.ts

@@ -1,5 +1,6 @@
 import { getDatabaseStartupPortPayload } from "./databaseStartupRelay.js";
 import { randomUUID } from "node:crypto";
+import { release as readPlatformRelease } from "node:os";
 import { app, BrowserWindow, Menu, MessageChannelMain, nativeImage } from "electron";
 import type { UtilityProcess as ElectronUtilityProcess } from "electron";
 import { HostMessageTypes, InternalChannels, PlatformChannels, type Locale } from "@zcode/shared";
@@ -9,14 +10,14 @@ import type { HostInitMessage, WindowBootstrapOptions } from "./desktopHostProce
 import type { StartupWorkspaceWarmupTarget } from "./startupWorkspace.js";
 import type { RemoteAssetDirs } from "./desktopRuntimeEnv.js";
 import { handleDarwinWindowCloseRequest } from "./desktopDarwinCloseBehavior.js";
+import { supportsNativeWindowsRoundedCorners } from "./desktopWindowChromeState.js";
 import { applyDesktopTrayUnreadBadge } from "./desktopTray.js";
 import {
   createWindowsTaskbarOverlayApplier,
-  parseWindowUnreadCount,
-  renderTaskbarBadgePixels,
   maxWindowUnreadCounts,
+  parseWindowUnreadCount,
+  renderTaskbarStatusDotPixels,
   syncUnreadBadgeForPlatform,
-  TASKBAR_BADGE_IMAGE_SIZE,
 } from "./unreadBadge.js";
 import { attachDesktopWindowSizePersistence, type DesktopWindowSize } from "./desktopWindowSize.js";
 import {
@@ -329,13 +330,34 @@ export function focusWorkspaceInExistingWindow(
 
 // Windows 任务栏 overlay 的 electron 侧装配:像素渲染在 unreadBadge.ts(纯逻辑,可单测),
 // 这里只负责 BrowserWindow 枚举与 nativeImage 构造。spec 见 docs/desktop/windows-taskbar-unread-badge.md
+const windowsTaskbarOverlayLayout = supportsNativeWindowsRoundedCorners(
+  process.platform,
+  readPlatformRelease(),
+)
+  ? "windows-11"
+  : "windows-10";
+
 const applyWindowsTaskbarOverlay = createWindowsTaskbarOverlayApplier({
   getAllWindows: () => BrowserWindow.getAllWindows(),
-  createBadgeImage: (label) =>
-    nativeImage.createFromBitmap(Buffer.from(renderTaskbarBadgePixels(label)), {
-      width: TASKBAR_BADGE_IMAGE_SIZE,
-      height: TASKBAR_BADGE_IMAGE_SIZE,
-    }),
+  // Windows 固定把 overlay 显示为 16×16。直接传硬边 32px 圆再让 Shell 缩放会发糊、
+  // 边缘像缺口;这里提供原生 1x(16px) + 2x(32px) 纯红抗锯齿表示。
+  // label 只用于无障碍 description,屏幕阅读器仍播报具体数量。
+  createBadgeImage: () => {
+    const image = nativeImage.createEmpty();
+    image.addRepresentation({
+      scaleFactor: 1,
+      width: 16,
+      height: 16,
+      buffer: Buffer.from(renderTaskbarStatusDotPixels(1, windowsTaskbarOverlayLayout)),
+    });
+    image.addRepresentation({
+      scaleFactor: 2,
+      width: 32,
+      height: 32,
+      buffer: Buffer.from(renderTaskbarStatusDotPixels(2, windowsTaskbarOverlayLayout)),
+    });
+    return image;
+  },
 });
 
 export function syncApplicationUnreadBadge(windowUnreadCountMap: Map<number, number>) {

+ 81 - 3
packages/desktop/src/main/unreadBadge.ts

@@ -92,6 +92,12 @@ export type BadgePixelOptions = {
   padding?: number;
   /** 纯色圆点模式(托盘用):16px 显示尺寸下数字不可读,只画圆不画数字。 */
   dot?: boolean;
+  /**
+   * 圆点锚点。center 为画布中心(托盘合成用);bottom-right 把圆心锚到画布
+   * 右下角(任务栏 overlay 用)——overlay 整图铺在图标右下区域,点画在画布
+   * 中心会悬在图标中部,只有锚住右下角才呈现"图标角标"的观感。
+   */
+  anchor?: "center" | "bottom-right";
 };
 
 // 输出预乘 alpha 的 BGRA(与 Electron toBitmap / createFromBitmap 契约一致):
@@ -119,9 +125,15 @@ export function renderTaskbarBadgePixels(
   const totalWidth = glyphs.length * glyphWidth + (glyphs.length - 1) * glyphSpacing;
   const originX = Math.round((size - totalWidth) / 2);
   const originY = Math.round((size - glyphHeight) / 2);
-  const center = (size - 1) / 2;
   const radius = Math.max(1, (size - padding * 2) / 2 - 1);
   const radiusSquared = radius * radius;
+  // 右下锚定留 2px 安全边:贴到只剩 1px 时 Windows 缩放采样会吃掉最外圈像素,
+  // 实拍观感像圆被咬掉一块。
+  const anchorMargin = 2;
+  const center =
+    options.anchor === "bottom-right"
+      ? { x: size - radius - anchorMargin, y: size - radius - anchorMargin }
+      : { x: (size - 1) / 2, y: (size - 1) / 2 };
 
   const isGlyphPixel = (x: number, y: number): boolean => {
     for (let index = 0; index < glyphs.length; index += 1) {
@@ -148,8 +160,8 @@ export function renderTaskbarBadgePixels(
 
   for (let y = 0; y < size; y += 1) {
     for (let x = 0; x < size; x += 1) {
-      const offsetX = x - center;
-      const offsetY = y - center;
+      const offsetX = x - center.x;
+      const offsetY = y - center.y;
       if (offsetX * offsetX + offsetY * offsetY > radiusSquared) {
         continue;
       }
@@ -212,6 +224,72 @@ export function blendBadgeIntoBitmap(options: {
   }
 }
 
+export interface AntialiasedDotOptions {
+  size: number;
+  centerX: number;
+  centerY: number;
+  radius: number;
+  supersample?: number;
+}
+
+/** 4× 超采样的纯红预乘 BGRA 圆点;任务栏与托盘复用,几何参数各自独立。 */
+export function renderAntialiasedStatusDotPixels(
+  options: AntialiasedDotOptions,
+): Uint8Array {
+  const supersample = options.supersample ?? 4;
+  const pixels = new Uint8Array(options.size * options.size * 4);
+  const samplesPerPixel = supersample * supersample;
+
+  for (let y = 0; y < options.size; y += 1) {
+    for (let x = 0; x < options.size; x += 1) {
+      let coveredSamples = 0;
+      for (let sy = 0; sy < supersample; sy += 1) {
+        for (let sx = 0; sx < supersample; sx += 1) {
+          const sampleX = x + (sx + 0.5) / supersample;
+          const sampleY = y + (sy + 0.5) / supersample;
+          const dx = sampleX - options.centerX;
+          const dy = sampleY - options.centerY;
+          if (dx * dx + dy * dy <= options.radius * options.radius) coveredSamples += 1;
+        }
+      }
+
+      if (coveredSamples === 0) continue;
+      const coverage = coveredSamples / samplesPerPixel;
+      const offset = (y * options.size + x) * 4;
+      // 预乘 alpha:抗锯齿边缘保持同一红色,不与底图混成白边或脏边。
+      pixels[offset] = Math.round(BADGE_CIRCLE_COLOR.blue * coverage);
+      pixels[offset + 1] = Math.round(BADGE_CIRCLE_COLOR.green * coverage);
+      pixels[offset + 2] = Math.round(BADGE_CIRCLE_COLOR.red * coverage);
+      pixels[offset + 3] = Math.round(coverage * 255);
+    }
+  }
+
+  return pixels;
+}
+
+/**
+ * Windows taskbar overlay 固定显示 16×16。直接把硬边 32px 圆交给 Shell 缩放会产生
+ * 模糊/缺口;这里在目标尺寸上超采样,生成纯红色、抗锯齿的预乘 BGRA 圆点。
+ * scale=1 产出原生 16px 表示,scale=2 产出 32px 高 DPI 表示。
+ */
+export type TaskbarOverlayLayout = "windows-10" | "windows-11";
+
+export function renderTaskbarStatusDotPixels(
+  scale: 1 | 2 = 1,
+  layout: TaskbarOverlayLayout = "windows-11",
+): Uint8Array {
+  // 两代 Windows Shell 对 16×16 overlay 的任务栏落点不同:
+  // Win10 需要画布内右下锚定;Win11 已把整张 overlay 放到图标角上,需画布内居中,
+  // 否则形成二次偏移。一个固定圆心无法同时匹配两代任务栏。
+  const center = layout === "windows-10" ? 11.25 : 8;
+  return renderAntialiasedStatusDotPixels({
+    size: 16 * scale,
+    centerX: center * scale,
+    centerY: center * scale,
+    radius: 3.5 * scale,
+  });
+}
+
 // 只要求"有任务栏按钮的窗口"能力,方便单测注入假窗口;
 // skipTaskbar 窗口(CUA 指示器等)设置 overlay 无副作用,不必逐一排除。
 export type TaskbarOverlayWindow = {

+ 71 - 46
packages/desktop/test/desktopTrayBadge.test.ts

@@ -6,28 +6,41 @@ const state = vi.hoisted(() => {
     images: unknown[];
     tooltips: string[];
   }> = [];
-  const createFromBitmapCalls: Array<{ buffer: Buffer; width: number; height: number }> = [];
+  const representations: Array<{
+    scaleFactor: number;
+    width: number;
+    height: number;
+    buffer: Buffer;
+  }> = [];
   let baseImageCounter = 0;
 
-  // 32×32 不透明蓝底(预乘 BGRA),模拟托盘底图
-  const baseBuffer = Buffer.alloc(32 * 32 * 4);
-  for (let offset = 0; offset < baseBuffer.length; offset += 4) {
-    baseBuffer[offset] = 200;
-    baseBuffer[offset + 1] = 40;
-    baseBuffer[offset + 2] = 10;
-    baseBuffer[offset + 3] = 255;
-  }
+  const createBaseBuffer = (size: number) => {
+    // 不透明蓝底(预乘 BGRA),模拟托盘底图的 1x / 2x 表示
+    const buffer = Buffer.alloc(size * size * 4);
+    for (let offset = 0; offset < buffer.length; offset += 4) {
+      buffer[offset] = 200;
+      buffer[offset + 1] = 40;
+      buffer[offset + 2] = 10;
+      buffer[offset + 3] = 255;
+    }
+    return buffer;
+  };
+  const baseBuffer16 = createBaseBuffer(16);
+  const baseBuffer32 = createBaseBuffer(32);
 
   const fakeBaseImage = () => ({
     __baseImage: ++baseImageCounter,
     isEmpty: () => false,
-    resize: () => ({ toBitmap: () => baseBuffer }),
+    resize: ({ width }: { width: number }) => ({
+      toBitmap: () => (width === 16 ? baseBuffer16 : baseBuffer32),
+    }),
   });
 
   return {
     trayInstances,
-    createFromBitmapCalls,
-    baseBuffer,
+    representations,
+    baseBuffer16,
+    baseBuffer32,
     fakeBaseImage,
     resetBaseImageCounter: () => {
       baseImageCounter = 0;
@@ -55,10 +68,15 @@ vi.mock("electron", () => ({
   },
   nativeImage: {
     createFromPath: () => state.fakeBaseImage(),
-    createFromBitmap: (buffer: Buffer, options: { width: number; height: number }) => {
-      state.createFromBitmapCalls.push({ buffer, width: options.width, height: options.height });
-      return { __composed: state.createFromBitmapCalls.length, buffer };
-    },
+    createEmpty: () => ({
+      __composed: true,
+      addRepresentation: (representation: {
+        scaleFactor: number;
+        width: number;
+        height: number;
+        buffer: Buffer;
+      }) => state.representations.push(representation),
+    }),
   },
 }));
 
@@ -66,7 +84,7 @@ describe("desktop tray unread badge", () => {
   beforeEach(() => {
     vi.resetModules();
     state.trayInstances.length = 0;
-    state.createFromBitmapCalls.length = 0;
+    state.representations.length = 0;
     state.resetBaseImageCounter();
   });
 
@@ -82,8 +100,8 @@ describe("desktop tray unread badge", () => {
     logger: { warn: vi.fn() },
   };
 
-  function pixelOf(buffer: Buffer, x: number, y: number): number[] {
-    const offset = (y * 32 + x) * 4;
+  function pixelOf(buffer: Buffer, size: number, x: number, y: number): number[] {
+    const offset = (y * size + x) * 4;
     return [buffer[offset]!, buffer[offset + 1]!, buffer[offset + 2]!, buffer[offset + 3]!];
   }
 
@@ -102,39 +120,46 @@ describe("desktop tray unread badge", () => {
     mod.applyDesktopTrayUnreadBadge(3);
     mod.applyDesktopTrayUnreadBadge(3);
 
-    // 同一 label 只合成一次
-    expect(state.createFromBitmapCalls).toHaveLength(1);
+    // 同一 label 只合成一次(缓存的 NativeImage 含 1x/2x 两份表示)
+    expect(state.representations).toHaveLength(2);
+    expect(state.representations.map(({ scaleFactor, width, height }) => ({
+      scaleFactor,
+      width,
+      height,
+    }))).toEqual([
+      { scaleFactor: 1, width: 16, height: 16 },
+      { scaleFactor: 2, width: 32, height: 32 },
+    ]);
     // 创建时 + 两次换图
     const images = state.trayInstances[0]!.images;
     expect(images).toHaveLength(2);
 
-    const { buffer } = state.createFromBitmapCalls[0]!;
-    expect(state.createFromBitmapCalls[0]!).toMatchObject({ width: 32, height: 32 });
-    expect(buffer.length).toBe(32 * 32 * 4);
-    // 画布 32×32、Logo 满幅;红点 9×9(画布 10、radius 4)圆心 (28.5, 3.5),
-    // 嵌进 Logo 圆角的透明缺口,与图片上边缘、右边缘正切。
-    expect(pixelOf(buffer, 26, 4)).toEqual([53, 57, 229, 255]);
-    expect(pixelOf(buffer, 25, 3)).toEqual([53, 57, 229, 255]);
-    // 正切:红点像素触达图片第 0 行(上边缘)与第 31 列(右边缘)
-    expect(pixelOf(buffer, 28, 0)).toEqual([53, 57, 229, 255]);
-    expect(pixelOf(buffer, 31, 3)).toEqual([53, 57, 229, 255]);
-    // Logo 本体与远离红点的底图保持蓝色
-    expect(pixelOf(buffer, 16, 16)).toEqual([200, 40, 10, 255]);
-    expect(pixelOf(buffer, 22, 0)).toEqual([200, 40, 10, 255]);
+    const oneX = state.representations[0]!.buffer;
+    const twoX = state.representations[1]!.buffer;
+    // 1x / 2x 都有纯红芯,且抗锯齿边缘与底图混合(不是硬边纯红或原底图)
+    expect(pixelOf(oneX, 16, 13, 2)).toEqual([53, 57, 229, 255]);
+    expect(pixelOf(twoX, 32, 27, 4)).toEqual([53, 57, 229, 255]);
+    expect(pixelOf(twoX, 32, 23, 4)).not.toEqual([200, 40, 10, 255]);
+    expect(pixelOf(twoX, 32, 23, 4)).not.toEqual([53, 57, 229, 255]);
+    // Logo 本体与远离红点的底图保持不变
+    expect(pixelOf(oneX, 16, 8, 8)).toEqual([200, 40, 10, 255]);
+    expect(pixelOf(twoX, 32, 16, 16)).toEqual([200, 40, 10, 255]);
     // 整图不应出现白色笔画像素
-    let hasWhitePixel = false;
-    for (let offset = 0; offset + 3 < buffer.length; offset += 4) {
-      if (
-        buffer[offset] === 255 &&
-        buffer[offset + 1] === 255 &&
-        buffer[offset + 2] === 255 &&
-        buffer[offset + 3] === 255
-      ) {
-        hasWhitePixel = true;
-        break;
+    for (const buffer of [oneX, twoX]) {
+      let hasWhitePixel = false;
+      for (let offset = 0; offset + 3 < buffer.length; offset += 4) {
+        if (
+          buffer[offset] === 255 &&
+          buffer[offset + 1] === 255 &&
+          buffer[offset + 2] === 255 &&
+          buffer[offset + 3] === 255
+        ) {
+          hasWhitePixel = true;
+          break;
+        }
       }
+      expect(hasWhitePixel).toBe(false);
     }
-    expect(hasWhitePixel).toBe(false);
   });
 
   it("计数归零时恢复原始托盘底图", async () => {
@@ -156,6 +181,6 @@ describe("desktop tray unread badge", () => {
 
     mod.applyDesktopTrayUnreadBadge(1);
 
-    expect(state.createFromBitmapCalls).toHaveLength(1);
+    expect(state.representations).toHaveLength(2);
   });
 });

+ 321 - 0
packages/desktop/test/e2e/conversation-session/conversation-session-side-pane-full-view.test.ts

@@ -0,0 +1,321 @@
+import { join } from "node:path";
+import {
+  TID_SIDE_PANE_FULL_VIEW_ANSWER_BUBBLE,
+  TID_SIDE_PANE_FULL_VIEW_ANSWER_BUBBLE_CLOSE,
+  TID_SIDE_PANE_FULL_VIEW_BUBBLE,
+  TID_SIDE_PANE_FULL_VIEW_EXPAND,
+  TID_SIDE_PANE_FULL_VIEW_HEADER,
+  TID_SIDE_PANE_FULL_VIEW_HOST,
+  TID_SIDE_PANE_FULL_VIEW_MINIMIZE,
+  TID_SIDE_PANE_FULL_VIEW_RUNNING,
+  TID_SIDE_PANE_FULL_VIEW_TOGGLE,
+  TID_SIDE_PANE_TOGGLE,
+  TID_V4_COMPOSER_INPUT,
+  TID_V4_COMPOSER_SEND,
+  TID_WORKSPACE_HEADER,
+} from "@zcode/shared/test-ids";
+import { clearAppData } from "../helpers/desktop-app.js";
+import {
+  prepareV4ConversationE2E,
+  selectV4TaskById,
+  sendV4Prompt,
+  waitForV4AssistantMessageContaining,
+  waitForV4Pane,
+  waitForV4UserMessageContaining,
+} from "../helpers/v4-conversation.js";
+
+// spec:docs/ui/side-pane-full-view.md;用例:docs/testing/side-pane-tabs-e2e-case-catalog.md(SPFV-007/008)
+const SIDE_FRAME = '[data-workspace-side-frame="true"]';
+const HOST = `[data-testid="${TID_SIDE_PANE_FULL_VIEW_HOST}"]`;
+const FLOATING_INPUT = `${HOST}[data-side-pane-full-view-host="floating"] [data-testid="${TID_V4_COMPOSER_INPUT}"]`;
+const TAB = "[data-side-pane-tab-id]";
+const ELICITATION_BODY = '[data-elicitation-dialog-body="true"]';
+const RUNNING = `[data-testid="${TID_SIDE_PANE_FULL_VIEW_RUNNING}"]`;
+const ANSWER_BUBBLE = `${HOST} [data-testid="${TID_SIDE_PANE_FULL_VIEW_ANSWER_BUBBLE}"]`;
+const ANSWER_BUBBLE_OPEN = `${ANSWER_BUBBLE} > button:first-child`;
+const STREAM_WORKING_LABEL = `${HOST} [data-testid^="chat-assistant-history-trigger"] > span`;
+
+describe("Side Pane 完整视图浮窗(SPFV provider)", () => {
+  after(async () => {
+    await browser.electron.restoreAllMocks();
+    await clearAppData();
+  });
+
+  it("SPFV-E2E-007 浮窗发送消息,并按 session 记忆完整视图", async function () {
+    this.timeout(180_000);
+    await prepareV4ConversationE2E();
+    const runId = Date.now();
+
+    await sendV4Prompt(`E2E_SPFV_FIRST_${runId}: reply briefly.`);
+    await waitForV4AssistantMessageContaining("spfv-first-ok");
+    const sessionA = (
+      await waitForV4Pane(
+        (snapshot) => snapshot.sessionId !== null && snapshot.sessionId !== "draft",
+        "首条消息后没有绑定真实会话",
+      )
+    ).sessionId!;
+    await ensureSidePaneExpanded();
+    await ensureTerminalTab();
+    await $(`${SIDE_FRAME} [data-testid="${TID_SIDE_PANE_FULL_VIEW_TOGGLE}"]`).click();
+    await waitForHostMode("floating");
+
+    const floatingPrompt = `E2E_SPFV_FLOATING_SEND_${runId}: reply briefly.`;
+    await typeIntoFloatingComposer(floatingPrompt);
+    await browser.keys("Enter");
+    await waitForV4UserMessageContaining(`E2E_SPFV_FLOATING_SEND_${runId}`);
+    await waitForV4AssistantMessageContaining("spfv-floating-ok");
+    // 回答结束:浮窗上方弹出气泡,只有回答正文,没有图标与标题。
+    await waitForAnswerBubble("spfv-floating-ok");
+    expect(await $(`${ANSWER_BUBBLE_OPEN} svg`).isExisting()).toBe(false);
+    expect((await $(ANSWER_BUBBLE_OPEN).getText()).trim()).toBe("spfv-floating-ok");
+    // 默认吸附右下:气泡在浮窗上方。
+    const bubbleBottom = await browser.execute(
+      (selector) => document.querySelector(selector)?.getBoundingClientRect().bottom ?? -1,
+      ANSWER_BUBBLE,
+    );
+    const hostTop = await browser.execute(
+      (selector) => document.querySelector(selector)?.getBoundingClientRect().top ?? -1,
+      HOST,
+    );
+    expect(bubbleBottom).toBeLessThanOrEqual(hostTop);
+    await saveThemeScreenshots("spfv-answer-bubble");
+
+    // 完整视图隐藏左侧任务列表;切走会话走命令面板(⌘K → 新建任务),不依赖原生菜单 accelerator。
+    await realKeys(["Control", "k"]);
+    await $('[role="dialog"] [cmdk-input]').waitForDisplayed({ timeout: 10_000 });
+    await browser.keys("New task");
+    await browser.keys("Enter");
+    await waitForV4Pane((snapshot) => snapshot.sessionId === "draft", "命令面板新建任务失败");
+    await waitForHostMode("normal");
+    expect(await $(`[data-testid="${TID_WORKSPACE_HEADER}"]`).isExisting()).toBe(true);
+
+    await selectV4TaskById(sessionA);
+    await waitForHostMode("floating");
+    // 气泡只有 × 或点击才消失:切走再切回仍在;点气泡展开消息流并清除气泡。
+    await waitForAnswerBubble("spfv-floating-ok");
+    await $(ANSWER_BUBBLE_OPEN).click();
+    await browser.waitUntil(
+      async () =>
+        (await $(HOST).getAttribute("data-floating")) === "expanded" &&
+        !(await $(ANSWER_BUBBLE).isExisting()),
+      { timeout: 5_000, timeoutMsg: "点击气泡后没有展开消息流并清除气泡" },
+    );
+    // 展开有高度过渡,按钮仍在移动时点击会落到消息正文上;等宿主过渡结束再点。
+    await waitForHostTransitionsSettled();
+    await $(`[data-testid="${TID_SIDE_PANE_FULL_VIEW_EXPAND}"]`).click();
+    await browser.waitUntil(
+      async () => (await $(HOST).getAttribute("data-floating")) === "collapsed",
+      {
+        timeout: 5_000,
+        timeoutMsg: "收起消息流失败",
+      },
+    );
+    expect(await $(ANSWER_BUBBLE).isExisting()).toBe(false);
+  });
+
+  it("SPFV-E2E-008 最小化时出现 AskUserQuestion 会自动恢复浮窗并显示卡片", async function () {
+    this.timeout(180_000);
+    await waitForHostMode("floating");
+    const runId = Date.now();
+
+    await typeIntoFloatingComposer(`E2E_SPFV_ASK_${runId}: ask one question before continuing.`);
+    await browser.waitUntil(
+      () =>
+        browser.execute(
+          (hostSelector, sendTestId) =>
+            document.querySelector<HTMLButtonElement>(
+              `${hostSelector} [data-testid="${sendTestId}"]`,
+            )?.disabled === false,
+          HOST,
+          TID_V4_COMPOSER_SEND,
+        ),
+      { timeout: 30_000, timeoutMsg: "切回会话后浮窗发送按钮没有可用" },
+    );
+    await browser.keys("Enter");
+    await waitForV4UserMessageContaining(`E2E_SPFV_ASK_${runId}`);
+    // 运行中(问答请求还没到):焦点仍在浮窗,操作栏「⌃ / ⌄」右侧显示 loading。
+    await $(RUNNING).waitForDisplayed({ timeout: 10_000 });
+    // 占位文字显示「工作中 N 秒」,与流式消息里的运行时长同值同格式。
+    await browser.waitUntil(
+      () =>
+        browser.execute(
+          (inputSelector, labelSelector) => {
+            const placeholder =
+              document.querySelector(inputSelector)?.getAttribute("aria-placeholder") ?? "";
+            const label = [...document.querySelectorAll(labelSelector)].at(-1)?.textContent ?? "";
+            return /^(Working for|工作中) /.test(placeholder) && placeholder === label.trim();
+          },
+          FLOATING_INPUT,
+          STREAM_WORKING_LABEL,
+        ),
+      { timeout: 3_000, timeoutMsg: "运行中占位文字没有与流式消息的工作时长一致" },
+    );
+    // 回放把问答响应延迟 4s:用户消息出现后立刻最小化,请求在最小化期间到达。
+    await $(`[data-testid="${TID_SIDE_PANE_FULL_VIEW_MINIMIZE}"]`).click();
+    await browser.waitUntil(
+      async () =>
+        (await $(HOST).getAttribute("data-floating")) === "collapsed" &&
+        (await $(`${HOST} ${ELICITATION_BODY}`).isDisplayed()),
+      { timeout: 60_000, timeoutMsg: "问答请求没有让最小化浮窗恢复并显示卡片" },
+    );
+    expect(await $(`[data-testid="${TID_SIDE_PANE_FULL_VIEW_BUBBLE}"]`).isExisting()).toBe(false);
+
+    const option = await $(`${HOST} ${ELICITATION_BODY}`).$("button=Use default");
+    if (await option.isExisting()) {
+      await option.click();
+    }
+    await submitElicitation();
+    await waitForV4AssistantMessageContaining("spfv-ask-done");
+    await browser.waitUntil(async () => !(await $(`${HOST} ${ELICITATION_BODY}`).isExisting()), {
+      timeout: 30_000,
+      timeoutMsg: "提交回答后问答卡片没有消失",
+    });
+    await $(FLOATING_INPUT).waitForDisplayed({ timeout: 10_000 });
+    // 回答结束弹出新气泡;点 × 只清除气泡,浮窗保持收起。
+    await waitForAnswerBubble("spfv-ask-done");
+    await $(`[data-testid="${TID_SIDE_PANE_FULL_VIEW_ANSWER_BUBBLE_CLOSE}"]`).click();
+    await $(ANSWER_BUBBLE).waitForExist({ reverse: true, timeout: 5_000 });
+    expect(await $(HOST).getAttribute("data-floating")).toBe("collapsed");
+    // 回答完成后对话空闲:操作栏可见,但不再显示 loading。
+    await $(FLOATING_INPUT).click();
+    await $(`[data-testid="${TID_SIDE_PANE_FULL_VIEW_HEADER}"]`).waitForExist({ timeout: 5_000 });
+    await $(RUNNING).waitForExist({ reverse: true, timeout: 30_000 });
+  });
+});
+
+async function waitForHostTransitionsSettled() {
+  await browser.waitUntil(
+    () =>
+      browser.execute(
+        (selector) =>
+          (document.querySelector(selector)?.getAnimations() ?? []).every(
+            (animation) => animation.playState !== "running",
+          ),
+        HOST,
+      ),
+    { timeout: 5_000, timeoutMsg: "完整视图宿主的几何过渡没有结束" },
+  );
+}
+
+async function waitForAnswerBubble(text: string) {
+  await browser.waitUntil(
+    async () =>
+      (await $(ANSWER_BUBBLE).isDisplayed()) && (await $(ANSWER_BUBBLE).getText()).includes(text),
+    { timeout: 15_000, timeoutMsg: `回答气泡没有显示「${text}」` },
+  );
+}
+
+async function saveThemeScreenshots(name: string) {
+  const artifactDir = process.env.ZCODE_E2E_ARTIFACT_DIR;
+  if (!artifactDir) return;
+  for (const theme of ["zai-light", "zai-dark"]) {
+    await browser.execute((value) => {
+      const actions = (
+        window as typeof window & { __testActions?: { setTheme(theme: string): void } }
+      ).__testActions;
+      actions?.setTheme(value);
+    }, theme);
+    await browser.pause(300);
+    await browser.saveScreenshot(join(artifactDir, `${name}-${theme}.png`));
+  }
+}
+
+async function realKeys(keys: string[]) {
+  const isMac = await browser.execute(() => /Mac|iPhone|iPad/.test(navigator.userAgent));
+  const mapped = keys.map((key) => (key === "Control" && isMac ? "Command" : key));
+  await browser.keys(mapped as never);
+}
+
+async function waitForHostMode(mode: "normal" | "conversation" | "floating") {
+  await browser.waitUntil(
+    async () => (await $(HOST).getAttribute("data-side-pane-full-view-host")) === mode,
+    { timeout: 10_000, timeoutMsg: `完整视图宿主没有进入 ${mode}` },
+  );
+}
+
+async function typeIntoFloatingComposer(text: string) {
+  const input = await $(FLOATING_INPUT);
+  await input.waitForDisplayed({ timeout: 10_000 });
+  try {
+    await input.click();
+  } catch (error) {
+    const geometry = await browser.execute(
+      (hostSelector, inputSelector) => {
+        const rect = (selector: string) => {
+          const r = document.querySelector(selector)?.getBoundingClientRect();
+          return r
+            ? [Math.round(r.left), Math.round(r.top), Math.round(r.width), Math.round(r.height)]
+            : null;
+        };
+        const host = document.querySelector<HTMLElement>(hostSelector);
+        const inputRect = document.querySelector(inputSelector)?.getBoundingClientRect();
+        const hit = inputRect
+          ? document.elementFromPoint(
+              inputRect.left + inputRect.width / 2,
+              inputRect.top + inputRect.height / 2,
+            )
+          : null;
+        return {
+          host: rect(hostSelector),
+          style: host?.getAttribute("style"),
+          attrs: [host?.dataset.floating, host?.dataset.headerVisible],
+          input: rect(inputSelector),
+          hit: `${hit?.tagName}.${(hit?.className?.toString() ?? "").slice(0, 80)}`,
+          dialogs: document.querySelectorAll('[role="dialog"]').length,
+        };
+      },
+      HOST,
+      FLOATING_INPUT,
+    );
+    throw new Error(`浮窗输入框不可点击: ${JSON.stringify(geometry)}`, { cause: error });
+  }
+  await browser.keys(text);
+  await browser.waitUntil(async () => (await input.getText()).includes(text.slice(0, 20)), {
+    timeout: 5_000,
+    timeoutMsg: "浮窗输入框没有写入文字",
+  });
+}
+
+async function submitElicitation() {
+  const clicked = await browser.execute((hostSelector) => {
+    const footer = document.querySelector<HTMLElement>(
+      `${hostSelector} [data-elicitation-dialog-footer="true"]`,
+    );
+    const button = Array.from(footer?.querySelectorAll<HTMLButtonElement>("button") ?? []).find(
+      (candidate) => ["Submit", "提交"].includes((candidate.textContent ?? "").trim()),
+    );
+    button?.click();
+    return Boolean(button);
+  }, HOST);
+  expect(clicked).toBe(true);
+}
+
+async function ensureSidePaneExpanded() {
+  const isExpanded = () =>
+    browser.execute((frameSelector) => {
+      const panel = document.querySelector(frameSelector)?.parentElement;
+      return Boolean(
+        panel &&
+        panel.getBoundingClientRect().width > 100 &&
+        getComputedStyle(panel).opacity === "1",
+      );
+    }, SIDE_FRAME);
+  if (await isExpanded()) return;
+  const toggle = await $(
+    `[data-testid="${TID_WORKSPACE_HEADER}"] [data-testid="${TID_SIDE_PANE_TOGGLE}"]`,
+  );
+  await toggle.waitForClickable({ timeout: 10_000 });
+  await toggle.click();
+  await browser.waitUntil(isExpanded, { timeout: 10_000, timeoutMsg: "Side Pane 未实际展开" });
+}
+
+async function ensureTerminalTab() {
+  if ((await $$(TAB).length) > 0) return;
+  const launcher = await $('[data-side-pane-open-tab-item="terminal"]');
+  await launcher.waitForClickable({ timeout: 10_000 });
+  await launcher.click();
+  await browser.waitUntil(async () => (await $$(TAB).length) === 1, {
+    timeout: 10_000,
+    timeoutMsg: "Terminal tab 没有打开",
+  });
+}

+ 22 - 0
packages/desktop/test/e2e/conversation-session/conversation-session-v4-composer-toolbar.test.ts

@@ -362,6 +362,28 @@ describe("v4 M5 门禁:composer 工具条与 slash 候选面板", () => {
     const cfg = await getV4ModelConfig();
     expect(cfg.provider).toBe(UPSTREAM_PROVIDER_ID);
 
+    // 选模型后保留合并菜单,便于继续调档;重复选当前模型也不收起。
+    for (const selected of [false, true]) {
+      await openComposerPicker("model");
+      const option = $(
+        `[data-testid^="chat-model-select-item-"]${selected ? '[data-checked="true"]' : ':not([data-checked="true"])'}:not([data-model-option-locked])`,
+      );
+      await option.waitForClickable({ timeout: 15000 });
+      const value = (await option.getAttribute("data-testid"))!.slice(
+        "chat-model-select-item-".length,
+      );
+      await option.click();
+      await waitForOnlyComposerPickerOpen("model", selected ? "重复选择当前模型" : "选择其他模型");
+      await browser.waitUntil(
+        async () =>
+          (await $(`[data-testid="${TID_CHAT_MODEL_SELECT_TRIGGER}"]`).getAttribute(
+            "data-model-current-value",
+          )) === value,
+        { timeout: 15000 },
+      );
+      await closeComposerPicker();
+    }
+
     // 只点击 Provider,不补点 Model:必须直接更新同一 Composer 草稿并同步有效档位。
     await openComposerPicker("model");
     await $('[data-testid="composer-provider-trigger"]').click();

+ 35 - 6
packages/desktop/test/e2e/conversation-session/manual-review/pending/conversation-session-archive-management.test.ts

@@ -143,7 +143,7 @@ describe("归档管理", () => {
     expect(await confirmation.getText()).toContain("只删除当前确认范围内的会话。");
     await browser.keys("Escape");
   });
-  it("ARM07:自动归档设置仅在归档管理展示,修改落盘且刷新保留", async () => {
+  it("ARM07:默认 30 天,关闭时可先保存时长,开启与刷新保留选择", async () => {
     await $('[data-testid="settings-section-nav-general"]').click();
     expect(await $('//*[normalize-space(text())="自动归档旧会话"]').isExisting()).toBe(false);
     expect(await $('//*[normalize-space(text())="归档保留时长"]').isExisting()).toBe(false);
@@ -151,8 +151,8 @@ describe("归档管理", () => {
     const toggle = $('[data-testid="archive-auto-archive-switch"]');
     const days = $('[data-testid="archive-auto-archive-days"]');
     await expect(toggle).toHaveAttribute("aria-checked", "false");
-    await expect(days).toBeDisabled();
-    await expect(days).toHaveText("7 天后归档");
+    await expect(days).toBeEnabled();
+    await expect(days).toHaveText("30 天后归档");
     const placement = await browser.execute(() => ({
       settingsBottom: document
         .querySelector('[data-testid="archive-auto-archive-days"]')!
@@ -161,8 +161,29 @@ describe("归档管理", () => {
         .top,
     }));
     expect(placement.settingsBottom).toBeLessThan(placement.listTop);
-    await toggle.click();
+    // 先保存时长再开启,避免开关一开就按旧阈值归档。
+    await days.click();
+    await $('[role="option"]*=7 天后归档').click();
+    await expect(days).toHaveText("7 天后归档");
+    await browser.waitUntil(async () => {
+      const settings = JSON.parse(await readFile(join(home, ".zcode/v2/setting.json"), "utf8"));
+      return (
+        settings.taskAutoArchiveEnabled === false && settings.taskAutoArchiveOlderThanDays === 7
+      );
+    });
+    await browser.refresh();
+    await waitForWorkspaceApp(DEFAULT_WORKSPACE, 45000);
+    await $('[data-testid="task-settings-button"]').click();
+    await $('[data-testid="settings-section-nav-archives"]').click();
+    await expect(toggle).toHaveAttribute("aria-checked", "false");
     await expect(days).toBeEnabled();
+    await expect(days).toHaveText("7 天后归档");
+    await toggle.click();
+    await expect(toggle).toHaveAttribute("aria-checked", "true");
+    expect(JSON.parse(await readFile(join(home, ".zcode/v2/setting.json"), "utf8"))).toMatchObject({
+      taskAutoArchiveEnabled: true,
+      taskAutoArchiveOlderThanDays: 7,
+    });
     await days.click();
     await $('[role="option"]*=14 天后归档').click();
     await expect(days).toHaveText("14 天后归档");
@@ -179,14 +200,22 @@ describe("归档管理", () => {
     await expect(toggle).toHaveAttribute("aria-checked", "true");
     await expect(days).toHaveText("14 天后归档");
     await toggle.click();
-    await expect(days).toBeDisabled();
+    await expect(toggle).toHaveAttribute("aria-checked", "false");
+    await expect(days).toBeEnabled();
     await expect(days).toHaveText("14 天后归档");
+    await days.click();
+    await $('[role="option"]*=30 天后归档').click();
+    await expect(days).toHaveText("30 天后归档");
     await browser.waitUntil(async () => {
       const settings = JSON.parse(await readFile(join(home, ".zcode/v2/setting.json"), "utf8"));
       return (
-        settings.taskAutoArchiveEnabled === false && settings.taskAutoArchiveOlderThanDays === 14
+        settings.taskAutoArchiveEnabled === false && settings.taskAutoArchiveOlderThanDays === 30
       );
     });
+    expect(ids.map((id) => readRow(id).archived)).toEqual(ids.map(() => 1));
+    await browser.saveScreenshot(
+      join(process.env.ZCODE_E2E_ARTIFACT_DIR!, "ARM07-disabled-30-days.png"),
+    );
   });
   it("ARM01/05/06:分组折叠、搜索、时间排序和项目选择", async () => {
     expect(await $$('[data-testid="archive-group"]').length).toBe(4);

+ 52 - 5
packages/desktop/test/e2e/conversation-session/manual-review/pending/conversation-session-dynamic-workflow-gray-disabled.test.ts

@@ -1,6 +1,8 @@
 import { readFile } from "node:fs/promises";
-import { clearAppData } from "../../../helpers/desktop-app.js";
-import { prepareV4ConversationE2E } from "../../../helpers/v4-conversation.js";
+import { TID_SETTINGS_DYNAMIC_WORKFLOW_MODE_ITEM } from "@zcode/shared";
+import { testId } from "@zcode/shared/test-ids";
+import { clearAppData, readSettings, waitForTestIdByDom } from "../../../helpers/desktop-app.js";
+import { prepareV4ConversationE2E, startNewV4Draft } from "../../../helpers/v4-conversation.js";
 import {
   AUTOMATIONS_CONTENT_SELECTOR,
   PLUS_GOAL_OPTION_ID,
@@ -13,17 +15,21 @@ import {
   expectTestIdAbsentThroughout,
   hasTestIdInDom,
   openAutomationsPage,
+  openDynamicWorkflowModeSelect,
   openGeneralSettings,
   openPlusMenu,
   openSlashPanelWithCatalogReady,
   readDynamicWorkflowGrayMockStatus,
+  readDynamicWorkflowModeTriggerText,
   readPlusMenuAddOptionIds,
+  selectDynamicWorkflowMode,
   setComposerDraft,
 } from "../../../helpers/dynamic-workflow-gray.js";
-import { TID_SETTINGS_DYNAMIC_WORKFLOW_MODE_TRIGGER } from "@zcode/shared";
+import { sel } from "../../../helpers/selectors.js";
 
 // DWG-08(disabled 档):服务端 /client/configs 不下发 dynamicWorkflow key,
 // 三个入口必须同时消失——`+` 菜单的「工作流」、`/` 面板的 workflow、自动化页的「工作流」标签。
+// DWG-23(disabled 档):服务端只给默认值,设置 › 常规的模式行照样出现,用户选「始终开启」后入口回来。
 // 服务端形状由 dynamic-workflow-config-mock-server.ts 按本文件名选档;
 // 契约见 docs/dynamic-workflow/launch.md「Gray release: the `dynamicWorkflow` feature key」。
 // E2E_DWF_GRAY:只读入口,不发送 prompt;空 provider fixture 是有意的合同。
@@ -76,9 +82,50 @@ describe("动态工作流灰度未命中(disabled)", () => {
     expect(await hasTestIdInDom(automationsPageTabTestId("workflow"))).toBe(false);
     expect(await hasTestIdInDom(automationsPageTabTestId("automation"))).toBe(false);
     await expectTestIdAbsentThroughout(automationsPageTabTestId("workflow"));
+  });
+
+  it("DWG-23 默认关闭时设置行照样出现,选「始终开启」后工作流入口回来", async function () {
+    this.timeout(240000);
 
-    // 4) DWG-23:服务端未提供时,设置 › 常规里没有动态工作流模式行,灰度对用户不可见。
+    // 1) 设置 › 常规:服务端没下发 key,行仍在,显示「关闭」,「默认」标签只在「关闭」上。
     await openGeneralSettings();
-    await expectTestIdAbsentThroughout(TID_SETTINGS_DYNAMIC_WORKFLOW_MODE_TRIGGER);
+    await browser.waitUntil(
+      async () => (await readDynamicWorkflowModeTriggerText()).includes("关闭"),
+      { timeout: 30000, timeoutMsg: "服务端默认关闭时动态工作流模式行没有出现或没有显示「关闭」" },
+    );
+    await openDynamicWorkflowModeSelect();
+    const itemText = (mode: string) =>
+      $(sel(testId(TID_SETTINGS_DYNAMIC_WORKFLOW_MODE_ITEM, mode))).getText();
+    expect(await itemText("disabled")).toContain("默认");
+    expect(await itemText("onDemand")).not.toContain("默认");
+    expect(await itemText("alwaysOn")).not.toContain("默认");
+    await browser.keys("Escape");
+
+    // 2) 选「始终开启」:不等于默认值,所以原样写进设置文件。
+    await selectDynamicWorkflowMode("alwaysOn");
+    await browser.waitUntil(async () => (await readSettings()).dynamicWorkflowMode === "alwaysOn", {
+      timeout: 15000,
+      timeoutMsg: "选择「始终开启」没有写进设置文件",
+    });
+
+    // 3) 自动化页恢复「工作流」切换:renderer 快照已按用户选择重读。
+    await openAutomationsPage();
+    await waitForTestIdByDom(automationsPageTabTestId("workflow"), {
+      timeout: 30000,
+      timeoutMsg: "选「始终开启」后自动化页没有出现「工作流」切换",
+    });
+
+    // 4) 新草稿的 + 菜单出现「工作流」:Host 已按用户选择给 CLI 重发 enabled:true 的策略。
+    await startNewV4Draft();
+    await setComposerDraft("");
+    await browser.waitUntil(
+      async () => {
+        await openPlusMenu();
+        const ids = await readPlusMenuAddOptionIds();
+        await closePlusMenu();
+        return ids.includes(PLUS_GOAL_OPTION_ID) && ids.includes(PLUS_WORKFLOW_OPTION_ID);
+      },
+      { timeout: 30000, timeoutMsg: "选「始终开启」后新草稿的 + 菜单仍没有工作流" },
+    );
   });
 });

+ 16 - 2
packages/desktop/test/e2e/conversation-session/manual-review/pending/conversation-session-project-upgrade-order.test.ts

@@ -1,8 +1,10 @@
 import { join } from "node:path";
 import { DatabaseSync } from "node:sqlite";
 import { waitForWorkspaceApp, DEFAULT_WORKSPACE } from "#e2e/helpers/desktop-app";
+import { loginWithApiKey } from "#e2e/helpers/conversation-session";
 import {
   SAVED_PROJECT_NAMES,
+  MIGRATED_REMOTE_NAME,
   LEGACY_PINNED_TASK_IDS,
   CURRENT_IMPORTED_TASK_ID,
 } from "#e2e/helpers/project-upgrade-order-fixture";
@@ -11,7 +13,7 @@ describe("虚拟项目升级顺序", () => {
   it("VP28:仅迁移旧设置保留的项目,历史任务不建项目,刷新保留", async function () {
     this.timeout(90_000);
     await waitForWorkspaceApp(DEFAULT_WORKSPACE, 45_000);
-    const expected = ["ZCodeProject", ...SAVED_PROJECT_NAMES];
+    const expected = ["ZCodeProject", MIGRATED_REMOTE_NAME, ...SAVED_PROJECT_NAMES];
     const readNames = () =>
       browser.execute(() =>
         [...document.querySelectorAll('[data-testid="project-section"] [data-project-name]')].map(
@@ -32,6 +34,7 @@ describe("虚拟项目升级顺序", () => {
       expect(db.prepare("SELECT id FROM schema_migration").all()).toEqual([
         { id: "0005_projects" },
         { id: "0006_default_workspace_tasks" },
+        { id: "0007_initial_workspace_order" },
       ]);
       expect(
         db
@@ -98,7 +101,10 @@ describe("虚拟项目升级顺序", () => {
           .prepare("SELECT name FROM projects WHERE deleted=0 ORDER BY position")
           .all()
           .map((row) => row.name),
-      ).toEqual(expected);
+      ).toEqual(expected.filter((name) => name !== MIGRATED_REMOTE_NAME));
+      expect(
+        db.prepare("SELECT cached_name,initial_position FROM remote_project_entries").all(),
+      ).toEqual([{ cached_name: MIGRATED_REMOTE_NAME, initial_position: 1 }]);
     } finally {
       db.close();
     }
@@ -107,6 +113,14 @@ describe("虚拟项目升级顺序", () => {
     );
     await browser.refresh();
     try {
+      // 隔离夹具无账号登录态;刷新可能回欢迎页,复用真实登录步骤后再检查顺序。
+      const login = $('[data-testid="login-use-api-key-button"]');
+      await browser.waitUntil(
+        async () =>
+          (await login.isExisting()) || (await $('[data-project-name="empty-saved"]').isExisting()),
+        { timeout: 45_000 },
+      );
+      if (await login.isExisting()) await loginWithApiKey();
       await $('[data-project-name="empty-saved"]').waitForExist({ timeout: 45_000 });
     } catch (error) {
       await browser.saveScreenshot(

+ 29 - 1
packages/desktop/test/e2e/conversation-session/manual-review/pending/conversation-session-r3-daemon-detached.test.ts

@@ -31,15 +31,17 @@ const artifactDir = resolve(
 
 describe(`${CASE_MARKER}: 无 user service manager 目标的 daemon 生命周期`, () => {
   let provider: SSHLifecycleProvider | null = null;
+  let restoreRemoteEnvironment: (() => Promise<void>) | undefined;
 
   after(async () => {
+    await restoreRemoteEnvironment?.();
     await provider?.tunnel.close().catch(() => undefined);
     provider = null;
     await browser.electron.restoreAllMocks();
     await clearAppData();
   });
 
-  it("R3A-BLD-07 detached daemon:断开不杀 daemon,daemon 消失后重连由 ensureDaemon 拉起", async function () {
+  it("R3A-BLD-07 detached daemon:断开不杀 daemon,离线探测被跳过时重连仍能拉起", async function () {
     this.timeout(30 * 60_000);
     const prepared = await prepareSSHLifecycle(CASE_MARKER);
     provider = prepared.provider;
@@ -106,6 +108,32 @@ describe(`${CASE_MARKER}: 无 user service manager 目标的 daemon 生命周期
     expect(daemonGone.stdout.trim()).toBe("gone");
     facts.daemonAfterKill = daemonGone.stdout.trim();
 
+    // Bug 原因:systemd offline 会跳过探测并返回 0;旧代码误判可用,在 enable --now 报 user bus 错误。
+    // 在独立 SSH 目标的非交互 shell 注入真实 offline 环境,不替换 systemctl 或伪造探测结果。
+    const fixtureRoot = `'${`${workspaceA}/.zcode-e2e/${CASE_MARKER}`.replaceAll("'", "'\\''")}'`;
+    const backup = `${fixtureRoot}/bashrc.original`;
+    const setup = await runSSHCommand(
+      prepared.config,
+      `mkdir -p ${fixtureRoot} && test ! -e ${backup} && cp -p "$HOME/.bashrc" ${backup}`,
+    );
+    expect(setup.code).toBe(0);
+    restoreRemoteEnvironment = async () => {
+      const restored = await runSSHCommand(prepared.config, `mv ${backup} "$HOME/.bashrc"`);
+      expect(restored.code).toBe(0);
+    };
+    const configured = await runSSHCommand(
+      prepared.config,
+      `{ printf '%s\\n' 'export SYSTEMD_OFFLINE=1'; cat ${backup}; } > ${fixtureRoot}/bashrc.offline && mv ${fixtureRoot}/bashrc.offline "$HOME/.bashrc"`,
+    );
+    expect(configured.code).toBe(0);
+    const skippedProbe = await runSSHCommand(
+      prepared.config,
+      'test "$SYSTEMD_OFFLINE" = 1 && test "${ZCODE_SERVER_SKIP_SERVICE_REGISTRATION-}" != 1 && systemctl --user show --property=Version',
+    );
+    expect(skippedProbe.code).toBe(0);
+    expect(skippedProbe.stdout.trim()).toBe("");
+    facts.skippedProbe = skippedProbe;
+
     // 3. 用户点击重连:ensureDaemon 必须拉起全新 Supervisor/Core 并恢复 workspace。
     // 用户显式断开的是设备,恢复入口是设备行的"重连"按钮(与冷恢复 case 的合同一致)。
     await reconnectRemoteProject(taskA.identity, CASE_MARKER);

+ 19 - 3
packages/desktop/test/e2e/conversation-session/manual-review/pending/conversation-session-r3-install-environment.test.ts

@@ -21,7 +21,7 @@ const CASE_MARKER = "E2E_R3_INSTALL_ENVIRONMENT";
 const artifactDir = resolve(
   process.env.ZCODE_E2E_ARTIFACT_DIR ?? ".e2e-artifacts/r3-install-environment",
 );
-type InstallEnvironmentCase = "noexec-tmp" | "no-tar" | "no-forwarding";
+type InstallEnvironmentCase = "noexec-tmp" | "no-tar" | "no-forwarding" | "old-glibc";
 const SUBCASE = (process.env.R3_INSTALL_ENV_CASE ?? "") as InstallEnvironmentCase;
 
 async function readRemoteFacts(config: SSHConnectionConfig) {
@@ -31,6 +31,8 @@ async function readRemoteFacts(config: SSHConnectionConfig) {
       'echo "forwarding=$(grep -iE "^AllowTcpForwarding" /etc/ssh/sshd_config | tail -n1)"; ' +
       'echo "current=$(test -f "$HOME/.zcode/server/current.json" && grep -o \'"archiveSha256": *"[0-9a-f]*"\' "$HOME/.zcode/server/current.json" || echo none)"; ' +
       'echo "staging=$(ls -d "$HOME"/.zcode/server/staging* "$HOME"/.zcode/server/bootstrap* 2>/dev/null | tr "\\n" ",")"; ' +
+      'echo "serverRoot=$(ls -A "$HOME/.zcode/server" 2>/dev/null | tr "\\n" ",")"; ' +
+      'echo "libc=$(getconf GNU_LIBC_VERSION 2>/dev/null || echo none)"; ' +
       'echo "tmpEntries=$(ls /tmp 2>/dev/null | tr "\\n" ",")"; echo "status=$(cat "$HOME/.zcode/server/run/status.json" 2>/dev/null | tr -d "\\n ")"',
   );
   return Object.fromEntries(
@@ -88,8 +90,10 @@ describe(`${CASE_MARKER}: 受限远端环境下的安装与连接(${SUBCASE}
 
   it(`R3A-BLD-09/CON-06 ${SUBCASE}`, async function () {
     this.timeout(20 * 60_000);
-    if (!["noexec-tmp", "no-tar", "no-forwarding"].includes(SUBCASE)) {
-      throw new Error(`${CASE_MARKER}: R3_INSTALL_ENV_CASE 必须为 noexec-tmp|no-tar|no-forwarding`);
+    if (!["noexec-tmp", "no-tar", "no-forwarding", "old-glibc"].includes(SUBCASE)) {
+      throw new Error(
+        `${CASE_MARKER}: R3_INSTALL_ENV_CASE 必须为 noexec-tmp|no-tar|no-forwarding|old-glibc`,
+      );
     }
     const config = readSSHRuntimeConfig(CASE_MARKER);
     const before = await readRemoteFacts(config);
@@ -130,6 +134,18 @@ describe(`${CASE_MARKER}: 受限远端环境下的安装与连接(${SUBCASE}
       expect(after.current).toBe("none");
       return;
     }
+    if (SUBCASE === "old-glibc") {
+      // ZCT-2112008575366098944:glibc 低于 archive 内置 Node 的 2.28 下限时,probe 按环境检查失败;
+      // 不弹安装确认、不上传 archive、不在 Server root 建 staging。
+      expect(before.libc).toBe("glibc 2.17");
+      expect(outcome.ready).toBe(false);
+      expect(outcome.errorText).toMatch(/环境|environment/iu);
+      expect(outcome.connectionLog).toContain("glibc 2.17");
+      expect(outcome.connectionLog).not.toMatch(/Uploading|上传/u);
+      expect(after.current).toBe("none");
+      expect(after.serverRoot).toBe("");
+      return;
+    }
     // 主规格与 Transport Adapter 明确支持 direct-tcpip 被禁后回退 proxy-stdio。
     // 任意非空错误不能算通过;必须证明安装、握手、目录 RPC 和项目绑定都成功。
     expect((before.forwarding ?? "").toLowerCase()).toContain("allowtcpforwarding no");

+ 141 - 8
packages/desktop/test/e2e/conversation-session/manual-review/pending/conversation-session-r3-subagent.test.ts

@@ -2,27 +2,44 @@ import { mkdir, writeFile } from "node:fs/promises";
 import { resolve } from "node:path";
 import {
   TID_CHAT_ASSISTANT_HISTORY_TRIGGER,
+  TID_TASK_ITEM,
+  testId,
   TID_V4_SESSION_PANE,
   TID_V4_RETRY_SUBSCRIBE,
   TID_V4_SUBAGENT_OPEN_SIDE_PANE,
   TID_V4_STOP,
+  TID_V4_COMPOSER_INPUT,
+  TID_V4_COMPOSER_SEND,
 } from "@zcode/shared/test-ids";
 import { clearAppData } from "../../../helpers/desktop-app.js";
 import {
   getUpstreamRequestRecordCount,
+  getUpstreamRequestEvidence,
   waitForUpstreamRequest,
 } from "../../../helpers/conversation-session-network.js";
 import {
   connectSSHWorkspaceAndSendFirstTurn,
   listRemoteAgentProcesses,
-  prepareSSHLifecycle,
+  SSH_LIFECYCLE_MODEL_ID,
   type SSHLifecycleProvider,
 } from "../../../helpers/ssh-remote-lifecycle.js";
-import { readRemoteTabSnapshot, runSSHCommand } from "../../../helpers/ssh-remote-p0.js";
 import {
+  seedCustomAnthropicMessagesProvider,
+  refreshSeededOpenAIProvidersThroughSettings,
+} from "../../../helpers/custom-openai-provider.js";
+import {
+  createSSHReplayTunnel,
+  readHostProcesses,
+  readRemoteTabSnapshot,
+  readSSHRuntimeConfig,
+  runSSHCommand,
+} from "../../../helpers/ssh-remote-p0.js";
+import {
+  approveV4Permission,
   clickV4StopInPane,
   getV4ConfigProjection,
   getV4ConversationState,
+  prepareV4ConversationE2E,
   sendV4Prompt,
   sendV4PromptAndWaitAccepted,
   switchV4Mode,
@@ -32,6 +49,8 @@ import {
 } from "../../../helpers/v4-conversation.js";
 
 const CASE_MARKER = "E2E_R3_SUBAGENT";
+// 远端用例前置:Server 启动时设置 ZCODE_DYNAMIC_WORKFLOW_MODE=alwaysOn;WDIO 也为本文件开启。
+// 常驻 Server 不继承客户端环境;本用例验证会话归属,灰度另有专用用例。
 const artifactDir = resolve(process.env.ZCODE_E2E_ARTIFACT_DIR ?? ".e2e-artifacts/r3-subagent");
 const REMOTE_RELEASE_DIR = "/home/dev/r3-workspace-a/.zcode-e2e/r3-subagent";
 const REMOTE_RELEASE_FILE = `${REMOTE_RELEASE_DIR}/release-child`;
@@ -77,7 +96,7 @@ async function readPanes(): Promise<
   );
 }
 
-describe(`${CASE_MARKER}: 远端 task 的子 Agent 会话:打开、继续观察、父 task 停止`, () => {
+describe(`${CASE_MARKER}: 远端 Agent、工作流 actor 与辅助对话的项目归属`, () => {
   let provider: SSHLifecycleProvider | null = null;
   const facts: Record<string, unknown> = {};
 
@@ -90,13 +109,35 @@ describe(`${CASE_MARKER}: 远端 task 的子 Agent 会话:打开、继续观
     await clearAppData();
   });
 
-  it("R3A-TASK-06 子会话与父 task 同 Source、独立 session;从 Agent 行打开子会话;父 task 停止后父/子状态收口", async function () {
+  it("R3A-TASK-06 子会话与父 task 同 Source、独立 session;从 Agent 行打开子会话;父 task 停止后父/子状态收口;工作流 actor 可读、辅助对话可续发", async function () {
     this.timeout(30 * 60_000);
-    const prepared = await prepareSSHLifecycle(CASE_MARKER, {
-      apiType: "anthropic-messages",
-      tunnelUsername: "tunnel",
+    expect(await browser.electron.execute(() => process.env.ZCODE_DYNAMIC_WORKFLOW_MODE)).toBe(
+      "alwaysOn",
+    );
+    const prepared = { config: readSSHRuntimeConfig(CASE_MARKER) };
+    await prepareV4ConversationE2E({ skipProvider: true });
+    expect(await readHostProcesses()).toHaveLength(1);
+    const tunnel = await createSSHReplayTunnel(prepared.config, CASE_MARKER, {
+      username: "tunnel",
+    });
+    provider = { id: "", name: "", tunnel };
+    Object.assign(
+      provider,
+      await seedCustomAnthropicMessagesProvider({
+        baseURL: `${tunnel.baseURL}/anthropic`,
+        modelId: SSH_LIFECYCLE_MODEL_ID,
+        providerId: `e2e-ssh-remote-lifecycle-${Date.now()}`,
+        providerName: "SSH workflow lifecycle",
+      }),
+    );
+    // 主/子模型在同一次刷新、首连同步前配置,确保远端 Agent 启动时拥有完整 provider 配置。
+    await seedCustomAnthropicMessagesProvider({
+      baseURL: `${provider.tunnel.baseURL}/anthropic`,
+      modelId: "GLM-5.3",
+      providerId: "e2e-workflow-actors",
+      providerName: "Workflow actors",
     });
-    provider = prepared.provider;
+    await refreshSeededOpenAIProvidersThroughSettings([provider.name, "Workflow actors"]);
     const [workspaceA] = prepared.config.workspacePaths;
     await runSSHCommand(
       prepared.config,
@@ -335,5 +376,97 @@ describe(`${CASE_MARKER}: 远端 task 的子 Agent 会话:打开、继续观
       },
     );
     expect(await childPane.$(`[data-testid="${TID_V4_RETRY_SUBSCRIBE}"]`).isExisting()).toBe(false);
+
+    // 同一远端项目里的工作流 actor 没有 tasks 行,必须沿真实 CLI 父链打开正文。
+    await sendV4Prompt("/workflow E2E_R3_WORKFLOW_START");
+    await approveV4Permission();
+    await waitForV4TimelineContaining("R3_WORKFLOW_STARTED", 120_000);
+    await browser.waitUntil(
+      async () =>
+        browser.execute(() => {
+          const pill = document.querySelector<HTMLElement>(
+            '[data-testid="workflow-agent-pill"][data-agent-open="true"][data-agent-status="done"]',
+          );
+          if (!pill) return false;
+          pill.click();
+          return true;
+        }),
+      { timeout: 120_000, timeoutMsg: "工作流 actor 没有完成或没有详情入口" },
+    );
+    let actorSessionId = "";
+    await browser.waitUntil(
+      async () => {
+        const actor = (await readPanes()).find((pane) => pane.sessionId?.startsWith("sess_dwf-"));
+        actorSessionId = actor?.sessionId ?? "";
+        return Boolean(actor?.projectionSeq && actor.rowCount > 0 && !actor.subscriptionFailed);
+      },
+      { timeout: 30_000, timeoutMsg: "远端工作流 actor 详情没有加载" },
+    );
+    const actorPane = $(`[data-session-id="${actorSessionId}"]`);
+    expect(await actorPane.getText()).toContain("R3_WORKFLOW_CHILD_DONE");
+    expect(await actorPane.$(`[data-testid="${TID_V4_COMPOSER_INPUT}"]`).isExisting()).toBe(false);
+    const actorRequests = await getUpstreamRequestEvidence({
+      lastUserMessageIncludes: ["E2E_R3_WORKFLOW_CHILD"],
+    });
+    expect(
+      actorRequests.some(
+        (request) => (request.requestJson as { model?: string })?.model === "GLM-5.3",
+      ),
+    ).toBe(true);
+    facts.workflowActor = { actorSessionId, model: "GLM-5.3", panes: await readPanes() };
+
+    // 辅助对话也继承项目,但保留用户输入;不能跟工作流一起被设为只读。
+    await sendV4Prompt("/side E2E_R3_SIDE_CHAT");
+    let sideSessionId = "";
+    await browser.waitUntil(
+      async () => {
+        const pane = (await readPanes()).find(
+          (entry) =>
+            entry.sessionId !== taskA.taskId &&
+            entry.sessionId !== childSessionId &&
+            entry.sessionId !== actorSessionId &&
+            Boolean(entry.projectionSeq) &&
+            !entry.subscriptionFailed,
+        );
+        if (!pane?.paneTestId || !pane.sessionId) return false;
+        sideSessionId = pane.sessionId;
+        return (await $(`[data-session-id="${sideSessionId}"]`).getText()).includes(
+          "R3_SIDE_CHAT_DONE",
+        );
+      },
+      { timeout: 60_000, timeoutMsg: "远端辅助对话未打开或无法发送" },
+    );
+    // 辅助对话直接挂载 SessionPane,没有分屏的 pane shell;在真实输入框中键入续发。
+    const sidePane = $(`[data-session-id="${sideSessionId}"]`);
+    const sideInput = sidePane.$(`[data-testid="${TID_V4_COMPOSER_INPUT}"]`);
+    await browser.waitUntil(
+      async () => (await sideInput.getAttribute("contenteditable")) === "true",
+      { timeout: 15_000, timeoutMsg: "辅助对话输入框不可编辑" },
+    );
+    await sideInput.click();
+    await browser.keys("E2E_R3_SIDE_FOLLOWUP");
+    await browser.waitUntil(async () => (await sideInput.getText()) === "E2E_R3_SIDE_FOLLOWUP", {
+      timeout: 15_000,
+      timeoutMsg: "辅助对话续发内容没有进入输入框",
+    });
+    const sideSend = sidePane.$(`[data-testid="${TID_V4_COMPOSER_SEND}"]`);
+    await sideSend.waitForClickable();
+    await sideSend.click();
+    await browser.waitUntil(
+      async () =>
+        (await $(`[data-session-id="${sideSessionId}"]`).getText()).includes(
+          "R3_SIDE_FOLLOWUP_DONE",
+        ),
+      { timeout: 60_000, timeoutMsg: "辅助对话续发未完成" },
+    );
+    facts.selectionSideChat = { sideSessionId, panes: await readPanes() };
+    expect(await $(`[data-testid="${testId(TID_TASK_ITEM, taskA.taskId)}"]`).isExisting()).toBe(
+      true,
+    );
+    for (const hiddenId of [childSessionId, actorSessionId, sideSessionId]) {
+      expect(await $(`[data-testid="${testId(TID_TASK_ITEM, hiddenId)}"]`).isExisting()).toBe(
+        false,
+      );
+    }
   });
 });

+ 86 - 6
packages/desktop/test/e2e/conversation-session/manual-review/pending/conversation-session-remote-device-cards.test.ts

@@ -1,6 +1,9 @@
 import { mkdir } from "node:fs/promises";
 import { resolve } from "node:path";
 import { createServer } from "node:net";
+import { buildRemoteHostWorkspaceIdentity, ServiceChannels } from "@zcode/shared";
+import type { RemoteProjectDirectory } from "@zcode/services";
+import { callHandoffHost, installHandoffRpcProbe } from "#e2e/helpers/remote-project-handoff-probe";
 import {
   TID_CONFIRM_DIALOG_CONFIRM,
   TID_REMOTE_KIND_SSH,
@@ -23,6 +26,7 @@ import {
   selectSSHRemoteDirectory,
   waitForSSHDirectoryStep,
   waitForSSHError,
+  waitForRemoteTab,
 } from "../../../helpers/ssh-remote-p0.js";
 
 const CASE_MARKER = "E2E_REMOTE_DEVICE_CARDS";
@@ -68,6 +72,83 @@ describe(`${CASE_MARKER}: 设置设备卡与未完成连接`, () => {
     await waitForSSHDirectoryStep(CASE_MARKER);
     await selectSSHRemoteDirectory(config.workspacePaths[0], CASE_MARKER);
     await waitForWorkspaceApp(config.workspacePaths[0], 120_000);
+    await installHandoffRpcProbe();
+    const originalDirectory = await callHandoffHost<RemoteProjectDirectory>(
+      ServiceChannels.RemoteProjects,
+      "readDirectory",
+    );
+    const original = originalDirectory.entries.find((entry) =>
+      entry.roots.some((root) => root.rootPath === config.workspacePaths[0]),
+    );
+    if (!original?.projectId) throw new Error(`${CASE_MARKER}: 缺少原项目身份`);
+    const identity = buildRemoteHostWorkspaceIdentity(original.hostId, config.workspacePaths[0]);
+    const openRecentProject = async (cachedProjectId: string | null) => {
+      // 模拟旧版本缺少草稿范围或同目录残留其他项目;最近项目必须由 Host 入口决定归属。
+      await browser.execute(
+        (identity, hostId, projectId) => {
+          const key = `zcode-composer-workspace-scope:v1:${JSON.stringify(["desktop", identity])}`;
+          if (projectId === null) localStorage.removeItem(key);
+          else
+            localStorage.setItem(
+              key,
+              JSON.stringify({ clientNamespace: "desktop", hostId, projectId }),
+            );
+        },
+        identity,
+        original.hostId,
+        cachedProjectId,
+      );
+      await $("[data-device-project]").click();
+      await browser.waitUntil(
+        async () => {
+          // 旧断言反而等待创建器,掩盖了已保存项目被当作新目录的回归。
+          expect(await $('[data-testid="virtual-project-name"]').isDisplayed()).toBe(false);
+          return (
+            !(await $('[role="dialog"]').isDisplayed()) &&
+            !(await $('[data-testid="settings-page"]').isDisplayed())
+          );
+        },
+        { timeout: 30_000, timeoutMsg: `${CASE_MARKER}: 最近项目未完成原项目导航` },
+      );
+      await waitForRemoteTab({
+        caseMarker: CASE_MARKER,
+        expectedIdentity: identity,
+        expectedPath: config.workspacePaths[0],
+      });
+      await waitForWorkspaceApp(config.workspacePaths[0], 30_000);
+      expect(await $('[data-testid="virtual-project-name"]').isDisplayed()).toBe(false);
+      const projectId = await browser.execute(
+        (path, identity) => {
+          const bridge = window as Window & {
+            __zcodeSessionStoreE2E?: {
+              getState(): {
+                getWorkspaceState(
+                  path: string,
+                  identity: string,
+                ): { draftProjectId?: string | null };
+              };
+            };
+          };
+          return bridge.__zcodeSessionStoreE2E?.getState().getWorkspaceState(path, identity)
+            .draftProjectId;
+        },
+        config.workspacePaths[0],
+        identity,
+      );
+      expect(projectId).toBe(original.projectId);
+      const rememberedProjectId = await browser.execute((identity) => {
+        const key = `zcode-composer-workspace-scope:v1:${JSON.stringify(["desktop", identity])}`;
+        return JSON.parse(localStorage.getItem(key) ?? "null")?.projectId;
+      }, identity);
+      expect(rememberedProjectId).toBe(original.projectId);
+      const current = await callHandoffHost<RemoteProjectDirectory>(
+        ServiceChannels.RemoteProjects,
+        "readDirectory",
+      );
+      expect(current.entries.map((entry) => [entry.id, entry.projectId]).sort()).toEqual(
+        originalDirectory.entries.map((entry) => [entry.id, entry.projectId]).sort(),
+      );
+    };
     await browser.execute(() => {
       (
         window as Window & { __testActions?: { setLocale(locale: string): void } }
@@ -86,6 +167,8 @@ describe(`${CASE_MARKER}: 设置设备卡与未完成连接`, () => {
     expect(await $("[data-device-projects]").getText()).toContain("最近项目");
     expect(await $("[data-device-project]").getText()).toContain(config.workspacePaths[0]);
     expect(await $("[data-settings-content-frame]").getText()).not.toContain("远端任务会继续运行");
+    await openRecentProject(null);
+    await settings();
     await $('[data-source-server-card] button[aria-label="更多"]').click();
     await browser.waitUntil(
       async () => (await $("[data-device-info]").getText()).includes("设备 ID"),
@@ -110,11 +193,7 @@ describe(`${CASE_MARKER}: 设置设备卡与未完成连接`, () => {
     await $(
       '[data-source-server-card] [data-remote-connection-status="offline"]',
     ).waitForDisplayed();
-    await $("[data-device-project]").click();
-    // 已知目录入口进入项目编辑器,必须保存并打开项目草稿后再继续操作设置。
-    await $('[data-testid="virtual-project-name"]').waitForDisplayed({ timeout: 30_000 });
-    await selectSSHRemoteDirectory(config.workspacePaths[0], CASE_MARKER);
-    await waitForWorkspaceApp(config.workspacePaths[0], 30_000);
+    await openRecentProject("stale-project");
     await settings();
     const listener = createServer();
     await new Promise<void>((done) => listener.listen(0, "127.0.0.1", done));
@@ -128,7 +207,8 @@ describe(`${CASE_MARKER}: 设置设备卡与未完成连接`, () => {
     await fillSSHPasswordSettings({ ...config, host: "localhost", port: address.port });
     await clickLastEnabledSSHDialogButton(CASE_MARKER);
     expect(await waitForSSHError(CASE_MARKER)).toMatch(/无法连接到主机|Unable to connect to host/u);
-    await button("收起 — 连接将继续进行", '[data-testid="ssh-dialog"]');
+    // 默认折叠针对历史记录;收起会保留后台 owner 并主动展开,须先关闭失败的当前流程。
+    await button("关闭", '[data-testid="ssh-dialog"]');
     await $('[data-testid="ssh-dialog"]').waitForDisplayed({ reverse: true });
     const unfinished = $("[data-unfinished-connections]");
     await unfinished.waitForExist();

+ 0 - 222
packages/desktop/test/e2e/conversation-session/manual-review/pending/conversation-session-runtime-communication-performance.test.ts

@@ -1,222 +0,0 @@
-import { mkdir, writeFile } from "node:fs/promises";
-import { dirname, join, resolve } from "node:path";
-import { clearAppData } from "../../../helpers/desktop-app.js";
-import {
-  ELECTRON_WINDOW_RECORDING_CAPTURE_MODE,
-  startElectronWindowRecording,
-} from "../../../helpers/electron-window-recorder.js";
-import {
-  V4_MAIN_PANE_ID,
-  getV4PaneIds,
-  openV4SplitFromSidebar,
-  prepareV4ConversationE2E,
-  selectV4TaskById,
-  sendV4PromptInPane,
-  startNewV4Draft,
-  waitForV4Pane,
-} from "../../../helpers/v4-conversation.js";
-
-const CASE_NAME = "conversation-session-runtime-communication-performance";
-
-interface PerfLane {
-  finalToken: string;
-  label: "A" | "B" | "C" | "D";
-  paneId: string;
-  sessionId: string;
-}
-
-describe("通信中性能复现:四分屏 streaming + Agent subagent", () => {
-  after(async () => {
-    await browser.electron.restoreAllMocks();
-    await clearAppData();
-  });
-
-  it("PERF02: 4 pane 同时经历 Agent tool、child stream 和 parent final stream", async function () {
-    this.timeout(420000);
-
-    await prepareV4ConversationE2E();
-    const profileOnly = process.env.ZCODE_E2E_PROFILE_ONLY === "1";
-    const recording = profileOnly
-      ? null
-      : await startElectronWindowRecording({
-          frameIntervalMs: 250,
-          outputPath: resolveArtifactPath(`${CASE_NAME}.webm`),
-        });
-    const profiler =
-      process.env.ZCODE_E2E_PROFILE_STREAMING === "1"
-        ? await startRendererCpuProfile()
-        : null;
-
-    try {
-      const runId = Date.now();
-      const lanes = await createRunningPerfSessions(runId);
-      await bindRunningSessionsToFourPane(lanes);
-
-      await browser.pause(9000);
-      for (const lane of lanes) {
-        const snapshot = await waitForV4Pane(
-          (current) =>
-            current.sessionId === lane.sessionId && current.canStop,
-          `pane ${lane.label} 在 child stream 窗口没有保持 running`,
-          45000,
-          lane.paneId,
-        );
-        expect(snapshot.sessionId).not.toBe("draft");
-      }
-
-      for (const lane of lanes) {
-        await waitForV4Pane(
-          (snapshot) =>
-            snapshot.sessionId === lane.sessionId &&
-            snapshot.timelineText.includes(lane.finalToken),
-          `pane ${lane.label} 没有出现最终 streaming marker`,
-          180000,
-          lane.paneId,
-        );
-      }
-    } finally {
-      if (profiler) {
-        await profiler.stop();
-      }
-      if (recording) {
-        const result = await recording.stop();
-        await writeRecordingManifest({
-          frameCount: result.frameCount,
-          videoPath: result.videoPath,
-        });
-      }
-    }
-  });
-});
-
-async function createRunningPerfSessions(runId: number): Promise<PerfLane[]> {
-  const lanes: PerfLane[] = [];
-  for (const label of ["A", "B", "C", "D"] as const) {
-    if (lanes.length > 0) {
-      await startNewV4Draft();
-    }
-    await sendV4PromptInPane(
-      V4_MAIN_PANE_ID,
-      `E2E_RUNTIME_PERF_${label}_${runId}: trigger Agent subagent runtime communication pressure.`,
-    );
-    const snapshot = await waitForV4Pane(
-      (current) =>
-        current.sessionId !== "draft" && current.sessionId !== null,
-      `session ${label} 没有从 draft 绑定到真实 session`,
-      45000,
-      V4_MAIN_PANE_ID,
-    );
-    if (!snapshot.sessionId || snapshot.sessionId === "draft") {
-      throw new Error(`session ${label} 缺少真实 sessionId`);
-    }
-    lanes.push({
-      finalToken: `PERF_PARENT_DONE_${label}`,
-      label,
-      paneId: V4_MAIN_PANE_ID,
-      sessionId: snapshot.sessionId,
-    });
-  }
-  return lanes;
-}
-
-async function bindRunningSessionsToFourPane(lanes: PerfLane[]) {
-  const primaryLane = lanes[0];
-  if (!primaryLane || lanes.length !== 4) {
-    throw new Error(`四分屏性能用例需要 4 个 session,实际 ${lanes.length} 个`);
-  }
-  await selectV4TaskById(primaryLane.sessionId);
-  primaryLane.paneId = V4_MAIN_PANE_ID;
-  for (const lane of lanes.slice(1)) {
-    lane.paneId = await openV4SplitFromSidebar(lane.sessionId);
-  }
-  await browser.waitUntil(async () => (await getV4PaneIds()).length === 4, {
-    timeout: 15000,
-    timeoutMsg: "四分屏布局没有稳定到 4 个 pane",
-  });
-  for (const lane of lanes) {
-    await waitForV4Pane(
-      (snapshot) => snapshot.sessionId === lane.sessionId,
-      `pane ${lane.label} 没有绑定到预期 session ${lane.sessionId}`,
-      30000,
-      lane.paneId,
-    );
-  }
-}
-
-function resolveArtifactPath(fileName: string) {
-  return resolve(
-    process.env.ZCODE_E2E_ARTIFACT_DIR?.trim() ||
-      process.env.CODEX_E2E_ARTIFACT_DIR?.trim() ||
-      join(process.cwd(), ".e2e-artifacts", CASE_NAME),
-    fileName,
-  );
-}
-
-async function writeRecordingManifest(input: {
-  frameCount: number;
-  videoPath: string;
-}) {
-  const manifestPath = resolveArtifactPath(`${CASE_NAME}.recording.json`);
-  await mkdir(dirname(manifestPath), { recursive: true });
-  await writeFile(
-    manifestPath,
-    `${JSON.stringify(
-      {
-        caseName: CASE_NAME,
-        frameCount: input.frameCount,
-        video_capture_mode: ELECTRON_WINDOW_RECORDING_CAPTURE_MODE,
-        videoPath: input.videoPath,
-      },
-      null,
-      2,
-    )}\n`,
-    "utf-8",
-  );
-}
-
-async function startRendererCpuProfile() {
-  await sendRendererProfilerCommand("start");
-
-  return {
-    async stop() {
-      const result = await sendRendererProfilerCommand("stop");
-      const profilePath = resolveArtifactPath(`${CASE_NAME}.cpuprofile`);
-      await mkdir(dirname(profilePath), { recursive: true });
-      await writeFile(
-        profilePath,
-        `${JSON.stringify(result.profile ?? result, null, 2)}\n`,
-        "utf-8",
-      );
-    },
-  };
-}
-
-async function sendRendererProfilerCommand(command: "start" | "stop") {
-  return browser.electron.execute(async (electron, requestedCommand) => {
-    const window = electron.BrowserWindow.getAllWindows().find((candidate) => {
-      const url = candidate.webContents.getURL();
-      return !candidate.isDestroyed() && url.includes("/renderer/index.html");
-    });
-    if (!window) {
-      throw new Error("没有找到可采样的 renderer BrowserWindow");
-    }
-
-    const debuggerClient = window.webContents.debugger;
-    if (requestedCommand === "start") {
-      if (!debuggerClient.isAttached()) {
-        debuggerClient.attach("1.3");
-      }
-      await debuggerClient.sendCommand("Profiler.enable");
-      await debuggerClient.sendCommand("Profiler.start");
-      return { started: true };
-    }
-
-    try {
-      return await debuggerClient.sendCommand("Profiler.stop");
-    } finally {
-      if (debuggerClient.isAttached()) {
-        debuggerClient.detach();
-      }
-    }
-  }, command);
-}

+ 9 - 12
packages/desktop/test/e2e/conversation-session/manual-review/pending/conversation-session-virtual-project-mobile.test.ts

@@ -833,24 +833,21 @@ describe("虚拟项目手机 shared-host 导航", () => {
       await page.getByRole("menuitem", { name: /^(置顶任务|Pin task)$/ }).click();
       await page.getByTestId(`task-files-${createdTaskId}`).waitFor();
       await page.getByTestId(`task-files-${createdTaskId}`).click();
-      await page
-        .locator('[data-project-sidebar-panel="files"][aria-hidden="false"]')
-        .getByText("E2E_VP13_FILES.txt", { exact: true })
-        .waitFor({ timeout: 30_000 });
+      // 文件已改为右侧 Files 标签;旧侧栏选择器会在文件已显示时仍超时。
+      const filesTab = page.locator(
+        '[data-side-pane-tab-id^="file-manager:"][data-state="active"]',
+      );
+      await filesTab.waitFor();
+      await page.getByText("E2E_VP13_FILES.txt", { exact: true }).waitFor({ timeout: 30_000 });
       const filesDraft = await readDraft();
       expect(filesDraft.path).toBe(cwd);
       expect(filesDraft.activeTaskId).toBe(projectTaskState.activeTaskId);
       await page.screenshot({
         path: join(process.env.ZCODE_E2E_ARTIFACT_DIR!, "VP13-file-only-mobile.png"),
       });
-      await page
-        .locator('[data-project-sidebar-panel="files"][aria-hidden="false"]')
-        .getByRole("button", { name: /Back to tasks|返回任务/ })
-        .click();
-      await page.waitForFunction(
-        () =>
-          document.querySelector('[data-project-sidebar-panel="files"]')?.childElementCount === 0,
-      );
+      await filesTab.getByRole("button").click();
+      await filesTab.waitFor({ state: "detached" });
+      await page.getByRole("button", { name: /返回任务首页|Back to task home/ }).click();
       enterStage("reopen task");
       await page.getByTestId("sidebar-view-menu").tap();
       await page.getByTestId("sidebar-view-timeline").tap();

+ 56 - 0
packages/desktop/test/e2e/fixtures/cases/conversation-session/conversation-session-r3-subagent.json

@@ -16,6 +16,62 @@
       "source": "synthetic",
       "syntheticReason": "标题不属于断言"
     },
+    {
+      "id": "r3-workflow-skill",
+      "description": "远端工作流及辅助对话会话归属回归",
+      "kind": "main",
+      "timingPolicy": "fast-tool-use",
+      "source": "synthetic",
+      "syntheticReason": "固定模型输出,真实执行 Skill、CreateWorkflow 与远端子会话订阅。"
+    },
+    {
+      "id": "r3-workflow-create",
+      "description": "远端工作流及辅助对话会话归属回归",
+      "kind": "main",
+      "timingPolicy": "fast-tool-use",
+      "source": "synthetic",
+      "syntheticReason": "固定模型输出,真实执行 Skill、CreateWorkflow 与远端子会话订阅。"
+    },
+    {
+      "id": "r3-workflow-started",
+      "description": "远端工作流及辅助对话会话归属回归",
+      "kind": "main",
+      "timingPolicy": "fast-text",
+      "source": "synthetic",
+      "syntheticReason": "固定模型输出,真实执行 Skill、CreateWorkflow 与远端子会话订阅。"
+    },
+    {
+      "id": "r3-workflow-child",
+      "description": "远端工作流及辅助对话会话归属回归",
+      "kind": "main",
+      "timingPolicy": "fast-text",
+      "source": "synthetic",
+      "syntheticReason": "固定模型输出,真实执行 Skill、CreateWorkflow 与远端子会话订阅。"
+    },
+    {
+      "id": "r3-workflow-notification",
+      "description": "远端工作流及辅助对话会话归属回归",
+      "kind": "main",
+      "timingPolicy": "fast-text",
+      "source": "synthetic",
+      "syntheticReason": "固定模型输出,真实执行 Skill、CreateWorkflow 与远端子会话订阅。"
+    },
+    {
+      "id": "r3-side-chat",
+      "description": "远端工作流及辅助对话会话归属回归",
+      "kind": "main",
+      "timingPolicy": "fast-text",
+      "source": "synthetic",
+      "syntheticReason": "固定模型输出,真实执行 Skill、CreateWorkflow 与远端子会话订阅。"
+    },
+    {
+      "id": "r3-side-followup",
+      "description": "远端工作流及辅助对话会话归属回归",
+      "kind": "main",
+      "timingPolicy": "fast-text",
+      "source": "synthetic",
+      "syntheticReason": "固定模型输出,真实执行 Skill、CreateWorkflow 与远端子会话订阅。"
+    },
     {
       "id": "r3-sub-parent-agent",
       "description": "BG25: main launches a long-running background Agent.",

+ 0 - 104
packages/desktop/test/e2e/fixtures/cases/conversation-session/conversation-session-runtime-communication-performance.json

@@ -1,104 +0,0 @@
-{
-  "version": 1,
-  "caseName": "conversation-session-runtime-communication-performance",
-  "spec": "./test/e2e/conversation-session/conversation-session-runtime-communication-performance.test.ts",
-  "providerFixtures": [
-    "./test/e2e/fixtures/upstream/common.json",
-    "./test/e2e/fixtures/upstream/conversation-session/conversation-session-runtime-communication-performance.json"
-  ],
-  "fileFixtures": [],
-  "videoCaptureMode": "electron_capture_page",
-  "requests": [
-    {
-      "id": "runtime-perf-title",
-      "kind": "common",
-      "source": "synthetic",
-      "timingPolicy": "fast-text",
-      "syntheticReason": "标题生成不是本性能复现的通信压力来源,只需稳定返回。"
-    },
-    {
-      "id": "runtime-perf-parent-tool-a",
-      "kind": "main",
-      "source": "synthetic",
-      "timingPolicy": "fast-text",
-      "syntheticReason": "PERF02 需要稳定触发子智能体,父请求只负责产生 Agent tool。"
-    },
-    {
-      "id": "runtime-perf-child-stream-a",
-      "kind": "main",
-      "source": "synthetic",
-      "timingPolicy": "recorded-stream",
-      "syntheticReason": "性能复现需要稳定的 child subagent streaming 窗口。"
-    },
-    {
-      "id": "runtime-perf-parent-final-a",
-      "kind": "main",
-      "source": "synthetic",
-      "timingPolicy": "recorded-stream",
-      "syntheticReason": "性能复现需要父会话 continuation 也保持 streaming。"
-    },
-    {
-      "id": "runtime-perf-parent-tool-b",
-      "kind": "main",
-      "source": "synthetic",
-      "timingPolicy": "fast-text",
-      "syntheticReason": "PERF02 需要稳定触发子智能体,父请求只负责产生 Agent tool。"
-    },
-    {
-      "id": "runtime-perf-child-stream-b",
-      "kind": "main",
-      "source": "synthetic",
-      "timingPolicy": "recorded-stream",
-      "syntheticReason": "性能复现需要稳定的 child subagent streaming 窗口。"
-    },
-    {
-      "id": "runtime-perf-parent-final-b",
-      "kind": "main",
-      "source": "synthetic",
-      "timingPolicy": "recorded-stream",
-      "syntheticReason": "性能复现需要父会话 continuation 也保持 streaming。"
-    },
-    {
-      "id": "runtime-perf-parent-tool-c",
-      "kind": "main",
-      "source": "synthetic",
-      "timingPolicy": "fast-text",
-      "syntheticReason": "PERF02 需要稳定触发子智能体,父请求只负责产生 Agent tool。"
-    },
-    {
-      "id": "runtime-perf-child-stream-c",
-      "kind": "main",
-      "source": "synthetic",
-      "timingPolicy": "recorded-stream",
-      "syntheticReason": "性能复现需要稳定的 child subagent streaming 窗口。"
-    },
-    {
-      "id": "runtime-perf-parent-final-c",
-      "kind": "main",
-      "source": "synthetic",
-      "timingPolicy": "recorded-stream",
-      "syntheticReason": "性能复现需要父会话 continuation 也保持 streaming。"
-    },
-    {
-      "id": "runtime-perf-parent-tool-d",
-      "kind": "main",
-      "source": "synthetic",
-      "timingPolicy": "fast-text",
-      "syntheticReason": "PERF02 需要稳定触发子智能体,父请求只负责产生 Agent tool。"
-    },
-    {
-      "id": "runtime-perf-child-stream-d",
-      "kind": "main",
-      "source": "synthetic",
-      "timingPolicy": "recorded-stream",
-      "syntheticReason": "性能复现需要稳定的 child subagent streaming 窗口。"
-    },
-    {
-      "id": "runtime-perf-parent-final-d",
-      "kind": "main",
-      "source": "synthetic",
-      "timingPolicy": "recorded-stream",
-      "syntheticReason": "性能复现需要父会话 continuation 也保持 streaming。"
-    }
-  ]
-}

+ 54 - 0
packages/desktop/test/e2e/fixtures/cases/conversation-session/conversation-session-side-pane-full-view.json

@@ -0,0 +1,54 @@
+{
+  "version": 1,
+  "caseName": "conversation-session-side-pane-full-view",
+  "spec": "./test/e2e/conversation-session/conversation-session-side-pane-full-view.test.ts",
+  "providerFixtures": [
+    "./test/e2e/fixtures/upstream/common.json",
+    "./test/e2e/fixtures/upstream/conversation-session/conversation-session-side-pane-full-view.json"
+  ],
+  "fileFixtures": [],
+  "requests": [
+    {
+      "id": "upstream-conversation-side-pane-full-view-first",
+      "kind": "main",
+      "source": "synthetic",
+      "timingPolicy": "fast-text",
+      "syntheticReason": "只需要一个已完成的会话作为完整视图 owner,回复内容不参与断言。"
+    },
+    {
+      "id": "upstream-conversation-side-pane-full-view-floating-send",
+      "kind": "main",
+      "source": "synthetic",
+      "timingPolicy": "fast-text",
+      "syntheticReason": "证明浮窗输入框与主对话是同一实例,回复内容只用于确认消息被 agent 处理。"
+    },
+    {
+      "id": "upstream-conversation-side-pane-full-view-ask",
+      "kind": "main",
+      "source": "synthetic",
+      "timingPolicy": "controlled-stream",
+      "syntheticReason": "稳定制造问答等待态并延迟 4s 返回,保证请求在浮窗最小化之后到达,验证自动恢复并显示卡片。"
+    },
+    {
+      "id": "upstream-conversation-side-pane-full-view-ask-final",
+      "kind": "main",
+      "source": "synthetic",
+      "timingPolicy": "fast-text",
+      "syntheticReason": "只证明问答回答已被 agent 消费,核心断言在浮窗卡片的显示与消失。"
+    },
+    {
+      "id": "upstream-conversation-side-pane-full-view-title",
+      "kind": "common",
+      "source": "synthetic",
+      "timingPolicy": "fast-text",
+      "syntheticReason": "E2E_SPFV_FIRST 首发会触发 title sidecar;固定 case-local 标题,避免 sidecar 500 重试干扰会话。"
+    },
+    {
+      "id": "upstream-conversation-side-pane-full-view-compact",
+      "kind": "common",
+      "source": "synthetic",
+      "timingPolicy": "fast-text",
+      "syntheticReason": "manual-review 的小上下文窗口会在每轮之间自动 compact(compact 后历史不再含首条 marker);compact 失败会退避重试并阻塞后续输入,这里统一给出稳定摘要。"
+    }
+  ]
+}

+ 207 - 0
packages/desktop/test/e2e/fixtures/upstream/conversation-session/conversation-session-r3-subagent.json

@@ -28,6 +28,213 @@
         }
       }
     },
+    {
+      "id": "r3-workflow-skill",
+      "description": "远端工作流及辅助对话会话归属回归",
+      "metadata": {
+        "kind": "main",
+        "timingPolicy": "fast-tool-use",
+        "source": "synthetic",
+        "syntheticReason": "固定模型输出,真实执行 Skill、CreateWorkflow 与远端子会话订阅。"
+      },
+      "maxMatches": 3,
+      "match": {
+        "method": "POST",
+        "pathIncludes": "/messages",
+        "bodyExcludes": [
+          "Generate a concise title",
+          "CRITICAL: Respond with TEXT ONLY",
+          "You are now acting as the memory extraction subagent"
+        ],
+        "lastUserMessageIncludes": ["E2E_R3_WORKFLOW_START"]
+      },
+      "response": {
+        "statusCode": 200,
+        "toolUse": {
+          "id": "toolu_r3_workflow_skill",
+          "name": "Skill",
+          "input": {
+            "skill": "dynamic-workflows"
+          }
+        }
+      }
+    },
+    {
+      "id": "r3-workflow-create",
+      "description": "远端工作流及辅助对话会话归属回归",
+      "metadata": {
+        "kind": "main",
+        "timingPolicy": "fast-tool-use",
+        "source": "synthetic",
+        "syntheticReason": "固定模型输出,真实执行 Skill、CreateWorkflow 与远端子会话订阅。"
+      },
+      "maxMatches": 3,
+      "match": {
+        "method": "POST",
+        "pathIncludes": "/messages",
+        "bodyExcludes": [
+          "Generate a concise title",
+          "CRITICAL: Respond with TEXT ONLY",
+          "You are now acting as the memory extraction subagent"
+        ],
+        "lastUserMessageIncludes": ["Writing dynamic workflows"],
+        "bodyIncludes": ["E2E_R3_WORKFLOW_START"]
+      },
+      "response": {
+        "statusCode": 200,
+        "toolUse": {
+          "id": "toolu_r3_workflow_create",
+          "name": "CreateWorkflow",
+          "input": {
+            "name": "Remote workflow regression",
+            "script": "return await agent(\"remote-reviewer\").ask(\"E2E_R3_WORKFLOW_CHILD: Reply exactly R3_WORKFLOW_CHILD_DONE\");",
+            "subagent_model": "e2e-workflow-actors/GLM-5.3"
+          }
+        }
+      }
+    },
+    {
+      "id": "r3-workflow-started",
+      "description": "远端工作流及辅助对话会话归属回归",
+      "metadata": {
+        "kind": "main",
+        "timingPolicy": "fast-text",
+        "source": "synthetic",
+        "syntheticReason": "固定模型输出,真实执行 Skill、CreateWorkflow 与远端子会话订阅。"
+      },
+      "maxMatches": 3,
+      "match": {
+        "method": "POST",
+        "pathIncludes": "/messages",
+        "bodyExcludes": [
+          "Generate a concise title",
+          "CRITICAL: Respond with TEXT ONLY",
+          "You are now acting as the memory extraction subagent"
+        ],
+        "lastUserMessageIncludes": ["run started in the background with ID:"],
+        "bodyIncludes": ["E2E_R3_WORKFLOW_START"]
+      },
+      "response": {
+        "statusCode": 200,
+        "text": {
+          "id": "r3-workflow-started",
+          "text": "R3_WORKFLOW_STARTED"
+        }
+      }
+    },
+    {
+      "id": "r3-workflow-child",
+      "description": "远端工作流及辅助对话会话归属回归",
+      "metadata": {
+        "kind": "main",
+        "timingPolicy": "fast-text",
+        "source": "synthetic",
+        "syntheticReason": "固定模型输出,真实执行 Skill、CreateWorkflow 与远端子会话订阅。"
+      },
+      "maxMatches": 3,
+      "match": {
+        "method": "POST",
+        "pathIncludes": "/messages",
+        "bodyExcludes": [
+          "Generate a concise title",
+          "CRITICAL: Respond with TEXT ONLY",
+          "You are now acting as the memory extraction subagent"
+        ],
+        "lastUserMessageIncludes": ["E2E_R3_WORKFLOW_CHILD"]
+      },
+      "response": {
+        "statusCode": 200,
+        "text": {
+          "id": "r3-workflow-child",
+          "text": "R3_WORKFLOW_CHILD_DONE"
+        }
+      }
+    },
+    {
+      "id": "r3-workflow-notification",
+      "description": "远端工作流及辅助对话会话归属回归",
+      "metadata": {
+        "kind": "main",
+        "timingPolicy": "fast-text",
+        "source": "synthetic",
+        "syntheticReason": "固定模型输出,真实执行 Skill、CreateWorkflow 与远端子会话订阅。"
+      },
+      "maxMatches": 3,
+      "match": {
+        "method": "POST",
+        "pathIncludes": "/messages",
+        "bodyExcludes": [
+          "Generate a concise title",
+          "CRITICAL: Respond with TEXT ONLY",
+          "You are now acting as the memory extraction subagent"
+        ],
+        "lastUserMessageIncludes": ["workflow"],
+        "bodyIncludes": ["E2E_R3_WORKFLOW_START", "R3_WORKFLOW_STARTED"]
+      },
+      "response": {
+        "statusCode": 200,
+        "text": {
+          "id": "r3-workflow-notification",
+          "text": "R3_WORKFLOW_COMPLETED"
+        }
+      }
+    },
+    {
+      "id": "r3-side-chat",
+      "description": "远端工作流及辅助对话会话归属回归",
+      "metadata": {
+        "kind": "main",
+        "timingPolicy": "fast-text",
+        "source": "synthetic",
+        "syntheticReason": "固定模型输出,真实执行 Skill、CreateWorkflow 与远端子会话订阅。"
+      },
+      "maxMatches": 3,
+      "match": {
+        "method": "POST",
+        "pathIncludes": "/messages",
+        "bodyExcludes": [
+          "Generate a concise title",
+          "CRITICAL: Respond with TEXT ONLY",
+          "You are now acting as the memory extraction subagent"
+        ],
+        "lastUserMessageIncludes": ["E2E_R3_SIDE_CHAT"]
+      },
+      "response": {
+        "statusCode": 200,
+        "text": {
+          "id": "r3-side-chat",
+          "text": "R3_SIDE_CHAT_DONE"
+        }
+      }
+    },
+    {
+      "id": "r3-side-followup",
+      "description": "远端工作流及辅助对话会话归属回归",
+      "metadata": {
+        "kind": "main",
+        "timingPolicy": "fast-text",
+        "source": "synthetic",
+        "syntheticReason": "固定模型输出,真实执行 Skill、CreateWorkflow 与远端子会话订阅。"
+      },
+      "maxMatches": 3,
+      "match": {
+        "method": "POST",
+        "pathIncludes": "/messages",
+        "bodyExcludes": [
+          "Generate a concise title",
+          "CRITICAL: Respond with TEXT ONLY",
+          "You are now acting as the memory extraction subagent"
+        ],
+        "lastUserMessageIncludes": ["E2E_R3_SIDE_FOLLOWUP"]
+      },
+      "response": {
+        "statusCode": 200,
+        "text": {
+          "id": "r3-side-followup",
+          "text": "R3_SIDE_FOLLOWUP_DONE"
+        }
+      }
+    },
     {
       "id": "r3-sub-parent-agent",
       "description": "BG25: main launches a long-running background Agent.",

+ 0 - 434
packages/desktop/test/e2e/fixtures/upstream/conversation-session/conversation-session-runtime-communication-performance.json

@@ -1,434 +0,0 @@
-{
-  "version": 1,
-  "caseName": "conversation-session-runtime-communication-performance",
-  "spec": "./test/e2e/conversation-session/conversation-session-runtime-communication-performance.test.ts",
-  "fixtures": [
-    {
-      "id": "runtime-perf-title",
-      "description": "PERF02 标题生成固定响应,避免 title sidecar 抢占业务 fixture。",
-      "metadata": {
-        "kind": "common",
-        "timingPolicy": "fast-text",
-        "source": "synthetic",
-        "syntheticReason": "标题生成不是本性能复现的通信压力来源,只需稳定返回。"
-      },
-      "match": {
-        "method": "POST",
-        "pathIncludes": "/messages",
-        "bodyIncludes": ["Generate a concise title"]
-      },
-      "response": {
-        "statusCode": 200,
-        "statusMessage": "OK",
-        "headers": {
-          "content-type": "application/json; charset=utf-8"
-        },
-        "body": "{\"id\":\"runtime-perf-title\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"text\",\"text\":\"{\\\"title\\\":\\\"Runtime Perf Repro\\\"}\"}],\"stop_reason\":\"end_turn\",\"stop_sequence\":null,\"usage\":{\"input_tokens\":96,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":16,\"service_tier\":\"standard\"}}"
-      }
-    },
-    {
-      "id": "runtime-perf-parent-tool-a",
-      "description": "lane A 父请求触发 Agent tool_use。",
-      "metadata": {
-        "kind": "main",
-        "timingPolicy": "fast-text",
-        "source": "synthetic",
-        "syntheticReason": "PERF02 需要稳定触发子智能体,父请求只负责产生 Agent tool。"
-      },
-      "maxMatches": 1,
-      "match": {
-        "method": "POST",
-        "pathIncludes": "/messages",
-        "lastUserMessageIncludes": ["E2E_RUNTIME_PERF_A"],
-        "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
-      },
-      "response": {
-        "statusCode": 200,
-        "toolUse": {
-          "id": "toolu_runtime_perf_a_agent",
-          "name": "Agent",
-          "input": {
-            "description": "PERF02 lane A child stream",
-            "prompt": "E2E_RUNTIME_PERF_CHILD_A: stream child result and finish with PERF_CHILD_DONE_A.",
-            "subagent_type": "general-purpose"
-          }
-        }
-      }
-    },
-    {
-      "id": "runtime-perf-child-stream-a",
-      "description": "lane A child subagent recorded stream。",
-      "metadata": {
-        "kind": "main",
-        "timingPolicy": "recorded-stream",
-        "source": "synthetic",
-        "syntheticReason": "性能复现需要稳定的 child subagent streaming 窗口。"
-      },
-      "maxMatches": 1,
-      "match": {
-        "method": "POST",
-        "pathIncludes": "/messages",
-        "lastUserMessageIncludes": ["E2E_RUNTIME_PERF_CHILD_A"],
-        "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
-      },
-      "response": {
-        "statusCode": 200,
-        "statusMessage": "OK",
-        "headers": {
-          "cache-control": "no-cache",
-          "content-type": "text/event-stream; charset=utf-8"
-        },
-        "chunks": [
-          { "offsetMs": 0, "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"runtime-perf-child-a\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":128,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0,\"service_tier\":\"standard\"}}}\n\n" },
-          { "offsetMs": 250, "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n" },
-          { "offsetMs": 500, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"PERF_CHILD_STREAM_A_START\\n\\n| lane | phase | status |\\n| --- | --- | --- |\\n\"}}\n\n" },
-          { "offsetMs": 4000, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"| A | child-stream | receiving tool context |\\n```ts\\nexport const laneA = 'child-stream-mid';\\n```\\n\"}}\n\n" },
-          { "offsetMs": 8000, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"Lane A child stream is still active with markdown, code, and table updates.\\n\"}}\n\n" },
-          { "offsetMs": 12000, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"PERF_CHILD_DONE_A\"}}\n\n" },
-          { "offsetMs": 12200, "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n" },
-          { "offsetMs": 12300, "text": "event: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":128,\"output_tokens\":96,\"service_tier\":\"standard\"}}\n\n" },
-          { "offsetMs": 12400, "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n" }
-        ]
-      }
-    },
-    {
-      "id": "runtime-perf-parent-final-a",
-      "description": "lane A 父会话收到 child tool_result 后的 recorded stream。",
-      "metadata": {
-        "kind": "main",
-        "timingPolicy": "recorded-stream",
-        "source": "synthetic",
-        "syntheticReason": "性能复现需要父会话 continuation 也保持 streaming。"
-      },
-      "maxMatches": 1,
-      "match": {
-        "method": "POST",
-        "pathIncludes": "/messages",
-        "bodyIncludes": ["E2E_RUNTIME_PERF_A", "PERF_CHILD_DONE_A"],
-        "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
-      },
-      "response": {
-        "statusCode": 200,
-        "statusMessage": "OK",
-        "headers": {
-          "cache-control": "no-cache",
-          "content-type": "text/event-stream; charset=utf-8"
-        },
-        "chunks": [
-          { "offsetMs": 0, "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"runtime-perf-parent-a\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":192,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0,\"service_tier\":\"standard\"}}}\n\n" },
-          { "offsetMs": 250, "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n" },
-          { "offsetMs": 500, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"PERF_PARENT_STREAM_A_START after Agent tool result.\\n\"}}\n\n" },
-          { "offsetMs": 3500, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"Parent lane A continuation renders while other panes are active.\\n\"}}\n\n" },
-          { "offsetMs": 7000, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"More lane A markdown updates to keep React work alive.\\n\"}}\n\n" },
-          { "offsetMs": 10000, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"PERF_PARENT_DONE_A\"}}\n\n" },
-          { "offsetMs": 10200, "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n" },
-          { "offsetMs": 10300, "text": "event: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":192,\"output_tokens\":96,\"service_tier\":\"standard\"}}\n\n" },
-          { "offsetMs": 10400, "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n" }
-        ]
-      }
-    },
-    {
-      "id": "runtime-perf-parent-tool-b",
-      "description": "lane B 父请求触发 Agent tool_use。",
-      "metadata": {
-        "kind": "main",
-        "timingPolicy": "fast-text",
-        "source": "synthetic",
-        "syntheticReason": "PERF02 需要稳定触发子智能体,父请求只负责产生 Agent tool。"
-      },
-      "maxMatches": 1,
-      "match": {
-        "method": "POST",
-        "pathIncludes": "/messages",
-        "lastUserMessageIncludes": ["E2E_RUNTIME_PERF_B"],
-        "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
-      },
-      "response": {
-        "statusCode": 200,
-        "toolUse": {
-          "id": "toolu_runtime_perf_b_agent",
-          "name": "Agent",
-          "input": {
-            "description": "PERF02 lane B child stream",
-            "prompt": "E2E_RUNTIME_PERF_CHILD_B: stream child result and finish with PERF_CHILD_DONE_B.",
-            "subagent_type": "general-purpose"
-          }
-        }
-      }
-    },
-    {
-      "id": "runtime-perf-child-stream-b",
-      "description": "lane B child subagent recorded stream。",
-      "metadata": {
-        "kind": "main",
-        "timingPolicy": "recorded-stream",
-        "source": "synthetic",
-        "syntheticReason": "性能复现需要稳定的 child subagent streaming 窗口。"
-      },
-      "maxMatches": 1,
-      "match": {
-        "method": "POST",
-        "pathIncludes": "/messages",
-        "lastUserMessageIncludes": ["E2E_RUNTIME_PERF_CHILD_B"],
-        "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
-      },
-      "response": {
-        "statusCode": 200,
-        "statusMessage": "OK",
-        "headers": {
-          "cache-control": "no-cache",
-          "content-type": "text/event-stream; charset=utf-8"
-        },
-        "chunks": [
-          { "offsetMs": 0, "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"runtime-perf-child-b\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":128,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0,\"service_tier\":\"standard\"}}}\n\n" },
-          { "offsetMs": 250, "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n" },
-          { "offsetMs": 500, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"PERF_CHILD_STREAM_B_START\\n\\n| lane | phase | status |\\n| --- | --- | --- |\\n\"}}\n\n" },
-          { "offsetMs": 4000, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"| B | child-stream | receiving tool context |\\n```ts\\nexport const laneB = 'child-stream-mid';\\n```\\n\"}}\n\n" },
-          { "offsetMs": 8000, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"Lane B child stream is still active with markdown, code, and table updates.\\n\"}}\n\n" },
-          { "offsetMs": 12000, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"PERF_CHILD_DONE_B\"}}\n\n" },
-          { "offsetMs": 12200, "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n" },
-          { "offsetMs": 12300, "text": "event: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":128,\"output_tokens\":96,\"service_tier\":\"standard\"}}\n\n" },
-          { "offsetMs": 12400, "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n" }
-        ]
-      }
-    },
-    {
-      "id": "runtime-perf-parent-final-b",
-      "description": "lane B 父会话收到 child tool_result 后的 recorded stream。",
-      "metadata": {
-        "kind": "main",
-        "timingPolicy": "recorded-stream",
-        "source": "synthetic",
-        "syntheticReason": "性能复现需要父会话 continuation 也保持 streaming。"
-      },
-      "maxMatches": 1,
-      "match": {
-        "method": "POST",
-        "pathIncludes": "/messages",
-        "bodyIncludes": ["E2E_RUNTIME_PERF_B", "PERF_CHILD_DONE_B"],
-        "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
-      },
-      "response": {
-        "statusCode": 200,
-        "statusMessage": "OK",
-        "headers": {
-          "cache-control": "no-cache",
-          "content-type": "text/event-stream; charset=utf-8"
-        },
-        "chunks": [
-          { "offsetMs": 0, "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"runtime-perf-parent-b\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":192,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0,\"service_tier\":\"standard\"}}}\n\n" },
-          { "offsetMs": 250, "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n" },
-          { "offsetMs": 500, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"PERF_PARENT_STREAM_B_START after Agent tool result.\\n\"}}\n\n" },
-          { "offsetMs": 3500, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"Parent lane B continuation renders while other panes are active.\\n\"}}\n\n" },
-          { "offsetMs": 7000, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"More lane B markdown updates to keep React work alive.\\n\"}}\n\n" },
-          { "offsetMs": 10000, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"PERF_PARENT_DONE_B\"}}\n\n" },
-          { "offsetMs": 10200, "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n" },
-          { "offsetMs": 10300, "text": "event: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":192,\"output_tokens\":96,\"service_tier\":\"standard\"}}\n\n" },
-          { "offsetMs": 10400, "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n" }
-        ]
-      }
-    },
-    {
-      "id": "runtime-perf-parent-tool-c",
-      "description": "lane C 父请求触发 Agent tool_use。",
-      "metadata": {
-        "kind": "main",
-        "timingPolicy": "fast-text",
-        "source": "synthetic",
-        "syntheticReason": "PERF02 需要稳定触发子智能体,父请求只负责产生 Agent tool。"
-      },
-      "maxMatches": 1,
-      "match": {
-        "method": "POST",
-        "pathIncludes": "/messages",
-        "lastUserMessageIncludes": ["E2E_RUNTIME_PERF_C"],
-        "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
-      },
-      "response": {
-        "statusCode": 200,
-        "toolUse": {
-          "id": "toolu_runtime_perf_c_agent",
-          "name": "Agent",
-          "input": {
-            "description": "PERF02 lane C child stream",
-            "prompt": "E2E_RUNTIME_PERF_CHILD_C: stream child result and finish with PERF_CHILD_DONE_C.",
-            "subagent_type": "general-purpose"
-          }
-        }
-      }
-    },
-    {
-      "id": "runtime-perf-child-stream-c",
-      "description": "lane C child subagent recorded stream。",
-      "metadata": {
-        "kind": "main",
-        "timingPolicy": "recorded-stream",
-        "source": "synthetic",
-        "syntheticReason": "性能复现需要稳定的 child subagent streaming 窗口。"
-      },
-      "maxMatches": 1,
-      "match": {
-        "method": "POST",
-        "pathIncludes": "/messages",
-        "lastUserMessageIncludes": ["E2E_RUNTIME_PERF_CHILD_C"],
-        "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
-      },
-      "response": {
-        "statusCode": 200,
-        "statusMessage": "OK",
-        "headers": {
-          "cache-control": "no-cache",
-          "content-type": "text/event-stream; charset=utf-8"
-        },
-        "chunks": [
-          { "offsetMs": 0, "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"runtime-perf-child-c\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":128,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0,\"service_tier\":\"standard\"}}}\n\n" },
-          { "offsetMs": 250, "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n" },
-          { "offsetMs": 500, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"PERF_CHILD_STREAM_C_START\\n\\n| lane | phase | status |\\n| --- | --- | --- |\\n\"}}\n\n" },
-          { "offsetMs": 4000, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"| C | child-stream | receiving tool context |\\n```ts\\nexport const laneC = 'child-stream-mid';\\n```\\n\"}}\n\n" },
-          { "offsetMs": 8000, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"Lane C child stream is still active with markdown, code, and table updates.\\n\"}}\n\n" },
-          { "offsetMs": 12000, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"PERF_CHILD_DONE_C\"}}\n\n" },
-          { "offsetMs": 12200, "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n" },
-          { "offsetMs": 12300, "text": "event: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":128,\"output_tokens\":96,\"service_tier\":\"standard\"}}\n\n" },
-          { "offsetMs": 12400, "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n" }
-        ]
-      }
-    },
-    {
-      "id": "runtime-perf-parent-final-c",
-      "description": "lane C 父会话收到 child tool_result 后的 recorded stream。",
-      "metadata": {
-        "kind": "main",
-        "timingPolicy": "recorded-stream",
-        "source": "synthetic",
-        "syntheticReason": "性能复现需要父会话 continuation 也保持 streaming。"
-      },
-      "maxMatches": 1,
-      "match": {
-        "method": "POST",
-        "pathIncludes": "/messages",
-        "bodyIncludes": ["E2E_RUNTIME_PERF_C", "PERF_CHILD_DONE_C"],
-        "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
-      },
-      "response": {
-        "statusCode": 200,
-        "statusMessage": "OK",
-        "headers": {
-          "cache-control": "no-cache",
-          "content-type": "text/event-stream; charset=utf-8"
-        },
-        "chunks": [
-          { "offsetMs": 0, "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"runtime-perf-parent-c\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":192,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0,\"service_tier\":\"standard\"}}}\n\n" },
-          { "offsetMs": 250, "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n" },
-          { "offsetMs": 500, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"PERF_PARENT_STREAM_C_START after Agent tool result.\\n\"}}\n\n" },
-          { "offsetMs": 3500, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"Parent lane C continuation renders while other panes are active.\\n\"}}\n\n" },
-          { "offsetMs": 7000, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"More lane C markdown updates to keep React work alive.\\n\"}}\n\n" },
-          { "offsetMs": 10000, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"PERF_PARENT_DONE_C\"}}\n\n" },
-          { "offsetMs": 10200, "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n" },
-          { "offsetMs": 10300, "text": "event: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":192,\"output_tokens\":96,\"service_tier\":\"standard\"}}\n\n" },
-          { "offsetMs": 10400, "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n" }
-        ]
-      }
-    },
-    {
-      "id": "runtime-perf-parent-tool-d",
-      "description": "lane D 父请求触发 Agent tool_use。",
-      "metadata": {
-        "kind": "main",
-        "timingPolicy": "fast-text",
-        "source": "synthetic",
-        "syntheticReason": "PERF02 需要稳定触发子智能体,父请求只负责产生 Agent tool。"
-      },
-      "maxMatches": 1,
-      "match": {
-        "method": "POST",
-        "pathIncludes": "/messages",
-        "lastUserMessageIncludes": ["E2E_RUNTIME_PERF_D"],
-        "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
-      },
-      "response": {
-        "statusCode": 200,
-        "toolUse": {
-          "id": "toolu_runtime_perf_d_agent",
-          "name": "Agent",
-          "input": {
-            "description": "PERF02 lane D child stream",
-            "prompt": "E2E_RUNTIME_PERF_CHILD_D: stream child result and finish with PERF_CHILD_DONE_D.",
-            "subagent_type": "general-purpose"
-          }
-        }
-      }
-    },
-    {
-      "id": "runtime-perf-child-stream-d",
-      "description": "lane D child subagent recorded stream。",
-      "metadata": {
-        "kind": "main",
-        "timingPolicy": "recorded-stream",
-        "source": "synthetic",
-        "syntheticReason": "性能复现需要稳定的 child subagent streaming 窗口。"
-      },
-      "maxMatches": 1,
-      "match": {
-        "method": "POST",
-        "pathIncludes": "/messages",
-        "lastUserMessageIncludes": ["E2E_RUNTIME_PERF_CHILD_D"],
-        "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
-      },
-      "response": {
-        "statusCode": 200,
-        "statusMessage": "OK",
-        "headers": {
-          "cache-control": "no-cache",
-          "content-type": "text/event-stream; charset=utf-8"
-        },
-        "chunks": [
-          { "offsetMs": 0, "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"runtime-perf-child-d\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":128,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0,\"service_tier\":\"standard\"}}}\n\n" },
-          { "offsetMs": 250, "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n" },
-          { "offsetMs": 500, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"PERF_CHILD_STREAM_D_START\\n\\n| lane | phase | status |\\n| --- | --- | --- |\\n\"}}\n\n" },
-          { "offsetMs": 4000, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"| D | child-stream | receiving tool context |\\n```ts\\nexport const laneD = 'child-stream-mid';\\n```\\n\"}}\n\n" },
-          { "offsetMs": 8000, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"Lane D child stream is still active with markdown, code, and table updates.\\n\"}}\n\n" },
-          { "offsetMs": 12000, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"PERF_CHILD_DONE_D\"}}\n\n" },
-          { "offsetMs": 12200, "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n" },
-          { "offsetMs": 12300, "text": "event: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":128,\"output_tokens\":96,\"service_tier\":\"standard\"}}\n\n" },
-          { "offsetMs": 12400, "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n" }
-        ]
-      }
-    },
-    {
-      "id": "runtime-perf-parent-final-d",
-      "description": "lane D 父会话收到 child tool_result 后的 recorded stream。",
-      "metadata": {
-        "kind": "main",
-        "timingPolicy": "recorded-stream",
-        "source": "synthetic",
-        "syntheticReason": "性能复现需要父会话 continuation 也保持 streaming。"
-      },
-      "maxMatches": 1,
-      "match": {
-        "method": "POST",
-        "pathIncludes": "/messages",
-        "bodyIncludes": ["E2E_RUNTIME_PERF_D", "PERF_CHILD_DONE_D"],
-        "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
-      },
-      "response": {
-        "statusCode": 200,
-        "statusMessage": "OK",
-        "headers": {
-          "cache-control": "no-cache",
-          "content-type": "text/event-stream; charset=utf-8"
-        },
-        "chunks": [
-          { "offsetMs": 0, "text": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"id\":\"runtime-perf-parent-d\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[],\"stop_reason\":null,\"stop_sequence\":null,\"usage\":{\"input_tokens\":192,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0,\"service_tier\":\"standard\"}}}\n\n" },
-          { "offsetMs": 250, "text": "event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"text\",\"text\":\"\"}}\n\n" },
-          { "offsetMs": 500, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"PERF_PARENT_STREAM_D_START after Agent tool result.\\n\"}}\n\n" },
-          { "offsetMs": 3500, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"Parent lane D continuation renders while other panes are active.\\n\"}}\n\n" },
-          { "offsetMs": 7000, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"More lane D markdown updates to keep React work alive.\\n\"}}\n\n" },
-          { "offsetMs": 10000, "text": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"PERF_PARENT_DONE_D\"}}\n\n" },
-          { "offsetMs": 10200, "text": "event: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\n" },
-          { "offsetMs": 10300, "text": "event: message_delta\ndata: {\"type\":\"message_delta\",\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"usage\":{\"input_tokens\":192,\"output_tokens\":96,\"service_tier\":\"standard\"}}\n\n" },
-          { "offsetMs": 10400, "text": "event: message_stop\ndata: {\"type\":\"message_stop\"}\n\n" }
-        ]
-      }
-    }
-  ]
-}

+ 166 - 0
packages/desktop/test/e2e/fixtures/upstream/conversation-session/conversation-session-side-pane-full-view.json

@@ -0,0 +1,166 @@
+{
+  "version": 1,
+  "caseName": "conversation-session-side-pane-full-view",
+  "spec": "./test/e2e/conversation-session/conversation-session-side-pane-full-view.test.ts",
+  "fixtures": [
+    {
+      "id": "upstream-conversation-side-pane-full-view-first",
+      "description": "完整视图用例的首条消息:建立真实会话 A。",
+      "metadata": {
+        "kind": "main",
+        "timingPolicy": "fast-text",
+        "source": "synthetic",
+        "syntheticReason": "只需要一个已完成的会话作为完整视图 owner,回复内容不参与断言。"
+      },
+      "maxMatches": 1,
+      "match": {
+        "method": "POST",
+        "pathIncludes": "/messages",
+        "lastUserMessageIncludes": ["E2E_SPFV_FIRST"],
+        "bodyIncludes": ["E2E_SPFV_FIRST"],
+        "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
+      },
+      "response": {
+        "statusCode": 200,
+        "text": "spfv-first-ok"
+      }
+    },
+    {
+      "id": "upstream-conversation-side-pane-full-view-floating-send",
+      "description": "从完整视图浮窗输入框发送的消息。",
+      "metadata": {
+        "kind": "main",
+        "timingPolicy": "fast-text",
+        "source": "synthetic",
+        "syntheticReason": "证明浮窗输入框与主对话是同一实例,回复内容只用于确认消息被 agent 处理。"
+      },
+      "maxMatches": 1,
+      "match": {
+        "method": "POST",
+        "pathIncludes": "/messages",
+        "lastUserMessageIncludes": ["E2E_SPFV_FLOATING_SEND"],
+        "bodyIncludes": ["E2E_SPFV_FLOATING_SEND"],
+        "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
+      },
+      "response": {
+        "statusCode": 200,
+        "text": "spfv-floating-ok"
+      }
+    },
+    {
+      "id": "upstream-conversation-side-pane-full-view-ask",
+      "description": "最小化浮窗期间触发 AskUserQuestion 等待态。",
+      "metadata": {
+        "kind": "main",
+        "timingPolicy": "controlled-stream",
+        "source": "synthetic",
+        "syntheticReason": "稳定制造问答等待态并延迟 4s 返回,保证请求在浮窗最小化之后到达,验证自动恢复并显示卡片。"
+      },
+      "maxMatches": 1,
+      "match": {
+        "method": "POST",
+        "pathIncludes": "/messages",
+        "lastUserMessageIncludes": ["E2E_SPFV_ASK"],
+        "bodyIncludes": ["E2E_SPFV_ASK"],
+        "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
+      },
+      "response": {
+        "statusCode": 200,
+        "toolUse": {
+          "id": "toolu_e2e_spfv_ask_user_question",
+          "name": "AskUserQuestion",
+          "input": {
+            "questions": [
+              {
+                "question": "E2E_SPFV_ASK_QUESTION: choose an answer?",
+                "header": "E2E",
+                "options": [
+                  {
+                    "label": "Use default",
+                    "description": "Continue with the default answer."
+                  },
+                  {
+                    "label": "Use fallback",
+                    "description": "Continue with the fallback answer."
+                  }
+                ]
+              }
+            ]
+          }
+        },
+        "delayMs": 4000
+      }
+    },
+    {
+      "id": "upstream-conversation-side-pane-full-view-ask-final",
+      "description": "问答回答进入下一次请求后的最终回复。",
+      "metadata": {
+        "kind": "main",
+        "timingPolicy": "fast-text",
+        "source": "synthetic",
+        "syntheticReason": "只证明问答回答已被 agent 消费,核心断言在浮窗卡片的显示与消失。"
+      },
+      "maxMatches": 1,
+      "match": {
+        "method": "POST",
+        "pathIncludes": "/messages",
+        "bodyIncludes": ["E2E_SPFV_ASK_QUESTION", "toolu_e2e_spfv_ask_user_question"],
+        "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
+      },
+      "response": {
+        "statusCode": 200,
+        "text": "spfv-ask-done"
+      }
+    },
+    {
+      "id": "upstream-conversation-side-pane-full-view-title",
+      "description": "完整视图用例首发的 case-local 标题生成响应。",
+      "metadata": {
+        "kind": "common",
+        "timingPolicy": "fast-text",
+        "source": "synthetic",
+        "syntheticReason": "E2E_SPFV_FIRST 首发会触发 title sidecar;固定 case-local 标题,避免 sidecar 500 重试干扰会话。"
+      },
+      "match": {
+        "method": "POST",
+        "pathIncludes": "/messages",
+        "bodyIncludes": ["Generate a concise title", "E2E_SPFV_FIRST"]
+      },
+      "response": {
+        "statusCode": 200,
+        "text": {
+          "id": "upstream-conversation-side-pane-full-view-title",
+          "inputTokens": 64,
+          "outputTokens": 8,
+          "text": "{\"title\":\"SPFV E2E\"}"
+        }
+      }
+    },
+    {
+      "id": "upstream-conversation-side-pane-full-view-compact",
+      "description": "manual-review 小上下文窗口触发的自动 compact 摘要。",
+      "metadata": {
+        "kind": "common",
+        "timingPolicy": "fast-text",
+        "source": "synthetic",
+        "syntheticReason": "manual-review 的小上下文窗口会在每轮之间自动 compact(compact 后历史不再含首条 marker);compact 失败会退避重试并阻塞后续输入,这里统一给出稳定摘要。"
+      },
+      "match": {
+        "method": "POST",
+        "pathIncludes": "/messages",
+        "bodyIncludes": ["CRITICAL: Respond with TEXT ONLY", "E2E_SPFV_"],
+        "bodyExcludes": ["Generate a concise title"]
+      },
+      "response": {
+        "statusCode": 200,
+        "statusMessage": "OK",
+        "text": {
+          "id": "upstream-conversation-side-pane-full-view-compact",
+          "inputTokens": 128,
+          "outputTokens": 32,
+          "text": "<summary>The user asked for brief replies in a side pane full view test. No files or tools were used.</summary>"
+        }
+      }
+    }
+  ]
+}

+ 22 - 5
packages/desktop/test/e2e/helpers/project-upgrade-order-fixture.ts

@@ -4,6 +4,7 @@ import { DatabaseSync } from "node:sqlite";
 
 export const PROJECT_UPGRADE_ORDER_SPEC = "conversation-session-project-upgrade-order.test.ts";
 export const SAVED_PROJECT_NAMES = ["z-saved", "b-saved", "empty-saved"];
+export const MIGRATED_REMOTE_NAME = "upgrade-remote";
 export const LEGACY_PINNED_TASK_IDS = ["e2e-legacy-pinned", "e2e-legacy-imported-pinned"];
 export const CURRENT_IMPORTED_TASK_ID = "e2e-current-imported";
 
@@ -56,11 +57,27 @@ export async function seedProjectUpgradeOrderFixture(home: string, settingsFile:
     settingsFile,
     JSON.stringify({
       ...settings,
-      lastWorkspaceSession: [workspace, defaultPath, ...paths.slice(0, 3)].map((workspacePath) => ({
-        kind: "local",
-        workspacePurpose: "project",
-        workspacePath,
-      })),
+      lastWorkspaceSession: [workspace, defaultPath, ...paths.slice(0, 3)].flatMap(
+        (workspacePath, index) => [
+          {
+            kind: "local",
+            workspacePurpose: "project",
+            workspacePath,
+          },
+          ...(index === 0
+            ? [
+                {
+                  kind: "remote",
+                  workspacePurpose: "project",
+                  workspacePath: `/${MIGRATED_REMOTE_NAME}`,
+                  target: { kind: "ssh", host: "127.0.0.1", port: 1, username: "dev" },
+                  lastOpenedAt: 1,
+                  lastConnectionStatus: "failed",
+                },
+              ]
+            : []),
+        ],
+      ),
       recentProjects: [...paths].reverse(),
       lastActiveTabIndex: 0,
     }),

+ 0 - 286
packages/desktop/test/e2e/helpers/v4-conversation.ts

@@ -51,11 +51,6 @@ import {
   TID_V4_ROW_ATTACHMENTS,
   TID_V4_SESSION_PANE,
   TID_V4_SESSION_TITLE,
-  TID_V4_SPLIT_CLOSE,
-  TID_V4_SPLIT_DOWN,
-  TID_V4_SPLIT_DIVIDER,
-  TID_V4_SPLIT_OPEN,
-  TID_V4_TASK_OPEN_IN_SPLIT,
   TID_V4_STOP,
   TID_V4_TIMELINE,
   TID_V4_TIMELINE_BOTTOM,
@@ -1979,287 +1974,6 @@ export function getV4FocusedPaneId(): Promise<string | null> {
   }, TID_V4_PANE_SHELL);
 }
 
-/**
- * 首个非 primary pane 的 paneId(分屏二期 paneId 动态分配:pane-1/pane-2/…,
- * 一期固定 "split" 仅存于 v1 持久化迁移形态);无分屏返回 null。
- */
-export function getV4SecondaryPaneId(): Promise<string | null> {
-  return browser.execute(
-    (shellPrefix, mainPaneId) => {
-      const shells = Array.from(
-        document.querySelectorAll<HTMLElement>(`[data-testid^="${shellPrefix}-"]`),
-      );
-      for (const shell of shells) {
-        const paneId = shell.getAttribute("data-pane-id");
-        if (paneId && paneId !== mainPaneId) {
-          return paneId;
-        }
-      }
-      return null;
-    },
-    TID_V4_PANE_SHELL,
-    V4_MAIN_PANE_ID,
-  );
-}
-
-/** 当前 workbench 中全部 paneId。 */
-export function getV4PaneIds(): Promise<string[]> {
-  return browser.execute((shellPrefix) => {
-    return Array.from(document.querySelectorAll<HTMLElement>(`[data-testid^="${shellPrefix}-"]`))
-      .map((shell) => shell.getAttribute("data-pane-id"))
-      .filter((paneId): paneId is string => Boolean(paneId));
-  }, TID_V4_PANE_SHELL);
-}
-
-/** 是否存在非 primary pane(分屏布局)。 */
-export async function hasV4SplitPane(): Promise<boolean> {
-  return (await getV4SecondaryPaneId()) !== null;
-}
-
-/** 点击 primary pane header 的「向右拆分」按钮,等新 pane 出现并返回其 paneId。 */
-export async function openV4SplitPane(): Promise<string> {
-  await clickTestIdByDom(TID_V4_SPLIT_OPEN, {
-    timeout: 15000,
-    timeoutMsg: "v4 拆分按钮没有出现或不可点击",
-  });
-  let paneId: string | null = null;
-  await browser.waitUntil(
-    async () => {
-      paneId = await getV4SecondaryPaneId();
-      return paneId !== null;
-    },
-    {
-      timeout: 15000,
-      timeoutMsg: "点击拆分按钮后新 pane 没有出现",
-    },
-  );
-  return paneId as unknown as string;
-}
-
-/** 在指定 pane 上点击向右/向下拆分按钮,返回本次新增 paneId。 */
-export async function openV4SplitPaneFrom(
-  paneId: string,
-  direction: "right" | "down" = "right",
-): Promise<string> {
-  const before = new Set(await getV4PaneIds());
-  const splitButtonTestId = direction === "down" ? TID_V4_SPLIT_DOWN : TID_V4_SPLIT_OPEN;
-  const clicked = await browser.execute(
-    (shellTestId, buttonTestId) => {
-      const shell = document.querySelector<HTMLElement>(`[data-testid="${shellTestId}"]`);
-      const button = shell?.querySelector<HTMLButtonElement>(`[data-testid="${buttonTestId}"]`);
-      if (!button || button.disabled) return false;
-      button.click();
-      return true;
-    },
-    testId(TID_V4_PANE_SHELL, paneId),
-    splitButtonTestId,
-  );
-  if (!clicked) {
-    throw new Error(`pane ${paneId} 的 ${direction} 拆分按钮不存在或不可用`);
-  }
-
-  let addedPaneId: string | null = null;
-  await browser.waitUntil(
-    async () => {
-      const after = await getV4PaneIds();
-      addedPaneId = after.find((id) => !before.has(id)) ?? null;
-      return addedPaneId !== null;
-    },
-    {
-      timeout: 15000,
-      timeoutMsg: `pane ${paneId} 点击 ${direction} 拆分后没有新增 pane`,
-    },
-  );
-  return addedPaneId as unknown as string;
-}
-
-/** 点击非 primary pane header 的「关闭窗格」按钮,并等该 pane 外壳消失。 */
-export async function closeV4SplitPane() {
-  await clickTestIdByDom(TID_V4_SPLIT_CLOSE, {
-    timeout: 15000,
-    timeoutMsg: "v4 关闭窗格按钮没有出现或不可点击",
-  });
-  await browser.waitUntil(async () => !(await hasV4SplitPane()), {
-    timeout: 15000,
-    timeoutMsg: "点击关闭窗格后 pane 没有消失",
-  });
-}
-
-// ── 布局持久化 / 拖拽调宽 / 侧栏分屏入口 ──
-
-/** paneLayoutStore 的 localStorage 键(packages/ui paneLayoutStore.PANE_LAYOUT_STORAGE_KEY,分屏二期 v2)。 */
-export const V4_PANE_LAYOUT_STORAGE_KEY = "zcode-v4-pane-layout:v2";
-export const V4_WORKBENCH_GROUP_STORAGE_KEY = "zcode-v4-session-workbench-groups:v1";
-
-/** v2 持久化载荷形态(与 packages/ui paneLayoutStore PersistedPaneLayoutV2 对偶,e2e 断言/篡改用)。 */
-export interface V4PersistedPaneLayout {
-  root: {
-    type: string;
-    ratio?: number;
-    [key: string]: unknown;
-  };
-  panes: Record<string, { workspaceScope: { workspacePath: string }; sessionId: string | null }>;
-  focusedPaneId: string;
-}
-
-/** promoted 分屏的唯一持久化 owner(与 packages/ui workbenchGroupStore 对偶)。 */
-export interface V4PersistedWorkbenchGroups {
-  activeGroupId: string | null;
-  groups: Record<
-    string,
-    {
-      root: {
-        type: string;
-        ratio?: number;
-        [key: string]: unknown;
-      };
-      panes: Record<
-        string,
-        {
-          workspaceScope: { workspacePath: string };
-          sessionId: string;
-        }
-      >;
-      focusedPaneId: string;
-    }
-  >;
-}
-
-/** 读取当前分屏占比(primary 外壳宽 / 容器宽);无分屏或容器不可测返回 null。 */
-export function getV4SplitRatio(): Promise<number | null> {
-  return browser.execute(
-    (primaryShellTestId, shellPrefix, mainPaneId) => {
-      const primary = document.querySelector<HTMLElement>(`[data-testid="${primaryShellTestId}"]`);
-      const hasSecondary = Array.from(
-        document.querySelectorAll<HTMLElement>(`[data-testid^="${shellPrefix}-"]`),
-      ).some((shell) => shell.getAttribute("data-pane-id") !== mainPaneId);
-      const container = primary?.parentElement;
-      if (!primary || !hasSecondary || !container) return null;
-      const containerWidth = container.getBoundingClientRect().width;
-      if (containerWidth <= 0) return null;
-      return primary.getBoundingClientRect().width / containerWidth;
-    },
-    testId(TID_V4_PANE_SHELL, V4_MAIN_PANE_ID),
-    TID_V4_PANE_SHELL,
-    V4_MAIN_PANE_ID,
-  );
-}
-
-/**
- * 把分屏分隔条拖到容器宽度的 targetRatio 处(pointer events:down → move → up;
- * 分隔条 pointerup 提交 store → 持久化)。
- */
-export async function dragV4SplitDividerTo(targetRatio: number) {
-  const dispatched = await browser.execute(
-    (dividerTestId, primaryShellTestId, ratio) => {
-      const divider = document.querySelector<HTMLElement>(`[data-testid="${dividerTestId}"]`);
-      const container = document.querySelector<HTMLElement>(
-        `[data-testid="${primaryShellTestId}"]`,
-      )?.parentElement;
-      if (!divider || !container) return false;
-      const containerRect = container.getBoundingClientRect();
-      const dividerRect = divider.getBoundingClientRect();
-      const startX = dividerRect.left + dividerRect.width / 2;
-      const y = dividerRect.top + dividerRect.height / 2;
-      const targetX = containerRect.left + containerRect.width * ratio;
-      const base = {
-        bubbles: true,
-        cancelable: true,
-        button: 0,
-        pointerId: 1,
-        pointerType: "mouse",
-      } as const;
-      divider.dispatchEvent(
-        new PointerEvent("pointerdown", { ...base, clientX: startX, clientY: y }),
-      );
-      divider.dispatchEvent(
-        new PointerEvent("pointermove", {
-          ...base,
-          clientX: (startX + targetX) / 2,
-          clientY: y,
-        }),
-      );
-      divider.dispatchEvent(
-        new PointerEvent("pointermove", { ...base, clientX: targetX, clientY: y }),
-      );
-      divider.dispatchEvent(
-        new PointerEvent("pointerup", { ...base, clientX: targetX, clientY: y }),
-      );
-      return true;
-    },
-    TID_V4_SPLIT_DIVIDER,
-    testId(TID_V4_PANE_SHELL, V4_MAIN_PANE_ID),
-    targetRatio,
-  );
-  if (!dispatched) {
-    throw new Error("分屏分隔条不存在,无法拖拽");
-  }
-}
-
-/** 等待实际分屏占比进入 target±tolerance。 */
-export async function waitForV4SplitRatio(target: number, tolerance = 0.03, timeout = 15000) {
-  let latest: number | null = null;
-  await browser.waitUntil(
-    async () => {
-      latest = await getV4SplitRatio();
-      return latest !== null && Math.abs(latest - target) <= tolerance;
-    },
-    {
-      timeout,
-      timeoutMsg: `分屏占比没有达到 ${target}(最近值 ${latest})`,
-    },
-  );
-}
-
-/** 右键侧栏会话项 → 上下文菜单「在分屏打开」→ 等新 pane 出现并返回其 paneId(仅桌面 shell)。 */
-export async function openV4SplitFromSidebar(sessionId: string): Promise<string> {
-  const before = new Set(await getV4PaneIds());
-  await browser.waitUntil(
-    async () =>
-      browser.execute(
-        (itemTestId) => {
-          const item = document.querySelector<HTMLElement>(`[data-testid="${itemTestId}"]`);
-          if (!item) return false;
-          const rect = item.getBoundingClientRect();
-          item.dispatchEvent(
-            new MouseEvent("contextmenu", {
-              bubbles: true,
-              cancelable: true,
-              button: 2,
-              clientX: rect.left + rect.width / 2,
-              clientY: rect.top + rect.height / 2,
-            }),
-          );
-          return true;
-        },
-        testId(TID_TASK_ITEM, sessionId),
-      ),
-    {
-      timeout: 15000,
-      timeoutMsg: `侧栏会话项不存在: ${sessionId}`,
-    },
-  );
-  await clickTestIdByDom(TID_V4_TASK_OPEN_IN_SPLIT, {
-    timeout: 15000,
-    timeoutMsg: "会话项上下文菜单「在分屏打开」没有出现",
-  });
-  let paneId: string | null = null;
-  await browser.waitUntil(
-    async () => {
-      const after = await getV4PaneIds();
-      paneId =
-        after.find((candidate) => !before.has(candidate)) ??
-        (before.size === 1 ? await getV4SecondaryPaneId() : null);
-      return paneId !== null;
-    },
-    {
-      timeout: 15000,
-      timeoutMsg: "「在分屏打开」后新 pane 没有出现",
-    },
-  );
-  return paneId as unknown as string;
-}
-
 /** 点击侧栏会话项并等待 primary pane 绑定到该 session。 */
 export async function selectV4TaskById(sessionId: string, taskListTimeout = 15000) {
   await clickTestIdByDom(testId(TID_TASK_ITEM, sessionId), {

+ 55 - 0
packages/desktop/test/e2e/plugins/manual-review/pending/plugin-builtin-ui-uninstall.test.ts

@@ -0,0 +1,55 @@
+import { clearAppData } from "../../../helpers/desktop-app.js";
+import {
+  capturePluginManualReview,
+  clickPluginControl,
+  openPluginSettings,
+  requirePluginManualReview,
+  waitForPluginCard,
+  waitForPluginControl,
+  waitUntilPluginOverview,
+} from "../../../helpers/plugin-management-lifecycle.js";
+
+const DOCUMENTS_ID = "documents@zcode-plugins-official";
+
+describe("PLM-BUILTIN-UI-UNINSTALL 内置 UI 插件卸载后的分组", () => {
+  after(async () => {
+    await clearAppData();
+  });
+
+  it("卸载内置 Word 插件后仍归在 UI 插件分组", async function () {
+    this.timeout(240000);
+    requirePluginManualReview();
+    await openPluginSettings();
+    await waitForPluginControl("plugin-store-ui-section", {}, 60000);
+    await waitForPluginCard(DOCUMENTS_ID, 60000);
+    await assertInUiSection("installed");
+    await clickPluginControl("plugin-store-item-menu", { pluginId: DOCUMENTS_ID });
+    await clickPluginControl("plugin-store-menu-uninstall", { pluginId: DOCUMENTS_ID });
+    await waitForPluginControl("plugin-store-uninstall-dialog");
+    await clickPluginControl("plugin-store-uninstall-confirm");
+    await waitUntilPluginOverview(
+      (overview) => overview.restorableBuiltins.some((plugin) => plugin.id === DOCUMENTS_ID),
+      `Built-in plugin did not become restorable: ${DOCUMENTS_ID}`,
+      120000,
+    );
+    // 旧实现中可恢复条目丢了 componentTypes 的 "ui",卡片会掉进「生产力」分类分组。
+    await assertInUiSection("restorable");
+    await capturePluginManualReview("PLM-BUILTIN-UI-UNINSTALL", "restorable-in-ui-section");
+  });
+});
+
+async function assertInUiSection(stage: string): Promise<void> {
+  await browser.waitUntil(
+    () =>
+      browser.execute((id) => {
+        const card = document.querySelector(
+          `[data-testid="plugin-store-card"][data-plugin-id=${JSON.stringify(id)}]`,
+        );
+        return Boolean(card?.closest('[data-testid="plugin-store-ui-section"]'));
+      }, DOCUMENTS_ID),
+    {
+      timeout: 30000,
+      timeoutMsg: `${stage}: ${DOCUMENTS_ID} is not in the UI plugin section`,
+    },
+  );
+}

+ 122 - 51
packages/desktop/test/e2e/plugins/manual-review/pending/plugin-concurrent-install.test.ts

@@ -6,82 +6,139 @@ import {
   addMarketplaceSourceThroughUi,
   capturePluginManualReview,
   clickPluginControl,
+  getPluginList,
+  getPluginOverview,
+  openPluginCard,
   openPluginSettings,
   requirePluginManualReview,
   waitForPluginCard,
+  waitForPluginControl,
 } from "../../../helpers/plugin-management-lifecycle.js";
 
 const marketplace = "e2e-concurrent-install";
 const names = ["first", "second"];
+const localName = "local";
+const localSkill = "detail-during-install";
 
 describe("PLM-CONCURRENT-INSTALL 独立安装忙碌态", () => {
   it("后一次安装与前一次失败都不能清理另一插件的安装中状态", async function () {
     this.timeout(240000);
     requirePluginManualReview();
-    const pending = new Map<string, ServerResponse[]>();
-    const released = new Set<string>();
-    // 用响应门控制真实下载,不依赖网络速度或固定 sleep 制造并发窗口。
-    const server = createServer((request, response) => {
-      const name = request.url?.slice(1).replace(".zip", "") ?? "";
-      if (released.has(name)) {
-        response.writeHead(404).end("fixture install failure");
-      } else {
-        pending.set(name, [...(pending.get(name) ?? []), response]);
-      }
-    });
-    const release = (name: string) => {
-      released.add(name);
-      for (const response of pending.get(name) ?? []) {
-        response.writeHead(404).end("fixture install failure");
-      }
-      pending.delete(name);
-    };
+    const gate = await startGatedZipServer();
     try {
-      await new Promise<void>((resolve) => server.listen(0, "127.0.0.1", resolve));
-      const address = server.address();
-      if (!address || typeof address === "string") throw new Error("Fixture server unavailable");
-      const fixture = join(getE2EAppDataPaths().homeDir, "fixtures", marketplace);
-      await mkdir(join(fixture, ".claude-plugin"), { recursive: true });
-      await writeFile(
-        join(fixture, ".claude-plugin", "marketplace.json"),
-        JSON.stringify({
-          name: marketplace,
-          plugins: names.map((name) => ({
-            name,
-            version: "1.0.0",
-            description: `Concurrent install ${name}`,
-            source: {
-              source: "url",
-              type: "zip",
-              url: `http://127.0.0.1:${address.port}/${name}.zip`,
-              sha256: "0".repeat(64),
-            },
-          })),
-        }),
-      );
-      await openPluginSettings();
-      await addMarketplaceSourceThroughUi(fixture);
-      await clickPluginControl("plugin-store-segment-personal");
-      for (const name of names) await waitForPluginCard(`${name}@${marketplace}`, 60000);
+      await prepareGatedMarketplace(gate.port);
       await clickPluginControl("plugin-store-install", { pluginId: `first@${marketplace}` });
-      await browser.waitUntil(() => pending.has("first"), { timeout: 30000 });
+      await browser.waitUntil(() => gate.pending.has("first"), { timeout: 30000 });
       await clickPluginControl("plugin-store-install", { pluginId: `second@${marketplace}` });
       await assertBusy([true, true]);
       await capturePluginManualReview("PLM-CONCURRENT-INSTALL", "both-pending");
-      release("first");
-      await browser.waitUntil(() => pending.has("second"), { timeout: 60000 });
+      // PLM-DETAIL-DURING-INSTALL:A 下载中、B 排在 A 后面时打开其他插件详情。
+      // 旧实现中 describe 排在两次安装后面,组件区会一直停在 loading。
+      await openPluginCard(`${localName}@${marketplace}`);
+      await waitForPluginControl(
+        "plugin-store-component-section",
+        { componentKind: "skill" },
+        30000,
+      );
+      if (!gate.pending.has("first")) throw new Error("Install finished before detail loaded");
+      await capturePluginManualReview("PLM-DETAIL-DURING-INSTALL", "detail-loaded");
+      // 新建右侧标签页会新建插件 store 并加载 list/overview;旧实现中它们排在两次安装后面,
+      // 推荐区一直停在骨架屏。这里直接走同一条服务链路,断言安装未结束时就返回。
+      await withTimeout(
+        Promise.all([getPluginList(), getPluginOverview()]),
+        10000,
+        "plugins/list and plugins/overview waited for the install",
+      );
+      if (!gate.pending.has("first")) throw new Error("Install finished before list loaded");
+      await clickPluginControl("plugin-store-detail-back");
+      await assertBusy([true, true]);
+      gate.release("first");
+      await browser.waitUntil(() => gate.pending.has("second"), { timeout: 60000 });
       await assertBusy([false, true]);
-      release("second");
+      gate.release("second");
       await assertBusy([false, false]);
     } finally {
-      for (const name of names) release(name);
-      server.closeAllConnections();
-      await new Promise<void>((resolve) => server.close(() => resolve()));
+      await gate.close();
       await clearAppData();
     }
   });
 });
 
+// 用响应门控制真实下载,不依赖网络速度或固定 sleep 制造并发窗口。
+async function startGatedZipServer() {
+  const pending = new Map<string, ServerResponse[]>();
+  const released = new Set<string>();
+  const server = createServer((request, response) => {
+    const name = request.url?.slice(1).replace(".zip", "") ?? "";
+    if (released.has(name)) {
+      response.writeHead(404).end("fixture install failure");
+    } else {
+      pending.set(name, [...(pending.get(name) ?? []), response]);
+    }
+  });
+  const release = (name: string) => {
+    released.add(name);
+    for (const response of pending.get(name) ?? []) {
+      response.writeHead(404).end("fixture install failure");
+    }
+    pending.delete(name);
+  };
+  await new Promise<void>((resolve) => server.listen(0, "127.0.0.1", resolve));
+  const address = server.address();
+  if (!address || typeof address === "string") throw new Error("Fixture server unavailable");
+  return {
+    pending,
+    port: address.port,
+    release,
+    async close() {
+      for (const name of names) release(name);
+      server.closeAllConnections();
+      await new Promise<void>((resolve) => server.close(() => resolve()));
+    },
+  };
+}
+
+async function prepareGatedMarketplace(port: number): Promise<void> {
+  const fixture = join(getE2EAppDataPaths().homeDir, "fixtures", marketplace);
+  await mkdir(join(fixture, ".claude-plugin"), { recursive: true });
+  const skillDir = join(fixture, "plugins", localName, "skills", localSkill);
+  await mkdir(skillDir, { recursive: true });
+  await writeFile(
+    join(skillDir, "SKILL.md"),
+    `---\nname: ${localSkill}\ndescription: Detail stays readable during install\n---\n`,
+  );
+  await writeFile(
+    join(fixture, ".claude-plugin", "marketplace.json"),
+    JSON.stringify({
+      name: marketplace,
+      plugins: [
+        ...names.map((name) => ({
+          name,
+          version: "1.0.0",
+          description: `Concurrent install ${name}`,
+          source: {
+            source: "url",
+            type: "zip",
+            url: `http://127.0.0.1:${port}/${name}.zip`,
+            sha256: "0".repeat(64),
+          },
+        })),
+        {
+          name: localName,
+          version: "1.0.0",
+          description: "Local detail fixture",
+          source: `./plugins/${localName}`,
+        },
+      ],
+    }),
+  );
+  await openPluginSettings();
+  await addMarketplaceSourceThroughUi(fixture);
+  await clickPluginControl("plugin-store-segment-personal");
+  for (const name of [...names, localName])
+    await waitForPluginCard(`${name}@${marketplace}`, 60000);
+}
+
 async function assertBusy(expected: boolean[]): Promise<void> {
   await browser.waitUntil(
     async () => {
@@ -100,3 +157,17 @@ async function assertBusy(expected: boolean[]): Promise<void> {
     { timeout: 30000, timeoutMsg: `Expected install busy states ${JSON.stringify(expected)}` },
   );
 }
+
+async function withTimeout<T>(promise: Promise<T>, timeoutMs: number, message: string): Promise<T> {
+  let timer: ReturnType<typeof setTimeout> | undefined;
+  try {
+    return await Promise.race([
+      promise,
+      new Promise<never>((_, reject) => {
+        timer = setTimeout(() => reject(new Error(message)), timeoutMs);
+      }),
+    ]);
+  } finally {
+    clearTimeout(timer);
+  }
+}

+ 640 - 0
packages/desktop/test/e2e/ui-shell/side-pane-full-view.test.ts

@@ -0,0 +1,640 @@
+import { join } from "node:path";
+import {
+  TID_SIDE_PANE_FULL_VIEW_BUBBLE,
+  TID_SIDE_PANE_FULL_VIEW_CONVERSATION_TAB,
+  TID_SIDE_PANE_FULL_VIEW_DRAWER,
+  TID_SIDE_PANE_FULL_VIEW_EXPAND,
+  TID_SIDE_PANE_FULL_VIEW_HANDLE,
+  TID_SIDE_PANE_FULL_VIEW_HEADER,
+  TID_SIDE_PANE_FULL_VIEW_HOST,
+  TID_SIDE_PANE_FULL_VIEW_MENU_OPEN_CONVERSATION,
+  TID_SIDE_PANE_FULL_VIEW_MINIMIZE,
+  TID_SIDE_PANE_FULL_VIEW_RUNNING,
+  TID_SIDE_PANE_FULL_VIEW_TOGGLE,
+  TID_SIDE_PANE_TOGGLE,
+  TID_COMPOSER_WORKSPACE_TRIGGER,
+  TID_V4_COMPOSER_INPUT,
+  TID_V4_COMPOSER_SEND,
+  TID_V4_SESSION_PANE,
+  TID_V4_TIMELINE,
+  TID_WORKSPACE_HEADER,
+  testId,
+} from "@zcode/shared/test-ids";
+import { clearAppData } from "../helpers/desktop-app.js";
+import { prepareV4ConversationE2E } from "../helpers/v4-conversation.js";
+
+// spec:docs/ui/side-pane-full-view.md;用例:docs/testing/side-pane-tabs-e2e-case-catalog.md(SPFV)
+const SIDE_FRAME = '[data-workspace-side-frame="true"]';
+const SLOT = `${SIDE_FRAME} [data-side-pane-content-slot]`;
+const HOST = `[data-testid="${TID_SIDE_PANE_FULL_VIEW_HOST}"]`;
+const MAIN_PANE = `[data-testid="${testId(TID_V4_SESSION_PANE, "workspace-main")}"]`;
+const COMPOSER_INPUT = `${HOST} [data-testid="${TID_V4_COMPOSER_INPUT}"]`;
+const COMPOSER_DOCK = `${HOST} [data-v4-composer-dock="true"]`;
+const COMPOSER_SHELL = `${HOST} [data-composer-layout]`;
+const COMPOSER_ACTION_MENU = `${HOST} [data-composer-action-menu] button`;
+const COMPOSER_SEND = `${HOST} [data-testid="${TID_V4_COMPOSER_SEND}"]`;
+const COMPOSER_PROJECT_TRIGGER = `${HOST} [data-testid="${TID_COMPOSER_WORKSPACE_TRIGGER}"]`;
+const EDITOR_MARKER = "spfv-editor-instance";
+const DRAWER = `[data-testid="${TID_SIDE_PANE_FULL_VIEW_DRAWER}"]`;
+const EXPAND = `[data-testid="${TID_SIDE_PANE_FULL_VIEW_EXPAND}"]`;
+const TAB = "[data-side-pane-tab-id]";
+const PANE_MARKER = "spfv-single-instance";
+const DRAFT_TEXT = "E2E_SPFV_FLOATING_DRAFT";
+const MARGIN = 16;
+
+interface Rect {
+  left: number;
+  top: number;
+  right: number;
+  bottom: number;
+  width: number;
+  height: number;
+}
+
+describe("Side Pane 完整视图(SPFV)", () => {
+  before(async () => {
+    await prepareV4ConversationE2E({ skipProvider: true });
+    await browser.execute(() =>
+      window.localStorage.removeItem("zcode:side-pane-full-view:floating-anchor"),
+    );
+  });
+
+  after(async () => {
+    await browser.electron.restoreAllMocks();
+    await clearAppData();
+  });
+
+  it("SPFV-E2E-001 进入、退出且不重新挂载对话", async () => {
+    await ensureSidePaneExpanded();
+    await ensureTerminalTab();
+    const before = await readLayoutWidths();
+    await markMainPane();
+
+    await clickFullViewToggle();
+    await waitForHostMode("floating");
+    const entered = await readLayoutWidths();
+    // 完整视图保留左侧任务列表与左上角按钮组。
+    expect(Math.abs(entered.sidebar - before.sidebar)).toBeLessThanOrEqual(2);
+    expect(await $('[data-testid="desktop-top-nav-back"]').isExisting()).toBe(true);
+    // tab 栏是窗口拖拽区;对话 tab 不是 no-drag 时真实鼠标点击会被当成拖动窗口(CDP 点击测不出来)。
+    expect(
+      await browser.execute(
+        (tabId) =>
+          getComputedStyle(document.querySelector(`[data-testid="${tabId}"]`)!).getPropertyValue(
+            "-webkit-app-region",
+          ),
+        TID_SIDE_PANE_FULL_VIEW_CONVERSATION_TAB,
+      ),
+    ).toBe("no-drag");
+    expect(await $(`[data-testid="${TID_WORKSPACE_HEADER}"]`).isExisting()).toBe(false);
+    expect(entered.content - entered.sideFrame).toBeLessThanOrEqual(16);
+    expect(
+      await browser.execute(
+        (conversationTabId, tabSelector) => {
+          const conversationTab = document.querySelector(`[data-testid="${conversationTabId}"]`);
+          const firstPaneTab = document.querySelector(tabSelector);
+          return Boolean(
+            conversationTab &&
+            firstPaneTab &&
+            conversationTab.compareDocumentPosition(firstPaneTab) &
+              Node.DOCUMENT_POSITION_FOLLOWING,
+          );
+        },
+        TID_SIDE_PANE_FULL_VIEW_CONVERSATION_TAB,
+        TAB,
+      ),
+    ).toBe(true);
+
+    // 侧栏收起时,tab 栏按 WorkspaceHeader 的规则给左上角按钮组让位,对话 tab 不被按钮盖住。
+    await realKeys(["Control", "b"]);
+    await browser.waitUntil(async () => (await readLayoutWidths()).sidebar <= 8, {
+      timeout: 5_000,
+      timeoutMsg: "Cmd/Ctrl+B 后侧栏没有收起",
+    });
+    await browser.waitUntil(
+      async () =>
+        (await readRect(`[data-testid="${TID_SIDE_PANE_FULL_VIEW_CONVERSATION_TAB}"]`)).left >
+        (await readRect('[data-testid="desktop-top-nav-back"]')).right + 24,
+      { timeout: 5_000, timeoutMsg: "侧栏收起后 tab 栏没有给左上角按钮组让位" },
+    );
+    await realKeys(["Control", "b"]);
+    await browser.waitUntil(
+      async () => Math.abs((await readLayoutWidths()).sidebar - before.sidebar) <= 2,
+      { timeout: 5_000, timeoutMsg: "Cmd/Ctrl+B 后侧栏没有恢复" },
+    );
+
+    await realKeys(["Control", "Shift", "f"]);
+    await waitForHostMode("normal");
+    await browser.waitUntil(
+      async () => Math.abs((await readLayoutWidths()).sidebar - before.sidebar) <= 2,
+      { timeout: 5_000, timeoutMsg: "退出完整视图后左侧任务列表没有恢复原宽度" },
+    );
+    const exited = await readLayoutWidths();
+    expect(Math.abs(exited.sidebar - before.sidebar)).toBeLessThanOrEqual(2);
+    expect(Math.abs(exited.sideFrame - before.sideFrame)).toBeLessThanOrEqual(2);
+    expect(await $(`[data-testid="${TID_WORKSPACE_HEADER}"]`).isExisting()).toBe(true);
+
+    await clickFullViewToggle();
+    await waitForHostMode("floating");
+    expect(await readMainPaneMarker()).toBe(PANE_MARKER);
+  });
+
+  it("SPFV-E2E-002 对话 tab 全宽,面板 tab 显示浮窗", async () => {
+    await $(`[data-testid="${TID_SIDE_PANE_FULL_VIEW_CONVERSATION_TAB}"]`).click();
+    await waitForHostMode("conversation");
+    const slot = await readRect(SLOT);
+    await browser.waitUntil(async () => rectsClose(await readRect(HOST), slot, 2), {
+      timeout: 5_000,
+      timeoutMsg: "对话 tab 激活后宿主没有铺满面板内容区",
+    });
+    expect(await $(`[data-testid="${TID_SIDE_PANE_FULL_VIEW_HEADER}"]`).isExisting()).toBe(false);
+    // 对话 tab 保持普通两行布局,草稿顶部仍有「选择项目」栏。
+    expect(await $(COMPOSER_SHELL).getAttribute("data-composer-layout")).toBe("stacked");
+    expect(await $(COMPOSER_PROJECT_TRIGGER).isExisting()).toBe(true);
+    await markComposerEditor();
+
+    await $(TAB).click();
+    await waitForHostMode("floating");
+    await browser.waitUntil(
+      async () => {
+        const host = await readRect(HOST);
+        const currentSlot = await readRect(SLOT);
+        return (
+          Math.abs(currentSlot.right - MARGIN - host.right) <= 2 &&
+          Math.abs(currentSlot.bottom - MARGIN - host.bottom) <= 2 &&
+          host.height < 320
+        );
+      },
+      { timeout: 5_000, timeoutMsg: "浮窗没有收起在右下角" },
+    );
+    // 修复原因:对话 tab 切回浮窗时宿主几何有过渡,过渡中分两次读宿主和输入区会得到不同帧的坐标。
+    await waitForHostTransitionsSettled();
+    // 收起态没有外层:输入区与浮窗同宽、底边对齐,抽屉藏在输入框后面。
+    const host = await readRect(HOST);
+    const dock = await readRect(COMPOSER_DOCK);
+    expect(Math.abs(dock.width - host.width)).toBeLessThanOrEqual(1);
+    expect(Math.abs(dock.bottom - host.bottom)).toBeLessThanOrEqual(1);
+    expect(await $(DRAWER).getAttribute("data-open")).toBe("false");
+    // 浮窗默认是一条:[+] 输入区 [控件][发送] 在同一行,没有草稿项目栏。
+    expect(await $(COMPOSER_SHELL).getAttribute("data-composer-layout")).toBe("inline");
+    expect(await $(COMPOSER_PROJECT_TRIGGER).isExisting()).toBe(false);
+    await browser.waitUntil(async () => (await readRect(HOST)).height <= 64, {
+      timeout: 5_000,
+      timeoutMsg: "单行浮窗高度没有收到一行",
+    });
+    const plus = await readRect(COMPOSER_ACTION_MENU);
+    const input = await readRect(COMPOSER_INPUT);
+    const send = await readRect(COMPOSER_SEND);
+    expect(plus.right).toBeLessThanOrEqual(input.left);
+    expect(input.right).toBeLessThanOrEqual(send.left);
+    expect(Math.abs(centerY(plus) - centerY(send))).toBeLessThanOrEqual(2);
+    expect(Math.abs(centerY(input) - centerY(send))).toBeLessThanOrEqual(2);
+    expect(input.width).toBeGreaterThanOrEqual((await readRect(COMPOSER_SHELL)).width / 2 - 16);
+    // 布局切换只换样式,编辑器节点不重新挂载。
+    expect(await readComposerEditorMarker()).toBe(EDITOR_MARKER);
+  });
+
+  it("SPFV-E2E-003 操作栏、最小化与恢复共享同一份草稿", async () => {
+    await focusFloatingComposer();
+    await waitForHeader(true);
+    // 抽屉从输入框后面滑出:操作栏只有按钮,抽屉一直延伸到输入框底边,两侧没有凹口。
+    expect(await $(DRAWER).getAttribute("data-open")).toBe("true");
+    expect(await $(`[data-testid="${TID_SIDE_PANE_FULL_VIEW_HEADER}"] span`).isExisting()).toBe(
+      false,
+    );
+    // 草稿空闲:操作栏不显示运行中的 loading。
+    expect(await $(`[data-testid="${TID_SIDE_PANE_FULL_VIEW_RUNNING}"]`).isExisting()).toBe(false);
+    await browser.waitUntil(
+      async () =>
+        Math.abs((await readRect(DRAWER)).bottom - (await readRect(COMPOSER_DOCK)).bottom) <= 1.5,
+      { timeout: 5_000, timeoutMsg: "抽屉没有延伸到输入框底边" },
+    );
+    await browser.keys(DRAFT_TEXT);
+    await waitForComposerText(COMPOSER_INPUT, DRAFT_TEXT);
+
+    // 面板 tab trigger 不抢焦点;点进面板内容区才会让焦点离开浮窗。
+    await clickSlotTopLeft();
+    await waitForHeader(false);
+
+    await focusFloatingComposer();
+    await waitForHeader(true);
+    await $(`[data-testid="${TID_SIDE_PANE_FULL_VIEW_MINIMIZE}"]`).click();
+    const bubble = await $(`[data-testid="${TID_SIDE_PANE_FULL_VIEW_BUBBLE}"]`);
+    await bubble.waitForDisplayed({ timeout: 5_000 });
+    await browser.waitUntil(async () => (await readRect(HOST)).width <= 52, {
+      timeout: 5_000,
+      timeoutMsg: "最小化后浮窗没有收成圆形按钮",
+    });
+
+    // 恢复动画逐帧采样:浮窗与输入区高度不能先变高再缩回(回归:宽度过渡时单行输入框折行)。
+    await browser.execute(
+      (hostSelector, dockSelector) => {
+        const samples: Array<{ host: number; dock: number }> = [];
+        (window as unknown as { __spfvRestoreSamples: typeof samples }).__spfvRestoreSamples =
+          samples;
+        const start = performance.now();
+        const tick = () => {
+          const host = document.querySelector(hostSelector)?.getBoundingClientRect();
+          const dock = document.querySelector(dockSelector)?.getBoundingClientRect();
+          samples.push({ host: host?.height ?? 0, dock: dock?.height ?? 0 });
+          if (performance.now() - start < 500) requestAnimationFrame(tick);
+        };
+        document.addEventListener("pointerdown", () => requestAnimationFrame(tick), {
+          capture: true,
+          once: true,
+        });
+      },
+      HOST,
+      COMPOSER_DOCK,
+    );
+    await bubble.click();
+    await bubble.waitForExist({ reverse: true, timeout: 5_000 });
+    await waitForHeader(true);
+    await browser.waitUntil(
+      () =>
+        browser.execute(
+          (selector) => Boolean(document.activeElement?.closest(selector)),
+          COMPOSER_INPUT,
+        ),
+      { timeout: 5_000, timeoutMsg: "恢复后输入框没有获得焦点" },
+    );
+    await waitForComposerText(COMPOSER_INPUT, DRAFT_TEXT);
+    await browser.waitUntil(
+      async () =>
+        (await browser.execute(
+          () =>
+            (window as unknown as { __spfvRestoreSamples: unknown[] }).__spfvRestoreSamples.length,
+        )) > 20,
+      { timeout: 5_000, timeoutMsg: "恢复动画采样不足" },
+    );
+    await waitForHostTransitionsSettled();
+    const finalHost = await readRect(HOST);
+    const finalDock = await readRect(COMPOSER_DOCK);
+    const restoreSamples = await browser.execute(
+      () =>
+        (window as unknown as { __spfvRestoreSamples: Array<{ host: number; dock: number }> })
+          .__spfvRestoreSamples,
+    );
+    expect(Math.max(...restoreSamples.map((sample) => sample.host))).toBeLessThanOrEqual(
+      finalHost.height + 1,
+    );
+    expect(Math.max(...restoreSamples.map((sample) => sample.dock))).toBeLessThanOrEqual(
+      finalDock.height + 1,
+    );
+
+    await $(`[data-testid="${TID_SIDE_PANE_FULL_VIEW_CONVERSATION_TAB}"]`).click();
+    await waitForHostMode("conversation");
+    await waitForComposerText(COMPOSER_INPUT, DRAFT_TEXT);
+    expect(await readMainPaneMarker()).toBe(PANE_MARKER);
+    await $(TAB).click();
+    await waitForHostMode("floating");
+  });
+
+  it("SPFV-E2E-004 拖动吸附到左上并通过菜单打开对话", async () => {
+    await focusFloatingComposer();
+    await waitForHeader(true);
+    const handle = await $(`[data-testid="${TID_SIDE_PANE_FULL_VIEW_HANDLE}"]`);
+    // 修复原因:上一个用例刚从对话 tab 切回浮窗,浮窗几何还在从铺满 slot 过渡到浮窗大小;
+    // 过渡中读到的 ⠿ 坐标会让按下点落在浮窗外(面板内容上),拖动变成终端选区。
+    // 两次读数比较不可靠(同一渲染帧内读数天然相同),改为等宿主没有正在运行的过渡。
+    await waitForHostTransitionsSettled();
+    const handleRect = await readRect(`[data-testid="${TID_SIDE_PANE_FULL_VIEW_HANDLE}"]`);
+    const slot = await readRect(SLOT);
+    await browser
+      .action("pointer", { parameters: { pointerType: "mouse" } })
+      .move({ x: Math.round(handleRect.left + 8), y: Math.round(handleRect.top + 8) })
+      .down({ button: 0 })
+      .move({
+        x: Math.round(handleRect.left + 20),
+        y: Math.round(handleRect.top + 8),
+        duration: 50,
+      })
+      .move({ x: Math.round(slot.left + 300), y: Math.round(slot.top + 40), duration: 200 })
+      .up({ button: 0 })
+      .perform();
+    await browser.waitUntil(
+      async () => {
+        const host = await readRect(HOST);
+        const currentSlot = await readRect(SLOT);
+        return (
+          Math.abs(host.left - (currentSlot.left + MARGIN)) <= 2 &&
+          Math.abs(host.top - (currentSlot.top + MARGIN)) <= 2
+        );
+      },
+      { timeout: 5_000, timeoutMsg: "松手后浮窗没有吸附到左上角" },
+    );
+    expect(
+      await browser.execute(() =>
+        window.localStorage.getItem("zcode:side-pane-full-view:floating-anchor"),
+      ),
+    ).toBe("top-left");
+
+    await focusFloatingComposer();
+    await waitForHeader(true);
+    await handle.click();
+    const openConversation = await $(
+      `[data-testid="${TID_SIDE_PANE_FULL_VIEW_MENU_OPEN_CONVERSATION}"]`,
+    );
+    await openConversation.waitForDisplayed({ timeout: 5_000 });
+    await openConversation.click();
+    await waitForHostMode("conversation");
+    await $(TAB).click();
+    await waitForHostMode("floating");
+    // 回归:菜单 portal 的点击沿 React 树冒泡,曾顺带把浮窗切成展开态。
+    expect(await $(HOST).getAttribute("data-floating")).toBe("collapsed");
+  });
+
+  it("SPFV-E2E-005 用上 / 下按钮展开与收起消息流", async () => {
+    await focusFloatingComposer();
+    await waitForHeader(true);
+    expect(await $(EXPAND).getAttribute("aria-expanded")).toBe("false");
+    await $(EXPAND).click();
+    await browser.waitUntil(
+      async () =>
+        (await $(HOST).getAttribute("data-floating")) === "expanded" &&
+        (await readRect(HOST)).height > 400,
+      { timeout: 5_000, timeoutMsg: "点上按钮后浮窗没有展开" },
+    );
+    expect(await $(EXPAND).getAttribute("aria-expanded")).toBe("true");
+    const timeline = await readRect(`${HOST} [data-testid="${TID_V4_TIMELINE}"]`);
+    expect(timeline.height).toBeGreaterThan(100);
+    // 滚动容器(含滚动条)止于输入框上方,不再延伸到输入框后面。
+    expect(timeline.bottom).toBeLessThanOrEqual((await readRect(COMPOSER_DOCK)).top - 8);
+    await saveThemeScreenshots("spfv-expanded");
+
+    await $(EXPAND).click();
+    await browser.waitUntil(
+      async () =>
+        (await $(HOST).getAttribute("data-floating")) === "collapsed" &&
+        (await readRect(HOST)).height < 360,
+      { timeout: 5_000, timeoutMsg: "点下按钮后浮窗没有收起" },
+    );
+    await saveThemeScreenshots("spfv-collapsed-with-header");
+    await clickSlotTopLeft();
+    await waitForHeader(false);
+    await saveThemeScreenshots("spfv-collapsed");
+    await focusFloatingComposer();
+    await waitForHeader(true);
+    await $(`[data-testid="${TID_SIDE_PANE_FULL_VIEW_MINIMIZE}"]`).click();
+    await $(`[data-testid="${TID_SIDE_PANE_FULL_VIEW_BUBBLE}"]`).waitForDisplayed({
+      timeout: 5_000,
+    });
+    await saveThemeScreenshots("spfv-minimized");
+    await $(`[data-testid="${TID_SIDE_PANE_FULL_VIEW_BUBBLE}"]`).click();
+    await waitForHeader(true);
+  });
+
+  // 插件 UI 页面不在面板 DOM 里:它挂在 body 末尾的停靠层(position:fixed,无 z-index),
+  // 按 tab 占位元素的坐标摆放。这里按 pluginUiPagePlane 的同一套样式复刻停靠层。
+  it("SPFV-E2E-009 body 级插件页面层不被完整视图的面板外框遮挡", async () => {
+    await waitForHostMode("floating");
+    const slot = await readRect(SLOT);
+    const hit = await browser.execute((rect) => {
+      let parking = document.querySelector<HTMLElement>("[data-sandbox-page-parking]");
+      if (!parking) {
+        parking = document.createElement("div");
+        parking.dataset.sandboxPageParking = "true";
+        parking.style.cssText = "position:fixed;inset:0;pointer-events:none;overflow:visible";
+        document.body.append(parking);
+      }
+      const page = document.createElement("div");
+      page.dataset.e2eSpfvPluginPage = "true";
+      Object.assign(page.style, {
+        position: "fixed",
+        inset: "auto",
+        zIndex: "10",
+        left: `${rect.left}px`,
+        top: `${rect.top}px`,
+        width: `${rect.width}px`,
+        height: `${rect.height}px`,
+        pointerEvents: "auto",
+      });
+      parking.append(page);
+      // 取 slot 右下区域,避开吸附在左上的浮窗。
+      const element = document.elementFromPoint(
+        rect.left + rect.width * 0.85,
+        rect.top + rect.height * 0.7,
+      );
+      const result = element?.closest("[data-e2e-spfv-plugin-page]")
+        ? "plugin-page"
+        : (element?.closest("[data-testid]")?.getAttribute("data-testid") ??
+          element?.tagName ??
+          null);
+      page.remove();
+      return result;
+    }, slot);
+    expect(hit).toBe("plugin-page");
+  });
+
+  it("SPFV-E2E-006 面板开关退出完整视图,重新打开不回到完整视图", async () => {
+    await $(`${SIDE_FRAME} [data-testid="${TID_SIDE_PANE_TOGGLE}"]`).click();
+    await waitForHostMode("normal");
+    // 收起有过渡动画,动画结束前再次切换会被吞掉;等面板真正收起再重新打开。
+    await browser.waitUntil(
+      () =>
+        browser.execute((frameSelector) => {
+          const panel = document.querySelector(frameSelector)?.parentElement;
+          return !panel || panel.getBoundingClientRect().width < 10;
+        }, SIDE_FRAME),
+      { timeout: 5_000, timeoutMsg: "面板开关点击后面板没有收起" },
+    );
+    await ensureSidePaneExpanded();
+    await browser.pause(300);
+    expect(await $(HOST).getAttribute("data-side-pane-full-view-host")).toBe("normal");
+    expect(await $(`[data-testid="${TID_WORKSPACE_HEADER}"]`).isExisting()).toBe(true);
+    expect(await readMainPaneMarker()).toBe(PANE_MARKER);
+  });
+});
+
+/** 视觉验收:深浅两套主题各存一张整窗截图到 artifact 目录。 */
+async function saveThemeScreenshots(name: string) {
+  const artifactDir = process.env.ZCODE_E2E_ARTIFACT_DIR;
+  if (!artifactDir) return;
+  for (const theme of ["zai-light", "zai-dark"]) {
+    await browser.execute((value) => {
+      const actions = (
+        window as typeof window & { __testActions?: { setTheme(theme: string): void } }
+      ).__testActions;
+      actions?.setTheme(value);
+    }, theme);
+    await browser.pause(300);
+    await browser.saveScreenshot(join(artifactDir, `${name}-${theme}.png`));
+  }
+}
+
+async function realKeys(keys: string[]) {
+  const isMac = await browser.execute(() => /Mac|iPhone|iPad/.test(navigator.userAgent));
+  const mapped = keys.map((key) => (key === "Control" && isMac ? "Command" : key));
+  await browser.keys(mapped as never);
+}
+
+async function clickSlotTopLeft() {
+  const slot = await readRect(SLOT);
+  await browser
+    .action("pointer", { parameters: { pointerType: "mouse" } })
+    .move({ x: Math.round(slot.left + 60), y: Math.round(slot.top + 60) })
+    .down({ button: 0 })
+    .up({ button: 0 })
+    .perform();
+}
+
+async function clickFullViewToggle() {
+  const toggle = await $(`${SIDE_FRAME} [data-testid="${TID_SIDE_PANE_FULL_VIEW_TOGGLE}"]`);
+  await toggle.waitForClickable({ timeout: 10_000 });
+  await toggle.click();
+}
+
+async function waitForHostMode(mode: "normal" | "conversation" | "floating") {
+  await browser.waitUntil(
+    async () => (await $(HOST).getAttribute("data-side-pane-full-view-host")) === mode,
+    { timeout: 5_000, timeoutMsg: `完整视图宿主没有进入 ${mode}` },
+  );
+}
+
+async function waitForHeader(visible: boolean) {
+  await browser.waitUntil(
+    async () =>
+      (await $(`[data-testid="${TID_SIDE_PANE_FULL_VIEW_HEADER}"]`).isExisting()) === visible,
+    { timeout: 5_000, timeoutMsg: `浮窗操作栏可见性应为 ${visible}` },
+  );
+}
+
+async function focusFloatingComposer() {
+  const input = await $(COMPOSER_INPUT);
+  await input.waitForDisplayed({ timeout: 5_000 });
+  await input.click();
+}
+
+async function waitForComposerText(selector: string, expected: string) {
+  await browser.waitUntil(
+    async () =>
+      (await browser.execute(
+        (inputSelector) => document.querySelector(inputSelector)?.textContent ?? "",
+        selector,
+      )) === expected,
+    { timeout: 5_000, timeoutMsg: `输入框文字应为 ${expected}` },
+  );
+}
+
+async function markMainPane() {
+  await browser.execute(
+    (selector, marker) => {
+      const pane = document.querySelector<HTMLElement>(selector);
+      if (!pane) throw new Error("缺少主 SessionPane");
+      pane.dataset.e2eSpfvMarker = marker;
+    },
+    MAIN_PANE,
+    PANE_MARKER,
+  );
+}
+
+function readMainPaneMarker() {
+  return browser.execute(
+    (selector) => document.querySelector<HTMLElement>(selector)?.dataset.e2eSpfvMarker ?? null,
+    MAIN_PANE,
+  );
+}
+
+async function markComposerEditor() {
+  await browser.execute(
+    (selector, marker) => {
+      const editor = document.querySelector<HTMLElement>(selector);
+      if (!editor) throw new Error("缺少输入框");
+      editor.dataset.e2eSpfvMarker = marker;
+    },
+    COMPOSER_INPUT,
+    EDITOR_MARKER,
+  );
+}
+
+function readComposerEditorMarker() {
+  return browser.execute(
+    (selector) => document.querySelector<HTMLElement>(selector)?.dataset.e2eSpfvMarker ?? null,
+    COMPOSER_INPUT,
+  );
+}
+
+async function waitForHostTransitionsSettled() {
+  await browser.waitUntil(
+    () =>
+      browser.execute(
+        (selector) =>
+          (document.querySelector(selector)?.getAnimations() ?? []).every(
+            (animation) => animation.playState !== "running",
+          ),
+        HOST,
+      ),
+    { timeout: 5_000, timeoutMsg: "完整视图宿主的几何过渡没有结束" },
+  );
+}
+
+function centerY(rect: Rect) {
+  return rect.top + rect.height / 2;
+}
+
+function readRect(selector: string): Promise<Rect> {
+  return browser.execute((target) => {
+    const element = document.querySelector(target);
+    if (!element) throw new Error(`缺少元素 ${target}`);
+    const rect = element.getBoundingClientRect();
+    return {
+      left: rect.left,
+      top: rect.top,
+      right: rect.right,
+      bottom: rect.bottom,
+      width: rect.width,
+      height: rect.height,
+    };
+  }, selector);
+}
+
+function rectsClose(a: Rect, b: Rect, tolerance: number) {
+  return (
+    Math.abs(a.left - b.left) <= tolerance &&
+    Math.abs(a.top - b.top) <= tolerance &&
+    Math.abs(a.width - b.width) <= tolerance &&
+    Math.abs(a.height - b.height) <= tolerance
+  );
+}
+
+function readLayoutWidths() {
+  return browser.execute((sideFrameSelector) => {
+    const width = (selector: string) =>
+      document.querySelector(selector)?.getBoundingClientRect().width ?? 0;
+    return {
+      sidebar: width("#sidebar"),
+      content: width("#content"),
+      sideFrame: width(sideFrameSelector),
+    };
+  }, SIDE_FRAME);
+}
+
+async function ensureSidePaneExpanded() {
+  const isExpanded = () =>
+    browser.execute((frameSelector) => {
+      const panel = document.querySelector(frameSelector)?.parentElement;
+      return Boolean(
+        panel &&
+        panel.getBoundingClientRect().width > 100 &&
+        getComputedStyle(panel).opacity === "1",
+      );
+    }, SIDE_FRAME);
+  if (await isExpanded()) return;
+  const toggle = await $(
+    `[data-testid="${TID_WORKSPACE_HEADER}"] [data-testid="${TID_SIDE_PANE_TOGGLE}"]`,
+  );
+  await toggle.waitForClickable({ timeout: 10_000 });
+  await toggle.click();
+  await browser.waitUntil(isExpanded, { timeout: 10_000, timeoutMsg: "Side Pane 未实际展开" });
+}
+
+async function ensureTerminalTab() {
+  if ((await $$(TAB).length) > 0) return;
+  const launcher = await $('[data-side-pane-open-tab-item="terminal"]');
+  await launcher.waitForClickable({ timeout: 10_000 });
+  await launcher.click();
+  await browser.waitUntil(async () => (await $$(TAB).length) === 1, {
+    timeout: 10_000,
+    timeoutMsg: "Terminal tab 没有打开",
+  });
+}

Некоторые файлы не были показаны из-за большого количества измененных файлов