dsh-github-copilot 0.4.0-alpha.79 → 0.4.0-alpha.80
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 +7 -0
- package/README.md +12 -7
- package/README.zh.md +12 -7
- package/deployment-baseline.json +9 -1
- package/docs/copilot-compaction.md +4 -0
- package/docs/model-compatibility-acceptance.md +1 -0
- package/lib/index.js +164 -14
- package/lib/types/config.d.ts +9 -4
- package/lib/types/copilot-stream-liveness.d.ts +23 -0
- package/lib/types/preview-provider.d.ts +5 -0
- package/lib/types/preview-route.d.ts +2 -0
- package/package.json +1 -1
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/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.
|
|
76
77
|
- `tests/`: unit and integration evidence; mirror the source area being changed.
|
|
77
78
|
- `deployment-baseline.json`: declared machine-readable compatibility and capability evidence inventory.
|
|
78
79
|
- `scripts/verify-deployment-baseline.mjs`: invariant drift gate.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.0-alpha.80 (prepared)
|
|
4
|
+
|
|
5
|
+
- Observe real HTTP/SSE byte progress on managed requests, retaining the original five-minute byte-idle bound while allowing at most ten minutes without a native assistant chunk (#253).
|
|
6
|
+
- Preserve native SDK parsing, exact stream bytes, caller cancellation and retry ownership; endless heartbeats remain bounded and explicit WebSocket/auto transport keeps native behavior.
|
|
7
|
+
- Add separate managed-chat timeout/opt-out settings and a configurable native image-request budget with the unchanged 20 MiB default. No hidden history trimming, automatic model switch, extra retry or claim to cure HTTP 408.
|
|
8
|
+
- Reproduce heartbeat-only semantic timeouts and verify real late output, actual byte stalls and cleanup through unchanged native adapters.
|
|
9
|
+
|
|
3
10
|
## 0.4.0-alpha.79 (prepared)
|
|
4
11
|
|
|
5
12
|
- Bind retained turn selection reads through the public `TypertRemoteService` and `@Remote get`, fixing the Host registration missing from the alpha.76 Client-only correction (#254).
|
package/README.md
CHANGED
|
@@ -32,6 +32,8 @@ On official rc.2, routing is exposed through native live `Config` fields, not a
|
|
|
32
32
|
|
|
33
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
34
|
|
|
35
|
+
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.
|
|
36
|
+
|
|
35
37
|
| DSH surface | Exact source pin | Models UI seam |
|
|
36
38
|
|---|---|---|
|
|
37
39
|
| 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 |
|
|
@@ -106,7 +108,7 @@ The Host reads GitHub's internal quota endpoint using the existing canonical OAu
|
|
|
106
108
|
|
|
107
109
|
## Install and sign in
|
|
108
110
|
|
|
109
|
-
The commands below target the package version `0.4.0-alpha.
|
|
111
|
+
The commands below target the package version `0.4.0-alpha.80`. 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):
|
|
110
112
|
|
|
111
113
|
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):
|
|
112
114
|
|
|
@@ -119,10 +121,10 @@ Include any launcher patch files with repeated `--patch /absolute/file` argument
|
|
|
119
121
|
For a standalone named profile only, the supported CLI command is:
|
|
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.80/dsh-github-copilot-0.4.0-alpha.80.tgz
|
|
123
125
|
```
|
|
124
126
|
|
|
125
|
-
For Desktop profiles, use Desktop's native package manager with `dsh-github-copilot@0.4.0-alpha.
|
|
127
|
+
For Desktop profiles, use Desktop's native package manager with `dsh-github-copilot@0.4.0-alpha.80` 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.
|
|
126
128
|
|
|
127
129
|
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.
|
|
128
130
|
|
|
@@ -177,7 +179,7 @@ Agents should treat the browser authorization as a human handoff, not as a token
|
|
|
177
179
|
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.
|
|
178
180
|
6. Use **Sign out** only when the user explicitly asks to disconnect the account. It deletes the Copilot credential record but preserves route settings.
|
|
179
181
|
|
|
180
|
-
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.
|
|
182
|
+
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.80`, 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).
|
|
181
183
|
|
|
182
184
|
**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.
|
|
183
185
|
|
|
@@ -363,6 +365,9 @@ The plugin details page exposes only **Search provider** and **Fallback provider
|
|
|
363
365
|
|---|---:|---|
|
|
364
366
|
| `accountModelTtlMs` | `86400000` | Maximum account-metadata reuse window in milliseconds (24h); does not extend credentials or proof validity. |
|
|
365
367
|
| `accountModelFailureCooldownMs` | `300000` | Failure cooldown in milliseconds (5min) for non-forcing discovery; no periodic retries. |
|
|
368
|
+
| `chatStreamIdleTimeoutMs` | `300000` | Managed chat byte-idle interval; native assistant-chunk silence is bounded to twice this interval when liveness is enabled (maximum 2147483647 ms). Separate from hosted search. |
|
|
369
|
+
| `chatStreamLiveness` | `true` | Observe actual HTTP/SSE bytes without synthetic assistant output; `false` restores native-only timing. Explicit WebSocket/`auto` transport is unchanged. |
|
|
370
|
+
| `chatMaxRequestImageBytes` | `20971520` | Native outgoing image budget (20 MiB), not a total JSON/supplier limit. A smaller explicit value lets Core offload older images to mapped read-only paths; original history stays intact, but outgoing image visibility changes. |
|
|
366
371
|
| `requestBudgetSafetyTokens` | `4096` | Non-negative safe-integer estimated input allowance; larger values reduce available input. |
|
|
367
372
|
| `requestBudgetPressureRatio` | `0.9` | Fraction (0.01–1, step 0.01) for early local pressure, only with supported enabled stock recovery. |
|
|
368
373
|
| `compactionReasoning` | `prefer-low` | Choose supported minimal/low only when summary effort is absent; `preserve` keeps native defaults. |
|
|
@@ -456,8 +461,8 @@ Report the published Release URL, version, tag/commit and verified asset SHA-256
|
|
|
456
461
|
`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.
|
|
457
462
|
|
|
458
463
|
```sh
|
|
459
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
460
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
464
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.80/dsh-github-copilot-0.4.0-alpha.80.tgz
|
|
465
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.80/SHA256SUMS
|
|
461
466
|
sha256sum --check SHA256SUMS
|
|
462
467
|
```
|
|
463
468
|
|
|
@@ -465,7 +470,7 @@ PowerShell can verify the same two downloaded files with:
|
|
|
465
470
|
|
|
466
471
|
```powershell
|
|
467
472
|
$expected = (Get-Content .\SHA256SUMS).Split()[0]
|
|
468
|
-
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.
|
|
473
|
+
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.80.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
|
|
469
474
|
if ($actual -cne $expected) { throw 'Release checksum mismatch' }
|
|
470
475
|
```
|
|
471
476
|
|
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.80`。源码、发布制品、已安装版本和实际加载运行时需分别确认;本地升级和中断会话的重启仍需用户批准。
|
|
30
30
|
|
|
31
31
|
Web search 路由现在优先显示在插件详情页;宿主不支持详情页插槽时才回退到 **设置 → 模型**或独立 Web search section。搜索子 Fiber 仍独立等待 Remote,不影响账号控件和既有搜索安全检查。
|
|
32
32
|
|
|
@@ -36,6 +36,8 @@ Web search 路由现在优先显示在插件详情页;宿主不支持详情页
|
|
|
36
36
|
|
|
37
37
|
托管 Copilot 返回 `408 / user_request_timeout` 且确认是读取请求体超时时,现会显示 `COPILOT_REQUEST_BODY_TIMEOUT`,并在可观测时给出最终 JSON 请求的 UTF-8 字节数。字节不是上下文 token,上传超时也不证明上下文超限。原生重试与失败分类保持不变。重试耗尽后,可显式压缩会话或减少附件/工具输出再试,并检查网络/代理及 [GitHub 服务状态](https://www.githubstatus.com/)。压缩不保证成功,也无法修复网络或服务故障;调大客户端超时不会改变服务端超时。插件不会自动裁剪历史、切换模型、压缩或新增重试循环,未识别错误仍由原生流程处理。
|
|
38
38
|
|
|
39
|
+
托管 HTTP/SSE 聊天现区分**字节空闲**与**助手输出静默**。Core 原生计时只看助手 chunk,忽略 SSE 心跳;未修改原生适配器的合成测试已复现“仍有字节却超时”。默认连续五分钟无响应头/非空响应体字节仍失败;实际字节进展只允许助手输出静默延长到十分钟,持续心跳也不能无限等待,消费者处理输出的时间不计入空闲。`chatStreamLiveness: false` 恢复纯原生计时;显式 WebSocket/`auto` transport 保持原生行为。这修复已复现的误判机制,不保证消除所有重试或服务端 HTTP 408,也不证明某次生产故障中实际存在心跳。
|
|
40
|
+
|
|
39
41
|
| DSH 表面 | 精确源码 pin | Models UI 接口 |
|
|
40
42
|
|---|---|---|
|
|
41
43
|
| 受控 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 |
|
|
@@ -121,10 +123,10 @@ node package/scripts/check-search-composition.mjs --profile-dir /absolute/profil
|
|
|
121
123
|
仅对独立的具名 profile,获准且网络可用时,可通过受支持的 CLI 命令安装:
|
|
122
124
|
|
|
123
125
|
```sh
|
|
124
|
-
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
126
|
+
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.80/dsh-github-copilot-0.4.0-alpha.80.tgz
|
|
125
127
|
```
|
|
126
128
|
|
|
127
|
-
Desktop profile 请在完成同样的预检后,使用 Desktop 原生包管理器安装 `dsh-github-copilot@0.4.0-alpha.
|
|
129
|
+
Desktop profile 请在完成同样的预检后,使用 Desktop 原生包管理器安装 `dsh-github-copilot@0.4.0-alpha.80`。Desktop 保留 `desktop` profile,CLI 不负责管理。若 registry 被公司封禁或不可用,不要更换网络绕行或使用离线 CLI;请停止。[受控离线 CLI 流程](./docs/npm-distribution.md#controlled-offline-cli-maintenance-for-standalone-profiles)仅适用于独立具名 profile,不适用于 Desktop。
|
|
128
130
|
|
|
129
131
|
随后打开上表对应的 Models UI,找到 **GitHub Copilot**,点击 **Sign in** 并完成 GitHub device-code 流程。安装会修改指定 profile;是否立即激活取决于该 profile 的常规 reload/restart 策略。
|
|
130
132
|
|
|
@@ -179,7 +181,7 @@ Agent 应把浏览器授权视为需要用户完成的 handoff,而不是自行
|
|
|
179
181
|
5. 确认 **Signed in** 并检查自动发现结果,再请用户选择模型。已登录时打开 Models 会自动确保缺失/过期元数据,新鲜 ready 缓存不发请求。错误可使用 **Retry**,有意强制更新时使用 **Manage → Refresh models**,不作为常规设置步骤。状态读取本身不发现;登录、元数据与真实调用成功是独立证据。
|
|
180
182
|
6. 只有用户明确要求断开账号时才使用 **Sign out**;它会删除 Copilot credential record,但保留 route settings。
|
|
181
183
|
|
|
182
|
-
每个新版本默认同时分发到 GitHub Releases 和 npm,两个渠道使用同一份已验证 tarball。应固定版本并核对所用渠道的证据:Release 的 `SHA256SUMS`;从 npm 安装时另核对 `dist.integrity`。Desktop profile 只能通过原生 Desktop 包管理器安装;获准且 registry 可用时输入 `dsh-github-copilot@0.4.0-alpha.
|
|
184
|
+
每个新版本默认同时分发到 GitHub Releases 和 npm,两个渠道使用同一份已验证 tarball。应固定版本并核对所用渠道的证据:Release 的 `SHA256SUMS`;从 npm 安装时另核对 `dist.integrity`。Desktop profile 只能通过原生 Desktop 包管理器安装;获准且 registry 可用时输入 `dsh-github-copilot@0.4.0-alpha.80`,不是 URL 或本地文件。Desktop 保留 `desktop` profile,不能通过 DSH CLI 管理。受控离线 CLI 维护仅适用于独立具名 profile,不得作为 Desktop 安装绕行方案。[双渠道发布与 OIDC 要求](./docs/npm-distribution.md)保持不变。
|
|
183
185
|
|
|
184
186
|
**Desktop package 更新与 Web 生命周期边界:**原生 manager 对已安装 package 原位升级返回的 `restart-required` 是权威结果,与移除/重加 plugin bundle 的行为是两个不同问题。涉及服务重编排补丁(`cordis.patch.yml`,如本插件所采用的隔离路由 Web 搜索层)的停用、移除或升级,可能让依赖条目保持 pending,直到完全退出并冷重启 Desktop。若原生 manager 只报告类似 `pending (waiting for service: web)` 的条目,同时本插件已经显示 **Off**,说明请求的停用状态已经落盘;请冷重启 Desktop,不要反复切换或重装插件。其它错误不属于此提示范围,仍需单独排查。
|
|
185
187
|
|
|
@@ -366,6 +368,9 @@ Copilot Session 如需更宽的文件或命令权限,必须在调用前选择
|
|
|
366
368
|
|---|---:|---|
|
|
367
369
|
| `accountModelTtlMs` | `86400000` | 最大账号元数据复用窗口,毫秒(24 小时);不延长凭据或 proof 有效期。 |
|
|
368
370
|
| `accountModelFailureCooldownMs` | `300000` | 非强制发现的失败冷却,毫秒(5 分钟);不设周期重试。 |
|
|
371
|
+
| `chatStreamIdleTimeoutMs` | `300000` | 托管聊天字节空闲间隔;启用 liveness 时,原生助手 chunk 静默上限为此间隔的两倍(最高 2147483647 毫秒)。与 hosted search 分开。 |
|
|
372
|
+
| `chatStreamLiveness` | `true` | 观察实际 HTTP/SSE 字节,不伪造助手输出;`false` 恢复纯原生计时。显式 WebSocket/`auto` transport 不变。 |
|
|
373
|
+
| `chatMaxRequestImageBytes` | `20971520` | 原生出站图片预算(20 MiB),不是总 JSON/供应方上限。显式减小后由 Core 将较旧图片 offload 到映射的只读路径;原始历史保留,但出站图片可见性会改变。 |
|
|
369
374
|
| `requestBudgetSafetyTokens` | `4096` | 非负安全整数的估算输入余量;增加会减少可用输入空间。 |
|
|
370
375
|
| `requestBudgetPressureRatio` | `0.9` | 提前压力比例,0.01–1、步长 0.01;仅在官方自动恢复已启用且接口可用时使用。 |
|
|
371
376
|
| `compactionReasoning` | `prefer-low` | 摘要等级缺省时选择已支持的 minimal/low;`preserve` 保留原生默认。 |
|
|
@@ -467,8 +472,8 @@ node scripts/agent.mjs attribution "DeepSeek Harness (DSH)"
|
|
|
467
472
|
`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 要求包已存在,不能代替首次建包。不会批量补发历史版本。
|
|
468
473
|
|
|
469
474
|
```sh
|
|
470
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
471
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
475
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.80/dsh-github-copilot-0.4.0-alpha.80.tgz
|
|
476
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.80/SHA256SUMS
|
|
472
477
|
sha256sum --check SHA256SUMS
|
|
473
478
|
```
|
|
474
479
|
|
|
@@ -476,7 +481,7 @@ PowerShell 可以对已下载的同一组文件执行:
|
|
|
476
481
|
|
|
477
482
|
```powershell
|
|
478
483
|
$expected = (Get-Content .\SHA256SUMS).Split()[0]
|
|
479
|
-
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.
|
|
484
|
+
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.80.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
|
|
480
485
|
if ($actual -cne $expected) { throw 'Release checksum mismatch' }
|
|
481
486
|
```
|
|
482
487
|
|
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.80"
|
|
12
12
|
},
|
|
13
13
|
"evidence": {
|
|
14
14
|
"kind": "source-and-synthetic-test-inventory",
|
|
@@ -553,6 +553,8 @@
|
|
|
553
553
|
{"file": "src/remote.ts", "marker": "githubCopilot.setModelExcluded"},
|
|
554
554
|
{"file": "src/preview-provider.ts", "marker": "native.streamSimple"},
|
|
555
555
|
{"file": "src/request-body-timeout.ts", "marker": "COPILOT_REQUEST_BODY_TIMEOUT"},
|
|
556
|
+
{"file": "src/copilot-stream-liveness.ts", "marker": "COPILOT_STREAM_IDLE_TIMEOUT"},
|
|
557
|
+
{"file": "src/preview-route.ts", "marker": "Math.min(idle * 2, 2_147_483_647)"},
|
|
556
558
|
{"file": "src/response-error-body.ts", "marker": "readResponseErrorJson"},
|
|
557
559
|
{"file": "src/pi-provider-bridge.ts", "marker": "PiStreamPublicCompatibility"}
|
|
558
560
|
],
|
|
@@ -570,6 +572,12 @@
|
|
|
570
572
|
{"file": "tests/preview-route.spec.ts", "name": "enriches only a verified 408 while preserving native failure classification and retry ownership"},
|
|
571
573
|
{"file": "tests/preview-provider.spec.ts", "name": "observes verified %s timeout without changing bytes, Response, native retries or credential ownership"},
|
|
572
574
|
{"file": "tests/request-body-timeout.spec.ts", "name": "bounds stalled response observation and gives cancellation priority"},
|
|
575
|
+
{"file": "tests/copilot-stream-liveness.spec.ts", "name": "does not count consumer think time as provider idle"},
|
|
576
|
+
{"file": "tests/copilot-stream-adapter.spec.ts", "name": "reproduces native semantic timeout despite ongoing SSE bytes"},
|
|
577
|
+
{"file": "tests/copilot-stream-adapter.spec.ts", "name": "allows real late output after the original semantic-idle boundary"},
|
|
578
|
+
{"file": "tests/copilot-stream-adapter.spec.ts", "name": "retains a native hard semantic deadline for an endless heartbeat stream"},
|
|
579
|
+
{"file": "tests/preview-route.spec.ts", "name": "restores byte-idle failures as TIMEOUT without adding a native wire attempt"},
|
|
580
|
+
{"file": "tests/preview-route.spec.ts", "name": "excludes actual Core consumer think time despite eager SDK event forwarding"},
|
|
573
581
|
{"file": "tests/pi-provider-bridge.spec.ts", "name": "preserves the stream object rather than copying or replacing its private queue"},
|
|
574
582
|
{"file": "tests/pi-provider-bridge.spec.ts", "name": "passes the checked simple input through and rejects unsupported advanced entry without I/O"}
|
|
575
583
|
]
|
|
@@ -91,6 +91,10 @@ Current scoped-recovery evidence additionally targets unchanged official `639ed0
|
|
|
91
91
|
|
|
92
92
|
## Verification boundary
|
|
93
93
|
|
|
94
|
+
Managed HTTP/SSE liveness is separate from compaction and HTTP 408. Core's idle watchdog measures translated assistant chunks, not heartbeat bytes. The plugin observes actual nonempty bytes without parsing or fabricating output: the default byte-idle limit stays five minutes, while native semantic silence is bounded to ten minutes. Consumer think time does not count; endless heartbeats still fail. Caller cancellation and native retry ownership remain unchanged. Explicit WebSocket/auto transport and `chatStreamLiveness: false` retain native-only timing.
|
|
95
|
+
|
|
96
|
+
`github-copilot.chatMaxRequestImageBytes` exposes the existing native image projection budget with its unchanged 20971520-byte default. An explicit smaller budget can reduce outgoing image payloads by offloading older images into mapped read-only paths; original history is retained, but outgoing image visibility changes. This is not a total request cap, automatic compaction, or a supplier size limit. No live budget reduction is performed by installation or by a 408. Fixed text/tool prefixes and network/service faults may still cause upload timeouts.
|
|
97
|
+
|
|
94
98
|
Pure arithmetic and policy tests, public-middleware fixtures, and the real published native adapter/SDK with synthetic transport cover separate layers. Required cases include independent/combined bounds, changed prefixes, explicit/default output and effort, metadata/credential invalidation, direct/prepared parity, concurrent calls, cancellation, output truncation and oversized manual input. Existing full plugin gates and exact-Core compatibility fixtures remain required; source inventory is not their execution result.
|
|
95
99
|
|
|
96
100
|
No live model inference, local Desktop installation, activation or restart is implied by unit tests or publication. Preserve immutable GitHub/npm byte identity and coordinate Desktop/Ops pins separately after release verification.
|
|
@@ -21,6 +21,7 @@ Follow the [plugin-only boundary](../AGENTS.md#plugin-only-implementation-bounda
|
|
|
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
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.
|
|
24
|
+
- Verify byte-aware managed HTTP/SSE liveness through unchanged published and tagged adapters: heartbeat bytes may cross the original semantic deadline before actual output, but endless heartbeat-only output must hit the bounded native deadline. Real header/body stalls retain the original interval and a dispatch-local TIMEOUT; consumer think time, caller/credential cancellation, exact bytes, parser ownership and one native wire attempt remain unchanged. Explicit WebSocket/auto and opt-out retain native-only behavior. Preserve the 20 MiB native image budget by default; explicit smaller budgets must use native offload and retain mapped read-only paths/history, never hidden trimming or a claimed supplier threshold. These synthetic cases do not attest production heartbeat activity or cure HTTP 408.
|
|
24
25
|
- 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.
|
|
25
26
|
|
|
26
27
|
## Explicit public-interface limits
|
package/lib/index.js
CHANGED
|
@@ -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.80";
|
|
1851
1851
|
//#endregion
|
|
1852
1852
|
//#region lib/types/probe.js
|
|
1853
1853
|
/**
|
|
@@ -2175,9 +2175,8 @@ const WebSearchRoutingConfigSchema = z.object({
|
|
|
2175
2175
|
//#endregion
|
|
2176
2176
|
//#region lib/types/config.js
|
|
2177
2177
|
/**
|
|
2178
|
-
* Settings
|
|
2179
|
-
*
|
|
2180
|
-
* configurable through the settings seam; defaults follow the chat route.
|
|
2178
|
+
* Settings for managed account requests and inline hosted search, including
|
|
2179
|
+
* separate stream bounds. Credentials and model transport remain native-owned.
|
|
2181
2180
|
* @module dsh-github-copilot/config
|
|
2182
2181
|
*/
|
|
2183
2182
|
/** Keep native live references at the boundary; request code consumes plain snapshots. */
|
|
@@ -2206,6 +2205,9 @@ const Config = z.object({
|
|
|
2206
2205
|
includeSources: z.boolean().default(true),
|
|
2207
2206
|
stripServerTools: z.boolean().default(true),
|
|
2208
2207
|
idleTimeoutMs: z.number().step(1).min(1).max(MAX_TIMEOUT_MS).default(3e5),
|
|
2208
|
+
chatStreamIdleTimeoutMs: z.number().step(1).min(1).max(MAX_TIMEOUT_MS).default(3e5),
|
|
2209
|
+
chatStreamLiveness: z.boolean().default(true),
|
|
2210
|
+
chatMaxRequestImageBytes: z.number().step(1).min(1).max(Number.MAX_SAFE_INTEGER).default(20971520),
|
|
2209
2211
|
probe: z.boolean().default(true),
|
|
2210
2212
|
probeTimeoutMs: z.number().step(1).min(1).max(MAX_TIMEOUT_MS).default(3e4),
|
|
2211
2213
|
accountModelTtlMs: z.number().step(1).min(0).max(MAX_TIMEOUT_MS).default(864e5),
|
|
@@ -5551,6 +5553,112 @@ async function requestBodyTimeoutDiagnostic(response, body, signal) {
|
|
|
5551
5553
|
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.`;
|
|
5552
5554
|
}
|
|
5553
5555
|
//#endregion
|
|
5556
|
+
//#region lib/types/copilot-stream-liveness.js
|
|
5557
|
+
var CopilotStreamIdleError = class extends Error {
|
|
5558
|
+
timeoutMs;
|
|
5559
|
+
constructor(timeoutMs, stage = "waiting for HTTP response", requestBytes) {
|
|
5560
|
+
const size = requestBytes === void 0 ? "Request body size unavailable." : `Request body: ${requestBytes} UTF-8 bytes (not context tokens).`;
|
|
5561
|
+
super(`COPILOT_STREAM_IDLE_TIMEOUT: No HTTP response or nonempty response-body bytes for ${timeoutMs}ms while ${stage}. ${size} Native retry ownership is unchanged; no history was trimmed or model switched.`);
|
|
5562
|
+
this.timeoutMs = timeoutMs;
|
|
5563
|
+
this.name = "CopilotStreamIdleError";
|
|
5564
|
+
}
|
|
5565
|
+
};
|
|
5566
|
+
/** A request-local byte-idle bound; the native adapter separately bounds semantic silence. */
|
|
5567
|
+
var CopilotStreamLiveness = class {
|
|
5568
|
+
timeoutMs;
|
|
5569
|
+
controller = new AbortController();
|
|
5570
|
+
timer;
|
|
5571
|
+
disposed = false;
|
|
5572
|
+
paused = false;
|
|
5573
|
+
stage = "waiting for HTTP response";
|
|
5574
|
+
requestBytes;
|
|
5575
|
+
signal;
|
|
5576
|
+
constructor(timeoutMs, upstream) {
|
|
5577
|
+
this.timeoutMs = timeoutMs;
|
|
5578
|
+
if (!Number.isInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs > 2147483647) throw new Error("COPILOT_STREAM_IDLE_INTERVAL_INVALID");
|
|
5579
|
+
this.signal = AbortSignal.any([upstream, this.controller.signal]);
|
|
5580
|
+
this.signal.addEventListener("abort", this.dispose, { once: true });
|
|
5581
|
+
if (this.signal.aborted) this.dispose();
|
|
5582
|
+
this.pulse();
|
|
5583
|
+
}
|
|
5584
|
+
pulse() {
|
|
5585
|
+
if (this.disposed || this.paused || this.signal.aborted) return;
|
|
5586
|
+
if (this.timer !== void 0) clearTimeout(this.timer);
|
|
5587
|
+
this.timer = setTimeout(() => this.controller.abort(new CopilotStreamIdleError(this.timeoutMs, this.stage, this.requestBytes)), this.timeoutMs);
|
|
5588
|
+
}
|
|
5589
|
+
beginRequest(body) {
|
|
5590
|
+
this.stage = "waiting for HTTP response";
|
|
5591
|
+
this.requestBytes = body === void 0 ? void 0 : Buffer.byteLength(body, "utf8");
|
|
5592
|
+
this.pulse();
|
|
5593
|
+
}
|
|
5594
|
+
pause() {
|
|
5595
|
+
this.paused = true;
|
|
5596
|
+
if (this.timer !== void 0) clearTimeout(this.timer);
|
|
5597
|
+
}
|
|
5598
|
+
resume() {
|
|
5599
|
+
this.paused = false;
|
|
5600
|
+
this.pulse();
|
|
5601
|
+
}
|
|
5602
|
+
observe(response) {
|
|
5603
|
+
if (!response.ok || !response.headers.get("content-type")?.toLowerCase().includes("text/event-stream") || response.body === null) return response;
|
|
5604
|
+
this.stage = "reading the SSE response body";
|
|
5605
|
+
this.pulse();
|
|
5606
|
+
const reader = response.body.getReader();
|
|
5607
|
+
const owner = this;
|
|
5608
|
+
let output;
|
|
5609
|
+
const onAbort = () => {
|
|
5610
|
+
reader.cancel(owner.signal.reason).catch((error) => {
|
|
5611
|
+
output?.error(owner.signal.reason ?? error);
|
|
5612
|
+
});
|
|
5613
|
+
};
|
|
5614
|
+
this.signal.addEventListener("abort", onAbort, { once: true });
|
|
5615
|
+
if (this.signal.aborted) onAbort();
|
|
5616
|
+
return new Response(new ReadableStream({
|
|
5617
|
+
start(controller) {
|
|
5618
|
+
output = controller;
|
|
5619
|
+
},
|
|
5620
|
+
async pull(controller) {
|
|
5621
|
+
try {
|
|
5622
|
+
const next = await reader.read();
|
|
5623
|
+
if (next.done) {
|
|
5624
|
+
controller.close();
|
|
5625
|
+
owner.signal.removeEventListener("abort", onAbort);
|
|
5626
|
+
reader.releaseLock();
|
|
5627
|
+
owner.dispose();
|
|
5628
|
+
} else {
|
|
5629
|
+
if (next.value.byteLength > 0) owner.pulse();
|
|
5630
|
+
controller.enqueue(next.value);
|
|
5631
|
+
}
|
|
5632
|
+
} catch (error) {
|
|
5633
|
+
owner.dispose();
|
|
5634
|
+
owner.signal.removeEventListener("abort", onAbort);
|
|
5635
|
+
reader.releaseLock();
|
|
5636
|
+
controller.error(error);
|
|
5637
|
+
}
|
|
5638
|
+
},
|
|
5639
|
+
async cancel(reason) {
|
|
5640
|
+
owner.dispose();
|
|
5641
|
+
owner.signal.removeEventListener("abort", onAbort);
|
|
5642
|
+
try {
|
|
5643
|
+
await reader.cancel(reason);
|
|
5644
|
+
} finally {
|
|
5645
|
+
reader.releaseLock();
|
|
5646
|
+
}
|
|
5647
|
+
}
|
|
5648
|
+
}), {
|
|
5649
|
+
status: response.status,
|
|
5650
|
+
statusText: response.statusText,
|
|
5651
|
+
headers: response.headers
|
|
5652
|
+
});
|
|
5653
|
+
}
|
|
5654
|
+
dispose = () => {
|
|
5655
|
+
if (this.disposed) return;
|
|
5656
|
+
this.disposed = true;
|
|
5657
|
+
if (this.timer !== void 0) clearTimeout(this.timer);
|
|
5658
|
+
this.signal.removeEventListener("abort", this.dispose);
|
|
5659
|
+
};
|
|
5660
|
+
};
|
|
5661
|
+
//#endregion
|
|
5554
5662
|
//#region lib/types/preview-provider.js
|
|
5555
5663
|
/** Identity, not upstream error text, proves that the plugin revoked this wire. */
|
|
5556
5664
|
var ManagedWireAbortError = class extends Error {
|
|
@@ -5730,6 +5838,24 @@ function createAccountProvider(descriptors, guard, baseURL) {
|
|
|
5730
5838
|
lease.release();
|
|
5731
5839
|
throw new Error("COPILOT_MANAGED_OAUTH_REQUIRED");
|
|
5732
5840
|
}
|
|
5841
|
+
let liveness;
|
|
5842
|
+
try {
|
|
5843
|
+
if (guard.streamIdleTimeoutMs !== void 0) {
|
|
5844
|
+
liveness = new CopilotStreamLiveness(guard.streamIdleTimeoutMs, lease.signal);
|
|
5845
|
+
guard.onStreamLiveness?.(liveness);
|
|
5846
|
+
}
|
|
5847
|
+
} catch (error) {
|
|
5848
|
+
liveness?.dispose();
|
|
5849
|
+
lease.release();
|
|
5850
|
+
throw error;
|
|
5851
|
+
}
|
|
5852
|
+
let idleReported = false;
|
|
5853
|
+
const reportIdleFailure = () => {
|
|
5854
|
+
if (!idleReported && liveness?.signal.reason instanceof CopilotStreamIdleError && !lease.signal.aborted && !options.signal?.aborted) {
|
|
5855
|
+
idleReported = true;
|
|
5856
|
+
guard.onStreamIdleTimeout?.(liveness.signal.reason);
|
|
5857
|
+
}
|
|
5858
|
+
};
|
|
5733
5859
|
const headers = {};
|
|
5734
5860
|
for (const [name, value] of Object.entries(options.headers ?? {})) if (name.toLowerCase() !== "authorization" && name.toLowerCase() !== "x-api-key") headers[name] = value;
|
|
5735
5861
|
Object.assign(headers, buildCopilotDynamicHeaders({
|
|
@@ -5744,6 +5870,7 @@ function createAccountProvider(descriptors, guard, baseURL) {
|
|
|
5744
5870
|
try {
|
|
5745
5871
|
retry = responses ? guard.retryReplay?.begin(context, guard.retrySignal, options?.sessionId, model.id) : void 0;
|
|
5746
5872
|
} catch (error) {
|
|
5873
|
+
liveness?.dispose();
|
|
5747
5874
|
lease.release();
|
|
5748
5875
|
throw error;
|
|
5749
5876
|
}
|
|
@@ -5767,6 +5894,7 @@ function createAccountProvider(descriptors, guard, baseURL) {
|
|
|
5767
5894
|
const fetch = options.fetch ?? globalThis.fetch;
|
|
5768
5895
|
const observeResponse = async (input, init) => {
|
|
5769
5896
|
guard.onRequestBodyTimeout?.(void 0);
|
|
5897
|
+
liveness?.beginRequest(typeof init?.body === "string" ? init.body : void 0);
|
|
5770
5898
|
let response;
|
|
5771
5899
|
try {
|
|
5772
5900
|
response = await fetch(input, init);
|
|
@@ -5783,33 +5911,37 @@ function createAccountProvider(descriptors, guard, baseURL) {
|
|
|
5783
5911
|
if (responses && await isCopilotInputItemScopeError(response, lease.signal)) reportReplayFailure(new CopilotResponsesReplayError("scope-mismatch"));
|
|
5784
5912
|
else unauthorized = true;
|
|
5785
5913
|
}
|
|
5786
|
-
return response;
|
|
5914
|
+
return liveness?.observe(response) ?? response;
|
|
5787
5915
|
};
|
|
5788
5916
|
const wireOptions = model.api === "anthropic-messages" ? {
|
|
5789
5917
|
...options,
|
|
5790
|
-
signal: lease.signal,
|
|
5918
|
+
signal: liveness?.signal ?? lease.signal,
|
|
5791
5919
|
apiKey: void 0,
|
|
5792
5920
|
headers,
|
|
5793
5921
|
fetch: observeResponse
|
|
5794
5922
|
} : {
|
|
5795
5923
|
...options,
|
|
5796
|
-
signal: lease.signal,
|
|
5924
|
+
signal: liveness?.signal ?? lease.signal,
|
|
5797
5925
|
headers,
|
|
5798
5926
|
fetch: observeResponse,
|
|
5799
5927
|
onPayload
|
|
5800
5928
|
};
|
|
5801
5929
|
if (!hasApi(model, "openai-responses") && !hasApi(model, "openai-completions") && !hasApi(model, "anthropic-messages")) {
|
|
5802
5930
|
retry?.finish();
|
|
5931
|
+
liveness?.dispose();
|
|
5803
5932
|
lease.release();
|
|
5804
5933
|
throw new Error("COPILOT_MANAGED_PROTOCOL_UNSUPPORTED");
|
|
5805
5934
|
}
|
|
5806
5935
|
return (async function* () {
|
|
5807
5936
|
try {
|
|
5808
5937
|
for await (const event of native.streamSimple(model, context, wireOptions)) {
|
|
5938
|
+
reportIdleFailure();
|
|
5809
5939
|
if (event.type === "error" && event.reason === "aborted" && lease.signal.reason instanceof ManagedWireAbortError) guard.onWireAbort?.(lease.signal.reason.code);
|
|
5810
5940
|
yield event;
|
|
5811
5941
|
}
|
|
5812
5942
|
} finally {
|
|
5943
|
+
reportIdleFailure();
|
|
5944
|
+
liveness?.dispose();
|
|
5813
5945
|
if (lease.signal.aborted || options.signal?.aborted) retry?.observe(void 0, 0);
|
|
5814
5946
|
retry?.finish();
|
|
5815
5947
|
lease.release();
|
|
@@ -7836,6 +7968,7 @@ var PreviewAdapter = class extends PiAiAdapter {
|
|
|
7836
7968
|
let requestFailure;
|
|
7837
7969
|
let wireAbort;
|
|
7838
7970
|
let bodyTimeout;
|
|
7971
|
+
let liveness;
|
|
7839
7972
|
const inspectRequest = (_model, context, nativeOptions) => {
|
|
7840
7973
|
if (signal.aborted) throw abortFailure(signal);
|
|
7841
7974
|
const imageFailure = imageInputFailure(lease.descriptor, context.messages);
|
|
@@ -7865,6 +7998,12 @@ var PreviewAdapter = class extends PiAiAdapter {
|
|
|
7865
7998
|
onRequestBodyTimeout(diagnostic) {
|
|
7866
7999
|
bodyTimeout = diagnostic;
|
|
7867
8000
|
},
|
|
8001
|
+
onStreamIdleTimeout(error) {
|
|
8002
|
+
requestFailure = new LlmError(error.message, "TIMEOUT", { cause: error });
|
|
8003
|
+
},
|
|
8004
|
+
onStreamLiveness(control) {
|
|
8005
|
+
liveness = control;
|
|
8006
|
+
},
|
|
7868
8007
|
onReplayFailure(error) {
|
|
7869
8008
|
if (!signal.aborted) requestFailure = new LlmError(error.message, "INVALID_REQUEST");
|
|
7870
8009
|
}
|
|
@@ -7878,6 +8017,7 @@ var PreviewAdapter = class extends PiAiAdapter {
|
|
|
7878
8017
|
...effort === void 0 ? {} : { reasoningEffort: ReasoningEffortId(effort) }
|
|
7879
8018
|
};
|
|
7880
8019
|
for await (const chunk of native.stream(request)) {
|
|
8020
|
+
let delivered = chunk;
|
|
7881
8021
|
if (requestFailure !== void 0) {
|
|
7882
8022
|
if (signal.aborted) throw abortFailure(signal);
|
|
7883
8023
|
throw requestFailure;
|
|
@@ -7889,7 +8029,7 @@ var PreviewAdapter = class extends PiAiAdapter {
|
|
|
7889
8029
|
if (chunk.type === "finish" && chunk.reason.kind === "error" && chunk.reason.failure.code === "UNKNOWN_MODEL") await owner.refreshRejected(lease.snapshot, signal);
|
|
7890
8030
|
if (chunk.type === "finish" && chunk.reason.kind === "error" && bodyTimeout !== void 0 && chunk.reason.failure.code !== "ABORTED") {
|
|
7891
8031
|
if (signal.aborted) throw abortFailure(signal);
|
|
7892
|
-
|
|
8032
|
+
delivered = {
|
|
7893
8033
|
...chunk,
|
|
7894
8034
|
reason: {
|
|
7895
8035
|
...chunk.reason,
|
|
@@ -7899,9 +8039,13 @@ var PreviewAdapter = class extends PiAiAdapter {
|
|
|
7899
8039
|
}
|
|
7900
8040
|
}
|
|
7901
8041
|
};
|
|
7902
|
-
continue;
|
|
7903
8042
|
}
|
|
7904
|
-
|
|
8043
|
+
liveness?.pause();
|
|
8044
|
+
try {
|
|
8045
|
+
yield delivered;
|
|
8046
|
+
} finally {
|
|
8047
|
+
liveness?.resume();
|
|
8048
|
+
}
|
|
7905
8049
|
}
|
|
7906
8050
|
if (requestFailure !== void 0) throw requestFailure;
|
|
7907
8051
|
} catch (cause) {
|
|
@@ -7917,7 +8061,7 @@ var PreviewAdapter = class extends PiAiAdapter {
|
|
|
7917
8061
|
};
|
|
7918
8062
|
/** Register one stable account route; attach/status remain network-free. */
|
|
7919
8063
|
function apply$1(ctx, config = {}) {
|
|
7920
|
-
const { accountModelTtlMs, accountModelFailureCooldownMs, accountModelSettings, requestBudget, requestBudgetSettings, ...requestConfig } = config;
|
|
8064
|
+
const { accountModelTtlMs, accountModelFailureCooldownMs, accountModelSettings, requestBudget, requestBudgetSettings, streamLiveness, chatRequestSettings, ...requestConfig } = config;
|
|
7921
8065
|
const cacheSettings = accountModelSettings ?? (() => ({
|
|
7922
8066
|
accountModelTtlMs,
|
|
7923
8067
|
accountModelFailureCooldownMs,
|
|
@@ -8140,9 +8284,13 @@ function apply$1(ctx, config = {}) {
|
|
|
8140
8284
|
} catch {}
|
|
8141
8285
|
};
|
|
8142
8286
|
const optionsFor = (lease, hooks = {}) => {
|
|
8287
|
+
const settings = chatRequestSettings?.();
|
|
8288
|
+
const idle = settings?.chatStreamIdleTimeoutMs ?? template.streamIdleTimeoutMs;
|
|
8289
|
+
const enabled = (settings?.chatStreamLiveness ?? streamLiveness ?? true) && (template.transport === void 0 || template.transport === "sse");
|
|
8143
8290
|
const guard = {
|
|
8144
8291
|
...lifetime.guard(lease),
|
|
8145
8292
|
...hooks,
|
|
8293
|
+
...enabled ? { streamIdleTimeoutMs: idle } : {},
|
|
8146
8294
|
onUnauthorized() {
|
|
8147
8295
|
if (lease === void 0 || !lifetime.isCurrent(lease.revision) || source.readDisplaySnapshot() !== lease.snapshot || provenSnapshot !== lease.snapshot || snapshotProof !== lease.proof) return;
|
|
8148
8296
|
rejectedAuth = lease.proof;
|
|
@@ -8153,9 +8301,10 @@ function apply$1(ctx, config = {}) {
|
|
|
8153
8301
|
}
|
|
8154
8302
|
};
|
|
8155
8303
|
const { provider } = createAccountProvider(lease?.snapshot.models ?? [], guard, lease?.proof.baseURL ?? "https://api.individual.githubcopilot.com");
|
|
8156
|
-
const profile =
|
|
8157
|
-
...
|
|
8158
|
-
|
|
8304
|
+
const profile = resolvedProfile(provider, {
|
|
8305
|
+
...requestConfig,
|
|
8306
|
+
streamIdleTimeoutMs: enabled ? Math.min(idle * 2, 2147483647) : idle,
|
|
8307
|
+
maxRequestImageBytes: settings?.chatMaxRequestImageBytes ?? template.maxRequestImageBytes
|
|
8159
8308
|
});
|
|
8160
8309
|
const profiles = /* @__PURE__ */ new Map([[GITHUB_COPILOT_PREVIEW_PROVIDER_ID, profile]]);
|
|
8161
8310
|
return {
|
|
@@ -8407,6 +8556,7 @@ function activate(ctx, config) {
|
|
|
8407
8556
|
};
|
|
8408
8557
|
ctx.plugin(preview_route_default, {
|
|
8409
8558
|
accountModelSettings: () => current(),
|
|
8559
|
+
chatRequestSettings: () => current(),
|
|
8410
8560
|
requestBudgetSettings: () => {
|
|
8411
8561
|
const selected = current();
|
|
8412
8562
|
return {
|
package/lib/types/config.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Settings
|
|
3
|
-
*
|
|
4
|
-
* configurable through the settings seam; defaults follow the chat route.
|
|
2
|
+
* Settings for managed account requests and inline hosted search, including
|
|
3
|
+
* separate stream bounds. Credentials and model transport remain native-owned.
|
|
5
4
|
* @module dsh-github-copilot/config
|
|
6
5
|
*/
|
|
7
6
|
import z from '@deepseek-ai/schemastery';
|
|
@@ -11,7 +10,7 @@ import type { LiveSetting } from './settings-reader.ts';
|
|
|
11
10
|
import type { ParentModelBinding } from './parent-model-follow.ts';
|
|
12
11
|
/** Plugin configuration. Defaults make the current chat route decide. */
|
|
13
12
|
export interface InlineConfig {
|
|
14
|
-
/**
|
|
13
|
+
/** Hosted-search switch; managed chat requests remain enabled. */
|
|
15
14
|
enabled: boolean;
|
|
16
15
|
/**
|
|
17
16
|
* Provider whitelist (llm-pi-ai route keys). Empty = follow the current
|
|
@@ -24,6 +23,12 @@ export interface InlineConfig {
|
|
|
24
23
|
stripServerTools: boolean;
|
|
25
24
|
/** Idle bound for one inline request, in milliseconds. */
|
|
26
25
|
idleTimeoutMs: number;
|
|
26
|
+
/** Managed chat byte-idle interval; separate from hosted search. */
|
|
27
|
+
chatStreamIdleTimeoutMs?: number;
|
|
28
|
+
/** Enable bounded HTTP byte-aware liveness without fabricated assistant progress. */
|
|
29
|
+
chatStreamLiveness?: boolean;
|
|
30
|
+
/** Native request image projection budget; changing it can offload older images. */
|
|
31
|
+
chatMaxRequestImageBytes?: number;
|
|
27
32
|
/** Verify the endpoint executes native search before serving. */
|
|
28
33
|
probe: boolean;
|
|
29
34
|
/** Bound on one probe request, in milliseconds. */
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare class CopilotStreamIdleError extends Error {
|
|
2
|
+
readonly timeoutMs: number;
|
|
3
|
+
constructor(timeoutMs: number, stage?: string, requestBytes?: number);
|
|
4
|
+
}
|
|
5
|
+
/** A request-local byte-idle bound; the native adapter separately bounds semantic silence. */
|
|
6
|
+
export declare class CopilotStreamLiveness {
|
|
7
|
+
private readonly timeoutMs;
|
|
8
|
+
private readonly controller;
|
|
9
|
+
private timer;
|
|
10
|
+
private disposed;
|
|
11
|
+
private paused;
|
|
12
|
+
private stage;
|
|
13
|
+
private requestBytes;
|
|
14
|
+
readonly signal: AbortSignal;
|
|
15
|
+
constructor(timeoutMs: number, upstream: AbortSignal);
|
|
16
|
+
pulse(): void;
|
|
17
|
+
beginRequest(body?: string): void;
|
|
18
|
+
pause(): void;
|
|
19
|
+
resume(): void;
|
|
20
|
+
observe(response: Response): Response;
|
|
21
|
+
dispose: () => void;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=copilot-stream-liveness.d.ts.map
|
|
@@ -4,6 +4,7 @@ import type { CoreCompatibleProvider } from './pi-provider-bridge.ts';
|
|
|
4
4
|
import type { GitHubCopilotOAuthCredential } from './copilot-grant.ts';
|
|
5
5
|
import { CopilotResponsesReplayError } from './responses-replay-compat.ts';
|
|
6
6
|
import type { ResponsesRetryReplay } from './responses-replay-compat.ts';
|
|
7
|
+
import { CopilotStreamIdleError, CopilotStreamLiveness } from './copilot-stream-liveness.ts';
|
|
7
8
|
export type ManagedWireAbortCode = 'COPILOT_PREVIEW_CREDENTIAL_CHANGED' | 'COPILOT_PREVIEW_DISPOSED';
|
|
8
9
|
/** Identity, not upstream error text, proves that the plugin revoked this wire. */
|
|
9
10
|
export declare class ManagedWireAbortError extends Error {
|
|
@@ -27,6 +28,10 @@ export interface PreviewProviderGuard {
|
|
|
27
28
|
onWireAbort?(code: ManagedWireAbortCode): void;
|
|
28
29
|
/** Request-local safe guidance from a verified HTTP response; undefined clears prior evidence. */
|
|
29
30
|
onRequestBodyTimeout?(diagnostic: string | undefined): void;
|
|
31
|
+
/** Optional HTTP byte-idle bound paired with a separate native semantic deadline. */
|
|
32
|
+
readonly streamIdleTimeoutMs?: number;
|
|
33
|
+
onStreamLiveness?(control: Pick<CopilotStreamLiveness, 'pause' | 'resume'>): void;
|
|
34
|
+
onStreamIdleTimeout?(error: CopilotStreamIdleError): void;
|
|
30
35
|
}
|
|
31
36
|
/** Guard for one selected model in an account-bound descriptor snapshot. */
|
|
32
37
|
export interface AccountProviderGuard extends PreviewProviderGuard {
|
|
@@ -7,6 +7,8 @@ import type { InlineConfig } from './config.ts';
|
|
|
7
7
|
import type { RequestBudgetPolicy } from './request-budget.ts';
|
|
8
8
|
/** Safe request knobs; identities, model tables, endpoints and credentials are not configurable. */
|
|
9
9
|
export type PreviewRouteConfig = Pick<PiAiProviderProfile, 'reasoning' | 'cacheRetention' | 'transport' | 'timeoutMs' | 'websocketConnectTimeoutMs' | 'streamIdleTimeoutMs' | 'maxRequestImageBytes' | 'requestImagePixelBudget' | 'requestImageMaxBytes' | 'retryPolicy'> & Pick<InlineConfig, 'accountModelTtlMs' | 'accountModelFailureCooldownMs'> & {
|
|
10
|
+
readonly streamLiveness?: boolean;
|
|
11
|
+
readonly chatRequestSettings?: () => Pick<InlineConfig, 'chatStreamIdleTimeoutMs' | 'chatStreamLiveness' | 'chatMaxRequestImageBytes'>;
|
|
10
12
|
readonly accountModelSettings?: () => Pick<InlineConfig, 'accountModelTtlMs' | 'accountModelFailureCooldownMs' | 'excludedModelIds' | 'parentModelFollow' | 'followParentModel'>;
|
|
11
13
|
readonly requestBudget?: Partial<RequestBudgetPolicy>;
|
|
12
14
|
readonly requestBudgetSettings?: () => Partial<RequestBudgetPolicy>;
|
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.80",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"registry": "https://registry.npmjs.org/",
|