dsh-github-copilot 0.4.0-alpha.83 → 0.4.0-alpha.85

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -73,6 +73,7 @@ Alpha.25 admits native `subagent/descriptor` v3, already v3 in the retained rc.1
73
73
  - `src/traditional-search.ts`: `github-copilot-hosted` `ctx.web` provider.
74
74
  - `src/serialize.ts`, `src/sse.ts`, `src/failure.ts`: protocol conversion and bounded error handling.
75
75
  - `src/response-error-body.ts`, `src/request-body-timeout.ts`: bounded clone-only HTTP error evidence and safe managed upload-timeout guidance. Exact verified `408/user_request_timeout` preserves native failure classification/retry metadata; final JSON bytes are not tokens or a payload limit. Never infer overflow, auto-compact, trim history, switch models or add retries from a 408.
76
+ - `src/request-body-evidence.ts`: verified-408-only, bounded numeric original-JSON span accounting through the existing fetch hook. Conversation/tool definitions/top-level system/residual partition total bytes; structural image and opaque replay spans are disjoint conversation subsets, never decoded contents. Unknown/limited evidence stays explicit. Fetch-to-header time excludes clone inspection and is not upload duration. No success-path analysis, retained body, automatic mitigation or supplier-limit claim.
76
77
  - `src/copilot-stream-liveness.ts`: request-local HTTP/SSE byte-idle observation, paired with the public native adapter's bounded assistant-chunk deadline. Default five-minute byte idle and ten-minute semantic silence; no fake assistant output, private watchdog access, new retry or Core patch. Consumer think time is excluded; explicit WebSocket/auto stays native-only. `chatStreamLiveness: false` restores native-only timing. `chatMaxRequestImageBytes` retains Core's 20 MiB default; smaller explicit settings authorize only native image offload, not hidden history trimming or a guessed supplier limit. Synthetic heartbeat evidence is not production heartbeat proof.
77
78
  - `tests/`: unit and integration evidence; mirror the source area being changed.
78
79
  - `deployment-baseline.json`: declared machine-readable compatibility and capability evidence inventory.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.0-alpha.84 (prepared)
