Merge master into docs/post-v3-release-proofreading

This commit is contained in:
xjt
2026-08-12 20:48:08 +08:00
148 changed files with 2028 additions and 408 deletions
@@ -0,0 +1,6 @@
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write .agents/notes/implemented/bug-fix/2026-08-12-max-tokens-turn-end-notice.md
2026-08-12-max-tokens-turn-end-notice.md: bdb34d67a6d8271089af04f6bcd0f046ef7cdea6
2026-08-12-max-tokens-turn-end-notice.zh.md: 9b9c679972570e791b607330195810d68f04c803
@@ -0,0 +1,27 @@
# Agent Note: The chat flow surfaces a max-tokens turn end
Status: implemented
English | [中文](2026-08-12-max-tokens-turn-end-notice.zh.md)
## Problem
The agent loop records `max-tokens` as its own `turn/end` reason, but no user surface consumed it. In the Web chat flow only `reason.kind === 'error'` built a conversation node, and the unknown-surface fallback claims append-surface events only, so a turn the provider cut at its output cap ended with no visible sign: the truncated answer read as a normal completion, and the user had no way to tell why the run stopped (issue #1522).
## Decision
A `turn-max-tokens` conversation node Definition matches `turn/end` with `reason.kind === 'max-tokens'` and materializes a persistent chat row at the turn position: a warning StateDot, a localized title, and guidance that the truncated output is preserved and sending "continue" resumes in a new turn. The node derives from the durable session event alone, so refresh, restore, and history replay rebuild it identically. It shows no token numbers: the event carries none, and the notice must not fabricate budget data the provider did not report.
The renderer registers under the keyed `conversation.chat.node` seat like every chat row, and the legacy chat-snapshot contribution includes the node. The fixture history gained a max-tokens sample turn (72; the image and todo turns shifted to 73 and 74), and an assembled keyless snapshot pins the dot state, title, and hint, so a regression that routes max-tokens through the error presentation or silences it again changes a golden.
## Alternatives considered
**Extending `turn-error` with a max-tokens arm** — rejected: the acceptance for issue #1522 requires that max-tokens not read as a provider error; a shared node kind couples the two presentations, and the two reasons carry different data (an error payload versus nothing).
**A turn-tail marker instead of a flow row** — rejected: the tail renders closing chrome for a finished turn and its actions collapse on later turns, while the truncation notice must stay at the turn that was cut and remain visible in history without interaction.
**A continue or retry action button on the notice** — deferred: resuming has open semantics (new turn versus same-turn splice, old-output retention rules) that issue #1522 explicitly leaves out of scope; guidance text carries the safe next step without committing to an action contract.
## Consequences
Max-tokens turn ends are visible, localized, and distinct from both errors and normal completion across live streaming, reload, and replay. The fixture renumbering cost two comment updates in dependent snapshots, and anything pinning fixture turn numbers must count from the new layout. Surfaces other than the Web chat flow (ACP and SDK consumers) keep mapping the reason through their own presentations and are unchanged.
@@ -0,0 +1,27 @@
# Agent Note: 聊天流展示 max-tokens 结束的轮次
Status: implemented
[English](2026-08-12-max-tokens-turn-end-notice.md) | 中文
## Problem
agent loop 已把 `max-tokens` 记录为独立的 `turn/end` 原因,但没有任何用户表面消费它。Web 聊天流中只有 `reason.kind === 'error'` 会生成会话节点,unknown-surface 兜底又只接管 append-surface 事件,于是被提供方在输出上限处截断的轮次没有任何可见迹象:被截断的回答看起来和正常完成一样,用户无从得知运行为何停止(issue #1522)。
## Decision
新增 `turn-max-tokens` 会话节点 Definition,匹配 `reason.kind === 'max-tokens'``turn/end`,在该轮位置生成一条持久聊天行:warning 状态的 StateDot、本地化标题,以及说明已截断输出会保留、发送“继续”可在新一轮接着输出的指引。节点只从持久会话事件推导,因此刷新、恢复和历史回放会重建出完全一致的结果。提示不显示任何 token 数字:事件本身不携带数量,提示也不得伪造提供方未报告的预算数据。
渲染器与其他聊天行一样注册在按 kind 分发的 `conversation.chat.node` 槽位下,legacy chat-snapshot 投影也包含该节点。fixture 历史新增了一个 max-tokens 样本轮(72,图片轮和 todo 轮顺移为 73、74),并有一条 assembled keyless snapshot 钉住圆点状态、标题和指引文案,把 max-tokens 路由回错误样式或再次静默的回归都会改动 golden。
## Alternatives considered
**在 `turn-error` 上加一个 max-tokens 分支** — 否决:issue #1522 的验收要求 max-tokens 不得呈现为普通 provider error;共用节点会耦合两种呈现,且两种原因携带的数据不同(一个有错误负载,一个没有)。
**用 turn-tail 标记代替独立聊天行** — 否决:turn-tail 渲染的是完成轮次的收尾信息,其操作会在后续轮次折叠,而截断提示必须停留在被截断的那一轮,并且在历史中无需交互即可看到。
**在提示上放继续或重试按钮** — 暂缓:恢复输出的语义尚未确定(新开一轮还是同轮续写、旧输出保留规则),issue #1522 明确把它排除在范围外;指引文字已给出安全的下一步,不必先固定一个操作契约。
## Consequences
max-tokens 结束在实时流、刷新和回放中都可见、已本地化,并与错误和正常完成明确区分。fixture 重编号需要更新两处依赖 snapshot 的注释,之后钉 fixture 轮次号的改动要按新布局计数。Web 聊天流之外的表面(ACP 和 SDK 消费方)仍按各自的呈现映射该原因,本次不变。
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority; # side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with: # after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write .agents/notes/implemented/feature/2026-08-10-telemetry-default-off.md # pnpm run verify-translation-pairing --write .agents/notes/implemented/feature/2026-08-10-telemetry-default-off.md
2026-08-10-telemetry-default-off.md: 856b2f8fe604a1ddb9642ead702b4705c359bc72 2026-08-10-telemetry-default-off.md: 8163079eb5f8d6170e329c164141364681030793
2026-08-10-telemetry-default-off.zh.md: 2135595a8fa040413246d8ff802f3d43b6057bb0 2026-08-10-telemetry-default-off.zh.md: c8e16f84248bde5bdc2c1d4bdb814f0d80fcf77e
@@ -12,7 +12,7 @@ DeepSeek Harness has two outbound telemetry feeds. During internal testing, the
Both feeds use `DSH_TELEMETRY_MODE` as their positive consent setting. Unset and empty values resolve to `DISABLED`. `@deepseek-ai/dsh-session-telemetry-otel` also resolves an omitted `mode` to `DISABLED`, which constructs no OTel provider, processor, or exporter and leaves feedback in the local session log. The shared dsh base keeps the backend row mounted so disabled feedback can still explain that nothing was shared. A deployment opts into Session Log sharing through `FULL` or `FEEDBACK_ONLY`; only `FULL` also permits dsh-sdk launcher reporting. Any non-empty `DSH_TELEMETRY_DISABLED` remains an authoritative pre-load hard opt-out. The [default-mount decision](2026-07-31-web-telemetry-default-mount.md) continues to own the endpoint, batching cadence, and exit-drain settings. Both feeds use `DSH_TELEMETRY_MODE` as their positive consent setting. Unset and empty values resolve to `DISABLED`. `@deepseek-ai/dsh-session-telemetry-otel` also resolves an omitted `mode` to `DISABLED`, which constructs no OTel provider, processor, or exporter and leaves feedback in the local session log. The shared dsh base keeps the backend row mounted so disabled feedback can still explain that nothing was shared. A deployment opts into Session Log sharing through `FULL` or `FEEDBACK_ONLY`; only `FULL` also permits dsh-sdk launcher reporting. Any non-empty `DSH_TELEMETRY_DISABLED` remains an authoritative pre-load hard opt-out. The [default-mount decision](2026-07-31-web-telemetry-default-mount.md) continues to own the endpoint, batching cadence, and exit-drain settings.
The dsh-sdk launcher reads the same variable without parsing `cordis.yml` or booting Cordis. `FULL` permits reporting; `FEEDBACK_ONLY`, `DISABLED`, unset, and empty values deny it. Consent is frozen from the launching environment before the command runs, because `dsh-sdk start` loads a project `.env` and project code can mutate `process.env`: resolving afterwards would let a project grant reporting of its own configuration, which the [configuration source ownership decision](../architecture/2026-08-04-configuration-source-ownership.md) denies for the whole `DSH_*` namespace. An unsupported mode denies rather than throwing at that boundary, since telemetry may never change a command's result. That launcher and its project toolchain were subsequently removed by the [SDK project toolchain removal](../simplification/2026-08-11-remove-sdk-project-toolchain.md). The dsh-sdk launcher reads the same variable without parsing `cordis.yml` or booting Cordis. `FULL` permits reporting; `FEEDBACK_ONLY`, `DISABLED`, unset, and empty values deny it. Consent is frozen from the launching environment before the command runs, because `dsh-sdk start` loads a project `.env` and project code can mutate `process.env`: resolving afterwards would let a project grant reporting of its own configuration, which the [configuration source ownership decision](../architecture/2026-08-04-configuration-source-ownership.md) denies for the whole `DSH_*` namespace. An unsupported mode denies rather than throwing at that boundary, since telemetry may never change a command's result. Telemetry consent is owned here; no SDK project configuration or toolchain may opt in on the launching environment's behalf.
The versioned Web welcome notice states that Session Log upload is off by default, names `DSH_TELEMETRY_MODE=FEEDBACK_ONLY` and `DSH_TELEMETRY_MODE=FULL` as the two opt-in choices, and discloses that `FULL` also enables dsh-sdk command telemetry. Its version changes with that material privacy statement so every profile acknowledges the current copy. The versioned Web welcome notice states that Session Log upload is off by default, names `DSH_TELEMETRY_MODE=FEEDBACK_ONLY` and `DSH_TELEMETRY_MODE=FULL` as the two opt-in choices, and discloses that `FULL` also enables dsh-sdk command telemetry. Its version changes with that material privacy statement so every profile acknowledges the current copy.
@@ -12,7 +12,7 @@ DeepSeek Harness 有两路出站遥测数据流。在内测阶段,共享基础
两路数据流都使用 `DSH_TELEMETRY_MODE` 作为正向授权配置。未设置和空值都解析为 `DISABLED``@deepseek-ai/dsh-session-telemetry-otel` 也将省略的 `mode` 解析为 `DISABLED`;该模式不构造 OTel 提供方、处理器或导出器,并将反馈留在本地会话日志中。dsh 共享基础配置继续挂载后端配置行,使禁用模式仍可在记录反馈时说明没有共享任何内容。部署方通过 `FULL``FEEDBACK_ONLY` 显式启用 Session Log 共享;只有 `FULL` 还允许 dsh-sdk 启动器上报。任何非空 `DSH_TELEMETRY_DISABLED` 仍是具有最高优先级的加载前硬性退出开关。[默认挂载决策](2026-07-31-web-telemetry-default-mount.md)继续负责 endpoint、批处理节奏和退出排空设置。 两路数据流都使用 `DSH_TELEMETRY_MODE` 作为正向授权配置。未设置和空值都解析为 `DISABLED``@deepseek-ai/dsh-session-telemetry-otel` 也将省略的 `mode` 解析为 `DISABLED`;该模式不构造 OTel 提供方、处理器或导出器,并将反馈留在本地会话日志中。dsh 共享基础配置继续挂载后端配置行,使禁用模式仍可在记录反馈时说明没有共享任何内容。部署方通过 `FULL``FEEDBACK_ONLY` 显式启用 Session Log 共享;只有 `FULL` 还允许 dsh-sdk 启动器上报。任何非空 `DSH_TELEMETRY_DISABLED` 仍是具有最高优先级的加载前硬性退出开关。[默认挂载决策](2026-07-31-web-telemetry-default-mount.md)继续负责 endpoint、批处理节奏和退出排空设置。
dsh-sdk 启动器读取同一变量,不解析 `cordis.yml`,也不启动 Cordis。`FULL` 允许上报;`FEEDBACK_ONLY``DISABLED`、未设置和空值都会拒绝。授权在命令执行前从启动环境冻结:`dsh-sdk start` 会加载项目 `.env`,项目代码也能修改 `process.env`,若在执行后解析,项目便能自行授权上报其自身配置,而[配置来源所有权决策](../architecture/2026-08-04-configuration-source-ownership.md)对整个 `DSH_*` 命名空间禁止这种行为。在该边界上,不受支持的模式按拒绝处理而非抛出,因为遥测不得改变命令结果。该启动器及其项目工具链随后已由 [SDK 项目工具链移除决策](../simplification/2026-08-11-remove-sdk-project-toolchain.md)移除 dsh-sdk 启动器读取同一变量,不解析 `cordis.yml`,也不启动 Cordis。`FULL` 允许上报;`FEEDBACK_ONLY``DISABLED`、未设置和空值都会拒绝。授权在命令执行前从启动环境冻结:`dsh-sdk start` 会加载项目 `.env`,项目代码也能修改 `process.env`,若在执行后解析,项目便能自行授权上报其自身配置,而[配置来源所有权决策](../architecture/2026-08-04-configuration-source-ownership.md)对整个 `DSH_*` 命名空间禁止这种行为。在该边界上,不受支持的模式按拒绝处理而非抛出,因为遥测不得改变命令结果。遥测授权由本说明持有;SDK 项目配置或工具链不得代替启动环境显式启用遥测
带版本的 Web 欢迎通知说明会话日志上传默认关闭,将 `DSH_TELEMETRY_MODE=FEEDBACK_ONLY``DSH_TELEMETRY_MODE=FULL` 列为两种显式启用选项,并披露 `FULL` 同时会启用 dsh-sdk 命令遥测。其版本随这项重要的隐私声明一同变更,使每个 profile 都确认当前文案。 带版本的 Web 欢迎通知说明会话日志上传默认关闭,将 `DSH_TELEMETRY_MODE=FEEDBACK_ONLY``DSH_TELEMETRY_MODE=FULL` 列为两种显式启用选项,并披露 `FULL` 同时会启用 dsh-sdk 命令遥测。其版本随这项重要的隐私声明一同变更,使每个 profile 都确认当前文案。
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority; # side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with: # after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write .agents/notes/implemented/feature/2026-08-10-web-session-log-export.md # pnpm run verify-translation-pairing --write .agents/notes/implemented/feature/2026-08-10-web-session-log-export.md
2026-08-10-web-session-log-export.md: 8fa62b877df1be55de2c373d4281672881dc2b9d 2026-08-10-web-session-log-export.md: 24703bd5c98a91bf8708ae243ef7a44df4afb8f1
2026-08-10-web-session-log-export.zh.md: 1dbc5a3219f446464c2f6e17445e5d7dffabcf0a 2026-08-10-web-session-log-export.zh.md: d5e77495f76511a9226f91fb2c10014a61a81a15
@@ -12,8 +12,8 @@ The Trajectory view had no way to hand a debugging artifact to a human: the raw
- **The export is a host-only download, not an RPC**: `GET /api/session.export?sessionId=…&includeDescendants=true` streams one ZIP attachment. Every file is a session's **stored artifact text verbatim**: `readRaw` on the persistence service reads the backend's own durable bytes (the JSONL backend decodes its physical zstd frames, or returns plaintext) — never a reconstruction from parsed events, so packed-chunk rows, key order, and line breaks survive byte-for-byte — under its original base name (`session.jsonl` at the root, `subagents/<id>/session.jsonl` for descendants). Compression runs on the host with fflate's streaming `Zip`/`ZipDeflate` API at validated `sessionExportCompressionLevel` 09 (default 6), letting deployments trade CPU and latency against archive size; each entry is deflated in bounded chunks as it is produced, so the response is chunked as it is generated and the host never holds the whole archive in one buffer (at most one descendant's artifact text beyond the preloaded root). At the 64 KiB response byte high-water mark, production waits for consumer pull to restore capacity; fflate's synchronous callback can add at most one bounded input push beyond that queue bound. No manifest is written — every file is byte-identical to the durable artifact and self-describing through its own header line. - **The export is a host-only download, not an RPC**: `GET /api/session.export?sessionId=…&includeDescendants=true` streams one ZIP attachment. Every file is a session's **stored artifact text verbatim**: `readRaw` on the persistence service reads the backend's own durable bytes (the JSONL backend decodes its physical zstd frames, or returns plaintext) — never a reconstruction from parsed events, so packed-chunk rows, key order, and line breaks survive byte-for-byte — under its original base name (`session.jsonl` at the root, `subagents/<id>/session.jsonl` for descendants). Compression runs on the host with fflate's streaming `Zip`/`ZipDeflate` API at validated `sessionExportCompressionLevel` 09 (default 6), letting deployments trade CPU and latency against archive size; each entry is deflated in bounded chunks as it is produced, so the response is chunked as it is generated and the host never holds the whole archive in one buffer (at most one descendant's artifact text beyond the preloaded root). At the 64 KiB response byte high-water mark, production waits for consumer pull to restore capacity; fflate's synchronous callback can add at most one bounded input push beyond that queue bound. No manifest is written — every file is byte-identical to the durable artifact and self-describing through its own header line.
- **Error vocabulary is HTTP-native**: missing services → 500, a backend without per-session raw artifacts → 501, missing root session → 404 (all decided before any byte streams), and a descendant without a stored artifact → the stream errors (fail-loud, never silent under-export). Request abort remains cancellation instead of being rewritten as 500; request and response-consumer cancellation converge on the producer signal, which reaches lineage, persistence, and attachment reads and terminates the active compressor. The carrier (`toFetchHandler`) already applies the `/api` trust fence; the GET branch sits beside the existing SSE GET routes, and `ApiProxy.downloads.sessionLog` (host-only, no wire envelope, absent from `IApiClient`) implements it. - **Error vocabulary is HTTP-native**: missing services → 500, a backend without per-session raw artifacts → 501, missing root session → 404 (all decided before any byte streams), and a descendant without a stored artifact → the stream errors (fail-loud, never silent under-export). Request abort remains cancellation instead of being rewritten as 500; request and response-consumer cancellation converge on the producer signal, which reaches lineage, persistence, and attachment reads and terminates the active compressor. The carrier (`toFetchHandler`) already applies the `/api` trust fence; the GET branch sits beside the existing SSE GET routes, and `ApiProxy.downloads.sessionLog` (host-only, no wire envelope, absent from `IApiClient`) implements it.
- **The UI just downloads**: the 导出 button hands the endpoint directly to the browser's native download manager, so JavaScript neither fetches nor buffers the ZIP; the `session.log` RPC that an earlier iteration shipped was removed — the download endpoint is its only consumer, and the repo rule is no public interface without a current owner. The client bundle carries no archive implementation. - **The UI just downloads**: browser consumers may issue a bodyless `HEAD` preflight for preparation errors, then hand the GET endpoint to the browser's native download manager, so JavaScript never buffers the ZIP. The `session.log` RPC that an earlier iteration shipped was removed — the download endpoint is its only consumer, and the repo rule is no public interface without a current owner. The client bundle carries no archive implementation.
- The 导出 button lives in the Trajectory toolbar; the plugin exposes `exportLog` through the view's inject face (components never touch ctx) and resolves the view tab label through the locale service (`轨迹` in Chinese, `Trajectory` in English). In-flight state disables the button during the handoff; a synchronous browser-handoff failure surfaces in a visible alert bar, while HTTP delivery is owned and reported by the browser. - The current Header and `/export` consumers are defined by the [Web export command and dialog decision](2026-08-11-web-export-command-and-dialog.md).
## Alternatives considered ## Alternatives considered
@@ -12,8 +12,8 @@ Trajectory 视图没有任何方式把调试工件交到人手里:原始会话
- **导出是宿主侧的下载面,不是 RPC**:`GET /api/session.export?sessionId=…&includeDescendants=true` 流式返回一个 ZIP 附件。每个文件都是会话**存储工件的逐字原文**:持久化服务新增的 `readRaw` 读取后端自己的持久化字节(jsonl 后端解码其物理 zstd 帧,或直接返回明文)——绝非从解析后事件重建,因此 chunk 打包、键序、换行全部逐字节保留——放在其原始基础文件名下(根为 `session.jsonl`,子代理为 `subagents/<id>/session.jsonl`)。压缩在宿主侧使用 fflate 流式 `Zip`/`ZipDeflate` API 和已验证的 `sessionExportCompressionLevel` 0–9(默认 6),使部署可以在 CPU/延迟与归档大小之间取舍;每个条目按有界分块边产出边压缩,响应随生成分块写出,宿主从不把整个归档放进单个缓冲区(除预载的根外,最多同时持有一条后代的工件文本)。到达 64 KiB 响应字节高水位后,生产会等待 Consumer pull 恢复容量;fflate 的同步回调最多只会在该队列界限外再增加一次有界输入 push。不写清单——每个文件都与持久化工件逐字节一致,并通过自身 header 行自描述。 - **导出是宿主侧的下载面,不是 RPC**:`GET /api/session.export?sessionId=…&includeDescendants=true` 流式返回一个 ZIP 附件。每个文件都是会话**存储工件的逐字原文**:持久化服务新增的 `readRaw` 读取后端自己的持久化字节(jsonl 后端解码其物理 zstd 帧,或直接返回明文)——绝非从解析后事件重建,因此 chunk 打包、键序、换行全部逐字节保留——放在其原始基础文件名下(根为 `session.jsonl`,子代理为 `subagents/<id>/session.jsonl`)。压缩在宿主侧使用 fflate 流式 `Zip`/`ZipDeflate` API 和已验证的 `sessionExportCompressionLevel` 0–9(默认 6),使部署可以在 CPU/延迟与归档大小之间取舍;每个条目按有界分块边产出边压缩,响应随生成分块写出,宿主从不把整个归档放进单个缓冲区(除预载的根外,最多同时持有一条后代的工件文本)。到达 64 KiB 响应字节高水位后,生产会等待 Consumer pull 恢复容量;fflate 的同步回调最多只会在该队列界限外再增加一次有界输入 push。不写清单——每个文件都与持久化工件逐字节一致,并通过自身 header 行自描述。
- **错误词汇是 HTTP 原生的**:服务缺失 → 500,后端不提供每会话原始工件 → 501,根会话缺失 → 404(三者都在任何字节流出前判定),后代缺少存储工件 → 流失败(fail-loud,绝不静默少导出)。请求中止会保持取消语义而不会改写成 500;请求取消与响应 Consumer 取消汇合到生产者 signal,该 signal 会传到血缘、持久化与附件读取,并终止活跃压缩器。载体(`toFetchHandler`)已对 `/api` 应用信任围栏;GET 分支与既有 SSE GET 路由并列,由 `ApiProxy.downloads.sessionLog`host-only、无 wire 信封、不在 `IApiClient` 上)实现。 - **错误词汇是 HTTP 原生的**:服务缺失 → 500,后端不提供每会话原始工件 → 501,根会话缺失 → 404(三者都在任何字节流出前判定),后代缺少存储工件 → 流失败(fail-loud,绝不静默少导出)。请求中止会保持取消语义而不会改写成 500;请求取消与响应 Consumer 取消汇合到生产者 signal,该 signal 会传到血缘、持久化与附件读取,并终止活跃压缩器。载体(`toFetchHandler`)已对 `/api` 应用信任围栏;GET 分支与既有 SSE GET 路由并列,由 `ApiProxy.downloads.sessionLog`host-only、无 wire 信封、不在 `IApiClient` 上)实现。
- **UI 只负责下载**「导出」按钮将端点直接交给浏览器原生下载管理器,因此 JavaScript 既不会 fetch 也不会缓冲 ZIP早先迭代发布的 `session.log` RPC 已删除——下载端点是它唯一的消费者,仓库规则是不留无当前所有者的公共接口。客户端 bundle 不包含任何归档实现。 - **UI 只负责下载**浏览器 Consumer 可以先发出不读取 body 的 `HEAD` 预检以取得准备阶段错误,再把 GET 端点交给浏览器原生下载管理器,因此 JavaScript 不会缓冲 ZIP早先迭代发布的 `session.log` RPC 已删除——下载端点是它唯一的消费者,仓库规则是不留无当前所有者的公共接口。客户端 bundle 不包含任何归档实现。
- 「导出」按钮位于 Trajectory 工具栏;插件通过视图的 inject face 暴露 `exportLog`(组件从不接触 ctx),并通过 locale 服务解析视图标签页标题(中文「轨迹」、英文 "Trajectory")。进行中状态会在交接期间禁用按钮;同步的浏览器交接失败会在可见警示条中显示,而 HTTP 交付由浏览器负责并报告 - 当前 Header 与 `/export` Consumer 由 [Web 导出命令与弹窗决策](2026-08-11-web-export-command-and-dialog.md)定义
## 考虑过的替代方案 ## 考虑过的替代方案
@@ -0,0 +1,6 @@
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write .agents/notes/implemented/feature/2026-08-11-web-export-command-and-dialog.md
2026-08-11-web-export-command-and-dialog.md: 385fc05f42af329e59d0989d5f4b2145a637db11
2026-08-11-web-export-command-and-dialog.zh.md: a86c003211a83c90a264ab5f17c4357c8da3ccb3
@@ -0,0 +1,31 @@
# Agent Note: Web `/export` shares the streamed Session ZIP download
Status: implemented
English | [中文](2026-08-11-web-export-command-and-dialog.zh.md)
## Problem
Session export needs a stable Session-level visible action and an equivalent slash-command path. A second backend reader or Host-path writer would duplicate the download implementation and introduce platform-specific file-permission and path-reveal problems.
## Decision
`@deepseek-ai/dsh-session-export` registers a Web-only `/export` human command and provides the browser `ctx.sessionExport` controller. The command records an ordinary `command/run` and `command/done`; after `command.execute` returns a successful result, `dsh-client-ui-command` emits a local acknowledgment that asks this browser's controller to download ApiProxy's existing `GET /api/session.export` ZIP. Other clients render the broadcast command nodes without repeating the browser side effect. The 111×32 `Session log` capsule in the Session Header calls that controller directly. Both paths use a `HEAD` preflight for preparation errors, then hand the GET URL to the browser download manager so JavaScript never buffers the ZIP; they share the same in-flight state and Modal.
The Header contribution occupies the right-aligned `conversation.session.header.utilities` list and renders the `Session log` text capsule with its trailing download icon plus the shared Modal. The title-adjacent `conversation.session.header.actions` list continues to own mode, Subagent, and Task entries, so mounting Session export does not reorder or move them. The export contribution does not observe Session history. A per-Session controller collapses concurrent gestures, aborts active preflights when its plugin disposes, ignores late requests after disposal, and preserves a user's closed state when the request later completes.
The ZIP endpoint and persistence `readRaw` capability remain owned by `dsh-host-apiproxy` and the persistence package. The endpoint flushes a live root Session before reading its artifact, so the local acknowledgment cannot race ahead of durable command lifecycle rows. This package does not serialize Session events, write Host files, deliver Host paths, or implement SQLite fallback.
The package is an ordinary Client aggregate project. Its single `tsconfig.json` compiles the Node loader entries and browser contribution together; Host-side tests still exercise the command and invariant through their source entries.
## Alternatives considered
**Put the visible action in Trajectory.** Rejected because export is a Session-level operation and must remain discoverable without opening a diagnostic view.
**Write a Host-side JSONL file from `/export`.** Rejected because it would diverge from the descendant-and-attachment ZIP, require Windows ACL handling, and return a Host path that may be meaningless to a remote browser.
**Keep both Header and Trajectory buttons.** Rejected because two visible controls for the same Session operation create duplicate ownership and inconsistent placement.
## Consequences
The Header action and `/export` download the same ZIP and show the same feedback. An executed command remains visible in the durable transcript without creating a model turn. The preflight reports failures found before streaming starts; failures while the browser consumes the GET remain browser-download failures. Deployments whose persistence backend has no raw per-Session artifact receive the endpoint's existing failure; SQLite support remains separate work. Command availability before a Session's first turn is separate work.
@@ -0,0 +1,31 @@
# Agent Note: Web `/export` 共用流式 Session ZIP 下载
Status: implemented
[English](2026-08-11-web-export-command-and-dialog.md) | 中文
## Problem
Session 导出需要一个稳定的 Session 级外显入口,以及语义等价的斜杠命令路径。第二套后端读取器或 Host 路径写入器会重复下载实现,并引入平台相关的文件权限和路径公开问题。
## Decision
`@deepseek-ai/dsh-session-export` 注册 Web 专用的 `/export` 用户命令,并提供浏览器 `ctx.sessionExport` 控制器。该命令记录普通的 `command/run``command/done``command.execute` 返回成功结果后,`dsh-client-ui-command` 会发布本地确认,请求当前浏览器的控制器下载 ApiProxy 现有的 `GET /api/session.export` ZIP。其他客户端会渲染广播的命令节点,但不会重复执行浏览器副作用。Session Header 中 111×32 的 `Session log` 胶囊按钮会直接调用该控制器。两种入口通过 `HEAD` 预检获得准备阶段错误,再把 GET URL 交给浏览器下载管理器,因此 JavaScript 不会缓冲 ZIP;两种入口共用进行中状态和 Modal。
Header 贡献占用最右侧的 `conversation.session.header.utilities` 列表,渲染带尾部下载图标的 `Session log` 文字 capsule 和共享 Modal。标题旁的 `conversation.session.header.actions` 列表继续承载模式、Subagent 和 Task 配置项,挂载 Session export 不会改变它们的顺序或位置。导出贡献不观察 Session 历史。逐 Session 控制器会折叠并发操作,在插件释放时取消活动预检,忽略释放后的迟到请求,并在请求后来完成时保留用户已经关闭弹窗的状态。
ZIP 端点与持久化 `readRaw` 能力仍由 `dsh-host-apiproxy` 和持久化包拥有。端点会在读取工件前 flush 活动的根 Session,因此本地确认不会早于持久命令生命周期行。本包不序列化 Session 事件、不写 Host 文件、不交付 Host 路径,也不实现 SQLite 回退。
本包是普通的 Client 聚合项目。单一 `tsconfig.json` 会一起编译 Node loader 入口与浏览器贡献;Host 侧测试仍通过源码入口验证命令与 invariant。
## Alternatives considered
**把外显入口放进 Trajectory。** 不采用,因为导出是 Session 级操作,用户不应先打开诊断视图才能发现它。
**让 `/export` 写入 Host 侧 JSONL 文件。** 不采用,因为这会偏离包含子 Session 与附件的 ZIP,需要处理 Windows ACL,并返回对远程浏览器可能没有意义的 Host 路径。
**同时保留 Header 与 Trajectory 按钮。** 不采用,因为两个外显控件执行同一项 Session 操作,会形成重复归属和不一致的位置。
## Consequences
Header 操作与 `/export` 会下载同一个 ZIP,并显示相同反馈。已执行命令保留在持久文本记录中,且不创建模型轮次。预检会报告流式传输开始前发现的失败;浏览器消费 GET 时发生的失败仍属于浏览器下载失败。持久化后端没有逐 Session 原始工件时,用户会收到端点现有的失败;SQLite 支持保留为独立工作。Session 首轮前的命令可用性属于独立工作。
@@ -283,6 +283,7 @@ describe('web e2e: agent-preset selection', () => {
expect(snapshot).toContain('Minimal mode') expect(snapshot).toContain('Minimal mode')
expect(snapshot).toContain('button "1 subagent"') expect(snapshot).toContain('button "1 subagent"')
expect(snapshot.indexOf('Minimal mode')).toBeLessThan(snapshot.indexOf('button "1 subagent"')) expect(snapshot.indexOf('Minimal mode')).toBeLessThan(snapshot.indexOf('button "1 subagent"'))
expect(snapshot.indexOf('button "1 subagent"')).toBeLessThan(snapshot.indexOf('button "Session log"'))
// Static chrome, not a control: the header can only report a composition // Static chrome, not a control: the header can only report a composition
// the host would refuse to change. // the host would refuse to change.
expect(snapshot).not.toContain('button "Minimal mode"') expect(snapshot).not.toContain('button "Minimal mode"')
+1
View File
@@ -43,6 +43,7 @@ const PLUGINS: readonly (WebBootEntry & { bundlePath: string })[] = [
'@deepseek-ai/dsh-client-ui-sidebar', '@deepseek-ai/dsh-client-ui-sidebar',
], ],
}, },
{ id: '@deepseek-ai/dsh-session-export', bundlePath: 'packages/session-query/session-export/lib/client.js', url: '/plugins/session-export.js', rev: 'fx', inject: ['@deepseek-ai/dsh-client-ui-command', '@deepseek-ai/dsh-client-ui-conversation'] },
{ id: '@deepseek-ai/dsh-client-ui-trajectory', bundlePath: 'packages/client/ui-trajectory/lib/client.js', url: '/plugins/ui-trajectory.js', rev: 'fx', inject: ['@deepseek-ai/dsh-client-ui-conversation'] }, { id: '@deepseek-ai/dsh-client-ui-trajectory', bundlePath: 'packages/client/ui-trajectory/lib/client.js', url: '/plugins/ui-trajectory.js', rev: 'fx', inject: ['@deepseek-ai/dsh-client-ui-conversation'] },
] ]
+1 -1
View File
@@ -1,7 +1,7 @@
// @vitest-environment jsdom // @vitest-environment jsdom
// Multimodal image surfaces over the BUILT client graph (the code-mode-fixture // Multimodal image surfaces over the BUILT client graph (the code-mode-fixture
// idiom: real bundles via AppWebEntry, keyless FixtureApiClient transport). // idiom: real bundles via AppWebEntry, keyless FixtureApiClient transport).
// Opens the fixture history session whose turn 72 carries an image in BOTH a // Opens the fixture history session whose turn 73 carries an image in BOTH a
// user message and an assistant message, and pins the product surfaces: the // user message and an assistant message, and pins the product surfaces: the
// history ImageGallery loading real fixture bytes through the authorized // history ImageGallery loading real fixture bytes through the authorized
// sessions.attachment route, the single-click ImageLightbox, and the composer // sessions.attachment route, the single-click ImageLightbox, and the composer
@@ -0,0 +1,56 @@
// @vitest-environment jsdom
// Assembled max-tokens snapshot: boots the real built `packages/client/*/lib/
// client.js` bundles through AppWebEntry's ModuleLoader path against the
// keyless FixtureApiClient transport, opens the fixture session, and pins the
// surface its max-tokens turn (72) reaches — the turn-end notice row that a
// provider output-cap truncation must render instead of ending silently.
//
// The dot state is pinned beside the copy on purpose: `dot=warning` is what
// distinguishes this notice from the error row, so a regression that routes
// max-tokens through the turn-error presentation changes this file even when
// its own copy still renders.
import { mkdirSync, writeFileSync } from 'node:fs'
import { dirname, join } from 'node:path'
import { fireEvent, screen, waitFor, within } from '@testing-library/react'
import { describe, expect, it } from 'vitest'
import { hasClass, installAssembledBootEnv, mountAssembledApp, REFRESHING_GOLDEN } from './assembled-boot.ts'
const EXPECTED = join(process.cwd(), 'apps/web/tests/snapshots/max-tokens-notice/history-turn.expected.txt')
installAssembledBootEnv()
/** Normalize the notice row to stable fields: its dot state, title, and hint. */
function noticeShape(row: Element): string {
const first = (name: string): string =>
[...row.querySelectorAll('*')].filter(el => hasClass(el, name))[0]?.textContent?.trim() ?? '<absent>'
return [
`dot=${row.querySelector('[data-state]')?.getAttribute('data-state') ?? '<absent>'}`,
`title=${first('maxTokensTitle')}`,
`hint=${first('turnErrorMessage')}`,
].join('\n')
}
describe('assembled max-tokens turn-end notice', () => {
it('renders the localized truncation notice after the cut-off answer instead of ending silently', async () => {
mountAssembledApp()
const tree = await screen.findByRole('tree', { name: 'Sessions' }, { timeout: 10_000 })
fireEvent.click(await within(tree).findByText('Fixture 历史会话'))
// The truncated answer itself stays in the flow: the notice supplements the
// partial output, it never replaces it.
await screen.findByText(/条目 3:这一条写到一半被/, undefined, { timeout: 10_000 })
const row = await waitFor(() => {
const found = [...document.querySelectorAll('[role="status"]')]
.find(candidate => [...candidate.querySelectorAll('*')].some(el => hasClass(el, 'maxTokensTitle')))
expect(found).not.toBeUndefined()
return found!
}, { timeout: 10_000 })
const shape = noticeShape(row)
if (REFRESHING_GOLDEN) {
mkdirSync(dirname(EXPECTED), { recursive: true })
writeFileSync(EXPECTED, shape)
}
await expect(shape).toMatchFileSnapshot(EXPECTED)
})
})
+81 -4
View File
@@ -52,6 +52,11 @@ async function assertBaselineSucceeded(response: Response, method: string): Prom
} }
async function ensureSeedOpen(page: Page): Promise<void> { async function ensureSeedOpen(page: Page): Promise<void> {
const welcome = page.locator('[class*="onboardingOverlay"]')
if (await welcome.count() > 0) {
await welcome.getByRole('button').click()
await welcome.waitFor({ state: 'detached', timeout: 15_000 })
}
const chat = page.getByRole('tab', { name: 'Chat', exact: true }) const chat = page.getByRole('tab', { name: 'Chat', exact: true })
// Search is a collapsed header action; expand it so the input is actionable. // Search is a collapsed header action; expand it so the input is actionable.
const searchButton = page.getByRole('button', { name: 'Search sessions' }) const searchButton = page.getByRole('button', { name: 'Search sessions' })
@@ -283,14 +288,30 @@ describe('web e2e: navigation & panes over a rich seeded session', () => {
await details.getByRole('button', { name: 'Close details' }).click() await details.getByRole('button', { name: 'Close details' }).click()
}, 60_000) }, 60_000)
it.skipIf(MODE === 'record')('downloads the session-log ZIP from the trajectory toolbar', async () => { it.skipIf(MODE === 'record')('downloads through the Session Header and /export with one dialog', async () => {
onTestFailed(() => saveFailureShot(page, 'web-e2e-navigation-export')) onTestFailed(() => saveFailureShot(page, 'web-e2e-navigation-export'))
await ensureSeedOpen(page) await ensureSeedOpen(page)
await page.getByRole('tab', { name: 'Trajectory' }).click() const exportButton = page.getByRole('button', { name: 'Session log' })
expect(await exportButton.isDisabled()).toBe(false)
const header = exportButton.locator('xpath=ancestor::header[1]')
const [buttonBox, headerBox] = await Promise.all([
exportButton.boundingBox(), header.boundingBox(),
])
if (buttonBox === null || headerBox === null) {
throw new Error('Session Header export geometry is unavailable')
}
expect(headerBox.x + headerBox.width - (buttonBox.x + buttonBox.width)).toBeLessThanOrEqual(32)
const responsePromise = page.waitForResponse(response =>
response.request().method() === 'HEAD'
&& new URL(response.url()).pathname === '/api/session.export', { timeout: 30_000 })
const downloadPromise = page.waitForEvent('download', { timeout: 30_000 }) const downloadPromise = page.waitForEvent('download', { timeout: 30_000 })
await page.getByRole('button', { name: 'Export session log' }).click() await exportButton.click()
const response = await responsePromise
expect(response.status()).toBe(200)
const download = await downloadPromise const download = await downloadPromise
expect(download.suggestedFilename()).toMatch(/^dsh-session-.+\.zip$/) expect(download.suggestedFilename()).toMatch(/^dsh-session-.+\.zip$/)
const dialog = page.getByRole('dialog', { name: 'Session download started' })
await dialog.waitFor({ timeout: 30_000 })
// The real host streamed the ZIP; its root entry is the persisted log // The real host streamed the ZIP; its root entry is the persisted log
// text verbatim (the assembled seam: real route, real persistence read). // text verbatim (the assembled seam: real route, real persistence read).
const files = unzipSync(await readFile(await download.path())) const files = unzipSync(await readFile(await download.path()))
@@ -298,7 +319,63 @@ describe('web e2e: navigation & panes over a rich seeded session', () => {
const content = strFromU8(files['session.jsonl'] as Uint8Array) const content = strFromU8(files['session.jsonl'] as Uint8Array)
expect(content.split('\n')[0]).toContain(SEED_ID) expect(content.split('\n')[0]).toContain(SEED_ID)
expect(content).toContain('FIRST_DONE') expect(content).toContain('FIRST_DONE')
}, 60_000) await dialog.getByText('Close', { exact: true }).click()
const observer = await newEnglishPage(browser)
const observerTripwire = watchConsole(observer)
const observerSlotErrors: string[] = []
let observerDownloads = 0
observer.on('download', () => { observerDownloads += 1 })
observer.on('console', (message) => {
if (message.type() === 'error' && /slot entry crashed/i.test(message.text())) {
observerSlotErrors.push(message.text())
}
})
const observerSessionBaseline = baselineResponse(observer, 'session.list')
const observerWorkspaceBaseline = baselineResponse(observer, 'workspace.list')
const [, observerSessionResponse, observerWorkspaceResponse] = await Promise.all([
observer.goto(scaffold.baseUrl, { waitUntil: 'load' }),
observerSessionBaseline,
observerWorkspaceBaseline,
])
await Promise.all([
assertBaselineSucceeded(observerSessionResponse, 'observer session.list'),
assertBaselineSucceeded(observerWorkspaceResponse, 'observer workspace.list'),
])
await observer.getByText('Ungrouped', { exact: true }).waitFor({ timeout: 30_000 })
await ensureSeedOpen(observer)
try {
const input = page.locator('textarea').first()
const slashDownloadPromise = page.waitForEvent('download', { timeout: 30_000 })
await input.fill('/export')
await page.getByRole('option', { name: /export/u }).waitFor({ timeout: 10_000 })
await input.press('Enter')
const slashDownload = await slashDownloadPromise
expect(slashDownload.suggestedFilename()).toBe(download.suggestedFilename())
const slashFiles = unzipSync(await readFile(await slashDownload.path()))
const slashContent = strFromU8(slashFiles['session.jsonl'] as Uint8Array)
const slashEvents = parseSessionLog(slashContent)
const exportRun = slashEvents.findLast(event => event.type === 'command/run' && event.data.name === 'export')
if (exportRun?.type !== 'command/run') throw new Error('slash ZIP has no export command/run')
const exportDone = slashEvents.find(event =>
event.type === 'command/done' && event.data.commandId === exportRun.data.commandId)
expect(exportDone?.type).toBe('command/done')
await page.getByRole('dialog', { name: 'Session download started' }).waitFor({ timeout: 30_000 })
await page.getByRole('dialog', { name: 'Session download started' })
.getByText('Close', { exact: true }).click()
await observer.getByText('Session log download requested.', { exact: true }).waitFor({ timeout: 30_000 })
expect(observerDownloads).toBe(0)
expect(await observer.getByRole('dialog', { name: 'Session download started' }).count()).toBe(0)
expect({
pageErrors: observerTripwire.pageErrors,
slotErrors: observerSlotErrors,
warnings: observerTripwire.warnings,
}).toEqual({ pageErrors: [], slotErrors: [], warnings: [] })
} finally {
await observer.close()
}
}, 120_000)
it.skipIf(MODE === 'record')('focuses the ledger by dragging an overview interval', async () => { it.skipIf(MODE === 'record')('focuses the ledger by dragging an overview interval', async () => {
onTestFailed(() => saveFailureShot(page, 'web-e2e-navigation-timeline')) onTestFailed(() => saveFailureShot(page, 'web-e2e-navigation-timeline'))
+9 -2
View File
@@ -51,7 +51,7 @@ import { dshHomePath } from '@deepseek-ai/dsh-paths'
// } from '@deepseek-ai/dsh-client-ui-settings-general' // } from '@deepseek-ai/dsh-client-ui-settings-general'
export const WELCOME_NOTICE_SETTINGS_NAMESPACE = 'ui-onboarding' export const WELCOME_NOTICE_SETTINGS_NAMESPACE = 'ui-onboarding'
export const WELCOME_NOTICE_ACK_FIELD = 'welcomeNoticeVersion' export const WELCOME_NOTICE_ACK_FIELD = 'welcomeNoticeVersion'
export const WELCOME_NOTICE_VERSION = '2026-07-30.7' export const WELCOME_NOTICE_VERSION = '2026-08-11.1'
export const WELCOME_NOTICE_COPY = { zh: { title: '内测声明', continueLabel: '继续' } } as const export const WELCOME_NOTICE_COPY = { zh: { title: '内测声明', continueLabel: '继续' } } as const
import { settingsNamespace } from '@deepseek-ai/dsh-settings' import { settingsNamespace } from '@deepseek-ai/dsh-settings'
@@ -421,7 +421,14 @@ export async function launchWebScaffold(options: LaunchOptions = {}): Promise<We
// disclosure passes a local dead endpoint instead of disabling the row. // disclosure passes a local dead endpoint instead of disabling the row.
options.telemetryUrl === undefined options.telemetryUrl === undefined
? { id: 'telemetry-otel', disabled: true } ? { id: 'telemetry-otel', disabled: true }
: { id: 'telemetry-otel', config: { exporter: { url: options.telemetryUrl }, shutdownTimeoutMillis: 1_000 } }, : {
id: 'telemetry-otel',
config: {
mode: 'FULL',
exporter: { url: options.telemetryUrl },
shutdownTimeoutMillis: 1_000,
},
},
{ {
id: 'webserver', id: 'webserver',
config: { host: '127.0.0.1', port: 0 }, config: { host: '127.0.0.1', port: 0 },
+2 -2
View File
@@ -138,13 +138,13 @@ async function detailsTrack(page: Page): Promise<number> {
return Number(cols.split(' ').pop()!.replace('px', '')) return Number(cols.split(' ').pop()!.replace('px', ''))
} }
// Readiness gate: `dsh web` serves all ten production manifest plugins; until every UI // Readiness gate: `dsh web` serves every production manifest plugin; until every UI
// plugin's client bundle exists and exports apply, the loader fail-louds and // plugin's client bundle exists and exports apply, the loader fail-louds and
// the frame never appears. // the frame never appears.
const UI_PLUGIN_DIRS = [ const UI_PLUGIN_DIRS = [
'connection', 'runtime', 'ui-theme', 'locale', 'ui-layout', 'ui-sidebar', 'connection', 'runtime', 'ui-theme', 'locale', 'ui-layout', 'ui-sidebar',
'ui-settings', 'ui-settings-general', 'ui-models', 'ui-conversation', 'ui-settings', 'ui-settings-general', 'ui-models', 'ui-conversation',
'ui-model', 'ui-question', 'ui-trajectory', 'ui-model', 'ui-question', 'ui-trajectory', '../session-query/session-export',
] ]
const ROUND_DONE_MARKER = 'WEB_ROUND_DONE' const ROUND_DONE_MARKER = 'WEB_ROUND_DONE'
const notReady = UI_PLUGIN_DIRS.filter((dir) => { const notReady = UI_PLUGIN_DIRS.filter((dir) => {
@@ -5,3 +5,6 @@
- button "1 subagent": - button "1 subagent":
- text: 1 subagent - text: 1 subagent
- img - img
- button "Session log":
- text: Session log
- img
@@ -1,6 +1,9 @@
- banner: - banner:
- navigation "Session hierarchy": - navigation "Session hierarchy":
- 'button "Run two shell commands: wait" [disabled]' - 'button "Run two shell commands: wait" [disabled]'
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -3,6 +3,9 @@
- 'button "Using ONE run_code program: run" [disabled]' - 'button "Using ONE run_code program: run" [disabled]'
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -3,6 +3,9 @@
- button "Use only Cordis tools. First" [disabled] - button "Use only Cordis tools. First" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -3,6 +3,9 @@
- button "Reply with the single word" [disabled] - button "Reply with the single word" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -3,6 +3,9 @@
- button "Use the bash tool to" [disabled] - button "Use the bash tool to" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -3,6 +3,9 @@
- button "workspace" [disabled] - button "workspace" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -3,6 +3,9 @@
- button "workspace" [disabled] - button "workspace" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -1,6 +1,7 @@
- listbox "Trigger suggestions": - listbox "Trigger suggestions":
- text: Commands - text: Commands
- option "compact Compact older conversation history" [selected] - option "compact Compact older conversation history" [selected]
- option "export Download this Session log as a ZIP archive"
- option "feedback record feedback about this session" - option "feedback record feedback about this session"
- option "goal set or view the goal for a long-running task" - option "goal set or view the goal for a long-running task"
- option "permission Switch the permission preset (sandbox mode + approval policy)" - option "permission Switch the permission preset (sandbox mode + approval policy)"
@@ -3,6 +3,9 @@
- button "Reply with the single word" [disabled] - button "Reply with the single word" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -3,6 +3,9 @@
- button "Reply with a one-sentence description" [disabled] - button "Reply with a one-sentence description" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -3,6 +3,9 @@
- button "Reply with a one-sentence description" [disabled] - button "Reply with a one-sentence description" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -3,6 +3,9 @@
- button "Reply with a one-sentence description" [disabled] - button "Reply with a one-sentence description" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -3,6 +3,9 @@
- button "Reply with a one-sentence description" [disabled] - button "Reply with a one-sentence description" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -1,6 +1,9 @@
- banner: - banner:
- navigation "Session hierarchy": - navigation "Session hierarchy":
- button "CJK strong emphasis" [disabled] - button "CJK strong emphasis" [disabled]
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -1,6 +1,9 @@
- banner: - banner:
- navigation "Session hierarchy": - navigation "Session hierarchy":
- button "Markdown image policy" [disabled] - button "Markdown image policy" [disabled]
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -1,6 +1,9 @@
- banner: - banner:
- navigation "Session hierarchy": - navigation "Session hierarchy":
- button "Inline code links" [disabled] - button "Inline code links" [disabled]
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -1,6 +1,9 @@
- banner: - banner:
- navigation "Session hierarchy": - navigation "Session hierarchy":
- button "Math rendering" [disabled] - button "Math rendering" [disabled]
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -0,0 +1,3 @@
dot=warning
title=Output token limit reached
hint=The reply was cut off; earlier output is preserved in the conversation. Send "continue" to let the model resume.
@@ -1,6 +1,9 @@
- banner: - banner:
- navigation "Session hierarchy": - navigation "Session hierarchy":
- button "Use the read tool twice" [disabled] - button "Use the read tool twice" [disabled]
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -2,7 +2,6 @@
- button "Use actual duration": Duration - button "Use actual duration": Duration
- button "Collapse turns": Turns - button "Collapse turns": Turns
- button "Collapse calls": Calls - button "Collapse calls": Calls
- button "Export session log": Export
- img - img
- searchbox "Search trajectory" - searchbox "Search trajectory"
- region "Trajectory timeline": - region "Trajectory timeline":
@@ -3,6 +3,9 @@
- 'button "Plan a small change: add" [disabled]' - 'button "Plan a small change: add" [disabled]'
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -3,6 +3,9 @@
- button "Use the ask_user_question tool to" [disabled] - button "Use the ask_user_question tool to" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -3,6 +3,9 @@
- button "Reply with a one-sentence description" [disabled] - button "Reply with a one-sentence description" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -3,6 +3,9 @@
- button "Reply with a one-sentence description" [disabled] - button "Reply with a one-sentence description" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -3,6 +3,9 @@
- button "workspace" [disabled] - button "workspace" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -3,6 +3,9 @@
- button "Reply with a one-sentence description" [disabled] - button "Reply with a one-sentence description" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -3,6 +3,9 @@
- button "Reply with a one-sentence description" [disabled] - button "Reply with a one-sentence description" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -1,6 +1,9 @@
- banner: - banner:
- navigation "Session hierarchy": - navigation "Session hierarchy":
- button "Use the read tool twice" [disabled] - button "Use the read tool twice" [disabled]
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -1,6 +1,9 @@
- banner: - banner:
- navigation "Session hierarchy": - navigation "Session hierarchy":
- button "Use the read tool twice" [disabled] - button "Use the read tool twice" [disabled]
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -1,6 +1,9 @@
- banner: - banner:
- navigation "Session hierarchy": - navigation "Session hierarchy":
- button "Use the read tool twice" [disabled] - button "Use the read tool twice" [disabled]
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -1,6 +1,9 @@
- banner: - banner:
- navigation "Session hierarchy": - navigation "Session hierarchy":
- button "Load the snapshot-skill skill with" [disabled] - button "Load the snapshot-skill skill with" [disabled]
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -3,6 +3,9 @@
- button "/user-invoke-demo and confirm the fixtur" [disabled] - button "/user-invoke-demo and confirm the fixtur" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -3,6 +3,9 @@
- button "Use the ask_user_question tool to" [disabled] - button "Use the ask_user_question tool to" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -3,6 +3,9 @@
- button "Use the ask_user_question tool to" [disabled] - button "Use the ask_user_question tool to" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -3,6 +3,9 @@
- button "Use the ask_user_question tool to" [disabled] - button "Use the ask_user_question tool to" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -3,6 +3,9 @@
- button "Use the ask_user_question tool to" [disabled] - button "Use the ask_user_question tool to" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -5,6 +5,9 @@
- button "event-sourcing researcher" - button "event-sourcing researcher"
- text: / - text: /
- button "example editor" [disabled] - button "example editor" [disabled]
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -8,6 +8,9 @@
- button "1 subagent": - button "1 subagent":
- text: 1 subagent - text: 1 subagent
- img - img
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -5,6 +5,9 @@
- button "event-sourcing researcher" [disabled] - button "event-sourcing researcher" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -3,6 +3,9 @@
- button "Begin your reply with the" [disabled] - button "Begin your reply with the" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -3,6 +3,9 @@
- button "Begin your reply with the" [disabled] - button "Begin your reply with the" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
@@ -3,6 +3,9 @@
- button "Use web_search to search exactly" [disabled] - button "Use web_search to search exactly" [disabled]
- img - img
- text: Standard mode - text: Standard mode
- button "Session log":
- text: Session log
- img
- tablist: - tablist:
- tab "Chat" [selected] - tab "Chat" [selected]
- tab "Trajectory" - tab "Trajectory"
+1 -1
View File
@@ -2,7 +2,7 @@
// Assembled todo snapshot: boots the real built `packages/client/*/lib/ // Assembled todo snapshot: boots the real built `packages/client/*/lib/
// client.js` bundles through AppWebEntry's ModuleLoader path against the // client.js` bundles through AppWebEntry's ModuleLoader path against the
// keyless FixtureApiClient transport, opens the fixture session, and pins the // keyless FixtureApiClient transport, opens the fixture session, and pins the
// two surfaces the fixture's parallel plan (turn 73, two items `in_progress`) // two surfaces the fixture's parallel plan (turn 74, two items `in_progress`)
// reaches — the `todo_write` tool row and the dock's plan strip. // reaches — the `todo_write` tool row and the dock's plan strip.
// //
// The row is pinned as three separate fields on purpose. `summary=` is the // The row is pinned as three separate fields on purpose. `summary=` is the
+2 -2
View File
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority; # side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with: # after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/config-catalog.md # pnpm run verify-translation-pairing --write docs/config-catalog.md
config-catalog.md: 369490ec41480b8c46355f0edc3eb97f2f0c76cb config-catalog.md: 3eb59072b712c4386072042ba1c6f4f1f54423ca
config-catalog.zh.md: 443b560d147a8f48d71abf05ede75a07d5cba5c4 config-catalog.zh.md: ad91b5156c6b86225c502abdbdf73fbe1fd23e19
+1
View File
@@ -2846,6 +2846,7 @@ These load from a `cordis.yml` entry with no `config:` block; they declare no co
- `@deepseek-ai/dsh-pty` ([`packages/pty/pty/src/index.ts`](../packages/pty/pty/src/index.ts)) - `@deepseek-ai/dsh-pty` ([`packages/pty/pty/src/index.ts`](../packages/pty/pty/src/index.ts))
- `@deepseek-ai/dsh-session` ([`packages/core/session/src/index.ts`](../packages/core/session/src/index.ts)) - `@deepseek-ai/dsh-session` ([`packages/core/session/src/index.ts`](../packages/core/session/src/index.ts))
- `@deepseek-ai/dsh-session-checkpoint-policy` — requires `llm` · `sessionPersistence` · `sessions` · `tools` ([`packages/session/session-checkpoint-policy/src/index.ts`](../packages/session/session-checkpoint-policy/src/index.ts)) - `@deepseek-ai/dsh-session-checkpoint-policy` — requires `llm` · `sessionPersistence` · `sessions` · `tools` ([`packages/session/session-checkpoint-policy/src/index.ts`](../packages/session/session-checkpoint-policy/src/index.ts))
- `@deepseek-ai/dsh-session-export` — requires `commands` ([`packages/session-query/session-export/src/index.ts`](../packages/session-query/session-export/src/index.ts))
- `@deepseek-ai/dsh-session-projection` ([`packages/session/session-projection/src/index.ts`](../packages/session/session-projection/src/index.ts)) - `@deepseek-ai/dsh-session-projection` ([`packages/session/session-projection/src/index.ts`](../packages/session/session-projection/src/index.ts))
- `@deepseek-ai/dsh-skill-badge` — requires `skills` ([`packages/skill/skill-badge/src/index.ts`](../packages/skill/skill-badge/src/index.ts)) - `@deepseek-ai/dsh-skill-badge` — requires `skills` ([`packages/skill/skill-badge/src/index.ts`](../packages/skill/skill-badge/src/index.ts))
- `@deepseek-ai/dsh-storage` ([`packages/storage/storage/src/index.ts`](../packages/storage/storage/src/index.ts)) - `@deepseek-ai/dsh-storage` ([`packages/storage/storage/src/index.ts`](../packages/storage/storage/src/index.ts))
+1
View File
@@ -2847,6 +2847,7 @@ export interface Config {
- `@deepseek-ai/dsh-pty`[`packages/pty/pty/src/index.ts`](../packages/pty/pty/src/index.ts) - `@deepseek-ai/dsh-pty`[`packages/pty/pty/src/index.ts`](../packages/pty/pty/src/index.ts)
- `@deepseek-ai/dsh-session`[`packages/core/session/src/index.ts`](../packages/core/session/src/index.ts) - `@deepseek-ai/dsh-session`[`packages/core/session/src/index.ts`](../packages/core/session/src/index.ts)
- `@deepseek-ai/dsh-session-checkpoint-policy` — 需要 `llm` · `sessionPersistence` · `sessions` · `tools`[`packages/session/session-checkpoint-policy/src/index.ts`](../packages/session/session-checkpoint-policy/src/index.ts) - `@deepseek-ai/dsh-session-checkpoint-policy` — 需要 `llm` · `sessionPersistence` · `sessions` · `tools`[`packages/session/session-checkpoint-policy/src/index.ts`](../packages/session/session-checkpoint-policy/src/index.ts)
- `@deepseek-ai/dsh-session-export` — 需要 `commands`[`packages/session-query/session-export/src/index.ts`](../packages/session-query/session-export/src/index.ts)
- `@deepseek-ai/dsh-session-projection`[`packages/session/session-projection/src/index.ts`](../packages/session/session-projection/src/index.ts) - `@deepseek-ai/dsh-session-projection`[`packages/session/session-projection/src/index.ts`](../packages/session/session-projection/src/index.ts)
- `@deepseek-ai/dsh-skill-badge` — 需要 `skills`[`packages/skill/skill-badge/src/index.ts`](../packages/skill/skill-badge/src/index.ts) - `@deepseek-ai/dsh-skill-badge` — 需要 `skills`[`packages/skill/skill-badge/src/index.ts`](../packages/skill/skill-badge/src/index.ts)
- `@deepseek-ai/dsh-storage`[`packages/storage/storage/src/index.ts`](../packages/storage/storage/src/index.ts) - `@deepseek-ai/dsh-storage`[`packages/storage/storage/src/index.ts`](../packages/storage/storage/src/index.ts)
+2 -2
View File
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority; # side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with: # after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/module-graph.md # pnpm run verify-translation-pairing --write docs/module-graph.md
module-graph.md: 56e029df192f28a787748b12074ee4dfe67d1c58 module-graph.md: 371699d8a4aab83eb8603ce1623373fe56871dd3
module-graph.zh.md: 839c5edf758a3076874643cb6bdbd91954ca369e module-graph.zh.md: 381a387ff77ef36dda31655bb9c0e4d5b931e544
+10
View File
@@ -108,6 +108,7 @@ flowchart TD
pkg_hooks_codex["hooks-codex"] pkg_hooks_codex["hooks-codex"]
end end
subgraph group_session_query["packages/session-query"] subgraph group_session_query["packages/session-query"]
pkg_session_export["session-export"]
pkg_session_query["session-query"] pkg_session_query["session-query"]
pkg_session_query_sqlite["session-query-sqlite"] pkg_session_query_sqlite["session-query-sqlite"]
pkg_tool_session_query["tool-session-query"] pkg_tool_session_query["tool-session-query"]
@@ -1326,6 +1327,14 @@ flowchart TD
pkg_host_directory_picker_auto --> pkg_host_directory_picker_native pkg_host_directory_picker_auto --> pkg_host_directory_picker_native
pkg_host_directory_picker_auto --> pkg_host_webserver pkg_host_directory_picker_auto --> pkg_host_webserver
pkg_host_directory_picker_auto --> pkg_invariants pkg_host_directory_picker_auto --> pkg_invariants
pkg_session_export --> pkg_client_locale
pkg_session_export --> pkg_client_runtime
pkg_session_export --> pkg_client_ui_command
pkg_session_export --> pkg_client_ui_conversation
pkg_session_export --> pkg_client_ui_primitives
pkg_session_export --> pkg_client_ui_slots
pkg_session_export --> pkg_commands
pkg_session_export --> pkg_invariants
pkg_client_ui_model --> pkg_api_remotes pkg_client_ui_model --> pkg_api_remotes
pkg_client_ui_model --> pkg_client_connection pkg_client_ui_model --> pkg_client_connection
pkg_client_ui_model --> pkg_client_locale pkg_client_ui_model --> pkg_client_locale
@@ -1572,6 +1581,7 @@ flowchart TD
| [`client-ui-tool`](../packages/client/ui-tool) | `client` | [`api-remotes`](../packages/api/remotes), [`client-locale`](../packages/client/locale), [`client-runtime`](../packages/client/runtime), [`client-ui-conversation`](../packages/client/ui-conversation), [`client-ui-primitives`](../packages/client/ui-primitives), [`client-ui-slots`](../packages/client/ui-slots), [`invariants`](../packages/support/invariants) | | [`client-ui-tool`](../packages/client/ui-tool) | `client` | [`api-remotes`](../packages/api/remotes), [`client-locale`](../packages/client/locale), [`client-runtime`](../packages/client/runtime), [`client-ui-conversation`](../packages/client/ui-conversation), [`client-ui-primitives`](../packages/client/ui-primitives), [`client-ui-slots`](../packages/client/ui-slots), [`invariants`](../packages/support/invariants) |
| [`client-ui-workflow-run`](../packages/client/ui-workflow-run) | `client` | [`client-locale`](../packages/client/locale), [`client-runtime`](../packages/client/runtime), [`client-ui-conversation`](../packages/client/ui-conversation), [`client-ui-primitives`](../packages/client/ui-primitives), [`client-ui-slots`](../packages/client/ui-slots), [`invariants`](../packages/support/invariants), [`session`](../packages/core/session), [`tool-workflow`](../packages/workflow/tool-workflow), [`workflow`](../packages/workflow/workflow) | | [`client-ui-workflow-run`](../packages/client/ui-workflow-run) | `client` | [`client-locale`](../packages/client/locale), [`client-runtime`](../packages/client/runtime), [`client-ui-conversation`](../packages/client/ui-conversation), [`client-ui-primitives`](../packages/client/ui-primitives), [`client-ui-slots`](../packages/client/ui-slots), [`invariants`](../packages/support/invariants), [`session`](../packages/core/session), [`tool-workflow`](../packages/workflow/tool-workflow), [`workflow`](../packages/workflow/workflow) |
| [`host-directory-picker-auto`](../packages/host/directory-picker-auto) | `host` | [`client-ui-directory-picker`](../packages/client/ui-directory-picker), [`client-ui-directory-picker-native`](../packages/client/ui-directory-picker-native), [`host-directory-picker-browse`](../packages/host/directory-picker-browse), [`host-directory-picker-native`](../packages/host/directory-picker-native), [`host-webserver`](../packages/host/webserver), [`invariants`](../packages/support/invariants) | | [`host-directory-picker-auto`](../packages/host/directory-picker-auto) | `host` | [`client-ui-directory-picker`](../packages/client/ui-directory-picker), [`client-ui-directory-picker-native`](../packages/client/ui-directory-picker-native), [`host-directory-picker-browse`](../packages/host/directory-picker-browse), [`host-directory-picker-native`](../packages/host/directory-picker-native), [`host-webserver`](../packages/host/webserver), [`invariants`](../packages/support/invariants) |
| [`session-export`](../packages/session-query/session-export) | `session-query` | [`client-locale`](../packages/client/locale), [`client-runtime`](../packages/client/runtime), [`client-ui-command`](../packages/client/ui-command), [`client-ui-conversation`](../packages/client/ui-conversation), [`client-ui-primitives`](../packages/client/ui-primitives), [`client-ui-slots`](../packages/client/ui-slots), [`commands`](../packages/interaction/commands), [`invariants`](../packages/support/invariants) |
| [`client-ui-model`](../packages/client/ui-model) | `client` | [`api-remotes`](../packages/api/remotes), [`client-connection`](../packages/client/connection), [`client-locale`](../packages/client/locale), [`client-runtime`](../packages/client/runtime), [`client-ui-command`](../packages/client/ui-command), [`client-ui-conversation`](../packages/client/ui-conversation), [`client-ui-primitives`](../packages/client/ui-primitives), [`client-ui-slash`](../packages/client/ui-slash), [`client-ui-slots`](../packages/client/ui-slots), [`invariants`](../packages/support/invariants) | | [`client-ui-model`](../packages/client/ui-model) | `client` | [`api-remotes`](../packages/api/remotes), [`client-connection`](../packages/client/connection), [`client-locale`](../packages/client/locale), [`client-runtime`](../packages/client/runtime), [`client-ui-command`](../packages/client/ui-command), [`client-ui-conversation`](../packages/client/ui-conversation), [`client-ui-primitives`](../packages/client/ui-primitives), [`client-ui-slash`](../packages/client/ui-slash), [`client-ui-slots`](../packages/client/ui-slots), [`invariants`](../packages/support/invariants) |
| [`client-ui-permission`](../packages/client/ui-permission) | `client` | [`api-remotes`](../packages/api/remotes), [`client-connection`](../packages/client/connection), [`client-locale`](../packages/client/locale), [`client-runtime`](../packages/client/runtime), [`client-schema-form`](../packages/client/schema-form), [`client-ui-command`](../packages/client/ui-command), [`client-ui-primitives`](../packages/client/ui-primitives), [`client-ui-settings`](../packages/client/ui-settings), [`client-ui-slash`](../packages/client/ui-slash), [`client-ui-slots`](../packages/client/ui-slots), [`invariants`](../packages/support/invariants), [`permission`](../packages/interaction/permission) | | [`client-ui-permission`](../packages/client/ui-permission) | `client` | [`api-remotes`](../packages/api/remotes), [`client-connection`](../packages/client/connection), [`client-locale`](../packages/client/locale), [`client-runtime`](../packages/client/runtime), [`client-schema-form`](../packages/client/schema-form), [`client-ui-command`](../packages/client/ui-command), [`client-ui-primitives`](../packages/client/ui-primitives), [`client-ui-settings`](../packages/client/ui-settings), [`client-ui-slash`](../packages/client/ui-slash), [`client-ui-slots`](../packages/client/ui-slots), [`invariants`](../packages/support/invariants), [`permission`](../packages/interaction/permission) |
| [`client-ui-skill`](../packages/client/ui-skill) | `client` | [`api-remotes`](../packages/api/remotes), [`client-connection`](../packages/client/connection), [`client-locale`](../packages/client/locale), [`client-runtime`](../packages/client/runtime), [`client-ui-primitives`](../packages/client/ui-primitives), [`client-ui-slash`](../packages/client/ui-slash), [`client-ui-slots`](../packages/client/ui-slots), [`client-ui-tool`](../packages/client/ui-tool), [`invariants`](../packages/support/invariants) | | [`client-ui-skill`](../packages/client/ui-skill) | `client` | [`api-remotes`](../packages/api/remotes), [`client-connection`](../packages/client/connection), [`client-locale`](../packages/client/locale), [`client-runtime`](../packages/client/runtime), [`client-ui-primitives`](../packages/client/ui-primitives), [`client-ui-slash`](../packages/client/ui-slash), [`client-ui-slots`](../packages/client/ui-slots), [`client-ui-tool`](../packages/client/ui-tool), [`invariants`](../packages/support/invariants) |
+10
View File
@@ -110,6 +110,7 @@ flowchart TD
pkg_hooks_codex["hooks-codex"] pkg_hooks_codex["hooks-codex"]
end end
subgraph group_session_query["packages/session-query"] subgraph group_session_query["packages/session-query"]
pkg_session_export["session-export"]
pkg_session_query["session-query"] pkg_session_query["session-query"]
pkg_session_query_sqlite["session-query-sqlite"] pkg_session_query_sqlite["session-query-sqlite"]
pkg_tool_session_query["tool-session-query"] pkg_tool_session_query["tool-session-query"]
@@ -1328,6 +1329,14 @@ flowchart TD
pkg_host_directory_picker_auto --> pkg_host_directory_picker_native pkg_host_directory_picker_auto --> pkg_host_directory_picker_native
pkg_host_directory_picker_auto --> pkg_host_webserver pkg_host_directory_picker_auto --> pkg_host_webserver
pkg_host_directory_picker_auto --> pkg_invariants pkg_host_directory_picker_auto --> pkg_invariants
pkg_session_export --> pkg_client_locale
pkg_session_export --> pkg_client_runtime
pkg_session_export --> pkg_client_ui_command
pkg_session_export --> pkg_client_ui_conversation
pkg_session_export --> pkg_client_ui_primitives
pkg_session_export --> pkg_client_ui_slots
pkg_session_export --> pkg_commands
pkg_session_export --> pkg_invariants
pkg_client_ui_model --> pkg_api_remotes pkg_client_ui_model --> pkg_api_remotes
pkg_client_ui_model --> pkg_client_connection pkg_client_ui_model --> pkg_client_connection
pkg_client_ui_model --> pkg_client_locale pkg_client_ui_model --> pkg_client_locale
@@ -1574,6 +1583,7 @@ flowchart TD
| [`client-ui-tool`](../packages/client/ui-tool) | `client` | [`api-remotes`](../packages/api/remotes), [`client-locale`](../packages/client/locale), [`client-runtime`](../packages/client/runtime), [`client-ui-conversation`](../packages/client/ui-conversation), [`client-ui-primitives`](../packages/client/ui-primitives), [`client-ui-slots`](../packages/client/ui-slots), [`invariants`](../packages/support/invariants) | | [`client-ui-tool`](../packages/client/ui-tool) | `client` | [`api-remotes`](../packages/api/remotes), [`client-locale`](../packages/client/locale), [`client-runtime`](../packages/client/runtime), [`client-ui-conversation`](../packages/client/ui-conversation), [`client-ui-primitives`](../packages/client/ui-primitives), [`client-ui-slots`](../packages/client/ui-slots), [`invariants`](../packages/support/invariants) |
| [`client-ui-workflow-run`](../packages/client/ui-workflow-run) | `client` | [`client-locale`](../packages/client/locale), [`client-runtime`](../packages/client/runtime), [`client-ui-conversation`](../packages/client/ui-conversation), [`client-ui-primitives`](../packages/client/ui-primitives), [`client-ui-slots`](../packages/client/ui-slots), [`invariants`](../packages/support/invariants), [`session`](../packages/core/session), [`tool-workflow`](../packages/workflow/tool-workflow), [`workflow`](../packages/workflow/workflow) | | [`client-ui-workflow-run`](../packages/client/ui-workflow-run) | `client` | [`client-locale`](../packages/client/locale), [`client-runtime`](../packages/client/runtime), [`client-ui-conversation`](../packages/client/ui-conversation), [`client-ui-primitives`](../packages/client/ui-primitives), [`client-ui-slots`](../packages/client/ui-slots), [`invariants`](../packages/support/invariants), [`session`](../packages/core/session), [`tool-workflow`](../packages/workflow/tool-workflow), [`workflow`](../packages/workflow/workflow) |
| [`host-directory-picker-auto`](../packages/host/directory-picker-auto) | `host` | [`client-ui-directory-picker`](../packages/client/ui-directory-picker), [`client-ui-directory-picker-native`](../packages/client/ui-directory-picker-native), [`host-directory-picker-browse`](../packages/host/directory-picker-browse), [`host-directory-picker-native`](../packages/host/directory-picker-native), [`host-webserver`](../packages/host/webserver), [`invariants`](../packages/support/invariants) | | [`host-directory-picker-auto`](../packages/host/directory-picker-auto) | `host` | [`client-ui-directory-picker`](../packages/client/ui-directory-picker), [`client-ui-directory-picker-native`](../packages/client/ui-directory-picker-native), [`host-directory-picker-browse`](../packages/host/directory-picker-browse), [`host-directory-picker-native`](../packages/host/directory-picker-native), [`host-webserver`](../packages/host/webserver), [`invariants`](../packages/support/invariants) |
| [`session-export`](../packages/session-query/session-export) | `session-query` | [`client-locale`](../packages/client/locale), [`client-runtime`](../packages/client/runtime), [`client-ui-command`](../packages/client/ui-command), [`client-ui-conversation`](../packages/client/ui-conversation), [`client-ui-primitives`](../packages/client/ui-primitives), [`client-ui-slots`](../packages/client/ui-slots), [`commands`](../packages/interaction/commands), [`invariants`](../packages/support/invariants) |
| [`client-ui-model`](../packages/client/ui-model) | `client` | [`api-remotes`](../packages/api/remotes), [`client-connection`](../packages/client/connection), [`client-locale`](../packages/client/locale), [`client-runtime`](../packages/client/runtime), [`client-ui-command`](../packages/client/ui-command), [`client-ui-conversation`](../packages/client/ui-conversation), [`client-ui-primitives`](../packages/client/ui-primitives), [`client-ui-slash`](../packages/client/ui-slash), [`client-ui-slots`](../packages/client/ui-slots), [`invariants`](../packages/support/invariants) | | [`client-ui-model`](../packages/client/ui-model) | `client` | [`api-remotes`](../packages/api/remotes), [`client-connection`](../packages/client/connection), [`client-locale`](../packages/client/locale), [`client-runtime`](../packages/client/runtime), [`client-ui-command`](../packages/client/ui-command), [`client-ui-conversation`](../packages/client/ui-conversation), [`client-ui-primitives`](../packages/client/ui-primitives), [`client-ui-slash`](../packages/client/ui-slash), [`client-ui-slots`](../packages/client/ui-slots), [`invariants`](../packages/support/invariants) |
| [`client-ui-permission`](../packages/client/ui-permission) | `client` | [`api-remotes`](../packages/api/remotes), [`client-connection`](../packages/client/connection), [`client-locale`](../packages/client/locale), [`client-runtime`](../packages/client/runtime), [`client-schema-form`](../packages/client/schema-form), [`client-ui-command`](../packages/client/ui-command), [`client-ui-primitives`](../packages/client/ui-primitives), [`client-ui-settings`](../packages/client/ui-settings), [`client-ui-slash`](../packages/client/ui-slash), [`client-ui-slots`](../packages/client/ui-slots), [`invariants`](../packages/support/invariants), [`permission`](../packages/interaction/permission) | | [`client-ui-permission`](../packages/client/ui-permission) | `client` | [`api-remotes`](../packages/api/remotes), [`client-connection`](../packages/client/connection), [`client-locale`](../packages/client/locale), [`client-runtime`](../packages/client/runtime), [`client-schema-form`](../packages/client/schema-form), [`client-ui-command`](../packages/client/ui-command), [`client-ui-primitives`](../packages/client/ui-primitives), [`client-ui-settings`](../packages/client/ui-settings), [`client-ui-slash`](../packages/client/ui-slash), [`client-ui-slots`](../packages/client/ui-slots), [`invariants`](../packages/support/invariants), [`permission`](../packages/interaction/permission) |
| [`client-ui-skill`](../packages/client/ui-skill) | `client` | [`api-remotes`](../packages/api/remotes), [`client-connection`](../packages/client/connection), [`client-locale`](../packages/client/locale), [`client-runtime`](../packages/client/runtime), [`client-ui-primitives`](../packages/client/ui-primitives), [`client-ui-slash`](../packages/client/ui-slash), [`client-ui-slots`](../packages/client/ui-slots), [`client-ui-tool`](../packages/client/ui-tool), [`invariants`](../packages/support/invariants) | | [`client-ui-skill`](../packages/client/ui-skill) | `client` | [`api-remotes`](../packages/api/remotes), [`client-connection`](../packages/client/connection), [`client-locale`](../packages/client/locale), [`client-runtime`](../packages/client/runtime), [`client-ui-primitives`](../packages/client/ui-primitives), [`client-ui-slash`](../packages/client/ui-slash), [`client-ui-slots`](../packages/client/ui-slots), [`client-ui-tool`](../packages/client/ui-tool), [`invariants`](../packages/support/invariants) |
+4
View File
@@ -65,6 +65,10 @@
config: config:
maxNoteBytes: 8192 maxNoteBytes: 8192
# Browser Session export: `/export` command plus the shared download dialog.
- id: session-export
name: '@deepseek-ai/dsh-session-export'
- id: workspace - id: workspace
name: '@deepseek-ai/dsh-workspace' name: '@deepseek-ai/dsh-workspace'
+1
View File
@@ -92,6 +92,7 @@
"@deepseek-ai/dsh-host-webserver": "workspace:^", "@deepseek-ai/dsh-host-webserver": "workspace:^",
"@deepseek-ai/dsh-message-feedback": "workspace:^", "@deepseek-ai/dsh-message-feedback": "workspace:^",
"@deepseek-ai/dsh-session-projection-cache": "workspace:^", "@deepseek-ai/dsh-session-projection-cache": "workspace:^",
"@deepseek-ai/dsh-session-export": "workspace:^",
"@deepseek-ai/dsh-storage": "workspace:^", "@deepseek-ai/dsh-storage": "workspace:^",
"@deepseek-ai/dsh-storage-domain": "workspace:^", "@deepseek-ai/dsh-storage-domain": "workspace:^",
"@deepseek-ai/dsh-storage-json": "workspace:^", "@deepseek-ai/dsh-storage-json": "workspace:^",
@@ -352,7 +352,7 @@ function fixtureUsage(turn: number, step: number): TokenUsage {
} }
} }
/** fx-alpha history script: 74 turns (~150+ messages -> 4 pages at PAGE_MESSAGES=50), /** fx-alpha history script: 75 turns (~150+ messages -> 4 pages at PAGE_MESSAGES=50),
* mixing reasoning blocks / tool call+result / context. */ * mixing reasoning blocks / tool call+result / context. */
function buildAlphaLog(): SessionEvent[] { function buildAlphaLog(): SessionEvent[] {
const events: Record<string, unknown>[] = [] const events: Record<string, unknown>[] = []
@@ -488,7 +488,7 @@ function buildAlphaLog(): SessionEvent[] {
push({ type: 'step/end', data: { turn, step: 0 } }) push({ type: 'step/end', data: { turn, step: 0 } })
push({ type: 'turn/end', data: { turn, reason: { kind: 'completed' } } }) push({ type: 'turn/end', data: { turn, reason: { kind: 'completed' } } })
} }
// Turn 73: todo_write sample — the TodoRow toolview in the flow plus the // Turn 74: todo_write sample — the TodoRow toolview in the flow plus the
// todo/write snapshot event feeding the TodoPanel plan strip. Two items are // todo/write snapshot event feeding the TodoPanel plan strip. Two items are
// in_progress: this fixture chooses the parallel policy, so both surfaces // in_progress: this fixture chooses the parallel policy, so both surfaces
// must render a parallel plan rather than the first active item alone. // must render a parallel plan rather than the first active item alone.
@@ -547,20 +547,35 @@ function buildAlphaLog(): SessionEvent[] {
toolTurn(70, 'web_search', '{"query":"deepseek harness architecture"}', 'Search results for deepseek harness architecture.') toolTurn(70, 'web_search', '{"query":"deepseek harness architecture"}', 'Search results for deepseek harness architecture.')
toolTurn(71, 'web_fetch', '{"url":"https://www.deepseek.com/blog/harness-architecture"}', '# Harness architecture\n\nEverything is a plugin.') toolTurn(71, 'web_fetch', '{"url":"https://www.deepseek.com/blog/harness-architecture"}', '# Harness architecture\n\nEverything is a plugin.')
// Turn 72: user and assistant images share one durable fixture object. // Turn 72: max-tokens sample — the provider ends the turn at its output cap
// The todo turn remains last so its standing projection stays visible. // mid-sentence, so the chat flow must render the turn-max-tokens notice
// instead of ending silently. Ordered before the todo turn for the same
// standing-plan reason the bash turn is.
push({ type: 'turn/start', data: { turn: 72 } }) push({ type: 'turn/start', data: { turn: 72 } })
push({ type: 'user/message', surfaceOp: 'append', data: userMessage(text('问题 72:请完整列出全部一百条条目。')) })
push({ type: 'step/start', data: { turn: 72, step: 0 } })
push({
type: 'assistant/message',
surfaceOp: 'append',
data: { turn: 72, step: 0, message: assistantMessage(text('条目 1:第一条。条目 2:第二条。条目 3:这一条写到一半被')) },
})
push({ type: 'step/end', data: { turn: 72, step: 0 } })
push({ type: 'turn/end', data: { turn: 72, reason: { kind: 'max-tokens' } } })
// Turn 73: user and assistant images share one durable fixture object.
// The todo turn remains last so its standing projection stays visible.
push({ type: 'turn/start', data: { turn: 73 } })
push({ push({
type: 'user/message', type: 'user/message',
surfaceOp: 'append', surfaceOp: 'append',
data: userMessage([{ type: 'image', attachment: FIXTURE_IMAGE_REF }, ...text('历史用户图片')]), data: userMessage([{ type: 'image', attachment: FIXTURE_IMAGE_REF }, ...text('历史用户图片')]),
}) })
push({ type: 'step/start', data: { turn: 72, step: 0 } }) push({ type: 'step/start', data: { turn: 73, step: 0 } })
push({ push({
type: 'assistant/message', type: 'assistant/message',
surfaceOp: 'append', surfaceOp: 'append',
data: { data: {
turn: 72, turn: 73,
step: 0, step: 0,
message: assistantMessage( message: assistantMessage(
[...text('结构化模型图片:'), { type: 'image', attachment: FIXTURE_IMAGE_REF }], [...text('结构化模型图片:'), { type: 'image', attachment: FIXTURE_IMAGE_REF }],
@@ -568,11 +583,11 @@ function buildAlphaLog(): SessionEvent[] {
), ),
}, },
}) })
push({ type: 'step/end', data: { turn: 72, step: 0 } }) push({ type: 'step/end', data: { turn: 73, step: 0 } })
push({ type: 'turn/end', data: { turn: 72, reason: { kind: 'completed' } } }) push({ type: 'turn/end', data: { turn: 73, reason: { kind: 'completed' } } })
const todoArgs = JSON.stringify({ todos: fixtureTodos }) const todoArgs = JSON.stringify({ todos: fixtureTodos })
toolTurn(73, 'todo_write', todoArgs, 'Updated todo list: 1 pending, 2 in progress, 1 completed.') toolTurn(74, 'todo_write', todoArgs, 'Updated todo list: 1 pending, 2 in progress, 1 completed.')
// The real tool appends the snapshot mid-execution — between tool/call and // The real tool appends the snapshot mid-execution — between tool/call and
// tool/result — so the fixture reproduces that exact ordering (the last // tool/result — so the fixture reproduces that exact ordering (the last
// toolTurn events run ... tool/call, tool/result, step/end, turn/end). // toolTurn events run ... tool/call, tool/result, step/end, turn/end).
@@ -1444,7 +1459,7 @@ function createFixtureWorld(options: FixtureOptions): FixtureWorld {
['my-agent', { trust: 'user', content: "- id: tool-read\n name: '@deepseek-ai/dsh-tool-read'\n" }], ['my-agent', { trust: 'user', content: "- id: tool-read\n name: '@deepseek-ai/dsh-tool-read'\n" }],
]) ])
let fixtureDefaultPreset = 'standard' let fixtureDefaultPreset = 'standard'
const nextTurn = new Map<SessionId, number>([[sid('fx-alpha'), 74]]) const nextTurn = new Map<SessionId, number>([[sid('fx-alpha'), 75]])
let nextSession = 1 let nextSession = 1
let nextRpc = 1 let nextRpc = 1
let attachedSessions = options.empty ? 0 : 1 let attachedSessions = options.empty ? 0 : 1
+2 -2
View File
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority; # side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with: # after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write packages/client/runtime/README.md # pnpm run verify-translation-pairing --write packages/client/runtime/README.md
README.md: 44fd9b84e45c0a4d7f5846ce9ba040ef41b8b446 README.md: 441f5462d98c8a9e92ebc9f08cdd7568e89fd427
README.zh.md: 46120665e2720df7c0331b6bdea957316476a4a6 README.zh.md: f4ec9ac53c10f8f375c837556db7623c95d11c17
+2
View File
@@ -68,6 +68,8 @@ Every `ToolCallBlock` recursively owns its children through `subCalls`, in start
The Host-owned LLM retry invariant validates provider-routed `llm/retry` and `llm/retry-started` records at the durable append boundary, including their identity, ordering, timer, integer, status, provider-delay, and non-empty diagnostic contracts. In the client, the Retry, Assistant, and Turn Error Definitions fold those records with Assistant and Turn/Step events: a failed step's streaming partial is removed and a durable retry notice appears at the retry event's sequence position. The notice is `scheduled` until the matching started record arrives; closing its owning Step or Turn first marks it `cancelled`, while the started record marks it `started`. Normal-mode notices carry their finite maximum; always-mode notices remain explicitly unbounded. A terminal `turn/end` error without a retry projects one `turn-error` node from its durable message and optional code; AUTH projections replace provider copy that may echo credential fragments with `API key is invalid`, while the raw diagnostic remains in the session log. A retried failure keeps only the retry notice for that attempt. Window rebuild and history replay use the same Definitions, so refresh neither resurrects discarded chunks nor loses terminal failure feedback. Visible unfinalized output is frozen as an interrupted Assistant node beside the terminal error. The Host-owned LLM retry invariant validates provider-routed `llm/retry` and `llm/retry-started` records at the durable append boundary, including their identity, ordering, timer, integer, status, provider-delay, and non-empty diagnostic contracts. In the client, the Retry, Assistant, and Turn Error Definitions fold those records with Assistant and Turn/Step events: a failed step's streaming partial is removed and a durable retry notice appears at the retry event's sequence position. The notice is `scheduled` until the matching started record arrives; closing its owning Step or Turn first marks it `cancelled`, while the started record marks it `started`. Normal-mode notices carry their finite maximum; always-mode notices remain explicitly unbounded. A terminal `turn/end` error without a retry projects one `turn-error` node from its durable message and optional code; AUTH projections replace provider copy that may echo credential fragments with `API key is invalid`, while the raw diagnostic remains in the session log. A retried failure keeps only the retry notice for that attempt. Window rebuild and history replay use the same Definitions, so refresh neither resurrects discarded chunks nor loses terminal failure feedback. Visible unfinalized output is frozen as an interrupted Assistant node beside the terminal error.
A `turn/end` whose reason is `max-tokens` projects one `turn-max-tokens` node at the turn position: a warning-styled localized notice that the reply stopped at the per-request output cap, with the truncated output kept in the flow and guidance that sending "continue" resumes in a new turn. The notice carries no token counts because the event reports none. The same Definition rebuilds it on window rebuild and history replay, so the reason survives refresh and restore.
## Session forking ## Session forking
`ISessions.fork({sessionId, atSeq?, increaseTitle?})` resolves only after the child summary is locally addressable, carrying source lineage and cwd with `blank: false`; callers choose whether to open it. With `increaseTitle: true`, the client renames the child from the source session's persisted title: a trailing `(N)` or `N` is incremented without changing bracket style, while any other title gets ` (1)` appended; the rename is skipped when the source has no persisted title, and a rename failure rejects the promise but leaves the created child in place. This option is not sent in the Host fork request. A `workspace-attach-failed` response still identifies a child already published by the Host, so `SessionManager` reconciles that partial success before `SessionForkError` reaches the caller instead of making a retry create a duplicate child. `ISessions.fork({sessionId, atSeq?, increaseTitle?})` resolves only after the child summary is locally addressable, carrying source lineage and cwd with `blank: false`; callers choose whether to open it. With `increaseTitle: true`, the client renames the child from the source session's persisted title: a trailing `(N)` or `N` is incremented without changing bracket style, while any other title gets ` (1)` appended; the rename is skipped when the source has no persisted title, and a rename failure rejects the promise but leaves the created child in place. This option is not sent in the Host fork request. A `workspace-attach-failed` response still identifies a child already published by the Host, so `SessionManager` reconciles that partial success before `SessionForkError` reaches the caller instead of making a retry create a duplicate child.
+2
View File
@@ -68,6 +68,8 @@ Trajectory Definition 组装出一条按时间顺序排列、以用途为判别
Host 所属的 LLM(大语言模型)retry invariant 会在持久追加边界验证按提供方路由的 `llm/retry``llm/retry-started` 记录,包括标识、顺序、计时器、整数、状态、提供方延迟和非空诊断字段约定。客户端的 Retry、Assistant 与 Turn Error Definition 把这些记录和 Assistant、Turn/Step 事件一起折叠:失败步骤的流式输出片段会被移除,并在 retry 事件的序列位置插入一条持久重试提示。该提示在匹配的 started 记录到达前为 `scheduled`;如果所属 Step 或 Turn 先关闭,则标记为 `cancelled`started 记录到达后则标记为 `started`。normal mode 提示携带其有限上限;always mode 提示保持显式无界。没有重试的终态 `turn/end` 错误会从持久消息与可选错误码投影出一个 `turn-error` 节点;AUTH 投影会把可能回显凭据片段的提供方文案替换为 `API key is invalid`,原始诊断仍保留在会话日志中。进入重试的失败只保留该次尝试的重试提示。窗口重建与历史回放使用同一组 Definition,因此刷新既不会让已丢弃的分片重新出现,也不会丢失终态失败反馈。可见但尚未定稿的输出会在终态错误旁冻结为中断的 Assistant 节点。 Host 所属的 LLM(大语言模型)retry invariant 会在持久追加边界验证按提供方路由的 `llm/retry``llm/retry-started` 记录,包括标识、顺序、计时器、整数、状态、提供方延迟和非空诊断字段约定。客户端的 Retry、Assistant 与 Turn Error Definition 把这些记录和 Assistant、Turn/Step 事件一起折叠:失败步骤的流式输出片段会被移除,并在 retry 事件的序列位置插入一条持久重试提示。该提示在匹配的 started 记录到达前为 `scheduled`;如果所属 Step 或 Turn 先关闭,则标记为 `cancelled`started 记录到达后则标记为 `started`。normal mode 提示携带其有限上限;always mode 提示保持显式无界。没有重试的终态 `turn/end` 错误会从持久消息与可选错误码投影出一个 `turn-error` 节点;AUTH 投影会把可能回显凭据片段的提供方文案替换为 `API key is invalid`,原始诊断仍保留在会话日志中。进入重试的失败只保留该次尝试的重试提示。窗口重建与历史回放使用同一组 Definition,因此刷新既不会让已丢弃的分片重新出现,也不会丢失终态失败反馈。可见但尚未定稿的输出会在终态错误旁冻结为中断的 Assistant 节点。
reason 为 `max-tokens``turn/end` 会在该轮位置投影出一个 `turn-max-tokens` 节点:一条 warning 样式的本地化提示,说明回答在单次请求的输出 token 上限处停止,已截断的输出保留在对话流中,并提示发送“继续”可在新一轮接着输出。事件本身不携带 token 数量,提示因此不显示任何数字。窗口重建与历史回放使用同一 Definition 重建该节点,刷新和恢复后结束原因保持一致。
## 会话 fork ## 会话 fork
`ISessions.fork({sessionId, atSeq?, increaseTitle?})` 只在子会话摘要已能在本地寻址后才完成;该摘要携带源会话的谱系和 cwd,且 `blank: false`,由调用方决定是否打开。`increaseTitle: true` 会在 client 端根据源会话的持久化标题重命名子会话:尾部 `(N)``N` 递增并保留括号样式,其余标题追加 ` (1)`;源会话没有持久化标题时跳过改名,改名失败时拒绝 promise 但保留已创建的子会话。该选项不会进入 Host fork 请求。即使响应为 `workspace-attach-failed`,其中仍会标识 Host 已发布的子会话,因此 `SessionManager` 会先将这一部分成功对账,再让 `SessionForkError` 到达调用方,避免重试创建重复的子会话。 `ISessions.fork({sessionId, atSeq?, increaseTitle?})` 只在子会话摘要已能在本地寻址后才完成;该摘要携带源会话的谱系和 cwd,且 `blank: false`,由调用方决定是否打开。`increaseTitle: true` 会在 client 端根据源会话的持久化标题重命名子会话:尾部 `(N)``N` 递增并保留括号样式,其余标题追加 ` (1)`;源会话没有持久化标题时跳过改名,改名失败时拒绝 promise 但保留已创建的子会话。该选项不会进入 Host fork 请求。即使响应为 `workspace-attach-failed`,其中仍会标识 Host 已发布的子会话,因此 `SessionManager` 会先将这一部分成功对账,再让 `SessionForkError` 到达调用方,避免重试创建重复的子会话。
+2 -1
View File
@@ -77,7 +77,8 @@ export type {
CommandNode, CompactionSummaryNode, ComposerPhase, CommandNode, CompactionSummaryNode, ComposerPhase,
ContextMessageNode, ConversationNode, ConversationSnapshot, ModelRetryNode, QueuedMessage, ContextMessageNode, ConversationNode, ConversationSnapshot, ModelRetryNode, QueuedMessage,
LegacyConversationSlice, PartialAssistant, RunningToolCall, LegacyConversationSlice, PartialAssistant, RunningToolCall,
SteeringMessageNode, TodoItem, ToolCallBlock, ToolResultNode, TurnErrorNode, UnknownSurfaceNode, UserMessageNode, SteeringMessageNode, TodoItem, ToolCallBlock, ToolResultNode, TurnErrorNode, TurnMaxTokensNode,
UnknownSurfaceNode, UserMessageNode,
} from './sessions/conversation.ts' } from './sessions/conversation.ts'
export { export {
EMPTY_CHAT_SNAPSHOT, EMPTY_CONVERSATION_VIEWS, toAssistantBlock, toAssistantBlocks, EMPTY_CHAT_SNAPSHOT, EMPTY_CONVERSATION_VIEWS, toAssistantBlock, toAssistantBlocks,
@@ -169,6 +169,17 @@ export interface TurnErrorNode {
code?: string code?: string
} }
/** Durable notice for a turn ended by the per-request output-token cap. */
export interface TurnMaxTokensNode {
kind: 'turn-max-tokens'
/** Seq of the owning turn/end event. */
seq: number
/** Unix epoch ms from the turn/end event. */
time: number
turn: number
step: number
}
/** A tool result paired (when in-window) with its call head. */ /** A tool result paired (when in-window) with its call head. */
export interface ToolResultNode { export interface ToolResultNode {
kind: 'tool-result' kind: 'tool-result'
@@ -274,6 +285,7 @@ export type ConversationNode =
| ContextMessageNode | ContextMessageNode
| ModelRetryNode | ModelRetryNode
| TurnErrorNode | TurnErrorNode
| TurnMaxTokensNode
| ToolResultNode | ToolResultNode
| CommandNode | CommandNode
| CompactionSummaryNode | CompactionSummaryNode
+2 -2
View File
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority; # side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with: # after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write packages/client/ui-command/README.md # pnpm run verify-translation-pairing --write packages/client/ui-command/README.md
README.md: 60b70cfbc3784dd5b138f8857270c4bbdc0fd634 README.md: 0281df76fe601eaad86cefc0dcaecc6d8999df60
README.zh.md: 0429b980092acf9cbf808b1571c92ddea937e780 README.zh.md: 87c98cc92b80fe62a7522bf95a5612c388e07a1a
+2
View File
@@ -8,6 +8,8 @@ Client command API (`ctx.command`): the session-keyed command-directory cache, t
`CommandDirectory` (`src/client/directory.ts`) is the one wire-derived cache, keyed by session. Ordinary sessions fetch through `command.list({sessionId})`, and the source's scope-birth `warm` hook prewarms the session's entry. Catalog-addressed continuable children resolve an empty command directory locally: `command.list` is Agent-bound, so prewarming it would activate a child merely to view persisted history. Entries are soft-invalidated by the forwarded `commands/change` owner event (old snapshots serve while the repull flies) and by forwarded `agent-preset/selected` for that one session (recomposing an agent registers nothing, so the registry-wide signal never fires for it), hard-invalidated by `connection/reset`, and epoch-guarded so a superseded pull can never overwrite a newer one. `matchSpace` answers synchronously from this cache only; `matchEnter` strong-waits it on the SubmitAttempt signal and rejects on warmup failure — a `/` line is never silently downgraded to a plain prompt. `CommandDirectory` (`src/client/directory.ts`) is the one wire-derived cache, keyed by session. Ordinary sessions fetch through `command.list({sessionId})`, and the source's scope-birth `warm` hook prewarms the session's entry. Catalog-addressed continuable children resolve an empty command directory locally: `command.list` is Agent-bound, so prewarming it would activate a child merely to view persisted history. Entries are soft-invalidated by the forwarded `commands/change` owner event (old snapshots serve while the repull flies) and by forwarded `agent-preset/selected` for that one session (recomposing an agent registers nothing, so the registry-wide signal never fires for it), hard-invalidated by `connection/reset`, and epoch-guarded so a superseded pull can never overwrite a newer one. `matchSpace` answers synchronously from this cache only; `matchEnter` strong-waits it on the SubmitAttempt signal and rejects on warmup failure — a `/` line is never silently downgraded to a plain prompt.
After `command.execute` returns a matched command result, this browser emits local `command/executed(sessionId, name, result)`. Other clients receive the durable command nodes through the Host event stream but never this acknowledgment, so a browser-only side effect can select successful results from the client that submitted the command without treating Session replay as an action request. Listener failures are logged and contained one by one; they cannot change the already-admitted command result or prevent later listeners from running.
Menu queries fuzzy-match ordered, case-insensitive subsequences of command names. Prefixes rank first; separator boundaries, adjacent characters, and shorter gaps rank the remaining matches, with directory and contribution order breaking ties. This affects discovery only: space and Enter still require an exact command name. Rationale: [Web slash-command fuzzy discovery](../../../.agents/notes/implemented/feature/2026-08-04-web-slash-command-fuzzy-discovery.md). Menu queries fuzzy-match ordered, case-insensitive subsequences of command names. Prefixes rank first; separator boundaries, adjacent characters, and shorter gaps rank the remaining matches, with directory and contribution order breaking ties. This affects discovery only: space and Enter still require an exact command name. Rationale: [Web slash-command fuzzy discovery](../../../.agents/notes/implemented/feature/2026-08-04-web-slash-command-fuzzy-discovery.md).
`PopupSelectController` (`src/client/popup.ts`) is the headless shell state: `PopupSelectView` self-registers into `conversation.input.overlay` (the SlotMap key is ui-conversation's; this package pulls the declaration in with a type-only import — no runtime edge). The shell is a transient layer holding focus while open; token-segment consumption after onSelect runs both branches through `consumeTokenSegment` (menu-path span CAS, enter-path bare-token equality) against the draft face the wiring layer binds via `bindDraft`. `PopupSelectController` (`src/client/popup.ts`) is the headless shell state: `PopupSelectView` self-registers into `conversation.input.overlay` (the SlotMap key is ui-conversation's; this package pulls the declaration in with a type-only import — no runtime edge). The shell is a transient layer holding focus while open; token-segment consumption after onSelect runs both branches through `consumeTokenSegment` (menu-path span CAS, enter-path bare-token equality) against the draft face the wiring layer binds via `bindDraft`.
+2
View File
@@ -8,6 +8,8 @@
`CommandDirectory``src/client/directory.ts`)是唯一的 wire 派生缓存,以会话为 key。普通会话通过 `command.list({sessionId})` 拉取,source 的 scope 出生 `warm` 钩子会预热该会话的缓存项。由目录寻址的可继续子代理会在客户端解析为空命令目录:`command.list` 绑定 Agent,若预热它,就会仅因查看持久化历史而激活子代理。缓存项由转发的 owner 事件 `commands/change` 软失效(重拉在途期间旧快照继续服务),也由转发的 `agent-preset/selected` 对该会话单独软失效(重组 agent 不产生任何注册,注册表级信号不会为它触发),由 `connection/reset` 硬失效,并以 epoch 把关,被取代的旧拉取永远无法覆盖更新的结果。`matchSpace` 只凭该缓存同步应答;`matchEnter` 在 SubmitAttempt 信号上强等缓存,预热失败即拒绝——`/` 开头的一行绝不会被静默降级为普通提示词。 `CommandDirectory``src/client/directory.ts`)是唯一的 wire 派生缓存,以会话为 key。普通会话通过 `command.list({sessionId})` 拉取,source 的 scope 出生 `warm` 钩子会预热该会话的缓存项。由目录寻址的可继续子代理会在客户端解析为空命令目录:`command.list` 绑定 Agent,若预热它,就会仅因查看持久化历史而激活子代理。缓存项由转发的 owner 事件 `commands/change` 软失效(重拉在途期间旧快照继续服务),也由转发的 `agent-preset/selected` 对该会话单独软失效(重组 agent 不产生任何注册,注册表级信号不会为它触发),由 `connection/reset` 硬失效,并以 epoch 把关,被取代的旧拉取永远无法覆盖更新的结果。`matchSpace` 只凭该缓存同步应答;`matchEnter` 在 SubmitAttempt 信号上强等缓存,预热失败即拒绝——`/` 开头的一行绝不会被静默降级为普通提示词。
`command.execute` 返回已匹配的命令结果后,当前浏览器会发布本地 `command/executed(sessionId, name, result)`。其他客户端只会通过 Host 事件流收到持久命令节点,不会收到这条确认,因此浏览器专属副作用可以筛选由实际提交命令的客户端收到的成功结果,而不会把 Session 回放当成操作请求。监听器失败会逐项记录并隔离,不会改变已经准入的命令结果,也不会阻止后续监听器运行。
菜单查询会按顺序且不区分大小写地模糊匹配命令名的子序列。前缀排名最高;其余匹配项按分隔符边界优先、相邻字符优先、间隔越短越优先的规则排序,若仍同分,则以目录顺序和贡献项顺序打破平局。此行为只影响命令发现:space 和 Enter 仍要求命令名精确匹配。原理:[Web 斜杠命令模糊发现](../../../.agents/notes/implemented/feature/2026-08-04-web-slash-command-fuzzy-discovery.md)。 菜单查询会按顺序且不区分大小写地模糊匹配命令名的子序列。前缀排名最高;其余匹配项按分隔符边界优先、相邻字符优先、间隔越短越优先的规则排序,若仍同分,则以目录顺序和贡献项顺序打破平局。此行为只影响命令发现:space 和 Enter 仍要求命令名精确匹配。原理:[Web 斜杠命令模糊发现](../../../.agents/notes/implemented/feature/2026-08-04-web-slash-command-fuzzy-discovery.md)。
`PopupSelectController``src/client/popup.ts`)是不含界面的外壳状态:`PopupSelectView` 自行注册进 `conversation.input.overlay`SlotMap key 归 ui-conversation 所有;本包只以 type-only 导入引入该声明——没有运行时依赖边)。壳是打开期间持有焦点的瞬态层;onSelect 之后的 token 片段消费在两条分支上都经 `consumeTokenSegment` 执行(菜单路径做 span CAS,回车路径做裸 token 相等比较),作用于接线层经 `bindDraft` 绑定的草稿表层。 `PopupSelectController``src/client/popup.ts`)是不含界面的外壳状态:`PopupSelectView` 自行注册进 `conversation.input.overlay`SlotMap key 归 ui-conversation 所有;本包只以 type-only 导入引入该声明——没有运行时依赖边)。壳是打开期间持有焦点的瞬态层;onSelect 之后的 token 片段消费在两条分支上都经 `consumeTokenSegment` 执行(菜单路径做 span CAS,回车路径做裸 token 相等比较),作用于接线层经 `bindDraft` 绑定的草稿表层。
@@ -12,6 +12,7 @@ import type { Context } from '@deepseek-ai/cordis'
// Type-only: pulls the ctx.remote merge and the forwarded-event key face // Type-only: pulls the ctx.remote merge and the forwarded-event key face
// (`commands/change` rides the allowlist) into this program. // (`commands/change` rides the allowlist) into this program.
import type {} from '@deepseek-ai/dsh-api-remotes/client' import type {} from '@deepseek-ai/dsh-api-remotes/client'
import type { CommandResult } from '@deepseek-ai/dsh-commands/types'
import type { ClientContext, ISessions, SessionId } from '@deepseek-ai/dsh-client-runtime/client' import type { ClientContext, ISessions, SessionId } from '@deepseek-ai/dsh-client-runtime/client'
import type { import type {
CandidateRequest, ClientSessionContext, CommandClaim, PickOutcome, SlashCandidate, SlashPick, CandidateRequest, ClientSessionContext, CommandClaim, PickOutcome, SlashCandidate, SlashPick,
@@ -23,6 +24,28 @@ import { CommandDirectory } from './directory.ts'
import { PopupSelectController } from './popup.ts' import { PopupSelectController } from './popup.ts'
import type { TokenSegment } from './popup.ts' import type { TokenSegment } from './popup.ts'
declare module '@deepseek-ai/cordis' {
interface Events {
/**
* This browser client completed one admitted Host command execution.
* Other clients receive the durable command nodes but never this local
* submission acknowledgment.
* @param sessionId - Session addressed by the local submission.
* @param name - Executed command name without the leading slash.
* @param result - Host command result returned to this browser.
* @mode emit
*/
'command/executed'(sessionId: SessionId, name: string, result: CommandResult): void
}
}
/** Recover the command name from a line the Host confirmed as executed. */
function submittedCommandName(line: string): string {
const trimmed = line.trim()
const separator = trimmed.search(/\s/u)
return (separator === -1 ? trimmed : trimmed.slice(0, separator)).slice(1)
}
/** Live mutable state in one holder (service methods run behind the caller-ctx tracker). */ /** Live mutable state in one holder (service methods run behind the caller-ctx tracker). */
interface LiveState { interface LiveState {
readonly contributions: Map<string, CommandContribution> readonly contributions: Map<string, CommandContribution>
@@ -351,9 +374,33 @@ export class CommandService extends Service implements CommandServiceContract {
const result = await this.ctx.remote.commands.execute(session.sessionId, line) const result = await this.ctx.remote.commands.execute(session.sessionId, line)
if (!result.ok) throw new Error(`command.execute failed: ${result.error.code}: ${result.error.message}`) if (!result.ok) throw new Error(`command.execute failed: ${result.error.code}: ${result.error.message}`)
if (result.value === undefined) return { kind: 'error', text: `unknown or malformed command: ${line}` } if (result.value === undefined) return { kind: 'error', text: `unknown or malformed command: ${line}` }
this.notifyExecuted(session.sessionId, submittedCommandName(line), result.value.result)
return { kind: 'success' } return { kind: 'success' }
} }
/** Publish the local acknowledgment without letting an observer change command admission. */
private notifyExecuted(sessionId: SessionId, name: string, result: CommandResult): void {
const args = ['command/executed', sessionId, name, result]
for (const listener of this.ctx.events.dispatch('emit', args) as Array<(...listenerArgs: unknown[]) => unknown>) {
try {
const returned = listener(sessionId, name, result)
if (returned != null && typeof (returned as PromiseLike<unknown>).then === 'function') {
void Promise.resolve(returned as PromiseLike<unknown>).then(undefined, (error: unknown) => {
this.warnExecutedListenerFailure(name, error)
})
}
} catch (error) {
this.warnExecutedListenerFailure(name, error)
}
}
}
/** Log one contained `command/executed` observer failure. */
private warnExecutedListenerFailure(name: string, error: unknown): void {
this.ctx.logger.warn('client command: a command/executed listener for "%s" failed', name)
this.ctx.logger.warn(error)
}
/** /**
* Fire-and-forget execute for the internal ('handled') paths. Outcomes are * Fire-and-forget execute for the internal ('handled') paths. Outcomes are
* NOT surfaced here: the host executor durably logs the command lifecycle * NOT surfaced here: the host executor durably logs the command lifecycle
@@ -9,6 +9,7 @@
*/ */
import { Context } from '@deepseek-ai/cordis' import { Context } from '@deepseek-ai/cordis'
import { describe, expect, it, vi } from 'vitest' import { describe, expect, it, vi } from 'vitest'
import type { CommandResult } from '@deepseek-ai/dsh-commands/types'
import { createScope, scopeOf } from '@deepseek-ai/dsh-client-runtime/client' import { createScope, scopeOf } from '@deepseek-ai/dsh-client-runtime/client'
import type { SessionId } from '@deepseek-ai/dsh-client-runtime/client' import type { SessionId } from '@deepseek-ai/dsh-client-runtime/client'
import type { ClientSessionContext, ConsumeTokenRequest, SlashPick, SlashSource } from '@deepseek-ai/dsh-client-ui-slash/client' import type { ClientSessionContext, ConsumeTokenRequest, SlashPick, SlashSource } from '@deepseek-ai/dsh-client-ui-slash/client'
@@ -120,6 +121,10 @@ async function bench(opts: BenchOptions = {}) {
}, },
}) })
ctx.provide('remote.commands', commandsRemote) ctx.provide('remote.commands', commandsRemote)
const executions: Array<{ sessionId: SessionId; name: string; result: CommandResult }> = []
ctx.on('command/executed', (sessionId, name, result) => {
executions.push({ sessionId, name, result })
})
/** Notices the fake conversation face collected (runDetached routing). */ /** Notices the fake conversation face collected (runDetached routing). */
const notices: Array<{ scope: SessionId | undefined; level: 'info' | 'error'; text: string }> = [] const notices: Array<{ scope: SessionId | undefined; level: 'info' | 'error'; text: string }> = []
ctx.provide('conversation', { ctx.provide('conversation', {
@@ -145,7 +150,7 @@ async function bench(opts: BenchOptions = {}) {
const warm = async (session: ClientSessionContext) => { const warm = async (session: ClientSessionContext) => {
await source.candidates(session, { query: '', position: 'leading', signal: new AbortController().signal }) await source.candidates(session, { query: '', position: 'leading', signal: new AbortController().signal })
} }
return { ctx, fiber, command, source, mint, warm, listCalls, executeCalls, registered, notices } return { ctx, fiber, command, source, mint, warm, listCalls, executeCalls, executions, registered, notices }
} }
function menuPick(source: SlashSource, name: string, session: ClientSessionContext, end?: number) { function menuPick(source: SlashSource, name: string, session: ClientSessionContext, end?: number) {
@@ -367,7 +372,7 @@ describe('dispatch (menu column)', () => {
}) })
it('host bare → consume-token span guard on the session scope + detached execute', async () => { it('host bare → consume-token span guard on the session scope + detached execute', async () => {
const { source, mint, warm, executeCalls } = await bench() const { source, mint, warm, executeCalls, executions } = await bench()
const scope = mint('s1') const scope = mint('s1')
const consumes: ConsumeTokenRequest[] = [] const consumes: ConsumeTokenRequest[] = []
scope.ctx.on('slash/input-consume-token', (r) => { scope.ctx.on('slash/input-consume-token', (r) => {
@@ -377,8 +382,14 @@ describe('dispatch (menu column)', () => {
await warm(proj('s1')) await warm(proj('s1'))
expect(menuPick(source, 'plan', proj('s1'), 5)).toBe('handled') expect(menuPick(source, 'plan', proj('s1'), 5)).toBe('handled')
expect(consumes).toEqual([{ guard: { kind: 'span', span: { start: 0, end: 5, draftRev: 3 } } }]) expect(consumes).toEqual([{ guard: { kind: 'span', span: { start: 0, end: 5, draftRev: 3 } } }])
await Promise.resolve() await vi.waitFor(() => {
expect(executeCalls).toEqual([{ sessionId: sid('s1'), line: '/plan' }]) expect(executeCalls).toEqual([{ sessionId: sid('s1'), line: '/plan' }])
expect(executions).toEqual([{
sessionId: sid('s1'),
name: 'plan',
result: { kind: 'success' },
}])
})
}) })
it('a name the directory no longer serves → undefined (snapshot swapped between menu and pick)', async () => { it('a name the directory no longer serves → undefined (snapshot swapped between menu and pick)', async () => {
@@ -496,7 +507,7 @@ describe('matchEnter (enter column)', () => {
describe('execute payload', () => { describe('execute payload', () => {
it('claim.submit addresses the session; admitted outcomes stay off the composer (flow card owns them)', async () => { it('claim.submit addresses the session; admitted outcomes stay off the composer (flow card owns them)', async () => {
const { source, warm, executeCalls } = await bench({ const { source, warm, executeCalls, executions } = await bench({
execute: () => Promise.resolve({ matched: true }), execute: () => Promise.resolve({ matched: true }),
}) })
await warm(proj('s1')) await warm(proj('s1'))
@@ -507,6 +518,34 @@ describe('execute payload', () => {
// Pure admission: no outcome text ever rides the submit result — the // Pure admission: no outcome text ever rides the submit result — the
// durable command lifecycle events render the outcome in the flow. // durable command lifecycle events render the outcome in the flow.
expect(settled).toEqual({ kind: 'success' }) expect(settled).toEqual({ kind: 'success' })
expect(executions).toEqual([{
sessionId: sid('s1'),
name: 'goal',
result: { kind: 'success' },
}])
})
it('contains local acknowledgment listeners without changing an admitted result', async () => {
const b = await bench({ execute: () => Promise.resolve({ matched: true }) })
await b.warm(proj('s1'))
const outcome = b.source.matchSpace!(proj('s1'), '/goal')
if (outcome === undefined || outcome === 'handled' || !('claim' in outcome)) throw new Error('expected claim')
const syncFailure = new Error('sync observer failed')
const asyncFailure = new Error('async observer failed')
const after = vi.fn()
const warn = vi.spyOn(b.ctx.logger, 'warn').mockImplementation(() => undefined)
b.ctx.on('command/executed', () => { throw syncFailure })
const rejectingListener = (() => Promise.reject(asyncFailure)) as unknown as () => void
b.ctx.on('command/executed', rejectingListener)
b.ctx.on('command/executed', after)
await expect(outcome.claim.submit('ship it', new Context())).resolves.toEqual({ kind: 'success' })
expect(after).toHaveBeenCalledOnce()
await Promise.resolve()
await Promise.resolve()
expect(warn).toHaveBeenCalledWith('client command: a command/executed listener for "%s" failed', 'goal')
expect(warn).toHaveBeenCalledWith(syncFailure)
expect(warn).toHaveBeenCalledWith(asyncFailure)
}) })
it('maps matched:false to an error outcome and a matched bare result to success', async () => { it('maps matched:false to an error outcome and a matched bare result to success', async () => {
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority; # side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with: # after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write packages/client/ui-conversation/README.md # pnpm run verify-translation-pairing --write packages/client/ui-conversation/README.md
README.md: e2db456f92151c3602fce0bf40a86e4019cda1cb README.md: b6a265c9f0a67d31ebeaa88bd59082c4be465983
README.zh.md: c5f3152006ea37848b21942d886cbfb74af15943 README.zh.md: 001e0a58badd6f31875c09a31085277928f1ae22
+1 -1
View File
@@ -16,7 +16,7 @@ Chat business rows are independent registry contributions rather than a closed b
Approvals take over the composer through the chain this package declares: `ApprovalPanel` registers as a selector-routed `'conversation.composer'` entry (the ui-question pattern) and occupies the composer in place of the InputBar while an approval wait is pending (amber strip, justification headline, paired command line from the running call's args, one-shot refuse/allow). The `PendingApproval` domain face in `contract/slots.ts` owns the wire encoding — the `ApprovalResponsePayload` value with the audit correlation — over the runtime's `PendingWait` carrier; the broadcast `approval/resolved` frame settles the wait and restores the composer. The runtime manager projects every approval or question wait through `SessionSummary.pendingInteraction`, including sessions never instantiated; `ui-workspace` owns its sidebar presentation. Pending waits leave the message flow entirely: questions (ui-question) and approvals (ApprovalPanel) both answer through the composer takeover, so no display-only placeholder card remains. The composer's bottom-row Access seat mounts `PermissionSelect`, fed by the host-computed `permissions` projection through the standard-kit `useProjection` (key absence hides the chip); the chip opens a Menu-primitive dropdown whose kebab-case preset names render as title-case labels. Safe preset picks submit `/permission <preset>` immediately through the bar's injected `command` callback, while `danger-full-access` is presented as `Full access` and first opens an in-page Modal risk confirmation. The enabling action stays disabled until the user checks the acknowledgement; cancel, Escape, close, and mask click submit nothing. Approvals take over the composer through the chain this package declares: `ApprovalPanel` registers as a selector-routed `'conversation.composer'` entry (the ui-question pattern) and occupies the composer in place of the InputBar while an approval wait is pending (amber strip, justification headline, paired command line from the running call's args, one-shot refuse/allow). The `PendingApproval` domain face in `contract/slots.ts` owns the wire encoding — the `ApprovalResponsePayload` value with the audit correlation — over the runtime's `PendingWait` carrier; the broadcast `approval/resolved` frame settles the wait and restores the composer. The runtime manager projects every approval or question wait through `SessionSummary.pendingInteraction`, including sessions never instantiated; `ui-workspace` owns its sidebar presentation. Pending waits leave the message flow entirely: questions (ui-question) and approvals (ApprovalPanel) both answer through the composer takeover, so no display-only placeholder card remains. The composer's bottom-row Access seat mounts `PermissionSelect`, fed by the host-computed `permissions` projection through the standard-kit `useProjection` (key absence hides the chip); the chip opens a Menu-primitive dropdown whose kebab-case preset names render as title-case labels. Safe preset picks submit `/permission <preset>` immediately through the bar's injected `command` callback, while `danger-full-access` is presented as `Full access` and first opens an in-page Modal risk confirmation. The enabling action stays disabled until the user checks the acknowledgement; cancel, Escape, close, and mask click submit nothing.
The session header declares and renders the session-scoped `'conversation.session.header.actions'` list beside the title, allowing feature plugins to contribute controls without entering the skeleton. The composer chain currency includes the current conversation `session`; ui-subagent selects one-shot or parent-unavailable addressed sessions for reason-specific read-only copy, while the ordinary InputBar keeps every addressed child Send-only because the continuation service exposes no public per-Activation cancellation operation and `session.cancel` would bypass its ownership. The session header renders the session-scoped `'conversation.session.header.actions'` list beside the title and the independent `'conversation.session.header.utilities'` list at the right edge. Session context and lineage controls remain in `actions`; optional Session utilities cannot reorder or move them. The composer chain currency includes the current conversation `session`; ui-subagent selects one-shot or parent-unavailable addressed sessions for reason-specific read-only copy, while the ordinary InputBar keeps every addressed child Send-only because the continuation service exposes no public per-Activation cancellation operation and `session.cancel` would bypass its ownership.
Logged non-user messages render as a default-collapsed disclosure whose header names the role the runtime projected for the message — `上下文注入` for an injection, `跨会话召回` for a recalled session — followed by the producer name that projection read out of the durable source, so a reader distinguishes a skill catalog from a workspace instruction file or a recalled session without expanding. A source that names no producer shows the role alone. The shared `DisclosureRow` primitive gives this context surface the same compact geometry as other flow rows while retaining context semantics: the expanded body follows its content height up to a 141px scrolling cap and synthesizes no tool state or summary ([historical disclosure decision](../../../.agents/notes/archived/feature/2026-07-30-web-context-injection-disclosure.md), [producer-label decision](../../../.agents/notes/implemented/feature/2026-08-04-web-context-source-and-steer-marks.md)). That body follows the form the producer declared on its durable source: `instructions` names the reconciled files above their text, `catalog` lists the entries the source recorded instead of the model-facing prose, and every other value — absent, unknown to this version, or carrying no usable fields — renders the opaque body, which shows the model-facing text with its real line breaks and the remaining source fields. The opaque body is the documented default, not a leftover: a resumed, forked, or foreign log must render whether or not its producer is mounted here. A durable or pending steering bubble shares the user bubble's presentation unadorned; its mid-turn position in the flow is the only steering signal the transcript shows. Logged non-user messages render as a default-collapsed disclosure whose header names the role the runtime projected for the message — `上下文注入` for an injection, `跨会话召回` for a recalled session — followed by the producer name that projection read out of the durable source, so a reader distinguishes a skill catalog from a workspace instruction file or a recalled session without expanding. A source that names no producer shows the role alone. The shared `DisclosureRow` primitive gives this context surface the same compact geometry as other flow rows while retaining context semantics: the expanded body follows its content height up to a 141px scrolling cap and synthesizes no tool state or summary ([historical disclosure decision](../../../.agents/notes/archived/feature/2026-07-30-web-context-injection-disclosure.md), [producer-label decision](../../../.agents/notes/implemented/feature/2026-08-04-web-context-source-and-steer-marks.md)). That body follows the form the producer declared on its durable source: `instructions` names the reconciled files above their text, `catalog` lists the entries the source recorded instead of the model-facing prose, and every other value — absent, unknown to this version, or carrying no usable fields — renders the opaque body, which shows the model-facing text with its real line breaks and the remaining source fields. The opaque body is the documented default, not a leftover: a resumed, forked, or foreign log must render whether or not its producer is mounted here. A durable or pending steering bubble shares the user bubble's presentation unadorned; its mid-turn position in the flow is the only steering signal the transcript shows.
+1 -1
View File
@@ -14,7 +14,7 @@
Chat 业务行是彼此独立的注册表贡献,不是封闭的内建联合。Client 插件通过 declaration merging 增加类型化 `ChatNodeDataMap` key,在 `ctx.conversationEvents` 上注册 `ConversationNodeDefinition`,再向 `conversation.chat.node` 注册匹配的 keyed renderer;它无须修改会话 fold 或中央 renderer switch。稳定事件 id、append/prepend 回放、Location data 与 renderer 约束见 [Conversation Node 实操手册](../../../docs/cookbook/adding-a-conversation-node.md)。 Chat 业务行是彼此独立的注册表贡献,不是封闭的内建联合。Client 插件通过 declaration merging 增加类型化 `ChatNodeDataMap` key,在 `ctx.conversationEvents` 上注册 `ConversationNodeDefinition`,再向 `conversation.chat.node` 注册匹配的 keyed renderer;它无须修改会话 fold 或中央 renderer switch。稳定事件 id、append/prepend 回放、Location data 与 renderer 约束见 [Conversation Node 实操手册](../../../docs/cookbook/adding-a-conversation-node.md)。
会话页头会在标题旁声明并渲染会话作用域的 `'conversation.session.header.actions'` 列表,使功能插件无需进入骨架即可贡献控件。编辑器链的 currency 包含当前对话 `session`ui-subagent 会选取 one-shot 或 parent 不可用的已寻址会话,并按原因显示只读文案,而普通 InputBar 会让所有已寻址 child 仅保留 Send,因为继续执行服务不公开逐 Activation 取消操作,`session.cancel` 也会绕过其所有权。 会话页头会在标题旁渲染会话作用域的 `'conversation.session.header.actions'` 列表,并在最右侧渲染独立的 `'conversation.session.header.utilities'` 列表。会话上下文和谱系控件保留在 `actions` 中;可选的会话工具不会改变它们的顺序或位置。编辑器链的 currency 包含当前对话 `session`ui-subagent 会选取 one-shot 或 parent 不可用的已寻址会话,并按原因显示只读文案,而普通 InputBar 会让所有已寻址 child 仅保留 Send,因为继续执行服务不公开逐 Activation 取消操作,`session.cancel` 也会绕过其所有权。
已记录的非用户消息渲染为默认折叠的展开项,标题栏先给出运行时为该消息投影出的角色——注入为 `上下文注入`,召回为 `跨会话召回`——其后是该投影从持久来源读出的生产者名称,因此读者无需展开即可区分 skill(技能)目录、工作区指令文件与被召回的会话。来源未提供生产者名称时只显示角色。共享的 `DisclosureRow` 原子组件让该上下文界面与消息流中的其他紧凑行保持相同几何,同时保留上下文语义:展开内容区的高度会随内容自适应,最大为 141px,超出后滚动,且不会合成工具状态或摘要([历史展开项决策](../../../.agents/notes/archived/feature/2026-07-30-web-context-injection-disclosure.md)、[生产者标签决策](../../../.agents/notes/implemented/feature/2026-08-04-web-context-source-and-steer-marks.md))。该内容区按生产方在持久来源上声明的形态渲染:`instructions` 在正文之上列出它对账过的文件,`catalog` 列出来源记录的条目而非面向模型的正文,其余取值——未声明、本版本不认识、或字段不可用——一律渲染 opaque 内容区,即按真实换行展示面向模型的文本,并把剩余来源字段列出。opaque 不是兜底剩余物而是有文档的默认:恢复的、fork 的、外部写入的日志,无论其生产方是否挂载在此处,都必须渲染得出来。持久或待处理的 steering(中途引导)气泡沿用用户气泡的呈现,不加任何装饰;transcript 中唯一的 steering 信号是它出现在轮次中途的位置。 已记录的非用户消息渲染为默认折叠的展开项,标题栏先给出运行时为该消息投影出的角色——注入为 `上下文注入`,召回为 `跨会话召回`——其后是该投影从持久来源读出的生产者名称,因此读者无需展开即可区分 skill(技能)目录、工作区指令文件与被召回的会话。来源未提供生产者名称时只显示角色。共享的 `DisclosureRow` 原子组件让该上下文界面与消息流中的其他紧凑行保持相同几何,同时保留上下文语义:展开内容区的高度会随内容自适应,最大为 141px,超出后滚动,且不会合成工具状态或摘要([历史展开项决策](../../../.agents/notes/archived/feature/2026-07-30-web-context-injection-disclosure.md)、[生产者标签决策](../../../.agents/notes/implemented/feature/2026-08-04-web-context-source-and-steer-marks.md))。该内容区按生产方在持久来源上声明的形态渲染:`instructions` 在正文之上列出它对账过的文件,`catalog` 列出来源记录的条目而非面向模型的正文,其余取值——未声明、本版本不认识、或字段不可用——一律渲染 opaque 内容区,即按真实换行展示面向模型的文本,并把剩余来源字段列出。opaque 不是兜底剩余物而是有文档的默认:恢复的、fork 的、外部写入的日志,无论其生产方是否挂载在此处,都必须渲染得出来。持久或待处理的 steering(中途引导)气泡沿用用户气泡的呈现,不加任何装饰;transcript 中唯一的 steering 信号是它出现在轮次中途的位置。
@@ -259,6 +259,7 @@ export function apply(ctx: Context): void {
locale: NS, locale: NS,
children: { children: {
'conversation.session.header.actions': { kind: 'list', scope: 'session' }, 'conversation.session.header.actions': { kind: 'list', scope: 'session' },
'conversation.session.header.utilities': { kind: 'list', scope: 'session' },
}, },
store: chatStore, store: chatStore,
inject: (): ConversationSessionHeaderInjected => ({ inject: (): ConversationSessionHeaderInjected => ({
@@ -244,6 +244,12 @@
font: var(--dsw-font-markdown-code-block-small); font: var(--dsw-font-markdown-code-block-small);
} }
.maxTokensTitle {
margin-right: 6px;
color: var(--dsw-alias-state-warn-primary);
font-weight: 600;
}
@keyframes retry-shimmer { @keyframes retry-shimmer {
from { from {
background-position: 100% 50%; background-position: 100% 50%;
@@ -130,6 +130,21 @@ function TurnErrorItem({ node, t }: {
) )
} }
/** Persistent, turn-positioned notice for a turn ended at the output-token cap. */
function TurnMaxTokensItem({ t }: {
t: ChatViewSlotProps['t']
}) {
return (
<div className={css.turnErrorRow} role="status">
<StateDot state="warning" className={css.turnErrorDot} />
<div className={css.turnErrorCopy}>
<span className={css.maxTokensTitle}>{t('message.maxTokens')}</span>
<span className={css.turnErrorMessage}>{t('message.maxTokens.hint')}</span>
</div>
</div>
)
}
/** /**
* Display projection of reference forms in a user bubble (free geometry — no * Display projection of reference forms in a user bubble (free geometry — no
* textarea alignment constraint here); everything else stays plain text. The * textarea alignment constraint here); everything else stays plain text. The
@@ -272,6 +287,11 @@ export const TurnErrorNodeView = memo(function TurnErrorNodeView({ node, t }: Ch
return <TurnErrorItem node={node.data} t={t} /> return <TurnErrorItem node={node.data} t={t} />
}) })
/** Max-tokens turn-end notice keyed Chat renderer. */
export const TurnMaxTokensNodeView = memo(function TurnMaxTokensNodeView({ t }: ChatNodeViewProps<'turn-max-tokens'>) {
return <TurnMaxTokensItem t={t} />
})
/** Explicit unknown-surface keyed Chat renderer. */ /** Explicit unknown-surface keyed Chat renderer. */
export const UnknownNodeView = memo(function UnknownNodeView({ node, t }: ChatNodeViewProps<'unknown'>) { export const UnknownNodeView = memo(function UnknownNodeView({ node, t }: ChatNodeViewProps<'unknown'>) {
const data = node.data const data = node.data
@@ -4,7 +4,7 @@ import { AssistantNodeView } from './AssistantNodeView.tsx'
import { CommandNodeView, ManualCompactionNodeView } from './CommandNodeView.tsx' import { CommandNodeView, ManualCompactionNodeView } from './CommandNodeView.tsx'
import { import {
CompactionNodeView, ContextMessageNodeView, RetryNodeView, TurnErrorNodeView, CompactionNodeView, ContextMessageNodeView, RetryNodeView, TurnErrorNodeView,
UnknownNodeView, UserMessageNodeView, TurnMaxTokensNodeView, UnknownNodeView, UserMessageNodeView,
} from './MessageItem.tsx' } from './MessageItem.tsx'
import { TurnTailNodeView } from './TurnTailNodeView.tsx' import { TurnTailNodeView } from './TurnTailNodeView.tsx'
@@ -35,6 +35,8 @@ export function registerChatNodeRenderers(ctx: Context): void {
{ name: 'conversation.chat.node', key: 'model-retry', locale: NS }, RetryNodeView)) { name: 'conversation.chat.node', key: 'model-retry', locale: NS }, RetryNodeView))
ctx.slots.inject('conversation.chat.node', () => ctx.slots.register( ctx.slots.inject('conversation.chat.node', () => ctx.slots.register(
{ name: 'conversation.chat.node', key: 'turn-error', locale: NS }, TurnErrorNodeView)) { name: 'conversation.chat.node', key: 'turn-error', locale: NS }, TurnErrorNodeView))
ctx.slots.inject('conversation.chat.node', () => ctx.slots.register(
{ name: 'conversation.chat.node', key: 'turn-max-tokens', locale: NS }, TurnMaxTokensNodeView))
ctx.slots.inject('conversation.chat.node', () => ctx.slots.register({ ctx.slots.inject('conversation.chat.node', () => ctx.slots.register({
name: 'conversation.chat.node', name: 'conversation.chat.node',
key: 'turn-tail', key: 'turn-tail',
@@ -45,6 +45,11 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
* context that precedes interactive actions. * context that precedes interactive actions.
*/ */
'conversation.session.header.actions': { kind: 'list'; scope: 'session'; owner: ConversationHeaderActionOwnerProps } 'conversation.session.header.actions': { kind: 'list'; scope: 'session'; owner: ConversationHeaderActionOwnerProps }
/**
* Right-aligned Session utilities kept outside the title-adjacent action
* group, so an optional utility cannot reorder session context or lineage.
*/
'conversation.session.header.utilities': { kind: 'list'; scope: 'session'; owner: ConversationHeaderActionOwnerProps }
/** /**
* The conversation view ring: one list entry per view tab (chat here; * The conversation view ring: one list entry per view tab (chat here;
* trajectory/waterfall from ui-trajectory), rendered one-at-a-time by * trajectory/waterfall from ui-trajectory), rendered one-at-a-time by
@@ -525,7 +530,7 @@ export type ConversationSessionSlotProps =
/** Full strict-session header props: shared store, tabs/actions render shares, navigation, and locale. */ /** Full strict-session header props: shared store, tabs/actions render shares, navigation, and locale. */
export type ConversationSessionHeaderSlotProps = export type ConversationSessionHeaderSlotProps =
PropsRuntime<'conversation.session.header'> PropsRuntime<'conversation.session.header'>
& PropsRenderSlots<'conversation.session.header.actions'> & PropsRenderSlots<'conversation.session.header.actions' | 'conversation.session.header.utilities'>
& PropsStore<ChatStore> & PropsStore<ChatStore>
& ConversationSessionHeaderInjected & ConversationSessionHeaderInjected
& PropsLocale<'conversation'> & PropsLocale<'conversation'>
@@ -165,6 +165,7 @@ function legacyContribution(raw: ChatConversationViewNode): LegacyContribution {
case 'command': case 'command':
case 'compaction': case 'compaction':
case 'turn-error': case 'turn-error':
case 'turn-max-tokens':
case 'unknown': case 'unknown':
return { anchorSeq: node.anchorSeq, nodes: [node.data], partial: null, running: null } return { anchorSeq: node.anchorSeq, nodes: [node.data], partial: null, running: null }
case 'assistant-step': { case 'assistant-step': {
@@ -7,11 +7,14 @@ import type {
/** /**
* Relative positions in one durable event's seq neighborhood: interrupted * Relative positions in one durable event's seq neighborhood: interrupted
* Assistant, its follow-up Nodes, then follow-ups to an ordinary final. * Assistant, its follow-up Nodes, then follow-ups to an ordinary final. The
* max-tokens notice sits between a closing Assistant and the turn-tail so the
* tail stays the turn's last node and keeps its branch action enabled.
*/ */
export const CHAT_SYNTHETIC_SEQ_OFFSETS = { export const CHAT_SYNTHETIC_SEQ_OFFSETS = {
interruptedAssistant: -0.9, interruptedAssistant: -0.9,
interruptedFollowup: -0.8, interruptedFollowup: -0.8,
maxTokensNotice: 0.05,
finalizedFollowup: 0.1, finalizedFollowup: 0.1,
} as const } as const
@@ -9,6 +9,7 @@ import { registerMessageConversationNode } from './message.ts'
import { registerRetryConversationNode } from './retry.ts' import { registerRetryConversationNode } from './retry.ts'
import { registerToolConversationNode } from './tool.ts' import { registerToolConversationNode } from './tool.ts'
import { registerTurnErrorConversationNode } from './turn-error.ts' import { registerTurnErrorConversationNode } from './turn-error.ts'
import { registerTurnMaxTokensConversationNode } from './turn-max-tokens.ts'
import { registerTurnTailConversationNode } from './turn-tail.ts' import { registerTurnTailConversationNode } from './turn-tail.ts'
/** /**
@@ -24,6 +25,7 @@ export function registerConversationNodes(ctx: Context): void {
registerCompactionConversationNode(ctx) registerCompactionConversationNode(ctx)
registerRetryConversationNode(ctx) registerRetryConversationNode(ctx)
registerTurnErrorConversationNode(ctx) registerTurnErrorConversationNode(ctx)
registerTurnMaxTokensConversationNode(ctx)
registerTurnTailConversationNode(ctx) registerTurnTailConversationNode(ctx)
registerUnknownConversationFallback(ctx) registerUnknownConversationFallback(ctx)
registerChatConversationView(ctx) registerChatConversationView(ctx)
@@ -0,0 +1,82 @@
import type { Context } from '@deepseek-ai/cordis'
import type {
ConversationMatch, ConversationNodeContext, ConversationNodeDefinition, TurnMaxTokensNode,
} from '@deepseek-ai/dsh-client-runtime/client'
import { CHAT_SYNTHETIC_SEQ_OFFSETS, chatNode } from './common.ts'
declare module '@deepseek-ai/dsh-client-ui-conversation/client' {
interface ChatNodeDataMap {
/** Turn ended by the per-request output-token cap. */
'turn-max-tokens': TurnMaxTokensNode
}
}
interface TurnMaxTokensState {
readonly turn: number
readonly seq: number
readonly time: number
}
function lastStep(context: ConversationNodeContext<TurnMaxTokensState>): number {
const location = context.start?.location ?? context.matches[0]?.location
if (location?.kind !== 'turn' && location?.kind !== 'step') return 0
return location.turn.steps.at(-1)?.step ?? 0
}
/**
* Anchor the notice between the closing Assistant and the turn-tail so the
* tail stays the turn's last Chat node and keeps its branch action enabled.
* Without a closing text Assistant there is no branch action to protect, and
* the turn/end seq keeps the notice at the truncation point.
*/
function noticeAnchor(context: ConversationNodeContext<TurnMaxTokensState>, seq: number): number {
const location = context.start?.location ?? context.matches[0]?.location
if (location?.kind !== 'turn' && location?.kind !== 'step') return seq
const closing = location.turn.data.get('turn-tail')?.closing
return closing === null || closing === undefined
? seq
: closing.finalNode.seq + CHAT_SYNTHETIC_SEQ_OFFSETS.maxTokensNotice
}
function stateFrom(match: ConversationMatch): TurnMaxTokensState | undefined {
if (match.event.type !== 'turn/end' || match.event.data.reason.kind !== 'max-tokens') return undefined
return { turn: match.event.data.turn, seq: match.event.seq, time: match.event.time }
}
/** Notice Definition for a turn the provider ended at its output-token cap. */
export const turnMaxTokensDefinition: ConversationNodeDefinition<TurnMaxTokensState> = {
kind: 'turn-max-tokens',
target: 'chat',
match: (event) => {
if (event.type === 'turn/end' && event.data.reason.kind === 'max-tokens') {
return { id: String(event.data.turn), role: 'start' }
}
return null
},
start: (_context, match) => {
const state = stateFrom(match)
if (state === undefined) throw new Error('turn-max-tokens start requires a max-tokens turn/end')
return state
},
update: context => context.state,
buildViewNode: (context) => {
const state = context.state
if (state === undefined) return null
const node: TurnMaxTokensNode = {
kind: 'turn-max-tokens',
seq: state.seq,
time: state.time,
turn: state.turn,
step: lastStep(context),
}
return chatNode(context, 'turn-max-tokens', noticeAnchor(context, state.seq), node)
},
}
/**
* Register the max-tokens turn-end notice contribution.
* @param ctx - owning UI Conversation context.
*/
export function registerTurnMaxTokensConversationNode(ctx: Context): void {
ctx.conversationEvents.register(turnMaxTokensDefinition)
}
@@ -11,6 +11,7 @@ export type {} from './conversation-nodes/message.ts'
export type {} from './conversation-nodes/retry.ts' export type {} from './conversation-nodes/retry.ts'
export type {} from './conversation-nodes/tool.ts' export type {} from './conversation-nodes/tool.ts'
export type {} from './conversation-nodes/turn-error.ts' export type {} from './conversation-nodes/turn-error.ts'
export type {} from './conversation-nodes/turn-max-tokens.ts'
export type {} from './conversation-nodes/turn-tail.ts' export type {} from './conversation-nodes/turn-tail.ts'
export { apply, inject } from './apply.ts' export { apply, inject } from './apply.ts'
@@ -122,6 +122,8 @@ export const zh = {
'message.retry.delay': '重试延迟:', 'message.retry.delay': '重试延迟:',
'message.retry.failure': '失败原因:', 'message.retry.failure': '失败原因:',
'message.turnError': '本轮运行失败', 'message.turnError': '本轮运行失败',
'message.maxTokens': '已达到输出 token 上限',
'message.maxTokens.hint': '回答被截断,已有输出保留在对话中。发送“继续”可让模型接着输出。',
'message.ranFor': '用时 {duration}', 'message.ranFor': '用时 {duration}',
'message.ttft': '首 token {seconds}秒', 'message.ttft': '首 token {seconds}秒',
'message.tokensPerSecond': '{tps} tok/s', 'message.tokensPerSecond': '{tps} tok/s',
@@ -289,6 +291,8 @@ export const en = {
'message.retry.delay': 'Retry delay: ', 'message.retry.delay': 'Retry delay: ',
'message.retry.failure': 'Failure reason: ', 'message.retry.failure': 'Failure reason: ',
'message.turnError': 'This turn failed', 'message.turnError': 'This turn failed',
'message.maxTokens': 'Output token limit reached',
'message.maxTokens.hint': 'The reply was cut off; earlier output is preserved in the conversation. Send "continue" to let the model resume.',
'message.ranFor': 'Ran for {duration}', 'message.ranFor': 'Ran for {duration}',
'message.ttft': 'TTFT {seconds}s', 'message.ttft': 'TTFT {seconds}s',
'message.tokensPerSecond': '{tps} tok/s', 'message.tokensPerSecond': '{tps} tok/s',
@@ -53,9 +53,18 @@
.titleRow { .titleRow {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 10px; gap: 0;
min-height: 32px; min-height: 32px;
} }
.titleCluster {
display: flex;
flex: 1;
align-items: center;
gap: 10px;
min-width: 0;
}
.crumbs { .crumbs {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -111,6 +120,18 @@
gap: 8px; gap: 8px;
} }
.headerUtilities {
display: flex;
flex: none;
align-items: center;
gap: 8px;
margin-left: 20px;
}
.headerUtilities:empty {
display: none;
}
/* figma Tab_Group 34:11441: 35px strip, gap 36, pad-left 8, tabs bottom-aligned. */ /* figma Tab_Group 34:11441: 35px strip, gap 36, pad-left 8, tabs bottom-aligned. */
.tabs { .tabs {
position: relative; position: relative;
@@ -69,27 +69,32 @@ export function ConversationSessionHeader({
{!hideChrome && ( {!hideChrome && (
<> <>
<div className={css.titleRow}> <div className={css.titleRow}>
<nav className={css.crumbs} aria-label={t('session.hierarchy')}> <div className={css.titleCluster}>
{ancestry.map((summary, index) => { <nav className={css.crumbs} aria-label={t('session.hierarchy')}>
const last = index === ancestry.length - 1 {ancestry.map((summary, index) => {
return ( const last = index === ancestry.length - 1
<span key={summary.id} className={css.crumbSeg}> return (
{index > 0 && <span className={css.crumbSep}>/</span>} <span key={summary.id} className={css.crumbSeg}>
<button {index > 0 && <span className={css.crumbSep}>/</span>}
type="button" <button
className={clsx(css.crumb, last && css.crumbCurrent)} type="button"
disabled={last} className={clsx(css.crumb, last && css.crumbCurrent)}
onClick={() => { open(summary.id) }} disabled={last}
> onClick={() => { open(summary.id) }}
{summary.displayTitle} >
</button> {summary.displayTitle}
</span> </button>
) </span>
})} )
{ancestry.length === 0 && <span className={css.crumbCurrent}>{sessionId}</span>} })}
</nav> {ancestry.length === 0 && <span className={css.crumbCurrent}>{sessionId}</span>}
<div className={css.headerActions}> </nav>
{renderSlot('conversation.session.header.actions', {})} <div className={css.headerActions}>
{renderSlot('conversation.session.header.actions', {})}
</div>
</div>
<div className={css.headerUtilities}>
{renderSlot('conversation.session.header.utilities', {})}
</div> </div>
</div> </div>
{tabs.length > 1 && ( {tabs.length > 1 && (
@@ -9,7 +9,7 @@ import { useEffect } from 'react'
import type { import type {
AssistantMessageNode, CommandNode, CompactionSummaryNode, ConversationNode, ConversationSnapshot, AssistantMessageNode, CommandNode, CompactionSummaryNode, ConversationNode, ConversationSnapshot,
ModelRetryNode, RunningToolCall, SessionId, SessionListState, ToolCallBlock, ToolResultNode, TurnErrorNode, ModelRetryNode, RunningToolCall, SessionId, SessionListState, ToolCallBlock, ToolResultNode, TurnErrorNode,
UserMessageNode, WorkspaceListState, TurnMaxTokensNode, UserMessageNode, WorkspaceListState,
} from '@deepseek-ai/dsh-client-runtime/client' } from '@deepseek-ai/dsh-client-runtime/client'
import { bindSnapshotSelector } from '@deepseek-ai/dsh-client-web-react' import { bindSnapshotSelector } from '@deepseek-ai/dsh-client-web-react'
import { import {
@@ -28,7 +28,7 @@ import { AssistantNodeView } from '../src/client/chat/AssistantNodeView.tsx'
import { CommandNodeView, ManualCompactionNodeView } from '../src/client/chat/CommandNodeView.tsx' import { CommandNodeView, ManualCompactionNodeView } from '../src/client/chat/CommandNodeView.tsx'
import { import {
CompactionNodeView, ContextMessageNodeView, RetryNodeView, TurnErrorNodeView, CompactionNodeView, ContextMessageNodeView, RetryNodeView, TurnErrorNodeView,
UnknownNodeView, UserMessageNodeView, TurnMaxTokensNodeView, UnknownNodeView, UserMessageNodeView,
} from '../src/client/chat/MessageItem.tsx' } from '../src/client/chat/MessageItem.tsx'
import { TurnTailNodeView } from '../src/client/chat/TurnTailNodeView.tsx' import { TurnTailNodeView } from '../src/client/chat/TurnTailNodeView.tsx'
import { formatRunDuration } from '../src/client/chat/message-chrome.ts' import { formatRunDuration } from '../src/client/chat/message-chrome.ts'
@@ -108,6 +108,9 @@ const turnError = (seq: number, code?: string): TurnErrorNode => ({
message: seq === 2 ? 'API key is invalid' : 'plugin exploded', message: seq === 2 ? 'API key is invalid' : 'plugin exploded',
...(code === undefined ? {} : { code }), ...(code === undefined ? {} : { code }),
}) })
const turnMaxTokens = (seq: number): TurnMaxTokensNode => ({
kind: 'turn-max-tokens', seq, time: seq * 1_000, turn: 1, step: 0,
})
const toolResult = (seq: number, callId: string, name = 'bash'): ToolResultNode => ({ const toolResult = (seq: number, callId: string, name = 'bash'): ToolResultNode => ({
kind: 'tool-result', seq, time: seq * 1_000, callId, kind: 'tool-result', seq, time: seq * 1_000, callId,
call: { name, argsRaw: `{"command":"cmd-${callId}","description":"run ${callId}"}` }, call: { name, argsRaw: `{"command":"cmd-${callId}","description":"run ${callId}"}` },
@@ -217,6 +220,8 @@ function makeHarness(init?: Partial<ConversationSnapshot>) {
return <RetryNodeView {...nodeProps<'model-retry'>()} /> return <RetryNodeView {...nodeProps<'model-retry'>()} />
case 'turn-error': case 'turn-error':
return <TurnErrorNodeView {...nodeProps<'turn-error'>()} /> return <TurnErrorNodeView {...nodeProps<'turn-error'>()} />
case 'turn-max-tokens':
return <TurnMaxTokensNodeView {...nodeProps<'turn-max-tokens'>()} />
case 'turn-tail': case 'turn-tail':
return ( return (
<TurnTailNodeView <TurnTailNodeView
@@ -585,6 +590,16 @@ describe('ChatView', () => {
]) ])
}) })
it('renders the max-tokens notice with localized guidance, distinct from turn errors', () => {
const h = makeHarness({ nodes: [user(1, 'try'), assistant(2, 'truncated'), turnMaxTokens(3)] })
const view = render(<h.ChatView {...h.props} />)
const statuses = view.getAllByRole('status')
expect(statuses.map(status => status.textContent)).toEqual([
'已达到输出 token 上限回答被截断,已有输出保留在对话中。发送“继续”可让模型接着输出。',
])
expect(view.queryByText('本轮运行失败')).toBeNull()
})
it('hands the trajectory callback to the Tool seat', () => { it('hands the trajectory callback to the Tool seat', () => {
const h = makeHarness({ const h = makeHarness({
nodes: [toolResult(3, 'a')], nodes: [toolResult(3, 'a')],
@@ -14,6 +14,7 @@ import { messageDefinition } from '../src/client/conversation-nodes/message.ts'
import { retryDefinition } from '../src/client/conversation-nodes/retry.ts' import { retryDefinition } from '../src/client/conversation-nodes/retry.ts'
import { toolDefinition } from '../src/client/conversation-nodes/tool.ts' import { toolDefinition } from '../src/client/conversation-nodes/tool.ts'
import { turnErrorDefinition } from '../src/client/conversation-nodes/turn-error.ts' import { turnErrorDefinition } from '../src/client/conversation-nodes/turn-error.ts'
import { turnMaxTokensDefinition } from '../src/client/conversation-nodes/turn-max-tokens.ts'
import { turnTailDefinition } from '../src/client/conversation-nodes/turn-tail.ts' import { turnTailDefinition } from '../src/client/conversation-nodes/turn-tail.ts'
import type { import type {
AssistantChatData, ManualCompactionChatData, RetryChatData, ToolChatData, TurnTailChatData, AssistantChatData, ManualCompactionChatData, RetryChatData, ToolChatData, TurnTailChatData,
@@ -29,6 +30,7 @@ const DEFINITIONS: readonly ConversationNodeDefinition[] = [
compactionDefinition, compactionDefinition,
retryDefinition, retryDefinition,
turnErrorDefinition, turnErrorDefinition,
turnMaxTokensDefinition,
turnTailDefinition, turnTailDefinition,
] ]
@@ -812,6 +814,75 @@ describe('built-in conversation node Definitions', () => {
expect(node(snapshot(value), 'turn-error')).toBeUndefined() expect(node(snapshot(value), 'turn-error')).toBeUndefined()
}) })
it('materializes a max-tokens notice and keeps completed and error turns clean', () => {
const value = assembler([
at(1, 'turn/start', { turn: 1 }),
at(2, 'step/start', { turn: 1, step: 1 }),
at(3, 'assistant/message', {
turn: 1, step: 1, message: assistantMessage('a1', 'truncated answer'),
}, { surfaceOp: 'append' }),
at(4, 'step/end', { turn: 1, step: 1 }),
at(5, 'turn/end', { turn: 1, reason: { kind: 'max-tokens' } }),
])
const notice = node(snapshot(value), 'turn-max-tokens')
expect(notice?.data).toMatchObject({ kind: 'turn-max-tokens', seq: 5, turn: 1, step: 1 })
expect(node(snapshot(value), 'turn-error')).toBeUndefined()
// The tail stays the turn's last node so its branch action survives; the
// notice slots between the truncated closing Assistant and the tail.
const tail = node(snapshot(value), 'turn-tail')
expect(notice?.anchorSeq).toBeLessThan(tail?.anchorSeq ?? Number.NEGATIVE_INFINITY)
expect(notice?.anchorSeq).toBeGreaterThan(3)
const completed = assembler([
at(1, 'turn/start', { turn: 1 }),
at(2, 'turn/end', { turn: 1, reason: { kind: 'completed' } }),
])
expect(node(snapshot(completed), 'turn-max-tokens')).toBeUndefined()
const failed = assembler([
at(1, 'turn/start', { turn: 1 }),
at(2, 'turn/end', {
turn: 1,
reason: { kind: 'error', error: { code: 'TRANSPORT', message: 'failed' } },
}),
])
expect(node(snapshot(failed), 'turn-max-tokens')).toBeUndefined()
expect(node(snapshot(failed), 'turn-error')).toBeDefined()
})
it('keeps the max-tokens notice when the window starts after the owning turn/start', () => {
const value = assembler([
at(9, 'turn/end', { turn: 3, reason: { kind: 'max-tokens' } }),
], true)
const notice = node(snapshot(value), 'turn-max-tokens')
expect(notice?.data).toMatchObject({ kind: 'turn-max-tokens', seq: 9, turn: 3 })
})
it('pins the max-tokens Definition edges the engine cannot reach', () => {
// The engine only hands start the single matched turn/end and never emits
// update Matches for this kind; these direct calls pin the declared
// behavior of both required Definition members anyway.
const match = (seq: number, type: string, data: unknown) => ({
event: { seq, time: seq * 1_000, type, data },
view: undefined,
role: 'start',
location: undefined,
}) as unknown as Parameters<typeof turnMaxTokensDefinition.start>[1]
const context = (state: unknown, matches: unknown[] = []) => ({
key: 'k', kind: 'turn-max-tokens', id: '1', matches, start: undefined, state, current: new Map(),
}) as unknown as Parameters<NonNullable<typeof turnMaxTokensDefinition.buildViewNode>>[0]
const reader = { previous: () => undefined }
expect(() => turnMaxTokensDefinition.start(context(undefined), match(1, 'turn/start', { turn: 1 }), reader))
.toThrow('turn-max-tokens start requires a max-tokens turn/end')
const state = { turn: 1, seq: 5, time: 5_000 }
expect(turnMaxTokensDefinition.update(
context(state) as Parameters<typeof turnMaxTokensDefinition.update>[0],
match(6, 'turn/end', { turn: 1, reason: { kind: 'completed' } }),
)).toBe(state)
expect(turnMaxTokensDefinition.buildViewNode?.(context(undefined))).toBeNull()
})
it('preserves nested Tools and manual compaction evidence when their start events are outside the window', () => { it('preserves nested Tools and manual compaction evidence when their start events are outside the window', () => {
const value = assembler([ const value = assembler([
at(12, 'tool/code-dispatch-start', { at(12, 'tool/code-dispatch-start', {

Some files were not shown because too many files have changed in this diff Show More