dsh-github-copilot 0.4.0-alpha.73 → 0.4.0-alpha.75
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 +1 -0
- package/CHANGELOG.md +12 -0
- package/README.md +11 -7
- package/README.zh.md +11 -7
- package/deployment-baseline.json +10 -1
- package/docs/copilot-compaction.md +2 -0
- package/docs/manual-compaction-recovery.md +19 -1
- package/docs/model-compatibility-acceptance.md +1 -0
- package/lib/index.js +103 -58
- package/lib/manual-compaction-recovery.js +156 -0
- package/lib/types/background-compaction.d.ts +30 -0
- package/lib/types/manual-compaction-recovery.d.ts +2 -0
- package/lib/types/preview-provider.d.ts +2 -0
- package/lib/types/request-body-timeout.d.ts +3 -0
- package/lib/types/response-error-body.d.ts +3 -0
- package/package.json +2 -1
package/AGENTS.md
CHANGED
|
@@ -72,6 +72,7 @@ Alpha.25 admits native `subagent/descriptor` v3, already v3 in the retained rc.1
|
|
|
72
72
|
- `src/wire.ts`, `src/wire-anthropic.ts`: inline hosted-search streaming.
|
|
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
|
+
- `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.
|
|
75
76
|
- `tests/`: unit and integration evidence; mirror the source area being changed.
|
|
76
77
|
- `deployment-baseline.json`: declared machine-readable compatibility and capability evidence inventory.
|
|
77
78
|
- `scripts/verify-deployment-baseline.mjs`: invariant drift gate.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.0-alpha.75 (prepared)
|
|
4
|
+
|
|
5
|
+
- Add safe, actionable managed `COPILOT_REQUEST_BODY_TIMEOUT` guidance for the exact observed HTTP 408 request-body timeout, including final JSON UTF-8 bytes when observable (#246).
|
|
6
|
+
- Preserve native failure classification, retry metadata, payloads, cancellation and credential ownership; no new retry, timeout change, automatic compaction, hidden trimming or model switch.
|
|
7
|
+
- Share the existing bounded clone-only response observer with replay-scope classification and cover all three native HTTP protocols, unknown/oversized/stalled replies and concurrent dispatch isolation. This is diagnostic/recovery guidance, not a claim to eliminate upstream timeouts.
|
|
8
|
+
|
|
9
|
+
## 0.4.0-alpha.74 (prepared)
|
|
10
|
+
|
|
11
|
+
- Add `/copilot-compact [status|cancel]` to the explicitly selected recovery engine when native commands/jobs are available (#244).
|
|
12
|
+
- Acknowledge a Session-owned background job promptly instead of holding Desktop's unary command request past its response-header timeout. Preserve native `/compact`, maintenance locks and compaction transactions.
|
|
13
|
+
- Deduplicate active starts, cancel and drain on teardown, and collect native settlement without waking the model or resuming a Goal. Admission is not completion; failed summaries retain their native diagnostics.
|
|
14
|
+
|
|
3
15
|
## 0.4.0-alpha.73 (prepared)
|
|
4
16
|
|
|
5
17
|
- Prevent managed Copilot failure/cancellation terminal zero-usage samples from resetting native context pressure; preserve successful zero and real nonzero usage (#242).
|
package/README.md
CHANGED
|
@@ -30,6 +30,8 @@ On official rc.2, routing is exposed through native live `Config` fields, not a
|
|
|
30
30
|
|
|
31
31
|
## Compatibility baselines and qualification targets
|
|
32
32
|
|
|
33
|
+
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
|
+
|
|
33
35
|
| DSH surface | Exact source pin | Models UI seam |
|
|
34
36
|
|---|---|---|
|
|
35
37
|
| Controlled Desktop `0.1.1-rc.2` baseline | Controlled Core commit [`a772dbb`](https://github.com/cloga/deepseek-harness/commit/a772dbbde82780bff2b9394427e9f0a24cafa1d5) on `cloga-pi-ai-model-api` | Dedicated **Settings → GitHub Copilot** section |
|
|
@@ -104,7 +106,7 @@ The Host reads GitHub's internal quota endpoint using the existing canonical OAu
|
|
|
104
106
|
|
|
105
107
|
## Install and sign in
|
|
106
108
|
|
|
107
|
-
The commands below target the package version `0.4.0-alpha.
|
|
109
|
+
The commands below target the package version `0.4.0-alpha.75`. 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):
|
|
108
110
|
|
|
109
111
|
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):
|
|
110
112
|
|
|
@@ -117,10 +119,10 @@ Include any launcher patch files with repeated `--patch /absolute/file` argument
|
|
|
117
119
|
For a standalone named profile only, the supported CLI command is:
|
|
118
120
|
|
|
119
121
|
```sh
|
|
120
|
-
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
122
|
+
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.75/dsh-github-copilot-0.4.0-alpha.75.tgz
|
|
121
123
|
```
|
|
122
124
|
|
|
123
|
-
For Desktop profiles, use Desktop's native package manager with `dsh-github-copilot@0.4.0-alpha.
|
|
125
|
+
For Desktop profiles, use Desktop's native package manager with `dsh-github-copilot@0.4.0-alpha.75` 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.
|
|
124
126
|
|
|
125
127
|
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.
|
|
126
128
|
|
|
@@ -173,7 +175,7 @@ Agents should treat the browser authorization as a human handoff, not as a token
|
|
|
173
175
|
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.
|
|
174
176
|
6. Use **Sign out** only when the user explicitly asks to disconnect the account. It deletes the Copilot credential record but preserves route settings.
|
|
175
177
|
|
|
176
|
-
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.
|
|
178
|
+
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.75`, 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).
|
|
177
179
|
|
|
178
180
|
**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.
|
|
179
181
|
|
|
@@ -332,6 +334,8 @@ Calls explicitly marked `purpose: 'compaction'` bypass the early-pressure signal
|
|
|
332
334
|
|
|
333
335
|
**Existing oversized history is not guaranteed recoverable.** The default manual compact still rejects an oversized summary before model transport. A separately selected [manual recovery engine](./docs/manual-compaction-recovery.md) can summarize compressible, balanced managed-Copilot history through bounded intermediate calls while Core retains the only durable transaction. It is opt-in as a **replacement**, not a second compaction service; merely installing the plugin does not activate it. Indivisible input, oversized fixed prefixes and truncated output fail without replacing history. No automatic model switch or hidden history deletion occurs.
|
|
334
336
|
|
|
337
|
+
When that recovery engine and native jobs are available, `/copilot-compact` starts a Session-owned background compaction without holding Desktop's command HTTP request open for the entire summary. Use `/copilot-compact status` or `/copilot-compact cancel` for its latest job. Admission is not summary success; failures remain explicit. Completion does not wake the model or resume a Goal. Native `/compact` stays unchanged, and job status is process-local.
|
|
338
|
+
|
|
335
339
|
## Copilot tool compatibility
|
|
336
340
|
|
|
337
341
|
To prevent observed invalid Copilot tool payloads, the package sets the managed route's `compat.supportsStrictMode` leaf to `false` and applies two schema-only fixes when the selected provider is canonical `github-copilot` or the plugin-owned account route `github-copilot-preview`: it removes top-level `sandbox_permissions` and `justification` properties, and rewrites Core's multi-action `update_goal` parameters as a discriminated `oneOf`. Each Goal action then advertises only its legal fields: `complete`, `pause`, and `resume` cannot carry edit or blocker fields; `blocked` requires `blocked_reason`; and `edit` alone exposes replacement fields. Execution still uses Core's original Goal tool and service. Non-Copilot prompt assemblies are unchanged.
|
|
@@ -448,8 +452,8 @@ Report the published Release URL, version, tag/commit and verified asset SHA-256
|
|
|
448
452
|
`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.
|
|
449
453
|
|
|
450
454
|
```sh
|
|
451
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
452
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
455
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.75/dsh-github-copilot-0.4.0-alpha.75.tgz
|
|
456
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.75/SHA256SUMS
|
|
453
457
|
sha256sum --check SHA256SUMS
|
|
454
458
|
```
|
|
455
459
|
|
|
@@ -457,7 +461,7 @@ PowerShell can verify the same two downloaded files with:
|
|
|
457
461
|
|
|
458
462
|
```powershell
|
|
459
463
|
$expected = (Get-Content .\SHA256SUMS).Split()[0]
|
|
460
|
-
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.
|
|
464
|
+
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.75.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
|
|
461
465
|
if ($actual -cne $expected) { throw 'Release checksum mismatch' }
|
|
462
466
|
```
|
|
463
467
|
|
package/README.zh.md
CHANGED
|
@@ -26,7 +26,7 @@ Core 管理。详见[图片兼容性与限制](./docs/image-input-compatibility.
|
|
|
26
26
|
|
|
27
27
|
截图来自当前构建 Client 的隔离浏览器 fixture,使用合成 Provider。它只证明已发布配置界面的形态,不证明真实凭据、账号权限、搜索成功或当前 Desktop 已加载。
|
|
28
28
|
|
|
29
|
-
> 当前文档与安装命令对应版本 `0.4.0-alpha.
|
|
29
|
+
> 当前文档与安装命令对应版本 `0.4.0-alpha.75`。源码、发布制品、已安装版本和实际加载运行时需分别确认;本地升级和中断会话的重启仍需用户批准。
|
|
30
30
|
|
|
31
31
|
Web search 路由现在优先显示在插件详情页;宿主不支持详情页插槽时才回退到 **设置 → 模型**或独立 Web search section。搜索子 Fiber 仍独立等待 Remote,不影响账号控件和既有搜索安全检查。
|
|
32
32
|
|
|
@@ -34,6 +34,8 @@ Web search 路由现在优先显示在插件详情页;宿主不支持详情页
|
|
|
34
34
|
|
|
35
35
|
## 兼容基线与待验收目标
|
|
36
36
|
|
|
37
|
+
托管 Copilot 返回 `408 / user_request_timeout` 且确认是读取请求体超时时,现会显示 `COPILOT_REQUEST_BODY_TIMEOUT`,并在可观测时给出最终 JSON 请求的 UTF-8 字节数。字节不是上下文 token,上传超时也不证明上下文超限。原生重试与失败分类保持不变。重试耗尽后,可显式压缩会话或减少附件/工具输出再试,并检查网络/代理及 [GitHub 服务状态](https://www.githubstatus.com/)。压缩不保证成功,也无法修复网络或服务故障;调大客户端超时不会改变服务端超时。插件不会自动裁剪历史、切换模型、压缩或新增重试循环,未识别错误仍由原生流程处理。
|
|
38
|
+
|
|
37
39
|
| DSH 表面 | 精确源码 pin | Models UI 接口 |
|
|
38
40
|
|---|---|---|
|
|
39
41
|
| 受控 Desktop `0.1.1-rc.2` 基线 | `cloga-pi-ai-model-api` 上的受控 Core commit [`a772dbb`](https://github.com/cloga/deepseek-harness/commit/a772dbbde82780bff2b9394427e9f0a24cafa1d5) | 独立的 **Settings → GitHub Copilot** section |
|
|
@@ -119,10 +121,10 @@ node package/scripts/check-search-composition.mjs --profile-dir /absolute/profil
|
|
|
119
121
|
仅对独立的具名 profile,获准且网络可用时,可通过受支持的 CLI 命令安装:
|
|
120
122
|
|
|
121
123
|
```sh
|
|
122
|
-
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
124
|
+
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.75/dsh-github-copilot-0.4.0-alpha.75.tgz
|
|
123
125
|
```
|
|
124
126
|
|
|
125
|
-
Desktop profile 请在完成同样的预检后,使用 Desktop 原生包管理器安装 `dsh-github-copilot@0.4.0-alpha.
|
|
127
|
+
Desktop profile 请在完成同样的预检后,使用 Desktop 原生包管理器安装 `dsh-github-copilot@0.4.0-alpha.75`。Desktop 保留 `desktop` profile,CLI 不负责管理。若 registry 被公司封禁或不可用,不要更换网络绕行或使用离线 CLI;请停止。[受控离线 CLI 流程](./docs/npm-distribution.md#controlled-offline-cli-maintenance-for-standalone-profiles)仅适用于独立具名 profile,不适用于 Desktop。
|
|
126
128
|
|
|
127
129
|
随后打开上表对应的 Models UI,找到 **GitHub Copilot**,点击 **Sign in** 并完成 GitHub device-code 流程。安装会修改指定 profile;是否立即激活取决于该 profile 的常规 reload/restart 策略。
|
|
128
130
|
|
|
@@ -175,7 +177,7 @@ Agent 应把浏览器授权视为需要用户完成的 handoff,而不是自行
|
|
|
175
177
|
5. 确认 **Signed in** 并检查自动发现结果,再请用户选择模型。已登录时打开 Models 会自动确保缺失/过期元数据,新鲜 ready 缓存不发请求。错误可使用 **Retry**,有意强制更新时使用 **Manage → Refresh models**,不作为常规设置步骤。状态读取本身不发现;登录、元数据与真实调用成功是独立证据。
|
|
176
178
|
6. 只有用户明确要求断开账号时才使用 **Sign out**;它会删除 Copilot credential record,但保留 route settings。
|
|
177
179
|
|
|
178
|
-
每个新版本默认同时分发到 GitHub Releases 和 npm,两个渠道使用同一份已验证 tarball。应固定版本并核对所用渠道的证据:Release 的 `SHA256SUMS`;从 npm 安装时另核对 `dist.integrity`。Desktop profile 只能通过原生 Desktop 包管理器安装;获准且 registry 可用时输入 `dsh-github-copilot@0.4.0-alpha.
|
|
180
|
+
每个新版本默认同时分发到 GitHub Releases 和 npm,两个渠道使用同一份已验证 tarball。应固定版本并核对所用渠道的证据:Release 的 `SHA256SUMS`;从 npm 安装时另核对 `dist.integrity`。Desktop profile 只能通过原生 Desktop 包管理器安装;获准且 registry 可用时输入 `dsh-github-copilot@0.4.0-alpha.75`,不是 URL 或本地文件。Desktop 保留 `desktop` profile,不能通过 DSH CLI 管理。受控离线 CLI 维护仅适用于独立具名 profile,不得作为 Desktop 安装绕行方案。[双渠道发布与 OIDC 要求](./docs/npm-distribution.md)保持不变。
|
|
179
181
|
|
|
180
182
|
**Desktop package 更新与 Web 生命周期边界:**原生 manager 对已安装 package 原位升级返回的 `restart-required` 是权威结果,与移除/重加 plugin bundle 的行为是两个不同问题。涉及服务重编排补丁(`cordis.patch.yml`,如本插件所采用的隔离路由 Web 搜索层)的停用、移除或升级,可能让依赖条目保持 pending,直到完全退出并冷重启 Desktop。若原生 manager 只报告类似 `pending (waiting for service: web)` 的条目,同时本插件已经显示 **Off**,说明请求的停用状态已经落盘;请冷重启 Desktop,不要反复切换或重装插件。其它错误不属于此提示范围,仍需单独排查。
|
|
181
183
|
|
|
@@ -335,6 +337,8 @@ Responses 解析器会保留公开的 `reasoning_summary_text`、`reasoning_text
|
|
|
335
337
|
|
|
336
338
|
**仍不保证救回所有已经超限的旧历史。** 默认手动 compact 仍会在模型发送前拒绝超限摘要。另有可单独选择的[手动恢复引擎](./docs/manual-compaction-recovery.md):仅对可分割且工具调用配对完整的托管 Copilot 历史进行有界中间摘要,最终持久事务仍由 Core 负责。它必须**替换**原有压缩服务而非并列安装;仅安装插件不会启用。不可分割的输入、过大的固定前缀或被截断的输出都不会替换历史;不会自动切换模型或偷偷删除历史。
|
|
337
339
|
|
|
340
|
+
选用该恢复引擎且原生 jobs 服务可用时,`/copilot-compact` 会启动属于当前 Session 的后台压缩,不再让 Desktop 的命令 HTTP 请求等待整个摘要完成。使用 `/copilot-compact status` 查询最新任务,或 `/copilot-compact cancel` 请求取消。“已启动”不代表摘要成功,失败仍明确报告。完成后不会唤醒模型或恢复 Goal;原生 `/compact` 不变,任务状态不跨 Host 重启保存。
|
|
341
|
+
|
|
338
342
|
## Copilot Tool 兼容
|
|
339
343
|
|
|
340
344
|
为避免已观察到的无效 Copilot Tool payload,本包会把托管 route 的 `compat.supportsStrictMode` 叶节点设为 `false`,并在所选 provider 为 `github-copilot`,或已确认由本插件挂载的 `github-copilot-preview` 时执行两项仅作用于 Schema 的修复:从 Tool Schema 顶层删除 `sandbox_permissions` 与 `justification`,并把 Core 的多动作 `update_goal` 参数改写为带判别字段的 `oneOf`。这样每种 Goal action 只暴露合法字段:`complete`、`pause`、`resume` 不会携带编辑或阻塞字段,`blocked` 必须提供 `blocked_reason`,只有 `edit` 暴露替换字段。执行仍使用 Core 原本的 Goal Tool 与 Service。非 Copilot prompt assembly 完全不变。
|
|
@@ -459,8 +463,8 @@ node scripts/agent.mjs attribution "DeepSeek Harness (DSH)"
|
|
|
459
463
|
`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 要求包已存在,不能代替首次建包。不会批量补发历史版本。
|
|
460
464
|
|
|
461
465
|
```sh
|
|
462
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
463
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
466
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.75/dsh-github-copilot-0.4.0-alpha.75.tgz
|
|
467
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.75/SHA256SUMS
|
|
464
468
|
sha256sum --check SHA256SUMS
|
|
465
469
|
```
|
|
466
470
|
|
|
@@ -468,7 +472,7 @@ PowerShell 可以对已下载的同一组文件执行:
|
|
|
468
472
|
|
|
469
473
|
```powershell
|
|
470
474
|
$expected = (Get-Content .\SHA256SUMS).Split()[0]
|
|
471
|
-
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.
|
|
475
|
+
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.75.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
|
|
472
476
|
if ($actual -cne $expected) { throw 'Release checksum mismatch' }
|
|
473
477
|
```
|
|
474
478
|
|
package/deployment-baseline.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"package": {
|
|
10
10
|
"name": "dsh-github-copilot",
|
|
11
|
-
"version": "0.4.0-alpha.
|
|
11
|
+
"version": "0.4.0-alpha.75"
|
|
12
12
|
},
|
|
13
13
|
"evidence": {
|
|
14
14
|
"kind": "source-and-synthetic-test-inventory",
|
|
@@ -471,6 +471,8 @@
|
|
|
471
471
|
"sourceMarkers": [
|
|
472
472
|
{"file": "src/manual-compaction-recovery.ts", "marker": "extends BasicCompactionEngine"},
|
|
473
473
|
{"file": "src/manual-compaction-recovery.ts", "marker": "COPILOT_MANUAL_RECOVERY_"},
|
|
474
|
+
{"file": "src/background-compaction.ts", "marker": "copilot-compact"},
|
|
475
|
+
{"file": "src/background-compaction.ts", "marker": "this.jobs.wait(jobId"},
|
|
474
476
|
{"file": "src/preview-route.ts", "marker": "recoveryLimits(modelId)"},
|
|
475
477
|
{"file": "docs/manual-compaction-recovery.md", "marker": "separately selected"}
|
|
476
478
|
],
|
|
@@ -478,6 +480,8 @@
|
|
|
478
480
|
{"file": "tests/manual-compaction-recovery.spec.ts", "name": "reduces an oversized balanced history with bounded complete calls and an unmarked aggregate audit"},
|
|
479
481
|
{"file": "tests/manual-compaction-recovery.spec.ts", "name": "rejects an indivisible span before dispatch and leaves recovery to native failure handling"},
|
|
480
482
|
{"file": "tests/manual-compaction-recovery.spec.ts", "name": "rejects unmatched tool calls before dispatch instead of splitting a call and result"},
|
|
483
|
+
{"file": "tests/background-compaction.spec.ts", "name": "acknowledges before completion and outlives a five-minute caller deadline"},
|
|
484
|
+
{"file": "tests/fixtures/compaction-pressure-core.fixture.ts", "name": "commits beyond the carrier deadline without a model wakeup and keeps status owner-scoped"},
|
|
481
485
|
{"file": "tests/fixtures/compaction-pressure-core.fixture.ts", "name": "recovers oversized manual history with one native transaction and honest multi-call audit"}
|
|
482
486
|
]
|
|
483
487
|
},
|
|
@@ -542,6 +546,8 @@
|
|
|
542
546
|
{"file": "src/preview-route.ts", "marker": "ctx.llm.registerAdapter"},
|
|
543
547
|
{"file": "src/preview-route.ts", "marker": "createAccountModelSource"},
|
|
544
548
|
{"file": "src/preview-provider.ts", "marker": "native.streamSimple"},
|
|
549
|
+
{"file": "src/request-body-timeout.ts", "marker": "COPILOT_REQUEST_BODY_TIMEOUT"},
|
|
550
|
+
{"file": "src/response-error-body.ts", "marker": "readResponseErrorJson"},
|
|
545
551
|
{"file": "src/pi-provider-bridge.ts", "marker": "PiStreamPublicCompatibility"}
|
|
546
552
|
],
|
|
547
553
|
"tests": [
|
|
@@ -553,6 +559,9 @@
|
|
|
553
559
|
{"file": "tests/preview-route.spec.ts", "name": "discovers mixed and unseen account models without model-name routing rules"},
|
|
554
560
|
{"file": "tests/preview-route.spec.ts", "name": "uses unmodified stock LlmRuntime preparation and leaves canonical model registration alone"},
|
|
555
561
|
{"file": "tests/preview-route.spec.ts", "name": "replays opaque reasoning and tool-call identities through the native adapter on a second turn"},
|
|
562
|
+
{"file": "tests/preview-route.spec.ts", "name": "enriches only a verified 408 while preserving native failure classification and retry ownership"},
|
|
563
|
+
{"file": "tests/preview-provider.spec.ts", "name": "observes verified %s timeout without changing bytes, Response, native retries or credential ownership"},
|
|
564
|
+
{"file": "tests/request-body-timeout.spec.ts", "name": "bounds stalled response observation and gives cancellation priority"},
|
|
556
565
|
{"file": "tests/pi-provider-bridge.spec.ts", "name": "preserves the stream object rather than copying or replacing its private queue"},
|
|
557
566
|
{"file": "tests/pi-provider-bridge.spec.ts", "name": "passes the checked simple input through and rejects unsupported advanced entry without I/O"}
|
|
558
567
|
]
|
|
@@ -61,6 +61,8 @@ The existing `enabled` switch remains hosted-search-only. These controls do not
|
|
|
61
61
|
|
|
62
62
|
## Existing oversized history and recovery limits
|
|
63
63
|
|
|
64
|
+
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.
|
|
65
|
+
|
|
64
66
|
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.
|
|
65
67
|
|
|
66
68
|
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.
|
|
@@ -14,7 +14,25 @@ Recovery must leave the original Session surface intact until a smaller *complet
|
|
|
14
14
|
|
|
15
15
|
The plugin's account service supplies a current descriptor and a revocable proof without starting discovery or reading credentials into the Client. The summary budget uses `min(maxInputTokens, contextWindow - configuredOutputCap) - safetyTokens`; an additional 4096-token allowance covers Core's appended directive and estimation variance. Each candidate request is conservatively bounded by serialized UTF-8 size including system, tools, prior intermediate checkpoint and current messages. Native managed-route admission remains the final authority. A call that still exceeds that guard fails; it is never retried with a hidden wire rewrite.
|
|
16
16
|
|
|
17
|
-
The hook partitions the *original* span only at balanced boundaries, summarizes each part through `super.summarize`, and supplies the previous completed intermediate checkpoint as context for the next call. Thus the last completed summary contains all processed parts in chronological order. Default maximum: 16 calls (hard maximum 32); each carries the native cancellation signal and checks account proof before and after dispatch. The original surface is not modified between calls. Core checks for a smaller replacement and current source after the final result; any failure closes the native marker without a replacement.
|
|
17
|
+
The hook partitions the *original* span only at balanced boundaries, summarizes each part through `super.summarize`, and supplies the previous completed intermediate checkpoint as context for the next call. Thus the last completed summary contains all processed parts in chronological order. Default maximum: 16 calls (hard maximum 32); each carries the native cancellation signal and checks account proof before and after dispatch. The original surface is not modified between calls. Core checks for a smaller replacement and current source after the final result; any failure closes the native marker without a replacement. Only an explicit manual command starts this process.
|
|
18
|
+
|
|
19
|
+
## Background command for Desktop
|
|
20
|
+
|
|
21
|
+
With this engine selected and the public `commands` and `jobs` services available in its scope, use:
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
/copilot-compact
|
|
25
|
+
/copilot-compact status
|
|
26
|
+
/copilot-compact cancel
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The jobs package is a development-only type dependency: the plugin imports no jobs runtime implementation, and the engine's public declaration does not expose its types. Runtime access is through the optionally injected Host service; no jobs package is bundled, installed as a new peer, or registered by this plugin.
|
|
30
|
+
|
|
31
|
+
The first command acknowledges **job admission**, not a completed summary. The existing native `/compact` command remains unchanged. Desktop rc.2 forwards unary command requests through Node `fetch`; a long synchronous compact can exceed the default 300-second response-header wait and lose its caller connection. The background command returns promptly and transfers work to a Session-owned native job with its own cancellation controller. A later HTTP disconnect does not cancel admitted work.
|
|
32
|
+
|
|
33
|
+
Status and cancellation apply only to the invoking Agent's latest job. Duplicate starts return the current running job rather than starting another transaction. The selected engine still acquires Core's maintenance lock and owns the only native transaction; another active turn or compaction can cause the admitted job to fail. Job status distinguishes running, completed, failed and cancelled work. Failure details are sanitized; consult the native compaction/end record for the underlying summary/transaction diagnostic. Provider timeout, truncation, capacity and account-proof failures remain failures.
|
|
34
|
+
|
|
35
|
+
The plugin collects the job's native settlement with `jobs.wait`, so the ordinary job reporter does not wake the model or resume its Goal. It never calls followup or inject. Explicit cancellation, owner disposal and plugin/Host teardown cancel and drain the producer. Owner teardown can fail native maintenance before the job receives cancellation; that outcome remains failed rather than being relabeled successful or cancelled. Jobs are process-local: status does not survive a Host restart, and the plugin does not silently restart interrupted work. Durable Core compaction events remain the outcome evidence. Merely installing the main plugin does not select this engine or make this command available; missing commands/jobs services leave the background entry unavailable without changing ordinary compaction.
|
|
18
36
|
|
|
19
37
|
**Audit:** each physical call goes through Core's public `llm.stream` seam with its actual route/cap. The final native summary event is intentionally *unmarked* (`llmStreamCall` absent), not a fabricated claim of one call. It records summed provider-reported usage only when **every** underlying call supplied usage; optional counters are included only if present on every call. The native event format has no per-call array or durable per-call transcript in a single summary event; do not infer individual request accounting from that aggregate. This is a real observability limit of the unchanged public contract.
|
|
20
38
|
|
|
@@ -20,6 +20,7 @@ Follow the [plugin-only boundary](../AGENTS.md#plugin-only-implementation-bounda
|
|
|
20
20
|
- Include GPT-6 Astra, Gemini 3.8 Flash and GPT-5.6 Sol Fast metadata fixtures, plus arbitrary unseen IDs on all three supported protocols. The unseen-ID cases must pass without adding those IDs to implementation tables.
|
|
21
21
|
- Cover missing/conflicting endpoints, missing/invalid limits, duplicate conflicting IDs, explicit denial, stale account snapshots, unsupported reasoning labels, unknown fields and hostile extra getters.
|
|
22
22
|
- Exercise real published adapter/SDK code against local synthetic HTTP for all supported protocols, including tools, public summaries, two-turn opaque replay, images and interruption/retry paths. Synthetic results are not claims of live account availability.
|
|
23
|
+
- Verify managed request-body timeout guidance only for the observed HTTP `408`, exact `user_request_timeout` code and request-body message. Bound clone reads to 8 KiB/250 ms, retain the original native response, and expose only fixed guidance plus final string-body UTF-8 bytes. Preserve failure code, retry metadata, cancellation, unchanged retry payloads and independent dispatches. Do not reclassify 408 as overflow, invent a safe byte threshold, change client timeouts, refresh OAuth, compact automatically or promise elimination of upstream failures.
|
|
23
24
|
- Run source/test typechecks, complete repository tests, built Host/Client/Remote smoke, archive verification, and relevant unchanged-Core compatibility fixtures. Do not suppress type or test failures to bridge incompatible SDK versions.
|
|
24
25
|
|
|
25
26
|
## Explicit public-interface limits
|
package/lib/index.js
CHANGED
|
@@ -1700,7 +1700,7 @@ const usageSchema = z$1.object({
|
|
|
1700
1700
|
totalTokens: count.optional(),
|
|
1701
1701
|
reasoningTokens: count.optional()
|
|
1702
1702
|
});
|
|
1703
|
-
function record$
|
|
1703
|
+
function record$5(value) {
|
|
1704
1704
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1705
1705
|
}
|
|
1706
1706
|
function sameRoute$1(left, right) {
|
|
@@ -1719,10 +1719,10 @@ function initialContextEvidence() {
|
|
|
1719
1719
|
}
|
|
1720
1720
|
/** Read only counts and routing leaves; never message content or opaque replay. */
|
|
1721
1721
|
function foldContextEvidence(state, event) {
|
|
1722
|
-
if (!record$
|
|
1722
|
+
if (!record$5(event) || typeof event.type !== "string" || !record$5(event.data)) return state;
|
|
1723
1723
|
if (event.type === "request/header" || event.type === "model/selection") {
|
|
1724
|
-
const raw = event.type === "request/header" ? record$
|
|
1725
|
-
if (!record$
|
|
1724
|
+
const raw = event.type === "request/header" ? record$5(event.data.header) ? event.data.header.config : void 0 : event.data;
|
|
1725
|
+
if (!record$5(raw)) return {
|
|
1726
1726
|
...state,
|
|
1727
1727
|
route: null,
|
|
1728
1728
|
sample: null,
|
|
@@ -1761,7 +1761,7 @@ function foldContextEvidence(state, event) {
|
|
|
1761
1761
|
if (!copilot(state.route)) return state;
|
|
1762
1762
|
if (event.type === "assistant/message" && event.data.source !== void 0) {
|
|
1763
1763
|
const source = event.data.source;
|
|
1764
|
-
const parsed = routeSchema.safeParse(record$
|
|
1764
|
+
const parsed = routeSchema.safeParse(record$5(source) ? {
|
|
1765
1765
|
provider: source.provider,
|
|
1766
1766
|
model: source.model
|
|
1767
1767
|
} : source);
|
|
@@ -1777,7 +1777,7 @@ function foldContextEvidence(state, event) {
|
|
|
1777
1777
|
const settledUsage = usage !== void 0;
|
|
1778
1778
|
let terminal;
|
|
1779
1779
|
for (const entry of stream) {
|
|
1780
|
-
if (!record$
|
|
1780
|
+
if (!record$5(entry) || entry.type !== "chunk" || !record$5(entry.chunk)) continue;
|
|
1781
1781
|
if (!settledUsage && entry.chunk.type === "usage") usage = entry.chunk.usage;
|
|
1782
1782
|
if (entry.chunk.type === "finish") terminal = entry.chunk.reason;
|
|
1783
1783
|
}
|
|
@@ -1791,7 +1791,7 @@ function foldContextEvidence(state, event) {
|
|
|
1791
1791
|
};
|
|
1792
1792
|
const value = parsed.data;
|
|
1793
1793
|
const zero = isZeroContextUsage(value);
|
|
1794
|
-
const successful = record$
|
|
1794
|
+
const successful = record$5(terminal) && (terminal.kind === "stop" || terminal.kind === "max-tokens" || terminal.kind === "tool-calls");
|
|
1795
1795
|
if (zero && !successful) {
|
|
1796
1796
|
const reason = state.sample !== null || state.reason === "none" ? "failed-zero" : state.reason;
|
|
1797
1797
|
return {
|
|
@@ -1833,7 +1833,7 @@ const contextEvidenceDefinition = {
|
|
|
1833
1833
|
function installContextEvidence(ctx) {
|
|
1834
1834
|
ctx.inject(["sessionProjections"], (scope) => {
|
|
1835
1835
|
const registry = scope.get("sessionProjections");
|
|
1836
|
-
if (!record$
|
|
1836
|
+
if (!record$5(registry) || typeof registry.register !== "function") {
|
|
1837
1837
|
scope.logger.warn("[github-copilot] COPILOT_CONTEXT_PROJECTION_UNAVAILABLE");
|
|
1838
1838
|
return;
|
|
1839
1839
|
}
|
|
@@ -1847,7 +1847,7 @@ function installContextEvidence(ctx) {
|
|
|
1847
1847
|
//#endregion
|
|
1848
1848
|
//#region package.json
|
|
1849
1849
|
var name$1 = "dsh-github-copilot";
|
|
1850
|
-
var version = "0.4.0-alpha.
|
|
1850
|
+
var version = "0.4.0-alpha.75";
|
|
1851
1851
|
//#endregion
|
|
1852
1852
|
//#region lib/types/probe.js
|
|
1853
1853
|
/**
|
|
@@ -2856,7 +2856,7 @@ function buildAnthropicWireBody(request, cfg, model) {
|
|
|
2856
2856
|
}
|
|
2857
2857
|
//#endregion
|
|
2858
2858
|
//#region lib/types/responses-reasoning-text.js
|
|
2859
|
-
function record$
|
|
2859
|
+
function record$4(value) {
|
|
2860
2860
|
return typeof value === "object" && value !== null;
|
|
2861
2861
|
}
|
|
2862
2862
|
function responseIndex(value) {
|
|
@@ -2914,13 +2914,13 @@ var ResponsesReasoningText = class {
|
|
|
2914
2914
|
}
|
|
2915
2915
|
/** Only recognized public text fields are examined; no copying of the item. */
|
|
2916
2916
|
snapshot(item) {
|
|
2917
|
-
if (!record$
|
|
2917
|
+
if (!record$4(item) || item.type !== "reasoning") return "";
|
|
2918
2918
|
let delta = "";
|
|
2919
2919
|
for (const family of ["summary", "raw"]) {
|
|
2920
2920
|
const value = family === "summary" ? item.summary : item.content;
|
|
2921
2921
|
if (!Array.isArray(value)) continue;
|
|
2922
2922
|
for (const [index, part] of value.entries()) {
|
|
2923
|
-
if (!record$
|
|
2923
|
+
if (!record$4(part) || part.type !== (family === "summary" ? "summary_text" : "reasoning_text")) continue;
|
|
2924
2924
|
delta += this.update(family, index, part.text, true);
|
|
2925
2925
|
}
|
|
2926
2926
|
}
|
|
@@ -5300,6 +5300,56 @@ function coreProviderView(provider) {
|
|
|
5300
5300
|
};
|
|
5301
5301
|
}
|
|
5302
5302
|
//#endregion
|
|
5303
|
+
//#region lib/types/response-error-body.js
|
|
5304
|
+
const maxErrorBytes = 8192;
|
|
5305
|
+
const errorReadTimeoutMs = 250;
|
|
5306
|
+
async function readError(reader) {
|
|
5307
|
+
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
5308
|
+
let bytes = 0, chunks = 0, text = "";
|
|
5309
|
+
while (true) {
|
|
5310
|
+
if (chunks++ > maxErrorBytes) return void 0;
|
|
5311
|
+
const chunk = await reader.read();
|
|
5312
|
+
if (chunk.done) break;
|
|
5313
|
+
bytes += chunk.value.byteLength;
|
|
5314
|
+
if (bytes > maxErrorBytes) return void 0;
|
|
5315
|
+
text += decoder.decode(chunk.value, { stream: true });
|
|
5316
|
+
}
|
|
5317
|
+
return JSON.parse(text + decoder.decode());
|
|
5318
|
+
}
|
|
5319
|
+
/** Optional classification evidence only; an unreadable clone leaves native handling unchanged. */
|
|
5320
|
+
async function readResponseErrorJson(response, signal) {
|
|
5321
|
+
if (signal?.aborted) return void 0;
|
|
5322
|
+
let reader;
|
|
5323
|
+
let timeout;
|
|
5324
|
+
let onAbort;
|
|
5325
|
+
try {
|
|
5326
|
+
const clone = response.clone();
|
|
5327
|
+
if (!clone.body) return void 0;
|
|
5328
|
+
reader = clone.body.getReader();
|
|
5329
|
+
const interrupted = new Promise((resolve) => {
|
|
5330
|
+
onAbort = () => resolve(void 0);
|
|
5331
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
5332
|
+
timeout = setTimeout(() => resolve(void 0), errorReadTimeoutMs);
|
|
5333
|
+
if (signal?.aborted) resolve(void 0);
|
|
5334
|
+
});
|
|
5335
|
+
const result = await Promise.race([readError(reader), interrupted]);
|
|
5336
|
+
return signal?.aborted ? void 0 : result;
|
|
5337
|
+
} catch {
|
|
5338
|
+
return;
|
|
5339
|
+
} finally {
|
|
5340
|
+
if (timeout !== void 0) clearTimeout(timeout);
|
|
5341
|
+
if (onAbort) signal?.removeEventListener("abort", onAbort);
|
|
5342
|
+
if (reader) {
|
|
5343
|
+
try {
|
|
5344
|
+
reader.cancel().catch(() => {});
|
|
5345
|
+
} catch {}
|
|
5346
|
+
try {
|
|
5347
|
+
reader.releaseLock();
|
|
5348
|
+
} catch {}
|
|
5349
|
+
}
|
|
5350
|
+
}
|
|
5351
|
+
}
|
|
5352
|
+
//#endregion
|
|
5303
5353
|
//#region lib/types/responses-replay-compat.js
|
|
5304
5354
|
const replayDiagnostics = {
|
|
5305
5355
|
"scope-mismatch": "COPILOT_RESPONSES_REPLAY_SCOPE_MISMATCH: Copilot Responses input references belong to a different connection.",
|
|
@@ -5472,23 +5522,7 @@ var ResponsesRetryReplay = class {
|
|
|
5472
5522
|
}
|
|
5473
5523
|
};
|
|
5474
5524
|
const scopeMessages = /* @__PURE__ */ new Set(["input item ID does not belong to this connection", "input item does not belong to this connection"]);
|
|
5475
|
-
|
|
5476
|
-
const errorReadTimeoutMs = 250;
|
|
5477
|
-
async function readScopeError(reader) {
|
|
5478
|
-
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
5479
|
-
let bytes = 0;
|
|
5480
|
-
let chunks = 0;
|
|
5481
|
-
let text = "";
|
|
5482
|
-
while (true) {
|
|
5483
|
-
if (chunks++ > maxErrorBytes) return false;
|
|
5484
|
-
const chunk = await reader.read();
|
|
5485
|
-
if (chunk.done) break;
|
|
5486
|
-
bytes += chunk.value.byteLength;
|
|
5487
|
-
if (bytes > maxErrorBytes) return false;
|
|
5488
|
-
text += decoder.decode(chunk.value, { stream: true });
|
|
5489
|
-
}
|
|
5490
|
-
text += decoder.decode();
|
|
5491
|
-
const body = JSON.parse(text);
|
|
5525
|
+
function isScopeError(body) {
|
|
5492
5526
|
if (!isRecord$1(body)) return false;
|
|
5493
5527
|
const error = Object.hasOwn(body, "error") ? body.error : body;
|
|
5494
5528
|
if (!isRecord$1(error) || typeof error.message !== "string" || !scopeMessages.has(error.message)) return false;
|
|
@@ -5502,35 +5536,23 @@ async function readScopeError(reader) {
|
|
|
5502
5536
|
/** Observe a cloned, bounded 401 body; every unknown result retains native auth behavior. */
|
|
5503
5537
|
async function isCopilotInputItemScopeError(response, signal) {
|
|
5504
5538
|
if (response.status !== 401 || signal?.aborted) return false;
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
} finally {
|
|
5523
|
-
if (timeout !== void 0) clearTimeout(timeout);
|
|
5524
|
-
if (onAbort) signal?.removeEventListener("abort", onAbort);
|
|
5525
|
-
if (reader) {
|
|
5526
|
-
try {
|
|
5527
|
-
reader.cancel().catch(() => {});
|
|
5528
|
-
} catch {}
|
|
5529
|
-
try {
|
|
5530
|
-
reader.releaseLock();
|
|
5531
|
-
} catch {}
|
|
5532
|
-
}
|
|
5533
|
-
}
|
|
5539
|
+
const body = await readResponseErrorJson(response, signal);
|
|
5540
|
+
return !signal?.aborted && isScopeError(body);
|
|
5541
|
+
}
|
|
5542
|
+
//#endregion
|
|
5543
|
+
//#region lib/types/request-body-timeout.js
|
|
5544
|
+
const observedMessage = "Timed out reading request body. Try again, or use a smaller request size.";
|
|
5545
|
+
function record$3(value) {
|
|
5546
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5547
|
+
}
|
|
5548
|
+
/** Verified provider evidence, not guessed capabilities, token limits or network cause. */
|
|
5549
|
+
async function requestBodyTimeoutDiagnostic(response, body, signal) {
|
|
5550
|
+
if (response.status !== 408 || signal?.aborted) return void 0;
|
|
5551
|
+
const value = await readResponseErrorJson(response, signal);
|
|
5552
|
+
if (!record$3(value)) return void 0;
|
|
5553
|
+
const error = Object.hasOwn(value, "error") ? value.error : value;
|
|
5554
|
+
if (!record$3(error) || error.code !== "user_request_timeout" || error.message !== observedMessage || value.code !== void 0 && value.code !== error.code || value.message !== void 0 && value.message !== error.message) return void 0;
|
|
5555
|
+
return `COPILOT_REQUEST_BODY_TIMEOUT: Copilot returned HTTP 408 / user_request_timeout while reading the request body; this is not context-window overflow. ${body === void 0 ? "Request body size unavailable." : `Request body: ${Buffer.byteLength(body, "utf8")} UTF-8 bytes (not context tokens).`} Native retry policy is unchanged. If retries exhaust, explicitly compact the conversation or reduce attachments/tool output before retrying; also check network/proxy health and GitHub service status. A larger client timeout does not change this server timeout. No history was trimmed or model switched.`;
|
|
5534
5556
|
}
|
|
5535
5557
|
//#endregion
|
|
5536
5558
|
//#region lib/types/preview-provider.js
|
|
@@ -5748,6 +5770,7 @@ function createAccountProvider(descriptors, guard, baseURL) {
|
|
|
5748
5770
|
} : options.onPayload;
|
|
5749
5771
|
const fetch = options.fetch ?? globalThis.fetch;
|
|
5750
5772
|
const observeResponse = async (input, init) => {
|
|
5773
|
+
guard.onRequestBodyTimeout?.(void 0);
|
|
5751
5774
|
let response;
|
|
5752
5775
|
try {
|
|
5753
5776
|
response = await fetch(input, init);
|
|
@@ -5756,6 +5779,10 @@ function createAccountProvider(descriptors, guard, baseURL) {
|
|
|
5756
5779
|
throw error;
|
|
5757
5780
|
}
|
|
5758
5781
|
retry?.observe(typeof init?.body === "string" ? init.body : void 0, response.status);
|
|
5782
|
+
if (response.status === 408 && guard.onRequestBodyTimeout !== void 0) {
|
|
5783
|
+
const diagnostic = await requestBodyTimeoutDiagnostic(response, typeof init?.body === "string" ? init.body : void 0, lease.signal);
|
|
5784
|
+
if (!lease.signal.aborted && !options.signal?.aborted) guard.onRequestBodyTimeout(diagnostic);
|
|
5785
|
+
}
|
|
5759
5786
|
if (response.status === 401) {
|
|
5760
5787
|
if (responses && await isCopilotInputItemScopeError(response, lease.signal)) reportReplayFailure(new CopilotResponsesReplayError("scope-mismatch"));
|
|
5761
5788
|
else unauthorized = true;
|
|
@@ -7704,6 +7731,7 @@ var PreviewAdapter = class extends PiAiAdapter {
|
|
|
7704
7731
|
}
|
|
7705
7732
|
let requestFailure;
|
|
7706
7733
|
let wireAbort;
|
|
7734
|
+
let bodyTimeout;
|
|
7707
7735
|
const inspectRequest = (_model, context, nativeOptions) => {
|
|
7708
7736
|
if (signal.aborted) throw abortFailure(signal);
|
|
7709
7737
|
const imageFailure = imageInputFailure(lease.descriptor, context.messages);
|
|
@@ -7730,6 +7758,9 @@ var PreviewAdapter = class extends PiAiAdapter {
|
|
|
7730
7758
|
onWireAbort(code) {
|
|
7731
7759
|
wireAbort = code;
|
|
7732
7760
|
},
|
|
7761
|
+
onRequestBodyTimeout(diagnostic) {
|
|
7762
|
+
bodyTimeout = diagnostic;
|
|
7763
|
+
},
|
|
7733
7764
|
onReplayFailure(error) {
|
|
7734
7765
|
if (!signal.aborted) requestFailure = new LlmError(error.message, "INVALID_REQUEST");
|
|
7735
7766
|
}
|
|
@@ -7752,6 +7783,20 @@ var PreviewAdapter = class extends PiAiAdapter {
|
|
|
7752
7783
|
throw failure(wireAbort, "ABORTED");
|
|
7753
7784
|
}
|
|
7754
7785
|
if (chunk.type === "finish" && chunk.reason.kind === "error" && chunk.reason.failure.code === "UNKNOWN_MODEL") await owner.refreshRejected(lease.snapshot, signal);
|
|
7786
|
+
if (chunk.type === "finish" && chunk.reason.kind === "error" && bodyTimeout !== void 0 && chunk.reason.failure.code !== "ABORTED") {
|
|
7787
|
+
if (signal.aborted) throw abortFailure(signal);
|
|
7788
|
+
yield {
|
|
7789
|
+
...chunk,
|
|
7790
|
+
reason: {
|
|
7791
|
+
...chunk.reason,
|
|
7792
|
+
failure: {
|
|
7793
|
+
...chunk.reason.failure,
|
|
7794
|
+
message: bodyTimeout
|
|
7795
|
+
}
|
|
7796
|
+
}
|
|
7797
|
+
};
|
|
7798
|
+
continue;
|
|
7799
|
+
}
|
|
7755
7800
|
yield chunk;
|
|
7756
7801
|
}
|
|
7757
7802
|
if (requestFailure !== void 0) throw requestFailure;
|
|
@@ -2,6 +2,156 @@ import "./copilot-identity-DRZY_d2X.js";
|
|
|
2
2
|
import { i as resolveRequestBudgetPolicy, r as calculateRequestBudget } from "./request-budget-DLY_aRq0.js";
|
|
3
3
|
import { createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
4
4
|
import BasicCompactionEngine from "@deepseek-ai/dsh-compaction-basic";
|
|
5
|
+
import { CommandDefinitionId } from "@deepseek-ai/dsh-commands/brand";
|
|
6
|
+
//#region lib/types/background-compaction.js
|
|
7
|
+
const WAIT_MS = 2147483647;
|
|
8
|
+
const USAGE = "Usage: /copilot-compact [status|cancel]";
|
|
9
|
+
const FAILED = "COPILOT_BACKGROUND_COMPACTION_FAILED: inspect the native compaction/end record; no success is implied.";
|
|
10
|
+
/** Own only admission and job lifetime; the selected engine owns all history transactions. */
|
|
11
|
+
var BackgroundCompaction = class {
|
|
12
|
+
jobs;
|
|
13
|
+
compact;
|
|
14
|
+
warn;
|
|
15
|
+
latest = /* @__PURE__ */ new WeakMap();
|
|
16
|
+
active = /* @__PURE__ */ new Map();
|
|
17
|
+
closed = false;
|
|
18
|
+
constructor(jobs, compact, warn) {
|
|
19
|
+
this.jobs = jobs;
|
|
20
|
+
this.compact = compact;
|
|
21
|
+
this.warn = warn;
|
|
22
|
+
}
|
|
23
|
+
execute(agent, rawInput, signal) {
|
|
24
|
+
if (this.closed) return {
|
|
25
|
+
kind: "error",
|
|
26
|
+
text: "COPILOT_BACKGROUND_COMPACTION_DISPOSED"
|
|
27
|
+
};
|
|
28
|
+
if (signal.aborted) return {
|
|
29
|
+
kind: "error",
|
|
30
|
+
text: "Compaction admission cancelled."
|
|
31
|
+
};
|
|
32
|
+
const action = rawInput.trim();
|
|
33
|
+
if (action !== "" && action !== "status" && action !== "cancel") return {
|
|
34
|
+
kind: "error",
|
|
35
|
+
text: USAGE
|
|
36
|
+
};
|
|
37
|
+
const id = this.latest.get(agent);
|
|
38
|
+
if (action !== "") {
|
|
39
|
+
if (id === void 0) return {
|
|
40
|
+
kind: "error",
|
|
41
|
+
text: "No background compaction job for this Session."
|
|
42
|
+
};
|
|
43
|
+
try {
|
|
44
|
+
if (action === "cancel") return {
|
|
45
|
+
kind: "success",
|
|
46
|
+
text: `${id}: cancellation ${this.jobs.kill(id, agent.id)}.`
|
|
47
|
+
};
|
|
48
|
+
const job = this.jobs.get(id, agent.id);
|
|
49
|
+
return {
|
|
50
|
+
kind: "success",
|
|
51
|
+
text: `${id}: ${job.status}${job.detail ? `; ${job.detail}` : ""}`
|
|
52
|
+
};
|
|
53
|
+
} catch {
|
|
54
|
+
return {
|
|
55
|
+
kind: "error",
|
|
56
|
+
text: "COPILOT_BACKGROUND_COMPACTION_JOB_UNAVAILABLE"
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const existing = this.active.get(agent);
|
|
61
|
+
if (existing !== void 0) return {
|
|
62
|
+
kind: "success",
|
|
63
|
+
text: `${existing.id}: already running; use /copilot-compact status or cancel.`
|
|
64
|
+
};
|
|
65
|
+
const cancel = new AbortController();
|
|
66
|
+
let done;
|
|
67
|
+
try {
|
|
68
|
+
const jobId = this.jobs.start({
|
|
69
|
+
kind: "copilot-compaction",
|
|
70
|
+
label: "Manual Copilot context compaction",
|
|
71
|
+
owner: agent.id,
|
|
72
|
+
run: (job) => {
|
|
73
|
+
job.updateProgress("Compacting context; the original history remains until native commit.");
|
|
74
|
+
done = Promise.resolve().then(async () => {
|
|
75
|
+
try {
|
|
76
|
+
cancel.signal.throwIfAborted();
|
|
77
|
+
const result = await this.compact(agent, cancel.signal);
|
|
78
|
+
return {
|
|
79
|
+
status: "completed",
|
|
80
|
+
detail: result === null ? "No compactable history." : `Compacted ${result.shadowedSeqs.length} history items (~${result.shadowedTokenCount} tokens).`
|
|
81
|
+
};
|
|
82
|
+
} catch {
|
|
83
|
+
if (cancel.signal.aborted) return {
|
|
84
|
+
status: "killed",
|
|
85
|
+
detail: "Compaction cancelled; inspect native history for its transaction outcome."
|
|
86
|
+
};
|
|
87
|
+
this.warn(FAILED);
|
|
88
|
+
return {
|
|
89
|
+
status: "failed",
|
|
90
|
+
detail: FAILED
|
|
91
|
+
};
|
|
92
|
+
} finally {
|
|
93
|
+
this.active.delete(agent);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
return {
|
|
97
|
+
cancel: () => {
|
|
98
|
+
cancel.abort();
|
|
99
|
+
},
|
|
100
|
+
done
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
if (done === void 0) throw new Error("COPILOT_BACKGROUND_COMPACTION_STARTER_MISSING");
|
|
105
|
+
this.active.set(agent, {
|
|
106
|
+
id: jobId,
|
|
107
|
+
cancel,
|
|
108
|
+
done
|
|
109
|
+
});
|
|
110
|
+
this.latest.set(agent, jobId);
|
|
111
|
+
this.jobs.wait(jobId, WAIT_MS, agent.id).then((view) => {
|
|
112
|
+
if (view.status === "running" || view.status === "stopping") {
|
|
113
|
+
this.warn("COPILOT_BACKGROUND_COMPACTION_OBSERVER_EXPIRED");
|
|
114
|
+
cancel.abort();
|
|
115
|
+
}
|
|
116
|
+
}, () => {
|
|
117
|
+
this.warn("COPILOT_BACKGROUND_COMPACTION_OBSERVER_FAILED");
|
|
118
|
+
cancel.abort();
|
|
119
|
+
});
|
|
120
|
+
return {
|
|
121
|
+
kind: "success",
|
|
122
|
+
text: `${jobId}: background compaction started, not completed. Use /copilot-compact status or /copilot-compact cancel.`
|
|
123
|
+
};
|
|
124
|
+
} catch {
|
|
125
|
+
cancel.abort();
|
|
126
|
+
this.warn("COPILOT_BACKGROUND_COMPACTION_ADMISSION_FAILED");
|
|
127
|
+
return {
|
|
128
|
+
kind: "error",
|
|
129
|
+
text: "COPILOT_BACKGROUND_COMPACTION_ADMISSION_FAILED: jobs and a live Session owner are required."
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
async dispose() {
|
|
134
|
+
this.closed = true;
|
|
135
|
+
const work = [...this.active.values()];
|
|
136
|
+
for (const entry of work) entry.cancel.abort();
|
|
137
|
+
await Promise.all(work.map((entry) => entry.done));
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
function installBackgroundCompaction(ctx, compact) {
|
|
141
|
+
const controller = new BackgroundCompaction(ctx.jobs, compact, (message) => ctx.logger.warn(message));
|
|
142
|
+
ctx.effect(function* () {
|
|
143
|
+
yield () => controller.dispose();
|
|
144
|
+
yield ctx.jobs.attachController("copilot-background-compaction");
|
|
145
|
+
yield ctx.commands.register({
|
|
146
|
+
definitionId: CommandDefinitionId("dsh-github-copilot/background-compaction"),
|
|
147
|
+
name: "copilot-compact",
|
|
148
|
+
description: "Start background manual compaction, inspect status, or cancel",
|
|
149
|
+
input: { hint: "status | cancel (omit to start)" },
|
|
150
|
+
handler: (invocation) => controller.execute(invocation.agent, invocation.rawInput, invocation.signal)
|
|
151
|
+
});
|
|
152
|
+
}, "Copilot background compaction");
|
|
153
|
+
}
|
|
154
|
+
//#endregion
|
|
5
155
|
//#region lib/types/manual-compaction-recovery.js
|
|
6
156
|
function recoverError(code) {
|
|
7
157
|
return /* @__PURE__ */ new Error(`COPILOT_MANUAL_RECOVERY_${code}`);
|
|
@@ -95,6 +245,12 @@ async function summarizeOversizedManualInput(options) {
|
|
|
95
245
|
*/
|
|
96
246
|
var CopilotManualRecoveryCompactionEngine = class extends BasicCompactionEngine {
|
|
97
247
|
manual = /* @__PURE__ */ new WeakMap();
|
|
248
|
+
constructor(ctx, config = {}) {
|
|
249
|
+
super(ctx, config);
|
|
250
|
+
ctx.inject(["commands", "jobs"], (scope) => {
|
|
251
|
+
installBackgroundCompaction(scope, (agent, signal) => this.compactNow(agent, signal));
|
|
252
|
+
});
|
|
253
|
+
}
|
|
98
254
|
async compactNow(agent, signal, sourceCommandId) {
|
|
99
255
|
this.manual.set(agent, (this.manual.get(agent) ?? 0) + 1);
|
|
100
256
|
try {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
3
|
+
import type { CommandResult } from '@deepseek-ai/dsh-commands';
|
|
4
|
+
import type { CompactionResult } from '@deepseek-ai/dsh-compaction';
|
|
5
|
+
import type { JobRegistry } from '@deepseek-ai/dsh-jobs';
|
|
6
|
+
import type { SessionId } from '@deepseek-ai/dsh-session';
|
|
7
|
+
declare module '@deepseek-ai/dsh-jobs/view' {
|
|
8
|
+
interface JobKindMap {
|
|
9
|
+
'copilot-compaction': 'copilot-compaction';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
type Jobs = Pick<JobRegistry, 'start' | 'get' | 'wait' | 'kill'>;
|
|
13
|
+
type Result = Pick<CompactionResult, 'shadowedSeqs' | 'shadowedTokenCount'> | null;
|
|
14
|
+
/** Own only admission and job lifetime; the selected engine owns all history transactions. */
|
|
15
|
+
export declare class BackgroundCompaction<A extends {
|
|
16
|
+
readonly id: SessionId;
|
|
17
|
+
}> {
|
|
18
|
+
private readonly jobs;
|
|
19
|
+
private readonly compact;
|
|
20
|
+
private readonly warn;
|
|
21
|
+
private readonly latest;
|
|
22
|
+
private readonly active;
|
|
23
|
+
private closed;
|
|
24
|
+
constructor(jobs: Jobs, compact: (agent: A, signal: AbortSignal) => Promise<Result>, warn: (message: string) => void);
|
|
25
|
+
execute(agent: A, rawInput: string, signal: AbortSignal): CommandResult;
|
|
26
|
+
dispose(): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
export declare function installBackgroundCompaction(ctx: Context, compact: (agent: Agent, signal: AbortSignal) => Promise<CompactionResult | null>): void;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=background-compaction.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
2
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
3
|
import BasicCompactionEngine from '@deepseek-ai/dsh-compaction-basic';
|
|
3
4
|
import type { ContentBlock, Message, TokenUsage, ToolSchema } from '@deepseek-ai/dsh-llm';
|
|
4
5
|
import type { CommandId } from '@deepseek-ai/dsh-commands/brand';
|
|
@@ -43,6 +44,7 @@ export declare function summarizeOversizedManualInput<M extends RecoveryMessage,
|
|
|
43
44
|
*/
|
|
44
45
|
export declare class CopilotManualRecoveryCompactionEngine extends BasicCompactionEngine {
|
|
45
46
|
private readonly manual;
|
|
47
|
+
constructor(ctx: Context, config?: ConstructorParameters<typeof BasicCompactionEngine>[1]);
|
|
46
48
|
compactNow(agent: Agent, signal: AbortSignal, sourceCommandId?: CommandId): Promise<CompactionResult | null>;
|
|
47
49
|
protected summarize(input: RecoveryInput<Message>, agent: Agent, signal?: AbortSignal): Promise<RecoveryResult>;
|
|
48
50
|
}
|
|
@@ -25,6 +25,8 @@ export interface PreviewProviderGuard {
|
|
|
25
25
|
onReplayFailure?(error: CopilotResponsesReplayError): void;
|
|
26
26
|
/** Preserve an owned abort cause before SDK terminal delivery and lease cleanup. */
|
|
27
27
|
onWireAbort?(code: ManagedWireAbortCode): void;
|
|
28
|
+
/** Request-local safe guidance from a verified HTTP response; undefined clears prior evidence. */
|
|
29
|
+
onRequestBodyTimeout?(diagnostic: string | undefined): void;
|
|
28
30
|
}
|
|
29
31
|
/** Guard for one selected model in an account-bound descriptor snapshot. */
|
|
30
32
|
export interface AccountProviderGuard extends PreviewProviderGuard {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Verified provider evidence, not guessed capabilities, token limits or network cause. */
|
|
2
|
+
export declare function requestBodyTimeoutDiagnostic(response: Response, body?: string, signal?: AbortSignal): Promise<string | undefined>;
|
|
3
|
+
//# sourceMappingURL=request-body-timeout.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-github-copilot",
|
|
3
3
|
"description": "DSH companion for GitHub Copilot sign-in, account-aware model profiles, tool compatibility, and provider-hosted search.",
|
|
4
|
-
"version": "0.4.0-alpha.
|
|
4
|
+
"version": "0.4.0-alpha.75",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -149,6 +149,7 @@
|
|
|
149
149
|
"@deepseek-ai/dsh-commands": "0.2.0-rc.2",
|
|
150
150
|
"@deepseek-ai/dsh-compaction": "0.2.0-rc.2",
|
|
151
151
|
"@deepseek-ai/dsh-compaction-basic": "0.2.0-rc.2",
|
|
152
|
+
"@deepseek-ai/dsh-jobs": "0.2.0-rc.2",
|
|
152
153
|
"@deepseek-ai/dsh-api-gateway": "0.2.0-rc.2",
|
|
153
154
|
"@deepseek-ai/dsh-api-remotes": "0.2.0-rc.2",
|
|
154
155
|
"@deepseek-ai/dsh-app-boot": "0.2.0-rc.2",
|