dsh-github-copilot 0.4.0-alpha.64 → 0.4.0-alpha.65
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/CHANGELOG.md +6 -0
- package/README.md +9 -7
- package/README.zh.md +9 -7
- package/deployment-baseline.json +5 -1
- package/docs/automatic-model-routing.md +3 -3
- package/docs/copilot-compaction.md +4 -0
- package/lib/index.js +31 -34
- package/lib/types/auto-model-routing.d.ts +5 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.0-alpha.65 (prepared)
|
|
4
|
+
|
|
5
|
+
- Fix Auto input undercount by using Core's public TokenMeter instead of passing Core messages to pi-ai's incompatible estimator and swallowing its errors (#230). Include assistant reasoning/tool history and retain native current-surface/tool-envelope measurement as a conservative floor.
|
|
6
|
+
- Fail Auto explicitly when native measurement is missing or invalid; fixed model selection remains available. Recognize native compact-checkpoint provenance without changing messages or same-turn routing.
|
|
7
|
+
- This is a preventive input-fit fix, not recovery of already oversized manual summaries. The independent summary-input overflow investigation remains open in #228; no chunking, alternate summarizer, history deletion, or extra retry loop is introduced.
|
|
8
|
+
|
|
3
9
|
## 0.4.0-alpha.64 (prepared)
|
|
4
10
|
|
|
5
11
|
- Omit only explicitly empty completed reasoning shells from managed Responses outgoing payloads, without changing durable history, opaque encrypted content, public summaries or tool call/result pairing (#226).
|
package/README.md
CHANGED
|
@@ -98,7 +98,7 @@ The Host reads GitHub's internal quota endpoint using the existing canonical OAu
|
|
|
98
98
|
|
|
99
99
|
## Install and sign in
|
|
100
100
|
|
|
101
|
-
The commands below target the package version `0.4.0-alpha.
|
|
101
|
+
The commands below target the package version `0.4.0-alpha.65`. 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):
|
|
102
102
|
|
|
103
103
|
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):
|
|
104
104
|
|
|
@@ -111,10 +111,10 @@ Include any launcher patch files with repeated `--patch /absolute/file` argument
|
|
|
111
111
|
For a standalone named profile only, the supported CLI command is:
|
|
112
112
|
|
|
113
113
|
```sh
|
|
114
|
-
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
114
|
+
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.65/dsh-github-copilot-0.4.0-alpha.65.tgz
|
|
115
115
|
```
|
|
116
116
|
|
|
117
|
-
For Desktop profiles, use Desktop's native package manager with `dsh-github-copilot@0.4.0-alpha.
|
|
117
|
+
For Desktop profiles, use Desktop's native package manager with `dsh-github-copilot@0.4.0-alpha.65` 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.
|
|
118
118
|
|
|
119
119
|
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.
|
|
120
120
|
|
|
@@ -134,6 +134,8 @@ The managed GitHub Copilot group includes **Auto · Balance**, **Auto · Efficie
|
|
|
134
134
|
|
|
135
135
|
Completed Copilot replies show **Auto (preference)** and an expandable recorded reason after native Usage/time, or **Manual** only with captured explicit fixed-selection evidence. Missing evidence shows **Selection unknown**, never a guess from today's picker. There is no repeated model name or separate Model details button: actual model display stays in native Usage, whose missing-route behavior is unchanged. New selection records are bounded and Host-local; restart, disposal or eviction loses them. Compatible historical Auto records remain readable. The public assistant-actions slot supports internal wrapping only, not changing the native fixed-height row.
|
|
136
136
|
|
|
137
|
+
Auto input fitting uses Core's native TokenMeter for every entered message, including reasoning and tool history, plus its current-surface/tool-envelope floor. Missing or invalid native measurement fails Auto explicitly rather than silently selecting from an undercount. This prevents the known estimation error but does not rescue history whose summary input already exceeds every eligible model's budget; see [compaction limits](./docs/copilot-compaction.md#existing-oversized-history-and-recovery-limits).
|
|
138
|
+
|
|
137
139
|
Alpha.63 fixes a missing footer on official Desktop by supporting its native ChatNodeStore rather than requiring a JavaScript Map. It does not change Auto selection or recover reasons already lost on Host restart.
|
|
138
140
|
|
|
139
141
|
**History loading error mentioning `github-copilot/auto-model-decision`:** alpha.54 prevents new incompatible events; upgrading or restarting does not repair existing logs. The [explicit recovery command](./docs/automatic-model-routing.md#recovering-affected-histories) validates a detached copy with the official codec and retains an exact original backup. Applying it to a live Session requires separate approval and stopped writers; no automatic history migration occurs.
|
|
@@ -161,7 +163,7 @@ Agents should treat the browser authorization as a human handoff, not as a token
|
|
|
161
163
|
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.
|
|
162
164
|
6. Use **Sign out** only when the user explicitly asks to disconnect the account. It deletes the Copilot credential record but preserves route settings.
|
|
163
165
|
|
|
164
|
-
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.
|
|
166
|
+
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.65`, 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).
|
|
165
167
|
|
|
166
168
|
**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.
|
|
167
169
|
|
|
@@ -436,8 +438,8 @@ Report the published Release URL, version, tag/commit and verified asset SHA-256
|
|
|
436
438
|
`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.
|
|
437
439
|
|
|
438
440
|
```sh
|
|
439
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
440
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
441
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.65/dsh-github-copilot-0.4.0-alpha.65.tgz
|
|
442
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.65/SHA256SUMS
|
|
441
443
|
sha256sum --check SHA256SUMS
|
|
442
444
|
```
|
|
443
445
|
|
|
@@ -445,7 +447,7 @@ PowerShell can verify the same two downloaded files with:
|
|
|
445
447
|
|
|
446
448
|
```powershell
|
|
447
449
|
$expected = (Get-Content .\SHA256SUMS).Split()[0]
|
|
448
|
-
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.
|
|
450
|
+
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.65.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
|
|
449
451
|
if ($actual -cne $expected) { throw 'Release checksum mismatch' }
|
|
450
452
|
```
|
|
451
453
|
|
package/README.zh.md
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
截图来自当前构建 Client 的隔离浏览器 fixture,使用合成 Provider。它只证明已发布配置界面的形态,不证明真实凭据、账号权限、搜索成功或当前 Desktop 已加载。
|
|
22
22
|
|
|
23
|
-
> 当前文档与安装命令对应版本 `0.4.0-alpha.
|
|
23
|
+
> 当前文档与安装命令对应版本 `0.4.0-alpha.65`。源码、发布制品、已安装版本和实际加载运行时需分别确认;本地升级和中断会话的重启仍需用户批准。
|
|
24
24
|
|
|
25
25
|
Web search 路由现在优先显示在插件详情页;宿主不支持详情页插槽时才回退到 **设置 → 模型**或独立 Web search section。搜索子 Fiber 仍独立等待 Remote,不影响账号控件和既有搜索安全检查。
|
|
26
26
|
|
|
@@ -113,10 +113,10 @@ node package/scripts/check-search-composition.mjs --profile-dir /absolute/profil
|
|
|
113
113
|
仅对独立的具名 profile,获准且网络可用时,可通过受支持的 CLI 命令安装:
|
|
114
114
|
|
|
115
115
|
```sh
|
|
116
|
-
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
116
|
+
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.65/dsh-github-copilot-0.4.0-alpha.65.tgz
|
|
117
117
|
```
|
|
118
118
|
|
|
119
|
-
Desktop profile 请在完成同样的预检后,使用 Desktop 原生包管理器安装 `dsh-github-copilot@0.4.0-alpha.
|
|
119
|
+
Desktop profile 请在完成同样的预检后,使用 Desktop 原生包管理器安装 `dsh-github-copilot@0.4.0-alpha.65`。Desktop 保留 `desktop` profile,CLI 不负责管理。若 registry 被公司封禁或不可用,不要更换网络绕行或使用离线 CLI;请停止。[受控离线 CLI 流程](./docs/npm-distribution.md#controlled-offline-cli-maintenance-for-standalone-profiles)仅适用于独立具名 profile,不适用于 Desktop。
|
|
120
120
|
|
|
121
121
|
随后打开上表对应的 Models UI,找到 **GitHub Copilot**,点击 **Sign in** 并完成 GitHub device-code 流程。安装会修改指定 profile;是否立即激活取决于该 profile 的常规 reload/restart 策略。
|
|
122
122
|
|
|
@@ -136,6 +136,8 @@ Desktop profile 请在完成同样的预检后,使用 Desktop 原生包管理
|
|
|
136
136
|
|
|
137
137
|
已完成的 Copilot 回复在原生 Usage/时间后显示 **Auto(偏好)**,点信息按钮查看本轮记录的选择原因;只有捕获到明确固定选择才显示**手动**。缺记录显示**选择方式未知**,不借当前 picker 推断历史。不重复模型名、不另设 Model details 按钮:实际模型仍由原生 Usage 显示,其缺失归属行为未改变。新选择记录仅限当前 Host 内存且有容量上限,重启、释放 Agent 或淘汰后会丢失;兼容历史 Auto 记录仍可读取。公开 assistant-actions slot 只允许插件内部换行,不能改变原生固定高度尾栏。
|
|
138
138
|
|
|
139
|
+
Auto 输入适配通过 Core 原生 TokenMeter 逐条估算消息,包含推理与工具历史,并保留原生当前上下文/工具定义测量值作为下限。缺失或无效的测量会明确报错,不再静默漏算后选模型。这能修复已知估算错误,但不能救回摘要输入已经超出所有合格模型预算的历史;详见[压缩恢复边界](./docs/copilot-compaction.md#existing-oversized-history-and-recovery-limits)。
|
|
140
|
+
|
|
139
141
|
Alpha.63 通过支持官方 Desktop 的原生 ChatNodeStore、移除必须为 JavaScript Map 的错误限制,修复尾栏不显示的问题。不改变 Auto 选择策略,也不能恢复 Host 重启后已丢失的选择原因。
|
|
140
142
|
|
|
141
143
|
**历史加载报错包含 `github-copilot/auto-model-decision`:**alpha.54 阻止新问题事件写入,但升级或重启不会修复已有日志。[显式恢复命令](./docs/automatic-model-routing.md#recovering-affected-histories)使用官方 codec 校验独立修复副本,同时保存原始字节备份。替换实际 Session 日志必须另行批准并先停止所有写入者;插件不会自动迁移历史。
|
|
@@ -163,7 +165,7 @@ Agent 应把浏览器授权视为需要用户完成的 handoff,而不是自行
|
|
|
163
165
|
5. 确认 **Signed in** 并检查自动发现结果,再请用户选择模型。已登录时打开 Models 会自动确保缺失/过期元数据,新鲜 ready 缓存不发请求。错误可使用 **Retry**,有意强制更新时使用 **Manage → Refresh models**,不作为常规设置步骤。状态读取本身不发现;登录、元数据与真实调用成功是独立证据。
|
|
164
166
|
6. 只有用户明确要求断开账号时才使用 **Sign out**;它会删除 Copilot credential record,但保留 route settings。
|
|
165
167
|
|
|
166
|
-
每个新版本默认同时分发到 GitHub Releases 和 npm,两个渠道使用同一份已验证 tarball。应固定版本并核对所用渠道的证据:Release 的 `SHA256SUMS`;从 npm 安装时另核对 `dist.integrity`。Desktop profile 只能通过原生 Desktop 包管理器安装;获准且 registry 可用时输入 `dsh-github-copilot@0.4.0-alpha.
|
|
168
|
+
每个新版本默认同时分发到 GitHub Releases 和 npm,两个渠道使用同一份已验证 tarball。应固定版本并核对所用渠道的证据:Release 的 `SHA256SUMS`;从 npm 安装时另核对 `dist.integrity`。Desktop profile 只能通过原生 Desktop 包管理器安装;获准且 registry 可用时输入 `dsh-github-copilot@0.4.0-alpha.65`,不是 URL 或本地文件。Desktop 保留 `desktop` profile,不能通过 DSH CLI 管理。受控离线 CLI 维护仅适用于独立具名 profile,不得作为 Desktop 安装绕行方案。[双渠道发布与 OIDC 要求](./docs/npm-distribution.md)保持不变。
|
|
167
169
|
|
|
168
170
|
**Desktop package 更新与 Web 生命周期边界:**原生 manager 对已安装 package 原位升级返回的 `restart-required` 是权威结果,与移除/重加 plugin bundle 的行为是两个不同问题。涉及服务重编排补丁(`cordis.patch.yml`,如本插件所采用的隔离路由 Web 搜索层)的停用、移除或升级,可能让依赖条目保持 pending,直到完全退出并冷重启 Desktop。若原生 manager 只报告类似 `pending (waiting for service: web)` 的条目,同时本插件已经显示 **Off**,说明请求的停用状态已经落盘;请冷重启 Desktop,不要反复切换或重装插件。其它错误不属于此提示范围,仍需单独排查。
|
|
169
171
|
|
|
@@ -447,8 +449,8 @@ node scripts/agent.mjs attribution "DeepSeek Harness (DSH)"
|
|
|
447
449
|
`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 要求包已存在,不能代替首次建包。不会批量补发历史版本。
|
|
448
450
|
|
|
449
451
|
```sh
|
|
450
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
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.65/dsh-github-copilot-0.4.0-alpha.65.tgz
|
|
453
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.65/SHA256SUMS
|
|
452
454
|
sha256sum --check SHA256SUMS
|
|
453
455
|
```
|
|
454
456
|
|
|
@@ -456,7 +458,7 @@ PowerShell 可以对已下载的同一组文件执行:
|
|
|
456
458
|
|
|
457
459
|
```powershell
|
|
458
460
|
$expected = (Get-Content .\SHA256SUMS).Split()[0]
|
|
459
|
-
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.
|
|
461
|
+
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.65.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
|
|
460
462
|
if ($actual -cne $expected) { throw 'Release checksum mismatch' }
|
|
461
463
|
```
|
|
462
464
|
|
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.65"
|
|
12
12
|
},
|
|
13
13
|
"evidence": {
|
|
14
14
|
"kind": "source-and-synthetic-test-inventory",
|
|
@@ -998,6 +998,7 @@
|
|
|
998
998
|
"sourceMarkers": [
|
|
999
999
|
{"file": "src/preview-route.ts", "marker": "GITHUB_COPILOT_AUTO_MODEL_ID"},
|
|
1000
1000
|
{"file": "src/auto-model-host.ts", "marker": "keep attribution out of the log"},
|
|
1001
|
+
{"file": "src/auto-model-host.ts", "marker": "COPILOT_AUTO_TOKEN_METER_UNAVAILABLE"},
|
|
1001
1002
|
{"file": "src/auto-model-presentation.ts", "marker": "conversation.chat.assistant-actions"},
|
|
1002
1003
|
{"file": "src/auto-model-presentation.ts", "marker": "turnModelProvenanceDefinition"},
|
|
1003
1004
|
{"file": "src/turn-model-provenance.ts", "marker": "assistant/message"},
|
|
@@ -1007,6 +1008,9 @@
|
|
|
1007
1008
|
],
|
|
1008
1009
|
"tests": [
|
|
1009
1010
|
{"file": "tests/auto-model-routing.spec.ts", "name": "classifies only the latest user turn and selects a deterministic capacity tier"},
|
|
1011
|
+
{"file": "tests/auto-model-routing.spec.ts", "name": "does not discard a complete Core assistant message when it contains reasoning"},
|
|
1012
|
+
{"file": "tests/auto-model-routing.spec.ts", "name": "retains the native current-surface and tool-envelope measurement as an input floor"},
|
|
1013
|
+
{"file": "tests/fixtures/compaction-pressure-core.fixture.ts", "name": "prices Core assistant text and reasoning with the unchanged native token meter"},
|
|
1010
1014
|
{"file": "tests/auto-model-routing.spec.ts", "name": "requires account-verified image capability for image turns"},
|
|
1011
1015
|
{"file": "tests/auto-model-host.spec.ts", "name": "resolves after downstream model selection and freezes one decision per turn"},
|
|
1012
1016
|
{"file": "tests/auto-model-host.spec.ts", "name": "replaces Core virtual-Auto switch guidance with the resolved real route"},
|
|
@@ -32,7 +32,7 @@ The catalog does not provide trustworthy quality, latency, price, or global-heal
|
|
|
32
32
|
|
|
33
33
|
Before applying soft preferences, routing checks whether each candidate can accommodate the estimated input tokens of the current turn:
|
|
34
34
|
|
|
35
|
-
1. **Input estimate:** `estimateTurnInputTokens`
|
|
35
|
+
1. **Input estimate:** `estimateTurnInputTokens` prices every entered Core message through the public native `tokenMeter.estimateMessage()`. Core reasoning, tool calls and tool results must not be passed to pi-ai's differently shaped message estimator or silently omitted on exceptions. The Host also retains `tokenMeter.measure(session).totalTokens` as a conservative floor for the current surface, native usage accounting and known tool envelope. Missing native measurement fails Auto with `COPILOT_AUTO_TOKEN_METER_UNAVAILABLE`; invalid numeric estimates fail with `COPILOT_AUTO_TOKEN_ESTIMATE_INVALID`. Explicit real-model selection does not require this Auto seam.
|
|
36
36
|
2. **Hard candidate budget:** For each candidate model, `calculateRequestBudget` calculates `hardInputLimit` given the model context window, output reservation, and safety allowance.
|
|
37
37
|
3. **Headroom filtering:** Candidates with insufficient headroom (`estimatedInputTokens > hardInputLimit`) are filtered out. If one or more fitting candidates exist, soft preference selects among the `fitting` subset.
|
|
38
38
|
4. **No-fit and compaction recovery:** If no candidate can fit the current messages:
|
|
@@ -42,7 +42,7 @@ Before applying soft preferences, routing checks whether each candidate can acco
|
|
|
42
42
|
- `compaction-unavailable`: compaction is disabled or has zero retries configured.
|
|
43
43
|
- `attempted-but-still-oversized`: a compaction summary already exists in history and the turn remains oversized.
|
|
44
44
|
- `compaction-eligible`: prior history is compressible and downstream dispatch will trigger compaction pressure.
|
|
45
|
-
5. **Final framing limitation:**
|
|
45
|
+
5. **Final framing limitation:** The fresh entered-message estimate and current native envelope floor are not the final candidate-specific serialized request. Later framing, changed tools and native attachment projection can still exceed a candidate's budget. The native provider guard (`inspectRequest`) remains authoritative and truthfully rejects such a request with `COPILOT_CONTEXT_BUDGET_EXCEEDED` without bypassing safety boundaries.
|
|
46
46
|
|
|
47
47
|
### Soft capacity preferences across candidate bands
|
|
48
48
|
|
|
@@ -91,7 +91,7 @@ The resolved real model enters the existing managed-route request-budget path. I
|
|
|
91
91
|
3. retries the same turn with the same resolved real model;
|
|
92
92
|
4. keeps the ordinary bounded overflow retry policy.
|
|
93
93
|
|
|
94
|
-
The guarantee is limited to
|
|
94
|
+
The guarantee is limited to history whose summary request itself fits. Correcting the Auto estimate does not recover a session when every eligible model is too small for the existing summary input. A fixed prompt, current attachment, or indivisible content block that cannot fit after compaction remains an explicit error. See [Copilot compaction](./copilot-compaction.md).
|
|
95
95
|
|
|
96
96
|
## Search ownership
|
|
97
97
|
|
|
@@ -63,6 +63,10 @@ The existing `enabled` switch remains hosted-search-only. These controls do not
|
|
|
63
63
|
|
|
64
64
|
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
65
|
|
|
66
|
+
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.
|
|
67
|
+
|
|
68
|
+
On official `0.2.0-rc.2`, the stock summarizer uses an explicitly configured summary route, otherwise the latest committed request header, otherwise the Agent's initial options. Changing only a pending picker selection therefore does not necessarily change a manual `/compact` request's model. Repeating the same over-budget summary or disabling admission is not a recovery procedure.
|
|
69
|
+
|
|
66
70
|
Official configuration already supports a separate summary route and output cap. Selecting a suitable authorized route/cap is an explicit deployment choice, not an automatic fallback. Increasing the output cap consumes combined-context headroom; decreasing it can reproduce the observed incomplete-checkpoint failure.
|
|
67
71
|
|
|
68
72
|
Bounded chunk/merge rescue was evaluated but is not included here. The official BasicCompactionEngine subclass hook is a possible extension, but would require an explicit single-provider composition choice, complete multi-call audit records, bounded calls/output, tool-pairing preservation and transactional cancellation/failure tests. Do not add it through a transparent wire interceptor or label several calls as one auxiliary request. Core changes are not a prerequisite for this preventive release.
|
package/lib/index.js
CHANGED
|
@@ -1646,7 +1646,7 @@ let GitHubCopilotUsageController = (() => {
|
|
|
1646
1646
|
//#endregion
|
|
1647
1647
|
//#region package.json
|
|
1648
1648
|
var name$1 = "dsh-github-copilot";
|
|
1649
|
-
var version = "0.4.0-alpha.
|
|
1649
|
+
var version = "0.4.0-alpha.65";
|
|
1650
1650
|
//#endregion
|
|
1651
1651
|
//#region lib/types/probe.js
|
|
1652
1652
|
/**
|
|
@@ -6518,37 +6518,18 @@ function reasonFor(features) {
|
|
|
6518
6518
|
if (features.taskClass === "strong") return "large-structured-turn";
|
|
6519
6519
|
return "standard-turn";
|
|
6520
6520
|
}
|
|
6521
|
-
function
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
contextTokens = estimateContextTokens(messages).tokens;
|
|
6529
|
-
} catch {}
|
|
6530
|
-
const estimated = Math.max(fresh, contextTokens);
|
|
6531
|
-
if (estimated > 0) return estimated;
|
|
6532
|
-
let charCount = 0;
|
|
6533
|
-
for (const message of messages) if (record$1(message) && Array.isArray(message.content)) {
|
|
6534
|
-
for (const block of message.content) if (record$1(block) && typeof block.text === "string") charCount += block.text.length;
|
|
6535
|
-
}
|
|
6536
|
-
return charCount > 0 ? Math.ceil(charCount / 4) : 0;
|
|
6521
|
+
function validTokenEstimate(value) {
|
|
6522
|
+
if (!Number.isSafeInteger(value) || value < 0) throw new AutoModelRoutingError("COPILOT_AUTO_TOKEN_ESTIMATE_INVALID");
|
|
6523
|
+
return value;
|
|
6524
|
+
}
|
|
6525
|
+
function estimateTurnInputTokens(messages, estimateMessage) {
|
|
6526
|
+
if (estimateMessage === void 0) throw new AutoModelRoutingError("COPILOT_AUTO_TOKEN_METER_UNAVAILABLE");
|
|
6527
|
+
return messages.reduce((sum, message) => validTokenEstimate(sum + validTokenEstimate(estimateMessage(message))), 0);
|
|
6537
6528
|
}
|
|
6538
|
-
function latestUserTurnTokens(messages) {
|
|
6529
|
+
function latestUserTurnTokens(messages, estimateMessage) {
|
|
6539
6530
|
for (let index = messages.length - 1; index >= 0; index--) {
|
|
6540
6531
|
const message = messages[index];
|
|
6541
|
-
if (userMessage(message))
|
|
6542
|
-
try {
|
|
6543
|
-
const est = estimateMessageTokens(message);
|
|
6544
|
-
if (est > 0) return est;
|
|
6545
|
-
} catch {}
|
|
6546
|
-
if (Array.isArray(message.content)) {
|
|
6547
|
-
let chars = 0;
|
|
6548
|
-
for (const block of message.content) if (record$1(block) && typeof block.text === "string") chars += block.text.length;
|
|
6549
|
-
if (chars > 0) return Math.ceil(chars / 4);
|
|
6550
|
-
}
|
|
6551
|
-
}
|
|
6532
|
+
if (userMessage(message)) return validTokenEstimate(estimateMessage(message));
|
|
6552
6533
|
}
|
|
6553
6534
|
return 0;
|
|
6554
6535
|
}
|
|
@@ -6650,7 +6631,9 @@ function selectAutoModel(models, messages, preference = "balance", context) {
|
|
|
6650
6631
|
const features = classifyAutoModelTurn(messages);
|
|
6651
6632
|
const eligible = models.filter((model) => autoModelPreference(model.id) === void 0 && model.input.includes("text") && (!features.requiresImage || model.input.includes("image"))).toSorted(compareCapacity);
|
|
6652
6633
|
if (eligible.length === 0) throw new AutoModelRoutingError("COPILOT_AUTO_NO_ELIGIBLE_MODEL");
|
|
6653
|
-
const
|
|
6634
|
+
const estimateMessage = context?.estimateMessage;
|
|
6635
|
+
if (estimateMessage === void 0) throw new AutoModelRoutingError("COPILOT_AUTO_TOKEN_METER_UNAVAILABLE");
|
|
6636
|
+
const estimatedInputTokens = Math.max(estimateTurnInputTokens(messages, estimateMessage), validTokenEstimate(context?.inputTokenFloor ?? 0));
|
|
6654
6637
|
const requestedMaxTokens = context?.requestedMaxTokens;
|
|
6655
6638
|
const policy = context?.requestBudgetPolicy ?? DEFAULT_REQUEST_BUDGET_POLICY;
|
|
6656
6639
|
const fitting = eligible.filter((model) => {
|
|
@@ -6677,7 +6660,7 @@ function selectAutoModel(models, messages, preference = "balance", context) {
|
|
|
6677
6660
|
}
|
|
6678
6661
|
selectedModel = maxModel;
|
|
6679
6662
|
selectedInputBudget = maxLimit;
|
|
6680
|
-
if (latestUserTurnTokens(messages) > maxLimit) inputFitDiagnostic = "fixed-content-cannot-fit";
|
|
6663
|
+
if (latestUserTurnTokens(messages, estimateMessage) > maxLimit) inputFitDiagnostic = "fixed-content-cannot-fit";
|
|
6681
6664
|
else if (context?.compactionAvailable === false) inputFitDiagnostic = "compaction-unavailable";
|
|
6682
6665
|
else if (context?.hasCompactionSummary === true) inputFitDiagnostic = "attempted-but-still-oversized";
|
|
6683
6666
|
else inputFitDiagnostic = "compaction-eligible";
|
|
@@ -6759,16 +6742,30 @@ function record(value) {
|
|
|
6759
6742
|
return typeof value === "object" && value !== null;
|
|
6760
6743
|
}
|
|
6761
6744
|
function buildRoutingContext(ctx, agent, turn, messages, budgetPolicyConfig) {
|
|
6745
|
+
const meter = ctx.get("tokenMeter");
|
|
6746
|
+
if (!record(meter) || typeof meter.estimateMessage !== "function" || typeof meter.measure !== "function") throw failure$1("COPILOT_AUTO_TOKEN_METER_UNAVAILABLE");
|
|
6747
|
+
const measured = meter.measure(agent.session);
|
|
6748
|
+
if (!record(measured) || typeof measured.totalTokens !== "number" || !Number.isSafeInteger(measured.totalTokens) || measured.totalTokens < 0) throw failure$1("COPILOT_AUTO_TOKEN_ESTIMATE_INVALID");
|
|
6749
|
+
const estimate = meter.estimateMessage.bind(meter);
|
|
6750
|
+
const estimateMessage = (message) => {
|
|
6751
|
+
const value = estimate(message);
|
|
6752
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) throw failure$1("COPILOT_AUTO_TOKEN_ESTIMATE_INVALID");
|
|
6753
|
+
return value;
|
|
6754
|
+
};
|
|
6762
6755
|
const sessionId = typeof agent.session?.id === "string" ? agent.session.id : void 0;
|
|
6763
6756
|
const compaction = ctx.get("compaction");
|
|
6764
6757
|
const compactionConfig = record(compaction) && record(compaction.config) ? compaction.config : void 0;
|
|
6765
6758
|
const compactionAvailable = compaction !== void 0 && compactionConfig?.auto !== false && (typeof compactionConfig?.maxOverflowRetries !== "number" || compactionConfig.maxOverflowRetries > 0);
|
|
6766
|
-
const hasCompactionSummary = messages.some((m) => record(m) && (record(m.source) && m.source.kind === "compaction" || typeof m.surfaceOp === "object"));
|
|
6759
|
+
const hasCompactionSummary = messages.some((m) => record(m) && (record(m.source) && (m.source.kind === "compaction" || m.source.kind === "compact-checkpoint") || typeof m.surfaceOp === "object"));
|
|
6760
|
+
const requestedMaxTokens = (typeof agent.session?.requestHeader === "function" ? agent.session.requestHeader() : void 0)?.config.maxTokens;
|
|
6761
|
+
const requestBudgetPolicy = budgetPolicyConfig ? resolveRequestBudgetPolicy(budgetPolicyConfig) : DEFAULT_REQUEST_BUDGET_POLICY;
|
|
6767
6762
|
return {
|
|
6763
|
+
estimateMessage,
|
|
6764
|
+
inputTokenFloor: measured.totalTokens,
|
|
6768
6765
|
sessionId,
|
|
6769
6766
|
turn,
|
|
6770
|
-
requestedMaxTokens
|
|
6771
|
-
requestBudgetPolicy
|
|
6767
|
+
requestedMaxTokens,
|
|
6768
|
+
requestBudgetPolicy,
|
|
6772
6769
|
compactionAvailable,
|
|
6773
6770
|
hasCompactionSummary
|
|
6774
6771
|
};
|
|
@@ -21,6 +21,8 @@ export interface AutoModelDecision {
|
|
|
21
21
|
readonly inputFitDiagnostic: AutoModelInputFitDiagnostic;
|
|
22
22
|
}
|
|
23
23
|
export interface AutoModelRoutingContext {
|
|
24
|
+
readonly estimateMessage?: (message: unknown) => number;
|
|
25
|
+
readonly inputTokenFloor?: number;
|
|
24
26
|
readonly sessionId?: string;
|
|
25
27
|
readonly turn?: number;
|
|
26
28
|
readonly requestedMaxTokens?: number;
|
|
@@ -30,11 +32,11 @@ export interface AutoModelRoutingContext {
|
|
|
30
32
|
readonly hasCompactionSummary?: boolean;
|
|
31
33
|
}
|
|
32
34
|
export declare class AutoModelRoutingError extends Error {
|
|
33
|
-
readonly code: 'COPILOT_AUTO_NO_ELIGIBLE_MODEL';
|
|
34
|
-
constructor(code: 'COPILOT_AUTO_NO_ELIGIBLE_MODEL');
|
|
35
|
+
readonly code: 'COPILOT_AUTO_NO_ELIGIBLE_MODEL' | 'COPILOT_AUTO_TOKEN_METER_UNAVAILABLE' | 'COPILOT_AUTO_TOKEN_ESTIMATE_INVALID';
|
|
36
|
+
constructor(code: 'COPILOT_AUTO_NO_ELIGIBLE_MODEL' | 'COPILOT_AUTO_TOKEN_METER_UNAVAILABLE' | 'COPILOT_AUTO_TOKEN_ESTIMATE_INVALID');
|
|
35
37
|
}
|
|
36
38
|
export declare function classifyAutoModelTurn(messages: readonly unknown[]): AutoModelFeatures;
|
|
37
|
-
export declare function estimateTurnInputTokens(messages: readonly unknown[]): number;
|
|
39
|
+
export declare function estimateTurnInputTokens(messages: readonly unknown[], estimateMessage?: (message: unknown) => number): number;
|
|
38
40
|
/**
|
|
39
41
|
* Filter by hard capabilities and input headroom before soft preference.
|
|
40
42
|
* Soft preferences distribute across capacity bands using in-memory deterministic seeds.
|
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.65",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"registry": "https://registry.npmjs.org/",
|