dsh-github-copilot 0.4.0-alpha.114 → 0.4.0-alpha.115

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -42,7 +42,7 @@ This repository owns eleven narrow surfaces:
42
42
  7. A bounded account-discovery route that supplies validated endpoint/capability metadata to the published native adapter, plus exact plugin-owned model exclusions enforced across its directory, Auto pools and direct admission, without maintaining model-ID routing rules or changing Core's catalog.
43
43
  8. Optional, provider-scoped Chat presentation for completed empty reasoning disclosures; durable content and encrypted replay metadata remain Core-owned.
44
44
  9. Compatibility-only policy restoration and request recovery for existing dedicated planner/executor Sessions. Model roles UI, settings writes and new dedicated roots are retired (#158); never reintroduce them or migrate histories implicitly.
45
- 10. Managed-route estimated input/output admission, optional exact-request pressure signalling through official compaction recovery, and supported low summary effort only when no effort is already resolved. See [compaction budgets](./docs/copilot-compaction.md). Preserve truthful capacities, requested output caps, native errors/replay and transaction ownership; no hidden history trimming, chunking, new retry loop, competing compaction service or automatic model switch. The separately selected, single-service [manual recovery engine](./docs/manual-compaction-recovery.md) may use bounded, explicit intermediate summaries through the public subclass hook; the preventive default never claims recovery of an already oversized manual summary.
45
+ 10. Managed-route estimated input/output admission, optional exact-request pressure signalling through official compaction recovery, and supported low summary effort only when no effort is already resolved. See [compaction budgets](./docs/copilot-compaction.md). Preserve truthful capacities, requested output caps, native errors/replay and transaction ownership; no hidden history trimming, wire chunking, competing compaction service or automatic model switch. The separately selected, single-service [recovery engine](./docs/manual-compaction-recovery.md) defaults to automatic segmented recovery for known oversized summaries or one typed native capacity failure through the public subclass hook. Preserve `automaticRecovery: false`, native `auto: false`, scopes and custom engines; at most 16 physical calls including a failed first attempt, no recursive retry or 408/network/auth/quota fallback. Installation alone never selects or migrates an engine.
46
46
  11. Optional account quota reads and a session-scoped composer usage control through public credentials, strict Remotes and additive slots. Keep account billing-cycle credits separate from context tokens and session cost. Missing, pooled, legacy and stale data must retain their real semantics; never infer credits from token estimates or account deltas. A separate plugin-owned historical context projection may diagnose failed-zero readings, never filter shared native usage, replace Core's meter, infer current occupancy/percentages or rewrite history. See [quota boundaries](./docs/copilot-usage.md).
47
47
 
48
48
  ## Approved multi-account ownership extension (#297)
@@ -293,7 +293,7 @@ cannot supply the native gateway binding or source method discovery. Test both
293
293
  actual Client and Host gateways; a synthetic RPC success cannot prove Host
294
294
  reachability. Preserve native Agent lookup and bounded store ownership (#254).
295
295
 
296
- Automatic pressure and Auto recovery availability resolve the initiating Agent's bound preset through public `agentPresets.composedPreset()` / `serviceFor(agent, 'compaction')`. A bound preset without an engine must not borrow global recovery. Only non-preset Agents use their own `agent.ctx.get('compaction')`; never scan Core's private registry or cache an engine across preset replacement. Native transactions, cancellation, retry policy and manual-only segmented recovery remain unchanged.
296
+ Automatic pressure and Auto recovery availability resolve the initiating Agent's bound preset through public `agentPresets.composedPreset()` / `serviceFor(agent, 'compaction')`. A bound preset without an engine must not borrow global recovery. Only non-preset Agents use their own `agent.ctx.get('compaction')`; never scan Core's private registry or cache an engine across preset replacement. Native transactions, cancellation and retry policy remain unchanged. The selected recovery subclass uses initiating-Agent account proof and public initiator scoping for automatic/manual summaries. Multi-call results stay unmarked; omit aggregate usage after a failed initial call. No automatic profile migration or full preset replacement.
297
297
 
298
298
  Continuing-step pressure prevention uses public `agent/pre-step` before `step/start`, only with a committed managed header, no selection notice, and known `modelSelection.pending: null`. Capacity lookup is not request estimation. Use the native surface meter and one currently bound native transaction; preserve final converted hard admission and stream-pressure fallback. First-step/pending/unknown evidence delegates. Native compaction failures propagate before attempt admission. Never claim all missing turn Usage is repaired, filter native samples, invent zero usage or rewrite historical totals. Native turn-tail accounting groups events by recorded turn, not compaction replacement sequence range.
299
299
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.0-alpha.115 (prepared)
4
+
5
+ - Default automatic segmented recovery on in the explicitly selected compaction recovery engine (#330). Keep fitting summaries native; handle known oversized input or one typed summary context-limit failure inside the same Core transaction.
6
+ - Bound each recovery invocation to 16 physical calls including the first rejected attempt; preserve cancellation, balanced tool pairs, source/shrink checks, native retry ownership and output caps. Never escalate timeout/408/auth/quota/network failures or commit partial summaries.
7
+ - Preserve native `auto: false` and add `automaticRecovery: false` for automatic-segmentation opt-out. Bind summary capacity proof and dispatch to the initiating Agent's account; omit incomplete aggregate accounting after an initial failure.
8
+ - Document explicit same-scope engine migration and rollback without overriding custom engines, presets or live profiles. No Core changes, automatic installation or restart.
9
+
3
10
  ## 0.4.0-alpha.114 (prepared)
4
11
 
5
12
  - Simplify the Chat account menu to configured accounts only. Move Follow global default into a separate checkbox and keep account addition in Models (#328).
package/README.md CHANGED
@@ -23,7 +23,7 @@ Visible Models and Credits resolve missing names for saved accounts without acti
23
23
 
24
24
  Adding an account now keeps the device-authorization link, selectable URL, one-time code, Copy code action and Cancel together while authorization is pending. After GitHub authorizes, identity and model verification are shown as a separate phase. Adding never changes the global default; use the existing explicit **Switch** action when ready. Technical diagnostics are secondary, and account/turn identity fallbacks never expose opaque account IDs or infer historical identity from today's settings.
25
25
 
26
- **Source candidate: `0.4.0-alpha.114` (unreleased). Supported host: official DSH / Windows Desktop `0.2.0-rc.2`.** Earlier DSH pins are historical evidence, not supported installation targets. Publication, profile installation and the version loaded by a running Host are separate states. The versioned commands below are for this candidate after publication, not evidence that its assets exist.
26
+ **Source candidate: `0.4.0-alpha.115` (unreleased). Supported host: official DSH / Windows Desktop `0.2.0-rc.2`.** Earlier DSH pins are historical evidence, not supported installation targets. Publication, profile installation and the version loaded by a running Host are separate states. The versioned commands below are for this candidate after publication, not evidence that its assets exist.
27
27
 
28
28
  ## What you can do
29
29
 
@@ -63,10 +63,10 @@ Supply any launcher patches with repeated `--patch /absolute/file`. Require `sup
63
63
  For a **standalone named profile**:
64
64
 
65
65
  ```sh
66
- dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.114/dsh-github-copilot-0.4.0-alpha.114.tgz
66
+ dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.115/dsh-github-copilot-0.4.0-alpha.115.tgz
67
67
  ```
68
68
 
69
- For **Desktop**, its native package manager accepts `dsh-github-copilot@0.4.0-alpha.114` after publication. Official rc.2's **Desktop-bundled CLI** also supports reserved-profile plugin management; a global/generic `dsh` shim is not equivalent. Qualify the installed entry before use. See [Desktop CLI qualification](./docs/npm-distribution.md#desktop-bundled-cli-on-official-rc2) and the distinct [standalone offline procedure](./docs/npm-distribution.md#controlled-offline-cli-maintenance-for-standalone-profiles). Neither path authorizes registry-policy bypass, peer patches or configuration deletion.
69
+ For **Desktop**, its native package manager accepts `dsh-github-copilot@0.4.0-alpha.115` after publication. Official rc.2's **Desktop-bundled CLI** also supports reserved-profile plugin management; a global/generic `dsh` shim is not equivalent. Qualify the installed entry before use. See [Desktop CLI qualification](./docs/npm-distribution.md#desktop-bundled-cli-on-official-rc2) and the distinct [standalone offline procedure](./docs/npm-distribution.md#controlled-offline-cli-maintenance-for-standalone-profiles). Neither path authorizes registry-policy bypass, peer patches or configuration deletion.
70
70
 
71
71
  After an approved reload/restart:
72
72
 
@@ -133,7 +133,7 @@ Native context occupancy and Turn Usage remain Core-owned. The plugin forwards u
133
133
 
134
134
  Owned timeout/replay errors preserve native usage before terminal failure restoration, including nonzero samples. A failed zero can still make the native ring show `0%`; this is not proof of an empty request. Retry-entry times describe backoff, not the failed request's duration. These accounting fixes do not cure supplier HTTP 408 or change retry policy.
135
135
 
136
- Managed request admission preserves truthful input/output limits and native transactions. Automatic pressure uses the initiating Agent's actual bound compaction service; a preset without an engine cannot borrow global recovery. Already oversized manual summaries require separately selected [manual recovery](./docs/manual-compaction-recovery.md), not a promise that preventive admission can rescue them.
136
+ Managed request admission preserves truthful input/output limits and native transactions. Automatic pressure uses the initiating Agent's actual bound compaction service; a preset without an engine cannot borrow global recovery. The separately selected [recovery engine](./docs/manual-compaction-recovery.md) defaults to automatic segmented fallback for oversized summaries or an explicit summary context-limit failure. Fitting summaries stay native; timeout/408/auth/quota failures do not trigger segmentation. Up to 16 calls may add time and charges; cancellation or incomplete recovery never commits a partial summary. `automaticRecovery: false` disables this fallback; native `auto: false` still disables automatic compaction. Installation alone does not select the engine: follow the explicit same-scope configuration migration, preserving preset/custom-engine ownership and existing policies.
137
137
 
138
138
  For continuing steps with a committed managed route and no pending model change, known input pressure is reduced before Core opens the next model attempt. Successful native reduction avoids an unsampled local-pressure attempt that would make whole-turn Usage unavailable. First steps, pending selections, new fixed-prefix growth and final hard-budget refusals retain existing admission; this does not repair historical totals or invent missing usage.
139
139
 
@@ -220,14 +220,14 @@ Commit attribution uses `Assisted-by` with the actual tool, never the model prov
220
220
  GitHub Releases and npm distribute the same original verified tarball. Pin a version; verify Release SHA-256 or npm `dist.integrity`. Never repack an immutable release or move/reuse its tag.
221
221
 
222
222
  ```sh
223
- curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.114/dsh-github-copilot-0.4.0-alpha.114.tgz
224
- curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.114/SHA256SUMS
223
+ curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.115/dsh-github-copilot-0.4.0-alpha.115.tgz
224
+ curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.115/SHA256SUMS
225
225
  sha256sum --check SHA256SUMS
226
226
  ```
227
227
 
228
228
  ```powershell
229
229
  $expected = (Get-Content .\SHA256SUMS).Split()[0]
230
- $actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.114.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
230
+ $actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.115.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
231
231
  if ($actual -cne $expected) { throw 'Release checksum mismatch' }
232
232
  ```
233
233
 
package/README.zh.md CHANGED
@@ -21,7 +21,7 @@ Models 和 Chat 共用不透明、随主题适配的账号下拉层;原生菜
21
21
 
22
22
  添加账号时,设备授权链接、可选择的网址、一次性授权码、复制授权码和取消操作会同时显示。GitHub 授权完成后,会单独显示身份与可用模型验证阶段。添加账号不会更改全局默认;准备好后仍需显式执行现有的**切换**操作。技术诊断收在次级折叠区;账号/历史 turn 缺少身份时不会暴露不透明账号 ID,也不会根据当前设置推断历史身份。
23
23
 
24
- **源码候选版本:`0.4.0-alpha.114`(尚未发布)。支持宿主:官方 DSH / Windows Desktop `0.2.0-rc.2`。** 较早 DSH pin 仅是历史证据,不是当前安装目标。已发布、已安装到 profile、已被运行中的 Host 加载,是三个不同状态。下方带版本的命令适用于候选版本发布后,不代表对应资产已经存在。
24
+ **源码候选版本:`0.4.0-alpha.115`(尚未发布)。支持宿主:官方 DSH / Windows Desktop `0.2.0-rc.2`。** 较早 DSH pin 仅是历史证据,不是当前安装目标。已发布、已安装到 profile、已被运行中的 Host 加载,是三个不同状态。下方带版本的命令适用于候选版本发布后,不代表对应资产已经存在。
25
25
 
26
26
  ## 你可以做什么
27
27
 
@@ -61,10 +61,10 @@ node package/scripts/check-search-composition.mjs --profile-dir /absolute/profil
61
61
  **独立具名 profile**:
62
62
 
63
63
  ```sh
64
- dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.114/dsh-github-copilot-0.4.0-alpha.114.tgz
64
+ dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.115/dsh-github-copilot-0.4.0-alpha.115.tgz
65
65
  ```
66
66
 
67
- **Desktop** 原生包管理器在发布后接受 `dsh-github-copilot@0.4.0-alpha.114`。官方 rc.2 **Desktop 随附的专属 CLI**也支持管理保留 profile;全局/普通 `dsh` shim 不等价。使用前核验实际安装入口,参见[Desktop CLI 核验](./docs/npm-distribution.md#desktop-bundled-cli-on-official-rc2)及独立的[具名 profile 离线流程](./docs/npm-distribution.md#controlled-offline-cli-maintenance-for-standalone-profiles)。两种路径都不授权绕过包源政策、修改 peer 或删除配置。
67
+ **Desktop** 原生包管理器在发布后接受 `dsh-github-copilot@0.4.0-alpha.115`。官方 rc.2 **Desktop 随附的专属 CLI**也支持管理保留 profile;全局/普通 `dsh` shim 不等价。使用前核验实际安装入口,参见[Desktop CLI 核验](./docs/npm-distribution.md#desktop-bundled-cli-on-official-rc2)及独立的[具名 profile 离线流程](./docs/npm-distribution.md#controlled-offline-cli-maintenance-for-standalone-profiles)。两种路径都不授权绕过包源政策、修改 peer 或删除配置。
68
68
 
69
69
  经批准 reload/restart 后:
70
70
 
@@ -131,7 +131,7 @@ Copilot 搜索要求当前账号/协议证据及能力 proof。固定/fallba
131
131
 
132
132
  插件恢复 timeout/replay 结构化错误前会保留原生 usage,包括非零采样。失败的零采样仍可能让原生圆环显示 `0%`,不代表请求上下文为空。重试条目的耗时表示退避等待,不是失败请求耗时;用量修复不等于解决供应方 HTTP 408,也不改变重试策略。
133
133
 
134
- 托管请求准入保留真实输入/输出上限和原生事务。自动压力使用发起 Agent 真正绑定的压缩服务;preset 无引擎时不能借用全局恢复。已超限的手动摘要需另行选择[手动恢复](./docs/manual-compaction-recovery.md),不能承诺预防性准入已解决。
134
+ 托管请求准入保留真实输入/输出上限和原生事务。自动压力使用发起 Agent 真正绑定的压缩服务;preset 无引擎时不能借用全局恢复。另行选用的[恢复引擎](./docs/manual-compaction-recovery.md)默认对已超限摘要或明确的摘要上下文超限错误启用自动分段兜底。能一次完成的摘要仍走原生流程;超时/408/认证/额度错误不会触发分段。最多 16 次调用可能增加耗时和费用,取消或恢复未完成不会提交半成品摘要。`automaticRecovery: false` 仅关闭自动分段,原生 `auto: false` 仍关闭自动压缩。仅安装插件不会选用该引擎:需按文档显式替换同一作用域的引擎配置,保留 preset/自定义引擎所有权及原有策略。
135
135
 
136
136
  同一轮后续步骤已有托管路由、且没有待切换模型时,已知输入压力会在 Core 开始下次模型尝试之前压缩。原生压缩成功可避免一次无 usage 样本的本地压力拒绝导致整轮 Usage 不可用。首次步骤、待切换模型、新增固定前缀膨胀与最终硬预算拒绝仍保留原有准入;不会修复历史总量或虚构缺失用量。
137
137
 
@@ -218,14 +218,14 @@ Agent 从 `node scripts/agent.mjs describe --json`、`doctor --json`及`plan <ta
218
218
  GitHub Releases 和 npm 分发同一原始已校验 tarball。固定版本并核验 Release SHA-256 或 npm `dist.integrity`;不重打包不可变 Release、不移动/复用 tag。
219
219
 
220
220
  ```sh
221
- curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.114/dsh-github-copilot-0.4.0-alpha.114.tgz
222
- curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.114/SHA256SUMS
221
+ curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.115/dsh-github-copilot-0.4.0-alpha.115.tgz
222
+ curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.115/SHA256SUMS
223
223
  sha256sum --check SHA256SUMS
224
224
  ```
225
225
 
226
226
  ```powershell
227
227
  $expected = (Get-Content .\SHA256SUMS).Split()[0]
228
- $actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.114.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
228
+ $actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.115.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
229
229
  if ($actual -cne $expected) { throw 'Release checksum mismatch' }
230
230
  ```
231
231
 
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "package": {
10
10
  "name": "dsh-github-copilot",
11
- "version": "0.4.0-alpha.114"
11
+ "version": "0.4.0-alpha.115"
12
12
  },
13
13
  "evidence": {
14
14
  "kind": "source-and-synthetic-test-inventory",
@@ -566,6 +566,8 @@
566
566
  "evidenceScope": "synthetic-public-subclass-and-exact-tagged-source-no-live-inference",
567
567
  "sourceMarkers": [
568
568
  {"file": "src/manual-compaction-recovery.ts", "marker": "extends BasicCompactionEngine"},
569
+ {"file": "src/manual-compaction-recovery.ts", "marker": "automaticRecovery: z.boolean().default(true)"},
570
+ {"file": "src/manual-compaction-recovery.ts", "marker": "maxCalls: failedAttempt ? 15 : 16"},
569
571
  {"file": "src/manual-compaction-recovery.ts", "marker": "COPILOT_MANUAL_RECOVERY_"},
570
572
  {"file": "src/background-compaction.ts", "marker": "copilot-compact"},
571
573
  {"file": "src/background-compaction.ts", "marker": "this.jobs.wait(jobId"},
@@ -578,7 +580,10 @@
578
580
  {"file": "tests/manual-compaction-recovery.spec.ts", "name": "rejects unmatched tool calls before dispatch instead of splitting a call and result"},
579
581
  {"file": "tests/background-compaction.spec.ts", "name": "acknowledges before completion and outlives a five-minute caller deadline"},
580
582
  {"file": "tests/fixtures/compaction-pressure-core.fixture.ts", "name": "commits beyond the carrier deadline without a model wakeup and keeps status owner-scoped"},
581
- {"file": "tests/fixtures/compaction-pressure-core.fixture.ts", "name": "recovers oversized manual history with one native transaction and honest multi-call audit"}
583
+ {"file": "tests/fixtures/compaction-pressure-core.fixture.ts", "name": "recovers oversized manual history with one native transaction and honest multi-call audit"},
584
+ {"file": "tests/fixtures/compaction-pressure-core.fixture.ts", "name": "defaults automatic oversized recovery on without a manual command, enabled=%s"},
585
+ {"file": "tests/fixtures/compaction-pressure-core.fixture.ts", "name": "escalates only a typed summary capacity failure once: %s"},
586
+ {"file": "tests/preview-route.spec.ts", "name": "binds explicit summary capacity proof to its Agent rather than the current default"}
582
587
  ]
583
588
  },
584
589
  {
@@ -56,7 +56,7 @@ Disabled auto recovery or zero retries are respected. Missing/mismatching option
56
56
 
57
57
  On official `0.2.0-rc.2`, Desktop presets may isolate `compaction` inside a child group, invisible to both the global plugin context and a plain `agent.ctx.get('compaction')`. The plugin uses the public `agentPresets.composedPreset()` and `serviceFor(agent, 'compaction')` methods to resolve the initiating Agent's current preset engine. A bound preset with no engine remains unavailable; it never borrows another scope's policy. Only an Agent without a bound preset uses its own context lookup. The lookup is repeated rather than caching a replaced engine. Auto's recovery-availability diagnostic uses the same helper.
58
58
 
59
- This fixes scope wiring, not a new automatic command: native pressure and `agent/request-error` still invoke the selected engine. Neither `/compact` nor `/copilot-compact` is called by this listener. If the optional manual recovery engine is selected, its automatic path remains the native single-summary path; segmented recovery stays manual-only. Ordinary timeout/transport failures do not become context overflow.
59
+ This fixes scope wiring, not a new automatic command: native pressure and `agent/request-error` still invoke the selected engine. Neither `/compact` nor `/copilot-compact` is called by this listener. If the recovery engine is selected, automatic segmentation defaults on for known oversized summary input or one exact native summary capacity failure, within the same native transaction. `automaticRecovery: false` restores its automatic single-summary path; native `auto: false` and retry bounds remain authoritative. Ordinary timeout/transport failures do not become context overflow.
60
60
 
61
61
  ## Summary purpose policy
62
62
 
@@ -102,7 +102,7 @@ On official `0.2.0-rc.2`, the stock summarizer uses an explicitly configured sum
102
102
 
103
103
  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.
104
104
 
105
- An explicit, separately selected recovery engine for compressible already-oversized **manual** summaries is specified in [manual compaction recovery](./manual-compaction-recovery.md). The default Basic engine and the preventive request guard remain unchanged. No hidden wire interceptor or automatic summary retry is used; the native summary event is unmarked when several real calls contributed to one checkpoint.
105
+ A separately selected recovery engine for compressible already-oversized manual and automatic summaries is specified in [compaction recovery](./manual-compaction-recovery.md). The stock Basic engine and preventive request guard remain unchanged. Selection requires explicit same-scope configuration migration, not installation alone. The selected engine bounds segmentation to 16 physical calls including an initial capacity failure; no hidden wire interceptor, arbitrary-error fallback or recursive retry is used. The native summary event is unmarked when several real calls contributed to one checkpoint.
106
106
 
107
107
  ## Official-first evidence and retirement
108
108
 
@@ -1,6 +1,6 @@
1
- # Oversized manual compaction recovery
1
+ # Oversized compaction recovery
2
2
 
3
- Tracking: [#228](https://github.com/cloga/dsh-github-copilot/issues/228). Target: unchanged official DSH `0.2.0-rc.2` (`639ed015397290b3745d163aafe02ffee4aa3f84`). This document specifies a **separately selected** Host compaction engine; installing this plugin by itself does not replace a running Core engine.
3
+ Tracking: [#228](https://github.com/cloga/dsh-github-copilot/issues/228), [#330](https://github.com/cloga/dsh-github-copilot/issues/330). Target: unchanged official DSH `0.2.0-rc.2` (`639ed015397290b3745d163aafe02ffee4aa3f84`). This document specifies a **separately selected** Host compaction engine; installing this plugin by itself does not replace a running Core engine. Once selected, automatic segmented recovery defaults on. The historical package export and class name remain compatible.
4
4
 
5
5
  ## Requirements and failure boundary
6
6
 
@@ -10,11 +10,15 @@ Recovery must leave the original Session surface intact until a smaller *complet
10
10
 
11
11
  ## Composition and algorithm
12
12
 
13
- `CopilotManualRecoveryCompactionEngine` is an opt-in alternative to **one** official `BasicCompactionEngine` registration. Operators selecting it must replace (not mount alongside) their existing basic compaction service in the same Host scope; the default plugin registration never changes the service. It subclasses the published engine and calls `super.compactNow`: Core still owns idle maintenance, a single bracketed durable transaction, balanced range selection, checkpoint framing, source-stability/shrink checks, cancellation, failure classification, flush, and optional native pruning. The subclass hook runs recovery **only** inside an explicit manual call with an authenticated, current managed Copilot summary model. Automatic compaction and all other providers delegate to the stock hook unchanged. A pending model picker is not summary-route evidence: an explicit native summary target wins, then the latest committed header, then Agent options.
13
+ `CopilotManualRecoveryCompactionEngine` is an opt-in alternative to **one** official `BasicCompactionEngine` registration. Operators selecting it must replace (not mount alongside) their existing basic compaction service in the same Host scope; the default plugin registration never changes the service. It subclasses the published engine: Core still owns automatic triggering/retries, manual idle maintenance, a single bracketed durable transaction, balanced range selection, checkpoint framing, source-stability/shrink checks, cancellation, failure classification, flush, and optional native pruning. With an authenticated, current managed Copilot summary model, the same hook handles manual and automatic summaries. All other providers delegate unchanged. A pending model picker is not summary-route evidence: an explicit native summary target wins, then the latest committed header, then Agent options.
14
14
 
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.
15
+ `automaticRecovery` defaults to `true` in this engine's config. Set it to `false` to retain stock automatic single-summary behavior while keeping manual segmented recovery. Native `auto: false`, `maxOverflowRetries`, thresholds and model policies retain their meaning; no background command or second transaction is launched by automatic recovery. A fitting summary first uses the unchanged native single call. A known oversized input directly enters segmented recovery. Only an actual native `LlmError` with `CONTEXT_WINDOW_EXCEEDED` from that first single summary permits one fallback, with a conservative bound at most half its original serialized input size. The rejected request is never resubmitted unchanged, and a segment failure is never recursively retried. HTTP 408, timeout, auth, quota, network, cancellation, empty or truncated output do not authorize fallback.
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. Only an explicit manual command starts this process.
17
+ The plugin's account service supplies a current descriptor and a revocable proof for the explicit initiating Agent, not another Session or today's global account. Each physical summary uses public initiator scoping; no credential discovery or Client credential reads are added. Account/selection changes revoke the proof. The summary budget uses `min(maxInputTokens, contextWindow - configuredOutputCap) - safetyTokens`; an additional 4096-token allowance covers Core's appended directive and estimation variance, and actual tool-history bytes are reserved separately. 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 segment that still exceeds that guard fails; it is never retried with a hidden wire rewrite.
18
+
19
+ 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. The engine allows at most 16 physical summary calls per hook invocation, including any initial capacity failure (the exported helper's hard maximum remains 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 partial summary replacement. Native pruning that already committed remains Core-owned. Native automatic retry/rebuild resumes the task only after a valid durable reduction.
20
+
21
+ Segmented recovery can take longer and incur additional provider charges. A sanitized Host log announces entry and its call bound; the Client keeps native compaction progress and cancellation, not a fabricated per-segment progress bar. The native transaction result remains the success evidence.
18
22
 
19
23
  ## Background command for Desktop
20
24
 
@@ -34,7 +38,7 @@ Status and cancellation apply only to the invoking Agent's latest job. Duplicate
34
38
 
35
39
  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.
36
40
 
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.
41
+ **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. After a failed initial single call, aggregate usage is omitted because this hook cannot recover that call's complete accounting. 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.
38
42
 
39
43
  This aggregate is not per-call attribution: it cannot reconstruct which intermediate request used which tokens, identify each physical response, or prove that native call-attribution consumers count every intermediate request. The plugin does not manufacture `llmStreamCall`, response IDs, or individual durable usage records to fill that gap. Reported aggregate provider usage and Core's native call-attribution/accounting are separate evidence layers.
40
44
 
@@ -59,6 +63,16 @@ Select the exported `dsh-github-copilot/manual-compaction-recovery` Host class *
59
63
 
60
64
  Keep the existing BasicCompactionConfig, including any modelPolicies and actual maxTokens; configure a summary route deliberately if the last committed model cannot serve the summary. Do not enable two compaction services or modify a live profile without explicit approval. The normal plugin and all ordinary sessions remain usable without this replacement; the package export alone neither installs it nor changes an existing Session.
61
65
 
66
+ ### Explicit configuration migration
67
+
68
+ 1. With separately approved profile maintenance, inspect the effective Host composition and the initiating Agent's bound preset. Identify exactly one stock basic engine in the intended scope; an absent or custom engine is not a migration target.
69
+ 2. In the owning configuration, replace only that row's `name` with `dsh-github-copilot/manual-compaction-recovery`. Preserve its id, group, isolation, disabled state and full config, including `auto: false`, retention, caps, retry limits and exact model policies. Keep the native compact command and tool-result pruner. Do not add a second row.
70
+ 3. For a native preset, edit its owned `config.plugins` entry in the native preset editor, preserving the surrounding plugins. Do not replace the whole preset with a stock template. A global engine replacement does not change engines isolated in presets.
71
+ 4. Review the resulting diff and reload only through approved normal Host/preset maintenance. Existing Agents may retain the older preset generation; verify their actual bound service rather than assuming a setting change moved them. Set `automaticRecovery: false` on the replacement to disable only automatic segmentation.
72
+ 5. To roll back, restore that row's stock name and remove only the plugin-owned `automaticRecovery` key. Keep the original native config. Already committed native summaries are not reversed.
73
+
74
+ Do not try to change an existing plugin name with the bundle include patch's `name` field: on rc.2 it is a matching guard, not a replacement. Include patches also do not traverse arbitrary preset `config.plugins`. This release intentionally supplies no automatic live migration, full-preset overwrite, service interception or Core patch. Native isolated-preset fixtures verify the selected replacement, unchanged native config and the disabled/absent/no-retry cases; they are not live deployment receipts.
75
+
62
76
  ## Acceptance and retirement
63
77
 
64
78
  Focused tests must exercise oversized balanced histories, native durable replacement and no replacement on cancellation, truncation, stale source or proof, irreducible units and bounded-call exhaustion. Verify the exact published Core source fixture, frozen install, full plugin gate and immutable package smoke before describing a deployable release. CI with synthetic transport proves no live Copilot availability. Retire this companion path only when official compaction safely handles independent prompt ceilings and multi-call/manual recovery with equivalent durable audit, lifecycle and transaction guarantees.
package/lib/index.js CHANGED
@@ -2998,7 +2998,7 @@ function createAccountProvider(descriptors, guard, baseURL) {
2998
2998
  var package_default = {
2999
2999
  name: "dsh-github-copilot",
3000
3000
  description: "DSH companion for GitHub Copilot sign-in, account-aware model profiles, tool compatibility, and provider-hosted search.",
3001
- version: "0.4.0-alpha.114",
3001
+ version: "0.4.0-alpha.115",
3002
3002
  publishConfig: {
3003
3003
  "access": "public",
3004
3004
  "registry": "https://registry.npmjs.org/",
@@ -12338,7 +12338,20 @@ function apply$1(ctx, config = {}) {
12338
12338
  getView: () => disposed ? initial.preview.getView() : currentRuntime().preview.getView(),
12339
12339
  refresh: async () => currentRuntime().preview.refresh(),
12340
12340
  discover: (options) => currentRuntime(options?.signal).preview.discover(options),
12341
- recoveryLimits: (model) => currentRuntime().preview.recoveryLimits(model),
12341
+ recoveryLimits: (model, agent) => {
12342
+ const accounts = ctx.get("githubCopilotSessionAccounts");
12343
+ const binding = agent !== void 0 && accounts !== void 0 ? accounts.bindingForAccount((accounts.turns.current(agent.session) ?? accounts.selected(agent)).accountId) : requestBinding();
12344
+ const lease = runtimeFor(binding).preview.recoveryLimits(model);
12345
+ if (lease === void 0) return void 0;
12346
+ return {
12347
+ ...lease,
12348
+ assertCurrent: () => {
12349
+ binding?.assertCurrent();
12350
+ if (agent !== void 0 && accounts !== void 0 && (accounts.turns.current(agent.session) ?? accounts.selected(agent)).accountId !== binding?.accountId) throw new Error("COPILOT_MANUAL_RECOVERY_ACCOUNT_PROOF_CHANGED");
12351
+ lease.assertCurrent();
12352
+ }
12353
+ };
12354
+ },
12342
12355
  routeFacts: (model) => currentRuntime().preview.routeFacts(model),
12343
12356
  captureSearchProof: () => currentRuntime().preview.captureSearchProof(),
12344
12357
  resolveRequestAuth: (model, signal) => currentRuntime(signal).preview.resolveRequestAuth(model, signal)
@@ -1,6 +1,7 @@
1
1
  import "./copilot-identity-DRZY_d2X.js";
2
2
  import { i as resolveRequestBudgetPolicy, r as calculateRequestBudget } from "./request-budget-DLY_aRq0.js";
3
- import { createUserMessage } from "@deepseek-ai/dsh-llm";
3
+ import z from "@deepseek-ai/schemastery";
4
+ import { LlmError, createUserMessage } from "@deepseek-ai/dsh-llm";
4
5
  import BasicCompactionEngine from "@deepseek-ai/dsh-compaction-basic";
5
6
  import { CommandDefinitionId } from "@deepseek-ai/dsh-commands/brand";
6
7
  //#region lib/types/background-compaction.js
@@ -169,7 +170,7 @@ function sumUsage(usages) {
169
170
  };
170
171
  }
171
172
  /**
172
- * Bounded, explicit manual-only map/fold. The native engine still owns the only
173
+ * Bounded map/fold. The native engine still owns the only
173
174
  * durable transaction, source-stability check, shrink check and cancellation.
174
175
  */
175
176
  async function summarizeOversizedManualInput(options) {
@@ -244,9 +245,14 @@ async function summarizeOversizedManualInput(options) {
244
245
  * mount both: Cordis compaction is a singleton, not an overridable service.
245
246
  */
246
247
  var CopilotManualRecoveryCompactionEngine = class extends BasicCompactionEngine {
248
+ static Config = z.intersect([BasicCompactionEngine.Config, z.object({ automaticRecovery: z.boolean().default(true) })]);
247
249
  manual = /* @__PURE__ */ new WeakMap();
250
+ automaticRecovery;
248
251
  constructor(ctx, config = {}) {
249
- super(ctx, config);
252
+ const { automaticRecovery = true, ...nativeConfig } = config;
253
+ if (typeof automaticRecovery !== "boolean") throw recoverError("INVALID_POLICY");
254
+ super(ctx, nativeConfig);
255
+ this.automaticRecovery = automaticRecovery;
250
256
  ctx.inject(["commands", "jobs"], (scope) => {
251
257
  installBackgroundCompaction(scope, (agent, signal) => this.compactNow(agent, signal));
252
258
  });
@@ -263,7 +269,8 @@ var CopilotManualRecoveryCompactionEngine = class extends BasicCompactionEngine
263
269
  }
264
270
  async summarize(input, agent, signal) {
265
271
  const routed = agent.session.requestHeader()?.config;
266
- const policy = this.config.modelPolicies.find((item) => item.provider === routed?.provider && item.model === routed.model);
272
+ const target = routed?.provider && routed.model ? routed : agent.options;
273
+ const policy = this.config.modelPolicies.find((item) => item.provider === target.provider && item.model === target.model);
267
274
  const configuredProvider = policy?.summarizationProvider ?? this.config.summarizationProvider;
268
275
  const configuredModel = policy?.summarizationModel ?? this.config.summarizationModel;
269
276
  const selected = configuredProvider.length > 0 ? {
@@ -275,23 +282,40 @@ var CopilotManualRecoveryCompactionEngine = class extends BasicCompactionEngine
275
282
  };
276
283
  const summaryProvider = selected.provider;
277
284
  const summaryModel = selected.model;
278
- if (!this.manual.has(agent) || summaryProvider !== "github-copilot-preview" || !summaryModel) return super.summarize(input, agent, signal);
279
- const lease = this.ctx.get("githubCopilotPreview")?.recoveryLimits(summaryModel);
285
+ if (!this.manual.has(agent) && !this.automaticRecovery || summaryProvider !== "github-copilot-preview" || !summaryModel) return super.summarize(input, agent, signal);
286
+ const lease = this.ctx.get("githubCopilotPreview")?.recoveryLimits(summaryModel, agent);
280
287
  if (lease === void 0) throw recoverError("ACCOUNT_PROOF_UNAVAILABLE");
288
+ const agents = this.ctx.get("agents");
289
+ if (this.ctx.get("githubCopilotSessionAccounts") !== void 0 && agents === void 0) throw recoverError("INITIATOR_UNAVAILABLE");
290
+ const summarize = (candidate) => agents === void 0 ? super.summarize(candidate, agent, signal) : agents.withInitiator(agent, () => super.summarize(candidate, agent, signal));
281
291
  const maxTokens = policy?.maxTokens ?? this.config.maxTokens;
282
292
  const budget = calculateRequestBudget(lease.limits, maxTokens, resolveRequestBudgetPolicy(lease.policy));
283
293
  if (!budget.ok) throw recoverError(budget.code);
284
294
  const toolHistoryBytes = Buffer.byteLength(JSON.stringify(agent.session.toolHistory()), "utf8");
285
- const inputLimit = budget.budget.hardInputLimit - 4096 - toolHistoryBytes;
295
+ let inputLimit = budget.budget.hardInputLimit - 4096 - toolHistoryBytes;
286
296
  if (inputLimit <= 0) throw recoverError("FIXED_PREFIX");
287
297
  const operationSignal = signal ?? new AbortController().signal;
288
298
  const estimate = (candidate) => Buffer.byteLength(JSON.stringify(candidate), "utf8");
289
- if (estimate(input) <= inputLimit) return super.summarize(input, agent, signal);
290
- return summarizeOversizedManualInput({
299
+ operationSignal.throwIfAborted();
300
+ lease.assertCurrent();
301
+ const originalSize = estimate(input);
302
+ let failedAttempt = false;
303
+ if (originalSize <= inputLimit) try {
304
+ return await summarize(input);
305
+ } catch (error) {
306
+ operationSignal.throwIfAborted();
307
+ if (!(error instanceof LlmError) || error.code !== "CONTEXT_WINDOW_EXCEEDED") throw error;
308
+ lease.assertCurrent();
309
+ inputLimit = Math.min(inputLimit, Math.floor(originalSize / 2));
310
+ failedAttempt = true;
311
+ }
312
+ this.ctx.logger.info("[github-copilot] Segmented compaction recovery started; up to %d additional model calls.", failedAttempt ? 15 : 16);
313
+ const result = await summarizeOversizedManualInput({
291
314
  input,
292
315
  inputLimit,
293
316
  signal: operationSignal,
294
317
  estimate,
318
+ maxCalls: failedAttempt ? 15 : 16,
295
319
  assertCurrent: lease.assertCurrent,
296
320
  makeCheckpoint: (summary) => createUserMessage({
297
321
  source: { kind: "user" },
@@ -307,8 +331,13 @@ var CopilotManualRecoveryCompactionEngine = class extends BasicCompactionEngine
307
331
  }
308
332
  ]
309
333
  }),
310
- summarize: (candidate) => super.summarize(candidate, agent, signal)
334
+ summarize
311
335
  });
336
+ if (failedAttempt) {
337
+ const { usage: _usage, ...unaccounted } = result;
338
+ return unaccounted;
339
+ }
340
+ return result;
312
341
  }
313
342
  };
314
343
  //#endregion
@@ -1,6 +1,8 @@
1
1
  import type { Agent } from '@deepseek-ai/dsh-agent';
2
2
  import type { Context } from '@deepseek-ai/cordis';
3
3
  import BasicCompactionEngine from '@deepseek-ai/dsh-compaction-basic';
4
+ import type { BasicCompactionConfig } from '@deepseek-ai/dsh-compaction-basic';
5
+ import z from '@deepseek-ai/schemastery';
4
6
  import type { ContentBlock, Message, TokenUsage, ToolSchema } from '@deepseek-ai/dsh-llm';
5
7
  import type { CommandId } from '@deepseek-ai/dsh-commands/brand';
6
8
  import type { CompactionResult } from '@deepseek-ai/dsh-compaction';
@@ -34,7 +36,7 @@ interface RecoveryOptions<M extends RecoveryMessage, R extends RecoveryResult> {
34
36
  readonly assertCurrent?: () => void;
35
37
  }
36
38
  /**
37
- * Bounded, explicit manual-only map/fold. The native engine still owns the only
39
+ * Bounded map/fold. The native engine still owns the only
38
40
  * durable transaction, source-stability check, shrink check and cancellation.
39
41
  */
40
42
  export declare function summarizeOversizedManualInput<M extends RecoveryMessage, R extends RecoveryResult>(options: RecoveryOptions<M, R>): Promise<RecoveryResult>;
@@ -43,10 +45,21 @@ export declare function summarizeOversizedManualInput<M extends RecoveryMessage,
43
45
  * mount both: Cordis compaction is a singleton, not an overridable service.
44
46
  */
45
47
  export declare class CopilotManualRecoveryCompactionEngine extends BasicCompactionEngine {
48
+ static Config: z<BasicCompactionConfig & {
49
+ automaticRecovery?: boolean;
50
+ }>;
46
51
  private readonly manual;
47
- constructor(ctx: Context, config?: ConstructorParameters<typeof BasicCompactionEngine>[1]);
52
+ private readonly automaticRecovery;
53
+ constructor(ctx: Context, config?: BasicCompactionConfig & {
54
+ automaticRecovery?: boolean;
55
+ });
48
56
  compactNow(agent: Agent, signal: AbortSignal, sourceCommandId?: CommandId): Promise<CompactionResult | null>;
49
- protected summarize(input: RecoveryInput<Message>, agent: Agent, signal?: AbortSignal): Promise<RecoveryResult>;
57
+ protected summarize(input: RecoveryInput<Message>, agent: Agent, signal?: AbortSignal): Promise<RecoveryResult | {
58
+ summary: ContentBlock[];
59
+ provider: string;
60
+ model: string;
61
+ maxTokens?: number;
62
+ }>;
50
63
  }
51
64
  export default CopilotManualRecoveryCompactionEngine;
52
65
  //# sourceMappingURL=manual-compaction-recovery.d.ts.map
@@ -1,4 +1,5 @@
1
1
  import type { Context } from '@deepseek-ai/cordis';
2
+ import type { Agent } from '@deepseek-ai/dsh-agent';
2
3
  import type { PiAiProviderProfile } from '@deepseek-ai/dsh-llm-pi-ai';
3
4
  import { GITHUB_COPILOT_PREVIEW_PROVIDER_ID } from './copilot-identity.ts';
4
5
  import type { AccountModelLoadOptions } from './account-model-source.ts';
@@ -34,8 +35,8 @@ export interface GitHubCopilotPreviewView {
34
35
  }
35
36
  export interface GitHubCopilotPreview {
36
37
  getView(): GitHubCopilotPreviewView;
37
- /** Synchronous, account-proven capacities for an explicit manual summary; never triggers discovery. */
38
- recoveryLimits(modelId: string): {
38
+ /** Synchronous, account-proven summary capacities for the initiating Agent; never triggers discovery. */
39
+ recoveryLimits(modelId: string, agent?: Agent): {
39
40
  readonly limits: Pick<AccountModelDescriptor, 'contextWindow' | 'maxInputTokens' | 'maxTokens'>;
40
41
  readonly policy: Partial<RequestBudgetPolicy>;
41
42
  readonly assertCurrent: () => void;
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.114",
4
+ "version": "0.4.0-alpha.115",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "registry": "https://registry.npmjs.org/",