dsh-github-copilot 0.4.0-alpha.119 → 0.4.0-alpha.121
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 +13 -0
- package/CHANGELOG.md +12 -0
- package/README.md +10 -6
- package/README.zh.md +9 -6
- package/deployment-baseline.json +7 -1
- package/docs/copilot-accounts.md +14 -0
- package/docs/copilot-compaction.md +9 -0
- package/docs/manual-compaction-recovery.md +11 -0
- package/docs/session-continuation.md +4 -0
- package/lib/index.js +50 -3
- package/lib/manual-compaction-recovery.js +55 -13
- package/lib/types/background-compaction.d.ts +2 -2
- package/lib/types/compaction-replay.d.ts +18 -0
- package/lib/types/manual-compaction-recovery.d.ts +2 -0
- package/lib/types/preview-route.d.ts +1 -0
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -45,6 +45,19 @@ This repository owns eleven narrow surfaces:
|
|
|
45
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
|
+
## Explicit compaction replay consent (#349)
|
|
49
|
+
|
|
50
|
+
`/copilot-compact visible-history` explicitly authorizes one lossy managed Responses
|
|
51
|
+
summary operation through the separately selected recovery engine. Scope consent
|
|
52
|
+
to the native summarizer signal, Session and account-proven model protocol; revoke
|
|
53
|
+
on settlement/cancellation/teardown. Remove historical reasoning and its embedded
|
|
54
|
+
summaries only from outgoing payloads, preserve visible tool relations and native
|
|
55
|
+
source/transaction ownership, and fail explicitly for unsupported routes. Never
|
|
56
|
+
inherit chat continuation consent or silently enable it for automatic compaction.
|
|
57
|
+
Safe background diagnostics use bounded Error cause chains and fixed allowlisted
|
|
58
|
+
codes, never raw errors. Installation alone neither selects nor invokes recovery.
|
|
59
|
+
See `src/compaction-replay.ts` and `docs/manual-compaction-recovery.md` (#349).
|
|
60
|
+
|
|
48
61
|
## Approved multi-account ownership extension (#297)
|
|
49
62
|
|
|
50
63
|
Identity presentation uses additive `ensureIdentity` Remotes, including explicit-Agent Session lookup. Keep `get` metadata-only; visible surfaces may ensure on their sixty-second cadence. Fresh ten-minute cache avoids requests, same-account consumers join a bounded flight, and failures cool down thirty seconds unless explicitly refreshed. Credential notifications revoke pending work even when token bytes are unchanged; no late cache publication. Quota may settle independently only with account-coherent metadata. Presentation cache never replaces fresh identity validation for switch, reauthorization or duplicate checks. Preserve strict sanitized diagnostics and Session/turn ownership (#309).
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.0-alpha.121 (prepared)
|
|
4
|
+
|
|
5
|
+
- Add explicit `/copilot-compact visible-history` consent for one lossy managed Responses summary operation after replay-scope rejection (#349). Preserve visible messages/tool pairs, native directive, route/cap, cancellation, source history and single transactional commit; no automatic retry, hidden settings change or live execution.
|
|
6
|
+
- Show safe allowlisted background-compaction failure reasons through bounded native Error cause chains rather than only a generic failure. Unknown causes remain explicit and private.
|
|
7
|
+
- Keep ordinary/manual/automatic compaction and chat continuation consent independent; installation alone neither selects an engine nor runs recovery.
|
|
8
|
+
|
|
9
|
+
## 0.4.0-alpha.120 (prepared)
|
|
10
|
+
|
|
11
|
+
- Let explicitly account-bound model preparation, native dispatch and subsequent turn steps continue during global selector switching, fixing `COPILOT_ACCOUNTS_BUSY` from the overly broad acquisition fence (#344).
|
|
12
|
+
- Keep unbound/global request fences, credential authorization/removal/sign-out protection, pinned-record leases, cancellation, route checks and original turn accounts. No automatic retry, message replay, fallback account, history rewrite, Core change, installation or restart.
|
|
13
|
+
- Exercise native Responses, Chat Completions and Anthropic dispatch while switch preflight is pending, then verify that the next turn adopts the confirmed new default.
|
|
14
|
+
|
|
3
15
|
## 0.4.0-alpha.119 (prepared)
|
|
4
16
|
|
|
5
17
|
- Show Models global account metadata before background identity-name hydration, keeping Switch available when metadata and route/activity evidence allow it (#342). Hydration never authorizes a switch and late results cannot undo a confirmed change.
|
package/README.md
CHANGED
|
@@ -13,6 +13,8 @@ independent official authorizations in the existing credentials service.
|
|
|
13
13
|
**Models → Manage → GitHub accounts** manages authorizations and the global default.
|
|
14
14
|
Inside **Credits**, choose a saved account for this Session's subsequent turns or
|
|
15
15
|
restore **Follow global default**. Running turns retain their original account.
|
|
16
|
+
Selector-only switching permits their account-bound model preparation and
|
|
17
|
+
dispatch to continue; unbound requests and credential mutations remain fenced.
|
|
16
18
|
Identity display accepts GitHub Enterprise Managed User names, including their underscore-separated enterprise suffixes.
|
|
17
19
|
|
|
18
20
|
Models and Chat share an opaque, theme-aware account dropdown; translucent native menu tokens cannot reveal underlying controls or quota text. Both use restrained dark elevation in light and dark mode.
|
|
@@ -23,7 +25,7 @@ Visible Models and Credits resolve missing names for saved accounts without acti
|
|
|
23
25
|
|
|
24
26
|
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
27
|
|
|
26
|
-
**Source candidate: `0.4.0-alpha.
|
|
28
|
+
**Source candidate: `0.4.0-alpha.121` (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
29
|
|
|
28
30
|
## What you can do
|
|
29
31
|
|
|
@@ -80,10 +82,10 @@ Supply any launcher patches with repeated `--patch /absolute/file`. Require `sup
|
|
|
80
82
|
For a **standalone named profile**:
|
|
81
83
|
|
|
82
84
|
```sh
|
|
83
|
-
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
85
|
+
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.121/dsh-github-copilot-0.4.0-alpha.121.tgz
|
|
84
86
|
```
|
|
85
87
|
|
|
86
|
-
For **Desktop**, its native package manager accepts `dsh-github-copilot@0.4.0-alpha.
|
|
88
|
+
For **Desktop**, its native package manager accepts `dsh-github-copilot@0.4.0-alpha.121` 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.
|
|
87
89
|
|
|
88
90
|
After an approved reload/restart:
|
|
89
91
|
|
|
@@ -160,6 +162,8 @@ Managed request admission preserves truthful input/output limits and native tran
|
|
|
160
162
|
|
|
161
163
|
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.
|
|
162
164
|
|
|
165
|
+
If compaction fails with `COPILOT_RESPONSES_REPLAY_SCOPE_MISMATCH`, the selected recovery engine supports explicit `/copilot-compact visible-history` for one lossy manual summary: old encrypted reasoning and its embedded summaries are omitted from outgoing Responses input, visible messages/tool pairs remain, and only the native transaction can commit a smaller checkpoint. Hidden context may be lost; ordinary and automatic compaction do not gain this consent. Background status exposes safe allowlisted failure reasons. Read [recovery consent and limits](./docs/manual-compaction-recovery.md#explicit-visible-history-summary-recovery) before invoking; installation alone neither selects the engine nor runs recovery.
|
|
166
|
+
|
|
163
167
|
For exact verified `408 / user_request_timeout`, diagnostics describe bounded request composition and observable timing, not a proven payload limit or root cause. Image counts include native Responses tool outputs; older stored diagnostics may have counted those images as residual history. Bytes are not tokens; timing is not upload duration. Small, image-free requests can also time out. Follow [request-budget and timeout guidance](./docs/copilot-compaction.md); do not automatically trim history, disable proof, switch models or add retries.
|
|
164
168
|
|
|
165
169
|
The same failure can include request-scoped native local body-write/header milestones, negotiated TLS ALPN and a Node writable-buffer count. These are local submission observations, not kernel ACK or supplier receipt; missing events do not prove an incomplete upload. Unsupported or ambiguous transports report unavailable evidence. No request contents are logged and no connection, proxy, dispatcher or retry is changed.
|
|
@@ -245,14 +249,14 @@ Commit attribution uses `Assisted-by` with the actual tool, never the model prov
|
|
|
245
249
|
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.
|
|
246
250
|
|
|
247
251
|
```sh
|
|
248
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
249
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
252
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.121/dsh-github-copilot-0.4.0-alpha.121.tgz
|
|
253
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.121/SHA256SUMS
|
|
250
254
|
sha256sum --check SHA256SUMS
|
|
251
255
|
```
|
|
252
256
|
|
|
253
257
|
```powershell
|
|
254
258
|
$expected = (Get-Content .\SHA256SUMS).Split()[0]
|
|
255
|
-
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.
|
|
259
|
+
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.121.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
|
|
256
260
|
if ($actual -cne $expected) { throw 'Release checksum mismatch' }
|
|
257
261
|
```
|
|
258
262
|
|
package/README.zh.md
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
[账号需求与技术方案](./docs/copilot-accounts.md)说明如何在现有凭据服务中
|
|
12
12
|
分别保存独立官方授权。**模型 → Manage → GitHub accounts**管理授权和全局默认;
|
|
13
13
|
在 Credits 内选择本 Session 后续 turn 的账号,或恢复跟随全局默认;正在运行的 turn 保持原账号。
|
|
14
|
+
仅切换全局选择期间,已绑定账号的模型准备和发送可以继续;未绑定请求及授权记录变更仍受锁保护。
|
|
14
15
|
身份展示支持 GitHub 企业托管账号,包括带下划线企业后缀的用户名。
|
|
15
16
|
|
|
16
17
|
Models 和 Chat 共用不透明、随主题适配的账号下拉层;原生菜单 token 即使半透明,也不会透出底下的按钮或额度文字。明暗主题均使用克制的深色投影,不产生白色光晕。
|
|
@@ -21,7 +22,7 @@ Models 和 Chat 共用不透明、随主题适配的账号下拉层;原生菜
|
|
|
21
22
|
|
|
22
23
|
添加账号时,设备授权链接、可选择的网址、一次性授权码、复制授权码和取消操作会同时显示。GitHub 授权完成后,会单独显示身份与可用模型验证阶段。添加账号不会更改全局默认;准备好后仍需显式执行现有的**切换**操作。技术诊断收在次级折叠区;账号/历史 turn 缺少身份时不会暴露不透明账号 ID,也不会根据当前设置推断历史身份。
|
|
23
24
|
|
|
24
|
-
**源码候选版本:`0.4.0-alpha.
|
|
25
|
+
**源码候选版本:`0.4.0-alpha.121`(尚未发布)。支持宿主:官方 DSH / Windows Desktop `0.2.0-rc.2`。** 较早 DSH pin 仅是历史证据,不是当前安装目标。已发布、已安装到 profile、已被运行中的 Host 加载,是三个不同状态。下方带版本的命令适用于候选版本发布后,不代表对应资产已经存在。
|
|
25
26
|
|
|
26
27
|
## 你可以做什么
|
|
27
28
|
|
|
@@ -73,10 +74,10 @@ node package/scripts/check-search-composition.mjs --profile-dir /absolute/profil
|
|
|
73
74
|
**独立具名 profile**:
|
|
74
75
|
|
|
75
76
|
```sh
|
|
76
|
-
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
77
|
+
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.121/dsh-github-copilot-0.4.0-alpha.121.tgz
|
|
77
78
|
```
|
|
78
79
|
|
|
79
|
-
**Desktop** 原生包管理器在发布后接受 `dsh-github-copilot@0.4.0-alpha.
|
|
80
|
+
**Desktop** 原生包管理器在发布后接受 `dsh-github-copilot@0.4.0-alpha.121`。官方 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 或删除配置。
|
|
80
81
|
|
|
81
82
|
经批准 reload/restart 后:
|
|
82
83
|
|
|
@@ -153,6 +154,8 @@ Copilot 搜索要求当前账号/协议证据及能力 proof。固定/fallba
|
|
|
153
154
|
|
|
154
155
|
同一轮后续步骤已有托管路由、且没有待切换模型时,已知输入压力会在 Core 开始下次模型尝试之前压缩。原生压缩成功可避免一次无 usage 样本的本地压力拒绝导致整轮 Usage 不可用。首次步骤、待切换模型、新增固定前缀膨胀与最终硬预算拒绝仍保留原有准入;不会修复历史总量或虚构缺失用量。
|
|
155
156
|
|
|
157
|
+
若压缩报 `COPILOT_RESPONSES_REPLAY_SCOPE_MISMATCH`,已选用的恢复引擎支持显式 `/copilot-compact visible-history`:仅授权一次有损手动摘要,从发出的 Responses 输入中省略旧加密 reasoning 及其内嵌摘要,保留可见消息和工具调用/结果关系,仅由原生事务提交更小的检查点。隐藏上下文可能丢失;普通/自动压缩不会继承授权。后台状态显示安全白名单错误原因。调用前阅读[授权与恢复限制](./docs/manual-compaction-recovery.md#explicit-visible-history-summary-recovery);安装本身不选用引擎,也不执行恢复。
|
|
158
|
+
|
|
156
159
|
严格核验的 `408 / user_request_timeout`诊断给出有界请求构成和可观察耗时,不证明供应方 payload 上限或根因。图片统计包括原生 Responses 工具输出中的图片;旧的已存诊断可能把这些图片算作剩余历史。字节不是 tokens,耗时不是上传时长;小型无图请求也可能超时。参见[预算与超时指导](./docs/copilot-compaction.md),不要自动裁剪历史、禁用 proof、切换模型或增加重试。
|
|
157
160
|
|
|
158
161
|
同一失败还可包含请求级原生客户端的本地请求体写入/响应头里程碑、协商出的 TLS ALPN 与 Node 写缓冲字节数。这些只是本地提交观测,不是内核 ACK 或供应方接收证明;缺失事件不代表上传未完成。不支持或存在歧义的传输会明确报告证据不可用。不记录请求内容,也不改变连接、代理、dispatcher 或重试。
|
|
@@ -238,14 +241,14 @@ Agent 从 `node scripts/agent.mjs describe --json`、`doctor --json`及`plan <ta
|
|
|
238
241
|
GitHub Releases 和 npm 分发同一原始已校验 tarball。固定版本并核验 Release SHA-256 或 npm `dist.integrity`;不重打包不可变 Release、不移动/复用 tag。
|
|
239
242
|
|
|
240
243
|
```sh
|
|
241
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
242
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
244
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.121/dsh-github-copilot-0.4.0-alpha.121.tgz
|
|
245
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.121/SHA256SUMS
|
|
243
246
|
sha256sum --check SHA256SUMS
|
|
244
247
|
```
|
|
245
248
|
|
|
246
249
|
```powershell
|
|
247
250
|
$expected = (Get-Content .\SHA256SUMS).Split()[0]
|
|
248
|
-
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.
|
|
251
|
+
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.121.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
|
|
249
252
|
if ($actual -cne $expected) { throw 'Release checksum mismatch' }
|
|
250
253
|
```
|
|
251
254
|
|
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.121"
|
|
12
12
|
},
|
|
13
13
|
"evidence": {
|
|
14
14
|
"kind": "source-and-synthetic-test-inventory",
|
|
@@ -334,6 +334,7 @@
|
|
|
334
334
|
{"file": "tests/copilot-usage-card.spec.ts", "name": "disables following when the Session selection cannot be read instead of treating it as a fixed account"},
|
|
335
335
|
{"file": "tests/fixtures/copilot-accounts-host-core.fixture.ts", "name": "never writes a captured A refresh into B after an external selection change"},
|
|
336
336
|
{"file": "tests/fixtures/copilot-accounts-host-core.fixture.ts", "name": "runs fresh switch identity and model preflight concurrently but commits only after both settle"},
|
|
337
|
+
{"file": "tests/fixtures/copilot-accounts-host-core.fixture.ts", "name": "permits record-bound requests during selector switching without admitting global requests or credential mutations"},
|
|
337
338
|
{"file": "tests/fixtures/copilot-accounts-host-core.fixture.ts", "name": "cancels and drains sibling switch preflight before releasing its mutation fence"},
|
|
338
339
|
{"file": "tests/fixtures/copilot-accounts-host-core.fixture.ts", "name": "rejects a changed credential identity during overlapping switch checks without saving"},
|
|
339
340
|
{"file": "tests/copilot-accounts-card.spec.ts", "name": "renders metadata and permits a confirmed switch while unrelated identity names remain pending"},
|
|
@@ -575,6 +576,8 @@
|
|
|
575
576
|
{"file": "src/manual-compaction-recovery.ts", "marker": "maxCalls: failedAttempt ? 15 : 16"},
|
|
576
577
|
{"file": "src/manual-compaction-recovery.ts", "marker": "COPILOT_MANUAL_RECOVERY_"},
|
|
577
578
|
{"file": "src/background-compaction.ts", "marker": "copilot-compact"},
|
|
579
|
+
{"file": "src/compaction-replay.ts", "marker": "request.purpose !== 'compaction'"},
|
|
580
|
+
{"file": "src/background-compaction.ts", "marker": "visible-history"},
|
|
578
581
|
{"file": "src/background-compaction.ts", "marker": "this.jobs.wait(jobId"},
|
|
579
582
|
{"file": "src/preview-route.ts", "marker": "recoveryLimits(modelId)"},
|
|
580
583
|
{"file": "docs/manual-compaction-recovery.md", "marker": "separately selected"}
|
|
@@ -584,6 +587,9 @@
|
|
|
584
587
|
{"file": "tests/manual-compaction-recovery.spec.ts", "name": "rejects an indivisible span before dispatch and leaves recovery to native failure handling"},
|
|
585
588
|
{"file": "tests/manual-compaction-recovery.spec.ts", "name": "rejects unmatched tool calls before dispatch instead of splitting a call and result"},
|
|
586
589
|
{"file": "tests/background-compaction.spec.ts", "name": "acknowledges before completion and outlives a five-minute caller deadline"},
|
|
590
|
+
{"file": "tests/compaction-replay.spec.ts", "name": "authorizes only the exact manual summary operation and preserves visible tool content"},
|
|
591
|
+
{"file": "tests/background-compaction.spec.ts", "name": "reports only allowlisted causes through native error wrappers"},
|
|
592
|
+
{"file": "tests/fixtures/compaction-pressure-core.fixture.ts", "name": "recovers only an explicitly authorized manual job through one native transaction"},
|
|
587
593
|
{"file": "tests/fixtures/compaction-pressure-core.fixture.ts", "name": "commits beyond the carrier deadline without a model wakeup and keeps status owner-scoped"},
|
|
588
594
|
{"file": "tests/fixtures/compaction-pressure-core.fixture.ts", "name": "recovers oversized manual history with one native transaction and honest multi-call audit"},
|
|
589
595
|
{"file": "tests/fixtures/compaction-pressure-core.fixture.ts", "name": "defaults automatic oversized recovery on without a manual command, enabled=%s"},
|
package/docs/copilot-accounts.md
CHANGED
|
@@ -10,6 +10,20 @@ publication, installation and loaded runtime state are separate evidence.
|
|
|
10
10
|
|
|
11
11
|
## Requirements
|
|
12
12
|
|
|
13
|
+
### Selector switching and account-bound turns (#344)
|
|
14
|
+
|
|
15
|
+
A global switch changes only the selector. Explicit record-bound request leases
|
|
16
|
+
may be acquired during its preflight and CAS so already admitted turns can
|
|
17
|
+
prepare and dispatch their next native step with their frozen account. A new
|
|
18
|
+
turn still captures its account once at admission; it does not adopt a later
|
|
19
|
+
selector. Unbound/global leases remain blocked during switching, and all
|
|
20
|
+
requests remain blocked during credential authorization/removal/sign-out.
|
|
21
|
+
Pinned records cannot be reauthorized or removed until their leases end.
|
|
22
|
+
Cancellation, route eligibility, credential validity and account-model checks
|
|
23
|
+
remain independent. This is not automatic retry or permission to redirect an
|
|
24
|
+
existing turn. Deferred native fixtures exercise all three supported protocols
|
|
25
|
+
while the selector operation is still pending, not just after it settles.
|
|
26
|
+
|
|
13
27
|
### Global switch responsiveness (#342)
|
|
14
28
|
|
|
15
29
|
Models first reads metadata-only `get()` and separately hydrates display names
|
|
@@ -60,6 +60,15 @@ This fixes scope wiring, not a new automatic command: native pressure and `agent
|
|
|
60
60
|
|
|
61
61
|
## Summary purpose policy
|
|
62
62
|
|
|
63
|
+
Replay-scope rejection is not input overflow: a smaller summary request can still
|
|
64
|
+
carry old encrypted reasoning that the supplier refuses. Ordinary and automatic
|
|
65
|
+
compaction never inherit chat continuation consent. The selected recovery engine's
|
|
66
|
+
explicit `/copilot-compact visible-history` authorizes one lossy Responses summary
|
|
67
|
+
operation, with safe failure-code reporting and unchanged native transaction
|
|
68
|
+
ownership. Review [consent and bounded limitations](./manual-compaction-recovery.md#explicit-visible-history-summary-recovery)
|
|
69
|
+
before invoking. This does not decrypt or repair replay, rewrite source history,
|
|
70
|
+
retry a failed message or guarantee capacity recovery.
|
|
71
|
+
|
|
63
72
|
Official `GenerateOptions.purpose` permits adapter-specific generation policy. For `purpose: 'compaction'`, `prefer-low` selects supported `minimal`, otherwise supported `low`, only when no effort was supplied or materialized by Core/the configured native profile. Explicit and resolved defaults win; unsupported low controls preserve the provider default. `preserve` disables this purpose default. Normal conversations and other purposes keep their existing reasoning behavior.
|
|
64
73
|
|
|
65
74
|
The stock summary record takes its requested output cap from the owning compaction configuration. Therefore the plugin does not silently increase/decrease that cap in middleware or alter summary route identity. It preserves native `max-tokens` output truncation as failure, distinct from input overflow. Public summaries, encrypted replay and native stop reasons remain native-owned.
|
|
@@ -28,6 +28,7 @@ With this engine selected and the public `commands` and `jobs` services availabl
|
|
|
28
28
|
/copilot-compact
|
|
29
29
|
/copilot-compact status
|
|
30
30
|
/copilot-compact cancel
|
|
31
|
+
/copilot-compact visible-history
|
|
31
32
|
```
|
|
32
33
|
|
|
33
34
|
The jobs package is a development-only type dependency: the plugin imports no jobs runtime implementation, and the engine's public declaration does not expose its types. Runtime access is through the optionally injected Host service; no jobs package is bundled, installed as a new peer, or registered by this plugin.
|
|
@@ -36,6 +37,16 @@ The first command acknowledges **job admission**, not a completed summary. The e
|
|
|
36
37
|
|
|
37
38
|
Status and cancellation apply only to the invoking Agent's latest job. Duplicate starts return the current running job rather than starting another transaction. The selected engine still acquires Core's maintenance lock and owns the only native transaction; another active turn or compaction can cause the admitted job to fail. Job status distinguishes running, completed, failed and cancelled work. Failure details are sanitized; consult the native compaction/end record for the underlying summary/transaction diagnostic. Provider timeout, truncation, capacity and account-proof failures remain failures.
|
|
38
39
|
|
|
40
|
+
### Explicit visible-history summary recovery
|
|
41
|
+
|
|
42
|
+
For a verified `COPILOT_RESPONSES_REPLAY_SCOPE_MISMATCH`, repeating the same summary cannot repair supplier-scoped encrypted replay. `/copilot-compact visible-history` is explicit consent for **one lossy manual compaction operation**: its managed Responses summary requests omit historical encrypted reasoning items **and their embedded summaries**, while retaining visible messages, tool calls/results, the system head and native final directive. Hidden reasoning may contain details absent from visible messages. Review this loss before issuing the command. Ordinary `/compact`, `/copilot-compact`, automatic compaction and persistent chat continuation remain unchanged; enabling chat continuation alone does not authorize summary recovery.
|
|
43
|
+
|
|
44
|
+
Consent is local to the native summarizer's exact cancellation signal, Session and summary model, including its bounded segments. It is revoked on completion, failure, cancellation or teardown. No unrelated request, subsequent command or automatic retry inherits it. Unknown or incomplete reasoning fails closed. No replay is decrypted, fabricated or written back; original source events remain unchanged and only Core can commit the final smaller checkpoint. The command adds no retry or model/account switch, and does not repair supplier scope. Missing managed integration or an unsupported summary route fails explicitly.
|
|
45
|
+
|
|
46
|
+
The original conservative input/segmentation estimate still includes native history before outgoing filtering. Giant indivisible units, fixed prefixes, bounded-work/call limits, truncation and failure to shrink can still prevent recovery. This command is not guaranteed to rescue every history, and summary calls may incur charges. Installation alone neither selects the engine nor runs this command.
|
|
47
|
+
|
|
48
|
+
Background status now exposes only allowlisted fixed failure codes through bounded native Error cause chains, including replay-scope rejection; raw exception text, response bodies and history remain excluded. Unknown failures retain `COPILOT_BACKGROUND_COMPACTION_FAILED` with guidance to the native `compaction/end` record. An admission receipt is not success; check status and the native transaction.
|
|
49
|
+
|
|
39
50
|
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.
|
|
40
51
|
|
|
41
52
|
**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.
|
|
@@ -67,6 +67,10 @@ published adapter/SDK's payload hook filters the normalized payload. Only
|
|
|
67
67
|
unbound requests and other protocols remain native. Cold mid-turn recovery
|
|
68
68
|
without a first-step boundary fails explicitly.
|
|
69
69
|
|
|
70
|
+
Explicit manual summary recovery is separate: `/copilot-compact visible-history`
|
|
71
|
+
authorizes only one selected-engine operation, never inherited chat consent.
|
|
72
|
+
See [summary recovery](./manual-compaction-recovery.md#explicit-visible-history-summary-recovery).
|
|
73
|
+
|
|
70
74
|
The filter scans at most 65536 top-level input items and 4096 reasoning items
|
|
71
75
|
(including duplicates). Only encrypted reasoning is hashed, with an aggregate
|
|
72
76
|
64 Mi UTF-16-code-unit processing bound per invocation and 64 Ki-code-unit chunks
|
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.
|
|
3001
|
+
version: "0.4.0-alpha.121",
|
|
3002
3002
|
publishConfig: {
|
|
3003
3003
|
"access": "public",
|
|
3004
3004
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -3589,7 +3589,8 @@ var CopilotAccountsHost = class {
|
|
|
3589
3589
|
binding.assertCurrent();
|
|
3590
3590
|
}
|
|
3591
3591
|
acquire(signal, requireManaged = true, accountId) {
|
|
3592
|
-
|
|
3592
|
+
const selectorOnly = this.operation === "switching" && accountId !== void 0;
|
|
3593
|
+
if (this.operation !== void 0 && !selectorOnly || this.ctx.get("authorization")?.describe(recordKey("canonical"))?.inFlight === true) fail("COPILOT_ACCOUNTS_BUSY");
|
|
3593
3594
|
if (signal?.aborted) fail("COPILOT_ACCOUNTS_CHANGED");
|
|
3594
3595
|
const binding = accountId === void 0 ? this.capture() : this.captureAccount(accountId);
|
|
3595
3596
|
if (requireManaged && binding.accountId !== "canonical") {
|
|
@@ -9643,6 +9644,49 @@ function installSessionContinuation(ctx) {
|
|
|
9643
9644
|
};
|
|
9644
9645
|
}
|
|
9645
9646
|
//#endregion
|
|
9647
|
+
//#region lib/types/compaction-replay.js
|
|
9648
|
+
/** Explicit manual consent lasts only for the native summarizer hook's exact signal. */
|
|
9649
|
+
var CompactionReplayRecovery = class {
|
|
9650
|
+
operations = /* @__PURE__ */ new Map();
|
|
9651
|
+
closed = false;
|
|
9652
|
+
async run(sessionId, model, signal, operation) {
|
|
9653
|
+
if (this.closed) throw new Error("COPILOT_COMPACTION_REPLAY_UNAVAILABLE");
|
|
9654
|
+
signal.throwIfAborted();
|
|
9655
|
+
if (this.operations.has(signal)) throw new Error("COPILOT_COMPACTION_REPLAY_OVERLAP");
|
|
9656
|
+
if (this.operations.size >= 64) throw new Error("COPILOT_COMPACTION_REPLAY_LIMIT");
|
|
9657
|
+
const authorization = {
|
|
9658
|
+
sessionId,
|
|
9659
|
+
model
|
|
9660
|
+
};
|
|
9661
|
+
this.operations.set(signal, authorization);
|
|
9662
|
+
try {
|
|
9663
|
+
return await operation();
|
|
9664
|
+
} finally {
|
|
9665
|
+
this.operations.delete(signal);
|
|
9666
|
+
}
|
|
9667
|
+
}
|
|
9668
|
+
prepare(request) {
|
|
9669
|
+
if (request.provider !== "github-copilot-preview" || request.purpose !== "compaction" || !request.signal) return void 0;
|
|
9670
|
+
const signal = request.signal;
|
|
9671
|
+
const authorization = this.operations.get(signal);
|
|
9672
|
+
if (!authorization || request.sessionId !== authorization.sessionId || request.model !== authorization.model) return void 0;
|
|
9673
|
+
const assertCurrent = () => {
|
|
9674
|
+
if (this.closed || signal.aborted || this.operations.get(signal) !== authorization) throw new Error("COPILOT_COMPACTION_REPLAY_REVOKED");
|
|
9675
|
+
};
|
|
9676
|
+
return (payload) => new SessionContinuationTurn().transform(payload, assertCurrent);
|
|
9677
|
+
}
|
|
9678
|
+
dispose() {
|
|
9679
|
+
this.closed = true;
|
|
9680
|
+
this.operations.clear();
|
|
9681
|
+
}
|
|
9682
|
+
};
|
|
9683
|
+
function installCompactionReplay(ctx) {
|
|
9684
|
+
const recovery = new CompactionReplayRecovery();
|
|
9685
|
+
ctx.provide("githubCopilotCompactionReplay", recovery);
|
|
9686
|
+
ctx.effect(() => () => recovery.dispose());
|
|
9687
|
+
return recovery;
|
|
9688
|
+
}
|
|
9689
|
+
//#endregion
|
|
9646
9690
|
//#region lib/types/agent-compaction.js
|
|
9647
9691
|
function record$7(value) {
|
|
9648
9692
|
return typeof value === "object" && value !== null;
|
|
@@ -12374,6 +12418,7 @@ function createAccountRuntime(ctx, config, binding, exclusionTurns, replayRecove
|
|
|
12374
12418
|
const revision = lifetime.revision;
|
|
12375
12419
|
const proof = snapshotProof;
|
|
12376
12420
|
return Object.freeze({
|
|
12421
|
+
api: descriptor.api,
|
|
12377
12422
|
limits: Object.freeze({
|
|
12378
12423
|
contextWindow: descriptor.contextWindow,
|
|
12379
12424
|
maxTokens: descriptor.maxTokens,
|
|
@@ -12543,9 +12588,10 @@ function apply$1(ctx, config = {}) {
|
|
|
12543
12588
|
return runtimeFor(binding).proof();
|
|
12544
12589
|
});
|
|
12545
12590
|
const continuation = installSessionContinuation(ctx);
|
|
12591
|
+
const compactionReplay = installCompactionReplay(ctx);
|
|
12546
12592
|
const replayRecovery = {
|
|
12547
12593
|
prepare(request) {
|
|
12548
|
-
const portable = continuation.prepare(request);
|
|
12594
|
+
const portable = compactionReplay.prepare(request) ?? continuation.prepare(request);
|
|
12549
12595
|
const temporary = temporaryRecovery.prepare(request);
|
|
12550
12596
|
if (!portable) return temporary;
|
|
12551
12597
|
return {
|
|
@@ -12556,6 +12602,7 @@ function apply$1(ctx, config = {}) {
|
|
|
12556
12602
|
dispose() {
|
|
12557
12603
|
temporaryRecovery.dispose();
|
|
12558
12604
|
continuation.dispose();
|
|
12605
|
+
compactionReplay.dispose();
|
|
12559
12606
|
}
|
|
12560
12607
|
};
|
|
12561
12608
|
const initial = directoryRuntime();
|
|
@@ -6,8 +6,32 @@ import BasicCompactionEngine from "@deepseek-ai/dsh-compaction-basic";
|
|
|
6
6
|
import { CommandDefinitionId } from "@deepseek-ai/dsh-commands/brand";
|
|
7
7
|
//#region lib/types/background-compaction.js
|
|
8
8
|
const WAIT_MS = 2147483647;
|
|
9
|
-
const USAGE = "Usage: /copilot-compact [status|cancel]";
|
|
9
|
+
const USAGE = "Usage: /copilot-compact [status|cancel|visible-history]. visible-history authorizes one lossy summary without old encrypted reasoning or its embedded summaries; stored source history is unchanged.";
|
|
10
10
|
const FAILED = "COPILOT_BACKGROUND_COMPACTION_FAILED: inspect the native compaction/end record; no success is implied.";
|
|
11
|
+
function failureDetail(cause) {
|
|
12
|
+
const allowed = /* @__PURE__ */ new Set([
|
|
13
|
+
"COPILOT_RESPONSES_REPLAY_SCOPE_MISMATCH",
|
|
14
|
+
"COPILOT_RESPONSES_REPLAY_UNSUPPORTED",
|
|
15
|
+
"COPILOT_RESPONSES_REPLAY_INVALID_PAYLOAD",
|
|
16
|
+
"CONTEXT_WINDOW_EXCEEDED",
|
|
17
|
+
"COPILOT_MANUAL_RECOVERY_ACCOUNT_PROOF_UNAVAILABLE",
|
|
18
|
+
"COPILOT_MANUAL_RECOVERY_FIXED_PREFIX",
|
|
19
|
+
"COPILOT_MANUAL_RECOVERY_INDIVISIBLE",
|
|
20
|
+
"COPILOT_MANUAL_RECOVERY_CALL_LIMIT",
|
|
21
|
+
"COPILOT_MANUAL_RECOVERY_EMPTY_SUMMARY",
|
|
22
|
+
"COPILOT_MANUAL_RECOVERY_UNBALANCED",
|
|
23
|
+
"COPILOT_COMPACTION_REPLAY_UNAVAILABLE",
|
|
24
|
+
"COPILOT_COMPACTION_REPLAY_REVOKED"
|
|
25
|
+
]);
|
|
26
|
+
const visited = /* @__PURE__ */ new Set();
|
|
27
|
+
for (let depth = 0; depth < 8 && cause instanceof Error && !visited.has(cause); depth++) {
|
|
28
|
+
visited.add(cause);
|
|
29
|
+
const code = /^[A-Z][A-Z_]+(?=:|$)/.exec(cause.message)?.[0];
|
|
30
|
+
if (code && allowed.has(code)) return `${code}: compaction failed; stored source history is unchanged.${code === "COPILOT_RESPONSES_REPLAY_SCOPE_MISMATCH" ? " Review loss of hidden context before explicitly using /copilot-compact visible-history. No automatic retry." : ""} Inspect the native compaction/end record.`;
|
|
31
|
+
cause = cause.cause;
|
|
32
|
+
}
|
|
33
|
+
return FAILED;
|
|
34
|
+
}
|
|
11
35
|
/** Own only admission and job lifetime; the selected engine owns all history transactions. */
|
|
12
36
|
var BackgroundCompaction = class {
|
|
13
37
|
jobs;
|
|
@@ -31,12 +55,12 @@ var BackgroundCompaction = class {
|
|
|
31
55
|
text: "Compaction admission cancelled."
|
|
32
56
|
};
|
|
33
57
|
const action = rawInput.trim();
|
|
34
|
-
if (action !== "" && action !== "status" && action !== "cancel") return {
|
|
58
|
+
if (action !== "" && action !== "status" && action !== "cancel" && action !== "visible-history") return {
|
|
35
59
|
kind: "error",
|
|
36
60
|
text: USAGE
|
|
37
61
|
};
|
|
38
62
|
const id = this.latest.get(agent);
|
|
39
|
-
if (action
|
|
63
|
+
if (action === "status" || action === "cancel") {
|
|
40
64
|
if (id === void 0) return {
|
|
41
65
|
kind: "error",
|
|
42
66
|
text: "No background compaction job for this Session."
|
|
@@ -75,20 +99,21 @@ var BackgroundCompaction = class {
|
|
|
75
99
|
done = Promise.resolve().then(async () => {
|
|
76
100
|
try {
|
|
77
101
|
cancel.signal.throwIfAborted();
|
|
78
|
-
const result = await this.compact(agent, cancel.signal);
|
|
102
|
+
const result = await this.compact(agent, cancel.signal, action === "visible-history");
|
|
79
103
|
return {
|
|
80
104
|
status: "completed",
|
|
81
105
|
detail: result === null ? "No compactable history." : `Compacted ${result.shadowedSeqs.length} history items (~${result.shadowedTokenCount} tokens).`
|
|
82
106
|
};
|
|
83
|
-
} catch {
|
|
107
|
+
} catch (cause) {
|
|
84
108
|
if (cancel.signal.aborted) return {
|
|
85
109
|
status: "killed",
|
|
86
110
|
detail: "Compaction cancelled; inspect native history for its transaction outcome."
|
|
87
111
|
};
|
|
88
|
-
|
|
112
|
+
const detail = failureDetail(cause);
|
|
113
|
+
this.warn(detail);
|
|
89
114
|
return {
|
|
90
115
|
status: "failed",
|
|
91
|
-
detail
|
|
116
|
+
detail
|
|
92
117
|
};
|
|
93
118
|
} finally {
|
|
94
119
|
this.active.delete(agent);
|
|
@@ -147,7 +172,7 @@ function installBackgroundCompaction(ctx, compact) {
|
|
|
147
172
|
definitionId: CommandDefinitionId("dsh-github-copilot/background-compaction"),
|
|
148
173
|
name: "copilot-compact",
|
|
149
174
|
description: "Start background manual compaction, inspect status, or cancel",
|
|
150
|
-
input: { hint: "status | cancel (omit
|
|
175
|
+
input: { hint: "status | cancel | visible-history (explicit lossy recovery; omit for normal compaction)" },
|
|
151
176
|
handler: (invocation) => controller.execute(invocation.agent, invocation.rawInput, invocation.signal)
|
|
152
177
|
});
|
|
153
178
|
}, "Copilot background compaction");
|
|
@@ -247,6 +272,7 @@ async function summarizeOversizedManualInput(options) {
|
|
|
247
272
|
var CopilotManualRecoveryCompactionEngine = class extends BasicCompactionEngine {
|
|
248
273
|
static Config = z.intersect([BasicCompactionEngine.Config, z.object({ automaticRecovery: z.boolean().default(true) })]);
|
|
249
274
|
manual = /* @__PURE__ */ new WeakMap();
|
|
275
|
+
visibleHistory = /* @__PURE__ */ new WeakSet();
|
|
250
276
|
automaticRecovery;
|
|
251
277
|
constructor(ctx, config = {}) {
|
|
252
278
|
const { automaticRecovery = true, ...nativeConfig } = config;
|
|
@@ -254,7 +280,12 @@ var CopilotManualRecoveryCompactionEngine = class extends BasicCompactionEngine
|
|
|
254
280
|
super(ctx, nativeConfig);
|
|
255
281
|
this.automaticRecovery = automaticRecovery;
|
|
256
282
|
ctx.inject(["commands", "jobs"], (scope) => {
|
|
257
|
-
installBackgroundCompaction(scope, (agent, signal) =>
|
|
283
|
+
installBackgroundCompaction(scope, (agent, signal, visibleHistory) => {
|
|
284
|
+
if (!visibleHistory) return this.compactNow(agent, signal);
|
|
285
|
+
if (this.manual.has(agent)) throw recoverError("BUSY");
|
|
286
|
+
this.visibleHistory.add(agent);
|
|
287
|
+
return this.compactNow(agent, signal).finally(() => this.visibleHistory.delete(agent));
|
|
288
|
+
});
|
|
258
289
|
});
|
|
259
290
|
}
|
|
260
291
|
async compactNow(agent, signal, sourceCommandId) {
|
|
@@ -282,19 +313,30 @@ var CopilotManualRecoveryCompactionEngine = class extends BasicCompactionEngine
|
|
|
282
313
|
};
|
|
283
314
|
const summaryProvider = selected.provider;
|
|
284
315
|
const summaryModel = selected.model;
|
|
285
|
-
if (!this.manual.has(agent) && !this.automaticRecovery || summaryProvider !== "github-copilot-preview" || !summaryModel)
|
|
316
|
+
if (!this.manual.has(agent) && !this.automaticRecovery || summaryProvider !== "github-copilot-preview" || !summaryModel) {
|
|
317
|
+
if (this.visibleHistory.has(agent)) throw new Error("COPILOT_COMPACTION_REPLAY_UNAVAILABLE");
|
|
318
|
+
return super.summarize(input, agent, signal);
|
|
319
|
+
}
|
|
320
|
+
const maxTokens = policy?.maxTokens ?? this.config.maxTokens;
|
|
321
|
+
const operationSignal = signal ?? new AbortController().signal;
|
|
322
|
+
const summarize = () => this.summarizeManaged(input, agent, summaryModel, maxTokens, operationSignal);
|
|
323
|
+
if (!this.visibleHistory.has(agent)) return summarize();
|
|
324
|
+
const recovery = this.ctx.get("githubCopilotCompactionReplay");
|
|
325
|
+
if (!recovery) throw new Error("COPILOT_COMPACTION_REPLAY_UNAVAILABLE");
|
|
326
|
+
return recovery.run(agent.session.id, summaryModel, operationSignal, summarize);
|
|
327
|
+
}
|
|
328
|
+
async summarizeManaged(input, agent, summaryModel, maxTokens, operationSignal) {
|
|
286
329
|
const lease = this.ctx.get("githubCopilotPreview")?.recoveryLimits(summaryModel, agent);
|
|
287
330
|
if (lease === void 0) throw recoverError("ACCOUNT_PROOF_UNAVAILABLE");
|
|
331
|
+
if (this.visibleHistory.has(agent) && lease.api !== "openai-responses") throw new Error("COPILOT_COMPACTION_REPLAY_UNAVAILABLE");
|
|
288
332
|
const agents = this.ctx.get("agents");
|
|
289
333
|
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,
|
|
291
|
-
const maxTokens = policy?.maxTokens ?? this.config.maxTokens;
|
|
334
|
+
const summarize = (candidate) => agents === void 0 ? super.summarize(candidate, agent, operationSignal) : agents.withInitiator(agent, () => super.summarize(candidate, agent, operationSignal));
|
|
292
335
|
const budget = calculateRequestBudget(lease.limits, maxTokens, resolveRequestBudgetPolicy(lease.policy));
|
|
293
336
|
if (!budget.ok) throw recoverError(budget.code);
|
|
294
337
|
const toolHistoryBytes = Buffer.byteLength(JSON.stringify(agent.session.toolHistory()), "utf8");
|
|
295
338
|
let inputLimit = budget.budget.hardInputLimit - 4096 - toolHistoryBytes;
|
|
296
339
|
if (inputLimit <= 0) throw recoverError("FIXED_PREFIX");
|
|
297
|
-
const operationSignal = signal ?? new AbortController().signal;
|
|
298
340
|
const estimate = (candidate) => Buffer.byteLength(JSON.stringify(candidate), "utf8");
|
|
299
341
|
operationSignal.throwIfAborted();
|
|
300
342
|
lease.assertCurrent();
|
|
@@ -21,10 +21,10 @@ export declare class BackgroundCompaction<A extends {
|
|
|
21
21
|
private readonly latest;
|
|
22
22
|
private readonly active;
|
|
23
23
|
private closed;
|
|
24
|
-
constructor(jobs: Jobs, compact: (agent: A, signal: AbortSignal) => Promise<Result>, warn: (message: string) => void);
|
|
24
|
+
constructor(jobs: Jobs, compact: (agent: A, signal: AbortSignal, visibleHistory: boolean) => Promise<Result>, warn: (message: string) => void);
|
|
25
25
|
execute(agent: A, rawInput: string, signal: AbortSignal): CommandResult;
|
|
26
26
|
dispose(): Promise<void>;
|
|
27
27
|
}
|
|
28
|
-
export declare function installBackgroundCompaction(ctx: Context, compact: (agent: Agent, signal: AbortSignal) => Promise<CompactionResult | null>): void;
|
|
28
|
+
export declare function installBackgroundCompaction(ctx: Context, compact: (agent: Agent, signal: AbortSignal, visibleHistory: boolean) => Promise<CompactionResult | null>): void;
|
|
29
29
|
export {};
|
|
30
30
|
//# sourceMappingURL=background-compaction.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { GenerateOptions } from '@deepseek-ai/dsh-llm';
|
|
3
|
+
import type { SessionId } from '@deepseek-ai/dsh-session';
|
|
4
|
+
declare module '@deepseek-ai/cordis' {
|
|
5
|
+
interface Context {
|
|
6
|
+
githubCopilotCompactionReplay: CompactionReplayRecovery;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
/** Explicit manual consent lasts only for the native summarizer hook's exact signal. */
|
|
10
|
+
export declare class CompactionReplayRecovery {
|
|
11
|
+
private readonly operations;
|
|
12
|
+
private closed;
|
|
13
|
+
run<T>(sessionId: SessionId, model: string, signal: AbortSignal, operation: () => Promise<T>): Promise<T>;
|
|
14
|
+
prepare(request: GenerateOptions): ((payload: unknown) => Promise<unknown>) | undefined;
|
|
15
|
+
dispose(): void;
|
|
16
|
+
}
|
|
17
|
+
export declare function installCompactionReplay(ctx: Context): CompactionReplayRecovery;
|
|
18
|
+
//# sourceMappingURL=compaction-replay.d.ts.map
|
|
@@ -49,6 +49,7 @@ export declare class CopilotManualRecoveryCompactionEngine extends BasicCompacti
|
|
|
49
49
|
automaticRecovery?: boolean;
|
|
50
50
|
}>;
|
|
51
51
|
private readonly manual;
|
|
52
|
+
private readonly visibleHistory;
|
|
52
53
|
private readonly automaticRecovery;
|
|
53
54
|
constructor(ctx: Context, config?: BasicCompactionConfig & {
|
|
54
55
|
automaticRecovery?: boolean;
|
|
@@ -60,6 +61,7 @@ export declare class CopilotManualRecoveryCompactionEngine extends BasicCompacti
|
|
|
60
61
|
model: string;
|
|
61
62
|
maxTokens?: number;
|
|
62
63
|
}>;
|
|
64
|
+
private summarizeManaged;
|
|
63
65
|
}
|
|
64
66
|
export default CopilotManualRecoveryCompactionEngine;
|
|
65
67
|
//# sourceMappingURL=manual-compaction-recovery.d.ts.map
|
|
@@ -37,6 +37,7 @@ export interface GitHubCopilotPreview {
|
|
|
37
37
|
getView(): GitHubCopilotPreviewView;
|
|
38
38
|
/** Synchronous, account-proven summary capacities for the initiating Agent; never triggers discovery. */
|
|
39
39
|
recoveryLimits(modelId: string, agent?: Agent): {
|
|
40
|
+
readonly api: AccountModelDescriptor['api'];
|
|
40
41
|
readonly limits: Pick<AccountModelDescriptor, 'contextWindow' | 'maxInputTokens' | 'maxTokens'>;
|
|
41
42
|
readonly policy: Partial<RequestBudgetPolicy>;
|
|
42
43
|
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.
|
|
4
|
+
"version": "0.4.0-alpha.121",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"registry": "https://registry.npmjs.org/",
|