4
+
5
+ - Add bounded numeric composition of the actual final request for verified Copilot `408 / user_request_timeout`, distinguishing conversation, tool definitions, protocol-owned system/instructions and residual framing (#263).
6
+ - Within conversation, count structural image blocks and opaque replay as disjoint wire-byte subsets without decoding or reporting their content. Missing, unsupported, malformed and work-limited evidence remains explicit.
7
+ - Capture per-dispatch fetch-to-response-header elapsed time before clone observation, honestly labeled as round trip rather than upload duration. Preserve native payload/response bytes, failure classification, retry, cancellation and credentials; no automatic settings change, trimming, compaction or model switch. Diagnostics guide explicit mitigation, not a claim to cure recurring 408.
8
+
3
9
  ## 0.4.0-alpha.83 (prepared)
4
10
 
5
11
  - Reduce avoidable Auto uncertainty through bounded difficult-task continuation and isolated fenced mechanical-transform recognition (#262); preserve unknown for new, incomplete and ambiguous work.
package/README.md CHANGED
@@ -20,7 +20,7 @@ Core still owns image conversion and history. See [image compatibility limits](.
20
20
  - **Search routing:** choose the primary and fallback search providers under **Plugins → dsh-github-copilot → Details**. The page intentionally exposes only those user-facing choices; protocol probes, timeouts, allowlists, and transport switches are not presented as routine UI. It also keeps the rc.2 lifecycle warning visible before disable/remove/upgrade actions. If the updated routed service is not active yet, the card reports **Restart required** instead of presenting a broken form.
21
21
  - **Usage:** eligible Copilot sessions get an optional **Credits** control beside the composer, with provider-reported billing-cycle data and explicit unavailable/stale states. The quota request alone combines Node default and OS trust roots without disabling certificate verification or relying on Desktop launcher environment inheritance.
22
22
  - **Context evidence:** managed requests suppress terminal all-zero usage on failure or cancellation. A separate composer disclosure can identify historical failed-zero readings and show the last applicable input sample, including cache. This is not current occupancy, does not replace the native `0%` meter, and does not rewrite history. See [context evidence boundaries](./docs/copilot-usage.md#historical-context-evidence).
23
- - **Missing Turn Usage:** a completed Copilot reply without a native total can show **Turn Usage unavailable**. Its read-only explanation distinguishes recorded local pre-dispatch budget blocks, other missing samples and incomplete history; it never invents zero usage or a partial turn total. [Observation and boundaries](./docs/copilot-usage.md#missing-completed-turn-usage).
23
+ - **Missing Turn Usage:** a completed Copilot reply without a native total can show **Turn Usage incomplete**. Its read-only explanation distinguishes recorded local pre-dispatch budget blocks, same-attempt HTTP 408 diagnoses, other missing samples and incomplete history. Bounded step/record references and proven same-step retry completion explain what happened, not missing token amounts or billing; it never invents zero usage or a partial turn total. [Observation and boundaries](./docs/copilot-usage.md#missing-completed-turn-usage).
24
24
  - **Compatibility:** the plugin applies Copilot-only tool-schema, reasoning-presentation, request-budget, and account-model compatibility through published DSH APIs. It does not patch Core or maintain a second model catalog.
25
25
 
26
26
  ![Current Web search provider routing on the plugin details page](./docs/images/copilot-search-routing.png)
@@ -31,7 +31,7 @@ On official rc.2, routing is exposed through native live `Config` fields, not a
31
31
 
32
32
  ## Compatibility baselines and qualification targets
33
33
 
34
- Managed Copilot HTTP `408 / user_request_timeout` with the verified request-body timeout message now reports `COPILOT_REQUEST_BODY_TIMEOUT` and the final JSON request's UTF-8 byte count when observable. Bytes are not context tokens, and a request-body timeout does not prove context overflow. Native retries and failure classification remain unchanged. If retries exhaust, explicitly compact the conversation or reduce attachments/tool output before retrying, and check network/proxy health and [GitHub service status](https://www.githubstatus.com/). Compaction is not guaranteed to succeed or cure network/service faults; increasing a client timeout cannot change the server timeout. No automatic history trimming, model switch, compaction or new retry loop is introduced. Unknown errors retain native behavior.
34
+ Managed Copilot HTTP `408 / user_request_timeout` with the verified request-body timeout message reports `COPILOT_REQUEST_BODY_TIMEOUT`, the final JSON request's UTF-8 byte count, bounded numeric composition and fetch-to-response-header elapsed time when observable. Composition partitions conversation, tool definitions, top-level system/instructions and other/framing; image blocks and opaque replay are disjoint subsets of conversation. Remaining conversation includes text/tool history, framing and unknown fields, not a proven text-only count. Image blocks include URLs/references, not decoded image sizes. Timing is a round trip, **not upload duration**; bytes are not context tokens, a supplier payload limit or proof of the cause. Missing, unsupported or work-limited evidence stays explicit. Analysis runs only after the exact error is verified and never records request text, credentials or replay contents. Native retries and failure classification remain unchanged. After retries exhaust, these numbers can inform an **explicit** native image-offload budget change or compaction for compressible history; tool definitions and opaque replay may remain. Also check network/proxy health and [GitHub service status](https://www.githubstatus.com/). Compaction is not guaranteed to succeed or cure network/service faults; increasing a client timeout cannot change the server timeout. No automatic history trimming, settings change, model switch, compaction or new retry loop is introduced. Unknown errors retain native behavior.
35
35
 
36
36
  Managed HTTP/SSE chat now distinguishes **byte idle** from **assistant-output silence**. Native Core ignores SSE heartbeats when timing assistant chunks; synthetic unchanged-adapter tests reproduce a timeout despite incoming bytes. By default, five minutes without response headers/nonempty body bytes still fails, but real byte progress permits up to ten minutes without an assistant chunk. Endless heartbeats cannot postpone failure indefinitely, and consumer think time is excluded. `chatStreamLiveness: false` restores native-only timing; explicit WebSocket/`auto` transport remains native-only. This fixes the reproduced false-idle mechanism, not every retry or upstream HTTP 408, and does not establish heartbeat activity in a production incident.
37
37
 
@@ -109,7 +109,7 @@ The Host reads GitHub's internal quota endpoint using the existing canonical OAu
109
109
 
110
110
  ## Install and sign in
111
111
 
112
- The commands below target the package version `0.4.0-alpha.83`. Versioned URLs describe the intended release artifacts, not proof that publication or local activation has completed; use them only once that Release and its checksums are available. Install into the profile you use (replace `web` when targeting another profile):
112
+ The commands below target the package version `0.4.0-alpha.85`. Versioned URLs describe the intended release artifacts, not proof that publication or local activation has completed; use them only once that Release and its checksums are available. Install into the profile you use (replace `web` when targeting another profile):
113
113
 
114
114
  Before installing/updating, unpack the **checksum-verified** archive into a temporary directory and run its read-only composition preflight (replace all paths with absolute paths for the intended profile):
115
115
 
@@ -122,10 +122,10 @@ Include any launcher patch files with repeated `--patch /absolute/file` argument
122
122
  For a standalone named profile only, the supported CLI command is:
123
123
 
124
124
  ```sh
125
- dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.83/dsh-github-copilot-0.4.0-alpha.83.tgz
125
+ dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.85/dsh-github-copilot-0.4.0-alpha.85.tgz
126
126
  ```
127
127
 
128
- For Desktop profiles, use Desktop's native package manager with `dsh-github-copilot@0.4.0-alpha.83` after the same preflight and only when registry access is permitted. Desktop reserves its `desktop` profile from CLI management. If registry access is blocked or unavailable, stop; the documented [controlled offline CLI procedure](./docs/npm-distribution.md#controlled-offline-cli-maintenance-for-standalone-profiles) is not a Desktop workaround.
128
+ For Desktop profiles, use Desktop's native package manager with `dsh-github-copilot@0.4.0-alpha.85` after the same preflight and only when registry access is permitted. Desktop reserves its `desktop` profile from CLI management. If registry access is blocked or unavailable, stop; the documented [controlled offline CLI procedure](./docs/npm-distribution.md#controlled-offline-cli-maintenance-for-standalone-profiles) is not a Desktop workaround.
129
129
 
130
130
  Then open the Models UI listed above, find **GitHub Copilot**, select **Sign in**, and complete the GitHub device-code flow. Plugin installation changes the selected profile; activation follows that profile's normal reload/restart policy.
131
131
 
@@ -186,7 +186,7 @@ Agents should treat the browser authorization as a human handoff, not as a token
186
186
  5. Confirm **Signed in** and inspect the automatic discovery result before asking the user to choose a model. Already-signed-in Models opening ensures missing/stale metadata automatically; fresh ready cache makes no request. Use visible **Retry** for errors or **Manage → Refresh models** for an intentional forced update, not routine setup. Status alone does not discover, and login, metadata and successful model calls remain separate evidence.
187
187
  6. Use **Sign out** only when the user explicitly asks to disconnect the account. It deletes the Copilot credential record but preserves route settings.
188
188
 
189
- GitHub Releases and npm are the default distribution channels for each new version, using the same verified tarball. Pin the version and verify the evidence for the channel used: Release `SHA256SUMS`, and npm `dist.integrity` when installing from npm. Install into Desktop profiles only through Desktop's native package manager; the reserved `desktop` profile is not managed by the DSH CLI. After npm publication is verified, the native manager accepts `dsh-github-copilot@0.4.0-alpha.83`, not a URL or file. Controlled offline CLI maintenance is documented for standalone named profiles only, never Desktop-managed profiles. Follow the mandatory search-composition preflight, backup, single-writer and post-install checks; do not bypass a corporate registry ban, disable TLS verification or restart without separate approval. See [distribution and publication requirements](./docs/npm-distribution.md).
189
+ GitHub Releases and npm are the default distribution channels for each new version, using the same verified tarball. Pin the version and verify the evidence for the channel used: Release `SHA256SUMS`, and npm `dist.integrity` when installing from npm. Install into Desktop profiles only through Desktop's native package manager; the reserved `desktop` profile is not managed by the DSH CLI. After npm publication is verified, the native manager accepts `dsh-github-copilot@0.4.0-alpha.85`, not a URL or file. Controlled offline CLI maintenance is documented for standalone named profiles only, never Desktop-managed profiles. Follow the mandatory search-composition preflight, backup, single-writer and post-install checks; do not bypass a corporate registry ban, disable TLS verification or restart without separate approval. See [distribution and publication requirements](./docs/npm-distribution.md).
190
190
 
191
191
  **Desktop package-update and Web-lifecycle boundaries:** the native manager's `restart-required` result for an in-place installed-package upgrade is authoritative and distinct from plugin-bundle removal/re-add behavior. Any disable, removal, or upgrade involving service recomposition (`cordis.patch.yml`, such as the isolated routed web search layer) may leave dependent entries pending until Desktop is fully exited and cold-restarted. If the native manager reports only entries such as `pending (waiting for service: web)` while this plugin already shows **Off**, the requested disabled state has been persisted; cold-restart Desktop instead of repeatedly toggling or reinstalling the plugin. Other errors are not covered by this guidance and must still be investigated.
192
192
 
@@ -468,8 +468,8 @@ Report the published Release URL, version, tag/commit and verified asset SHA-256
468
468
  `package.json` declares public npm distribution. A release tag must equal `v${package.json.version}`. Versions use standard SemVer prerelease labels (`alpha`, `beta`, or `rc`), each with its matching npm dist-tag; only stable versions use `latest`. The Release workflow performs the frozen install and complete verification gate, packs once (or recovers the original archive on retry), verifies `SHA256SUMS`, publishes the immutable GitHub Release and then publishes those same bytes to npm through OIDC. Either channel failing means delivery is incomplete. First package creation needs an authorized maintainer; staging requires an existing package and is not a first-package bootstrap. Historical releases are not republished.
469
469
 
470
470
  ```sh
471
- curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.83/dsh-github-copilot-0.4.0-alpha.83.tgz
472
- curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.83/SHA256SUMS
471
+ curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.85/dsh-github-copilot-0.4.0-alpha.85.tgz
472
+ curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.85/SHA256SUMS
473
473
  sha256sum --check SHA256SUMS
474
474
  ```
475
475
 
@@ -477,7 +477,7 @@ PowerShell can verify the same two downloaded files with:
477
477
 
478
478
  ```powershell
479
479
  $expected = (Get-Content .\SHA256SUMS).Split()[0]
480
- $actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.83.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
480
+ $actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.85.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
481
481
  if ($actual -cne $expected) { throw 'Release checksum mismatch' }
482
482
  ```
483
483
 
package/README.zh.md CHANGED
@@ -20,14 +20,14 @@ Core 管理。详见[图片兼容性与限制](./docs/image-input-compatibility.
20
20
  - **搜索路由:**在 **插件 → dsh-github-copilot → 详情**选择主搜索 Provider 与兜底 Provider。页面只保留用户真正需要的两项选择,不再把协议探测、超时、白名单或传输开关作为日常配置暴露;同时会在停用/移除/升级前常驻显示 rc.2 生命周期提示。更新后的路由服务尚未激活时,卡片会明确显示 **需要重启生效(Restart required)**,而不是继续展示无法使用的表单。
21
21
  - **用量:**符合条件的 Copilot 会话会在输入框旁显示可选的 **Credits / 额度** 控件,展示供应方明确返回的计费周期数据,并如实区分不可用与历史快照。仅额度请求组合 Node 默认证书与系统信任根,无需依赖 Desktop launcher 的环境变量继承,且保持 TLS 验签。
22
22
  - **上下文证据:**托管请求失败或取消时,不再传递终止前的全零用量。独立的输入框提示可识别历史失败零值,并显示仍适用的最后输入采样(含缓存);它不是当前占用率,不替换原生 `0%` 表盘,也不改写历史。详见[上下文证据边界](./docs/copilot-usage.md#historical-context-evidence)。
23
- - **整轮 Usage 缺失:**已完成的 Copilot 回复没有原生总量时,可显示**本轮 Usage 不可用**。只读说明区分已记录的插件发出前预算拦截、其他缺失采样和不完整历史;不会补造零用量或把部分步骤合计当成整轮总量。详见[观察与边界](./docs/copilot-usage.md#missing-completed-turn-usage)。
23
+ - **整轮 Usage 缺失:**已完成的 Copilot 回复没有原生总量时,可显示**本轮用量统计不完整**。只读说明区分已记录的插件发出前预算拦截、同次尝试的 HTTP 408 诊断、其他缺失采样和不完整历史。有限的步骤/记录定位及有证据的同一步骤重试成功只解释经过,不推断缺失 token 数或计费;不会补造零用量或把部分步骤合计当成整轮总量。详见[观察与边界](./docs/copilot-usage.md#missing-completed-turn-usage)。
24
24
  - **兼容处理:**插件通过 DSH 已发布公开接口提供 Copilot 专用 Tool Schema、Thinking 展示、请求预算及账号模型兼容,不修改 Core,也不维护第二套模型目录。
25
25
 
26
26
  ![当前插件详情页的 Web 搜索 Provider 路由](./docs/images/copilot-search-routing.png)
27
27
 
28
28
  截图来自当前构建 Client 的隔离浏览器 fixture,使用合成 Provider。它只证明已发布配置界面的形态,不证明真实凭据、账号权限、搜索成功或当前 Desktop 已加载。
29
29
 
30
- > 当前文档与安装命令对应版本 `0.4.0-alpha.83`。源码、发布制品、已安装版本和实际加载运行时需分别确认;本地升级和中断会话的重启仍需用户批准。
30
+ > 当前文档与安装命令对应版本 `0.4.0-alpha.85`。源码、发布制品、已安装版本和实际加载运行时需分别确认;本地升级和中断会话的重启仍需用户批准。
31
31
 
32
32
  Web search 路由现在优先显示在插件详情页;宿主不支持详情页插槽时才回退到 **设置 → 模型**或独立 Web search section。搜索子 Fiber 仍独立等待 Remote,不影响账号控件和既有搜索安全检查。
33
33
 
@@ -35,7 +35,7 @@ Web search 路由现在优先显示在插件详情页;宿主不支持详情页
35
35
 
36
36
  ## 兼容基线与待验收目标
37
37
 
38
- 托管 Copilot 返回 `408 / user_request_timeout` 且确认是读取请求体超时时,现会显示 `COPILOT_REQUEST_BODY_TIMEOUT`,并在可观测时给出最终 JSON 请求的 UTF-8 字节数。字节不是上下文 token,上传超时也不证明上下文超限。原生重试与失败分类保持不变。重试耗尽后,可显式压缩会话或减少附件/工具输出再试,并检查网络/代理及 [GitHub 服务状态](https://www.githubstatus.com/)。压缩不保证成功,也无法修复网络或服务故障;调大客户端超时不会改变服务端超时。插件不会自动裁剪历史、切换模型、压缩或新增重试循环,未识别错误仍由原生流程处理。
38
+ 托管 Copilot 返回 `408 / user_request_timeout` 且确认是读取请求体超时时,会显示 `COPILOT_REQUEST_BODY_TIMEOUT`,并在可观测时给出最终 JSON 的 UTF-8 字节数、有界的纯数字构成统计和 fetch 到响应头的耗时。构成分为会话、工具定义、顶层 system/instructions 和其他/封装;图片块与 opaque replay 是会话内互不重叠的子集。会话剩余部分包括文本/工具历史、封装及未知字段,不代表纯文本量;图片块包含 URL/引用,不是解码后的图片大小。耗时是往返时间,**不是上传时长**;字节不是 token、供应商大小上限或原因证明。缺失、未知结构、超出工作界限的证据明确标为不可用。仅在确认对应错误后才分析,不记录正文、凭证或 replay 内容。原生重试与失败分类保持不变。重试耗尽后,可据此选择**显式**调整原生图片 offload 预算或压缩可压缩历史;工具定义及 opaque replay 仍可能保留。另需检查网络/代理及 [GitHub 服务状态](https://www.githubstatus.com/)。压缩不保证成功,也无法修复网络或服务故障;调大客户端超时不会改变服务端超时。插件不会自动裁剪历史、改配置、切换模型、压缩或新增重试循环,未识别错误仍由原生流程处理。
39
39
 
40
40
  托管 HTTP/SSE 聊天现区分**字节空闲**与**助手输出静默**。Core 原生计时只看助手 chunk,忽略 SSE 心跳;未修改原生适配器的合成测试已复现“仍有字节却超时”。默认连续五分钟无响应头/非空响应体字节仍失败;实际字节进展只允许助手输出静默延长到十分钟,持续心跳也不能无限等待,消费者处理输出的时间不计入空闲。`chatStreamLiveness: false` 恢复纯原生计时;显式 WebSocket/`auto` transport 保持原生行为。这修复已复现的误判机制,不保证消除所有重试或服务端 HTTP 408,也不证明某次生产故障中实际存在心跳。
41
41
 
@@ -124,10 +124,10 @@ node package/scripts/check-search-composition.mjs --profile-dir /absolute/profil
124
124
  仅对独立的具名 profile,获准且网络可用时,可通过受支持的 CLI 命令安装:
125
125
 
126
126
  ```sh
127
- dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.83/dsh-github-copilot-0.4.0-alpha.83.tgz
127
+ dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.85/dsh-github-copilot-0.4.0-alpha.85.tgz
128
128
  ```
129
129
 
130
- Desktop profile 请在完成同样的预检后,使用 Desktop 原生包管理器安装 `dsh-github-copilot@0.4.0-alpha.83`。Desktop 保留 `desktop` profile,CLI 不负责管理。若 registry 被公司封禁或不可用,不要更换网络绕行或使用离线 CLI;请停止。[受控离线 CLI 流程](./docs/npm-distribution.md#controlled-offline-cli-maintenance-for-standalone-profiles)仅适用于独立具名 profile,不适用于 Desktop。
130
+ Desktop profile 请在完成同样的预检后,使用 Desktop 原生包管理器安装 `dsh-github-copilot@0.4.0-alpha.85`。Desktop 保留 `desktop` profile,CLI 不负责管理。若 registry 被公司封禁或不可用,不要更换网络绕行或使用离线 CLI;请停止。[受控离线 CLI 流程](./docs/npm-distribution.md#controlled-offline-cli-maintenance-for-standalone-profiles)仅适用于独立具名 profile,不适用于 Desktop。
131
131
 
132
132
  随后打开上表对应的 Models UI,找到 **GitHub Copilot**,点击 **Sign in** 并完成 GitHub device-code 流程。安装会修改指定 profile;是否立即激活取决于该 profile 的常规 reload/restart 策略。
133
133
 
@@ -188,7 +188,7 @@ Agent 应把浏览器授权视为需要用户完成的 handoff,而不是自行
188
188
  5. 确认 **Signed in** 并检查自动发现结果,再请用户选择模型。已登录时打开 Models 会自动确保缺失/过期元数据,新鲜 ready 缓存不发请求。错误可使用 **Retry**,有意强制更新时使用 **Manage → Refresh models**,不作为常规设置步骤。状态读取本身不发现;登录、元数据与真实调用成功是独立证据。
189
189
  6. 只有用户明确要求断开账号时才使用 **Sign out**;它会删除 Copilot credential record,但保留 route settings。
190
190
 
191
- 每个新版本默认同时分发到 GitHub Releases 和 npm,两个渠道使用同一份已验证 tarball。应固定版本并核对所用渠道的证据:Release 的 `SHA256SUMS`;从 npm 安装时另核对 `dist.integrity`。Desktop profile 只能通过原生 Desktop 包管理器安装;获准且 registry 可用时输入 `dsh-github-copilot@0.4.0-alpha.83`,不是 URL 或本地文件。Desktop 保留 `desktop` profile,不能通过 DSH CLI 管理。受控离线 CLI 维护仅适用于独立具名 profile,不得作为 Desktop 安装绕行方案。[双渠道发布与 OIDC 要求](./docs/npm-distribution.md)保持不变。
191
+ 每个新版本默认同时分发到 GitHub Releases 和 npm,两个渠道使用同一份已验证 tarball。应固定版本并核对所用渠道的证据:Release 的 `SHA256SUMS`;从 npm 安装时另核对 `dist.integrity`。Desktop profile 只能通过原生 Desktop 包管理器安装;获准且 registry 可用时输入 `dsh-github-copilot@0.4.0-alpha.85`,不是 URL 或本地文件。Desktop 保留 `desktop` profile,不能通过 DSH CLI 管理。受控离线 CLI 维护仅适用于独立具名 profile,不得作为 Desktop 安装绕行方案。[双渠道发布与 OIDC 要求](./docs/npm-distribution.md)保持不变。
192
192
 
193
193
  **Desktop package 更新与 Web 生命周期边界:**原生 manager 对已安装 package 原位升级返回的 `restart-required` 是权威结果,与移除/重加 plugin bundle 的行为是两个不同问题。涉及服务重编排补丁(`cordis.patch.yml`,如本插件所采用的隔离路由 Web 搜索层)的停用、移除或升级,可能让依赖条目保持 pending,直到完全退出并冷重启 Desktop。若原生 manager 只报告类似 `pending (waiting for service: web)` 的条目,同时本插件已经显示 **Off**,说明请求的停用状态已经落盘;请冷重启 Desktop,不要反复切换或重装插件。其它错误不属于此提示范围,仍需单独排查。
194
194
 
@@ -479,8 +479,8 @@ node scripts/agent.mjs attribution "DeepSeek Harness (DSH)"
479
479
  `package.json` 声明公开 npm 分发。Release tag 必须严格等于 `v${package.json.version}`。预发布使用 `alpha`、`beta` 或 `rc` 及对应 npm dist-tag,只有稳定版使用 `latest`。Release workflow 执行 frozen install 和完整门禁,只打包一次(重试恢复原始归档),验证 `SHA256SUMS`,发布不可变 GitHub Release,再通过 OIDC 将同一份字节发布到 npm。任一渠道失败都表示交付未完成。首次建包须由获准环境中的维护者完成;staging 要求包已存在,不能代替首次建包。不会批量补发历史版本。
480
480
 
481
481
  ```sh
482
- curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.83/dsh-github-copilot-0.4.0-alpha.83.tgz
483
- curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.83/SHA256SUMS
482
+ curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.85/dsh-github-copilot-0.4.0-alpha.85.tgz
483
+ curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.85/SHA256SUMS
484
484
  sha256sum --check SHA256SUMS
485
485
  ```
486
486
 
@@ -488,7 +488,7 @@ PowerShell 可以对已下载的同一组文件执行:
488
488
 
489
489
  ```powershell
490
490
  $expected = (Get-Content .\SHA256SUMS).Split()[0]
491
- $actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.83.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
491
+ $actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.85.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
492
492
  if ($actual -cne $expected) { throw 'Release checksum mismatch' }
493
493
  ```
494
494
 
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "package": {
10
10
  "name": "dsh-github-copilot",
11
- "version": "0.4.0-alpha.83"
11
+ "version": "0.4.0-alpha.85"
12
12
  },
13
13
  "evidence": {
14
14
  "kind": "source-and-synthetic-test-inventory",
@@ -294,16 +294,21 @@
294
294
  "sourceMarkers": [
295
295
  {"file": "src/turn-usage-evidence.ts", "marker": "github-copilot-turn-usage-evidence"},
296
296
  {"file": "src/turn-usage-evidence.ts", "marker": "tail.tokenUsage !== undefined"},
297
- {"file": "src/turn-usage-notice.ts", "marker": "Turn Usage unavailable"},
297
+ {"file": "src/turn-usage-notice.ts", "marker": "Turn Usage incomplete"},
298
+ {"file": "src/turn-usage-evidence.ts", "marker": "stateVersion: 2"},
299
+ {"file": "src/request-body-timeout-marker.ts", "marker": "COPILOT_REQUEST_BODY_TIMEOUT"},
298
300
  {"file": "src/auto-model-presentation.ts", "marker": "turnUsageEvidenceDefinition"},
299
301
  {"file": "scripts/verify-tagged-core.mjs", "marker": "tests/fixtures/turn-usage-core.fixture.ts"}
300
302
  ],
301
303
  "tests": [
302
304
  {"file": "tests/turn-usage-evidence.spec.ts", "name": "explains a recovered local block alongside reported successful steps without summing tokens"},
303
305
  {"file": "tests/turn-usage-evidence.spec.ts", "name": "does not label generic overflow, provider errors or ambiguous streams as pre-dispatch"},
306
+ {"file": "tests/turn-usage-evidence.spec.ts", "name": "retains same-attempt timeout coordinates and proven same-step retry completion without filling usage"},
307
+ {"file": "tests/turn-usage-evidence.spec.ts", "name": "keeps incomplete, reordered, interrupted and cross-step retry evidence uncertain"},
304
308
  {"file": "tests/turn-usage-notice.spec.ts", "name": "keeps the fixed-height footer compact and opens a bounded nonmodal explanation"},
305
309
  {"file": "tests/turn-usage-integration.spec.ts", "name": "explains native missing usage even when the independent selection Remote fails"},
306
310
  {"file": "tests/fixtures/turn-usage-core.fixture.ts", "name": "reproduces the finish-only local block and explains it without changing native accounting"},
311
+ {"file": "tests/fixtures/turn-usage-core.fixture.ts", "name": "associates a recorded 408 with its missing sample and exact retry without restoring the native total"},
307
312
  {"file": "tests/fixtures/reasoning-presentation-core.fixture.ts", "name": "explains missing turn Usage through native assembly and scoped actions (%s)"}
308
313
  ]
309
314
  },
@@ -571,7 +576,8 @@
571
576
  {"file": "src/model-exclusions.ts", "marker": "class ModelExclusionTurns"},
572
577
  {"file": "src/remote.ts", "marker": "githubCopilot.setModelExcluded"},
573
578
  {"file": "src/preview-provider.ts", "marker": "native.streamSimple"},
574
- {"file": "src/request-body-timeout.ts", "marker": "COPILOT_REQUEST_BODY_TIMEOUT"},
579
+ {"file": "src/request-body-timeout-marker.ts", "marker": "COPILOT_REQUEST_BODY_TIMEOUT"},
580
+ {"file": "src/request-body-evidence.ts", "marker": "REQUEST_BODY_EVIDENCE_LIMITS"},
575
581
  {"file": "src/copilot-stream-liveness.ts", "marker": "COPILOT_STREAM_IDLE_TIMEOUT"},
576
582
  {"file": "src/preview-route.ts", "marker": "Math.min(idle * 2, 2_147_483_647)"},
577
583
  {"file": "src/response-error-body.ts", "marker": "readResponseErrorJson"},
@@ -591,6 +597,8 @@
591
597
  {"file": "tests/preview-route.spec.ts", "name": "enriches only a verified 408 while preserving native failure classification and retry ownership"},
592
598
  {"file": "tests/preview-provider.spec.ts", "name": "observes verified %s timeout without changing bytes, Response, native retries or credential ownership"},
593
599
  {"file": "tests/request-body-timeout.spec.ts", "name": "bounds stalled response observation and gives cancellation priority"},
600
+ {"file": "tests/request-body-evidence.spec.ts", "name": "measures a nine MiB native-style inline image without exposing or decoding it"},
601
+ {"file": "tests/preview-provider.spec.ts", "name": "captures final %s callback bytes and dispatch-local header time before clone observation"},
594
602
  {"file": "tests/copilot-stream-liveness.spec.ts", "name": "does not count consumer think time as provider idle"},
595
603
  {"file": "tests/copilot-stream-adapter.spec.ts", "name": "reproduces native semantic timeout despite ongoing SSE bytes"},
596
604
  {"file": "tests/copilot-stream-adapter.spec.ts", "name": "allows real late output after the original semantic-idle boundary"},
@@ -67,6 +67,12 @@ The existing `enabled` switch remains hosted-search-only. These controls do not
67
67
 
68
68
  HTTP `408 / user_request_timeout` is separate from input-budget overflow. For the exact observed request-body timeout response, the managed route supplies a safe `COPILOT_REQUEST_BODY_TIMEOUT` diagnostic and final JSON UTF-8 byte count when available, while preserving native failure classification and retries. These bytes include serialized messages, tools and replay/attachments; they are not token occupancy or an advertised HTTP-size limit. Repeated unchanged retries cannot reduce the request. After retries exhaust, an explicit native compaction may reduce compressible history, but giant fixed prefixes/attachments and network/service faults may remain. The existing optional manual recovery engine must be separately selected; installing the account plugin does not enable it. No 408 triggers automatic compaction, hidden history trimming, credential refresh, model switching, timeout changes or a second retry loop. Consult [GitHub troubleshooting](https://docs.github.com/en/copilot/how-tos/troubleshoot-copilot/troubleshoot-common-issues) and [service status](https://www.githubstatus.com/) without bypassing network policy.
69
69
 
70
+ For [#263](https://github.com/cloga/dsh-github-copilot/issues/263), the same public final-body fetch hook additionally captures a monotonic fetch-invocation-to-response-header duration, before clone observation. This is round-trip latency, not measured upload progress, throughput or time spent reading the body. Only a verified exact error triggers numeric composition analysis; successful requests are not analyzed or retained.
71
+
72
+ Original serialized value spans partition total bytes into `input`/`messages`, tool definitions, protocol-owned top-level `instructions`/`system` and residual keys/framing. Within conversation only, supported structural image blocks and opaque replay string spans form disjoint subsets; the rest includes text/tool history, framing and unknown representations. Completions system/developer messages stay in conversation. Image URLs and file references are counted as wire blocks, not fetched/decoded file sizes. Responses encrypted content and Anthropic signature/redacted data are counted without interpreting or decrypting replay; no raw contents, IDs, hashes or credentials are reported.
73
+
74
+ Analysis accepts at most 16 MiB of UTF-8 JSON, with a pre-parse depth/token bound (64 levels / 131072 tokens), followed by at most 65536 values and 128 serialized key characters. Missing, malformed, unsupported, size-limited and work-limited evidence has a named unavailable state with no partial success-shaped totals. Limits bound diagnostic cost and are **not supplier request limits or admission controls**. A reported 9 MiB body may be analyzed, but its size does not establish why a timeout occurred. If image blocks dominate, an explicitly selected smaller `chatMaxRequestImageBytes` can authorize native image offload; if compressible history dominates, explicit native compaction can help. Tool definitions and opaque replay may remain; small failing requests still warrant network/service investigation. Neither choice is performed automatically or guaranteed to reduce 408 frequency.
75
+
70
76
  This implementation is preventive, not a general rescue summarizer. A manual summary whose full input already exceeds the hard budget fails before model transport. It does not silently trim, fabricate a partial checkpoint, or claim that refusing the request recovered the history. Giant fixed prefixes or an indivisible latest unit can also prevent useful reduction.
71
77
 
72
78
  The #228 investigation confirmed a separate Auto undercount (#230): Core reasoning blocks caused the incompatible pi-ai estimator to throw and drop complete assistant messages. Auto now uses the native Core meter, without changing final native provider admission. This fixes candidate selection evidence, not a genuinely oversized summary. In the reported failure class, a roughly 508k-token summary input exceeded a roughly 368k-token input budget even with a 65,536-token output reservation. Reducing output reservation cannot remove an independently binding prompt ceiling.
@@ -40,9 +40,13 @@ Official rc.2 `deriveTurnTokenUsage` requires complete lifecycle and exact usage
40
40
 
41
41
  ### Plugin-local explanation
42
42
 
43
- A plugin-owned public conversation definition retains only bounded counts of settlements without reported samples and finish-only attempts with the exact recorded local diagnostic. On a completed Copilot reply whose native tail has no `tokenUsage`, the additive assistant-actions control opens **Turn Usage unavailable**. It uses the incumbent nonmodal popover pattern rather than expanding the native fixed-height footer.
43
+ A plugin-owned public conversation definition retains bounded counts of settlements without reported samples and finish-only attempts with the exact recorded local diagnostic. On a completed Copilot reply whose native tail has no `tokenUsage`, the additive assistant-actions control opens **Turn Usage incomplete** (previously **Turn Usage unavailable**). It uses the incumbent nonmodal popover pattern rather than expanding the native fixed-height footer.
44
44
 
45
- The explanation distinguishes recorded local budget blocks, other settlements without samples, and missing turn-start/projection evidence. Generic provider overflow is never labeled pre-dispatch. Invalid reported samples and missing lifecycle boundaries can also make native accounting unavailable; if no cause is established, the explanation remains unknown rather than reimplementing the native validator. Projection and selection Remote failures remain independent, with named diagnostics; Retry only rereads selection evidence, never inference or accounting.
45
+ The explanation distinguishes recorded local budget blocks, same-settlement request-body timeout diagnoses, other settlements without samples, and missing turn-start/projection evidence. A timeout is recognized only from the shared bounded plugin diagnostic marker on that settlement's unambiguous error finish, never from a neighboring message, generic `408` text or cancellation. The disclosure copies no raw failure text or payload. It retains at most eight timeout details containing only recorded step/event sequence numbers and a recovery boolean, while keeping the full saturating diagnostic count. These are original record coordinates, not invented attempt numbers or navigation links. Unknown coordinates remain unknown. Older count-only projections remain readable; projection state version 2 requests refolding without converting history.
46
+
47
+ A successful retry claim requires strictly increasing event sequences and the same turn/step through the failed `assistant/attempt`, `llm/retry`, matching `llm/retry-started` (same retry ID and ordinal), and an `assistant/message` with an unambiguous successful `stop` finish. Missing, interrupted or mismatched chains remain uncertain. A later arbitrary successful reply or another step is not recovery evidence. This intentionally conservative recognition does not claim that an unrecognized retry failed. Even a confirmed retry cannot fill the failed attempt's usage; the native whole-turn total stays unavailable and billing remains unknown.
48
+
49
+ Generic provider overflow is never labeled pre-dispatch. Invalid reported samples and missing lifecycle boundaries can also make native accounting unavailable; if no cause is established, the explanation remains unknown rather than reimplementing the native validator. Projection and selection Remote failures remain independent, with named diagnostics; Retry only rereads selection evidence, never inference or accounting.
46
50
 
47
51
  The control is historical evidence, not current context occupancy, account credits, dispatch attestation or a supplier receipt. It adds no token sum or fabricated zero usage, changes no native projection key, reads no opaque replay, and rewrites no history. Native complete Usage suppresses the explanation. Ordinary pressure protection, compaction transactions, errors, cancellation and retry remain unchanged. Removing the plugin removes the explanation without a data migration.
48
52
 
package/lib/client.js CHANGED
@@ -6490,12 +6490,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6490
6490
  return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
6491
6491
  }
6492
6492
  function isTurnUsageEvidence(value) {
6493
- return record$4(value) && typeof value.ended === "boolean" && typeof value.hasStart === "boolean" && count$1(value.localPreDispatchBlocks) && count$1(value.unreportedAttempts);
6493
+ return record$4(value) && typeof value.ended === "boolean" && typeof value.hasStart === "boolean" && count$1(value.localPreDispatchBlocks) && count$1(value.unreportedAttempts) && (value.requestBodyTimeouts === void 0 || count$1(value.requestBodyTimeouts) && value.requestBodyTimeouts <= value.unreportedAttempts) && (value.timeoutDetails === void 0 || Array.isArray(value.timeoutDetails) && value.timeoutDetails.length <= 8 && count$1(value.requestBodyTimeouts) && value.timeoutDetails.length <= value.requestBodyTimeouts && value.timeoutDetails.every((detail) => record$4(detail) && typeof detail.recovered === "boolean" && (detail.step === void 0 || count$1(detail.step)) && (detail.seq === void 0 || count$1(detail.seq)) && (!detail.recovered || count$1(detail.step) && count$1(detail.seq))));
6494
6494
  }
6495
6495
  function coordinates(event) {
6496
6496
  if (!record$4(event) || typeof event.type !== "string" || !record$4(event.data) || !count$1(event.data.turn) || ![
6497
6497
  "turn/start",
6498
6498
  "turn/end",
6499
+ "step/start",
6500
+ "step/end",
6501
+ "llm/retry",
6502
+ "llm/retry-started",
6499
6503
  "assistant/message",
6500
6504
  "assistant/attempt"
6501
6505
  ].includes(event.type)) return void 0;
@@ -6503,9 +6507,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6503
6507
  return {
6504
6508
  turn: event.data.turn,
6505
6509
  type: event.type,
6506
- data: event.data
6510
+ data: event.data,
6511
+ ...count$1(event.seq) ? { seq: event.seq } : {}
6507
6512
  };
6508
6513
  }
6514
+ function finishReason(data) {
6515
+ if (!Array.isArray(data.stream)) return void 0;
6516
+ let result;
6517
+ for (const entry of data.stream) if (record$4(entry) && entry.type === "chunk" && record$4(entry.chunk) && entry.chunk.type === "finish") {
6518
+ if (result !== void 0 || !record$4(entry.chunk.reason)) return void 0;
6519
+ result = entry.chunk.reason;
6520
+ }
6521
+ return result;
6522
+ }
6523
+ function requestBodyTimeout(data) {
6524
+ const reason = finishReason(data);
6525
+ if (reason?.kind !== "error" || !record$4(reason.failure)) return false;
6526
+ const { code, message } = reason.failure;
6527
+ return typeof code === "string" && code !== "ABORTED" && typeof message === "string" && message.length <= 8192 && (message === "COPILOT_REQUEST_BODY_TIMEOUT: Copilot returned HTTP 408 / user_request_timeout while reading the request body; this is not context-window overflow." || message.startsWith(`COPILOT_REQUEST_BODY_TIMEOUT: Copilot returned HTTP 408 / user_request_timeout while reading the request body; this is not context-window overflow. `));
6528
+ }
6509
6529
  function unreported(type, data) {
6510
6530
  if (type === "assistant/message" && data.usage !== void 0) return false;
6511
6531
  return !Array.isArray(data.stream) || !data.stream.some((entry) => record$4(entry) && entry.type === "chunk" && record$4(entry.chunk) && entry.chunk.type === "usage" && entry.chunk.usage !== void 0);
@@ -6533,13 +6553,57 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6533
6553
  };
6534
6554
  const missing = (parsed.type === "assistant/message" || parsed.type === "assistant/attempt") && unreported(parsed.type, parsed.data);
6535
6555
  const local = missing && parsed.type === "assistant/attempt" && localBlock(parsed.data);
6556
+ const timeout = missing && requestBodyTimeout(parsed.data);
6557
+ let details = value.timeoutDetails;
6558
+ let pending = state?.pending;
6559
+ if (pending !== void 0) {
6560
+ const same = parsed.data.step === pending.step && parsed.seq !== void 0 && parsed.seq > pending.seq;
6561
+ if (same && parsed.seq !== void 0 && parsed.type === "llm/retry" && pending.phase === "failed" && typeof parsed.data.retryId === "string" && parsed.data.retryId.length > 0 && parsed.data.retryId.length <= 256 && count$1(parsed.data.retry) && parsed.data.retry > 0) pending = {
6562
+ ...pending,
6563
+ seq: parsed.seq,
6564
+ phase: "scheduled",
6565
+ retryId: parsed.data.retryId,
6566
+ retry: parsed.data.retry
6567
+ };
6568
+ else if (same && parsed.seq !== void 0 && parsed.type === "llm/retry-started" && pending.phase === "scheduled" && parsed.data.retryId === pending.retryId && parsed.data.retry === pending.retry) pending = {
6569
+ ...pending,
6570
+ seq: parsed.seq,
6571
+ phase: "started"
6572
+ };
6573
+ else {
6574
+ if (same && parsed.type === "assistant/message" && pending.phase === "started" && finishReason(parsed.data)?.kind === "stop") details = details?.map((detail, index) => index === pending?.index ? {
6575
+ ...detail,
6576
+ recovered: true
6577
+ } : detail);
6578
+ pending = void 0;
6579
+ }
6580
+ }
6581
+ if (timeout && (details?.length ?? 0) < 8) {
6582
+ const index = details?.length ?? 0;
6583
+ details = [...details ?? [], {
6584
+ ...count$1(parsed.data.step) ? { step: parsed.data.step } : {},
6585
+ ...parsed.seq !== void 0 ? { seq: parsed.seq } : {},
6586
+ recovered: false
6587
+ }];
6588
+ if (parsed.type === "assistant/attempt" && count$1(parsed.data.step) && parsed.seq !== void 0) pending = {
6589
+ index,
6590
+ step: parsed.data.step,
6591
+ seq: parsed.seq,
6592
+ phase: "failed"
6593
+ };
6594
+ }
6536
6595
  return {
6537
6596
  turn: parsed.turn,
6597
+ ...pending !== void 0 ? { pending } : {},
6538
6598
  value: {
6539
6599
  ended: value.ended || parsed.type === "turn/end",
6540
6600
  hasStart: value.hasStart || parsed.type === "turn/start",
6541
6601
  localPreDispatchBlocks: Math.min(Number.MAX_SAFE_INTEGER, value.localPreDispatchBlocks + (local ? 1 : 0)),
6542
- unreportedAttempts: Math.min(Number.MAX_SAFE_INTEGER, value.unreportedAttempts + (missing && !local ? 1 : 0))
6602
+ unreportedAttempts: Math.min(Number.MAX_SAFE_INTEGER, value.unreportedAttempts + (missing && !local ? 1 : 0)),
6603
+ ...timeout || value.requestBodyTimeouts !== void 0 ? {
6604
+ requestBodyTimeouts: Math.min(Number.MAX_SAFE_INTEGER, (value.requestBodyTimeouts ?? 0) + (timeout ? 1 : 0)),
6605
+ timeoutDetails: details
6606
+ } : {}
6543
6607
  }
6544
6608
  };
6545
6609
  }
@@ -6551,12 +6615,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6551
6615
  return {
6552
6616
  localPreDispatchBlocks: parsed?.localPreDispatchBlocks ?? 0,
6553
6617
  unreportedAttempts: parsed?.unreportedAttempts ?? 0,
6554
- incompleteHistory: parsed?.hasStart !== true
6618
+ incompleteHistory: parsed?.hasStart !== true,
6619
+ ...parsed?.requestBodyTimeouts !== void 0 ? {
6620
+ requestBodyTimeouts: parsed.requestBodyTimeouts,
6621
+ timeoutDetails: parsed.timeoutDetails
6622
+ } : {}
6555
6623
  };
6556
6624
  }
6557
- /** Diagnostic event counts only, not a competing usage total or billing projection. */
6625
+ /** Bounded diagnostic evidence, not a competing usage total or billing projection. */
6558
6626
  const turnUsageEvidenceDefinition = {
6559
6627
  kind: TURN_USAGE_EVIDENCE_KEY,
6628
+ stateVersion: 2,
6560
6629
  match(event) {
6561
6630
  const parsed = coordinates(event);
6562
6631
  return parsed ? {
@@ -6577,7 +6646,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6577
6646
  const state = context.state ?? context.matches.reduce((state, match) => fold(state, match.event), void 0);
6578
6647
  if (!state) return null;
6579
6648
  const value = state.value;
6580
- if (previous?.turn === state.turn && previous.value.ended === value.ended && previous.value.hasStart === value.hasStart && previous.value.localPreDispatchBlocks === value.localPreDispatchBlocks && previous.value.unreportedAttempts === value.unreportedAttempts) return previous;
6649
+ if (previous?.turn === state.turn && previous.value.ended === value.ended && previous.value.hasStart === value.hasStart && previous.value.localPreDispatchBlocks === value.localPreDispatchBlocks && previous.value.unreportedAttempts === value.unreportedAttempts && previous.value.requestBodyTimeouts === value.requestBodyTimeouts && JSON.stringify(previous.value.timeoutDetails) === JSON.stringify(value.timeoutDetails)) return previous;
6581
6650
  return {
6582
6651
  kind: "turn",
6583
6652
  turn: state.turn,
@@ -6599,7 +6668,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6599
6668
  const trigger = (0, react.useRef)(null);
6600
6669
  const panel = (0, react.useRef)(null);
6601
6670
  const close = (0, react.useRef)(null);
6602
- const label = zh ? "本轮 Usage 不可用" : "Turn Usage unavailable";
6671
+ const label = zh ? "本轮用量统计不完整" : "Turn Usage incomplete";
6672
+ const timeouts = diagnostic.requestBodyTimeouts ?? 0;
6673
+ const unknown = diagnostic.unreportedAttempts - timeouts;
6603
6674
  (0, react.useLayoutEffect)(() => {
6604
6675
  if (!open) return;
6605
6676
  panel.current?.showPopover?.();
@@ -6695,7 +6766,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6695
6766
  color: "var(--dsw-alias-label-primary, CanvasText)",
6696
6767
  lineHeight: 1.6
6697
6768
  }
6698
- }, (0, react.createElement)("strong", null, label), (0, react.createElement)("p", null, zh ? "原生统计无法证明本轮所有尝试的完整总量。部分步骤有用量,不代表整轮总量已知。" : "Native accounting cannot prove a complete total for every attempt in this turn. Reported usage on some steps is not a complete turn total."), diagnostic.localPreDispatchBlocks > 0 ? (0, react.createElement)("p", null, zh ? `记录中有 ${diagnostic.localPreDispatchBlocks} 次插件发出前的本地输入预算拦截,未记录供应商用量。后续压缩恢复不会补齐这些尝试的用量。` : `The history records ${diagnostic.localPreDispatchBlocks} local input-budget ${diagnostic.localPreDispatchBlocks === 1 ? "block" : "blocks"} before provider dispatch, with no reported provider usage. Subsequent compaction recovery does not fill in those attempts' usage.`) : null, diagnostic.unreportedAttempts > 0 ? (0, react.createElement)("p", null, zh ? `另有 ${diagnostic.unreportedAttempts} 次完成或失败记录未带用量样本;不能据此判断请求是否发出或计费。` : `${diagnostic.unreportedAttempts} other ${diagnostic.unreportedAttempts === 1 ? "settlement has" : "settlements have"} no reported usage sample; this does not establish whether a request was sent or billed.`) : null, diagnostic.incompleteHistory ? (0, react.createElement)("p", null, zh ? "本页未保留完整轮次证据;以上记录可能不完整。" : "Complete turn evidence is not retained on this page; these records may be incomplete.") : null, diagnostic.localPreDispatchBlocks === 0 && diagnostic.unreportedAttempts === 0 ? (0, react.createElement)("p", null, zh ? "现有证据无法确定原因;缺失的生命周期或无效用量也会使原生统计不可用。" : "The available evidence does not identify a cause; missing lifecycle boundaries or invalid usage can also make native accounting unavailable.") : null, (0, react.createElement)("p", null, zh ? "这是只读说明,不是零用量、部分合计或当前上下文占用。原生 Usage、用量记录与压缩恢复均保持不变。" : "This read-only explanation is not zero usage, a partial total or current context occupancy. Native Usage, usage records and compaction recovery remain unchanged."), (0, react.createElement)("button", {
6769
+ }, (0, react.createElement)("strong", null, label), (0, react.createElement)("p", null, zh ? "本轮没有可确认的完整用量总计。回复成功,也不代表每次尝试都记录了用量。" : "A complete usage total is unavailable for this turn. A successful reply does not mean every attempt reported usage."), diagnostic.localPreDispatchBlocks > 0 ? (0, react.createElement)("p", null, zh ? `记录中有 ${diagnostic.localPreDispatchBlocks} 次插件发出前的本地输入预算拦截,未记录供应商用量。后续压缩恢复不会补齐这些尝试的用量。` : `The history records ${diagnostic.localPreDispatchBlocks} local input-budget ${diagnostic.localPreDispatchBlocks === 1 ? "block" : "blocks"} before provider dispatch, with no reported provider usage. Subsequent compaction recovery does not fill in those attempts' usage.`) : null, timeouts > 0 ? (0, react.createElement)("p", null, zh ? `${timeouts} 次缺失用量的记录带有已记录的 HTTP 408 请求体读取超时诊断;这不是上下文窗口溢出,也不能据此判断是否计费。` : `${timeouts} ${timeouts === 1 ? "attempt without usage has" : "attempts without usage have"} a recorded HTTP 408 request-body timeout diagnosis. This is not context-window overflow and does not establish billing.`) : null, diagnostic.timeoutDetails?.length ? (0, react.createElement)("ul", { style: { paddingInlineStart: 20 } }, ...diagnostic.timeoutDetails.map((detail, index) => (0, react.createElement)("li", { key: index }, zh ? `${detail.step === void 0 ? "步骤未知" : `步骤 ${detail.step}`} · ${detail.seq === void 0 ? "记录编号未知" : `记录 ${detail.seq}`}:${detail.recovered ? "已记录同一步骤重试成功;但失败尝试的用量仍缺失。" : "没有足够证据确认这次尝试后重试成功。"}` : `${detail.step === void 0 ? "Step unknown" : `Step ${detail.step}`} · ${detail.seq === void 0 ? "Record unknown" : `record ${detail.seq}`}: ${detail.recovered ? "A same-step retry completed successfully; the failed attempt’s usage is still missing." : "A successful retry after this attempt is not established."}`))) : null, timeouts > (diagnostic.timeoutDetails?.length ?? 0) ? (0, react.createElement)("p", null, zh ? "这里只展示最多 8 条超时记录的定位信息;计数包含其余记录。" : "Details are limited to 8 timeout records; the count includes the remaining records.") : null, unknown > 0 ? (0, react.createElement)("p", null, zh ? `另有 ${unknown} 次完成或失败记录未带用量样本,原因未知;不能据此判断请求是否发出或计费。` : `${unknown} other ${unknown === 1 ? "settlement has" : "settlements have"} no reported usage sample and an unknown cause; this does not establish whether a request was sent or billed.`) : null, diagnostic.incompleteHistory ? (0, react.createElement)("p", null, zh ? "本页未保留完整轮次证据;以上记录可能不完整。" : "Complete turn evidence is not retained on this page; these records may be incomplete.") : null, diagnostic.localPreDispatchBlocks === 0 && diagnostic.unreportedAttempts === 0 ? (0, react.createElement)("p", null, zh ? "现有证据无法确定原因;缺失的生命周期或无效用量也会使原生统计不可用。" : "The available evidence does not identify a cause; missing lifecycle boundaries or invalid usage can also make native accounting unavailable.") : null, (0, react.createElement)("p", null, zh ? "这是只读说明,不是零用量、部分合计或当前上下文占用。原生 Usage、用量记录与压缩恢复均保持不变。" : "This read-only explanation is not zero usage, a partial total or current context occupancy. Native Usage, usage records and compaction recovery remain unchanged."), (0, react.createElement)("button", {
6699
6770
  ref: close,
6700
6771
  type: "button",
6701
6772
  style: button,