Merge master into ihsiang/unify-code-block-ui
No files matched your search
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write .agents/notes/implemented/architecture/2026-07-08-tool-output-spill-files.md
|
||||
2026-07-08-tool-output-spill-files.md: fa6697aad63c97b0ef580fe1ca46e50541e3d682
|
||||
2026-07-08-tool-output-spill-files.zh.md: a995eafc7878b342a2164c5116da1f43ada791a5
|
||||
2026-07-08-tool-output-spill-files.md: e32aec72f423dff33a29d9012c0f71c9cfbd24fb
|
||||
2026-07-08-tool-output-spill-files.zh.md: 2941fc516723e72b5d5670e674ce612f3cf581cc
|
||||
@@ -66,36 +66,7 @@ interface SpillRef {
|
||||
|
||||
### Spill policy
|
||||
|
||||
`dsh-spill-policy` is a `tools/post-execute` result transformer with one configuration knob:
|
||||
|
||||
```ts ignore-check
|
||||
interface Config {
|
||||
/** Omitted means no automatic spill policy. Present means apply to oversized plain text tool results. */
|
||||
maxInlineBytes?: number
|
||||
}
|
||||
```
|
||||
|
||||
When `maxInlineBytes` is omitted the plugin registers nothing (a true no-op). When set, it applies a default policy to final plain-text tool results:
|
||||
|
||||
1. Let the tool run normally, delegating via `next()` so a downstream listener settles the result first.
|
||||
2. Flatten the accepted final `ContentBlock[]` only when it is entirely plain text; a result with any non-text block is left untouched.
|
||||
3. If its UTF-8 byte size is at or below `maxInlineBytes`, leave it unchanged.
|
||||
4. If it is larger, call `ctx.spillStore.saveText()` with the full final text.
|
||||
5. Replace the model-facing result with a retained head/tail preview plus the spill reference.
|
||||
|
||||
The preview is an implementation default owned by the policy: a head/tail split of `maxInlineBytes` via the retention library's `TextRetainer`. Future config can expose preview sizing only after a second deployment needs it.
|
||||
|
||||
The replacement text is intentionally generic because the policy only knows the final formatted tool result, not the tool's internal resource:
|
||||
|
||||
```text
|
||||
<retained preview>
|
||||
|
||||
(Omitted N bytes. Full formatted result stored at: /.../session-.../....txt. Use read with offset/limit, or grep this path to search within it.)
|
||||
```
|
||||
|
||||
If `ctx.spillStore.saveText()` fails (permissions, ENOSPC, backend unavailable), or the call has no session owner, or no backend is loaded, the plugin logs the reason and returns the original result unchanged. Spill failure never turns a successful tool call into an `isError` result or hides the inline result.
|
||||
|
||||
The policy skips `read` to avoid a circular `read -> spill file -> read again` loop. Additional opt-out configuration is deferred until a real second tool needs it.
|
||||
`dsh-spill-policy` retains ordered text/image ends under `maxInlineTokens` after post-execute policy accepts the result. `saveText()` stores the complete result with readable image paths; image bytes remain in attachment storage. The [multimodal retention decision](../../implemented/bug-fix/2026-09-21-multimodal-tool-result-retention.md) owns image projection order, atomic image omission, and route pricing. An omitted budget installs no listeners, recovery failures keep the original result, and model-facing `read` results skip retention to avoid a read/spill loop.
|
||||
|
||||
## Showcase: web_fetch
|
||||
|
||||
@@ -129,7 +100,7 @@ With `dsh-spill-policy` configured, a large formatted fetch result is automatica
|
||||
- id: spill-policy
|
||||
name: '@deepseek-ai/dsh-spill-policy'
|
||||
config:
|
||||
maxInlineBytes: 50000
|
||||
maxInlineTokens: 12500
|
||||
```
|
||||
|
||||
This separation is important. `web-fetch-http` still owns resource caps (`maxResponseBytes`, `maxBodyChars`) to protect network, memory, and decoding work. `spill-policy` owns only the model-facing context cap after the result already exists. If the provider already returned `truncated: true`, the spill file contains the full formatted result the tool returned, not the full original webpage; the policy does not claim otherwise.
|
||||
@@ -186,11 +157,11 @@ The local-backend value proposition depends on the existing `read`/`grep` tools
|
||||
|
||||
**Snapshot gap.** No ACP snapshot scenario covers the transcript-visible `web_fetch` spill notice yet. The ACP snapshot harness replays keyless and cannot hit the live web, and a `web_fetch` spill requires a real over-cap HTTP body; a deterministic scenario would need a seeded loopback fetch target the replay tree does not currently wire (the examples do not load `tool-web` at all). The behavior is covered instead by the `dsh-tool-web` integration test against a loopback server. Closing the gap is follow-up work: wire `tool-web` + a seeded fetch target into the ACP example, then record a `web-fetch-spill` scenario.
|
||||
|
||||
The policy can become too large if it starts owning tool-specific semantics. It stays narrow: plain-text final results only. Tool-owned early spill remains future work.
|
||||
The policy can become too large if it starts owning tool-specific semantics. It handles accepted text/image sequences without interpreting tool-specific text. Tool-owned early spill remains future work.
|
||||
|
||||
## Alternatives considered
|
||||
|
||||
**Require each tool to opt in with a retention declaration.** Rejected: the goal is a default behavior similar to Claude Code's generic tool-result persistence. A single `maxInlineBytes` deployment knob is enough to prove the shape.
|
||||
**Require each tool to opt in with a retention declaration.** Rejected: the goal is a default behavior similar to Claude Code's generic tool-result persistence. A single `maxInlineTokens` deployment knob is enough to prove the shape.
|
||||
|
||||
**Make `tool-results` a broad tool-result platform.** Rejected: a broad package name invites retention policy, result replacement, preview wording, search, and early spill into one seam. The shared storage part is smaller: save text and return a locator plus retrieval hint.
|
||||
|
||||
|
||||
@@ -66,36 +66,7 @@ interface SpillRef {
|
||||
|
||||
### spill 策略
|
||||
|
||||
`dsh-spill-policy` 是一个 `tools/post-execute` 结果转换器,只提供一个配置项:
|
||||
|
||||
```ts ignore-check
|
||||
interface Config {
|
||||
/** Omitted means no automatic spill policy. Present means apply to oversized plain text tool results. */
|
||||
maxInlineBytes?: number
|
||||
}
|
||||
```
|
||||
|
||||
省略 `maxInlineBytes` 时,插件不会注册任何内容,是真正的无操作。设置该值后,它会对最终的纯文本工具结果应用默认策略:
|
||||
|
||||
1. 让工具正常运行,通过 `next()` 委托,使下游监听器先结算结果。
|
||||
2. 仅当已接受的最终 `ContentBlock[]` 全部是纯文本时,才将其展平;含任何非文本块的结果保持不变。
|
||||
3. 如果 UTF-8 字节大小不超过 `maxInlineBytes`,保持不变。
|
||||
4. 如果超出上限,使用完整的最终文本调用 `ctx.spillStore.saveText()`。
|
||||
5. 把模型可见结果替换为保留的首尾预览和 spill 引用。
|
||||
|
||||
预览属于策略所有的实现默认值:以 `maxInlineBytes` 为上限,使用保留库的 `TextRetainer` 进行首尾分割。只有第二个部署证明有此需求后,未来配置才会公开预览大小。
|
||||
|
||||
替换文本刻意保持通用,因为策略只知道最终格式化的工具结果,不了解工具的内部资源:
|
||||
|
||||
```text
|
||||
<retained preview>
|
||||
|
||||
(Omitted N bytes. Full formatted result stored at: /.../session-.../....txt. Use read with offset/limit, or grep this path to search within it.)
|
||||
```
|
||||
|
||||
如果 `ctx.spillStore.saveText()` 失败(权限、ENOSPC、后端不可用),或调用没有会话所有者,或未加载后端,插件会记录原因并原样返回结果。spill 失败绝不会把成功的工具调用变为 `isError` 结果,也不会隐藏内联结果。
|
||||
|
||||
策略跳过 `read`,以避免形成 `read -> spill file -> read again` 循环。额外的选择退出配置要等确实出现第二个有此需求的工具后再引入。
|
||||
`dsh-spill-policy` 在执行后策略接受结果之后,按 `maxInlineTokens` 对文字和图片共同计量并保留首尾。完整结果仍通过 `saveText()` 保存,图片本体留在附件存储,结果文件记录可读取路径。图片投影顺序、整图省略和模型计量由[图文结果保留决策](../../implemented/bug-fix/2026-09-21-multimodal-tool-result-retention.zh.md)负责。省略配置时不安装监听器,存储失败时保留原结果;`read` 的模型可见结果跳过自动省略,避免重复读取产生循环。
|
||||
|
||||
## 示例:web_fetch
|
||||
|
||||
@@ -129,7 +100,7 @@ ctx.tools.register(defineTool({
|
||||
- id: spill-policy
|
||||
name: '@deepseek-ai/dsh-spill-policy'
|
||||
config:
|
||||
maxInlineBytes: 50000
|
||||
maxInlineTokens: 12500
|
||||
```
|
||||
|
||||
这项分离很重要。`web-fetch-http` 仍负责资源上限(`maxResponseBytes`、`maxBodyChars`),用来保护网络、内存和解码工作。`spill-policy` 只负责结果已经存在后针对模型上下文的上限。如果提供方已经返回 `truncated: true`,spill 文件包含的是工具返回的完整格式化结果,而不是原始网页全文;策略不会做出其他承诺。
|
||||
@@ -186,11 +157,11 @@ ctx.tools.register(defineTool({
|
||||
|
||||
**快照缺口。** 目前没有 ACP 快照场景覆盖 transcript(文本记录)可见的 `web_fetch` spill 提示。ACP 快照 harness 在无密钥环境中回放,无法访问实时 web,而 `web_fetch` spill 需要一个真实的超上限 HTTP 正文;确定性场景需要一个预置的 loopback fetch 目标,但当前回放树尚未接线(示例根本没有加载 `tool-web`)。该行为改由 `dsh-tool-web` 针对 loopback server 的集成测试覆盖。弥补该缺口属于后续工作:把 `tool-web` 和预置 fetch 目标接入 ACP 示例,然后录制 `web-fetch-spill` 场景。
|
||||
|
||||
如果策略开始负责工具专用语义,就会膨胀得过大。它的范围保持狭窄:只处理纯文本最终结果。由工具负责的提前 spill 仍留作未来工作。
|
||||
如果策略开始负责工具专用语义,就会膨胀得过大。它处理已接受的图文序列,不解释工具专用的文字语义。由工具负责的提前 spill 仍留作未来工作。
|
||||
|
||||
## 考虑过的替代方案
|
||||
|
||||
**要求每个工具通过保留声明选择加入。**不予采纳,因为目标是实现类似 Claude Code 通用工具结果持久化的默认行为。只需一个 `maxInlineBytes` 部署配置项即可验证该形态。
|
||||
**要求每个工具通过保留声明选择加入。**不予采纳,因为目标是实现类似 Claude Code 通用工具结果持久化的默认行为。只需一个 `maxInlineTokens` 部署配置项即可验证该形态。
|
||||
|
||||
**把 `tool-results` 建成宽泛的工具结果平台。** 不予采纳:宽泛的包名会诱使系统把保留策略、结果替换、预览措辞、搜索和提前 spill 合并进一个 seam。可共享的存储部分更小:保存文本,并返回定位符与检索提示。
|
||||
|
||||
|
||||
@@ -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-09-21-multimodal-tool-result-retention.md
|
||||
2026-09-21-multimodal-tool-result-retention.md: 41470724911d3086878d206f82c76ad9a4993146
|
||||
2026-09-21-multimodal-tool-result-retention.zh.md: 8e6d4953f7380d45235ac13f9f245e2e005f1abf
|
||||
@@ -0,0 +1,31 @@
|
||||
# Agent Note: Multimodal tool-result retention
|
||||
|
||||
Status: implemented
|
||||
|
||||
English | [中文](2026-09-21-multimodal-tool-result-retention.zh.md)
|
||||
|
||||
## Problem
|
||||
|
||||
MCP prepares durable images asynchronously while its pure renderer emits text placeholders. Installing prepared content after post-execute policy makes text retention invalidate image replacement. A byte-only limit also cannot compare text with visual input costs.
|
||||
|
||||
## Decision
|
||||
|
||||
`ToolDefinition.projectContent` installs execution-prepared content before post-execute policy. The final callback retains its separate role for terminal and job limits. Policy blocks and replacements remain authoritative.
|
||||
|
||||
The spill policy prices ordered text/image blocks in estimated tokens, reusing the text estimator and the active route image calculator, including descriptor text. It reserves omission notices, divides remaining tokens between contiguous ends, and omits the middle. Text can split between code points; images remain indivisible at their original positions.
|
||||
|
||||
The complete spill file contains accepted text and readable attachment paths in order. Attachments own image bytes. Missing image pricing or a readable recovery path preserves the original result with a diagnostic. PTC program values remain complete; forwarding and logs retain a recovery notice even when every image is omitted.
|
||||
|
||||
The [spill storage decision](../architecture/2026-07-08-tool-output-spill-files.md) still owns backend separation and secure local files. The [MCP client decision](../feature/2026-07-07-mcp-client-plugin.md) still owns canonical values and image admission.
|
||||
|
||||
## Alternatives considered
|
||||
|
||||
**Restore images after policy edits.** This can resurrect blocked images or discarded text. Preparing content before policy lets transformations inspect the actual images.
|
||||
|
||||
**Keep images outside the budget or charge a fixed maximum.** Images must share the result budget with text. The existing route calculator already prices projected dimensions and descriptor text, so it owns that cost.
|
||||
|
||||
**Embed image bytes in spill text.** Base64 inflates the artifact and duplicates attachment storage. Readable attachment paths preserve retrieval and ordering without copying bytes.
|
||||
|
||||
## Consequences
|
||||
|
||||
The shipped result budget is 12,500 estimated tokens, replacing the former 50,000-byte setting. Text estimation remains heuristic; provider usage is authoritative. Unused space at an image boundary stays unused to preserve contiguous ends. Other block types pass through.
|
||||
@@ -0,0 +1,31 @@
|
||||
# Agent Note: 工具结果的图文保留
|
||||
|
||||
Status: implemented
|
||||
|
||||
[English](2026-09-21-multimodal-tool-result-retention.md) | 中文
|
||||
|
||||
## Problem
|
||||
|
||||
MCP 异步准备持久化图片,而纯渲染器输出文字占位。在执行后策略完成后才安装已准备内容,会让文字保留使图片替换失效。按字节限制也无法比较文字与视觉输入的成本。
|
||||
|
||||
## Decision
|
||||
|
||||
`ToolDefinition.projectContent` 在执行后策略之前安装执行期间准备的内容。最终回调保留其对终端和任务结果设定上限的独立职责。策略阻止和替换仍然生效。
|
||||
|
||||
spill 策略以估算 token 对有序图文块计量,复用文字估算和当前模型图片计算器,并计入说明文字。它预留省略提示,将剩余 token 平分给连续两端,省略中间。文字可在码点之间切分;图片不可切分,并保持原位置。
|
||||
|
||||
完整结果文件按顺序保存已接受文字和可读取的附件路径。附件拥有图片字节。缺少图片计量或可读取的恢复路径时,保留原结果并记录诊断。PTC 程序返回值保持完整;全部图片被省略时,转发内容和日志仍保留读取提示。
|
||||
|
||||
[spill 存储决策](../architecture/2026-07-08-tool-output-spill-files.zh.md)继续负责后端拆分和安全的本地文件。[MCP 客户端决策](../feature/2026-07-07-mcp-client-plugin.zh.md)继续负责规范值和图片准入。
|
||||
|
||||
## Alternatives considered
|
||||
|
||||
**在策略修改后恢复图片。** 这可能恢复已阻止图片或已丢弃文字。在策略之前准备内容,让转换能够检查真实图片。
|
||||
|
||||
**图片不计入预算或按固定上限计费。** 图片必须与文字共享结果预算。现有模型计算器已经衡量请求尺寸和说明文字,因此由它负责成本。
|
||||
|
||||
**把图片字节嵌入 spill 文本。** Base64 会增大产物并重复附件存储。可读取的附件路径在不复制字节的情况下保留读取方式和顺序。
|
||||
|
||||
## Consequences
|
||||
|
||||
随产品提供的结果预算为 12,500 个估算 token,替代此前的 50,000 字节配置。文字计量仍为估算,提供方用量具有权威性。图片分界处剩余空间保持空闲,以维持连续的首尾内容。其他内容块类型原样通过。
|
||||
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write .agents/notes/implemented/feature/2026-07-07-mcp-client-plugin.md
|
||||
2026-07-07-mcp-client-plugin.md: a4aa2cf216d9f28afedebf82f0659db70606bbf1
|
||||
2026-07-07-mcp-client-plugin.zh.md: 5903e4ef976317602527d9f335d640bc86939f72
|
||||
2026-07-07-mcp-client-plugin.md: dd793b67bf2043fa88377d50837df40faadf3fbf
|
||||
2026-07-07-mcp-client-plugin.zh.md: 5056118df0185f1e7ec2b1ea06818ed920d2af26
|
||||
@@ -145,7 +145,7 @@ A unified `execute` handler for all tools from one MCP server:
|
||||
1. Call the SDK's `callTool` with the closed-over `rawName`, model arguments, `exec.signal`, the configured timeout, and the complete discovered `toolDefinition` — the public name is never sent to the server.
|
||||
2. Preserve canonical success as `{ content: JsonValue[], structuredContent? }`; complete MCP JSON blocks remain the programmatic/PTC mode value. `isError: true` throws before any image persistence so the registry owns the failure path.
|
||||
3. Prepare a separate ordered Native projection. Text runs join with `'\n'`; resource links preserve name and URI as text; audio and embedded resources become explicit diagnostics. The SDK rejects malformed wire results. If any image exists, the bridge strictly decodes the complete batch, resolves the calling agent's latest exact route, requires an attachment store plus explicit model image input, and delegates all-member validation and ordered persistence to `AttachmentStore.saveImages()`. Any decode, capability, or storage refusal renders every image as diagnostic text and returns no partial references.
|
||||
4. Keep `output.render` synchronous and pure. The executor stages its richer projection in a generation-local `WeakMap` keyed by the exact execution; `finalizeContent` installs it only when the registry's post-execute result still has the original canonical value and fallback content. A policy block, value replacement, or content replacement remains authoritative, and a re-sync cannot let an older generation consume new execution state.
|
||||
4. The executor preserves the complete canonical MCP value and prepares ordered text/image content. `projectContent` installs that content before `tools/post-execute`, so retention sees real images. Subsequent content replacement, value replacement, and blocking remain authoritative.
|
||||
5. PTC mode receives the untouched canonical value. Its generic dispatch bridge defers a successful final content sequence containing an image through the outer `run_code` result, so MCP requires no private parent-token special case.
|
||||
6. Cancellation: `exec.signal` (from the agent loop's cancel) is passed through to the MCP SDK's `callTool`, exact-model lookup, and the pre-storage gate.
|
||||
|
||||
@@ -157,6 +157,8 @@ Build the child environment from the subprocess seam's shared `scrubbedParentEnv
|
||||
|
||||
A per-instance connection supervisor reconnects automatically after a lost connection with bounded exponential backoff and a per-outage attempt budget, re-running discovery on success; exhaustion unregisters the server's tools and stops until reload. The [auto-reconnect Agent Note](../../archived/feature/2026-08-06-mcp-client-auto-reconnect.md) owns that decision, including the `reconnect` config block and the `reconnect.enabled: false` opt-out that restores manual HMR/restart recovery.
|
||||
|
||||
The [multimodal retention decision](../../implemented/bug-fix/2026-09-21-multimodal-tool-result-retention.md) explains why prepared images enter content before result policies.
|
||||
|
||||
## Alternatives considered
|
||||
|
||||
### MCP Server side (expose harness tools to external MCP clients)
|
||||
|
||||
@@ -145,7 +145,7 @@ SDK 接受符合协议的工具,并执行现代 HTTP header 声明检查。注
|
||||
1. 调用 SDK 的 `callTool`,传入闭包持有的 `rawName`、模型参数、`exec.signal`、配置的超时时间与完整的已发现 `toolDefinition`——公开名称永远不发送给服务器。
|
||||
2. 把规范成功值保留为 `{ content: JsonValue[], structuredContent? }`;完整 MCP JSON 块仍是程序化调用/PTC mode 值。`isError: true` 会在持久化任何图片前抛出,使失败路径归注册表所有。
|
||||
3. 另行准备有序 Native 投影。连续文本块以 `'\n'` 连接;资源链接以文本保留名称和 URI;音频和嵌入资源成为明确诊断。SDK 拒绝格式错误的协议结果。只要存在图片,桥接层就严格解码完整批次,解析调用 agent 的最新确切路由,要求附件存储以及模型明确支持图片输入,再把全成员校验和有序持久化委托给 `AttachmentStore.saveImages()`。任何解码、能力或存储拒绝都会把全部图片渲染为诊断文本,且不返回部分引用。
|
||||
4. 保持 `output.render` 同步且纯净。执行器把更丰富的投影暂存在按同步世代创建、以确切执行为键的 `WeakMap` 中;只有注册表的 post-execute 结果仍保留原规范值和兜底内容时,`finalizeContent` 才安装该投影。策略阻止、值替换或内容替换仍具有权威性,重新同步也无法让旧世代消费新执行状态。
|
||||
4. 执行器保留完整的规范 MCP 返回值,并准备有序图文内容。`projectContent` 在 `tools/post-execute` 之前安装已准备的内容,让省略策略看到真实图片块。后续策略的内容替换、值替换和阻止均保持生效。
|
||||
5. PTC mode 接收未改动的规范值。其通用分发桥接层会把包含图片的成功最终内容序列经外层 `run_code` 结果延后,因此 MCP 无需私有父 token 特例。
|
||||
6. 取消:`exec.signal`(来自 agent loop 的取消)透传给 MCP SDK 的 `callTool`、确切模型查询和存储前门禁。
|
||||
|
||||
@@ -157,6 +157,8 @@ SDK 接受符合协议的工具,并执行现代 HTTP header 声明检查。注
|
||||
|
||||
每个实例的连接监督器在连接丢失后以有界指数退避和单次故障尝试预算自动重连,成功后重新执行发现流程;尝试耗尽则注销该服务器的工具并停止,直到重新加载。[自动重连 Agent Note](../../archived/feature/2026-08-06-mcp-client-auto-reconnect.md) 拥有该决策,包括 `reconnect` 配置块和恢复手动 HMR/重启恢复的 `reconnect.enabled: false` opt-out。
|
||||
|
||||
图片在结果策略之前进入内容的原因见[图文结果保留决策](../../implemented/bug-fix/2026-09-21-multimodal-tool-result-retention.zh.md)。
|
||||
|
||||
## 曾考虑的替代方案
|
||||
|
||||
### MCP Server 端(将 harness 工具暴露给外部 MCP 客户端)
|
||||
|
||||
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
@@ -119,6 +119,8 @@ static LRESULT CALLBACK ProgressProc(HWND window, UINT message, WPARAM wparam, L
|
||||
graphics.ScaleTransform(page->dpi / 96.0f, page->dpi / 96.0f);
|
||||
graphics.Clear(page->dark ? Color(255, 21, 21, 23) : Color(255, 255, 255, 255));
|
||||
graphics.SetSmoothingMode(SmoothingModeAntiAlias);
|
||||
graphics.SetInterpolationMode(InterpolationModeHighQualityBicubic);
|
||||
graphics.SetPixelOffsetMode(PixelOffsetModeHalf);
|
||||
graphics.DrawImage(page->brand, Rect(0, 174, 600, 196));
|
||||
const int stage = static_cast<int>(reinterpret_cast<INT_PTR>(GetPropW(GetParent(window), L"HarnessInstaller.Stage")));
|
||||
const double fraction = reinterpret_cast<UINT_PTR>(GetPropW(GetParent(window), L"HarnessInstaller.ExtractProgress")) / 100.0;
|
||||
|
||||
|
Before Width: | Height: | Size: 325 KiB After Width: | Height: | Size: 126 KiB |
@@ -1,8 +1,8 @@
|
||||
<svg width="1024" height="1024" viewBox="0 0 1024 1024" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g transform="translate(32 32) scale(0.9375) translate(-40 -32)"><g filter="url(#filter0_d_1637_371)">
|
||||
<rect rx="44" width="1024" height="1024" transform="translate(40 32)" fill="#FBFBFB"/>
|
||||
<rect rx="44" width="1024" height="1024" transform="translate(40 32)" fill="url(#paint0_linear_1637_371)" fill-opacity="0.4"/>
|
||||
<rect rx="44" width="1024" height="1024" transform="translate(40 32)" fill="url(#paint1_linear_1637_371)" fill-opacity="0.8"/>
|
||||
<rect rx="192" width="1024" height="1024" transform="translate(40 32)" fill="#FBFBFB"/>
|
||||
<rect rx="192" width="1024" height="1024" transform="translate(40 32)" fill="url(#paint0_linear_1637_371)" fill-opacity="0.4"/>
|
||||
<rect rx="192" width="1024" height="1024" transform="translate(40 32)" fill="url(#paint1_linear_1637_371)" fill-opacity="0.8"/>
|
||||
<g filter="url(#filter1_ddi_1637_371)">
|
||||
<path d="M968.002 326.025C959.5 321.85 955.842 329.804 950.865 333.835C949.162 335.143 947.722 336.834 946.283 338.393C933.859 351.673 919.336 360.407 900.376 359.363C872.649 357.804 848.963 366.525 828.035 387.759C823.586 361.583 808.812 345.951 786.313 335.936C774.536 330.729 762.64 325.51 754.401 314.186C748.645 306.112 747.074 297.127 744.195 288.274C742.36 282.936 740.538 277.465 734.385 276.554C727.718 275.51 725.103 281.112 722.476 285.803C712.006 304.95 707.952 326.039 708.349 347.405C709.26 395.463 729.54 433.742 769.823 460.962C774.404 464.094 775.579 467.212 774.14 471.771C771.394 481.153 768.119 490.257 765.241 499.639C763.406 505.624 760.66 506.933 754.256 504.329C732.154 495.08 713.049 481.417 696.175 464.874C667.524 437.138 641.633 406.536 609.325 382.566C601.733 376.964 594.154 371.758 586.298 366.802C553.33 334.773 590.616 308.464 599.251 305.333C608.282 302.082 602.393 290.877 573.214 291.009C544.048 291.141 517.364 300.906 483.353 313.935C478.389 315.891 473.147 317.318 467.786 318.494C436.917 312.64 404.873 311.332 371.377 315.111C308.332 322.141 257.975 351.964 220.953 402.876C176.471 464.081 166.014 533.624 178.835 606.153C192.302 682.594 231.291 745.887 291.194 795.372C353.328 846.68 424.876 871.813 506.498 866.99C556.076 864.122 611.279 857.489 673.532 804.74C689.23 812.55 705.708 815.681 733.052 818.02C754.111 819.976 774.391 816.976 790.076 813.726C814.674 808.519 812.971 785.726 804.072 781.564C731.995 747.962 747.826 761.638 733.435 750.565C770.06 707.198 825.263 662.139 846.85 516.156C848.553 504.567 847.114 497.273 846.85 487.892C846.718 482.157 848.025 479.95 854.574 479.303C872.623 477.215 890.156 472.273 906.238 463.42C952.938 437.892 971.765 395.965 976.215 345.7C976.875 338.01 976.083 330.069 967.976 326.039L968.002 326.025ZM561.067 778.432C491.222 723.477 457.343 705.374 443.347 706.154C430.263 706.933 432.626 721.918 435.505 731.682C438.515 741.315 442.436 747.962 447.929 756.418C451.718 762.021 454.346 770.345 444.14 776.609C421.641 790.549 382.533 771.918 380.698 771.006C335.174 744.182 297.109 708.757 270.293 660.316C244.389 613.698 229.35 563.685 226.868 510.302C226.208 497.406 230.01 492.847 242.831 490.508C259.704 487.376 277.106 486.729 293.98 489.2C365.264 499.625 425.959 531.523 476.844 582.052C505.878 610.831 527.861 645.213 550.491 678.815C574.561 714.492 600.452 748.49 633.42 776.358C645.066 786.122 654.348 793.548 663.247 799.019C636.431 802.018 591.698 802.666 561.08 778.445L561.067 778.432ZM594.55 562.905C594.55 557.171 599.132 552.625 604.888 552.625C606.195 552.625 607.371 552.876 608.414 553.273C609.853 553.801 611.16 554.581 612.203 555.744C614.038 557.567 615.081 560.17 615.081 562.905C615.081 568.64 610.5 573.185 604.743 573.185C598.987 573.185 594.537 568.627 594.537 562.905H594.55ZM698.539 616.301C691.871 619.037 685.19 621.375 678.787 621.64C668.845 622.155 657.992 618.125 652.103 613.17C642.953 605.479 636.404 601.185 633.658 587.773C632.483 582.039 633.13 573.185 634.186 568.111C636.536 557.171 633.922 550.141 626.212 543.759C619.927 538.553 611.952 537.112 603.185 537.112C599.911 537.112 596.914 535.685 594.682 534.509C591.025 532.686 588.015 528.127 590.893 522.525C591.804 520.701 596.254 516.275 597.297 515.495C609.206 508.716 622.937 510.936 635.625 516.01C647.403 520.833 656.288 529.686 669.109 542.186C682.193 557.289 684.543 561.465 692.003 572.789C697.892 581.642 703.252 590.759 706.909 601.185C709.128 607.699 706.249 613.038 698.539 616.288V616.301Z" fill="url(#paint2_linear_1637_371)" fill-opacity="0.9"/>
|
||||
</g>
|
||||
|
||||
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
@@ -3,6 +3,8 @@
|
||||
export const en = {
|
||||
application: 'Application',
|
||||
aboutMenu: 'About DeepSeek Harness',
|
||||
aboutProduct: 'DeepSeek Harness',
|
||||
aboutVersion: 'Version V{version}',
|
||||
hideApplication: 'Hide DeepSeek Harness',
|
||||
hideOtherApplications: 'Hide Others',
|
||||
showAllApplications: 'Show All',
|
||||
@@ -88,7 +90,7 @@ export const en = {
|
||||
updateTechnicalDetails: 'View technical details',
|
||||
updateTitle: 'DeepSeek Harness Update',
|
||||
updateAvailable: 'An update is available',
|
||||
updateDetail: 'DeepSeek Harness {version}\n\nThis release includes its matching dsh version. The application will restart after installation.',
|
||||
updateDetail: 'DeepSeek Harness {version}\n\nDeepSeek Harness will restart to complete the update.',
|
||||
installAndRestart: 'Install and Restart',
|
||||
later: 'Later',
|
||||
updateFailedTitle: 'Update Failed',
|
||||
@@ -130,6 +132,8 @@ export type DesktopMessages = { readonly [Key in keyof typeof en]: string }
|
||||
export const zh = {
|
||||
application: '应用',
|
||||
aboutMenu: '关于 DeepSeek Harness',
|
||||
aboutProduct: 'DeepSeek Harness',
|
||||
aboutVersion: '版本 V{version}',
|
||||
hideApplication: '隐藏 DeepSeek Harness',
|
||||
hideOtherApplications: '隐藏其他',
|
||||
showAllApplications: '显示全部',
|
||||
@@ -215,7 +219,7 @@ export const zh = {
|
||||
updateTechnicalDetails: '查看技术详情',
|
||||
updateTitle: 'DeepSeek Harness 更新',
|
||||
updateAvailable: '发现可用更新',
|
||||
updateDetail: 'DeepSeek Harness {version}\n\n新版本绑定匹配的 dsh,安装后将重新启动。',
|
||||
updateDetail: 'DeepSeek Harness {version}\n\nDeepSeek Harness 将重启以完成更新。',
|
||||
installAndRestart: '安装并重启',
|
||||
later: '稍后',
|
||||
updateFailedTitle: '更新失败',
|
||||
|
||||
@@ -276,6 +276,13 @@ async function main(): Promise<void> {
|
||||
}
|
||||
finally { ordinaryDialogs.delete(controller) }
|
||||
}
|
||||
// Copy comes from the same locale as the update prompts so the dialog
|
||||
// chrome and its content never mix languages.
|
||||
const showAbout = async (): Promise<void> => {
|
||||
await ordinaryMessageBox({ type: 'info', title: locale.messages.aboutMenu, message: locale.messages.aboutProduct,
|
||||
detail: formatDesktopMessage(locale.messages.aboutVersion, { version: app.getVersion() }),
|
||||
buttons: [locale.messages.updateAcknowledge], cancelId: 0 })
|
||||
}
|
||||
const appPreload = fileURLToPath(new URL('./preload-app.cjs', import.meta.url))
|
||||
const applicationUrl = `${SCHEME}://app/`
|
||||
let hostUrl: string | undefined
|
||||
@@ -753,7 +760,12 @@ async function main(): Promise<void> {
|
||||
{ role: 'unhide', label: currentDesktopLocale().messages.showAllApplications }, { type: 'separator' }]
|
||||
: []
|
||||
const applicationItems = (): MenuItemConstructorOptions[] => [
|
||||
{ label: currentDesktopLocale().messages.aboutMenu, role: 'about' },
|
||||
// Windows has no system About panel; Electron's fallback is a plain
|
||||
// message box, so the shell shows its own dimmed dialog instead.
|
||||
process.platform === 'win32'
|
||||
? { label: currentDesktopLocale().messages.aboutMenu,
|
||||
click: () => { void showAbout().catch((error: unknown) => { console.error(error) }) } }
|
||||
: { label: currentDesktopLocale().messages.aboutMenu, role: 'about' },
|
||||
{ type: 'separator' },
|
||||
{ label: currentDesktopLocale().messages.checkUpdatesMenu, click: () => { void openUpdatePrompt(true) } },
|
||||
...development ? [
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"en-US": {
|
||||
"darwin:en-US": {
|
||||
"menu": [
|
||||
{ "label": "About DeepSeek Harness", "role": "about" },
|
||||
{ "type": "separator" }
|
||||
@@ -12,7 +12,7 @@
|
||||
"iconPath": "<app icon>"
|
||||
}
|
||||
},
|
||||
"zh-CN": {
|
||||
"darwin:zh-CN": {
|
||||
"menu": [
|
||||
{ "label": "关于 DeepSeek Harness", "role": "about" },
|
||||
{ "type": "separator" }
|
||||
@@ -24,5 +24,31 @@
|
||||
"copyright": "",
|
||||
"iconPath": "<app icon>"
|
||||
}
|
||||
},
|
||||
"win32:zh-CN": {
|
||||
"menu": [
|
||||
{ "label": "关于 DeepSeek Harness" },
|
||||
{ "type": "separator" }
|
||||
],
|
||||
"options": {
|
||||
"applicationName": "DeepSeek Harness",
|
||||
"applicationVersion": "1.0.0",
|
||||
"version": "",
|
||||
"copyright": "",
|
||||
"iconPath": "<app icon>"
|
||||
}
|
||||
},
|
||||
"win32:en-US": {
|
||||
"menu": [
|
||||
{ "label": "About DeepSeek Harness" },
|
||||
{ "type": "separator" }
|
||||
],
|
||||
"options": {
|
||||
"applicationName": "DeepSeek Harness",
|
||||
"applicationVersion": "1.0.0",
|
||||
"version": "",
|
||||
"copyright": "",
|
||||
"iconPath": "<app icon>"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -405,7 +405,7 @@ describe('desktop main startup', () => {
|
||||
['darwin', false, 'zh-CN'],
|
||||
['win32', true, 'zh-CN'],
|
||||
['win32', false, 'en-US'],
|
||||
] as const)('offers the native About panel before other commands on %s (packaged=%s, locale=%s)', async (platform, packaged, locale) => {
|
||||
] as const)('offers the About command before other commands on %s (packaged=%s, locale=%s)', async (platform, packaged, locale) => {
|
||||
vi.stubGlobal('process', { ...process, platform })
|
||||
harness.app.isPackaged = packaged
|
||||
vi.spyOn(harness.app, 'getLocale').mockReturnValue(locale)
|
||||
@@ -415,9 +415,26 @@ describe('desktop main startup', () => {
|
||||
const submenu = applicationMenuItems()
|
||||
const options = harness.app.setAboutPanelOptions.mock.calls[0]![0]
|
||||
const expected = JSON.parse(readFileSync(new URL('./expected/about-panel.json', import.meta.url), 'utf8')) as Record<string, unknown>
|
||||
expect({ menu: submenu.slice(0, 2), options: { ...options, iconPath: '<app icon>' } }).toEqual(expected[locale])
|
||||
const [about, separator] = submenu
|
||||
expect({ menu: [{ label: about!.label, role: about!.role }, separator], options: { ...options, iconPath: '<app icon>' } })
|
||||
.toEqual(expected[`${platform}:${locale}`])
|
||||
expect(options.iconPath).toBe(packaged ? join('desktop-test-resources', 'icon.png')
|
||||
: join('desktop-test-app', 'resources', 'icon-windows.png'))
|
||||
if (platform !== 'win32') { expect(about!.click).toBeUndefined(); return }
|
||||
// Windows reuses the dimmed update dialog because Electron's fallback is a bare message box.
|
||||
harness.dialog.showMessageBox.mockResolvedValueOnce({ response: 0 })
|
||||
;(about!.click as () => void)()
|
||||
await vi.advanceTimersByTimeAsync(0)
|
||||
const zh = locale === 'zh-CN'
|
||||
expect(harness.dialog.showMessageBox).toHaveBeenLastCalledWith(expect.objectContaining({
|
||||
type: 'info', title: zh ? '关于 DeepSeek Harness' : 'About DeepSeek Harness', message: 'DeepSeek Harness',
|
||||
detail: zh ? '版本 V1.0.0' : 'Version V1.0.0', buttons: [zh ? '确定' : 'OK'], cancelId: 0,
|
||||
}))
|
||||
// A dialog that cannot open is logged, not surfaced as an unhandled rejection.
|
||||
harness.dialog.showMessageBox.mockRejectedValueOnce(new Error('overlay unavailable'))
|
||||
;(about!.click as () => void)()
|
||||
await vi.advanceTimersByTimeAsync(0)
|
||||
expect(console.error).toHaveBeenLastCalledWith(expect.objectContaining({ message: 'overlay unavailable' }))
|
||||
})
|
||||
|
||||
it('shows one explained startup login before Host readiness and joins concurrent checks without reopening it', async () => {
|
||||
|
||||
@@ -482,6 +482,54 @@ describe('web e2e: a git workspace turn ends with its changed files', () => {
|
||||
expect(tripwire.warnings).toEqual([])
|
||||
})
|
||||
|
||||
it.skipIf(MODE === 'record')('keeps the file menu aligned while dragging the floating review', async () => {
|
||||
const column = page.locator('[data-rightbar-col]')
|
||||
const tab = column.locator('[data-dockkit-tab]').filter({ hasText: '第 1 轮改动' })
|
||||
const tabBox = await tab.boundingBox()
|
||||
if (tabBox === null) throw new Error('review tab is not rendered')
|
||||
await page.mouse.move(tabBox.x + 6, tabBox.y + tabBox.height / 2)
|
||||
await page.mouse.down()
|
||||
try {
|
||||
await page.mouse.move(360, 140, { steps: 8 })
|
||||
} finally {
|
||||
await page.mouse.up()
|
||||
}
|
||||
const floating = page.locator('[data-dockkit-float]').filter({ has: page.locator('[data-changes-review]') })
|
||||
await floating.waitFor({ state: 'visible' })
|
||||
const selector = floating.getByRole('button', { name: '选择要查看的文件' })
|
||||
await selector.click()
|
||||
const menu = page.getByRole('menu')
|
||||
await menu.waitFor({ state: 'visible' })
|
||||
const grip = floating.locator('[data-dockkit-float-grip]')
|
||||
for (const delta of [{ x: 120, y: 60 }, { x: -60, y: -30 }]) {
|
||||
const handle = await grip.boundingBox()
|
||||
const before = await selector.boundingBox()
|
||||
if (handle === null || before === null) throw new Error('floating review controls are not rendered')
|
||||
const start = { x: handle.x + 12, y: handle.y + handle.height / 2 }
|
||||
await page.mouse.move(start.x, start.y)
|
||||
await page.mouse.down()
|
||||
try {
|
||||
await page.mouse.move(start.x + delta.x, start.y + delta.y, { steps: 8 })
|
||||
await expect.poll(async () => {
|
||||
const anchor = await selector.boundingBox()
|
||||
const list = await menu.boundingBox()
|
||||
if (anchor === null || list === null) throw new Error('review file menu disappeared during drag')
|
||||
return Math.max(
|
||||
Math.abs(anchor.x - before.x - delta.x), Math.abs(anchor.y - before.y - delta.y),
|
||||
Math.abs(list.x - anchor.x), Math.abs(list.y - anchor.y - anchor.height - 4),
|
||||
)
|
||||
}).toBeLessThanOrEqual(1)
|
||||
} finally {
|
||||
await page.mouse.up()
|
||||
}
|
||||
}
|
||||
await page.keyboard.press('Escape')
|
||||
await floating.locator('[data-dockkit-float-dock]').click()
|
||||
await floating.waitFor({ state: 'detached' })
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
expect(tripwire.warnings).toEqual([])
|
||||
})
|
||||
|
||||
it('keeps edge gestures inside either diff column and accepts reverse scrolling', async () => {
|
||||
const review = page.locator('[data-changes-review]')
|
||||
await review.getByRole('button', { name: '自动换行' }).click()
|
||||
|
||||
@@ -73,7 +73,7 @@ describe('web e2e: Desktop update workspace chrome', () => {
|
||||
|
||||
const progress = presentDesktopUpdate({ phase: 'downloading', version, percent: 58 }, en)
|
||||
await publish(progress)
|
||||
const downloading = page.getByRole('button', { name: '58%…', exact: true })
|
||||
const downloading = page.getByRole('button', { name: '58%', exact: true })
|
||||
await downloading.waitFor()
|
||||
expect(await downloading.getAttribute('aria-disabled')).toBe('true')
|
||||
expect(await downloading.locator('svg').count()).toBe(1)
|
||||
@@ -86,20 +86,20 @@ describe('web e2e: Desktop update workspace chrome', () => {
|
||||
const expand = locale === 'zh-CN' ? '打开侧边栏' : 'Open sidebar'
|
||||
await page.getByRole('button', { name: collapse, exact: true }).click()
|
||||
const toggle = page.getByRole('button', { name: expand, exact: true })
|
||||
const badge = toggle.getByRole('img', { name: '58%…', exact: true })
|
||||
const badge = toggle.getByRole('img', { name: '58%', exact: true })
|
||||
await badge.waitFor()
|
||||
await expect.poll(() => downloading.count()).toBe(0)
|
||||
expect(await page.getByRole('img', { name: '58%…', exact: true }).count()).toBe(1)
|
||||
const blue = await badge.evaluate(element => getComputedStyle(element).backgroundColor)
|
||||
expect(await page.getByRole('img', { name: '58%', exact: true }).count()).toBe(1)
|
||||
const updateBackground = await badge.evaluate(element => getComputedStyle(element).backgroundColor)
|
||||
await page.screenshot({ path: join(evidence, 'collapsed.png') })
|
||||
|
||||
const error = presentDesktopUpdate({ phase: 'error', version, failedOperation: 'download', message: 'HTTP 503' }, en)
|
||||
await publish(error)
|
||||
const errorBadge = toggle.getByRole('img', { name: retryLabel, exact: true })
|
||||
await errorBadge.waitFor()
|
||||
expect(await errorBadge.getAttribute('data-error')).toBe('true')
|
||||
const red = await errorBadge.evaluate(element => getComputedStyle(element).backgroundColor)
|
||||
expect(red).not.toBe(blue)
|
||||
// A failure keeps the update palette; only the label distinguishes it.
|
||||
const failedBackground = await errorBadge.evaluate(element => getComputedStyle(element).backgroundColor)
|
||||
expect(failedBackground).toBe(updateBackground)
|
||||
await errorBadge.hover()
|
||||
const tooltip = page.getByRole('tooltip', { name: errorDetail, exact: true })
|
||||
await expect.poll(() => tooltip.evaluateAll(elements => elements.map(element => getComputedStyle(element).opacity))).toEqual(['1'])
|
||||
@@ -132,7 +132,7 @@ describe('web e2e: Desktop update workspace chrome', () => {
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
expect(tripwire.warnings).toEqual([])
|
||||
expect(await page.evaluate(() => (window as FixtureWindow).updateFixture.listeners.size)).toBe(1)
|
||||
await writeFile(join(evidence, 'result.json'), JSON.stringify({ locale, geometry, blue, red,
|
||||
await writeFile(join(evidence, 'result.json'), JSON.stringify({ locale, geometry, updateBackground, failedBackground,
|
||||
passed: true, explicitActions: 3, carrier: 'substituted', host: 'real Web composition',
|
||||
electron: false, installerExecuted: false }, null, 2) + '\n')
|
||||
console.log(`Desktop workspace chrome evidence: ${evidence}`)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
- banner:
|
||||
- navigation "Session hierarchy": /user-invoke-demo @"meeting notes.md" an
|
||||
- navigation "Session hierarchy": /user-invoke-demo @"meeting notes-this-i
|
||||
- text: Standard mode
|
||||
- button "More actions"
|
||||
- button "Open right sidebar"
|
||||
@@ -7,7 +7,7 @@
|
||||
- tab "Chat" [selected]
|
||||
- tab "Trajectory"
|
||||
- button "/user-invoke-demo"
|
||||
- button "meeting notes.md"
|
||||
- button "meeting notes-this-is-a-very-long-filename-for-testing-user-message-file-references-and-preview-layout.md"
|
||||
- text: and confirm the fixture wiring {{clock}}
|
||||
- button "Copy"
|
||||
- status: Worked
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
- banner:
|
||||
- navigation "Session hierarchy": /user-invoke-demo @"meeting notes.md" an
|
||||
- navigation "Session hierarchy": /user-invoke-demo @"meeting notes-this-i
|
||||
- text: Standard mode
|
||||
- button "More actions"
|
||||
- button "Open right sidebar"
|
||||
@@ -7,7 +7,7 @@
|
||||
- tab "Chat" [selected]
|
||||
- tab "Trajectory"
|
||||
- button "/user-invoke-demo"
|
||||
- button "meeting notes.md"
|
||||
- button "meeting notes-this-is-a-very-long-filename-for-testing-user-message-file-references-and-preview-layout.md"
|
||||
- text: and confirm the fixture wiring {{clock}}
|
||||
- button "Copy"
|
||||
- status: Worked
|
||||
|
||||
@@ -34,6 +34,10 @@ const MODE = webSnapshotMode()
|
||||
const ACTIVE_PROMPT = 'Reply with a one-sentence description of event sourcing, then stop.'
|
||||
const REMOVE = 'Queue item to remove'
|
||||
const EDIT = 'Queue item to edit'
|
||||
// The edited value is deliberately multi-line: the inline editor must keep the
|
||||
// line breaks through the queue mutation and into the model-bound user message.
|
||||
const EDITED_CONTENT = 'Edited\nqueue item'
|
||||
// The dock preview flattens the queued text, so row locators match this form.
|
||||
const EDITED = 'Edited queue item'
|
||||
const TAIL = 'Queue item preserved after stop'
|
||||
const WAKE = 'Wake the preserved queue'
|
||||
@@ -187,7 +191,7 @@ describe('web e2e: queue row actions', () => {
|
||||
const editRow = page.locator('[data-queue-dock] li', { hasText: EDIT })
|
||||
await editRow.getByRole('button', { name: 'Edit queued message' }).click()
|
||||
const editor = page.getByRole('textbox', { name: 'Edit queued message' })
|
||||
await editor.fill(EDITED)
|
||||
await editor.fill(EDITED_CONTENT)
|
||||
const save = page.getByRole('button', { name: 'Save queued message' })
|
||||
await save.hover()
|
||||
const saveTooltip = page.getByRole('tooltip', { name: 'Save queued message', exact: true })
|
||||
@@ -308,7 +312,7 @@ describe('web e2e: queue row actions', () => {
|
||||
.toEqual(['aborted', 'completed', 'completed', 'completed'])
|
||||
expect(sessionEvents.flatMap(event => event.type === 'user/message' && event.data.source.kind === 'user'
|
||||
? event.data.content.flatMap(block => block.type === 'text' ? [block.text] : [])
|
||||
: [])).toEqual([ACTIVE_PROMPT, EDITED, TAIL, WAKE])
|
||||
: [])).toEqual([ACTIVE_PROMPT, EDITED_CONTENT, TAIL, WAKE])
|
||||
await expect.poll(() => page.locator('[data-queue-dock]').count()).toBe(0)
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
expect(tripwire.warnings).toEqual([])
|
||||
|
||||
@@ -30,7 +30,8 @@ const UI_EXPANDED_EXPECTED = join(SNAPSHOT_DIR, 'ui-expanded.expected.md')
|
||||
const MODE = webSnapshotMode()
|
||||
|
||||
const SKILL_NAME = 'user-invoke-demo'
|
||||
const ARGS_TEXT = '@"meeting notes.md" and confirm the fixture wiring'
|
||||
const FILE_NAME = 'meeting notes-this-is-a-very-long-filename-for-testing-user-message-file-references-and-preview-layout.md'
|
||||
const ARGS_TEXT = `@"${FILE_NAME}" and confirm the fixture wiring`
|
||||
const REPLY = 'USER_INVOKE_REPLY acknowledged; following the injected skill.'
|
||||
|
||||
async function seedUserOnlySkill(workspaceCwd: string): Promise<void> {
|
||||
@@ -78,7 +79,7 @@ describe.skipIf(MODE === 'record')('web e2e: user-explicit skill invocation thro
|
||||
paceMs: 10,
|
||||
})
|
||||
await seedUserOnlySkill(scaffold.workspaceCwd)
|
||||
await writeFile(join(scaffold.workspaceCwd, 'workspace', 'meeting notes.md'), '# Meeting notes\n\nSent reference preview.\n')
|
||||
await writeFile(join(scaffold.workspaceCwd, 'workspace', FILE_NAME), '# Meeting notes\n\nSent reference preview.\n')
|
||||
browser = await chromium.launch()
|
||||
page = await newEnglishPage(browser)
|
||||
tripwire = watchConsole(page)
|
||||
@@ -162,6 +163,19 @@ describe.skipIf(MODE === 'record')('web e2e: user-explicit skill invocation thro
|
||||
await skill.click()
|
||||
await expect.poll(() => preview.textContent(), { timeout: 10_000 }).toContain('Reply with the fixture acknowledgement line.')
|
||||
const file = page.locator('[data-chat-flow-kind="user"] [data-ref-chip="file"]').first()
|
||||
const bounds = await file.evaluate((element) => {
|
||||
const bubble = element.closest('[class*="bubble"]')
|
||||
if (bubble === null) throw new Error('file reference has no user bubble')
|
||||
const label = element.getBoundingClientRect()
|
||||
const container = bubble.getBoundingClientRect()
|
||||
return {
|
||||
left: label.left - container.left, right: container.right - label.right,
|
||||
height: label.height, lineHeight: Number.parseFloat(getComputedStyle(element).lineHeight),
|
||||
}
|
||||
})
|
||||
expect(bounds.left).toBeGreaterThanOrEqual(0)
|
||||
expect(bounds.right).toBeGreaterThanOrEqual(0)
|
||||
expect(bounds.height).toBeGreaterThan(bounds.lineHeight)
|
||||
await file.hover()
|
||||
expect(await file.evaluate(el => getComputedStyle(el).textDecorationStyle)).toBe('dotted')
|
||||
await file.click()
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write docs/config-catalog.md
|
||||
config-catalog.md: 573d16f37b9ce3c123c55c366d8ee6424feb3d64
|
||||
config-catalog.zh.md: 9d827a4c65ec198239d7d1ef29735747a39838b9
|
||||
config-catalog.md: f86f02fbec949c0212c3c038f47d1fdf50d239fe
|
||||
config-catalog.zh.md: d56d5bdef41e76ce7a41e3d582a1a8afde18766b
|
||||
@@ -679,7 +679,7 @@ Requires: `credentials` · `authorization`
|
||||
export interface Config {
|
||||
/** Platform origin serving auth-api and browser pages. */
|
||||
platformOrigin?: string
|
||||
/** Native desktop identity for Host API and embedded Platform requests; null omits the client platform header. */
|
||||
/** Native desktop identity for Host API and embedded Platform requests; null identifies the client as web. */
|
||||
desktopPlatform?: 'darwin' | 'win32' | null
|
||||
/** Optional frontend deployment selector for embedded Usage and Top-up pages. */
|
||||
embeddedPageDist?: string
|
||||
@@ -2781,18 +2781,14 @@ Source: [`packages/spill/spill-local/src/index.ts:31`](../packages/spill/spill-l
|
||||
Requires: `tools`
|
||||
|
||||
```ts config-catalog
|
||||
/** Plugin config. */
|
||||
/** Optional result-retention budget. */
|
||||
export interface Config {
|
||||
/**
|
||||
* The model-facing context cap for a plain-text tool result, in UTF-8 bytes.
|
||||
* Omitted disables the policy entirely (no-op). When set, a result larger than
|
||||
* this is spilled and replaced with a preview derived from this same budget.
|
||||
*/
|
||||
maxInlineBytes?: number
|
||||
/** Maximum estimated tokens in a retained result, including image descriptors and omission notices. Omitted disables retention. */
|
||||
maxInlineTokens?: number
|
||||
}
|
||||
```
|
||||
|
||||
Source: [`packages/spill/spill-policy/src/index.ts:61`](../packages/spill/spill-policy/src/index.ts)
|
||||
Source: [`packages/spill/spill-policy/src/index.ts:25`](../packages/spill/spill-policy/src/index.ts)
|
||||
|
||||
<a id="deepseek-aidsh-ssh"></a>
|
||||
|
||||
@@ -3808,7 +3804,7 @@ export interface Config {
|
||||
export type ToolPresentationMode = 'native' | 'ptc' | 'both'
|
||||
```
|
||||
|
||||
Source: [`packages/core/tools/src/index.ts:663`](../packages/core/tools/src/index.ts)
|
||||
Source: [`packages/core/tools/src/index.ts:673`](../packages/core/tools/src/index.ts)
|
||||
|
||||
<a id="deepseek-aidsh-typert-loader"></a>
|
||||
|
||||
|
||||
@@ -681,7 +681,7 @@ export interface Config {
|
||||
export interface Config {
|
||||
/** Platform origin serving auth-api and browser pages. */
|
||||
platformOrigin?: string
|
||||
/** Native desktop identity for Host API and embedded Platform requests; null omits the client platform header. */
|
||||
/** Native desktop identity for Host API and embedded Platform requests; null identifies the client as web. */
|
||||
desktopPlatform?: 'darwin' | 'win32' | null
|
||||
/** Optional frontend deployment selector for embedded Usage and Top-up pages. */
|
||||
embeddedPageDist?: string
|
||||
@@ -2783,18 +2783,14 @@ export interface Config {
|
||||
需要: `tools`
|
||||
|
||||
```ts config-catalog
|
||||
/** Plugin config. */
|
||||
/** Optional result-retention budget. */
|
||||
export interface Config {
|
||||
/**
|
||||
* The model-facing context cap for a plain-text tool result, in UTF-8 bytes.
|
||||
* Omitted disables the policy entirely (no-op). When set, a result larger than
|
||||
* this is spilled and replaced with a preview derived from this same budget.
|
||||
*/
|
||||
maxInlineBytes?: number
|
||||
/** Maximum estimated tokens in a retained result, including image descriptors and omission notices. Omitted disables retention. */
|
||||
maxInlineTokens?: number
|
||||
}
|
||||
```
|
||||
|
||||
来源: [`packages/spill/spill-policy/src/index.ts:61`](../packages/spill/spill-policy/src/index.ts)
|
||||
来源: [`packages/spill/spill-policy/src/index.ts:25`](../packages/spill/spill-policy/src/index.ts)
|
||||
|
||||
<a id="deepseek-aidsh-ssh"></a>
|
||||
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write docs/module-graph.md
|
||||
module-graph.md: fc5c06727e58705ac6d9b44470b1b37010dc3223
|
||||
module-graph.zh.md: 6911d9820932569c7a666b47a8bd53696fdb6393
|
||||
module-graph.md: bfe3e5faa7168b03848ac76d2dd2584d4aa31f5e
|
||||
module-graph.zh.md: bfa0f83e14cbcf89599fa207ec919195128db49e
|
||||
@@ -806,11 +806,6 @@ flowchart TD
|
||||
pkg_tool_web --> pkg_system_prompt
|
||||
pkg_tool_web --> pkg_tools
|
||||
pkg_tool_web --> pkg_web
|
||||
pkg_spill_policy --> pkg_llm
|
||||
pkg_spill_policy --> pkg_output_retention
|
||||
pkg_spill_policy --> pkg_session
|
||||
pkg_spill_policy --> pkg_spill
|
||||
pkg_spill_policy --> pkg_tools
|
||||
pkg_tool_todo --> pkg_agent
|
||||
pkg_tool_todo --> pkg_invariants
|
||||
pkg_tool_todo --> pkg_session
|
||||
@@ -1101,6 +1096,14 @@ flowchart TD
|
||||
pkg_subagent --> pkg_user_approval
|
||||
pkg_subagent --> pkg_util_time
|
||||
pkg_subagent --> pkg_workspace
|
||||
pkg_spill_policy --> pkg_attachment
|
||||
pkg_spill_policy --> pkg_fs
|
||||
pkg_spill_policy --> pkg_llm
|
||||
pkg_spill_policy --> pkg_output_retention
|
||||
pkg_spill_policy --> pkg_session
|
||||
pkg_spill_policy --> pkg_spill
|
||||
pkg_spill_policy --> pkg_token_meter
|
||||
pkg_spill_policy --> pkg_tools
|
||||
pkg_session_query_sqlite --> pkg_session
|
||||
pkg_session_query_sqlite --> pkg_session_persistence
|
||||
pkg_session_query_sqlite --> pkg_session_query
|
||||
@@ -1566,7 +1569,6 @@ flowchart TD
|
||||
| [`tool-skill`](../packages/skill/tool-skill) | `skill` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`skill`](../packages/skill/skill), [`tools`](../packages/core/tools) |
|
||||
| [`tool-workspace-dependencies`](../packages/skill/tool-workspace-dependencies) | `skill` | [`tools`](../packages/core/tools) |
|
||||
| [`tool-web`](../packages/web/tool-web) | `web` | [`llm`](../packages/llm/llm), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools), [`web`](../packages/web/web) |
|
||||
| [`spill-policy`](../packages/spill/spill-policy) | `spill` | [`llm`](../packages/llm/llm), [`output-retention`](../packages/util/output-retention), [`session`](../packages/core/session), [`spill`](../packages/spill/spill), [`tools`](../packages/core/tools) |
|
||||
| [`tool-todo`](../packages/todo/tool-todo) | `todo` | [`agent`](../packages/core/agent), [`invariants`](../packages/runtime-diagnostics/invariants), [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`tools`](../packages/core/tools) |
|
||||
| [`plan-mode`](../packages/plan/plan-mode) | `plan` | [`agent`](../packages/core/agent), [`commands`](../packages/interaction/commands), [`invariants`](../packages/runtime-diagnostics/invariants), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools), [`user-questions`](../packages/interaction/user-questions) |
|
||||
| [`hooks-codex`](../packages/hooks/hooks-codex) | `hooks` | [`agent`](../packages/core/agent), [`hook-protocol`](../packages/hooks/hook-protocol), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`tools`](../packages/core/tools) |
|
||||
@@ -1619,6 +1621,7 @@ flowchart TD
|
||||
| [`agent-loop-testkit`](../packages/test-support/agent-loop-testkit) | `test-support` | [`agent`](../packages/core/agent), [`agent-loop`](../packages/core/agent-loop), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) |
|
||||
| [`webhook`](../packages/webhook/webhook) | `webhook` | [`agent`](../packages/core/agent), [`agent-default-model`](../packages/core/agent-default-model), [`agent-preset-registry`](../packages/preset/agent-preset-registry), [`invariants`](../packages/runtime-diagnostics/invariants), [`llm`](../packages/llm/llm), [`permission-presets`](../packages/interaction/permission-presets), [`session`](../packages/core/session), [`session-title`](../packages/session/session-title), [`workspace`](../packages/workspace/workspace) |
|
||||
| [`subagent`](../packages/subagent/subagent) | `subagent` | [`agent`](../packages/core/agent), [`agent-preset-registry`](../packages/preset/agent-preset-registry), [`attachment`](../packages/attachment/attachment), [`invariants`](../packages/runtime-diagnostics/invariants), [`jobs`](../packages/jobs/jobs), [`llm`](../packages/llm/llm), [`permission-presets`](../packages/interaction/permission-presets), [`sandbox`](../packages/sandbox/sandbox), [`sandbox-policy`](../packages/sandbox/sandbox-policy), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`session-persistence`](../packages/session/session-persistence), [`session-projection`](../packages/session/session-projection), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-query`](../packages/session-query/session-query), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools), [`typert-protocol`](../packages/typert/protocol), [`user-approval`](../packages/interaction/user-approval), [`util-time`](../packages/util/time), [`workspace`](../packages/workspace/workspace) |
|
||||
| [`spill-policy`](../packages/spill/spill-policy) | `spill` | [`attachment`](../packages/attachment/attachment), [`fs`](../packages/fs/fs), [`llm`](../packages/llm/llm), [`output-retention`](../packages/util/output-retention), [`session`](../packages/core/session), [`spill`](../packages/spill/spill), [`token-meter`](../packages/llm/token-meter), [`tools`](../packages/core/tools) |
|
||||
| [`session-query-sqlite`](../packages/session-query/session-query-sqlite) | `session-query` | [`session`](../packages/core/session), [`session-persistence`](../packages/session/session-persistence), [`session-query`](../packages/session-query/session-query) |
|
||||
| [`tool-session-query`](../packages/session-query/tool-session-query) | `session-query` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`session-query`](../packages/session-query/session-query), [`system-prompt`](../packages/core/system-prompt), [`timeout`](../packages/util/timeout), [`tools`](../packages/core/tools) |
|
||||
| [`acp`](../packages/acp/acp) | `acp` | [`agent`](../packages/core/agent), [`attachment`](../packages/attachment/attachment), [`llm`](../packages/llm/llm), [`mcp-client`](../packages/mcp/mcp-client), [`session`](../packages/core/session), [`session-persistence`](../packages/session/session-persistence), [`token-meter`](../packages/llm/token-meter), [`user-approval`](../packages/interaction/user-approval) |
|
||||
|
||||
@@ -808,11 +808,6 @@ flowchart TD
|
||||
pkg_tool_web --> pkg_system_prompt
|
||||
pkg_tool_web --> pkg_tools
|
||||
pkg_tool_web --> pkg_web
|
||||
pkg_spill_policy --> pkg_llm
|
||||
pkg_spill_policy --> pkg_output_retention
|
||||
pkg_spill_policy --> pkg_session
|
||||
pkg_spill_policy --> pkg_spill
|
||||
pkg_spill_policy --> pkg_tools
|
||||
pkg_tool_todo --> pkg_agent
|
||||
pkg_tool_todo --> pkg_invariants
|
||||
pkg_tool_todo --> pkg_session
|
||||
@@ -1103,6 +1098,14 @@ flowchart TD
|
||||
pkg_subagent --> pkg_user_approval
|
||||
pkg_subagent --> pkg_util_time
|
||||
pkg_subagent --> pkg_workspace
|
||||
pkg_spill_policy --> pkg_attachment
|
||||
pkg_spill_policy --> pkg_fs
|
||||
pkg_spill_policy --> pkg_llm
|
||||
pkg_spill_policy --> pkg_output_retention
|
||||
pkg_spill_policy --> pkg_session
|
||||
pkg_spill_policy --> pkg_spill
|
||||
pkg_spill_policy --> pkg_token_meter
|
||||
pkg_spill_policy --> pkg_tools
|
||||
pkg_session_query_sqlite --> pkg_session
|
||||
pkg_session_query_sqlite --> pkg_session_persistence
|
||||
pkg_session_query_sqlite --> pkg_session_query
|
||||
@@ -1568,7 +1571,6 @@ flowchart TD
|
||||
| [`tool-skill`](../packages/skill/tool-skill) | `skill` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`skill`](../packages/skill/skill), [`tools`](../packages/core/tools) |
|
||||
| [`tool-workspace-dependencies`](../packages/skill/tool-workspace-dependencies) | `skill` | [`tools`](../packages/core/tools) |
|
||||
| [`tool-web`](../packages/web/tool-web) | `web` | [`llm`](../packages/llm/llm), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools), [`web`](../packages/web/web) |
|
||||
| [`spill-policy`](../packages/spill/spill-policy) | `spill` | [`llm`](../packages/llm/llm), [`output-retention`](../packages/util/output-retention), [`session`](../packages/core/session), [`spill`](../packages/spill/spill), [`tools`](../packages/core/tools) |
|
||||
| [`tool-todo`](../packages/todo/tool-todo) | `todo` | [`agent`](../packages/core/agent), [`invariants`](../packages/runtime-diagnostics/invariants), [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`tools`](../packages/core/tools) |
|
||||
| [`plan-mode`](../packages/plan/plan-mode) | `plan` | [`agent`](../packages/core/agent), [`commands`](../packages/interaction/commands), [`invariants`](../packages/runtime-diagnostics/invariants), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools), [`user-questions`](../packages/interaction/user-questions) |
|
||||
| [`hooks-codex`](../packages/hooks/hooks-codex) | `hooks` | [`agent`](../packages/core/agent), [`hook-protocol`](../packages/hooks/hook-protocol), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`tools`](../packages/core/tools) |
|
||||
@@ -1621,6 +1623,7 @@ flowchart TD
|
||||
| [`agent-loop-testkit`](../packages/test-support/agent-loop-testkit) | `test-support` | [`agent`](../packages/core/agent), [`agent-loop`](../packages/core/agent-loop), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) |
|
||||
| [`webhook`](../packages/webhook/webhook) | `webhook` | [`agent`](../packages/core/agent), [`agent-default-model`](../packages/core/agent-default-model), [`agent-preset-registry`](../packages/preset/agent-preset-registry), [`invariants`](../packages/runtime-diagnostics/invariants), [`llm`](../packages/llm/llm), [`permission-presets`](../packages/interaction/permission-presets), [`session`](../packages/core/session), [`session-title`](../packages/session/session-title), [`workspace`](../packages/workspace/workspace) |
|
||||
| [`subagent`](../packages/subagent/subagent) | `subagent` | [`agent`](../packages/core/agent), [`agent-preset-registry`](../packages/preset/agent-preset-registry), [`attachment`](../packages/attachment/attachment), [`invariants`](../packages/runtime-diagnostics/invariants), [`jobs`](../packages/jobs/jobs), [`llm`](../packages/llm/llm), [`permission-presets`](../packages/interaction/permission-presets), [`sandbox`](../packages/sandbox/sandbox), [`sandbox-policy`](../packages/sandbox/sandbox-policy), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`session-persistence`](../packages/session/session-persistence), [`session-projection`](../packages/session/session-projection), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-query`](../packages/session-query/session-query), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools), [`typert-protocol`](../packages/typert/protocol), [`user-approval`](../packages/interaction/user-approval), [`util-time`](../packages/util/time), [`workspace`](../packages/workspace/workspace) |
|
||||
| [`spill-policy`](../packages/spill/spill-policy) | `spill` | [`attachment`](../packages/attachment/attachment), [`fs`](../packages/fs/fs), [`llm`](../packages/llm/llm), [`output-retention`](../packages/util/output-retention), [`session`](../packages/core/session), [`spill`](../packages/spill/spill), [`token-meter`](../packages/llm/token-meter), [`tools`](../packages/core/tools) |
|
||||
| [`session-query-sqlite`](../packages/session-query/session-query-sqlite) | `session-query` | [`session`](../packages/core/session), [`session-persistence`](../packages/session/session-persistence), [`session-query`](../packages/session-query/session-query) |
|
||||
| [`tool-session-query`](../packages/session-query/tool-session-query) | `session-query` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`session-query`](../packages/session-query/session-query), [`system-prompt`](../packages/core/system-prompt), [`timeout`](../packages/util/timeout), [`tools`](../packages/core/tools) |
|
||||
| [`acp`](../packages/acp/acp) | `acp` | [`agent`](../packages/core/agent), [`attachment`](../packages/attachment/attachment), [`llm`](../packages/llm/llm), [`mcp-client`](../packages/mcp/mcp-client), [`session`](../packages/core/session), [`session-persistence`](../packages/session/session-persistence), [`token-meter`](../packages/llm/token-meter), [`user-approval`](../packages/interaction/user-approval) |
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write docs/persistence-catalog.md
|
||||
persistence-catalog.md: bb3ee2c998189533ed87e149422eae8123fb07b1
|
||||
persistence-catalog.zh.md: 3dabca40d2975e090935d471cd187def826ea4df
|
||||
persistence-catalog.md: 022944bea076f49e054e7194e6b475cf6dfca2bc
|
||||
persistence-catalog.zh.md: 096bf746085d329427dfb5516db4c6387f0974fe
|
||||
@@ -4929,7 +4929,7 @@ Sources: [`packages/llm/llm/src/types.ts:127`](../packages/llm/llm/src/types.ts)
|
||||
|
||||
SHA-256: `3cfc3a56502da1f8c6153c2c56657bab4b749056968634dd0991d325ec1c919f`
|
||||
|
||||
Sources: [`packages/core/tools/src/index.ts:689`](../packages/core/tools/src/index.ts)
|
||||
Sources: [`packages/core/tools/src/index.ts:699`](../packages/core/tools/src/index.ts)
|
||||
|
||||
| Property | Presence | Type |
|
||||
|---|---|---|
|
||||
|
||||
@@ -4931,7 +4931,7 @@ SHA-256: `43e311235aa537df1bacdd92d144df8a952337a76e9ac892cdf670f1a797bad8`
|
||||
|
||||
SHA-256: `3cfc3a56502da1f8c6153c2c56657bab4b749056968634dd0991d325ec1c919f`
|
||||
|
||||
来源:[`packages/core/tools/src/index.ts:689`](../packages/core/tools/src/index.ts)
|
||||
来源:[`packages/core/tools/src/index.ts:699`](../packages/core/tools/src/index.ts)
|
||||
|
||||
| 属性 | 存在性 | 类型 |
|
||||
|---|---|---|
|
||||
|
||||
@@ -36275,7 +36275,7 @@
|
||||
"packages/core/tools/src/index.ts#ToolRestriction"
|
||||
],
|
||||
"sources": [
|
||||
"packages/core/tools/src/index.ts:689"
|
||||
"packages/core/tools/src/index.ts:699"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write docs/subsystems/spill.md
|
||||
spill.md: 577f3ff14bade2b0c03a0aeaa975d12ae96803b8
|
||||
spill.zh.md: 1bc238b8cdc0ef81e966bc5ec9c11b2dd31b24da
|
||||
spill.md: 5a6eb91c8dc3932ab56bd7afc4a4cc60b509180d
|
||||
spill.zh.md: 0eebf93d041a2689e17c70053d34b93b34b51c2f
|
||||
@@ -89,7 +89,7 @@ type SpillLocator = Branded<'SpillLocator'>
|
||||
|
||||
`SpillStore` (`ctx.spillStore`, defined in [`packages/spill/spill/src/index.ts`](../../packages/spill/spill/src/index.ts)) is a one-method abstract service: `saveText(input) → Promise<SpillRef>`. It persists the FULL `content` and REJECTS on a real storage failure (permissions, ENOSPC, backend unavailable). The seam owns storage only: no retention policy, no tool-result replacement, no retrieval/search API.
|
||||
|
||||
The local backend ([dsh-spill-local](../../packages/spill/spill-local)) writes under `<root>/session-<hash>/<random>-<safeName>` — a configured or lazily-created private (0700) root, a `sha256(sessionId)` session subdir, and an exclusive owner-only (`open(path, 'wx', 0o600)`) write so a planted symlink cannot redirect it. Its `locator` is the local path and its `retrievalHint` tells the model to use `read` or `grep` on that path. The policy consumer ([dsh-spill-policy](../../packages/spill/spill-policy)) replaces an over-`maxInlineBytes` plain-text final result with a retention-library head/tail preview plus the spill reference, best-effort: a save failure keeps the original inline result rather than turning a successful call into an `isError`.
|
||||
The local backend ([dsh-spill-local](../../packages/spill/spill-local)) writes under `<root>/session-<hash>/<random>-<safeName>` — a configured or lazily-created private (0700) root, a `sha256(sessionId)` session subdir, and an exclusive owner-only (`open(path, 'wx', 0o600)`) write so a planted symlink cannot redirect it. Its `locator` is the local path and its `retrievalHint` tells the model to use `read` or `grep` on that path. The policy consumer ([dsh-spill-policy](../../packages/spill/spill-policy)) replaces an over-`maxInlineTokens` text/image result with ordered head/tail content and a spill address, best-effort: a save failure keeps the original inline result rather than turning a successful call into an `isError`.
|
||||
|
||||
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ type SpillLocator = Branded<'SpillLocator'>
|
||||
|
||||
`SpillStore`(`ctx.spillStore`,定义于 [`packages/spill/spill/src/index.ts`](../../packages/spill/spill/src/index.ts))是只有一个方法的抽象服务:`saveText(input) → Promise<SpillRef>`。它持久保存完整的 `content`,并在实际存储失败(权限、ENOSPC、后端不可用)时拒绝。该 seam 只负责存储:不负责保留策略、工具结果替换或检索/搜索 API。
|
||||
|
||||
本地后端([dsh-spill-local](../../packages/spill/spill-local))写入 `<root>/session-<hash>/<random>-<safeName>`:根目录是已配置或延迟创建的私有(0700)目录,会话子目录采用 `sha256(sessionId)`,并通过排他且仅所有者可访问的写入(`open(path, 'wx', 0o600)`)防止预先植入的符号链接重定向写入。其 `locator` 是本地路径,`retrievalHint` 则告知模型在该路径上使用 `read` 或 `grep`。策略消费方([dsh-spill-policy](../../packages/spill/spill-policy))会把超过 `maxInlineBytes` 的纯文本最终结果替换为保留库生成的首尾预览和 spill 引用;该过程尽力而为:保存失败时保留原始内联结果,而不会把成功的调用变成 `isError`。
|
||||
本地后端([dsh-spill-local](../../packages/spill/spill-local))写入 `<root>/session-<hash>/<random>-<safeName>`:根目录是已配置或延迟创建的私有(0700)目录,会话子目录采用 `sha256(sessionId)`,并通过排他且仅所有者可访问的写入(`open(path, 'wx', 0o600)`)防止预先植入的符号链接重定向写入。其 `locator` 是本地路径,`retrievalHint` 则告知模型在该路径上使用 `read` 或 `grep`。策略消费方([dsh-spill-policy](../../packages/spill/spill-policy))会把超过 `maxInlineTokens` 的图文结果替换为按原顺序保留的首尾内容和 spill 地址;该过程尽力而为:保存失败时保留原始内联结果,而不会把成功的调用变成 `isError`。
|
||||
|
||||
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
||||
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write docs/subsystems/tools.md
|
||||
tools.md: 396deae037f9026c56102d080b61a3f3fbde7a05
|
||||
tools.zh.md: ae39bade0f9bb7c4b0008a0f115d97ed2e033189
|
||||
tools.md: 348cda65733b1bf60c5e6e44d14507b7c91ecbd6
|
||||
tools.zh.md: ae928e573fa4d914713357ca2de94470fc8a2c7c
|
||||
@@ -8,7 +8,7 @@ Source: [`packages/core/tools/src/index.ts`](../../packages/core/tools/src/index
|
||||
|
||||
## `ToolDefinition` — a registered tool
|
||||
|
||||
A `ToolSchema` (the model-facing fields) plus a mandatory canonical output declaration, the `execute` function, host-only scheduler metadata, an optional final-content callback, and optional UI presenters. The registry holds these; the loop dispatches calls through them. The registry's `schemas()` builds the model-facing `ToolSchema[]` by an explicit allowlist — `output`/`execute`/`finalizeContent`/`timeoutMs`/`isConcurrencySafe`/`presentCall`/`presentResult` must never leak into a model request.
|
||||
A `ToolSchema` (the model-facing fields) plus a mandatory canonical output declaration, the `execute` function, host-only scheduler metadata, an optional final-content callback, and optional UI presenters. The registry holds these; the loop dispatches calls through them. The registry's `schemas()` builds the model-facing `ToolSchema[]` by an explicit allowlist — `output`/`execute`/`projectContent`/`finalizeContent`/`timeoutMs`/`isConcurrencySafe`/`presentCall`/`presentResult` must never leak into a model request.
|
||||
|
||||
```ts type-equiv
|
||||
/** Tool-owned canonical output contract used after the body returns a JSON value. */
|
||||
@@ -38,6 +38,16 @@ interface ToolDefinition extends ToolSchema {
|
||||
* @returns the canonical value declared by `output.schema`.
|
||||
*/
|
||||
execute(args: unknown, exec: ToolRunContext): Promise<unknown>
|
||||
/**
|
||||
* Install execution-prepared content before `tools/post-execute` policies.
|
||||
* The callback is captured when the call starts and runs once for a
|
||||
* normalized outcome entering post-execute. Policy replacements remain
|
||||
* authoritative; pipeline failures that bypass post-execute skip projection.
|
||||
* @param exec - immutable execution identity and arguments.
|
||||
* @param result - normalized result before post-execute policy.
|
||||
* @returns replacement content, or undefined to preserve the renderer output.
|
||||
*/
|
||||
projectContent?(exec: Readonly<ToolExecution>, result: Readonly<ToolExecutionResult>): ContentBlock[] | undefined
|
||||
/**
|
||||
* Synchronous last-mile transform for model-facing content. The registry
|
||||
* snapshots this callback when execution starts and invokes it exactly once
|
||||
@@ -169,7 +179,7 @@ interface ToolRestriction {
|
||||
|
||||
## Execution: extensible waterfalls plus monotonic policy
|
||||
|
||||
`ctx.tools.execute()` accepts a caller-owned `ToolExecutionInput` with a required readonly `signal`, materializes its parsed JSON arguments once into a pipeline-owned `ToolExecution`, and runs that call through `tools/pre-execute` (the reorderable allow/deny/ask waterfall) → registered monotonic guards → `tools/execute` (around-dispatch wrappers) → `tools/post-execute` (inspect/replace the result) → optional definition-owned `finalizeContent` → `tools/result` (the immutable authoritative outcome). Only the `tools/execute` view may replace the required signal. The outcome is a `ToolExecutionResult`.
|
||||
`ctx.tools.execute()` accepts a caller-owned `ToolExecutionInput` with a required readonly `signal`, materializes its parsed JSON arguments once into a pipeline-owned `ToolExecution`, and runs that call through `tools/pre-execute` (the reorderable allow/deny/ask waterfall) → registered monotonic guards → `tools/execute` (around-dispatch wrappers) → `projectContent` → `tools/post-execute` (inspect/replace the result) → optional definition-owned `finalizeContent` → `tools/result` (the immutable authoritative outcome). Only the `tools/execute` view may replace the required signal. The outcome is a `ToolExecutionResult`.
|
||||
|
||||
```ts type-equiv
|
||||
/** Opaque call identity that permits correlation without exposing mutable execution state. */
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
## `ToolDefinition` — 一个已注册的工具
|
||||
|
||||
由一个 `ToolSchema`(面向模型的字段)、必需的规范输出声明、`execute` 函数、仅供宿主使用的调度器元数据、可选的最终内容回调和可选 UI 展示函数组成。注册表持有这些定义,循环通过它们分派调用。注册表的 `schemas()` 通过显式允许列表构建面向模型的 `ToolSchema[]`;`output`/`execute`/`finalizeContent`/`timeoutMs`/`isConcurrencySafe`/`presentCall`/`presentResult` 绝不能泄漏到模型请求中。
|
||||
由一个 `ToolSchema`(面向模型的字段)、必需的规范输出声明、`execute` 函数、仅供宿主使用的调度器元数据、可选的最终内容回调和可选 UI 展示函数组成。注册表持有这些定义,循环通过它们分派调用。注册表的 `schemas()` 通过显式允许列表构建面向模型的 `ToolSchema[]`;`output`/`execute`/`projectContent`/`finalizeContent`/`timeoutMs`/`isConcurrencySafe`/`presentCall`/`presentResult` 绝不能泄漏到模型请求中。
|
||||
|
||||
```ts type-equiv
|
||||
/** Tool-owned canonical output contract used after the body returns a JSON value. */
|
||||
@@ -38,6 +38,16 @@ interface ToolDefinition extends ToolSchema {
|
||||
* @returns the canonical value declared by `output.schema`.
|
||||
*/
|
||||
execute(args: unknown, exec: ToolRunContext): Promise<unknown>
|
||||
/**
|
||||
* Install execution-prepared content before `tools/post-execute` policies.
|
||||
* The callback is captured when the call starts and runs once for a
|
||||
* normalized outcome entering post-execute. Policy replacements remain
|
||||
* authoritative; pipeline failures that bypass post-execute skip projection.
|
||||
* @param exec - immutable execution identity and arguments.
|
||||
* @param result - normalized result before post-execute policy.
|
||||
* @returns replacement content, or undefined to preserve the renderer output.
|
||||
*/
|
||||
projectContent?(exec: Readonly<ToolExecution>, result: Readonly<ToolExecutionResult>): ContentBlock[] | undefined
|
||||
/**
|
||||
* Synchronous last-mile transform for model-facing content. The registry
|
||||
* snapshots this callback when execution starts and invokes it exactly once
|
||||
@@ -169,7 +179,7 @@ interface ToolRestriction {
|
||||
|
||||
## 执行:可扩展的 waterfall(瀑布式事件)加单调策略
|
||||
|
||||
`ctx.tools.execute()` 接受由调用方拥有且包含必需 readonly `signal` 的 `ToolExecutionInput`,将其解析后的 JSON 参数一次性物化为流水线拥有的 `ToolExecution`,然后让调用依次经过 `tools/pre-execute`(可重排的 allow/deny/ask waterfall)→ 已注册的单调 guard → `tools/execute`(环绕分派包装层)→ `tools/post-execute`(检查/替换结果)→ 可选且由定义拥有的 `finalizeContent` → `tools/result`(不可变的权威结果)。只有 `tools/execute` 视图可以替换必需的 signal。最终产出为 `ToolExecutionResult`。
|
||||
`ctx.tools.execute()` 接受由调用方拥有且包含必需 readonly `signal` 的 `ToolExecutionInput`,将其解析后的 JSON 参数一次性物化为流水线拥有的 `ToolExecution`,然后让调用依次经过 `tools/pre-execute`(可重排的 allow/deny/ask waterfall)→ 已注册的单调 guard → `tools/execute`(环绕分派包装层)→ `projectContent` → `tools/post-execute`(检查/替换结果)→ 可选且由定义拥有的 `finalizeContent` → `tools/result`(不可变的权威结果)。只有 `tools/execute` 视图可以替换必需的 signal。最终产出为 `ToolExecutionResult`。
|
||||
|
||||
```ts type-equiv
|
||||
/** Opaque call identity that permits correlation without exposing mutable execution state. */
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write docs/tool-execution-pipeline.md
|
||||
tool-execution-pipeline.md: f9d3d145bb3d7c271882942b4adc100f53a55290
|
||||
tool-execution-pipeline.zh.md: 3bfa6f358ee8482feaa9d26541e495b86a02e515
|
||||
tool-execution-pipeline.md: 53b7481183145289d2b2a2502ef71b5a1b7a3796
|
||||
tool-execution-pipeline.zh.md: 89d2ba505e454c50a67095d10ef3014d26009e6c
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
# Tool Execution Pipeline
|
||||
|
||||
This graph shows where policy, hooks, sandboxing, filesystem guards, result rewriting, final-outcome observation, and UI rendering run without changing the loop. The `tools/pre-execute` waterfall runs first, monotonic guards run next, and the `tools/execute` and `tools/post-execute` waterfalls follow; the three waterfalls may transform a call. Definition-owned `finalizeContent` and `tools/result` run afterward.
|
||||
This graph shows where policy, hooks, sandboxing, filesystem guards, result rewriting, final-outcome observation, and UI rendering run without changing the loop. The `tools/pre-execute` waterfall runs first, monotonic guards run next, and the `tools/execute` and `tools/post-execute` waterfalls follow; the three waterfalls may transform a call. Definition-owned `projectContent` installs prepared content before post-execute; `finalizeContent` and `tools/result` run afterward.
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
@@ -18,6 +18,7 @@ flowchart TD
|
||||
toolBody["Registered tool execute() body"]
|
||||
fsGate["<code>fs/write-intent</code> or <code>fs/edit-intent</code><br/>tool-fs mutations only"]
|
||||
owned["Tool-owned session events<br/><code>todo/write</code>, <code>fs/observed</code>, <code>hook/invoked</code>, <code>hook/result</code>, <code>tool/ptc-dispatch</code>"]
|
||||
project["ToolDefinition.projectContent<br/>execution-prepared text and images"]
|
||||
post["<code>tools/post-execute</code> waterfall<br/>accept, block, replace, add context"]
|
||||
normalized["Registry outer normalization<br/>pipeline/result snapshot throws become isError"]
|
||||
finalize["ToolDefinition.finalizeContent<br/>last content-only invariant"]
|
||||
@@ -39,13 +40,15 @@ flowchart TD
|
||||
approval -->|allowed-once| guards
|
||||
approval -->|rejected, cancelled, unavailable| denied
|
||||
approval -.->|throw| normalized
|
||||
denied --> post
|
||||
denied --> project
|
||||
pre -.->|throw| normalized
|
||||
toolBody --> fsGate
|
||||
fsGate --> toolBody
|
||||
toolBody --> owned
|
||||
toolBody --> around
|
||||
around --> post
|
||||
around --> project
|
||||
project --> post
|
||||
project -.->|throw| normalized
|
||||
around -.->|wrapper throws| normalized
|
||||
post -.->|throw| normalized
|
||||
post --> finalize
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
[English](tool-execution-pipeline.md) | 中文
|
||||
|
||||
此图展示策略、钩子、沙箱、文件系统守卫、结果重写、最终结果观察和 UI 渲染在不改变循环的情况下何时运行。`tools/pre-execute` waterfall(瀑布式事件)首先运行,随后是单调守卫,然后运行 `tools/execute` 和 `tools/post-execute` waterfall;这三个 waterfall 可以改写一次调用。由定义自身控制的 `finalizeContent` 和 `tools/result` 在此之后运行。
|
||||
此图展示策略、钩子、沙箱、文件系统守卫、结果重写、最终结果观察和 UI 渲染在不改变循环的情况下何时运行。`tools/pre-execute` waterfall(瀑布式事件)首先运行,随后是单调守卫,然后运行 `tools/execute` 和 `tools/post-execute` waterfall;这三个 waterfall 可以改写一次调用。由定义自身控制的 `projectContent` 在执行后策略之前安装已准备内容;`finalizeContent` 和 `tools/result` 在此之后运行。
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
@@ -20,6 +20,7 @@ flowchart TD
|
||||
toolBody["Registered tool execute() body"]
|
||||
fsGate["<code>fs/write-intent</code> or <code>fs/edit-intent</code><br/>tool-fs mutations only"]
|
||||
owned["Tool-owned session events<br/><code>todo/write</code>, <code>fs/observed</code>, <code>hook/invoked</code>, <code>hook/result</code>, <code>tool/ptc-dispatch</code>"]
|
||||
project["ToolDefinition.projectContent<br/>execution-prepared text and images"]
|
||||
post["<code>tools/post-execute</code> waterfall<br/>accept, block, replace, add context"]
|
||||
normalized["Registry outer normalization<br/>pipeline/result snapshot throws become isError"]
|
||||
finalize["ToolDefinition.finalizeContent<br/>last content-only invariant"]
|
||||
@@ -41,13 +42,15 @@ flowchart TD
|
||||
approval -->|allowed-once| guards
|
||||
approval -->|rejected, cancelled, unavailable| denied
|
||||
approval -.->|throw| normalized
|
||||
denied --> post
|
||||
denied --> project
|
||||
pre -.->|throw| normalized
|
||||
toolBody --> fsGate
|
||||
fsGate --> toolBody
|
||||
toolBody --> owned
|
||||
toolBody --> around
|
||||
around --> post
|
||||
around --> project
|
||||
project --> post
|
||||
project -.->|throw| normalized
|
||||
around -.->|wrapper throws| normalized
|
||||
post -.->|throw| normalized
|
||||
post --> finalize
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write docs/user/guide/providers.md
|
||||
providers.md: 81ccba8b0665fa1f7666b5724aab4a8b3d183bbf
|
||||
providers.zh.md: 1afb7e7bf616206290e5cc4a90ef45b4250a9596
|
||||
providers.md: 773ff6722a8558720a458f7574940972cf976958
|
||||
providers.zh.md: 6d618ed1e9eec17e8c4a000d00cc6987d0a6af14
|
||||
@@ -20,7 +20,7 @@ Providers that sign in with OAuth, such as Codex, are not supported here yet.
|
||||
|
||||
## Add a custom model API
|
||||
|
||||
Switch the card to **Custom model API** for a relay, a company gateway, a self-hosted server, or any provider absent from the installed catalog. Supply a lowercase Provider ID, base URL, API protocol, credential, and at least one model. The **API protocol** must be the one your gateway speaks, and the picker offers three: OpenAI Chat Completions, OpenAI Responses, and Anthropic Messages, stored in `settings.yaml` as `openai-completions`, `openai-responses`, and `anthropic-messages`. A provider speaks one protocol, so a gateway that serves two needs two providers.
|
||||
Switch the card to **Custom model API** for a relay, a company gateway, a self-hosted server, or any provider absent from the installed catalog. Supply a lowercase Provider ID, base URL, API protocol, credential, and at least one model. The **API protocol** must be the one your gateway speaks, and the picker offers three: OpenAI Chat Completions, OpenAI Responses, and Anthropic Messages, stored in the active profile's `cordis.patch.yml` as `openai-completions`, `openai-responses`, and `anthropic-messages`. A provider speaks one protocol, so a gateway that serves two needs two providers.
|
||||
|
||||

|
||||
|
||||
@@ -44,6 +44,8 @@ The generated [plugin configuration catalog](../../config-catalog.md) lists ever
|
||||
|
||||
::: tip Additional settings
|
||||
The Models page exposes the API key, display name, base URL, API protocol, and each model's id, display name, context window, max output tokens, and input types. Configure reasoning effort levels, request-compatibility switches, headers, timeouts, and retry policy in `$DSH_HOME/profiles/<profile>/cordis.patch.yml`, the same document the page writes. Edit it directly, or, when the browser runs on the same machine as the server, open it with **Open configuration file** in the Settings header; the adapters re-read it on the next request, so nothing needs a restart. The subsections below cover the fields most gateways need.
|
||||
|
||||
For the standard Web UI launch with `dsh web`, `<profile>` is `web`, so the path is `$DSH_HOME/profiles/web/cordis.patch.yml`. If you launch a custom profile, use the name selected at startup instead.
|
||||
:::
|
||||
|
||||
### Image input
|
||||
@@ -132,14 +134,14 @@ Each key is a level the menu offers, and its value is the spelling sent on the w
|
||||
An `off` left empty sends nothing, which only stops a model that thinks on request; an `off` given a value sends that value as `reasoning_effort` instead. A model that thinks unless told not to — DeepSeek V4 behind an OpenAI-compatible gateway, for example — needs `compat.thinkingFormat: deepseek`, which makes `off` send `thinking: {type: disabled}` and every other level send `thinking: {type: enabled}` beside the effort:
|
||||
|
||||
```yaml
|
||||
models:
|
||||
- id: deepseek-v4-pro
|
||||
compat:
|
||||
thinkingFormat: deepseek
|
||||
reasoningEfforts:
|
||||
off:
|
||||
high: high
|
||||
max: max
|
||||
models:
|
||||
- id: deepseek-v4-pro
|
||||
compat:
|
||||
thinkingFormat: deepseek
|
||||
reasoningEfforts:
|
||||
off:
|
||||
high: high
|
||||
max: max
|
||||
```
|
||||
|
||||
A built-in provider's model whose gateway does not reason loses its levels with `reasoningEfforts: false` under `modelOverrides`; selecting an effort for it is then refused as `UNSUPPORTED_REASONING_EFFORT`. DeepSeek's own route needs none of this: its models already offer `off`, `low`, `high`, and `max`, and `llm-deepseek.reasoningEffort` sets the default the picker starts from:
|
||||
@@ -174,11 +176,11 @@ Two account for most of it. A model that declares reasoning has its system promp
|
||||
A route's `compat` is the default for its models, and a model's own wins field by field, so one model can be corrected without restating the route:
|
||||
|
||||
```yaml
|
||||
models:
|
||||
- id: my-model
|
||||
- id: my-reasoner
|
||||
compat:
|
||||
thinkingFormat: deepseek
|
||||
models:
|
||||
- id: my-model
|
||||
- id: my-reasoner
|
||||
compat:
|
||||
thinkingFormat: deepseek
|
||||
```
|
||||
|
||||
What neither sets keeps the installed catalog's value for that model, and what the catalog does not describe falls to pi-ai's detection. Give every switch you name a value: a key left empty (`supportsDeveloperRole:`) is refused rather than ignored, because an empty value would erase what the catalog knows while saying nothing in its place. A name no protocol accepts is refused too, and the message lists the ones that are available.
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
## 添加自定义模型 API
|
||||
|
||||
对于中转站、公司网关、自建服务器或已安装目录中不存在的提供商,把卡片切换到**自定义模型 API**。提供小写 Provider ID、基础 URL、API 协议、凭据和至少一个模型。**API 协议**必须选网关实际使用的那一种,选择框提供三种:OpenAI Chat Completions、OpenAI Responses 和 Anthropic Messages,在 `settings.yaml` 中分别存为 `openai-completions`、`openai-responses` 和 `anthropic-messages`。一个提供商只使用一种协议,网关同时提供两种时需要建两个提供商。
|
||||
对于中转站、公司网关、自建服务器或已安装目录中不存在的提供商,把卡片切换到**自定义模型 API**。提供小写 Provider ID、基础 URL、API 协议、凭据和至少一个模型。**API 协议**必须选网关实际使用的那一种,选择框提供三种:OpenAI Chat Completions、OpenAI Responses 和 Anthropic Messages,在当前 profile 的 `cordis.patch.yml` 中分别存为 `openai-completions`、`openai-responses` 和 `anthropic-messages`。一个提供商只使用一种协议,网关同时提供两种时需要建两个提供商。
|
||||
|
||||

|
||||
|
||||
@@ -44,6 +44,8 @@ Provider ID 是永久的,因为请求、已保存会话、模型默认值和
|
||||
|
||||
::: tip 其他设置
|
||||
模型页提供 API 密钥、显示名称、API 地址、API 协议,以及每个模型的 ID、显示名称、上下文窗口、最大输出 token 数和输入类型。推理等级、请求兼容性开关、请求头、超时和重试策略在 `$DSH_HOME/profiles/<profile>/cordis.patch.yml` 中设置,也就是模型页写入的同一份文档。可以直接编辑它;浏览器与服务器在同一台机器时,也可以点击设置页顶部的**打开配置文件**打开它。适配器会在下一次请求时重新读取,无需重启任何东西。下面各小节介绍多数网关会用到的字段。
|
||||
|
||||
按常规方式通过 `dsh web` 启动 Web UI 时,`<profile>` 就是 `web`,完整路径为 `$DSH_HOME/profiles/web/cordis.patch.yml`。如果使用自定义 profile,请替换为启动时指定的名称。
|
||||
:::
|
||||
|
||||
### 图片输入
|
||||
@@ -132,14 +134,14 @@ DeepSeek 将省略的 `inputModalities` 视为纯文本,并拒绝空列表。
|
||||
留空的 `off` 什么都不发送,这只能让「按请求才思考」的模型停下来;给 `off` 一个值,则会把该值作为 `reasoning_effort` 发送。对于「不明确关闭就会思考」的模型——例如 OpenAI 兼容网关后面的 DeepSeek V4——需要 `compat.thinkingFormat: deepseek`:它让 `off` 发送 `thinking: {type: disabled}`,其他每个等级则在 effort 之外再发送 `thinking: {type: enabled}`:
|
||||
|
||||
```yaml
|
||||
models:
|
||||
- id: deepseek-v4-pro
|
||||
compat:
|
||||
thinkingFormat: deepseek
|
||||
reasoningEfforts:
|
||||
off:
|
||||
high: high
|
||||
max: max
|
||||
models:
|
||||
- id: deepseek-v4-pro
|
||||
compat:
|
||||
thinkingFormat: deepseek
|
||||
reasoningEfforts:
|
||||
off:
|
||||
high: high
|
||||
max: max
|
||||
```
|
||||
|
||||
网关并不提供推理能力的内置提供商模型,可在 `modelOverrides` 下用 `reasoningEfforts: false` 去掉其等级;之后再为它选择等级会被拒绝并报 `UNSUPPORTED_REASONING_EFFORT`。DeepSeek 自身的路由不需要以上任何配置:其模型已经提供 `off`、`low`、`high` 和 `max`,`llm-deepseek.reasoningEffort` 设置选择器的起始默认值:
|
||||
@@ -174,11 +176,11 @@ DeepSeek 将省略的 `inputModalities` 视为纯文本,并拒绝空列表。
|
||||
路由的 `compat` 是其模型的默认值,模型自身的则逐字段胜出,因此更正某一个模型无需重述整条路由:
|
||||
|
||||
```yaml
|
||||
models:
|
||||
- id: my-model
|
||||
- id: my-reasoner
|
||||
compat:
|
||||
thinkingFormat: deepseek
|
||||
models:
|
||||
- id: my-model
|
||||
- id: my-reasoner
|
||||
compat:
|
||||
thinkingFormat: deepseek
|
||||
```
|
||||
|
||||
两者都未设置的字段,沿用已安装 catalog 为该模型记录的值;catalog 也未描述的,落到 pi-ai 的检测。凡是写下的开关都要给值:冒号后留空的键(`supportsDeveloperRole:`)会被拒绝而不是被忽略,因为空值会抹掉 catalog 已知的信息,却又没有给出任何替代。任何协议都不接受的名字同样会被拒绝,报错会列出可用的那些。
|
||||
|
||||
@@ -214,6 +214,7 @@
|
||||
"@deepseek-ai/dsh-experimental-computer-use-cua-driver-mcp": "workspace:^",
|
||||
"@deepseek-ai/dsh-experimental-computer-use-cua-driver-native": "workspace:^",
|
||||
"@deepseek-ai/dsh-llm-replay": "workspace:^",
|
||||
"@deepseek-ai/dsh-mcp-client": "workspace:^",
|
||||
"@deepseek-ai/dsh-tool-session-query": "workspace:^",
|
||||
"@deepseek-ai/dsh-web-fetch-http": "workspace:^",
|
||||
"@stylistic/eslint-plugin": "^5.10.0",
|
||||
|
||||
@@ -406,7 +406,7 @@
|
||||
- id: spill-policy
|
||||
name: '@deepseek-ai/dsh-spill-policy'
|
||||
config:
|
||||
maxInlineBytes: 50000
|
||||
maxInlineTokens: 12500
|
||||
|
||||
# Durability checkpoints before each model request and top-level dispatch.
|
||||
- id: session-checkpoint-policy
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write packages/client/ui-conversation/README.md
|
||||
README.md: a58ae14a450a18ae4bc89dc0dc5cc6fb664d48e0
|
||||
README.zh.md: 20d6cab01e7b5fc4c9b075a993783c9df8121413
|
||||
README.md: 48df40483632a7c63ec59d389f920d4dd663155b
|
||||
README.zh.md: f5c34657264f97d8f0178859dcba5e3fc981f17d
|
||||
@@ -68,7 +68,7 @@ Active transcripts in the main occurrence expose content-width drag handles in t
|
||||
|
||||
The width-handle indicator follows the pointer only during a captured drag; ordinary hover leaves its position unchanged.
|
||||
|
||||
The resident composer survives no-Session and Session transitions. Whitespace hides its placeholder; a whitespace-only draft without attachments cannot be sent. The no-Session state keeps the same composer surface mounted but inert while the Workspace picker connects a blank Session. The surface is a shell-owned Lexical editor: reference chips are atomic decorator nodes carrying the owner's serialization identity (submission expands them through the owner codec), claimed slash commands stay styled leading text, folder text references carry the folder glyph as an icon prefix, and the draft's clipboard projection is mirrored into the per-Session Conversation store. QueueDock reads `next-turn` directly from the Session `inbox` projection, including cold recovered messages. Queue operations address exact queue occurrences through the scoped `ctx.conversation` service; queue previews render sent text through the shared inline reference projection from `ui-primitives` (wire session forms fold to their label) and show local or durable images and files in original attachment order. Images use thumbnails; files use compact name-and-size cards. An edit exposes the literal sent text, and durable thumbnails resolve through the session image URL cache. Busy Enter behavior is stored in the Host-backed `ui-conversation` settings namespace. The composer keymap arbitrates the trigger menu's keys through the slash pipeline — Tab settles the highlighted completion (or drills a drillable one), Escape and Shift+Tab leave the menu without settling — and leaves every other key to the editor. An overlay that takes the keyboard hands it back through `SessionInput.focus()`, which rides Lexical's own focus so the caret returns where the draft left it rather than at the start.
|
||||
The resident composer survives no-Session and Session transitions. Whitespace hides its placeholder; a whitespace-only draft without attachments cannot be sent. The no-Session state keeps the same composer surface mounted but inert while the Workspace picker connects a blank Session. The surface is a shell-owned Lexical editor: reference chips are atomic decorator nodes carrying the owner's serialization identity (submission expands them through the owner codec), claimed slash commands stay styled leading text, folder text references carry the folder glyph as an icon prefix, and the draft's clipboard projection is mirrored into the per-Session Conversation store. QueueDock reads `next-turn` directly from the Session `inbox` projection, including cold recovered messages. Queue operations address exact queue occurrences through the scoped `ctx.conversation` service; queue previews render sent text through the shared inline reference projection from `ui-primitives` (wire session forms fold to their label) and show local or durable images and files in original attachment order. Images use thumbnails; files use compact name-and-size cards. An edit exposes the literal sent text in a textarea that grows with its content, so line breaks survive re-editing; Enter saves, Shift+Enter breaks the line, and Escape cancels. Durable thumbnails resolve through the session image URL cache. Busy Enter behavior is stored in the Host-backed `ui-conversation` settings namespace. The composer keymap arbitrates the trigger menu's keys through the slash pipeline — Tab settles the highlighted completion (or drills a drillable one), Escape and Shift+Tab leave the menu without settling — and leaves every other key to the editor. An overlay that takes the keyboard hands it back through `SessionInput.focus()`, which rides Lexical's own focus so the caret returns where the draft left it rather than at the start.
|
||||
|
||||
Default sends commit optimistically: Enter clears the draft, occurrence table, and undo history in the same transaction, keeps the composer in `plain`, and runs the send as a detached attempt, so typing and further sends continue during the flight. `sendSession` registers a Session submission echo (`session.beginSubmission`) with the delivery mode before serializing, preserving selected image and file order in `pendingSubmissions`; Session derives the placement from that mode and its current running state, so idle sends use the transcript, busy Queue sends use QueueDock, and busy Steer sends use the pending-steering surface. It then yields one paint, encodes images through the browser's native `FileReader` data-URL path, and cites staged file receipts. Command submissions use the same receipts for generic files, so sending `/goal` or `/plan` never reads those browser files again. The prompt reuses the submission `requestId`; queue and history observation by that `rpcId` retires the echo once. Concurrent failures are restored together in submission order until the user edits the restored content; command submissions keep the frozen `submitting` phase. Detached attempts retain their attachment ids through admission and Session scope disposal. An observed retirement immediately exposes each image preview through the durable cache, replaces it with the canonical URL after fetching the admitted attachment, revokes each URL after its use ends, and releases file cards. Selected generic files enter one FIFO background-upload queue; `maxConcurrentFileUploads` defaults to two active Worker transports, the Conversation service retains queued and active operations plus byte progress across Session navigation, and removing a draft skips its queued transfer or aborts its active transport. Where the browser shell exposes `__DSH_HOST_PATHS__` (the Desktop application), dropped or pasted folders and dropped, picked, or pasted non-image files with a real path become `@path` chips; images keep uploading. Drag-and-drop and paste identify directories through the browser entry API; when that API is absent or returns no entry, pasted items retain ordinary file handling. The file picker cannot select directories. References require the `ui-reference` plugin and the original paths to remain readable by the model's file tools. Paths inside the workspace are relative; others remain absolute. The whole batch is validated before insertion, retains source order and selected text, and uses whitespace-separated, closed-quote mentions. A browser without the bridge refuses dropped or pasted folders; a Desktop folder without a reported path is rejected separately. Continuable subagents disable attachment intake and skip local echoes because their transport does not preserve the browser request id.
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ Session 首次绑定或缓存的 Session 成为 current 时,shell 会在渲染
|
||||
|
||||
宽度拖拽条的指示线只在已捕获指针的拖拽期间跟随指针,普通悬停不改变其位置。
|
||||
|
||||
常驻 composer 在无 Session 与有 Session 之间保持挂载。输入空白字符会隐藏占位提示;没有附件的纯空白草稿无法发送。无 Session 时,同一个编辑器表面保持 inert,Workspace picker 连接 blank Session。该表面是 shell 所有的 Lexical 编辑器:引用 chip 是携带 owner 序列化身份的原子 decorator 节点(提交时经 owner codec 展开),已认领的 slash command 保持为带样式的行首文本,文件夹文本引用以图标前缀携带文件夹图形,草稿的剪贴板投影镜像到逐 Session Conversation store。QueueDock 直接从 Session 的 `inbox` 投影读取 `next-turn`,包含从冷状态恢复的消息。Queue 操作通过 scoped `ctx.conversation` service 寻址准确的 queue occurrence;queue 预览经 `ui-primitives` 的共享行内引用投影渲染已发送文本(wire 会话形式折叠为其标签),并按原始附件顺序展示本地或持久化的图片和文件。图片使用缩略图,文件使用紧凑的名称与大小卡片。编辑态展示字面发送文本,持久化缩略图通过会话图片 URL 缓存解析。繁忙时 Enter 行为保存在 Host-backed `ui-conversation` settings namespace。 composer 键盘映射经斜杠流水线裁决触发菜单的按键——Tab 确认高亮补全项(可下钻项则下钻),Escape 与 Shift+Tab 离开菜单且不选定——其余按键交给编辑器自身。 接管键盘的浮层通过 `SessionInput.focus()` 把键盘还回来,该路径走 Lexical 自己的 focus,因此光标回到草稿原来的位置而不是开头。
|
||||
常驻 composer 在无 Session 与有 Session 之间保持挂载。输入空白字符会隐藏占位提示;没有附件的纯空白草稿无法发送。无 Session 时,同一个编辑器表面保持 inert,Workspace picker 连接 blank Session。该表面是 shell 所有的 Lexical 编辑器:引用 chip 是携带 owner 序列化身份的原子 decorator 节点(提交时经 owner codec 展开),已认领的 slash command 保持为带样式的行首文本,文件夹文本引用以图标前缀携带文件夹图形,草稿的剪贴板投影镜像到逐 Session Conversation store。QueueDock 直接从 Session 的 `inbox` 投影读取 `next-turn`,包含从冷状态恢复的消息。Queue 操作通过 scoped `ctx.conversation` service 寻址准确的 queue occurrence;queue 预览经 `ui-primitives` 的共享行内引用投影渲染已发送文本(wire 会话形式折叠为其标签),并按原始附件顺序展示本地或持久化的图片和文件。图片使用缩略图,文件使用紧凑的名称与大小卡片。编辑态在可随内容增高的 textarea 中展示字面发送文本,因此重新编辑不会丢失换行;Enter 保存,Shift+Enter 换行,Escape 取消。持久化缩略图通过会话图片 URL 缓存解析。繁忙时 Enter 行为保存在 Host-backed `ui-conversation` settings namespace。 composer 键盘映射经斜杠流水线裁决触发菜单的按键——Tab 确认高亮补全项(可下钻项则下钻),Escape 与 Shift+Tab 离开菜单且不选定——其余按键交给编辑器自身。 接管键盘的浮层通过 `SessionInput.focus()` 把键盘还回来,该路径走 Lexical 自己的 focus,因此光标回到草稿原来的位置而不是开头。
|
||||
|
||||
默认发送采用乐观提交:Enter 在同一事务里清空草稿、occurrence 表和撤销历史,composer 保持 `plain`,发送作为 detached attempt 运行,发送期间可以继续输入和提交。`sendSession` 在序列化之前用投递模式注册 Session 提交回显(`session.beginSubmission`),并在 `pendingSubmissions` 中保留图片与文件的选择顺序;Session 根据该模式与当前运行状态推导位置,因此空闲发送进入 transcript(文本记录),繁忙时 Queue 进入 QueueDock,繁忙时 Steer 进入 pending-steering 区域。随后让出一帧,图片经浏览器原生 `FileReader` data-URL 路径编码,文件则引用已暂存凭证。命令提交也用同一凭证表示通用文件,因此发送 `/goal` 或 `/plan` 时不会再次读取这些浏览器文件。提示词复用提交 `requestId`;queue 或历史以同一 `rpcId` 被观察后,回显只退休一次。多个并发发送失败时,在用户编辑还原内容之前按提交顺序合并还原;命令提交保持冻结的 `submitting` 阶段。Detached attempt 持有附件 id,直到 admission 完成或 Session scope 销毁。回显以 observed 退休时,durable 图片缓存立即公开每个预览 URL,读取 admitted 附件后用规范化 URL 替换预览,并在各 URL 停止使用后撤销,同时释放文件卡。选中的通用文件进入同一个先进先出的后台上传队列;`maxConcurrentFileUploads` 默认允许两个 Worker transport 同时运行,Conversation 服务在切换 Session 时继续持有排队和运行中的传输操作及字节进度,移除草稿会跳过排队中的传输或中止正在运行的传输。浏览器 shell 暴露 `__DSH_HOST_PATHS__` 时(桌面应用),拖入或粘贴的文件夹以及拖入、选择或粘贴的带真实路径的非图片文件会成为 `@路径` chip;图片仍然上传。拖放和粘贴通过浏览器 entry API 识别目录;该 API 不可用或没有返回 entry 时,粘贴项沿用普通文件处理。文件选择器不能选择目录。引用需要启用 `ui-reference` 插件,原路径也必须仍可由模型的文件工具读取。工作区内的路径使用相对形式,其他路径保留绝对形式。整批文件先校验再插入,保留来源顺序和已选中的文字,引用之间有空白分隔,含空格的路径使用闭合引号。没有该桥的浏览器会拒绝拖入或粘贴的文件夹,桌面端无法获取文件夹路径时单独报错。continuable 子代理禁用附件入口,也不创建本地回显,因为其 transport 不保留浏览器 request id。
|
||||
|
||||
|
||||
@@ -124,7 +124,8 @@
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
height: 36px;
|
||||
/* Grows with the inline editor's content; the other rows stay 36px. */
|
||||
min-height: 36px;
|
||||
padding: 4px 5px 4px 12px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
@@ -211,13 +212,17 @@
|
||||
|
||||
.editor {
|
||||
box-sizing: border-box;
|
||||
height: 28px;
|
||||
padding: 0 8px;
|
||||
min-height: 28px;
|
||||
/* Six 20px text lines plus padding and border, then the editor scrolls. */
|
||||
max-height: 127px;
|
||||
padding: 3px 8px;
|
||||
border: 0.5px solid var(--dsw-alias-border-l4);
|
||||
border-radius: 6px;
|
||||
outline: none;
|
||||
background: var(--dsw-alias-bg-base);
|
||||
color: var(--dsw-alias-label-primary);
|
||||
overflow-y: auto;
|
||||
resize: none;
|
||||
}
|
||||
|
||||
.editor:focus {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Context } from '@deepseek-ai/cordis'
|
||||
import { useEffect, useId, useMemo, useState } from 'react'
|
||||
import { useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from 'react'
|
||||
import type { FileAttachmentRef, ImageAttachmentRef } from '@deepseek-ai/dsh-attachment'
|
||||
import type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
|
||||
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
||||
@@ -98,6 +98,53 @@ function QueueThumb({ attachment, loadImage, label }: {
|
||||
: <img className={css.thumb} src={url} alt={label} />
|
||||
}
|
||||
|
||||
/**
|
||||
* Inline editor for one queued row. A textarea rather than an input: HTML
|
||||
* strips newlines from single-line input values, so editing a multi-line
|
||||
* queued message through one rewrites it as a single line. It grows with its
|
||||
* content up to the CSS cap, then scrolls. Enter saves, Shift+Enter breaks the
|
||||
* line, Escape cancels.
|
||||
*/
|
||||
function QueueEditor({ text, label, onChange, onSave, onCancel }: {
|
||||
text: string
|
||||
label: string
|
||||
onChange: (text: string) => void
|
||||
onSave: () => void
|
||||
onCancel: () => void
|
||||
}) {
|
||||
const ref = useRef<HTMLTextAreaElement>(null)
|
||||
|
||||
useLayoutEffect(() => {
|
||||
const node = ref.current
|
||||
/* v8 ignore next -- the ref is attached before layout effects run. */
|
||||
if (node === null) return
|
||||
node.style.height = 'auto'
|
||||
// scrollHeight excludes the border that the border-box height includes.
|
||||
node.style.height = `${node.scrollHeight + node.offsetHeight - node.clientHeight}px`
|
||||
}, [text])
|
||||
|
||||
return (
|
||||
<textarea
|
||||
ref={ref}
|
||||
autoFocus
|
||||
rows={1}
|
||||
className={css.editor}
|
||||
aria-label={label}
|
||||
value={text}
|
||||
onChange={(event) => { onChange(event.currentTarget.value) }}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key === 'Escape') {
|
||||
onCancel()
|
||||
return
|
||||
}
|
||||
if (event.key !== 'Enter' || event.shiftKey || event.nativeEvent.isComposing) return
|
||||
event.preventDefault()
|
||||
onSave()
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
/** Full props of a dock entry: InputZone owner share + session standard kit + global seat + the locale seat. */
|
||||
export type QueueDockProps = PropsRuntime<'conversation.input.dock'> & QueueDockInjected & PropsLocale<'conversation'>
|
||||
|
||||
@@ -195,22 +242,12 @@ export function QueueDock({ useSession, useProjection, updateQueue, notify, load
|
||||
{rowCount === 1 && <span className={css.lead} aria-hidden><IconQueueOutlineRegular /></span>}
|
||||
{editing?.id === row.id
|
||||
? (
|
||||
<input
|
||||
autoFocus
|
||||
className={css.editor}
|
||||
aria-label={t('queue.edit')}
|
||||
value={editing.text}
|
||||
onChange={(event) => { setEditing({ id: row.id, text: event.currentTarget.value }) }}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key === 'Escape') {
|
||||
setEditing(null)
|
||||
return
|
||||
}
|
||||
if (event.key === 'Enter' && !event.nativeEvent.isComposing) {
|
||||
event.preventDefault()
|
||||
void saveEdit()
|
||||
}
|
||||
}}
|
||||
<QueueEditor
|
||||
text={editing.text}
|
||||
label={t('queue.edit')}
|
||||
onChange={(text) => { setEditing({ id: row.id, text }) }}
|
||||
onSave={() => { void saveEdit() }}
|
||||
onCancel={() => { setEditing(null) }}
|
||||
/>
|
||||
)
|
||||
: (
|
||||
|
||||
@@ -198,7 +198,7 @@ describe('QueueDock', () => {
|
||||
expect((view.getByRole('button', { name }) as HTMLButtonElement).disabled).toBe(false)
|
||||
}
|
||||
fireEvent.click(view.getByRole('button', { name: '编辑排队消息' }))
|
||||
expect((view.getByRole('textbox') as HTMLInputElement).value).toBe('等待上传')
|
||||
expect((view.getByRole('textbox') as HTMLTextAreaElement).value).toBe('等待上传')
|
||||
})
|
||||
|
||||
it('loads the durable thumbnail after replacing a local image echo', async () => {
|
||||
@@ -369,7 +369,35 @@ describe('QueueDock', () => {
|
||||
const view = render(<QueueDock {...kitFor(snap)} useSession={source.useSession} useProjection={source.useProjection} />)
|
||||
expect(view.getByText(`before ${'🙂'.repeat(193)}…`)).toBeTruthy()
|
||||
fireEvent.click(view.getByLabelText('编辑排队消息'))
|
||||
expect((view.getByRole('textbox') as HTMLInputElement).value).toBe(text)
|
||||
expect((view.getByRole('textbox') as HTMLTextAreaElement).value).toBe(text)
|
||||
})
|
||||
|
||||
it('keeps line breaks while re-editing a multiline queued message', async () => {
|
||||
const text = 'line one\n line two\n\nline four'
|
||||
const snap = snapshotWith([row('i-lines', text)])
|
||||
const source = liveSession(snap)
|
||||
const updateQueue = vi.fn(() => Promise.resolve())
|
||||
const { getByLabelText } = render(
|
||||
<QueueDock {...kitFor(snap, { updateQueue })} useSession={source.useSession} useProjection={source.useProjection} />,
|
||||
)
|
||||
|
||||
fireEvent.click(getByLabelText('编辑排队消息'))
|
||||
const editor = getByLabelText('编辑排队消息') as HTMLTextAreaElement
|
||||
expect(editor.value).toBe(text)
|
||||
|
||||
// Shift+Enter keeps the native line break: the handler must not consume it.
|
||||
expect(fireEvent.keyDown(editor, { key: 'Enter', shiftKey: true })).toBe(true)
|
||||
expect(updateQueue).not.toHaveBeenCalled()
|
||||
|
||||
fireEvent.change(editor, { target: { value: `${text}\nline five` } })
|
||||
fireEvent.keyDown(editor, { key: 'Enter' })
|
||||
|
||||
await waitFor(() => {
|
||||
expect(updateQueue).toHaveBeenCalledWith(iid('i-lines'), {
|
||||
kind: 'edit',
|
||||
content: [{ type: 'text', text: `${text}\nline five` }],
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('renders active actions and disables editing for mixed-content rows', () => {
|
||||
@@ -477,7 +505,7 @@ describe('QueueDock', () => {
|
||||
)
|
||||
|
||||
fireEvent.click(getByLabelText('编辑排队消息'))
|
||||
const editor = getByLabelText('编辑排队消息') as HTMLInputElement
|
||||
const editor = getByLabelText('编辑排队消息') as HTMLTextAreaElement
|
||||
expect(getByLabelText('保存排队消息')).toBeTruthy()
|
||||
expect(getByLabelText('取消编辑')).toBeTruthy()
|
||||
expect(queryByLabelText('删除排队消息')).toBeNull()
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write packages/client/ui-primitives/README.md
|
||||
README.md: 51947fcbdec941a31ed0baa221fe36603dfc3702
|
||||
README.zh.md: 6ccb781026d66f56263dfa520fb5466e7bd118de
|
||||
README.md: 43476f2aa531decbe1eff1b6664530f7873723b4
|
||||
README.zh.md: 44f5c6e123bd7d6e861fec9554beb2fccf827927
|
||||
@@ -77,13 +77,13 @@ Writing your own component in your own package is fine when the need is genuinel
|
||||
|
||||
### Controls and icons
|
||||
|
||||
The catalog above lists what each export is for; this section covers the behavior that props alone do not show. Product icon names omit artboard sizes and end in `Regular` for the supplied one-pixel artwork or `Medium` for the same geometry at a 1.3px stroke; the `size` prop controls rendered dimensions ([decision](../../../.agents/notes/implemented/architecture/2026-09-16-size-neutral-product-icon-weights.md)). Each product, reference, link, and permission glyph intentionally keeps both weight exports even when the current product uses only one, so callers can choose emphasis without adding another API later; fill-only pairs render identically. `IconWarningOutlineRegular`/`Medium` use a circle; `IconWarningTriangleOutlineRegular`/`Medium` use a rounded triangle. `FishLogo` and `BrandWordmark` fill brand slots. `FileTypeIcon` renders the traditional 28px spreadsheet, folder, HTML, image, Markdown, generic, PDF, PPT, video, and Word glyphs, and uses the imported square technology artwork for the established 48 code and configuration categories. The import replaces artwork only: archive-only categories do not extend `CodeFileType`. `classifyFileType` applies exact filename, prefix, suffix, optional project-context, and extension rules in that order; React names win over TypeScript/JavaScript, Angular suffixes win over their base extension, and a Dart file becomes Flutter only when the supplied project files contain a `pubspec.yaml` with `flutter:`. Markdown and SVG remain traditional Markdown and image files. Spreadsheet mappings include CSV, TSV, Excel workbooks and templates, OpenDocument spreadsheets, and Numbers; KEY maps to slides, while RTF/ODT/Pages map to documents. `fileExtension` exposes the same basename and final-dot parsing for adjacent metadata labels. Traditional glyphs use a solid category-colored sheet with a white mark and translucent white corner; the generic file uses a grey sheet and darker grey corner. Callers may override the sheet color through `--dsh-file-type-icon-color`. The full-color technology artwork is the deliberate exception and retains its embedded palette. All glyphs are decorative and carry no label. `LinkIconMedium` is the leading glyph for clickable artifact links — globe, folder, code, image, document, or plain paper, and for a `url` link the mark of a well-known site named by its `href` — the developer sites a transcript usually cites (GitHub, GitLab, npm, PyPI, Stack Overflow, MDN, Wikipedia, Hacker News, YouTube, X, Bilibili, Zhihu, Juejin, CSDN) and mainstream search, video, social, shopping, and reference sites (Google, Baidu, DuckDuckGo, TikTok, Netflix, Spotify, Facebook, Instagram, Reddit, Telegram, WhatsApp, WeChat, QQ, Weibo, Taobao, AliExpress, eBay, Quora, V2EX, Apple) — while `classifyLinkPath` folds the shared file types into that existing six-category vocabulary. `ConnectionIndicator` renders a warning-colored disconnected action whose permanent retry glyph marks the retry action beside the owner-supplied outage label, the shared ongoing loader beside a label whose one-to-three dots advance every 500ms independently of retry timing, or a success-colored recovered status. Clicking either warning state requests an immediate reconnect; no hover interaction changes the copy. The pill fades in on appearance, fades out for 150ms before unmounting, and sizes to its current label. Its owner supplies visibility, the recovery hold, localized labels, and the immediate-reconnect callback; the primitive uses no native title tooltip. `useAnchoredPosition` and `useAnchoredMaxHeight` keep floating panels and bottom-anchored overlays clamped to the viewport and following their anchor; `useAnchoredMaxHeight` and portalled `Menu` widen their 12px top viewport margin to the frame's published `--dsh-frame-top-clearance`. `HoverCard` keeps its portaled preview reachable across the anchor gap and can expose a copy button through the `copyText` prop. Its `preview` variant uses the anchor or `widthAnchorRef` element’s width minus 48px, centers the panel with 24px side insets, and places it above or below the row within the viewport. The panel keeps the frame’s top clearance, caps its height at 420px, and follows content and anchor resizing; Escape or pointer and keyboard activation of the anchor dismisses it. The whole preview fades in and out over 100ms; a closing preview stops receiving pointer input and unmounts after the fade. Re-entering the anchor during the fade restores it. Reduced-motion preferences suppress the transition. Copy labels are required only when copying is enabled. `Toast` uses the owner's `holdMs` for both the fade delay and its hold-and-fade lifetime. Rerenders with unchanged `holdMs` do not restart that lifetime; completion uses the latest callback, and fully faded actions cannot receive input. A new component key restarts the banner. `rankByName` is the `/` menu's shared candidate ranker for the command and skill sources: the query must be a cLine truncated
|
||||
The catalog above lists what each export is for; this section covers the behavior that props alone do not show. Product icon names omit artboard sizes and end in `Regular` for the supplied one-pixel artwork or `Medium` for the same geometry at a 1.3px stroke; the `size` prop controls rendered dimensions ([decision](../../../.agents/notes/implemented/architecture/2026-09-16-size-neutral-product-icon-weights.md)). Each product, reference, link, and permission glyph intentionally keeps both weight exports even when the current product uses only one, so callers can choose emphasis without adding another API later; fill-only pairs render identically. `IconWarningOutlineRegular`/`Medium` use a circle; `IconWarningTriangleOutlineRegular`/`Medium` use a rounded triangle. `FishLogo` and `BrandWordmark` fill brand slots. `FileTypeIcon` renders the traditional 28px spreadsheet, folder, HTML, image, Markdown, generic, PDF, PPT, video, and Word glyphs, and uses the imported square technology artwork for the established 48 code and configuration categories. The import replaces artwork only: archive-only categories do not extend `CodeFileType`. `classifyFileType` applies exact filename, prefix, suffix, optional project-context, and extension rules in that order; React names win over TypeScript/JavaScript, Angular suffixes win over their base extension, and a Dart file becomes Flutter only when the supplied project files contain a `pubspec.yaml` with `flutter:`. Markdown and SVG remain traditional Markdown and image files. Spreadsheet mappings include CSV, TSV, Excel workbooks and templates, OpenDocument spreadsheets, and Numbers; KEY maps to slides, while RTF/ODT/Pages map to documents. `fileExtension` exposes the same basename and final-dot parsing for adjacent metadata labels. Traditional glyphs use a solid category-colored sheet with a white mark and translucent white corner; the generic file uses a grey sheet and darker grey corner. Callers may override the sheet color through `--dsh-file-type-icon-color`. The full-color technology artwork is the deliberate exception and retains its embedded palette. All glyphs are decorative and carry no label. `LinkIconMedium` is the leading glyph for clickable artifact links — globe, folder, code, image, document, or plain paper, and for a `url` link the mark of a well-known site named by its `href` — the developer sites a transcript usually cites (GitHub, GitLab, npm, PyPI, Stack Overflow, MDN, Wikipedia, Hacker News, YouTube, X, Bilibili, Zhihu, Juejin, CSDN) and mainstream search, video, social, shopping, and reference sites (Google, Baidu, DuckDuckGo, TikTok, Netflix, Spotify, Facebook, Instagram, Reddit, Telegram, WhatsApp, WeChat, QQ, Weibo, Taobao, AliExpress, eBay, Quora, V2EX, Apple) — while `classifyLinkPath` folds the shared file types into that existing six-category vocabulary. `ConnectionIndicator` renders a warning-colored disconnected action whose permanent retry glyph marks the retry action beside the owner-supplied outage label, the shared ongoing loader beside a label whose one-to-three dots advance every 500ms independently of retry timing, or a success-colored recovered status. Clicking either warning state requests an immediate reconnect; no hover interaction changes the copy. The pill fades in on appearance, fades out for 150ms before unmounting, and sizes to its current label. Its owner supplies visibility, the recovery hold, localized labels, and the immediate-reconnect callback; the primitive uses no native title tooltip. `useAnchoredPosition` and `useAnchoredMaxHeight` keep floating panels and bottom-anchored overlays clamped to the viewport and following their anchor; `useAnchoredMaxHeight` and portalled `Menu` widen their 12px top viewport margin to the frame's published `--dsh-frame-top-clearance`. `HoverCard` keeps its portaled preview reachable across the anchor gap and can expose a copy button through the `copyText` prop. Its `preview` variant uses the anchor or `widthAnchorRef` element’s width minus 48px, centers the panel with 24px side insets, and places it above or below the row within the viewport. The panel keeps the frame’s top clearance, caps its height at 420px, and follows content and anchor resizing; Escape or pointer and keyboard activation of the anchor dismisses it. The whole preview fades in and out over 100ms; a closing preview stops receiving pointer input and unmounts after the fade. Re-entering the anchor during the fade restores it. Reduced-motion preferences suppress the transition. Copy labels are required only when copying is enabled. `Toast` uses the owner's `holdMs` for both the fade delay and its hold-and-fade lifetime. Rerenders with unchanged `holdMs` do not restart that lifetime; completion uses the latest callback, and fully faded actions cannot receive input. A new component key restarts the banner. `rankByName` is the `/` menu's shared candidate ranker for the command and skill sources: the query must be a cLine truncated
|
||||
|
||||
### Rendering agent output
|
||||
|
||||
The nearest `MarkdownDelegateProvider` supplies optional `openExternalLink` and `openFile` navigation callbacks. Nested providers replace the enclosing capabilities, and callback changes reach already-rendered links without rebuilding Markdown. Its `openFile` makes local Markdown links clickable after settlement. Absolute and workspace-relative paths support percent escapes and `#L24` / `#L24-L30` fragments; ranges open at their first line. Literal `?` and `#` in filenames must be percent-encoded. The tooltip uses the decoded path and supplies the accessible name when the label is empty. The callback receives the decoded path and optional line, while the renderer preserves the label and displays a file icon. Without a callback, local links remain text. URL schemes, queries, unsupported fragments, and malformed destinations never reach the file opener.
|
||||
|
||||
`MarkdownText` renders untrusted GFM and TeX math, blocks unsafe links and images, and can turn resolved file mentions into explicit controls. A surrounding `MarkdownDelegateProvider` receives sanitized HTTP(S) URLs from ordinary clicks; modified clicks and links outside a provider retain native external-anchor behavior. When the owner passes a `pathImages` vocabulary, image destinations that are local media paths rewrite to displayable URLs on settled renders only (the same streaming gate as file mentions); without a vocabulary, local destinations remain inert alt text. A load or decode failure replaces the image with its authored alt text, or the original destination when alt is empty. Changing the image source permits a fresh load. While a reply streams, it freezes completed blocks, advances a top-level open fence by completed lines, and highlights that fence from saved Shiki grammar state. Completed token lines enter fixed-size React groups, so later chunks reconcile only the growing group; an unchanged fence retains that DOM when the final full parse resolves cross-document syntax. `TerminalBlock`, `ReadBlock`, `DiffBlock`, `SearchBlock`, and `WebBlock` render the matching tool-result intent with copy controls, overflow handling, and ANSI processing where applicable. `JsonTree` and `JsonBlock` inspect JSON values read-only, while `projectUserText` projects sent user text into inline plain runs and reference chips for the message bubble and queue rows. When supplied with `UserTextReferences`, file and skill references become keyboard-accessible preview buttons using the same hover and focus styling as prose file links; the first pointer click can open a preview, while subsequent clicks and existing text selections retain native selection handling. Keyboard activation opens previews even when text is selected.
|
||||
`MarkdownText` renders untrusted GFM and TeX math, blocks unsafe links and images, and can turn resolved file mentions into explicit controls. A surrounding `MarkdownDelegateProvider` receives sanitized HTTP(S) URLs from ordinary clicks; modified clicks and links outside a provider retain native external-anchor behavior. When the owner passes a `pathImages` vocabulary, image destinations that are local media paths rewrite to displayable URLs on settled renders only (the same streaming gate as file mentions); without a vocabulary, local destinations remain inert alt text. A load or decode failure replaces the image with its authored alt text, or the original destination when alt is empty. Changing the image source permits a fresh load. While a reply streams, it freezes completed blocks, advances a top-level open fence by completed lines, and highlights that fence from saved Shiki grammar state. Completed token lines enter fixed-size React groups, so later chunks reconcile only the growing group; an unchanged fence retains that DOM when the final full parse resolves cross-document syntax. `TerminalBlock`, `ReadBlock`, `DiffBlock`, `SearchBlock`, and `WebBlock` render the matching tool-result intent with copy controls, overflow handling, and ANSI processing where applicable. `JsonTree` and `JsonBlock` inspect JSON values read-only, while `projectUserText` projects sent user text into inline plain runs and reference chips for the message bubble and queue rows. Reference labels inherit the consumer’s wrapping policy: long names wrap within a bubble, while queue previews retain their single-line layout. When supplied with `UserTextReferences`, file and skill references become keyboard-accessible preview buttons using the same hover and focus styling as prose file links; the first pointer click can open a preview, while subsequent clicks and existing text selections retain native selection handling. Keyboard activation opens previews even when text is selected.
|
||||
|
||||
`MarkdownText` defaults to `variant="body"`. Use `variant="compact"` for secondary content: its 13px text and 20px line height follow the content-size setting, all heading levels use the same size with weight 600, and paragraphs and lists use tighter spacing. Text, links, and code keep the tertiary color; dotted underlines distinguish links. Code headers scroll with their blocks. Tables and math stay enabled at the surrounding text size and scroll horizontally within the available width. Both variants share the parser and streaming cache.
|
||||
|
||||
|
||||
@@ -77,13 +77,13 @@ kind: "package-library"
|
||||
|
||||
### 控件与图标
|
||||
|
||||
上面的目录说明每个导出的用途;本节讲 props 本身看不出来的行为。产品图标名称不含画板尺寸,以 `Regular` 表示原始 1px 图形,以 `Medium` 表示同一几何的 1.3px 描边;`size` prop 控制渲染尺寸([决定](../../../.agents/notes/implemented/architecture/2026-09-16-size-neutral-product-icon-weights.zh.md))。每个产品、引用、链接与权限图形都会有意保留两种线重导出,即使当前产品只使用其中一种,也让调用方无需再次扩展 API 就能选择强调程度;仅填充的成对图形外观相同。`IconWarningOutlineRegular`/`Medium` 使用圆形;`IconWarningTriangleOutlineRegular`/`Medium` 使用圆角三角形。`FishLogo` 与 `BrandWordmark` 填充品牌 slot。`FileTypeIcon` 渲染传统的 28px spreadsheet、folder、HTML、image、Markdown、generic、PDF、PPT、video 与 Word 图形,并为现有 48 个代码和配置类别使用导入的方形技术图形。该导入只替换图形:资源包中额外的类别不会扩展 `CodeFileType`。`classifyFileType` 按完整文件名、前缀、后缀、可选项目上下文、扩展名的顺序匹配;React 文件名优先于 TypeScript/JavaScript,Angular 后缀优先于基础扩展名,只有传入的项目文件包含带 `flutter:` 的 `pubspec.yaml` 时 Dart 文件才使用 Flutter。Markdown 与 SVG 仍分别使用传统 Markdown 与图片图形。表格映射包括 CSV、TSV、Excel 工作簿与模板、OpenDocument 表格和 Numbers;KEY 映射为幻灯片,RTF/ODT/Pages 映射为文档。`fileExtension` 为相邻元数据 label 暴露同一套 basename 与最终点号解析。传统图形使用实色分类底板、白色标记和半透明白色折角;通用文件使用灰色底板与较深灰色折角。调用方可通过 `--dsh-file-type-icon-color` 覆盖底板颜色。全彩技术图形是明确例外,会保留其内嵌调色板。所有图形都是装饰性的,不自带 label。`LinkIconMedium` 是可点击产物链接的前置图形——地球、文件夹、代码、图片、文档或纸张,`url` 链接的 `href` 指向已知站点时则改用该站点自己的标记——转写内容常引用的开发者站点(GitHub、GitLab、npm、PyPI、Stack Overflow、MDN、Wikipedia、Hacker News、YouTube、X、Bilibili、知乎、掘金、CSDN),以及主流搜索、视频、社交、购物与参考资料站点(Google、百度、DuckDuckGo、TikTok、Netflix、Spotify、Facebook、Instagram、Reddit、Telegram、WhatsApp、微信、QQ、微博、淘宝、速卖通、eBay、Quora、V2EX、Apple)——`classifyLinkPath` 把共享文件类型折叠进原有六类词汇。`ConnectionIndicator` 可渲染警告色的断联操作(常驻重试图形指明重试动作,断联文案由持有方提供)、共享 ongoing loading 加一至三个点以独立于 retry 时序的 500ms 节奏推进的连接中状态,或成功色的恢复状态。点击任一警告状态都会请求立即重连;没有任何悬停交互会改变文案。药丸出现时淡入、卸载前淡出 150ms,宽度随当前 label 自适应。它的持有方提供可见性、恢复驻留时间、本地化 label 与立即重连回调;该原语不使用原生 title tooltip。`useAnchoredPosition` 与 `useAnchoredMaxHeight` 让浮动面板与底部锚定浮层始终钳制在视口内并跟随锚点;`useAnchoredMaxHeight` 与 portal 模式的 `Menu` 会把 12px 的视口顶部边距加宽到框架发布的 `--dsh-frame-top-clearance`。`HoverCard` 通过指针离开宽限期让采用 portal 的预览在跨过锚点间隙时仍可触及,并可通过 `copyText` prop 提供复制按钮。其 `preview` 变体使用 anchor 或 `widthAnchorRef` 元素的宽度减去 48px,左右各内缩 24px,并在视口内放置于行的上方或下方。浮层避开框架顶部保留区,高度最多 420px,会跟随内容及 anchor 尺寸变化;Escape 或通过鼠标和键盘激活锚点可将其关闭。整个浮层的淡入和淡出各持续 100ms;关闭中的浮层停止接收指针输入,淡出后卸载。在淡出期间移回锚点可恢复显示。减少动态效果偏好会禁用过渡动画。只有启用复制时才必须提供复制标签。`Toast` 使用调用方的 `holdMs` 同时控制淡出延迟与停留加淡出的总时长。`holdMs` 未变时,父组件重渲染不会重启该生命周期;完成时调用最新回调,完全淡出的操作不能接收输入。新的组件 key 会重新开始横幅周期。`rankByName` 是 `/` 菜单命令源与 skill(技能)源共享的候选排序器:查询必须是名字的不区分大小写的有序子序列;前缀命中排最前,其次按对齐分数,再按来源顺序。 `Menu.autoFocus` 聚焦首个启用项,支持上下方向键与 Home/End 导航,并在 Escape 时聚焦 anchor 内的第一个按钮;操作菜单可显式启用。
|
||||
上面的目录说明每个导出的用途;本节讲 props 本身看不出来的行为。产品图标名称不含画板尺寸,以 `Regular` 表示原始 1px 图形,以 `Medium` 表示同一几何的 1.3px 描边;`size` prop 控制渲染尺寸([决定](../../../.agents/notes/implemented/architecture/2026-09-16-size-neutral-product-icon-weights.zh.md))。每个产品、引用、链接与权限图形都会有意保留两种线重导出,即使当前产品只使用其中一种,也让调用方无需再次扩展 API 就能选择强调程度;仅填充的成对图形外观相同。`IconWarningOutlineRegular`/`Medium` 使用圆形;`IconWarningTriangleOutlineRegular`/`Medium` 使用圆角三角形。`FishLogo` 与 `BrandWordmark` 填充品牌 slot。`FileTypeIcon` 渲染传统的 28px spreadsheet、folder、HTML、image、Markdown、generic、PDF、PPT、video 与 Word 图形,并为现有 48 个代码和配置类别使用导入的方形技术图形。该导入只替换图形:资源包中额外的类别不会扩展 `CodeFileType`。`classifyFileType` 按完整文件名、前缀、后缀、可选项目上下文、扩展名的顺序匹配;React 文件名优先于 TypeScript/JavaScript,Angular 后缀优先于基础扩展名,只有传入的项目文件包含带 `flutter:` 的 `pubspec.yaml` 时 Dart 文件才使用 Flutter。Markdown 与 SVG 仍分别使用传统 Markdown 与图片图形。表格映射包括 CSV、TSV、Excel 工作簿与模板、OpenDocument 表格和 Numbers;KEY 映射为幻灯片,RTF/ODT/Pages 映射为文档。`fileExtension` 为相邻元数据 label 暴露同一套 basename 与最终点号解析。传统图形使用实色分类底板、白色标记和半透明白色折角;通用文件使用灰色底板与较深灰色折角。调用方可通过 `--dsh-file-type-icon-color` 覆盖底板颜色。全彩技术图形是明确例外,会保留其内嵌调色板。所有图形都是装饰性的,不自带 label。`LinkIconMedium` 是可点击产物链接的前置图形——地球、文件夹、代码、图片、文档或纸张,`url` 链接的 `href` 指向已知站点时则改用该站点自己的标记——转写内容常引用的开发者站点(GitHub、GitLab、npm、PyPI、Stack Overflow、MDN、Wikipedia、Hacker News、YouTube、X、Bilibili、知乎、掘金、CSDN),以及主流搜索、视频、社交、购物与参考资料站点(Google、百度、DuckDuckGo、TikTok、Netflix、Spotify、Facebook、Instagram、Reddit、Telegram、WhatsApp、微信、QQ、微博、淘宝、速卖通、eBay、Quora、V2EX、Apple)——`classifyLinkPath` 把共享文件类型折叠进原有六类词汇。`ConnectionIndicator` 可渲染警告色的断联操作(常驻重试图形指明重试动作,断联文案由持有方提供)、共享 ongoing loading 加一至三个点以独立于 retry 时序的 500ms 节奏推进的连接中状态,或成功色的恢复状态。点击任一警告状态都会请求立即重连;没有任何悬停交互会改变文案。药丸出现时淡入、卸载前淡出 150ms,宽度随当前 label 自适应。它的持有方提供可见性、恢复驻留时间、本地化 label 与立即重连回调;该原语不使用原生 title tooltip。`useAnchoredPosition` 与 `useAnchoredMaxHeight` 让浮动面板与底部锚定浮层始终钳制在视口内并跟随锚点;`useAnchoredMaxHeight` 与 portal 模式的 `Menu` 会把 12px 的视口顶部边距加宽到框架发布的 `--dsh-frame-top-clearance`。`HoverCard` 通过指针离开宽限期让采用 portal 的预览在跨过锚点间隙时仍可触及,并可通过 `copyText` prop 提供复制按钮。其 `preview` 变体使用 anchor 或 `widthAnchorRef` 元素的宽度减去 48px,左右各内缩 24px,并在视口内放置于行的上方或下方。浮层避开框架顶部保留区,高度最多 420px,会跟随内容及 anchor 尺寸变化;Escape 或通过鼠标和键盘激活锚点可将其关闭。整个浮层的淡入和淡出各持续 100ms;关闭中的浮层停止接收指针输入,淡出后卸载。在淡出期间移回锚点可恢复显示。减少动态效果偏好会禁用过渡动画。只有启用复制时才必须提供复制标签。`Toast` 使用调用方的 `holdMs` 同时控制淡出延迟与停留加淡出的总时长。`holdMs` 未变时,父组件重渲染不会重启该生命周期;完成时调用最新回调,完全淡出的操作不能接收输入。新的组件 key 会重新开始横幅周期。`rankByName` 是 `/` 菜单命令源与 skill(技能)源共享的候选排序器:查询必须是名字的不区分大小写的有序子序列;前缀命中排最前,其次按对齐分数,再按来源顺序。 portal 模式的 `Menu` 列表会在拖动和 CSS 变换期间跟随锚点,并在关闭时停止跟踪。`Menu.autoFocus` 聚焦首个启用项,支持上下方向键与 Home/End 导航,并在 Escape 时聚焦 anchor 内的第一Line truncated
|
||||
|
||||
### 渲染 agent 输出
|
||||
|
||||
最近的 `MarkdownDelegateProvider` 提供可选的 `openExternalLink` 和 `openFile` 导航回调。嵌套 Provider 替换外层能力,回调变化无需重新构建 Markdown 即可到达已渲染链接。其 `openFile` 使本地 Markdown 链接在落定后可点击。绝对路径和工作区相对路径支持百分号转义以及 `#L24` / `#L24-L30` 片段;范围定位到起始行。文件名中的字面 `?` 和 `#` 必须百分号编码。悬停提示使用解码后的路径,并在标签为空时提供可访问名称。回调接收解码后的路径和可选行号,渲染器保留标签并显示文件图标。不传回调时,本地链接仍为文本。URL 协议、查询串、不支持的片段及格式错误的目标不会传给文件打开器。
|
||||
|
||||
`MarkdownText` 渲染不可信的 GFM 与 TeX 公式、阻止不安全的链接与图片,并可把已解析的文件提及转换为显式控件。外层 `MarkdownDelegateProvider` 会接收普通点击产生的已净化 HTTP(S) URL;带修饰键的点击和 Provider 外的链接保留原生外部 anchor 行为。当 owner 传入 `pathImages` 词表时,本地媒体路径的图片目标只在落定渲染阶段重写为可展示 URL(与 file mentions 相同的流式门);不传词表时本地目标保持惰性 alt 文本。加载或解码失败后,图片替换为作者的 alt 文本;alt 为空时显示原始目标路径。图片源变化后可重新加载。回复流式输出时,它冻结已完成的块、按已完成行推进顶层未闭合 fence,并从保存的 Shiki grammar state 为该 fence 增量高亮。已完成的 token 行进入固定大小的 React 分组,后续分片只 reconcile 正在增长的分组;最终全量解析解决跨文档语法时,未变化的 fence 会保留该 DOM。`TerminalBlock`、`ReadBlock`、`DiffBlock`、`SearchBlock` 与 `WebBlock` 把对应的工具结果意图渲染为带复制控件、溢出处理及适用时 ANSI 处理的卡片。`JsonTree` 与 `JsonBlock` 以只读方式检查 JSON 值;`projectUserText` 把已发送的用户文本投影为行内普通文本段与引用 chip,供消息气泡和排队行使用。 传入 `UserTextReferences` 时,文件和 skill 引用成为支持键盘操作的预览按钮,复用正文文件链接的悬停和聚焦样式;第一次指针点击可以打开预览,后续点击和已有选区保留原生选择行为。键盘激活在存在选区时仍可打开预览。
|
||||
`MarkdownText` 渲染不可信的 GFM 与 TeX 公式、阻止不安全的链接与图片,并可把已解析的文件提及转换为显式控件。外层 `MarkdownDelegateProvider` 会接收普通点击产生的已净化 HTTP(S) URL;带修饰键的点击和 Provider 外的链接保留原生外部 anchor 行为。当 owner 传入 `pathImages` 词表时,本地媒体路径的图片目标只在落定渲染阶段重写为可展示 URL(与 file mentions 相同的流式门);不传词表时本地目标保持惰性 alt 文本。加载或解码失败后,图片替换为作者的 alt 文本;alt 为空时显示原始目标路径。图片源变化后可重新加载。回复流式输出时,它冻结已完成的块、按已完成行推进顶层未闭合 fence,并从保存的 Shiki grammar state 为该 fence 增量高亮。已完成的 token 行进入固定大小的 React 分组,后续分片只 reconcile 正在增长的分组;最终全量解析解决跨文档语法时,未变化的 fence 会保留该 DOM。`TerminalBlock`、`ReadBlock`、`DiffBlock`、`SearchBlock` 与 `WebBlock` 把对应的工具结果意图渲染为带复制控件、溢出处理及适用时 ANSI 处理的卡片。`JsonTree` 与 `JsonBlock` 以只读方式检查 JSON 值;`projectUserText` 把已发送的用户文本投影为行内普通文本段与引用 chip,供消息气泡和排队行使用。引用名称继承调用方的换行规则:长名称在气泡内换行,排队预览保持单行布局。传入 `UserTextReferences` 时,文件和 skill 引用成为支持键盘操作的预览按钮,复用正文文件链接的悬停和聚焦样式;第一次指针点击可以打开预览,后续点击和已有选区保留原生选择行为。键盘激活在存在选区时仍可打开预览。
|
||||
|
||||
`MarkdownText` 默认为 `variant="body"`。次级内容使用 `variant="compact"`:其 13px 字号与 20px 行高跟随内容字号设置,各级标题保持同一字号并使用 600 字重,段落与列表采用更紧凑的间距。正文、链接和代码均保持 tertiary 颜色,以点状下划线区分链接。代码标题栏随代码块滚动。表格和公式仍然启用,使用周围文字的字号,并在可用宽度内横向滚动。两个变体共享解析器与流式缓存。
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ const MEASURE_STYLE: CSSProperties = { visibility: 'hidden', left: 0, top: 0 }
|
||||
* @param props.align - list alignment against the anchor (default 'start').
|
||||
* @param props.side - open below (`bottom`, default) or above (`top`) the anchor.
|
||||
* @param props.portal - render the list into document.body, fixed-positioned
|
||||
* from the anchor rect (repositions on scroll/resize while open). Use when an
|
||||
* from the anchor rect (follows movement and resizing while open). Use when an
|
||||
* ancestor's overflow clipping would crop the in-place list; default false
|
||||
* keeps the pure-CSS in-place behavior.
|
||||
* @param props.closeOnPointerLeave - close the list once the pointer has left
|
||||
@@ -135,8 +135,8 @@ const MEASURE_STYLE: CSSProperties = { visibility: 'hidden', left: 0, top: 0 }
|
||||
* directly (e.g. from a host-owned trigger button) instead of measuring the
|
||||
* Menu's own wrapper span. Required when the wrapper isn't itself laid out at
|
||||
* the trigger (render-prop anchors, effect-positioned proxies — measuring the
|
||||
* wrapper there races the host's layout effects). Called on open and on every
|
||||
* scroll/resize; return null to skip placement for that frame.
|
||||
* wrapper there races the host's layout effects). Called on open, each animation
|
||||
* frame, and scroll/resize; return null to skip placement for that frame.
|
||||
* @param props.footer - rows pinned below the scrolling items area, separated
|
||||
* by a hairline; they stay visible while the items above scroll.
|
||||
* @param props.children - component rows rendered after `items` in the same
|
||||
@@ -260,15 +260,22 @@ export function Menu({ open, anchor, items = [], children, selectedId, selectedI
|
||||
if (lw > 0) x = Math.min(Math.max(x, MARGIN), vw - lw - MARGIN)
|
||||
if (lh > 0) y = Math.min(Math.max(y, overlayTopMargin(MARGIN)), vh - lh - MARGIN)
|
||||
|
||||
setFixedPos({ left: x, top: y })
|
||||
setFixedPos(current => current?.left === x && current.top === y ? current : { left: x, top: y })
|
||||
}
|
||||
// First run measures the hidden pre-render (same commit as `open`), so
|
||||
// end/top alignment and clamping use real dimensions before anything
|
||||
// paints — no visible jump from a zero-size first guess.
|
||||
place()
|
||||
// Dragging or transforming an ancestor moves the anchor without a scroll or resize event.
|
||||
const track = () => {
|
||||
place()
|
||||
frame = requestAnimationFrame(track)
|
||||
}
|
||||
let frame = requestAnimationFrame(track)
|
||||
window.addEventListener('scroll', place, true)
|
||||
window.addEventListener('resize', place)
|
||||
return () => {
|
||||
cancelAnimationFrame(frame)
|
||||
window.removeEventListener('scroll', place, true)
|
||||
window.removeEventListener('resize', place)
|
||||
}
|
||||
|
||||
@@ -14,10 +14,13 @@
|
||||
chip's label rode ~3px above the surrounding text in both surfaces. An
|
||||
inline chip shares the consumer's baseline by construction. */
|
||||
display: inline;
|
||||
max-width: 100%;
|
||||
margin: 0 2px;
|
||||
color: var(--dsw-alias-state-business-primary);
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
white-space: inherit;
|
||||
overflow-wrap: anywhere;
|
||||
text-align: inherit;
|
||||
}
|
||||
|
||||
/* Skill and command tokens read as code: the theme's code family at the
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* Display projection of reference forms in sent user text (bubble and queue
|
||||
* rows). The logged model text remains the single truth; this is presentation
|
||||
* only, and every part renders inline so a single-line message never breaks
|
||||
* across lines. Four decoration sources, by precedence: the wire session form
|
||||
* only. Inline references follow the consumer's wrapping policy and keep long
|
||||
* labels within its width. Four decoration sources, by precedence: the wire session form
|
||||
* `@[label](dsh-session:...)` folds to its label; exact session labels
|
||||
* supplied by an adjacent recall decorate their bare `@label` mention; plain
|
||||
* `@name` word-boundary tokens decorate by shape alone; and a plain `/name`
|
||||
|
||||
@@ -493,6 +493,34 @@ describe('Menu', () => {
|
||||
expect(screen.queryByRole('menu')).toBeNull()
|
||||
})
|
||||
|
||||
it('follows an anchor moving without scroll or resize and stops tracking when closed or unmounted', () => {
|
||||
vi.useFakeTimers({ toFake: ['requestAnimationFrame', 'cancelAnimationFrame'] })
|
||||
let rect = new DOMRect(40, 100, 32, 28)
|
||||
const getAnchorRect = vi.fn(() => rect)
|
||||
const props = { portal: true, anchor: null, items, getAnchorRect, onClose: () => {} }
|
||||
try {
|
||||
const view = render(<Menu {...props} open />)
|
||||
rect = new DOMRect(140, 180, 32, 28)
|
||||
act(() => { vi.advanceTimersToNextFrame() })
|
||||
expect(screen.getByRole('menu').style.left).toBe('140px')
|
||||
expect(screen.getByRole('menu').style.top).toBe('212px')
|
||||
|
||||
view.rerender(<Menu {...props} open={false} />)
|
||||
getAnchorRect.mockClear()
|
||||
act(() => { vi.advanceTimersToNextFrame() })
|
||||
expect(getAnchorRect).not.toHaveBeenCalled()
|
||||
|
||||
view.rerender(<Menu {...props} open />)
|
||||
view.unmount()
|
||||
getAnchorRect.mockClear()
|
||||
act(() => { vi.advanceTimersToNextFrame() })
|
||||
expect(getAnchorRect).not.toHaveBeenCalled()
|
||||
} finally {
|
||||
cleanup()
|
||||
vi.useRealTimers()
|
||||
}
|
||||
})
|
||||
|
||||
it('portal mode renders the list under body, positions it fixed, and still closes on outside pointerdown', () => {
|
||||
const onSelect = vi.fn()
|
||||
const onClose = vi.fn()
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
// @vitest-environment jsdom
|
||||
/**
|
||||
* Inline projection of sent user text: decoration never breaks a single-line
|
||||
* message (bubble regression), and wire session forms fold to their label
|
||||
* (queue-row readability).
|
||||
* Inline projection of sent user text: decoration adds no block containers,
|
||||
* preserves whitespace, and folds wire session forms to their label.
|
||||
*/
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { fireEvent, render } from '@testing-library/react'
|
||||
@@ -17,7 +16,7 @@ const project = (
|
||||
render(<div data-host>{projectUserText(text, labels, slashNames, slashKind)}</div>).container.querySelector('[data-host]')!
|
||||
|
||||
describe('projectUserText', () => {
|
||||
it('keeps a decorated single-line message on one line: every part is inline', () => {
|
||||
it('keeps decorated text inline and preserves whitespace between references', () => {
|
||||
const host = project('反反复复 /dsh-acp-test @执行几个命令测试', ['执行几个命令测试'], ['dsh-acp-test'])
|
||||
expect(host.querySelectorAll('div').length).toBe(0)
|
||||
expect(host.textContent).toBe('反反复复 /dsh-acp-test 执行几个命令测试')
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write packages/client/ui-settings-general/README.md
|
||||
README.md: 266fe837899f13d33e7a098b901cc34402da765e
|
||||
README.zh.md: 09570948b89089dda33d6705e4f17c7cd2f8481c
|
||||
README.md: 36d3fd7b260f95cffb67977e5a6f37852bf195aa
|
||||
README.zh.md: 9df8fe8bc3a39fceeccfc8b08a8e18cc5eeaf752
|
||||
@@ -31,7 +31,7 @@ Users reach the shell through the sidebar's bottom Settings control; feature plu
|
||||
|
||||
When the section navigation exceeds the panel's available height, the list scrolls independently of the settings content and keeps the Settings title fixed.
|
||||
|
||||
In Desktop, the account-row update control shows availability, progress, verification, readiness, and persistent retry feedback. The preload carries semantic phase, version, progress, and classified failures; the component resolves every visible and accessible string from the active `settings` locale, including after an in-application language change. Selecting an available update starts downloading; installation requires a separate shell-owned confirmation. A collapsed sidebar shows the same status as a dot on its top expand button. Connection feedback takes priority except during shell-reported installation, when the expected backend disconnect must not hide update status. Failure restores connection feedback. Both controls share one carrier subscription; browser code cannot choose packages or authorize installation. [Desktop updates](../../../apps/desktop/README.md) owns the release workflow.
|
||||
In Desktop, the account-row update control shows availability, progress, verification, readiness, and persistent retry feedback. It shares the connection indicator’s 28px height, 13px corners, 14px icon slot, 4px icon gap, and 12px medium text with an 18px line height; update-state border, fill, and text colors remain independently defined. Retry text and its dot use the same brand blue as other update labels; numeric download progress has no ellipsis. The preload carries semantic phase, version, progress, and classified failures; the component resolves every visible and accessible string from the active `settings` locale, including after an in-application language change. Selecting an available update starts downloading; installation requires a separate shell-owned confirmation. A collapsed sidebar shows the same status as a brand-blue dot on its top expand button, including failures. Connection feedback takes priority except during shell-reported installation, when the expected backend disconnect must not hide update status. Failure restores connection feedback. Both controls share one carrier subscription; browser code cannot choose packages or authorize installation. [Desktop updates](../../../apps/desktop/README.md) owns the release workflow.
|
||||
|
||||
### The General section
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ kind: "package-reference"
|
||||
|
||||
当分区导航超出面板可用高度时,列表独立于设置内容滚动,并保持「设置」标题固定。
|
||||
|
||||
在 Desktop 中,账户行更新控件显示可用版本、进度、验证、就绪和持久重试反馈。预加载仅传递语义化阶段、版本、进度和失败类别;组件从当前 `settings` locale 解析全部可见与无障碍文案,并在应用内语言变化后同步更新。选择可用更新即开始下载;安装需要独立的壳拥有的确认。侧栏收起时,其顶部展开按钮以圆点显示相同状态。连接反馈通常优先展示,但壳报告正在安装时,预期的后端断开不能遮盖更新状态;失败后恢复连接反馈。两个控件共用一次载体订阅;浏览器代码不能选择安装包或授权安装。[Desktop 更新](../../../apps/desktop/README.zh.md)负责发布流程。
|
||||
在 Desktop 中,账户行更新控件显示可用版本、进度、验证、就绪和持久重试反馈。它与连接指示器共用 28px 高度、13px 圆角、14px 图标占位、4px 图文间距,以及 12px 中等字重文字和 18px 行高;更新状态的边框、填充和文字颜色独立定义。重试文字及其圆点与其他更新文案使用相同的品牌蓝色;数字下载进度不带省略号。预加载仅传递语义化阶段、版本、进度和失败类别;组件从当前 `settings` locale 解析全部可见与无障碍文案,并在应用内语言变化后同步更新。选择可用更新即开始下载;安装需要独立的壳拥有的确认。侧栏收起时,其顶部展开按钮以品牌蓝色圆点显示相同状态,包括失败状态。连接反馈通常优先展示,但壳报告正在安装时,预期的后端断开不能遮盖更新状态;失败后恢复连接反馈。两个控件共用一次载体订阅;浏览器代码不能选择安装包或授权安装。[Desktop 更新](../../../apps/desktop/README.zh.md)负责发布流程。
|
||||
|
||||
### 「通用」分区
|
||||
|
||||
|
||||
@@ -1,28 +1,30 @@
|
||||
/* The entry's seat is the Settings foot row, which bleeds 2px past the sidebar
|
||||
content box for the Settings hover surface. The New Session bar and panel
|
||||
rows instead keep a 2px inset inside that box, so this entry gives back both
|
||||
2px offsets and ends on their trailing edge rather than flush against the
|
||||
sidebar edge. */
|
||||
.indicator {
|
||||
display: inline-flex;
|
||||
display: inline-grid;
|
||||
grid-template-columns: 14px max-content;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
column-gap: 4px;
|
||||
flex: none;
|
||||
margin-inline-end: 4px;
|
||||
padding: 1px 8px;
|
||||
height: 28px;
|
||||
padding: 0 8px;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid color-mix(in srgb, var(--dsw-alias-brand-primary-new-colorprimary-new-color) 20%, transparent);
|
||||
border-radius: 6px;
|
||||
border-radius: 13px;
|
||||
color: var(--dsw-alias-brand-primary-new-colorprimary-new-color);
|
||||
background: color-mix(in srgb, var(--dsw-alias-brand-primary-new-colorprimary-new-color) 8%, transparent);
|
||||
font: inherit;
|
||||
font-family: inherit;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
font-weight: 500;
|
||||
line-height: 18px;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.indicator[data-error] {
|
||||
color: var(--dsw-alias-state-error-primary);
|
||||
.icon {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
.badge {
|
||||
@@ -36,8 +38,7 @@
|
||||
background: var(--dsw-alias-brand-primary-new-colorprimary-new-color);
|
||||
}
|
||||
|
||||
.badge[data-error], .errorDot { background: var(--dsw-alias-state-error-primary); }
|
||||
.errorDot { width: 6px; height: 6px; border-radius: 50%; corner-shape: round; }
|
||||
.errorDot { background: currentColor; width: 6px; height: 6px; border-radius: 50%; corner-shape: round; }
|
||||
.spinner { animation: spin 1s linear infinite; }
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
|
||||
|
||||
@@ -46,6 +46,7 @@ function updateCopy(state: DesktopUpdatePresentation, t: SettingsTranslate): { l
|
||||
}
|
||||
|
||||
/**
|
||||
* Render update status with connection-indicator geometry and brand-blue labels, including retries.
|
||||
* @param props - Connection priority, sidebar width, and localized bridge-failure copy.
|
||||
* @returns Desktop-only status beside the account button, or nothing in browsers.
|
||||
*/
|
||||
@@ -64,10 +65,12 @@ export function DesktopUpdateIndicator({ wide, hidden, t, view, onOpen }: {
|
||||
const error = failed || state?.phase === 'error'
|
||||
const busy = opening || (state !== undefined && BUSY_PHASES.has(state.phase))
|
||||
return <Tooltip label={failed ? retryLabel : copy.detail} side="top">
|
||||
<button type="button" className={css.indicator} data-error={error || undefined}
|
||||
<button type="button" className={css.indicator}
|
||||
aria-label={label} aria-disabled={busy} onClick={() => { if (!busy) onOpen() }}>
|
||||
{error ? <span className={css.errorDot} aria-hidden="true" />
|
||||
: busy ? <IconLoadingOutlineRegular className={css.spinner} size={16} /> : <IconDownloadOutlineRegular size={14} />}
|
||||
<span className={css.icon} aria-hidden="true">
|
||||
{error ? <span className={css.errorDot} />
|
||||
: busy ? <IconLoadingOutlineRegular className={css.spinner} size={14} /> : <IconDownloadOutlineRegular size={14} />}
|
||||
</span>
|
||||
<span>{label}</span>
|
||||
</button>
|
||||
</Tooltip>
|
||||
@@ -78,7 +81,7 @@ type BadgeProps = PropsRuntime<'sidebar.toggle.badge'> & PropsLocale<'settings'>
|
||||
|
||||
/**
|
||||
* @param props - Framework-bound carrier and connection state.
|
||||
* @returns A non-interactive notification on the sidebar expand button.
|
||||
* @returns A non-interactive brand-blue notification on the sidebar expand button.
|
||||
*/
|
||||
export function DesktopUpdateBadge({ useDesktopUpdate, useConnectionState, t }: BadgeProps) {
|
||||
const { presentation: state, failed } = useDesktopUpdate(value => value)
|
||||
@@ -89,6 +92,6 @@ export function DesktopUpdateBadge({ useDesktopUpdate, useConnectionState, t }:
|
||||
const copy = state === undefined ? { label: retryLabel, detail: retryLabel } : updateCopy(state, t)
|
||||
const label = failed ? retryLabel : copy.label
|
||||
return <Tooltip label={failed ? label : copy.detail} side="right">
|
||||
<span role="img" aria-label={label} className={css.badge} data-error={failed || state?.phase === 'error' || undefined} />
|
||||
<span role="img" aria-label={label} className={css.badge} />
|
||||
</Tooltip>
|
||||
}
|
||||
@@ -5,7 +5,7 @@ export const zh = {
|
||||
'trigger': '设置',
|
||||
'desktop.update.available': '新版本',
|
||||
'desktop.update.checking': '正在检查更新…',
|
||||
'desktop.update.progress': '{percent}%…',
|
||||
'desktop.update.progress': '{percent}%',
|
||||
'desktop.update.verifying': '正在校验更新文件…',
|
||||
'desktop.update.installing': '正在准备重启…',
|
||||
'desktop.update.ready': '安装并重启',
|
||||
@@ -45,7 +45,7 @@ export const en = {
|
||||
'trigger': 'Settings',
|
||||
'desktop.update.available': 'Update',
|
||||
'desktop.update.checking': 'Checking for updates…',
|
||||
'desktop.update.progress': '{percent}%…',
|
||||
'desktop.update.progress': '{percent}%',
|
||||
'desktop.update.verifying': 'Verifying update files…',
|
||||
'desktop.update.installing': 'Preparing to restart…',
|
||||
'desktop.update.ready': 'Install and Restart',
|
||||
|
||||
@@ -44,7 +44,7 @@ const kit = {
|
||||
}
|
||||
|
||||
describe('Desktop collapsed update badge', () => {
|
||||
it('shows update status, marks failures, and yields to connection feedback', () => {
|
||||
it('shows update and retry status and yields to connection feedback', () => {
|
||||
let state: DesktopUpdateView = { failed: false, opening: false }
|
||||
let connection: 'connected' | 'connecting' | 'disconnected' = 'connected'
|
||||
const props = { ...kit, t,
|
||||
@@ -55,17 +55,17 @@ describe('Desktop collapsed update badge', () => {
|
||||
expect(screen.queryByRole('img')).toBeNull()
|
||||
state = { ...state, presentation: { phase: 'available', version: '1.0.1' } }
|
||||
view.rerender(<DesktopUpdateBadge {...props} />)
|
||||
expect(screen.getByRole('img', { name: 'Update' }).getAttribute('data-error')).toBeNull()
|
||||
expect(screen.getByRole('img', { name: 'Update' })).toBeTruthy()
|
||||
expect(screen.queryByRole('button')).toBeNull()
|
||||
state = { ...state, failed: true }
|
||||
view.rerender(<DesktopUpdateBadge {...props} />)
|
||||
expect(screen.getByRole('img', { name: en['desktop.update.retry'] }).getAttribute('data-error')).toBe('true')
|
||||
expect(screen.getByRole('img', { name: en['desktop.update.retry'] })).toBeTruthy()
|
||||
state = { failed: true, opening: false }
|
||||
view.rerender(<DesktopUpdateBadge {...props} />)
|
||||
expect(screen.getByRole('img', { name: en['desktop.update.retry'] }).getAttribute('data-error')).toBe('true')
|
||||
expect(screen.getByRole('img', { name: en['desktop.update.retry'] })).toBeTruthy()
|
||||
state = { failed: false, opening: false, presentation: { phase: 'error', failure: 'install' } }
|
||||
view.rerender(<DesktopUpdateBadge {...props} />)
|
||||
expect(screen.getByRole('img', { name: en['desktop.update.retry'] }).getAttribute('data-error')).toBe('true')
|
||||
expect(screen.getByRole('img', { name: en['desktop.update.retry'] })).toBeTruthy()
|
||||
for (const value of ['connecting', 'disconnected'] as const) {
|
||||
connection = value
|
||||
view.rerender(<DesktopUpdateBadge {...props} />)
|
||||
|
||||
@@ -71,11 +71,10 @@ it('keeps the newest event, hides for connection priority, and invokes only the
|
||||
expect(screen.queryByRole('button')).toBeNull()
|
||||
await f.emit({ phase: 'downloading', version: available.version, percent: 58 })
|
||||
f.view.rerender(<f.Indicator />)
|
||||
fireEvent.click(screen.getByRole('button', { name: '58%…' }))
|
||||
fireEvent.click(screen.getByRole('button', { name: '58%' }))
|
||||
expect(f.open).toHaveBeenCalledOnce()
|
||||
await f.emit({ phase: 'error', version: available.version, failure: 'download' })
|
||||
const retry = screen.getByRole('button', { name: '重试更新' })
|
||||
expect(retry.getAttribute('data-error')).toBe('true')
|
||||
fireEvent.focus(retry)
|
||||
expect((await screen.findByRole('tooltip')).textContent).toBe('下载更新失败,请重试。')
|
||||
f.view.rerender(<f.Indicator wide={false} />)
|
||||
@@ -90,7 +89,6 @@ it('keeps bridge failures actionable and ignores status completion after unmount
|
||||
f.open.mockRejectedValueOnce(new Error('IPC unavailable'))
|
||||
fireEvent.click(screen.getByRole('button', { name: '重试更新' }))
|
||||
await act(async () => {})
|
||||
expect(screen.getByRole('button').getAttribute('data-error')).toBe('true')
|
||||
f.view.unmount()
|
||||
const late = fixture()
|
||||
late.view.unmount()
|
||||
@@ -143,11 +141,11 @@ it('shows fallback progress and error details when the shell omits optional fiel
|
||||
const f = fixture()
|
||||
try {
|
||||
await f.emit({ phase: 'downloading' })
|
||||
const progress = screen.getByRole('button', { name: '0%…' })
|
||||
const progress = screen.getByRole('button', { name: '0%' })
|
||||
fireEvent.focus(progress)
|
||||
expect((await screen.findByRole('tooltip')).textContent).toBe('0%…')
|
||||
expect((await screen.findByRole('tooltip')).textContent).toBe('0%')
|
||||
await f.emit({ phase: 'downloading', version: '1.0.1' })
|
||||
fireEvent.focus(screen.getByRole('button', { name: '0%…' }))
|
||||
fireEvent.focus(screen.getByRole('button', { name: '0%' }))
|
||||
expect((await screen.findByRole('tooltip')).textContent).toContain('1.0.1')
|
||||
await f.emit({ phase: 'error' })
|
||||
fireEvent.focus(screen.getByRole('button', { name: '重试更新' }))
|
||||
|
||||
@@ -74,7 +74,8 @@
|
||||
"@deepseek-ai/dsh-util-workspace-path": "workspace:^",
|
||||
"@deepseek-ai/dsh-attachment": "workspace:^",
|
||||
"clsx": "^2.0.0",
|
||||
"@deepseek-ai/dsh-ptc-runtime": "workspace:^"
|
||||
"@deepseek-ai/dsh-ptc-runtime": "workspace:^",
|
||||
"@deepseek-ai/dsh-token-meter": "workspace:^"
|
||||
},
|
||||
"files": [
|
||||
"lib/index.js",
|
||||
|
||||
@@ -4,6 +4,7 @@ import type { Agent } from '@deepseek-ai/dsh-agent'
|
||||
import type { ToolResultNode } from '@deepseek-ai/dsh-client-ui-chat/client'
|
||||
import { PtcRuntime } from '@deepseek-ai/dsh-ptc-runtime'
|
||||
import type { PtcRunRequest, PtcRunSpec, PtcRunResult } from '@deepseek-ai/dsh-ptc-runtime'
|
||||
import { estimateContent } from '@deepseek-ai/dsh-token-meter/estimate'
|
||||
import { ToolCallId } from '@deepseek-ai/dsh-llm'
|
||||
import { Session, SessionId } from '@deepseek-ai/dsh-session'
|
||||
import { SpillLocator, SpillStore, type SaveTextSpill, type SpillRef } from '@deepseek-ai/dsh-spill'
|
||||
@@ -34,13 +35,13 @@ class MemorySpillStore extends SpillStore {
|
||||
|
||||
const shellArgs = { command: 'fixture-output', description: 'Return shell output fixture' }
|
||||
|
||||
async function executeShell(text: string, nested: boolean, name = 'bash', maxInlineBytes = 256) {
|
||||
async function executeShell(text: string, nested: boolean, name = 'bash', maxInlineTokens = 256) {
|
||||
const ctx = new Context()
|
||||
try {
|
||||
await ctx.plugin(SystemPrompt)
|
||||
await ctx.plugin(ToolRuntime, { mode: 'both' })
|
||||
await ctx.plugin(MemorySpillStore)
|
||||
await ctx.plugin(SpillPolicy, { maxInlineBytes })
|
||||
await ctx.plugin(SpillPolicy, { maxInlineTokens })
|
||||
if (nested) {
|
||||
// The real registry and spill policy own nested output; evaluator execution has its own process suite.
|
||||
class BindingRuntime extends PtcRuntime {
|
||||
@@ -136,7 +137,7 @@ describe.each([
|
||||
expect(block.content).toHaveLength(1)
|
||||
const preview = block.content[0]!
|
||||
if (preview.type !== 'text') throw new Error('expected a plain-text spill preview')
|
||||
expect(Buffer.byteLength(preview.text, 'utf8')).toBeLessThanOrEqual(256)
|
||||
expect(estimateContent(block.content)).toBeLessThanOrEqual(256)
|
||||
expect(preview.text).toContain('HEAD')
|
||||
if (marker !== '') expect(preview.text).toContain(marker)
|
||||
expect(terminalCardModel(block)).toBeNull()
|
||||
@@ -146,7 +147,7 @@ describe.each([
|
||||
it('keeps a notice-only result generic when no preview fits', async () => {
|
||||
const original = '雪'.repeat(1_000) + '\n[exit code: 9]'
|
||||
const notice = formatSpillNotice({ kind: 'exact', count: Buffer.byteLength(original, 'utf8') }, spillReference)
|
||||
const { block, saves } = await executeShell(original, nested, name, Buffer.byteLength(notice, 'utf8'))
|
||||
const { block, saves } = await executeShell(original, nested, name, estimateContent([{ type: 'text', text: notice }]))
|
||||
expect(block.content).toEqual([{ type: 'text', text: notice }])
|
||||
expect(saves).toHaveLength(1)
|
||||
expect(saves[0]!.bytes).toEqual(Buffer.from(original, 'utf8'))
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write packages/core/tools/README.md
|
||||
README.md: b5400d6b8743d904f5ff07a5fef50e041633ffbb
|
||||
README.zh.md: 1bfd05db5c333215544b515a52364edbd6c126d8
|
||||
README.md: 83f04d86d74b3b8c3a5028be65a6dd9eb6709a2e
|
||||
README.zh.md: 2b5c4e87b8a77bbdad7125732359f817b7ce7014
|
||||
@@ -84,6 +84,8 @@ The generated [configuration catalog](../../../docs/config-catalog.md#deepseek-a
|
||||
|
||||
`ctx.tools.guard(guard)` registers a monotonic synchronous guard after the extensible `tools/pre-execute` waterfall: a returned reason denies the call, and no later listener can turn that denial back into permission. The pipeline's events give plugins more control — `tools/pre-execute` decides allow/deny/ask, `tools/execute` wraps dispatch for timeout or retry, `tools/post-execute` inspects or replaces the result, and `tools/result` observes the frozen final outcome.
|
||||
|
||||
A tool’s `projectContent` installs execution-prepared content before post-execute policies. Policies may still replace or block it; `finalizeContent` remains the final content transform after those policies.
|
||||
|
||||
### Host presentation descriptors
|
||||
|
||||
A tool can retain pure `presentCall()` and `presentResult()` methods for Host-local consumers. The built-in Web Client does not consume those values. It selects a renderer through `tool.call.toolview` and derives card props from raw call arguments, result content, failure state, and persisted metadata. The [Client-derived presentation decision](../../../.agents/notes/implemented/architecture/2026-08-23-client-derived-tool-presentation.md) owns this transport split.
|
||||
|
||||
@@ -84,6 +84,8 @@ ctx.tools.register(defineTool({
|
||||
|
||||
`ctx.tools.guard(guard)` 在可扩展的 `tools/pre-execute` waterfall(瀑布式事件)之后注册单调同步守卫:返回的理由会拒绝调用,后续监听器无法把该拒绝重新变为允许。流水线事件给插件更多控制——`tools/pre-execute` 决定允许/拒绝/询问,`tools/execute` 为超时或重试包装分发,`tools/post-execute` 检查或替换结果,`tools/result` 观测冻结的最终结果。
|
||||
|
||||
工具的 `projectContent` 在执行后策略之前安装执行期间准备的图文内容。策略仍可替换或阻止这些内容;`finalizeContent` 保留为策略之后的最终内容处理。
|
||||
|
||||
### Host 展示描述
|
||||
|
||||
工具可以为 Host 本地消费方保留纯函数 `presentCall()` 与 `presentResult()` 方法。内置 Web Client 不消费这些值,而是通过 `tool.call.toolview` 选择 renderer,并从原始调用参数、结果内容、失败状态与持久 metadata 派生 card props。[Client 派生展示决策](../../../.agents/notes/implemented/architecture/2026-08-23-client-derived-tool-presentation.zh.md)负责该 transport 拆分。
|
||||
|
||||
@@ -234,6 +234,16 @@ export interface ToolDefinition extends ToolSchema {
|
||||
* @returns the canonical value declared by `output.schema`.
|
||||
*/
|
||||
execute(args: unknown, exec: ToolRunContext): Promise<unknown>
|
||||
/**
|
||||
* Install execution-prepared content before `tools/post-execute` policies.
|
||||
* The callback is captured when the call starts and runs once for a
|
||||
* normalized outcome entering post-execute. Policy replacements remain
|
||||
* authoritative; pipeline failures that bypass post-execute skip projection.
|
||||
* @param exec - immutable execution identity and arguments.
|
||||
* @param result - normalized result before post-execute policy.
|
||||
* @returns replacement content, or undefined to preserve the renderer output.
|
||||
*/
|
||||
projectContent?(exec: Readonly<ToolExecution>, result: Readonly<ToolExecutionResult>): ContentBlock[] | undefined
|
||||
/**
|
||||
* Synchronous last-mile transform for model-facing content. The registry
|
||||
* snapshots this callback when execution starts and invokes it exactly once
|
||||
@@ -817,6 +827,8 @@ export class ToolRuntime extends Service {
|
||||
private cancellationStates = new WeakMap<ToolRunContext, ToolCancellationState>()
|
||||
/** Definition-owned final content transform snapshotted before policy begins. */
|
||||
private contentFinalizers = new WeakMap<ToolRunContext, ToolDefinition['finalizeContent']>()
|
||||
/** Execution-prepared content installed before post-execute policy. */
|
||||
private contentProjectors = new WeakMap<ToolRunContext, ToolDefinition['projectContent']>()
|
||||
private readonly layers = new ScopedLayers(
|
||||
scope => new ToolLayer(scope),
|
||||
() => { this.ctx.emit('tools/change') },
|
||||
@@ -1421,6 +1433,7 @@ export class ToolRuntime extends Service {
|
||||
// invalid-args failure of a NON-ABORTED collapsed call drop it (the call
|
||||
// could never execute).
|
||||
const capturedFinalizer = visible?.finalizeContent?.bind(visible)
|
||||
const capturedProjector = visible?.projectContent?.bind(visible)
|
||||
const finalizerFor = (): ToolDefinition['finalizeContent'] | undefined =>
|
||||
collapsed && !signal.aborted ? undefined : capturedFinalizer
|
||||
try {
|
||||
@@ -1431,6 +1444,7 @@ export class ToolRuntime extends Service {
|
||||
const execution: MutableToolRunContext = { ...base, arguments: deepFreeze(detached) }
|
||||
this.deferredContexts.set(execution, deferredContexts)
|
||||
this.contentFinalizers.set(execution, finalizerFor())
|
||||
if (!collapsed) this.contentProjectors.set(execution, capturedProjector)
|
||||
this.cancellationStates.set(execution, {
|
||||
callerSignal: signal,
|
||||
bodyInvoked: false,
|
||||
@@ -1625,7 +1639,13 @@ export class ToolRuntime extends Service {
|
||||
*/
|
||||
private async finalizeScheduledExecution(exec: ToolRunContext, result: ToolExecutionResult): Promise<ToolExecutionResult> {
|
||||
try {
|
||||
const postResult = await this.postExecute(exec, result)
|
||||
const project = this.contentProjectors.get(exec)
|
||||
this.contentProjectors.delete(exec)
|
||||
const content = project?.(exec, result)
|
||||
const projected = content === undefined
|
||||
? result
|
||||
: this.markCanonical(exec, this.materializeFinalResult({ ...result, content }))
|
||||
const postResult = await this.postExecute(exec, projected)
|
||||
return this.finishScheduledExecution(
|
||||
exec,
|
||||
this.callerCancelled(exec) && !postResult.isError
|
||||
|
||||
@@ -513,6 +513,13 @@ export interface DefineToolOptions<S extends ParameterSchemaSpec, O extends Valu
|
||||
* @returns The canonical value declared by `output.schema`.
|
||||
*/
|
||||
execute(args: InferArgs<S>, exec: ToolRunContext): Promise<InferValue<NoInfer<O>>>
|
||||
/**
|
||||
* Install execution-prepared content before result policies.
|
||||
* @param exec - immutable execution identity and arguments.
|
||||
* @param result - normalized outcome entering post-execute.
|
||||
* @returns replacement content, or undefined to preserve it.
|
||||
*/
|
||||
projectContent?(exec: Readonly<ToolExecution>, result: Readonly<ToolExecutionResult>): ContentBlock[] | undefined
|
||||
/**
|
||||
* Optional last-mile content transform for every normalized outcome. Unlike
|
||||
* `execute`, arguments remain `unknown` because invalid-input failures also
|
||||
@@ -553,6 +560,8 @@ export function defineTool<const S extends ParameterSchemaSpec, const O extends
|
||||
// oxlint-disable-next-line typescript/unbound-method
|
||||
const userFinalizeContent = options.finalizeContent
|
||||
// oxlint-disable-next-line typescript/unbound-method
|
||||
const userProjectContent = options.projectContent
|
||||
// oxlint-disable-next-line typescript/unbound-method
|
||||
const userRender = options.output.render
|
||||
// oxlint-disable-next-line typescript/unbound-method
|
||||
const userPresentationMeta = options.output.presentationMeta
|
||||
@@ -591,6 +600,9 @@ export function defineTool<const S extends ParameterSchemaSpec, const O extends
|
||||
return userExecute(args as InferArgs<S>, exec) as Promise<JsonValue>
|
||||
},
|
||||
}
|
||||
if (userProjectContent) {
|
||||
tool.projectContent = (exec, result) => userProjectContent(exec, result)
|
||||
}
|
||||
if (userFinalizeContent) {
|
||||
tool.finalizeContent = (exec, result) => userFinalizeContent(exec, result)
|
||||
}
|
||||
|
||||
@@ -101,6 +101,46 @@ describe('ToolRuntime', () => {
|
||||
expect(schema.execute).toBeUndefined()
|
||||
})
|
||||
|
||||
it('runs the captured content projector before policy and keeps later replacement authoritative', async () => {
|
||||
const ctx = await setup()
|
||||
const definition = defineTool({
|
||||
name: 'projected', description: 'projected result', parameters: {},
|
||||
output: { schema: { type: 'string' }, render: () => [{ type: 'text', text: 'fallback' }] },
|
||||
async execute() { return 'canonical' },
|
||||
projectContent() { return [{ type: 'text', text: 'prepared' }] },
|
||||
})
|
||||
ctx.tools.register(definition)
|
||||
ctx.on('tools/pre-execute', async (_exec, next) => {
|
||||
definition.projectContent = () => [{ type: 'text', text: 'later definition' }]
|
||||
return next()
|
||||
})
|
||||
ctx.on('tools/post-execute', async (_exec, result, next): Promise<PostToolDecision> => {
|
||||
await next()
|
||||
expect(result.content).toEqual([{ type: 'text', text: 'prepared' }])
|
||||
return { kind: 'accept', content: [{ type: 'text', text: 'policy result' }] }
|
||||
})
|
||||
try {
|
||||
expect(Object.keys(ctx.tools.schemas()[0]!)).not.toContain('projectContent')
|
||||
const result = await ctx.tools.execute({ signal: testToolSignal, callId: ToolCallId('projection'), name: 'projected', arguments: {} })
|
||||
expect(result.content).toEqual([{ type: 'text', text: 'policy result' }])
|
||||
if (result.isError) throw new Error('expected successful projection')
|
||||
expect(result.value).toBe('canonical')
|
||||
} finally { await ctx.fiber.dispose() }
|
||||
})
|
||||
|
||||
it('normalizes a throwing content projector without running post-execute', async () => {
|
||||
const ctx = await setup()
|
||||
let postCalls = 0
|
||||
ctx.tools.register({ ...echoTool, projectContent() { throw new Error('projection failed') } })
|
||||
ctx.on('tools/post-execute', async (_exec, _result, next) => { postCalls++; return next() })
|
||||
try {
|
||||
const result = await ctx.tools.execute({ signal: testToolSignal, callId: ToolCallId('projection-error'), name: 'echo', arguments: {} })
|
||||
expect(result.isError).toBe(true)
|
||||
expect(JSON.stringify(result.content)).toContain('projection failed')
|
||||
expect(postCalls).toBe(0)
|
||||
} finally { await ctx.fiber.dispose() }
|
||||
})
|
||||
|
||||
it('schemas() excludes timeoutMs — the budget must never reach the model', async () => {
|
||||
const ctx = await setup()
|
||||
ctx.tools.register(defineContentToolFixture({
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write packages/credentials/deepseek-account-platform/README.md
|
||||
README.md: 34da2313ea99b989ea3a0692d2cca050116b5b6a
|
||||
README.zh.md: e24036ebf7a5c431ab34abdb1f01415b7b3a4f36
|
||||
README.md: 94816e5819027b0d68d39379a9905dfe02768029
|
||||
README.zh.md: 9e1df8a19881960e4d4b4423f9cfa89c463d237d
|
||||
@@ -11,7 +11,7 @@ New attempts map the caller’s UI language to Platform en_US or zh_CN; active a
|
||||
|
||||
getPlatformSession exports the stored grant only when its issuer matches platformOrigin. This Host-only operation supports native Platform embedding without widening the model/file origin configured for resolveToken.
|
||||
|
||||
`desktopPlatform` defaults to `null`. The Desktop profile supplies `darwin` or `win32`; Host authorization, profile, balance, and logout requests then carry `x-client-platform: desktop-mac` or `desktop-win`, overriding that header in deployment configuration. Embedded Platform document and API requests receive the same platform header alongside their deployment headers, only at the configured origin. Other profiles omit the automatic header.
|
||||
`desktopPlatform` defaults to `null`. Every profile then sends `x-client-platform: web` on Host authorization, profile, balance, and logout requests; the Desktop profile supplies `darwin` or `win32`, replacing it with `x-client-platform: desktop-mac` or `desktop-win`. The provider owns that header, so deployment configuration cannot override it. Embedded Platform document and API requests receive the same platform header alongside their deployment headers, only at the configured origin.
|
||||
|
||||
## Summary
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ kind: "package-reference"
|
||||
|
||||
getPlatformSession 仅在已存授权的 issuer 与 platformOrigin 一致时导出该授权。这个仅限 Host 的操作支持原生 Platform 内嵌,不扩大 resolveToken 配置的模型及文件请求来源。
|
||||
|
||||
`desktopPlatform` 默认为 `null`。Desktop profile 提供 `darwin` 或 `win32`,使 Host 的授权、资料、余额和退登请求携带 `x-client-platform: desktop-mac` 或 `desktop-win`,覆盖部署配置中的同名请求头。内嵌 Platform 的文档与 API 请求仅向配置来源发送相同的平台请求头,同时保留其他部署请求头;其他 profile 不自动添加平台请求头。
|
||||
`desktopPlatform` 默认为 `null`。此时所有 profile 的 Host 授权、资料、余额和退登请求都携带 `x-client-platform: web`;Desktop profile 提供 `darwin` 或 `win32`,改为携带 `x-client-platform: desktop-mac` 或 `desktop-win`。该请求头由 provider 拥有,部署配置无法覆盖。内嵌 Platform 的文档与 API 请求仅向配置来源发送相同的平台请求头,同时保留其他部署请求头。
|
||||
|
||||
## 概述
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ const device = z.object({ id: z.uuid() })
|
||||
export interface Config {
|
||||
/** Platform origin serving auth-api and browser pages. */
|
||||
platformOrigin?: string
|
||||
/** Native desktop identity for Host API and embedded Platform requests; null omits the client platform header. */
|
||||
/** Native desktop identity for Host API and embedded Platform requests; null identifies the client as web. */
|
||||
desktopPlatform?: 'darwin' | 'win32' | null
|
||||
/** Optional frontend deployment selector for embedded Usage and Top-up pages. */
|
||||
embeddedPageDist?: string
|
||||
@@ -112,7 +112,7 @@ export class PlatformAccount extends DeepSeekAccount {
|
||||
}
|
||||
this.inferenceOrigin = inference.origin
|
||||
this.rewriteBrowserOrigin = resolved.rewriteBrowserOrigin
|
||||
this.clientHeaders = desktopClientHeaders(resolved.desktopPlatform)
|
||||
this.clientHeaders = { 'x-client-platform': 'web', ...desktopClientHeaders(resolved.desktopPlatform) }
|
||||
this.requestHeaders = platformHeaders(resolved.requestHeaders)
|
||||
const accountHeaders = platformHeaders(resolved.accountRequestHeaders)
|
||||
this.accountRequestHeaders = { ...this.requestHeaders, ...accountHeaders }
|
||||
@@ -207,7 +207,7 @@ export class PlatformAccount extends DeepSeekAccount {
|
||||
const requestHeaders = { ...this.accountRequestHeaders, ...this.clientHeaders }
|
||||
return { origin: this.origin, token: stored.token,
|
||||
...(this.embeddedPageDist ? { embeddedPageDist: this.embeddedPageDist } : {}),
|
||||
...(Object.keys(requestHeaders).length ? { requestHeaders } : {}) }
|
||||
requestHeaders }
|
||||
}
|
||||
|
||||
private async readCurrentGrant(lifetime: AbortController): Promise<z.infer<typeof grant> | null> {
|
||||
|
||||
@@ -239,7 +239,8 @@ it('stores a grant before redirecting, restores account presence, and signs out
|
||||
expect(response.headers.get('location')).toBe(`${f.origin}/dsh/authorized?result=test&locale=zh_CN&login_source=desktop`)
|
||||
expect((await f.account.getState()).status).toBe('credential-stored')
|
||||
expect(await readFile(join(f.home, 'credentials.yaml'), 'utf8')).toContain('dsh_mock_test')
|
||||
expect(await f.account.getPlatformSession()).toEqual({ origin: f.origin, token: 'dsh_mock_test' })
|
||||
expect(await f.account.getPlatformSession()).toEqual({ origin: f.origin, token: 'dsh_mock_test',
|
||||
requestHeaders: { 'x-client-platform': 'web' } })
|
||||
expect(await f.account.resolveToken('https://api.deepseek.com')).toBeUndefined()
|
||||
await f.account.signOut()
|
||||
expect((await f.account.getState()).status).toBe('signed-out')
|
||||
@@ -779,13 +780,14 @@ it('carries the configured embedded frontend selector in the private Platform se
|
||||
await f.account.startSignIn('en', f.callbackOrigin, 'desktop')
|
||||
await f.wait('waiting-browser')
|
||||
await fetch(f.callback(), { redirect: 'manual' })
|
||||
expect(await f.account.getPlatformSession()).toEqual({ origin: f.origin, token: 'dsh_mock_test', embeddedPageDist: 'feat/test' })
|
||||
expect(await f.account.getPlatformSession()).toEqual({ origin: f.origin, token: 'dsh_mock_test', embeddedPageDist: 'feat/test',
|
||||
requestHeaders: { 'x-client-platform': 'web' } })
|
||||
})
|
||||
|
||||
it.each([
|
||||
['darwin', 'desktop-mac'], ['win32', 'desktop-win'], [null, undefined],
|
||||
['darwin', 'desktop-mac'], ['win32', 'desktop-win'], [null, 'web'],
|
||||
] as const)('identifies %s Host API and embedded Platform requests', async (desktopPlatform, expected) => {
|
||||
const f = await fixture(undefined, { Cookie: 'test_gate=synthetic', ...(desktopPlatform === null ? {} : { 'X-Client-Platform': 'web' }) },
|
||||
const f = await fixture(undefined, { Cookie: 'test_gate=synthetic', 'X-Client-Platform': 'deployment-override' },
|
||||
false, {}, undefined, undefined, '', desktopPlatform)
|
||||
await f.account.startSignIn('en', f.callbackOrigin, 'desktop')
|
||||
await f.wait('waiting-browser')
|
||||
@@ -796,8 +798,8 @@ it.each([
|
||||
await f.wait('waiting-browser')
|
||||
await fetch(f.callback(), { redirect: 'manual' })
|
||||
await readDetails(f.account)
|
||||
expect(await f.account.getPlatformSession()).toMatchObject({ requestHeaders: { cookie: 'test_gate=synthetic' } })
|
||||
expect((await f.account.getPlatformSession())?.requestHeaders?.['x-client-platform']).toBe(expected)
|
||||
expect(await f.account.getPlatformSession()).toEqual({ origin: f.origin, token: 'dsh_mock_test',
|
||||
requestHeaders: { cookie: 'test_gate=synthetic', 'x-client-platform': expected } })
|
||||
await f.account.signOut()
|
||||
await expect.poll(f.logoutCount).toBe(1)
|
||||
expect(f.receivedHeaders.map(item => item.path)).toEqual([
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write packages/credentials/deepseek-account/README.md
|
||||
README.md: 72b42ee996b809992e48ea4c124f0793d756526a
|
||||
README.zh.md: b30813e24adc2afc9e8245b839432dd195093c63
|
||||
README.md: c54dc4feced92308a83c47aa0eb7033766708205
|
||||
README.zh.md: 1df0ca4cdc7d55584d8dcba29706746c87dcb31f
|
||||
@@ -60,4 +60,4 @@ No model request prefix changes.
|
||||
|
||||
The [desktop login decision](../../../.agents/notes/implemented/architecture/2026-09-14-deepseek-account-login.md) records cancellation and storage ownership.
|
||||
|
||||
PlatformSession may carry private deployment requestHeaders from Host to Electron main. Consumers must exclude those headers from renderer bootstrap and restrict them to the configured origin. mergePlatformCookies preserves unrelated cookie pairs while replacing matching names.
|
||||
PlatformSession may carry Host-only requestHeaders from Host to Electron main: deployment headers plus the provider's x-client-platform. Consumers must exclude those headers from renderer bootstrap and restrict them to the configured origin. mergePlatformCookies preserves unrelated cookie pairs while replacing matching names.
|
||||
@@ -60,4 +60,4 @@ AccountDetails.balance 就绪时,value 保存充值钱包,bonusWallets 保
|
||||
|
||||
[桌面登录决策](../../../.agents/notes/implemented/architecture/2026-09-14-deepseek-account-login.zh.md)记录取消和存储的职责。
|
||||
|
||||
PlatformSession 可将私有部署 requestHeaders 从 Host 传至 Electron 主进程。消费者必须从渲染层 bootstrap 排除这些请求头,并将其限定于配置来源。mergePlatformCookies 替换同名 Cookie,同时保留其他 Cookie。
|
||||
PlatformSession 可将仅限 Host 的 requestHeaders 从 Host 传至 Electron 主进程,其中包含部署请求头和 provider 提供的 x-client-platform。消费者必须从渲染层 bootstrap 排除这些请求头,并将其限定于配置来源。mergePlatformCookies 替换同名 Cookie,同时保留其他 Cookie。
|
||||
@@ -15,7 +15,7 @@ export interface PlatformSession {
|
||||
readonly token: string
|
||||
/** Optional dist query value selecting the embedded frontend deployment. */
|
||||
readonly embeddedPageDist?: string
|
||||
/** Private deployment headers for native requests; excluded from renderer bootstrap. */
|
||||
/** Host-only request headers: deployment headers and the provider client identity; never exposed through renderer bootstrap. */
|
||||
readonly requestHeaders?: Readonly<Record<string, string>>
|
||||
}
|
||||
|
||||
|
||||
@@ -295,18 +295,26 @@ it('reclaims the process range after an unexpected idle exit before replacing th
|
||||
it('retains a worker whose idle cleanup cannot observe exit until that range is joined', async () => {
|
||||
const { worker, spawn, ctx } = await fixture({ idleTimeoutMs: 100 })
|
||||
await prepare(worker)
|
||||
const warn = vi.spyOn(ctx.logger, 'warn').mockImplementation(() => {})
|
||||
await worker.transcribe({ audio, language: 'en' }, signal())
|
||||
const handle = spawn.mock.results[0]!.value as SubprocessHandle
|
||||
const joined = vi.spyOn(handle, 'waitForExit').mockRejectedValueOnce(new Error('range observation failed'))
|
||||
await vi.waitFor(() => { expect(joined).toHaveBeenCalledOnce() }, { timeout: 10000 })
|
||||
expect(warn).toHaveBeenCalledWith('Speech worker idle cleanup failed', expect.any(Error))
|
||||
await expect(worker.transcribe({ audio, language: 'zh' }, signal())).rejects.toThrow('range observation failed')
|
||||
expect(spawn).toHaveBeenCalledOnce()
|
||||
expect((await worker.transcribe({ audio, language: 'zh' }, signal())).text).toBe('zh')
|
||||
expect(await joined.mock.results.at(-1)!.value).toBe(true)
|
||||
expect(spawn).toHaveBeenCalledTimes(2)
|
||||
warn.mockRestore()
|
||||
const failure = new Error('range observation failed')
|
||||
const warn = vi.spyOn(ctx.logger, 'warn').mockImplementation(() => {})
|
||||
const joined = vi.spyOn(handle, 'waitForExit').mockRejectedValueOnce(failure)
|
||||
try {
|
||||
// Subprocess ownership also calls waitForExit after the direct process exits.
|
||||
await handle.done
|
||||
await vi.waitFor(() => {
|
||||
expect(warn).toHaveBeenCalledWith('Speech worker idle cleanup failed', failure)
|
||||
}, { timeout: 10000 })
|
||||
await expect(worker.transcribe({ audio, language: 'zh' }, signal())).rejects.toBe(failure)
|
||||
expect(spawn).toHaveBeenCalledOnce()
|
||||
expect((await worker.transcribe({ audio, language: 'zh' }, signal())).text).toBe('zh')
|
||||
expect(await joined.mock.results.at(-1)!.value).toBe(true)
|
||||
expect(spawn).toHaveBeenCalledTimes(2)
|
||||
} finally {
|
||||
joined.mockRestore()
|
||||
warn.mockRestore()
|
||||
}
|
||||
})
|
||||
|
||||
it('retains completed preparation steps when cancellation settles the active step', async () => {
|
||||
|
||||
@@ -7185,7 +7185,7 @@ export const TYPE_API: readonly TypeApiEntry[] = [
|
||||
},
|
||||
{
|
||||
name: 'ToolDefinition',
|
||||
declaration: 'export interface ToolDefinition extends ToolSchema {\n readonly output: ToolOutputDefinition;\n execute(args: unknown, exec: ToolRunContext): Promise<unknown>;\n finalizeContent?(exec: Readonly<ToolExecution>, result: Readonly<ToolExecutionResult>): ContentBlock[] | undefined;\n timeoutMs?: number;\n isConcurrencySafe?(args: unknown): boolean;\n presentCall?(args: unknown): ToolCallView | undefined;\n presentResult?(args: unknown, result: ToolResult): ToolResultView | undefined;\n}',
|
||||
declaration: 'export interface ToolDefinition extends ToolSchema {\n readonly output: ToolOutputDefinition;\n execute(args: unknown, exec: ToolRunContext): Promise<unknown>;\n projectContent?(exec: Readonly<ToolExecution>, result: Readonly<ToolExecutionResult>): ContentBlock[] | undefined;\n finalizeContent?(exec: Readonly<ToolExecution>, result: Readonly<ToolExecutionResult>): ContentBlock[] | undefined;\n timeoutMs?: number;\n isConcurrencySafe?(args: unknown): boolean;\n presentCall?(args: unknown): ToolCallView | undefined;\n presentResult?(args: unknown, result: ToolResult): ToolResultView | undefined;\n}',
|
||||
},
|
||||
{
|
||||
name: 'ToolDispatchExecution',
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write packages/llm/llm-deepseek/README.md
|
||||
README.md: 8b71e435884b8ea0364e7bea0924f2f351f11ec5
|
||||
README.zh.md: 90709e09b73e0448a90a1f2d224203ad3ce7bd36
|
||||
README.md: 1fad3d3f832ff21c6ae1616d3637674d6c923b2b
|
||||
README.zh.md: 9914f53f732d0586fa14e2f1c6b9b05ed47c6567
|
||||
@@ -110,7 +110,7 @@ When `ctx.deepseekLlmApiExtensions` is present, the adapter prepares its registe
|
||||
|
||||
### Failures and recovery
|
||||
|
||||
Configuration accepts Messages only and has no `protocol` field. If resolution reports `protocol is not configurable`, remove `protocol` from the `llm-deepseek` section in `<harness home>/settings.yaml` and from any matching Cordis entry or overlay. Keep the intended `baseURL`, `apiKeyEnv`, and `models` fields. An invalid live section keeps the complete last good configuration; saving other fields in the Models card does not remove an unknown property. Edit the configuration file, then let settings reload or restart the profile; composition edits require a profile restart.
|
||||
Configuration accepts Messages only and has no `protocol` field. If resolution reports `protocol is not configurable`, remove `protocol` from the `config` of the `llm-deepseek` entry in `$DSH_HOME/profiles/<profile>/cordis.patch.yml` and from any overriding home patch or command-line overlay. Keep the intended `baseURL`, `apiKeyEnv`, and `models` fields. A stored configuration rejected by adapter validation makes subsequent requests fail until corrected; saving other fields in the Models card does not remove an unknown property. Edit the configuration file, then let the profile reload it through HMR or restart the profile if HMR is disabled.
|
||||
|
||||
Successful Files responses must contain valid JSON. JSON decoding failures from upload, list, retrieve, and delete throw `INVALID_RESPONSE` with the operation and HTTP status in the message, the status in `LlmError.failure`, and the original parser error as `cause`. Body-read transport and cancellation errors retain their identity.
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ Files 模式通过 `maxRequestFilesBytes` 与 `maxImagesPerRequest` 限制保留
|
||||
|
||||
### 失败与恢复
|
||||
|
||||
配置仅接受 Messages,不提供 `protocol` 字段。若解析报告 `protocol is not configurable`,请从 `<harness home>/settings.yaml` 的 `llm-deepseek` 分节以及对应 Cordis 条目或 overlay 中删除 `protocol`,保留需要的 `baseURL`、`apiKeyEnv` 和 `models` 字段。无效的实时分节会继续使用完整的最后有效配置;在模型设置卡中保存其他字段不会移除未知属性。请编辑配置文件,等待设置重新加载或重启 profile;组装配置变更需要重启 profile。
|
||||
配置仅接受 Messages,不提供 `protocol` 字段。若解析报告 `protocol is not configurable`,请从 `$DSH_HOME/profiles/<profile>/cordis.patch.yml` 中 `llm-deepseek` 条目的 `config` 以及覆盖它的 home patch 或命令行 overlay 中删除 `protocol`,保留需要的 `baseURL`、`apiKeyEnv` 和 `models` 字段。已存储的配置若被适配器校验拒绝,后续请求会持续失败,直到配置修正;在模型设置卡中保存其他字段不会移除未知属性。请编辑配置文件,等待 profile 通过 HMR(热模块替换)重新加载;若未启用 HMR,则重启 profile。
|
||||
|
||||
成功的 Files 响应必须包含有效 JSON。上传、列举、获取和删除操作的 JSON 解码失败抛出 `INVALID_RESPONSE`,消息包含操作名称与 HTTP 状态,`LlmError.failure` 保留该状态,`cause` 保留原始解析错误。读取响应体时的传输和取消错误保留其原有身份。
|
||||
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write packages/llm/token-meter/README.md
|
||||
README.md: 37b9614a6c684a27d44b8b8bb65108029d58612f
|
||||
README.zh.md: f2fb79132ec7deded9051a85db90cc1995a5f336
|
||||
README.md: e6d957bd14560d967fb221b147d87d7db42197ea
|
||||
README.zh.md: 526be7b2e399bcf6f4638ece9a7315044fa48c55
|
||||
@@ -102,6 +102,8 @@ Each `measure()` call synchronizes the fold to the current durable tail, then re
|
||||
|
||||
`contextBreakdown` retains plain-JSON `{ seq, heuristicTokens, system }` entries in surface order and reuses the measurement plan/commit fold. Its state and surface transitions are O(current retained surface), not O(1) and not O(total historical log); replaced entries and message bodies are not retained. State version 5 invalidates checkpoints priced with offload metadata. `contextPressure` remains the scalar shadow-price consumer: replacements without adjacent claims contribute zero delta. The usage fold retains one last-sample slot because legal logs never report usage for an earlier step after a later step reports usage.
|
||||
|
||||
`./estimate` exports the stateless text/content estimators used by tool-result retention. Model adapters supply request-image costs through `imageRequestPricing`.
|
||||
|
||||
</details>
|
||||
|
||||
-----
|
||||
|
||||
@@ -102,6 +102,8 @@ const price = ctx.tokenMeter.estimateMessage(message)
|
||||
|
||||
`contextBreakdown` 按 surface 顺序保留纯 JSON 的 `{ seq, heuristicTokens, system }` 条目,并复用测量服务的 plan/commit fold。其状态与 surface 转换成本为 O(当前保留 surface),不是 O(1),也不是 O(完整历史日志);被替换条目和消息正文不保留。状态版本 5 使计入省略元数据的检查点失效。`contextPressure` 仍是标量影子价消费方:没有相邻 claim 的替换贡献零增量。用量 fold 保留一个最后样本槽,因为合法日志不会在更晚步骤报告用量后再次报告更早步骤的用量。
|
||||
|
||||
`./estimate` 导出无服务状态的文字与内容估算函数,供工具结果保留复用。图片的实际请求成本由模型适配器的 `imageRequestPricing` 提供。
|
||||
|
||||
</details>
|
||||
|
||||
-----
|
||||
|
||||
@@ -23,7 +23,11 @@
|
||||
"default": "./lib/types/client.js"
|
||||
},
|
||||
"./src/*": "./src/*",
|
||||
"./package.json": "./package.json"
|
||||
"./package.json": "./package.json",
|
||||
"./estimate": {
|
||||
"types": "./lib/types/estimate.d.ts",
|
||||
"default": "./lib/types/estimate.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"lib/index.js",
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write packages/mcp/mcp-client/README.md
|
||||
README.md: a241dda5d77da5cea1d7092a99d670ead564ba03
|
||||
README.zh.md: dbebdae8675aecf9c1107f53c9aeec9469def1df
|
||||
README.md: d9f81a79b8c54b1437d051f46a72196fd84742c9
|
||||
README.zh.md: d6f3e9337c80e5535bb1239dfb7752f3485dbde3
|
||||
@@ -108,7 +108,7 @@ This section explains the design decisions behind the bridge and points at the c
|
||||
- **Naming is a pinned contract.** Public names are pure functions of `(serverName, rawName)` and satisfy the DeepSeek function-name contract; lossy normalization appends a 12-hex-char SHA-256 hash so distinct identities never collapse. Session history and permission rules therefore survive HMR swaps, re-syncs, and other servers' changes.
|
||||
- **The raw name is the only wire name.** `tools/call` always receives the raw name; the public name is never sent to the server and never parsed to recover the raw name.
|
||||
- **Full generation or none.** Syncs swap generations atomically: a fetch failure keeps the previous generation, and a registration conflict rolls back the entire attempted generation.
|
||||
- **One canonical value, one projection.** The executor returns the protocol-complete canonical `McpResult`; a separate ordered projection prepares Native content, and `finalizeContent` installs it only when the registry's post-execute result is unchanged, so policy blocks and value replacements stay authoritative.
|
||||
- **One canonical value, one projection.** The executor preserves the complete canonical MCP value and prepares ordered text/image content. `projectContent` installs that content before `tools/post-execute`, so retention sees real images. Subsequent content replacement, value replacement, and blocking remain authoritative.
|
||||
|
||||
### Source map
|
||||
|
||||
|
||||