dsh-github-copilot 0.4.0-alpha.95 → 0.4.0-alpha.96

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
@@ -83,7 +83,7 @@ Alpha.25 admits native `subagent/descriptor` v3, already v3 in the retained rc.1
83
83
 
84
84
  ## Non-negotiable invariants
85
85
 
86
- - Explicit replay recovery (#279) is default-off and bound to the initiating native request signal, Session, model and current account proof. Only exact verified scope failures capture bounded full-item fingerprints; no replay bytes reach Client or storage. Two-stage confirmation may omit matching old encrypted items and their item summaries on future outgoing requests, never durable history or new reasoning. Active-turn writes, ambient-scope calls and automatic retries are forbidden. Expiry, disposal and proof discontinuity revoke evidence. See `docs/model-compatibility-acceptance.md`.
86
+ - Explicit replay recovery (#279, #289) is default-off and bound to the initiating native request signal, Session, model and current account proof. Only exact verified scope failures capture bounded full-item fingerprints; no replay bytes reach Client or storage. Public Session running/error snapshots trigger read-only notices on open/settled turns, never polling or durable recovery events. Two-stage confirmation chooses next matching turn (all steps/retries until turn/end) or bounded Session consent, omitting matching old encrypted items and their item summaries only on outgoing requests, never durable history or new reasoning. Preserve get/setEnabled descriptor identities and legacy session-consent semantics; authorize is additive. Active-turn writes, ambient-scope calls and automatic retries are forbidden. Expiry, disposal and proof discontinuity revoke evidence. See `docs/model-compatibility-acceptance.md`.
87
87
 
88
88
  - Do not implement a second general wire adapter or independently maintained static Copilot model catalog. The account-scoped route composes the published adapter and SDK with validated supplier metadata.
89
89
  - Protocol and capability corrections must follow authenticated, current account metadata; new model IDs must not need new implementation tables. Native pi metadata may be reused only where it agrees with advertised endpoints and capabilities. Matching IDs alone do not prove correctness or authorize migration back into another Core catalog. Preserve old bounded ownership journals solely for verified restoration of legacy writes, never for new global protocol overrides.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.0-alpha.96 (prepared)
4
+
5
+ - Surface verified replay-recovery evidence automatically when an eligible Session opens or its native turn settles; ordinary conversations remain uncluttered (#289).
6
+ - Add explicit next-matching-turn or bounded Session consent, defaulting the choice to one turn. All native steps/retries share that turn's authorization, which is consumed at turn end. Confirmation never sends or retries a message.
7
+ - Preserve exact-item/proof guards, old Remote identities and native history ownership. Add native gateway and desktop/mobile component coverage, local dismissal, explicit read failures and expiry updates. This is not a supplier 408 fix.
8
+
3
9
  ## 0.4.0-alpha.95 (prepared)
4
10
 
5
11
  - Preserve native usage and chunk order before restoring dispatch-local byte-idle or replay errors (#285). Previously the owned error could be thrown before the SDK's terminal usage, discarding both failed-zero and real nonzero samples.
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  GitHub Copilot account discovery, contextual Auto routing and hosted search for DSH. The plugin reuses DSH's published native adapter and one Host-owned OAuth account; it does not patch Core or maintain a second model catalog.
10
10
 
11
- **Source candidate: `0.4.0-alpha.95` (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.
11
+ **Source candidate: `0.4.0-alpha.96` (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.
12
12
 
13
13
  ## What you can do
14
14
 
@@ -40,10 +40,10 @@ Supply any launcher patches with repeated `--patch /absolute/file`. Require `sup
40
40
  For a **standalone named profile**:
41
41
 
42
42
  ```sh
43
- dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.95/dsh-github-copilot-0.4.0-alpha.95.tgz
43
+ dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.96/dsh-github-copilot-0.4.0-alpha.96.tgz
44
44
  ```
45
45
 
46
- For **Desktop**, its native package manager accepts `dsh-github-copilot@0.4.0-alpha.95` 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.
46
+ For **Desktop**, its native package manager accepts `dsh-github-copilot@0.4.0-alpha.96` 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.
47
47
 
48
48
  After an approved reload/restart:
49
49
 
@@ -134,7 +134,7 @@ Configuration is under `github-copilot`. Credentials, endpoint definitions and a
134
134
  | Selection unknown/unavailable | Distinguish lost evidence from read failure; Retry only rereads |
135
135
  | Missing/cancelled Turn Usage | Read [usage limitations](./docs/copilot-usage.md); do not infer zero billing |
136
136
  | History fails on `github-copilot/auto-model-decision` | Use [detached, check-first recovery](./docs/automatic-model-routing.md#recovering-affected-histories); never replace live history without stopped writers and approval |
137
- | AUTH, Responses replay-scope or TLS failure | Review [request diagnostics](./docs/model-compatibility-acceptance.md#authentication-replay-and-request-diagnostics) and [usage TLS boundaries](./docs/copilot-usage.md#account-data-boundary). After an exact scope rejection, the session's **Replay recovery** offers default-off, explicit loss confirmation for matching old encrypted items and their summaries. It never rewrites stored history or retries automatically, and is not a 408 fix. Never reset credentials or disable TLS as an automatic repair. |
137
+ | AUTH, Responses replay-scope or TLS failure | Review [request diagnostics](./docs/model-compatibility-acceptance.md#authentication-replay-and-request-diagnostics) and [usage TLS boundaries](./docs/copilot-usage.md#account-data-boundary). After an exact scope rejection, **Replay recovery** appears automatically when the session's turn ends or the session opens. Review the loss of matching old encrypted items and their summaries, then authorize **Next matching turn only** (default choice) or **Continue in this session**. Both expire within one hour of the evidence and require the same validation state. Recovery itself stays off until confirmed; use native Send/Retry separately. It never rewrites history or retries automatically, and is not a 408 fix. Never reset credentials or disable TLS as an automatic repair. |
138
138
  | Hosted search unavailable | Check account/protocol/probe diagnostics; a legacy override stays authoritative until explicitly reset |
139
139
 
140
140
  ## Ownership and further reading
@@ -175,14 +175,14 @@ Commit attribution uses `Assisted-by` with the actual tool, never the model prov
175
175
  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.
176
176
 
177
177
  ```sh
178
- curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.95/dsh-github-copilot-0.4.0-alpha.95.tgz
179
- curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.95/SHA256SUMS
178
+ curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.96/dsh-github-copilot-0.4.0-alpha.96.tgz
179
+ curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.96/SHA256SUMS
180
180
  sha256sum --check SHA256SUMS
181
181
  ```
182
182
 
183
183
  ```powershell
184
184
  $expected = (Get-Content .\SHA256SUMS).Split()[0]
185
- $actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.95.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
185
+ $actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.96.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
186
186
  if ($actual -cne $expected) { throw 'Release checksum mismatch' }
187
187
  ```
188
188
 
package/README.zh.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  为 DSH 提供 GitHub Copilot 账号模型发现、上下文 Auto 选模和 hosted search。插件复用 DSH 公开的原生适配器与一个 Host 端 OAuth 账号,不修改 Core,也不维护第二套模型目录。
10
10
 
11
- **源码候选版本:`0.4.0-alpha.95`(尚未发布)。支持宿主:官方 DSH / Windows Desktop `0.2.0-rc.2`。** 较早 DSH pin 仅是历史证据,不是当前安装目标。已发布、已安装到 profile、已被运行中的 Host 加载,是三个不同状态。下方带版本的命令适用于候选版本发布后,不代表对应资产已经存在。
11
+ **源码候选版本:`0.4.0-alpha.96`(尚未发布)。支持宿主:官方 DSH / Windows Desktop `0.2.0-rc.2`。** 较早 DSH pin 仅是历史证据,不是当前安装目标。已发布、已安装到 profile、已被运行中的 Host 加载,是三个不同状态。下方带版本的命令适用于候选版本发布后,不代表对应资产已经存在。
12
12
 
13
13
  ## 你可以做什么
14
14
 
@@ -40,10 +40,10 @@ node package/scripts/check-search-composition.mjs --profile-dir /absolute/profil
40
40
  **独立具名 profile**:
41
41
 
42
42
  ```sh
43
- dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.95/dsh-github-copilot-0.4.0-alpha.95.tgz
43
+ dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.96/dsh-github-copilot-0.4.0-alpha.96.tgz
44
44
  ```
45
45
 
46
- **Desktop** 原生包管理器在发布后接受 `dsh-github-copilot@0.4.0-alpha.95`。官方 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 或删除配置。
46
+ **Desktop** 原生包管理器在发布后接受 `dsh-github-copilot@0.4.0-alpha.96`。官方 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 或删除配置。
47
47
 
48
48
  经批准 reload/restart 后:
49
49
 
@@ -134,7 +134,7 @@ HTTP/SSE liveness 默认区分 5 分钟字节 idle 和有界的 10 分钟助手
134
134
  | 选模未知/不可读 | 区分记录丢失与读取失败;Retry 只重读 |
135
135
  | 缺失/取消后的 Turn Usage | 查看[用量限制](./docs/copilot-usage.md),不推断零计费 |
136
136
  | 历史加载报 `github-copilot/auto-model-decision` | 使用[独立副本、先检查的恢复](./docs/automatic-model-routing.md#recovering-affected-histories);未经批准且未停写不得替换实际历史 |
137
- | AUTH、Responses replay scope 或 TLS 错误 | 查看[请求诊断](./docs/model-compatibility-acceptance.md#authentication-replay-and-request-diagnostics)及[额度 TLS 边界](./docs/copilot-usage.md#account-data-boundary)。精确 scope 拒绝后,会话的**回放恢复**可在明确接受损失后启用,仅跳过匹配的旧加密项及项内摘要,默认关闭。不改磁盘历史、不自动重试,也不是 408 修复。不自动重置凭据或关闭 TLS。 |
137
+ | AUTH、Responses replay scope 或 TLS 错误 | 查看[请求诊断](./docs/model-compatibility-acceptance.md#authentication-replay-and-request-diagnostics)及[额度 TLS 边界](./docs/copilot-usage.md#account-data-boundary)。精确 scope 拒绝后,**回放恢复**会在当前轮结束或打开会话时自动提示。查看旧加密项及项内摘要的损失后,可选择**仅下一轮使用恢复**(默认选项)或**在本会话内继续使用**;两者都要求验证状态不变,最长不超过证据产生后一小时。恢复默认关闭,确认授权也不发送消息,需另行使用原生发送或重试。不改磁盘历史,也不是 408 修复。不自动重置凭据或关闭 TLS。 |
138
138
  | Hosted search 不可用 | 检查账号/协议/probe 诊断;旧 override 保留至显式 reset |
139
139
 
140
140
  ## 所有权与深入阅读
@@ -175,14 +175,14 @@ Agent 从 `node scripts/agent.mjs describe --json`、`doctor --json`及`plan <ta
175
175
  GitHub Releases 和 npm 分发同一原始已校验 tarball。固定版本并核验 Release SHA-256 或 npm `dist.integrity`;不重打包不可变 Release、不移动/复用 tag。
176
176
 
177
177
  ```sh
178
- curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.95/dsh-github-copilot-0.4.0-alpha.95.tgz
179
- curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.95/SHA256SUMS
178
+ curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.96/dsh-github-copilot-0.4.0-alpha.96.tgz
179
+ curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.96/SHA256SUMS
180
180
  sha256sum --check SHA256SUMS
181
181
  ```
182
182
 
183
183
  ```powershell
184
184
  $expected = (Get-Content .\SHA256SUMS).Split()[0]
185
- $actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.95.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
185
+ $actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.96.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
186
186
  if ($actual -cne $expected) { throw 'Release checksum mismatch' }
187
187
  ```
188
188
 
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "package": {
10
10
  "name": "dsh-github-copilot",
11
- "version": "0.4.0-alpha.95"
11
+ "version": "0.4.0-alpha.96"
12
12
  },
13
13
  "evidence": {
14
14
  "kind": "source-and-synthetic-test-inventory",
@@ -690,13 +690,16 @@
690
690
  {"file": "src/replay-recovery-host.ts", "marker": "extends TypertRemoteService"},
691
691
  {"file": "src/replay-recovery-host.ts", "marker": "COPILOT_REPLAY_RECOVERY_TURN_ACTIVE"},
692
692
  {"file": "src/replay-recovery-remote.ts", "marker": "githubCopilotReplayRecovery.setEnabled"},
693
- {"file": "src/replay-recovery-ui.ts", "marker": "Accept loss and enable"}
693
+ {"file": "src/replay-recovery-remote.ts", "marker": "githubCopilotReplayRecovery.authorize"},
694
+ {"file": "src/replay-recovery-ui.ts", "marker": "Accept loss and authorize"}
694
695
  ],
695
696
  "tests": [
696
697
  {"file": "tests/replay-recovery.spec.ts", "name": "keeps default replay and requires a revision-bound confirmation"},
697
698
  {"file": "tests/replay-recovery.spec.ts", "name": "preserves source, fresh reasoning, tools, other models and other owners"},
698
699
  {"file": "tests/replay-recovery-host.spec.ts", "name": "requires the native initiating session and signal, rejects active-turn writes and revokes late requests"},
699
- {"file": "tests/replay-recovery-ui.spec.ts", "name": "requires an explicit loss confirmation, never submits a message and sends the read revision"},
700
+ {"file": "tests/replay-recovery.spec.ts", "name": "admits only the next matching native turn, including its steps and retries"},
701
+ {"file": "tests/replay-recovery-ui.spec.ts", "name": "automatically shows evidence but requires explicit %s consent, without sending"},
702
+ {"file": "tests/replay-recovery-ui.spec.ts", "name": "is absent normally, reads on settled turns without polling and resets dismissal only for new evidence"},
700
703
  {"file": "tests/preview-route.spec.ts", "name": "offers exact failed replay only to its initiating session and recovers after explicit confirmation"},
701
704
  {"file": "tests/fixtures/remote-core.fixture.ts", "name": "binds explicit replay recovery through native Client and %s Host gateways"}
702
705
  ]
@@ -91,11 +91,26 @@ IDs does not prove encrypted replay is portable.
91
91
  ### Explicit session replay recovery
92
92
 
93
93
  After an exact verified managed Responses scope rejection, **Replay recovery**
94
- in that session's composer can offer the failed request's old encrypted items.
95
- Open it, read the evidence, wait for the active turn to finish, choose **Review
96
- activation**, then **Accept loss and enable**. It does not send a message or
97
- retry the failed request. The user chooses whether to submit a subsequent turn.
98
- The default remains complete native replay.
94
+ in that session's composer automatically offers the failed request's old
95
+ encrypted items on opening the eligible session, when its native `running`
96
+ snapshot settles, or when its `lastAgentError` changes while idle. These public
97
+ Session snapshot changes trigger read-only Host evidence reads, not model calls,
98
+ history reads, new durable events or polling. Normal sessions show no notice.
99
+ Dismissal is local to the mounted model/session and evidence revision; a new
100
+ failure can reappear. Read errors remain distinct from missing evidence.
101
+
102
+ Choose **Review recovery options**, then **Next matching turn only** (the
103
+ default choice) or **Continue in this session**, and **Accept loss and authorize**.
104
+ This does not send a message or retry the failed request. Use the native Send or
105
+ Retry control separately; the plugin adds no competing sender. Complete native
106
+ replay remains the default until explicit consent.
107
+
108
+ Next-turn consent is admitted on the next bound, matching-model native request
109
+ and covers all steps and native retries of that turn, not just one HTTP attempt.
110
+ It is consumed at that turn's `turn/end`, including cancelled/failed turns.
111
+ Other models, purposes and unbound requests cannot consume it. Session consent
112
+ survives turn endings but shares the same bounded evidence/proof lifetime.
113
+ Controls are disabled during a native turn; Host checks remain authoritative.
99
114
 
100
115
  This is lossy recovery, not a supplier-scope repair. Only complete normalized
101
116
  encrypted reasoning items whose entire serialized fingerprints match that
@@ -107,8 +122,12 @@ requires fresh confirmation rather than broadening enabled omission silently.
107
122
 
108
123
  Evidence is bounded to 64 sessions, 512 distinct items per session, and one
109
124
  hour in the current Host. Only hashes, a model label and confirmation metadata
110
- are retained, never opaque payloads. The Client receives count/model/state and
111
- an opaque revision only. Token/account/metadata proof discontinuity, expiry,
125
+ are retained, never opaque payloads. The Client receives count/model/state,
126
+ an opaque revision, optional duration and evidence expiry only. The original
127
+ `get`/`setEnabled` descriptors retain their identities; `setEnabled(true)` still
128
+ means bounded session consent, and additive `authorize` selects a duration.
129
+ A one-shot expiry read updates the mounted notice, not a polling timer.
130
+ Token/account/metadata proof discontinuity, expiry,
112
131
  session disposal or Host restart revokes evidence; an old error on disk cannot
113
132
  create a candidate. Re-read status after these changes. Disabling affects
114
133
  future requests and does not undo answers already generated.
package/lib/client.js CHANGED
@@ -5781,11 +5781,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5781
5781
  };
5782
5782
  //#endregion
5783
5783
  //#region lib/types/replay-recovery-types.js
5784
+ const ReplayRecoveryDurationSchema = _enum(["next-turn", "session"]);
5784
5785
  const ReplayRecoveryViewSchema = discriminatedUnion("state", [object({ state: literal("unavailable") }).strict(), object({
5785
5786
  state: _enum(["available", "enabled"]),
5786
5787
  revision: string().uuid(),
5787
5788
  itemCount: number().int().positive().max(512),
5788
- model: string().min(1).max(256)
5789
+ model: string().min(1).max(256),
5790
+ duration: ReplayRecoveryDurationSchema.optional(),
5791
+ expiresAt: number().int().nonnegative().optional()
5789
5792
  }).strict()]);
5790
5793
  //#endregion
5791
5794
  //#region lib/types/replay-recovery-remote.js
@@ -5798,37 +5801,63 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5798
5801
  };
5799
5802
  const contribution$1 = {
5800
5803
  package: "dsh-github-copilot",
5801
- descriptors: [{
5802
- id: "dsh-github-copilot:githubCopilotReplayRecovery.get",
5803
- namespace: "githubCopilotReplayRecovery",
5804
- service: "githubCopilotReplayRecovery",
5805
- method: "get",
5806
- invocation: { kind: "direct" },
5807
- parameters: [agent],
5808
- result: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryView", ReplayRecoveryViewSchema)
5809
- }, {
5810
- id: "dsh-github-copilot:githubCopilotReplayRecovery.setEnabled",
5811
- namespace: "githubCopilotReplayRecovery",
5812
- service: "githubCopilotReplayRecovery",
5813
- method: "setEnabled",
5814
- invocation: { kind: "direct" },
5815
- parameters: [
5816
- agent,
5817
- {
5818
- name: "revision",
5819
- wire: "revision",
5820
- source: "json",
5821
- codec: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryRevision", string().uuid())
5822
- },
5823
- {
5824
- name: "enabled",
5825
- wire: "enabled",
5826
- source: "json",
5827
- codec: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryEnabled", boolean())
5828
- }
5829
- ],
5830
- result: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryView", ReplayRecoveryViewSchema)
5831
- }]
5804
+ descriptors: [
5805
+ {
5806
+ id: "dsh-github-copilot:githubCopilotReplayRecovery.get",
5807
+ namespace: "githubCopilotReplayRecovery",
5808
+ service: "githubCopilotReplayRecovery",
5809
+ method: "get",
5810
+ invocation: { kind: "direct" },
5811
+ parameters: [agent],
5812
+ result: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryView", ReplayRecoveryViewSchema)
5813
+ },
5814
+ {
5815
+ id: "dsh-github-copilot:githubCopilotReplayRecovery.authorize",
5816
+ namespace: "githubCopilotReplayRecovery",
5817
+ service: "githubCopilotReplayRecovery",
5818
+ method: "authorize",
5819
+ invocation: { kind: "direct" },
5820
+ parameters: [
5821
+ agent,
5822
+ {
5823
+ name: "revision",
5824
+ wire: "revision",
5825
+ source: "json",
5826
+ codec: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryRevision", string().uuid())
5827
+ },
5828
+ {
5829
+ name: "duration",
5830
+ wire: "duration",
5831
+ source: "json",
5832
+ codec: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryDuration", ReplayRecoveryDurationSchema)
5833
+ }
5834
+ ],
5835
+ result: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryView", ReplayRecoveryViewSchema)
5836
+ },
5837
+ {
5838
+ id: "dsh-github-copilot:githubCopilotReplayRecovery.setEnabled",
5839
+ namespace: "githubCopilotReplayRecovery",
5840
+ service: "githubCopilotReplayRecovery",
5841
+ method: "setEnabled",
5842
+ invocation: { kind: "direct" },
5843
+ parameters: [
5844
+ agent,
5845
+ {
5846
+ name: "revision",
5847
+ wire: "revision",
5848
+ source: "json",
5849
+ codec: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryRevision", string().uuid())
5850
+ },
5851
+ {
5852
+ name: "enabled",
5853
+ wire: "enabled",
5854
+ source: "json",
5855
+ codec: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryEnabled", boolean())
5856
+ }
5857
+ ],
5858
+ result: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryView", ReplayRecoveryViewSchema)
5859
+ }
5860
+ ]
5832
5861
  };
5833
5862
  //#endregion
5834
5863
  //#region lib/types/remote.js
@@ -8770,13 +8799,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8770
8799
  function record(value) {
8771
8800
  return value !== null && typeof value === "object" && !Array.isArray(value);
8772
8801
  }
8773
- function ReplayRecoveryCard({ sessionId, remote, locale = "en" }) {
8802
+ function ReplayRecoveryCard({ sessionId, remote, locale = "en", running = false, refreshKey = "" }) {
8774
8803
  const zh = locale.startsWith("zh");
8804
+ const durationName = (0, react.useId)();
8775
8805
  const [view, setView] = (0, react.useState)();
8776
8806
  const [busy, setBusy] = (0, react.useState)(false);
8777
8807
  const [error, setError] = (0, react.useState)(false);
8778
8808
  const [confirm, setConfirm] = (0, react.useState)(false);
8809
+ const [duration, setDuration] = (0, react.useState)("next-turn");
8810
+ const [dismissed, setDismissed] = (0, react.useState)();
8811
+ const [hadEvidence, setHadEvidence] = (0, react.useState)(false);
8812
+ const latest = (0, react.useRef)(view);
8813
+ const active = (0, react.useRef)(running);
8814
+ latest.current = view;
8815
+ active.current = running;
8779
8816
  const pending = (0, react.useRef)(false);
8817
+ const refreshPending = (0, react.useRef)(false);
8780
8818
  const mounted = (0, react.useRef)(true);
8781
8819
  (0, react.useEffect)(() => {
8782
8820
  mounted.current = true;
@@ -8784,18 +8822,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8784
8822
  mounted.current = false;
8785
8823
  };
8786
8824
  }, []);
8787
- const perform = async (enabled) => {
8788
- if (pending.current) return;
8825
+ const perform = (0, react.useCallback)(async (authorization) => {
8826
+ if (pending.current) {
8827
+ if (authorization === void 0) refreshPending.current = true;
8828
+ return;
8829
+ }
8830
+ if (active.current) return;
8789
8831
  pending.current = true;
8790
8832
  setBusy(true);
8791
8833
  setError(false);
8792
8834
  setConfirm(false);
8793
8835
  try {
8794
- const result = enabled === void 0 ? await remote.get(sessionId) : view && view.state !== "unavailable" ? await remote.setEnabled(sessionId, view.revision, enabled) : void 0;
8836
+ const current = latest.current;
8837
+ const result = authorization === void 0 ? await remote.get(sessionId) : current && current.state !== "unavailable" ? authorization === false ? await remote.setEnabled(sessionId, current.revision, false) : await remote.authorize(sessionId, current.revision, authorization) : void 0;
8795
8838
  const parsed = result?.ok ? ReplayRecoveryViewSchema.safeParse(result.value) : void 0;
8796
8839
  if (!mounted.current) return;
8797
- if (parsed?.success) setView(parsed.data);
8798
- else {
8840
+ if (parsed?.success) {
8841
+ setView(parsed.data);
8842
+ if (parsed.data.state !== "unavailable") setHadEvidence(true);
8843
+ } else {
8799
8844
  setView(void 0);
8800
8845
  setError(true);
8801
8846
  }
@@ -8806,9 +8851,29 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8806
8851
  }
8807
8852
  } finally {
8808
8853
  pending.current = false;
8809
- if (mounted.current) setBusy(false);
8854
+ if (mounted.current) {
8855
+ setBusy(false);
8856
+ if (refreshPending.current) {
8857
+ refreshPending.current = false;
8858
+ perform();
8859
+ }
8860
+ }
8810
8861
  }
8811
- };
8862
+ }, [remote, sessionId]);
8863
+ (0, react.useEffect)(() => {
8864
+ setConfirm(false);
8865
+ if (!running) perform();
8866
+ }, [
8867
+ running,
8868
+ refreshKey,
8869
+ perform
8870
+ ]);
8871
+ const expiresAt = view && view.state !== "unavailable" ? view.expiresAt : void 0;
8872
+ (0, react.useEffect)(() => {
8873
+ if (expiresAt === void 0) return;
8874
+ const timer = setTimeout(() => void perform(), Math.max(0, expiresAt - Date.now()));
8875
+ return () => clearTimeout(timer);
8876
+ }, [expiresAt, perform]);
8812
8877
  const button = {
8813
8878
  font: "inherit",
8814
8879
  color: "inherit",
@@ -8817,38 +8882,79 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8817
8882
  borderRadius: 6,
8818
8883
  padding: "6px 10px"
8819
8884
  };
8820
- return (0, react.createElement)("details", {
8885
+ const disabled = busy || running;
8886
+ const evidence = view && view.state !== "unavailable" ? view : void 0;
8887
+ if (!error && !evidence && !hadEvidence) return null;
8888
+ if (!error && evidence?.state === "available" && dismissed === evidence.revision) return (0, react.createElement)("button", {
8889
+ type: "button",
8890
+ style: button,
8891
+ disabled,
8892
+ onClick: () => setDismissed(void 0)
8893
+ }, zh ? "回放恢复 · 查看" : "Replay recovery · Review");
8894
+ return (0, react.createElement)("section", {
8895
+ "aria-label": zh ? "回放恢复" : "Replay recovery",
8896
+ "aria-busy": busy,
8821
8897
  style: {
8822
8898
  maxWidth: "min(100%, 38rem)",
8823
- overflowWrap: "anywhere"
8824
- },
8825
- onToggle: (event) => {
8826
- if (event.currentTarget.open && view === void 0 && !busy && !error) perform();
8899
+ overflowWrap: "anywhere",
8900
+ paddingBlock: 8
8827
8901
  }
8828
- }, (0, react.createElement)("summary", { style: { cursor: "pointer" } }, zh ? "回放恢复" : "Replay recovery"), (0, react.createElement)("p", null, zh ? "仅用于 Copilot 的旧加密推理回放被拒绝。不会处理 408、额度或上下文超限。" : "For rejected old Copilot encrypted reasoning only. Not a remedy for 408, quota or context limits."), busy ? (0, react.createElement)("p", { role: "status" }, zh ? "正在处理…" : "Working…") : null, error ? (0, react.createElement)("p", { role: "alert" }, zh ? "无法读取或更改恢复状态。请等当前轮结束后重新读取;旧确认可能已过期。" : "Recovery could not be read or changed. Wait for the active turn to end and read again; the prior confirmation may have expired.") : null, view?.state === "unavailable" ? (0, react.createElement)("p", null, zh ? "没有当前可用的失败证据。仅保留本次 Host 运行中、同一账号验证状态下最近一小时的证据。" : "No current failure evidence. Evidence lasts at most one hour in this Host under the same account validation state.") : null, view && view.state !== "unavailable" ? (0, react.createElement)("div", null, (0, react.createElement)("p", null, zh ? `${view.model}:${view.itemCount} 条旧加密推理项。${view.state === "enabled" ? "恢复已启用。" : "默认保留完整回放。"}` : `${view.model}: ${view.itemCount} old encrypted reasoning items. ${view.state === "enabled" ? "Recovery enabled." : "Full replay is retained by default."}`), (0, react.createElement)("p", null, zh ? "启用后,仅本会话后续请求跳过这些已识别的旧项,包括对应隐藏推理状态及项内摘要。磁盘历史、界面可见消息及工具调用保持不变;新推理照常保留。不会自动重试或发送消息。关闭只影响后续请求,不能撤销已生成的回答。" : "Enabling skips these identified old items only on later requests in this session, including their hidden reasoning state and item summaries. Stored history, displayed messages and tool calls stay unchanged; new reasoning is retained. No retry or message is sent automatically. Disabling affects later requests and cannot undo generated answers."), confirm ? (0, react.createElement)("div", null, (0, react.createElement)("p", null, zh ? "确认接受上述隐藏推理状态损失?" : "Accept the hidden-reasoning loss described above?"), (0, react.createElement)("button", {
8902
+ }, (0, react.createElement)("strong", { role: "status" }, evidence?.state === "enabled" ? zh ? "回放恢复已授权" : "Replay recovery authorized" : evidence ? zh ? "旧推理回放被拒绝" : "Old reasoning replay was rejected" : zh ? "回放恢复" : "Replay recovery"), error ? (0, react.createElement)("p", { role: "alert" }, zh ? "无法读取或更改恢复状态。请等当前轮结束后重新读取;旧确认可能已过期。" : "Recovery could not be read or changed. Wait for the active turn to end and read again; the prior confirmation may have expired.") : null, view?.state === "unavailable" ? (0, react.createElement)("p", null, zh ? "授权或失败证据已失效。恢复未启用;没有当前可用的失败证据。" : "Authorization or failure evidence expired. Recovery is off; no current failure evidence is available.") : null, evidence ? (0, react.createElement)("div", null, (0, react.createElement)("p", null, zh ? `${evidence.model}:${evidence.itemCount} 条已识别的旧加密推理项。` : `${evidence.model}: ${evidence.itemCount} identified old encrypted reasoning items.`), evidence.state === "enabled" ? (0, react.createElement)("p", null, evidence.duration === "next-turn" ? zh ? "仅下一轮使用恢复,覆盖该轮的全部步骤与原生重试,轮结束即关闭。" : "Authorized for the next matching turn only, including all its steps and native retries; turns off when that turn ends." : zh ? "本会话继续使用恢复,直到关闭或验证状态失效。" : "Authorized for this session until disabled or validation expires.", " ", zh ? "尚未发送消息。请使用原生发送或重试按钮继续。" : "No message has been sent. Use the native Send or Retry control to continue.") : (0, react.createElement)("p", null, zh ? "恢复未启用。确认损失后才能跳过这些旧项;不会自动重试。" : "Recovery is off. Review the loss before skipping these old items; nothing is retried automatically."), confirm ? (0, react.createElement)("div", null, (0, react.createElement)("p", null, zh ? "恢复会跳过已识别的旧项,包括对应隐藏推理状态及项内摘要。磁盘历史、界面可见消息及工具调用保持不变;新推理照常保留。关闭不能撤销已生成的回答。" : "Recovery skips the identified old items, including their hidden reasoning state and item summaries. Stored history, displayed messages and tool calls stay unchanged; new reasoning is retained. Disabling cannot undo generated answers."), (0, react.createElement)("fieldset", {
8903
+ disabled,
8904
+ style: {
8905
+ border: 0,
8906
+ padding: 0,
8907
+ marginBlock: 12
8908
+ }
8909
+ }, (0, react.createElement)("legend", null, zh ? "授权范围" : "Authorization duration"), ...["next-turn", "session"].map((value) => (0, react.createElement)("label", {
8910
+ key: value,
8911
+ style: {
8912
+ display: "block",
8913
+ paddingBlock: 6
8914
+ }
8915
+ }, (0, react.createElement)("input", {
8916
+ type: "radio",
8917
+ name: durationName,
8918
+ value,
8919
+ checked: duration === value,
8920
+ onChange: () => setDuration(value)
8921
+ }), " ", value === "next-turn" ? zh ? "仅下一轮使用恢复" : "Next matching turn only" : zh ? "在本会话内继续使用" : "Continue in this session"))), (0, react.createElement)("p", null, zh ? "两种授权都只适用于相同模型及验证状态,最长不超过失败证据产生后一小时;Host 重启后失效。不会处理 408、额度或上下文超限。" : "Both options require the same model and validation state, expire within one hour of the failure, and are lost on Host restart. Not a remedy for 408, quota or context limits."), (0, react.createElement)("div", { style: {
8922
+ display: "flex",
8923
+ flexWrap: "wrap",
8924
+ gap: 8
8925
+ } }, (0, react.createElement)("button", {
8829
8926
  type: "button",
8830
8927
  style: button,
8831
- disabled: busy,
8832
- onClick: () => void perform(true)
8833
- }, zh ? "接受损失并启用" : "Accept loss and enable"), (0, react.createElement)("button", {
8928
+ disabled,
8929
+ onClick: () => void perform(duration)
8930
+ }, zh ? "接受损失并授权" : "Accept loss and authorize"), (0, react.createElement)("button", {
8834
8931
  type: "button",
8835
8932
  style: button,
8836
- disabled: busy,
8933
+ disabled,
8837
8934
  onClick: () => setConfirm(false)
8838
- }, zh ? "取消" : "Cancel")) : (0, react.createElement)("button", {
8935
+ }, zh ? "取消" : "Cancel"))) : (0, react.createElement)("div", { style: {
8936
+ display: "flex",
8937
+ flexWrap: "wrap",
8938
+ gap: 8
8939
+ } }, (0, react.createElement)("button", {
8839
8940
  type: "button",
8840
8941
  style: button,
8841
- disabled: busy,
8842
- onClick: () => view.state === "enabled" ? void perform(false) : setConfirm(true)
8843
- }, view.state === "enabled" ? zh ? "关闭恢复" : "Disable recovery" : zh ? "查看启用确认" : "Review activation")) : null, (0, react.createElement)("button", {
8942
+ disabled,
8943
+ onClick: () => evidence.state === "enabled" ? void perform(false) : (setDuration("next-turn"), setConfirm(true))
8944
+ }, evidence.state === "enabled" ? zh ? "关闭恢复" : "Disable recovery" : zh ? "查看恢复选项" : "Review recovery options"), evidence.state === "available" ? (0, react.createElement)("button", {
8945
+ type: "button",
8946
+ style: button,
8947
+ disabled,
8948
+ onClick: () => setDismissed(evidence.revision)
8949
+ }, zh ? "暂不处理" : "Not now") : null)) : null, running ? (0, react.createElement)("p", { role: "status" }, zh ? "当前轮进行中,结束后自动更新。" : "Turn in progress; status updates when it ends.") : null, (0, react.createElement)("button", {
8844
8950
  type: "button",
8845
8951
  style: {
8846
8952
  ...button,
8847
8953
  marginBlock: 8
8848
8954
  },
8849
- disabled: busy,
8955
+ disabled,
8850
8956
  onClick: () => void perform()
8851
- }, zh ? "重新读取状态" : "Read status again"));
8957
+ }, busy ? zh ? "正在读取…" : "Reading…" : zh ? "重新读取状态" : "Read status again"));
8852
8958
  }
8853
8959
  function isSlots(value) {
8854
8960
  return record(value) && typeof value.spec === "function" && typeof value.inject === "function" && typeof value.register === "function";
@@ -8862,13 +8968,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8862
8968
  function Surface({ runtime, remote, locale }) {
8863
8969
  const valid = runtime.useSession((value) => record(value) && value.sessionId === runtime.sessionId && value.removed === false && value.openState === "open");
8864
8970
  const selected = runtime.useProjection("modelSelection");
8971
+ const running = runtime.useSession((value) => !record(value) || value.running !== false);
8972
+ const lastError = runtime.useSession((value) => record(value) && typeof value.lastAgentError === "string" ? value.lastAgentError : "");
8865
8973
  const language = (0, react.useSyncExternalStore)((listener) => locale?.subscribe(listener) ?? noop, () => locale?.getLocale().active ?? "en", () => "en");
8866
8974
  if (!valid || !record(selected) || !record(selected.next) || selected.next.provider !== "github-copilot-preview") return null;
8867
8975
  return (0, react.createElement)(ReplayRecoveryCard, {
8868
- key: runtime.sessionId,
8976
+ key: JSON.stringify([runtime.sessionId, selected.next.model]),
8869
8977
  sessionId: runtime.sessionId,
8870
8978
  remote,
8871
- locale: language
8979
+ locale: language,
8980
+ running,
8981
+ refreshKey: lastError
8872
8982
  });
8873
8983
  }
8874
8984
  function registerReplayRecoveryUi(ctx) {