dsh-github-copilot 0.4.0-alpha.126 → 0.4.0-alpha.127
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +8 -6
- package/README.zh.md +8 -6
- package/deployment-baseline.json +5 -1
- package/docs/manual-compaction-recovery.md +2 -0
- package/lib/client.js +142 -29
- package/lib/client.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/types/compaction-continuation-ui.d.ts +20 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.0-alpha.127 (prepared)
|
|
4
|
+
|
|
5
|
+
- Expire the confirmed visible-history compaction success notice eight seconds after its first Client observation; keep running loss disclosure visible and add localized, accessible Close to settled, unavailable and authorization-required results (#363).
|
|
6
|
+
- Retain expiry and presentation-only dismissal across incidental remounts and Session switches within a registration-owned 128-record bound. Scope by Session, operation and status; ignore late reads and clean up timers without changing consent, native proof/history, sending or retries.
|
|
7
|
+
- Synthetic Client lifecycle evidence is not live Desktop or provider acceptance; no installation, restart or settings enablement.
|
|
8
|
+
|
|
3
9
|
## 0.4.0-alpha.126 (prepared)
|
|
4
10
|
|
|
5
11
|
- Align plugin-owned Models, account management, model preferences, continuation disclosures, Credits details and plugin settings with the unchanged official rc.2 font family, type scale, themed neutral controls and focus states (#361).
|
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ Visible Models and Credits resolve missing names for saved accounts without acti
|
|
|
27
27
|
|
|
28
28
|
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.
|
|
29
29
|
|
|
30
|
-
**Package version: `0.4.0-alpha.
|
|
30
|
+
**Package version: `0.4.0-alpha.127` (prepared). 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. Verify the published Release and assets before using the versioned commands below; these instructions do not prove publication or installation.
|
|
31
31
|
|
|
32
32
|
## What you can do
|
|
33
33
|
|
|
@@ -93,10 +93,10 @@ Supply any launcher patches with repeated `--patch /absolute/file`. Require `sup
|
|
|
93
93
|
For a **standalone named profile**:
|
|
94
94
|
|
|
95
95
|
```sh
|
|
96
|
-
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
96
|
+
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.127/dsh-github-copilot-0.4.0-alpha.127.tgz
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
-
For **Desktop**, its native package manager accepts `dsh-github-copilot@0.4.0-alpha.
|
|
99
|
+
For **Desktop**, its native package manager accepts `dsh-github-copilot@0.4.0-alpha.127` 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.
|
|
100
100
|
|
|
101
101
|
After an approved reload/restart:
|
|
102
102
|
|
|
@@ -177,6 +177,8 @@ For continuing steps with a committed managed route and no pending model change,
|
|
|
177
177
|
|
|
178
178
|
**Visible-history continuation also covers this Session's native managed Responses compaction**, including automatic summaries: no extra manual recovery command or failure-first retry is required when enabled. Old encrypted reasoning and embedded summaries are omitted from outgoing input; hidden context may be lost. Visible messages/tool pairs and source history remain intact, and only the native transaction commits a smaller checkpoint. A composer notice identifies degradation and distinguishes committed, failed and cancelled outcomes. When off, an exact replay-scope rejection offers the same loss-disclosed enable control; unknown failures do not authorize loss. `/copilot-compact visible-history` remains a one-time alternative through the selected recovery engine. Read [recovery consent and limits](./docs/manual-compaction-recovery.md#explicit-visible-history-summary-recovery); this does not enable an absent engine or repair capacity, quota or timeout failures.
|
|
179
179
|
|
|
180
|
+
Running visible-history compaction notices stay visible. Confirmed success disappears eight seconds after first observation; settled failures, cancellation, unavailable status and enable prompts stay until **Close** (or the existing **Cancel**). Closing only hides this Session/operation/status notice, never changes consent, history or native proof, and never sends or retries. A bounded Client registration retains expiry/dismissal across incidental remounts and Session switches, not across teardown or eviction.
|
|
181
|
+
|
|
180
182
|
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.
|
|
181
183
|
|
|
182
184
|
The experimental `github-copilot.responsesRequestCompression` option is **off by default**. When explicitly enabled, it losslessly gzips only eligible managed HTTP Responses requests through the existing native Fetch seam. It starts at 256 KiB, skips compression work above 32 MiB and requires at least 5% and 4 KiB savings; every skip sends the original request. This changes prepared HTTP body bytes, not context/token admission. Custom Fetch, explicit `auto`/WebSocket and other protocols remain native, and a gzip rejection is never automatically resent uncompressed. On a verified 408, diagnostics distinguish original JSON composition from the prepared gzip body size; neither proves delivery or cures every timeout. Installation does not enable the option.
|
|
@@ -265,14 +267,14 @@ Commit attribution uses `Assisted-by` with the actual tool, never the model prov
|
|
|
265
267
|
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.
|
|
266
268
|
|
|
267
269
|
```sh
|
|
268
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
269
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
270
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.127/dsh-github-copilot-0.4.0-alpha.127.tgz
|
|
271
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.127/SHA256SUMS
|
|
270
272
|
sha256sum --check SHA256SUMS
|
|
271
273
|
```
|
|
272
274
|
|
|
273
275
|
```powershell
|
|
274
276
|
$expected = (Get-Content .\SHA256SUMS).Split()[0]
|
|
275
|
-
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.
|
|
277
|
+
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.127.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
|
|
276
278
|
if ($actual -cne $expected) { throw 'Release checksum mismatch' }
|
|
277
279
|
```
|
|
278
280
|
|
package/README.zh.md
CHANGED
|
@@ -24,7 +24,7 @@ Models 和 Chat 共用不透明、随主题适配的账号下拉层;原生菜
|
|
|
24
24
|
|
|
25
25
|
添加账号时,设备授权链接、可选择的网址、一次性授权码、复制授权码和取消操作会同时显示。GitHub 授权完成后,会单独显示身份与可用模型验证阶段。添加账号不会更改全局默认;准备好后仍需显式执行现有的**切换**操作。技术诊断收在次级折叠区;账号/历史 turn 缺少身份时不会暴露不透明账号 ID,也不会根据当前设置推断历史身份。
|
|
26
26
|
|
|
27
|
-
**包版本:`0.4.0-alpha.
|
|
27
|
+
**包版本:`0.4.0-alpha.127`(准备中)。支持宿主:官方 DSH / Windows Desktop `0.2.0-rc.2`。** 较早 DSH pin 仅是历史证据,不是当前安装目标。已发布、已安装到 profile、已被运行中的 Host 加载,是三个不同状态。执行下方带版本的命令前须核验正式发布与资产;这些说明不证明已发布或已安装。
|
|
28
28
|
|
|
29
29
|
## 你可以做什么
|
|
30
30
|
|
|
@@ -83,10 +83,10 @@ node package/scripts/check-search-composition.mjs --profile-dir /absolute/profil
|
|
|
83
83
|
**独立具名 profile**:
|
|
84
84
|
|
|
85
85
|
```sh
|
|
86
|
-
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
86
|
+
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.127/dsh-github-copilot-0.4.0-alpha.127.tgz
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
-
**Desktop** 原生包管理器在发布后接受 `dsh-github-copilot@0.4.0-alpha.
|
|
89
|
+
**Desktop** 原生包管理器在发布后接受 `dsh-github-copilot@0.4.0-alpha.127`。官方 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 或删除配置。
|
|
90
90
|
|
|
91
91
|
经批准 reload/restart 后:
|
|
92
92
|
|
|
@@ -167,6 +167,8 @@ Copilot 搜索要求当前账号/协议证据及能力 proof。固定/fallba
|
|
|
167
167
|
|
|
168
168
|
**“降级续聊”也覆盖本 Session 的原生托管 Responses 压缩,包括自动摘要**:开启后不需要额外手动恢复命令,也不必先失败再重试。发出的输入省略旧加密 reasoning 及其内嵌摘要,隐藏上下文可能丢失;可见消息、工具调用/结果关系和原历史保留,仅由原生事务提交更小的检查点。输入区提示降级,并区分已提交、失败和取消。关闭时,明确的回放作用域拒绝提供同一个带损失说明的开启入口;未知错误不授权降级。`/copilot-compact visible-history` 保留为已选用恢复引擎的一次性高级入口。参见[授权与恢复限制](./docs/manual-compaction-recovery.md#explicit-visible-history-summary-recovery);这不启用缺失的引擎,也不修复容量、额度或超时问题。
|
|
169
169
|
|
|
170
|
+
可见历史压缩进行中时提示持续可见。确认成功后从首次观察起八秒自动消失;失败、取消、状态不可用和开启提示保留至手动**关闭**(或原有**取消**)。关闭仅隐藏当前 Session/操作/状态的提示,不改变授权、历史或原生证据,不发送或重试。Client 注册范围内的有界状态使临时重挂载和会话切换不会重置期限;注册销毁或记录淘汰后不保留。
|
|
171
|
+
|
|
170
172
|
严格核验的 `408 / user_request_timeout`诊断给出有界请求构成和可观察耗时,不证明供应方 payload 上限或根因。图片统计包括原生 Responses 工具输出中的图片;旧的已存诊断可能把这些图片算作剩余历史。字节不是 tokens,耗时不是上传时长;小型无图请求也可能超时。参见[预算与超时指导](./docs/copilot-compaction.md),不要自动裁剪历史、禁用 proof、切换模型或增加重试。
|
|
171
173
|
|
|
172
174
|
实验性配置 `github-copilot.responsesRequestCompression` **默认关闭**。显式开启后,仅通过现有原生 Fetch 接口对符合条件的托管 HTTP Responses 请求进行无损 gzip 编码。请求至少 256 KiB;超过 32 MiB 的压缩工作会跳过,且必须同时节省至少 5% 和 4 KiB;任何跳过都会发送原始请求。这只改变准备发送的 HTTP body 字节,不改变 context/token 准入。自定义 Fetch、显式 `auto`/WebSocket 和其他协议维持原生行为;gzip 被拒绝后绝不会自动改成未压缩请求重发。严格核验的 408 诊断会区分原始 JSON 组成字节与准备发送的 gzip body 大小;两者均不证明请求已送达,也不保证消除超时。安装不会启用此选项。
|
|
@@ -255,14 +257,14 @@ Agent 从 `node scripts/agent.mjs describe --json`、`doctor --json`及`plan <ta
|
|
|
255
257
|
GitHub Releases 和 npm 分发同一原始已校验 tarball。固定版本并核验 Release SHA-256 或 npm `dist.integrity`;不重打包不可变 Release、不移动/复用 tag。
|
|
256
258
|
|
|
257
259
|
```sh
|
|
258
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
259
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
260
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.127/dsh-github-copilot-0.4.0-alpha.127.tgz
|
|
261
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.127/SHA256SUMS
|
|
260
262
|
sha256sum --check SHA256SUMS
|
|
261
263
|
```
|
|
262
264
|
|
|
263
265
|
```powershell
|
|
264
266
|
$expected = (Get-Content .\SHA256SUMS).Split()[0]
|
|
265
|
-
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.
|
|
267
|
+
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.127.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
|
|
266
268
|
if ($actual -cne $expected) { throw 'Release checksum mismatch' }
|
|
267
269
|
```
|
|
268
270
|
|
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.127"
|
|
12
12
|
},
|
|
13
13
|
"evidence": {
|
|
14
14
|
"kind": "source-and-synthetic-test-inventory",
|
|
@@ -603,12 +603,16 @@
|
|
|
603
603
|
{"file": "src/compaction-replay.ts", "marker": "request.purpose !== 'compaction'"},
|
|
604
604
|
{"file": "src/compaction-continuation.ts", "marker": "COPILOT_CONTINUATION_COMPACTION_BOUNDARY_UNAVAILABLE"},
|
|
605
605
|
{"file": "src/compaction-continuation-ui.ts", "marker": "Compacting with visible history"},
|
|
606
|
+
{"file": "src/compaction-continuation-ui.ts", "marker": "const successLifetimeMs = 8000"},
|
|
607
|
+
{"file": "src/replay-recovery-ui.ts", "marker": "presentation.dispose()"},
|
|
606
608
|
{"file": "src/background-compaction.ts", "marker": "visible-history"},
|
|
607
609
|
{"file": "src/background-compaction.ts", "marker": "this.jobs.wait(jobId"},
|
|
608
610
|
{"file": "src/preview-route.ts", "marker": "recoveryLimits(modelId)"},
|
|
609
611
|
{"file": "docs/manual-compaction-recovery.md", "marker": "separately selected"}
|
|
610
612
|
],
|
|
611
613
|
"tests": [
|
|
614
|
+
{"file": "tests/compaction-continuation-ui.spec.ts", "name": "expires eight seconds after first confirmed completion, not rerender, reread or remount"},
|
|
615
|
+
{"file": "tests/compaction-continuation-ui.spec.ts", "name": "keeps unavailable distinct and dismissible without hiding a later failure"},
|
|
612
616
|
{"file": "tests/manual-compaction-recovery.spec.ts", "name": "reduces an oversized balanced history with bounded complete calls and an unmarked aggregate audit"},
|
|
613
617
|
{"file": "tests/compaction-input-estimate.spec.ts", "name": "avoids metadata-driven sixteen-call exhaustion without changing dispatched messages"},
|
|
614
618
|
{"file": "tests/manual-compaction-recovery.spec.ts", "name": "rejects an indivisible span before dispatch and leaves recovery to native failure handling"},
|
|
@@ -49,6 +49,8 @@ Consent is local to the native summarizer's exact cancellation signal, Session a
|
|
|
49
49
|
|
|
50
50
|
The conservative content estimate still includes visible native history before outgoing filtering, but not source/replay metadata. Giant indivisible units, fixed prefixes, native admission, 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.
|
|
51
51
|
|
|
52
|
+
The visible-history composer notice keeps running loss disclosure visible. A confirmed native completion is shown for a fixed eight seconds from the first current Client read, not from a rerender or later read. Success may also be closed early; failed/cancelled/unavailable and blocked enable prompts never auto-expire and have a localized, keyboard-accessible **Close**. The existing blocked prompt **Cancel** also hides only the notice. Neither action changes persistent consent, invokes recovery, sends/retries, or changes native outcome evidence/history. A dismissal applies only to the exact Session, operation and status, never a later running/failed state. Expiry/dismissal survives incidental remounts and Session switches in a Client registration-owned FIFO of at most 128 records; teardown clears it, and an evicted record may be shown again. No disk or module-global cache is used. Component timers stop on unmount/Session changes; departed reads cannot start a lifetime or publish stale status. This transient presentation is not proof of the subsequent chat request succeeding.
|
|
53
|
+
|
|
52
54
|
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.
|
|
53
55
|
|
|
54
56
|
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.
|
package/lib/client.js
CHANGED
|
@@ -6988,7 +6988,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6988
6988
|
};
|
|
6989
6989
|
//#endregion
|
|
6990
6990
|
//#region package.json
|
|
6991
|
-
var version = "0.4.0-alpha.
|
|
6991
|
+
var version = "0.4.0-alpha.127";
|
|
6992
6992
|
//#endregion
|
|
6993
6993
|
//#region lib/types/diagnostics-client.js
|
|
6994
6994
|
let owner;
|
|
@@ -11137,6 +11137,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11137
11137
|
borderRadius: "var(--dsw-radius-md, 8px)",
|
|
11138
11138
|
background: "var(--dsw-alias-interactive-bg-hover, transparent)"
|
|
11139
11139
|
};
|
|
11140
|
+
const composerNoticeQuietButtonStyle = {
|
|
11141
|
+
fontFamily: "inherit",
|
|
11142
|
+
fontSize: "inherit",
|
|
11143
|
+
fontWeight: "inherit",
|
|
11144
|
+
lineHeight: "inherit",
|
|
11145
|
+
color: "inherit",
|
|
11146
|
+
background: "transparent",
|
|
11147
|
+
border: 0,
|
|
11148
|
+
padding: "6px 10px",
|
|
11149
|
+
cursor: "pointer",
|
|
11150
|
+
maxWidth: "100%"
|
|
11151
|
+
};
|
|
11140
11152
|
const composerNoticeParagraphStyle = {
|
|
11141
11153
|
marginBlock: 8,
|
|
11142
11154
|
maxWidth: "38rem"
|
|
@@ -11849,36 +11861,105 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11849
11861
|
}
|
|
11850
11862
|
//#endregion
|
|
11851
11863
|
//#region lib/types/compaction-continuation-ui.js
|
|
11852
|
-
|
|
11864
|
+
const successLifetimeMs = 8e3;
|
|
11865
|
+
/** Presentation only, retained across incidental mounts by the Client slot registration. */
|
|
11866
|
+
var CompactionNoticePresentation = class {
|
|
11867
|
+
entries = /* @__PURE__ */ new Map();
|
|
11868
|
+
listeners = /* @__PURE__ */ new Set();
|
|
11869
|
+
version = 0;
|
|
11870
|
+
subscribe = (listener) => {
|
|
11871
|
+
this.listeners.add(listener);
|
|
11872
|
+
return () => {
|
|
11873
|
+
this.listeners.delete(listener);
|
|
11874
|
+
};
|
|
11875
|
+
};
|
|
11876
|
+
snapshot = () => this.version;
|
|
11877
|
+
key(sessionId, id, state) {
|
|
11878
|
+
return JSON.stringify([
|
|
11879
|
+
sessionId,
|
|
11880
|
+
id,
|
|
11881
|
+
state
|
|
11882
|
+
]);
|
|
11883
|
+
}
|
|
11884
|
+
remember(key, entry) {
|
|
11885
|
+
this.entries.set(key, entry);
|
|
11886
|
+
while (this.entries.size > 128) this.entries.delete(this.entries.keys().next().value);
|
|
11887
|
+
}
|
|
11888
|
+
observe(sessionId, id, state) {
|
|
11889
|
+
const key = this.key(sessionId, id, state);
|
|
11890
|
+
if (state === "completed" && !this.entries.has(key)) this.remember(key, {
|
|
11891
|
+
dismissed: false,
|
|
11892
|
+
expiresAt: Date.now() + successLifetimeMs
|
|
11893
|
+
});
|
|
11894
|
+
}
|
|
11895
|
+
remaining(sessionId, id) {
|
|
11896
|
+
const expiresAt = this.entries.get(this.key(sessionId, id, "completed"))?.expiresAt;
|
|
11897
|
+
return expiresAt === void 0 ? void 0 : Math.max(0, expiresAt - Date.now());
|
|
11898
|
+
}
|
|
11899
|
+
visible(sessionId, id, state) {
|
|
11900
|
+
if (state === "running") return true;
|
|
11901
|
+
const entry = this.entries.get(this.key(sessionId, id, state));
|
|
11902
|
+
return !entry?.dismissed && (entry?.expiresAt === void 0 || entry.expiresAt > Date.now());
|
|
11903
|
+
}
|
|
11904
|
+
dismiss(sessionId, id, state) {
|
|
11905
|
+
if (state === "running") return;
|
|
11906
|
+
const key = this.key(sessionId, id, state);
|
|
11907
|
+
this.remember(key, {
|
|
11908
|
+
...this.entries.get(key),
|
|
11909
|
+
dismissed: true
|
|
11910
|
+
});
|
|
11911
|
+
this.version++;
|
|
11912
|
+
for (const listener of this.listeners) listener();
|
|
11913
|
+
}
|
|
11914
|
+
dispose() {
|
|
11915
|
+
this.entries.clear();
|
|
11916
|
+
this.listeners.clear();
|
|
11917
|
+
}
|
|
11918
|
+
};
|
|
11919
|
+
function CompactionContinuationNotice({ sessionId, remote, lifecycle, locale = "en", presentation: sharedPresentation }) {
|
|
11920
|
+
const [localPresentation] = (0, react.useState)(() => new CompactionNoticePresentation());
|
|
11921
|
+
const presentation = sharedPresentation ?? localPresentation;
|
|
11922
|
+
const version = (0, react.useSyncExternalStore)(presentation.subscribe, presentation.snapshot, presentation.snapshot);
|
|
11923
|
+
const [, refresh] = (0, react.useState)(0);
|
|
11853
11924
|
const parsed = CompactionContinuationLifecycleSchema.safeParse(lifecycle);
|
|
11854
11925
|
const id = parsed.success ? parsed.data.id : null;
|
|
11855
11926
|
const running = parsed.success && parsed.data.running;
|
|
11856
|
-
const [
|
|
11857
|
-
const
|
|
11858
|
-
const
|
|
11927
|
+
const [result, setResult] = (0, react.useState)();
|
|
11928
|
+
const currentResult = result?.sessionId === sessionId && result.id === id && result.remote === remote && result.running === running ? result : void 0;
|
|
11929
|
+
const status = currentResult?.status;
|
|
11930
|
+
const error = currentResult?.error === true;
|
|
11931
|
+
const state = error ? "unavailable" : status?.state;
|
|
11932
|
+
(0, react.useEffect)(() => () => localPresentation.dispose(), [localPresentation]);
|
|
11859
11933
|
(0, react.useEffect)(() => {
|
|
11860
11934
|
let current = true;
|
|
11861
11935
|
let timer;
|
|
11862
|
-
|
|
11863
|
-
|
|
11864
|
-
|
|
11936
|
+
setResult(void 0);
|
|
11937
|
+
if (!id) return;
|
|
11938
|
+
const publish = (status, error) => {
|
|
11939
|
+
if (!current) return;
|
|
11940
|
+
if (status) presentation.observe(sessionId, id, status.state);
|
|
11941
|
+
setResult({
|
|
11942
|
+
sessionId,
|
|
11943
|
+
id,
|
|
11944
|
+
running,
|
|
11945
|
+
remote,
|
|
11946
|
+
status,
|
|
11947
|
+
error
|
|
11948
|
+
});
|
|
11949
|
+
};
|
|
11950
|
+
if (!remote) {
|
|
11951
|
+
publish(void 0, true);
|
|
11952
|
+
return;
|
|
11953
|
+
}
|
|
11865
11954
|
const read = async () => {
|
|
11866
11955
|
try {
|
|
11867
11956
|
const result = await remote.get(sessionId);
|
|
11868
11957
|
const view = result.ok ? SessionContinuationViewSchema.safeParse(result.value) : void 0;
|
|
11869
11958
|
if (!current) return;
|
|
11870
|
-
if (!view?.success)
|
|
11871
|
-
|
|
11872
|
-
setStatus(void 0);
|
|
11873
|
-
} else {
|
|
11874
|
-
setError(false);
|
|
11875
|
-
setStatus(view.data.compaction?.id === id ? view.data.compaction : void 0);
|
|
11876
|
-
}
|
|
11959
|
+
if (!view?.success) publish(void 0, true);
|
|
11960
|
+
else publish(view.data.compaction?.id === id ? view.data.compaction : void 0, false);
|
|
11877
11961
|
} catch {
|
|
11878
|
-
|
|
11879
|
-
setError(true);
|
|
11880
|
-
setStatus(void 0);
|
|
11881
|
-
}
|
|
11962
|
+
publish(void 0, true);
|
|
11882
11963
|
} finally {
|
|
11883
11964
|
if (current && running) timer = setTimeout(() => void read(), 1e3);
|
|
11884
11965
|
}
|
|
@@ -11892,11 +11973,35 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11892
11973
|
sessionId,
|
|
11893
11974
|
remote,
|
|
11894
11975
|
id,
|
|
11895
|
-
running
|
|
11976
|
+
running,
|
|
11977
|
+
presentation
|
|
11978
|
+
]);
|
|
11979
|
+
(0, react.useEffect)(() => {
|
|
11980
|
+
if (!id || state !== "completed" || running || !presentation.visible(sessionId, id, state)) return;
|
|
11981
|
+
const remaining = presentation.remaining(sessionId, id);
|
|
11982
|
+
if (remaining === void 0) return;
|
|
11983
|
+
const timer = setTimeout(() => refresh((value) => value + 1), remaining);
|
|
11984
|
+
return () => clearTimeout(timer);
|
|
11985
|
+
}, [
|
|
11986
|
+
sessionId,
|
|
11987
|
+
id,
|
|
11988
|
+
state,
|
|
11989
|
+
running,
|
|
11990
|
+
presentation,
|
|
11991
|
+
version
|
|
11896
11992
|
]);
|
|
11897
11993
|
const zh = locale.startsWith("zh");
|
|
11898
|
-
if (!
|
|
11899
|
-
|
|
11994
|
+
if (!id || !state || !running && !presentation.visible(sessionId, id, state)) return null;
|
|
11995
|
+
const dismiss = () => {
|
|
11996
|
+
if (!running) presentation.dismiss(sessionId, id, state);
|
|
11997
|
+
};
|
|
11998
|
+
const close = !running && state !== "running" ? (0, react.createElement)("button", {
|
|
11999
|
+
type: "button",
|
|
12000
|
+
style: composerNoticeQuietButtonStyle,
|
|
12001
|
+
onClick: dismiss,
|
|
12002
|
+
"aria-label": zh ? "关闭压缩提示" : "Close compaction notice"
|
|
12003
|
+
}, zh ? "关闭" : "Close") : null;
|
|
12004
|
+
if (status?.state === "blocked") return (0, react.createElement)("section", {
|
|
11900
12005
|
"data-copilot-composer-notice": "compaction-continuation",
|
|
11901
12006
|
style: composerNoticeSurfaceStyle
|
|
11902
12007
|
}, (0, react.createElement)("p", {
|
|
@@ -11907,15 +12012,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11907
12012
|
remote,
|
|
11908
12013
|
locale,
|
|
11909
12014
|
recovery: true,
|
|
11910
|
-
|
|
11911
|
-
|
|
12015
|
+
running,
|
|
12016
|
+
onCancel: dismiss
|
|
12017
|
+
}), close);
|
|
11912
12018
|
const text = error ? zh ? "无法确认压缩降级状态;请查看原生压缩结果。" : "Compaction recovery status is unavailable; check the native compaction result." : status?.state === "running" ? zh ? "正在使用可见历史降级压缩,隐藏推理上下文可能丢失。" : "Compacting with visible history; hidden reasoning context may be lost." : status?.state === "completed" ? zh ? "可见历史压缩已提交;隐藏推理上下文未带入摘要。" : "Visible-history compaction committed; hidden reasoning context was omitted from the summary." : status?.state === "cancelled" ? zh ? "可见历史压缩已取消;未确认提交恢复摘要。" : "Visible-history compaction cancelled; no recovery summary commit is confirmed." : zh ? "可见历史压缩失败;Session 尚未恢复。请查看原生失败原因。" : "Visible-history compaction failed; the Session is not recovered. Check the native failure.";
|
|
11913
12019
|
return (0, react.createElement)("section", {
|
|
11914
12020
|
"data-copilot-composer-notice": "compaction-continuation",
|
|
11915
12021
|
role: error || status?.state === "failed" ? "alert" : "status",
|
|
11916
12022
|
"aria-live": "polite",
|
|
11917
12023
|
style: composerNoticeSurfaceStyle
|
|
11918
|
-
}, (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, text));
|
|
12024
|
+
}, (0, react.createElement)("p", { style: composerNoticeParagraphStyle }, text), close);
|
|
11919
12025
|
}
|
|
11920
12026
|
//#endregion
|
|
11921
12027
|
//#region lib/types/replay-recovery-ui.js
|
|
@@ -12050,7 +12156,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
12050
12156
|
function isRuntime(value) {
|
|
12051
12157
|
return record(value) && typeof value.sessionId === "string" && value.sessionId !== "" && typeof value.useSession === "function" && typeof value.useProjection === "function";
|
|
12052
12158
|
}
|
|
12053
|
-
function Surface({ runtime, remote, continuation, locale }) {
|
|
12159
|
+
function Surface({ runtime, remote, continuation, locale, presentation }) {
|
|
12054
12160
|
const valid = runtime.useSession((value) => record(value) && value.sessionId === runtime.sessionId && value.removed === false && value.openState === "open");
|
|
12055
12161
|
const selected = runtime.useProjection("modelSelection");
|
|
12056
12162
|
const compaction = runtime.useProjection(COMPACTION_CONTINUATION);
|
|
@@ -12062,7 +12168,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
12062
12168
|
sessionId: runtime.sessionId,
|
|
12063
12169
|
remote: continuation,
|
|
12064
12170
|
lifecycle: compaction,
|
|
12065
|
-
locale: language
|
|
12171
|
+
locale: language,
|
|
12172
|
+
presentation
|
|
12066
12173
|
}), (0, react.createElement)(ReplayRecoveryCard, {
|
|
12067
12174
|
key: JSON.stringify([runtime.sessionId, selected.next.model]),
|
|
12068
12175
|
sessionId: runtime.sessionId,
|
|
@@ -12080,11 +12187,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
12080
12187
|
return noop;
|
|
12081
12188
|
}
|
|
12082
12189
|
const slots = candidate;
|
|
12190
|
+
const presentation = new CompactionNoticePresentation();
|
|
12083
12191
|
let faces;
|
|
12084
12192
|
const language = ctx.get("locale");
|
|
12085
12193
|
const locale = isLocale(language) ? language : void 0;
|
|
12086
12194
|
const name = "conversation.input.dock";
|
|
12087
|
-
|
|
12195
|
+
const remove = slots.inject(name, () => {
|
|
12088
12196
|
const spec = slots.spec(name);
|
|
12089
12197
|
if (spec?.kind !== "list" || spec.scope !== "session") {
|
|
12090
12198
|
ctx.logger.warn("COPILOT_REPLAY_RECOVERY_SLOT_UNAVAILABLE");
|
|
@@ -12108,10 +12216,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
12108
12216
|
runtime: props,
|
|
12109
12217
|
remote,
|
|
12110
12218
|
continuation,
|
|
12111
|
-
locale
|
|
12219
|
+
locale,
|
|
12220
|
+
presentation
|
|
12112
12221
|
});
|
|
12113
12222
|
});
|
|
12114
12223
|
});
|
|
12224
|
+
return () => {
|
|
12225
|
+
remove();
|
|
12226
|
+
presentation.dispose();
|
|
12227
|
+
};
|
|
12115
12228
|
}
|
|
12116
12229
|
//#endregion
|
|
12117
12230
|
//#region lib/types/model-preferences-card.js
|