dsh-github-copilot 0.4.0-alpha.108 → 0.4.0-alpha.110
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 +3 -1
- package/CHANGELOG.md +15 -0
- package/README.md +12 -8
- package/README.zh.md +12 -8
- package/deployment-baseline.json +32 -4
- package/docs/account-management-experience.md +106 -0
- package/docs/copilot-accounts.md +12 -4
- package/docs/mockups/copilot-account-dropdown.html +71 -0
- package/docs/mockups/copilot-account-management.html +393 -0
- package/docs/model-compatibility-acceptance.md +13 -12
- package/docs/session-continuation.md +90 -0
- package/lib/client.js +1084 -238
- package/lib/client.js.map +1 -1
- package/lib/index.js +542 -85
- package/lib/remote.js +68 -7
- package/lib/types/account-dropdown.d.ts +22 -0
- package/lib/types/client.d.ts +3 -0
- package/lib/types/composer-notice-style.d.ts +2 -0
- package/lib/types/config.d.ts +19 -2
- package/lib/types/copilot-accounts-card.d.ts +13 -2
- package/lib/types/copilot-accounts-remote.d.ts +1 -1
- package/lib/types/copilot-usage-card.d.ts +5 -0
- package/lib/types/remote.d.ts +6 -6
- package/lib/types/replay-recovery-ui.d.ts +3 -1
- package/lib/types/responses-replay-compat.d.ts +1 -1
- package/lib/types/session-accounts-remote.d.ts +1 -1
- package/lib/types/session-continuation-host.d.ts +42 -0
- package/lib/types/session-continuation-remote.d.ts +22 -0
- package/lib/types/session-continuation-types.d.ts +35 -0
- package/lib/types/session-continuation-ui.d.ts +49 -0
- package/lib/types/session-continuation.d.ts +13 -0
- package/lib/types/turn-selection.d.ts +2 -2
- package/package.json +5 -1
package/AGENTS.md
CHANGED
|
@@ -51,7 +51,9 @@ Identity presentation uses additive `ensureIdentity` Remotes, including explicit
|
|
|
51
51
|
|
|
52
52
|
The user approved independently authorized account records in the existing DSH credentials service. The canonical `llm-pi-ai/github-copilot` record remains unchanged as the compatibility account. Additional plugin-owned `github-copilot/account-<opaque-id>` records must be written directly by official pi-ai OAuth through public account-bound stores; never copy/move grants, refill the canonical record, introduce a separate credential storage service, patch Core, or implement another wire/catalog. Native `Models.getAuth()` and DSH `modifyRecord()` remain the refresh and serialization owners.
|
|
53
53
|
|
|
54
|
-
Settings store only the opaque global account selector and explicit `sessionAccounts` rows. Missing/invalid selectors or records fail explicitly, without another-account fallback. Models
|
|
54
|
+
Settings store only the opaque global account selector and explicit `sessionAccounts` rows. Missing/invalid selectors or records fail explicitly, without another-account fallback. Models manages reauthorization/removal and the global default; Credits may select an already authorized account for this Session's subsequent turns, restore global inheritance or run add-only authorization without selecting it (#305/#318). An explicit choice equal to the default remains explicit. Freeze account ownership before Auto assessment and request admission, holding mutation fences until native `turn/end`/disposal; later Session/default changes never redirect running steps, retries or search. Account-local credentials, metadata, quota, proof cancellation and native adapter composition must remain isolated. Keep one public adapter/controller registration, with no second wire/catalog or Core changes. Reauthorization/removal of a pinned record stays blocked; global-default selection may continue independently.
|
|
55
|
+
|
|
56
|
+
Account selection shows the current account and a compact Switch dropdown with no account search, never a flat unbounded account list. Mark the current choice, scroll long lists internally and place Add at the bottom. Saved-account reauthorization/removal remains in a separate management disclosure. One Models Manage disclosure contains account management and cross-account exact-ID model preferences. Continuation settings belong beside account controls. Persist the initial default-on epoch and later global changes with path-level CAS; only unseeded Sessions born after a known epoch inherit it, never retroactively enroll existing/unknown/forked histories. Normal Client continuation uses only the persistent Session policy; no next-turn-only or temporary-recovery duration choices. Explicit-off account changes require persistent-enable/keep-off/cancel choices, then fresh account revision readback before CAS. Exact replay failures offer loss-disclosed persistent Enable/Cancel when off, diagnostics without repeated authorization when on. Missing policy evidence fails explicitly, never a temporary authorization fallback. Retain old next-turn/recovery strict Remote contracts and Host admission for compatibility; failure-evidence expiry does not disable the persistent policy. No automatic send/retry, history writes, private Settings navigation or inferred encrypted account origin. The approved synthetic mock and current navigation limit are documented in [account management](./docs/account-management-experience.md).
|
|
55
57
|
|
|
56
58
|
Use hidden volatile `sessionAccounts` with path-level SettingsForms CAS, readback and restart evidence. Session account Remotes use explicit viewed IDs, native Agent lookup and strict codecs, never automatic Client scope. Credits uses that Session's account for identity/quota, rejecting mismatched or late results. Historical Account is an additive assistant-actions disclosure beside native Usage, captured only after a real ordinary native chunk; bounded Host-lifetime evidence becomes unknown after restart/eviction and is never reconstructed from today's settings. No new durable events, history/default/model/Usage writes, automatic account fallback, replay deletion or message retry. See [the requirements and acceptance gates](./docs/copilot-accounts.md).
|
|
57
59
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.0-alpha.110 (prepared)
|
|
4
|
+
|
|
5
|
+
- Replace searchable account-switch forms with one compact anchored dropdown in Models and Chat: current-choice checkmark, bounded internal scrolling and Add account footer (#320).
|
|
6
|
+
- Separate saved-account reauthorization/removal from switching. Preserve global confirmation, explicit-off continuation consent, fresh revision readback, cancellation and admitted-turn ownership; selecting never sends or retries.
|
|
7
|
+
- Record the approved dropdown mock and keyboard/mobile behavior. No Core changes, credential migration, live installation or restart.
|
|
8
|
+
- Unify normal continuation and failure guidance around the persistent Session policy. Remove duration radios and next-turn-only actions; when off, disclose loss and offer Enable/Cancel, when on, show diagnostics without repeated authorization. Existing temporary recovery contracts remain compatibility-only; their evidence expiry does not expire the persistent policy.
|
|
9
|
+
- Omit the nonfunctional Chat management entry and unavailable-navigation paragraph when no public Models navigation callback exists; keep full management in Models.
|
|
10
|
+
|
|
11
|
+
## 0.4.0-alpha.109 (prepared)
|
|
12
|
+
|
|
13
|
+
- Record the approved synthetic account-management mock and unify current-account/Switch interactions in Chat and Models. Search bounded account lists, add without selecting, and retain guarded full management inside one Models Manage disclosure with shared exact-ID model preferences (#318).
|
|
14
|
+
- Add persistent Session on/off/default policies, a creation-time global default for new unseeded Sessions, reversible next-turn consent and cancel-safe explicit-off account-switch confirmation. Existing/unknown/seeded histories are not enrolled retroactively. Authorization never sends or retries.
|
|
15
|
+
- Filter bounded pre-turn encrypted reasoning and embedded summaries through the published native Responses adapter; retain current-turn tool-loop reasoning, visible messages, native retries and durable history. Expose persistent/next-turn controls after exact replay failures; keep the native manual retry action.
|
|
16
|
+
- Preserve account/default/continuation settings revisions, dark/light native control readability, cancellation and stale-response fences. The pinned Core lacks a public Models deep link, so Chat provides manual navigation; no Core patch, credential copying, second transport or live installation.
|
|
17
|
+
|
|
3
18
|
## 0.4.0-alpha.108 (prepared)
|
|
4
19
|
|
|
5
20
|
- Align context evidence and replay recovery with native secondary typography throughout, including explanations and controls. Use the public full-width input dock above the composer instead of the non-wrapping statistics row (#315).
|
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ Visible Models and Credits renew expired identity without forcing fresh reads on
|
|
|
19
19
|
|
|
20
20
|
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.
|
|
21
21
|
|
|
22
|
-
**Source candidate: `0.4.0-alpha.
|
|
22
|
+
**Source candidate: `0.4.0-alpha.110` (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.
|
|
23
23
|
|
|
24
24
|
## What you can do
|
|
25
25
|
|
|
@@ -59,10 +59,10 @@ Supply any launcher patches with repeated `--patch /absolute/file`. Require `sup
|
|
|
59
59
|
For a **standalone named profile**:
|
|
60
60
|
|
|
61
61
|
```sh
|
|
62
|
-
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
62
|
+
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.110/dsh-github-copilot-0.4.0-alpha.110.tgz
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
For **Desktop**, its native package manager accepts `dsh-github-copilot@0.4.0-alpha.
|
|
65
|
+
For **Desktop**, its native package manager accepts `dsh-github-copilot@0.4.0-alpha.110` 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.
|
|
66
66
|
|
|
67
67
|
After an approved reload/restart:
|
|
68
68
|
|
|
@@ -169,10 +169,14 @@ Configuration is under `github-copilot`. Credentials, endpoint definitions and a
|
|
|
169
169
|
| Selection unknown/unavailable | Distinguish lost evidence from read failure; Retry only rereads |
|
|
170
170
|
| Missing/cancelled Turn Usage | Read [usage limitations](./docs/copilot-usage.md); do not infer zero billing |
|
|
171
171
|
| 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 |
|
|
172
|
-
| 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**
|
|
172
|
+
| 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** shows the same persistent Session continuation policy: when off, disclose loss and offer **Enable visible-history continuation** or Cancel; when already on, show diagnostic guidance without repeated authorization. No duration or next-turn-only choice. Evidence expiry does not disable the policy. Use native Retry separately; no automatic send/retry or history rewrite, and not a 408 fix. Never reset credentials or disable TLS as an automatic repair. |
|
|
173
173
|
| Hosted search unavailable | Check account/protocol/probe diagnostics; a legacy override stays authoritative until explicitly reset |
|
|
174
174
|
|
|
175
|
-
|
|
175
|
+
The Credits account panel shows the current account and **Switch**; Models has one **Manage** disclosure for account management and shared model preferences. Both use a compact dropdown without account search: the current choice is checked, long lists scroll internally, and Add sits at the bottom without selecting the new account. Models retains guarded local removal and reauthorization in a separate management disclosure. Exact-ID exclusions are shared across accounts; availability is account-specific. See the [approved experience and interactive mock](./docs/account-management-experience.md).
|
|
176
|
+
|
|
177
|
+
[Visible-history continuation](./docs/session-continuation.md) is configured beside account switching, not permanently above the composer. New unseeded Sessions default on after the feature's first successful activation; existing Sessions and inherited histories remain off unless explicitly authorized. Global defaults affect new Sessions only; Session on/off overrides persist across accounts/restarts until disabled. With continuation off, a different-account switch offers persistent enable, keep off or cancel, without a one-turn mode. Each new enabled turn omits prior encrypted reasoning and embedded summaries, even on the same account; current-turn reasoning, visible messages, tools and disk history remain unchanged. Authorization never auto-sends/retries and is not a quota/context cure. Exact replay failures expose the same policy and require a separate native retry. The pinned Core lacks a public Models deep link; Chat omits the nonfunctional management entry. Full management remains in Settings → Models → GitHub Copilot → Manage.
|
|
178
|
+
|
|
179
|
+
Context evidence and Replay recovery use compact, centered notices bounded by the native composer width. Model/item counts and status refresh live in collapsed technical details; loss consent remains explicit. The context notice explains that native 0% does not establish an empty context; native statistics stay unchanged. Switching accounts does not make old encrypted reasoning portable. The concise scope error points to explicit recovery or a new conversation; bounded, sanitized dispatch counts stay in Host diagnostics, not the main error. **Authorized** means permission is ready, not that a message was sent or recovery succeeded.
|
|
176
180
|
|
|
177
181
|
## Ownership and further reading
|
|
178
182
|
|
|
@@ -212,14 +216,14 @@ Commit attribution uses `Assisted-by` with the actual tool, never the model prov
|
|
|
212
216
|
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.
|
|
213
217
|
|
|
214
218
|
```sh
|
|
215
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
216
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
219
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.110/dsh-github-copilot-0.4.0-alpha.110.tgz
|
|
220
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.110/SHA256SUMS
|
|
217
221
|
sha256sum --check SHA256SUMS
|
|
218
222
|
```
|
|
219
223
|
|
|
220
224
|
```powershell
|
|
221
225
|
$expected = (Get-Content .\SHA256SUMS).Split()[0]
|
|
222
|
-
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.
|
|
226
|
+
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.110.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
|
|
223
227
|
if ($actual -cne $expected) { throw 'Release checksum mismatch' }
|
|
224
228
|
```
|
|
225
229
|
|
package/README.zh.md
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
添加账号时,设备授权链接、可选择的网址、一次性授权码、复制授权码和取消操作会同时显示。GitHub 授权完成后,会单独显示身份与可用模型验证阶段。添加账号不会更改全局默认;准备好后仍需显式执行现有的**切换**操作。技术诊断收在次级折叠区;账号/历史 turn 缺少身份时不会暴露不透明账号 ID,也不会根据当前设置推断历史身份。
|
|
19
19
|
|
|
20
|
-
**源码候选版本:`0.4.0-alpha.
|
|
20
|
+
**源码候选版本:`0.4.0-alpha.110`(尚未发布)。支持宿主:官方 DSH / Windows Desktop `0.2.0-rc.2`。** 较早 DSH pin 仅是历史证据,不是当前安装目标。已发布、已安装到 profile、已被运行中的 Host 加载,是三个不同状态。下方带版本的命令适用于候选版本发布后,不代表对应资产已经存在。
|
|
21
21
|
|
|
22
22
|
## 你可以做什么
|
|
23
23
|
|
|
@@ -57,10 +57,10 @@ node package/scripts/check-search-composition.mjs --profile-dir /absolute/profil
|
|
|
57
57
|
**独立具名 profile**:
|
|
58
58
|
|
|
59
59
|
```sh
|
|
60
|
-
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
60
|
+
dsh plugin --profile web add https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.110/dsh-github-copilot-0.4.0-alpha.110.tgz
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
**Desktop** 原生包管理器在发布后接受 `dsh-github-copilot@0.4.0-alpha.
|
|
63
|
+
**Desktop** 原生包管理器在发布后接受 `dsh-github-copilot@0.4.0-alpha.110`。官方 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 或删除配置。
|
|
64
64
|
|
|
65
65
|
经批准 reload/restart 后:
|
|
66
66
|
|
|
@@ -167,10 +167,14 @@ HTTP/SSE liveness 默认区分 5 分钟字节 idle 和有界的 10 分钟助手
|
|
|
167
167
|
| 选模未知/不可读 | 区分记录丢失与读取失败;Retry 只重读 |
|
|
168
168
|
| 缺失/取消后的 Turn Usage | 查看[用量限制](./docs/copilot-usage.md),不推断零计费 |
|
|
169
169
|
| 历史加载报 `github-copilot/auto-model-decision` | 使用[独立副本、先检查的恢复](./docs/automatic-model-routing.md#recovering-affected-histories);未经批准且未停写不得替换实际历史 |
|
|
170
|
-
| AUTH、Responses replay scope 或 TLS 错误 | 查看[请求诊断](./docs/model-compatibility-acceptance.md#authentication-replay-and-request-diagnostics)及[额度 TLS 边界](./docs/copilot-usage.md#account-data-boundary)。精确 scope
|
|
170
|
+
| AUTH、Responses replay scope 或 TLS 错误 | 查看[请求诊断](./docs/model-compatibility-acceptance.md#authentication-replay-and-request-diagnostics)及[额度 TLS 边界](./docs/copilot-usage.md#account-data-boundary)。精确 scope 拒绝后,**回放恢复**使用同一个持久 Session 降级续聊策略:关闭时说明损失并提供**开启降级续聊**/取消,已开启时只显示诊断,不重复授权。不再选择授权范围或仅下一轮;失败证据过期不会关闭策略。需另行使用原生重试,不自动发送/重试、不改磁盘历史,也不是 408 修复。不自动重置凭据或关闭 TLS。 |
|
|
171
171
|
| Hosted search 不可用 | 检查账号/协议/probe 诊断;旧 override 保留至显式 reset |
|
|
172
172
|
|
|
173
|
-
|
|
173
|
+
Credits 账号面板只显示当前账号和 **切换**;Models 用一个 **管理** 展开账号管理与共享模型偏好。两处统一使用无账号搜索框的紧凑 dropdown:当前项打勾,长列表内部滚动,底部添加账号但不自动选中。Models 的独立管理 disclosure 保留重新授权与受保护的本地账号移除。按精确模型 ID 共享排除偏好,可用性仍按账号验证。参见[已确认体验与交互 mock](./docs/account-management-experience.md)。
|
|
174
|
+
|
|
175
|
+
[可见历史续聊模式](./docs/session-continuation.md)放在账号切换旁,不再常驻输入框上方。功能首次成功激活后创建的非继承 Session 默认开启;已有 Session、继承历史仍需明确授权。全局默认只影响新 Session,Session 开关跨账号及重启保留,直到关闭。关闭时切换到不同账号,提供持续开启、保持关闭或取消,不再提供仅下一轮模式。启用后的每个新 turn 省略旧加密推理及其内嵌摘要,同账号也适用;当前轮新推理、可见消息、工具记录和磁盘历史不变。授权不自动发送或重试,不解决额度或上下文超限。精确回放失败使用同一个持久策略,用户另行点击原生重试。当前 Core 没有公开 Models 直达 API,Chat 不展示不可用的管理入口;完整管理仍在设置 → 模型 → GitHub Copilot → 管理。
|
|
176
|
+
|
|
177
|
+
上下文证据与回放恢复以紧凑、居中提示显示在输入框上方,宽度遵循原生输入框。模型、项数和状态刷新收进默认折叠的技术详情;有损恢复仍需明确确认。上下文提示直接说明原生 0% 不代表上下文为空,原生统计不变。切换账号不会让旧加密推理自动变得可跨账号使用。简短 scope 错误指向显式恢复或新会话;有界、脱敏的请求结构计数留在 Host 诊断中,不挤占主错误。**已授权**只表示授权已准备好,不表示消息已发送或恢复已成功。
|
|
174
178
|
|
|
175
179
|
## 所有权与深入阅读
|
|
176
180
|
|
|
@@ -210,14 +214,14 @@ Agent 从 `node scripts/agent.mjs describe --json`、`doctor --json`及`plan <ta
|
|
|
210
214
|
GitHub Releases 和 npm 分发同一原始已校验 tarball。固定版本并核验 Release SHA-256 或 npm `dist.integrity`;不重打包不可变 Release、不移动/复用 tag。
|
|
211
215
|
|
|
212
216
|
```sh
|
|
213
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
214
|
-
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.
|
|
217
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.110/dsh-github-copilot-0.4.0-alpha.110.tgz
|
|
218
|
+
curl -LO https://github.com/cloga/dsh-github-copilot/releases/download/v0.4.0-alpha.110/SHA256SUMS
|
|
215
219
|
sha256sum --check SHA256SUMS
|
|
216
220
|
```
|
|
217
221
|
|
|
218
222
|
```powershell
|
|
219
223
|
$expected = (Get-Content .\SHA256SUMS).Split()[0]
|
|
220
|
-
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.
|
|
224
|
+
$actual = (Get-FileHash .\dsh-github-copilot-0.4.0-alpha.110.tgz -Algorithm SHA256).Hash.ToLowerInvariant()
|
|
221
225
|
if ($actual -cne $expected) { throw 'Release checksum mismatch' }
|
|
222
226
|
```
|
|
223
227
|
|
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.110"
|
|
12
12
|
},
|
|
13
13
|
"evidence": {
|
|
14
14
|
"kind": "source-and-synthetic-test-inventory",
|
|
@@ -745,6 +745,33 @@
|
|
|
745
745
|
{"file": "tests/preview-route.spec.ts", "name": "does not retain a replay-scope failure across independent dispatches of one native prepared lease: %s"}
|
|
746
746
|
]
|
|
747
747
|
},
|
|
748
|
+
{
|
|
749
|
+
"id": "managed-session-visible-history-continuation",
|
|
750
|
+
"required": true,
|
|
751
|
+
"scope": "managed-responses-exact-session-turn-and-signal",
|
|
752
|
+
"liveEndpointAcceptance": "not-claimed",
|
|
753
|
+
"sourceMarkers": [
|
|
754
|
+
{"file": "src/session-continuation.ts", "marker": "class SessionContinuationTurn"},
|
|
755
|
+
{"file": "src/session-continuation-host.ts", "marker": "path: ['continuationDefaultHistory']"},
|
|
756
|
+
{"file": "src/session-continuation-host.ts", "marker": "COPILOT_CONTINUATION_TURN_BOUNDARY_UNAVAILABLE"},
|
|
757
|
+
{"file": "src/session-continuation-remote.ts", "marker": "authorizeNext"},
|
|
758
|
+
{"file": "src/copilot-usage-ui.ts", "marker": "useSessionContinuationSwitch"},
|
|
759
|
+
{"file": "src/account-dropdown.ts", "marker": "data-copilot-dropdown-option"},
|
|
760
|
+
{"file": "docs/mockups/copilot-account-dropdown.html", "marker": "Approved Dropdown Mock"},
|
|
761
|
+
{"file": "docs/account-management-experience.md", "marker": "All accounts, quota"}
|
|
762
|
+
],
|
|
763
|
+
"tests": [
|
|
764
|
+
{"file": "tests/account-dropdown.spec.ts", "name": "supports arrows, Home, End and Escape without closing the containing Chat panel"},
|
|
765
|
+
{"file": "tests/session-continuation.spec.ts", "name": "continues A-B-B-A by omitting pre-turn reasoning while retaining new tool-loop reasoning"},
|
|
766
|
+
{"file": "tests/replay-recovery-ui.spec.ts", "name": "enables only persistent Session continuation after loss disclosure, without legacy authorization or sending"},
|
|
767
|
+
{"file": "tests/replay-recovery-ui.spec.ts", "name": "does not reauthorize an already enabled policy or change it when failure evidence expires"},
|
|
768
|
+
{"file": "tests/session-continuation.spec.ts", "name": "does not replay baseline ciphertext after its ID or embedded summary changes"},
|
|
769
|
+
{"file": "tests/session-continuation-host.spec.ts", "name": "captures birth-time defaults and consumes one-turn consent"},
|
|
770
|
+
{"file": "tests/session-continuation-ui.spec.ts", "name": "requires off-switch choice: %s"},
|
|
771
|
+
{"file": "tests/preview-route.spec.ts", "name": "filters persistent Session consent through the published adapter on successive turns without history writes"},
|
|
772
|
+
{"file": "tests/fixtures/remote-core.fixture.ts", "name": "binds persistent Session continuation through actual Client and %s Host gateways"}
|
|
773
|
+
]
|
|
774
|
+
},
|
|
748
775
|
{
|
|
749
776
|
"id": "managed-explicit-replay-recovery",
|
|
750
777
|
"required": true,
|
|
@@ -756,14 +783,15 @@
|
|
|
756
783
|
{"file": "src/replay-recovery-host.ts", "marker": "COPILOT_REPLAY_RECOVERY_TURN_ACTIVE"},
|
|
757
784
|
{"file": "src/replay-recovery-remote.ts", "marker": "githubCopilotReplayRecovery.setEnabled"},
|
|
758
785
|
{"file": "src/replay-recovery-remote.ts", "marker": "githubCopilotReplayRecovery.authorize"},
|
|
759
|
-
{"file": "src/replay-recovery-ui.ts", "marker": "
|
|
786
|
+
{"file": "src/replay-recovery-ui.ts", "marker": "recovery: true"},
|
|
787
|
+
{"file": "src/session-continuation-ui.ts", "marker": "Enable visible-history continuation"}
|
|
760
788
|
],
|
|
761
789
|
"tests": [
|
|
762
790
|
{"file": "tests/replay-recovery.spec.ts", "name": "keeps default replay and requires a revision-bound confirmation"},
|
|
763
791
|
{"file": "tests/replay-recovery.spec.ts", "name": "preserves source, fresh reasoning, tools, other models and other owners"},
|
|
764
792
|
{"file": "tests/replay-recovery-host.spec.ts", "name": "requires the native initiating session and signal, rejects active-turn writes and revokes late requests"},
|
|
765
793
|
{"file": "tests/replay-recovery.spec.ts", "name": "admits only the next matching native turn, including its steps and retries"},
|
|
766
|
-
{"file": "tests/replay-recovery-ui.spec.ts", "name": "
|
|
794
|
+
{"file": "tests/replay-recovery-ui.spec.ts", "name": "enables only persistent Session continuation after loss disclosure, without legacy authorization or sending"},
|
|
767
795
|
{"file": "tests/replay-recovery-ui.spec.ts", "name": "is absent normally, reads on settled turns without polling and resets dismissal only for new evidence"},
|
|
768
796
|
{"file": "tests/preview-route.spec.ts", "name": "offers exact failed replay only to its initiating session and recovers after explicit confirmation"},
|
|
769
797
|
{"file": "tests/fixtures/remote-core.fixture.ts", "name": "binds explicit replay recovery through native Client and %s Host gateways"}
|
|
@@ -1297,7 +1325,7 @@
|
|
|
1297
1325
|
{"file": "tests/compact-account.spec.ts", "name": "renders a neutral checking state then only a compact signed-in row"},
|
|
1298
1326
|
{"file": "tests/compact-account.spec.ts", "name": "shows signed-out CTA and automatically reveals authorization without opening Manage"},
|
|
1299
1327
|
{"file": "tests/compact-account.spec.ts", "name": "retains manual management and live actions when toggled during authorization"},
|
|
1300
|
-
{"file": "tests/compact-account.spec.ts", "name": "keeps
|
|
1328
|
+
{"file": "tests/compact-account.spec.ts", "name": "keeps refresh and Retry inside Manage while discovery failures stay visible when collapsed"},
|
|
1301
1329
|
{"file": "tests/compact-account.spec.ts", "name": "cleans timers and ignores late requests after detach or Remote replacement"},
|
|
1302
1330
|
{"file": "tests/compact-account.spec.ts", "name": "keeps cancellation failures visible without reviving a stale code"},
|
|
1303
1331
|
{"file": "tests/compact-account.spec.ts", "name": "orders cancellation after pending start so a late Host preflight cannot create an abandoned flow"},
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Copilot account management and continuation experience
|
|
2
|
+
|
|
3
|
+
Approved account switching reference: [dropdown mock](./mockups/copilot-account-dropdown.html).
|
|
4
|
+
The [complete continuation mock](./mockups/copilot-account-management.html) retains
|
|
5
|
+
the earlier search-form presentation as historical context; the dropdown replaces it.
|
|
6
|
+
Open the HTML locally; append `?scenario=off-switch` to start with continuation
|
|
7
|
+
disabled and an account switch awaiting confirmation. All accounts, quota,
|
|
8
|
+
authorization, messages and model availability in this mock are synthetic.
|
|
9
|
+
It performs no network requests and persists no credentials or settings.
|
|
10
|
+
|
|
11
|
+
## Chat: quick selection, not a second settings page
|
|
12
|
+
|
|
13
|
+
The Credits control opens a compact current-account summary and Switch button.
|
|
14
|
+
Do not render all saved accounts until Switch is opened. A compact anchored dropdown
|
|
15
|
+
marks the current choice, supports bounded internal scrolling, following the global
|
|
16
|
+
account and adding an account. Do not add an account search field or repeat Switch
|
|
17
|
+
buttons per row. Escape closes only the dropdown and restores its trigger; arrows,
|
|
18
|
+
Home and End navigate enabled options. Outside interaction dismisses the list.
|
|
19
|
+
Adding an account does not select it. Quota is account billing-cycle data, not
|
|
20
|
+
context occupancy or Session cost; missing and pooled data retain their semantics.
|
|
21
|
+
|
|
22
|
+
Selection applies to subsequent turns of the viewed Session. An active turn
|
|
23
|
+
keeps its admitted account and policy. Save failures retain their real uncertainty
|
|
24
|
+
and never imply that a change succeeded. Session explicit choices do not change
|
|
25
|
+
other Sessions or the global default.
|
|
26
|
+
|
|
27
|
+
The same panel includes a collapsible continuation policy. Full management belongs
|
|
28
|
+
in Models; show a "Manage accounts and models" entry only with a working public
|
|
29
|
+
navigation callback. Do not show a disabled link or unavailable-navigation paragraph.
|
|
30
|
+
Opening and closing Settings must not discard the composer draft or change the
|
|
31
|
+
selected Session. Direct navigation and automatic expansion depend on published
|
|
32
|
+
navigation APIs; absent support leaves navigation to ordinary Settings, never
|
|
33
|
+
parent DOM manipulation or a nonfunctional entry.
|
|
34
|
+
|
|
35
|
+
## Models: one Manage disclosure, two responsibilities
|
|
36
|
+
|
|
37
|
+
The existing native Settings layout and provider controls remain. The collapsed
|
|
38
|
+
Copilot contribution shows current default identity, model status, cache age and
|
|
39
|
+
one Manage button. Manage expands:
|
|
40
|
+
|
|
41
|
+
- Account management: current default account, Switch dropdown/add, identity
|
|
42
|
+
refresh, reauthorization, guarded removal, and new-Session continuation default.
|
|
43
|
+
- Model preferences: cross-account shared exclusions, model search and filters,
|
|
44
|
+
account-specific availability, discovery diagnostics and model refresh.
|
|
45
|
+
|
|
46
|
+
Removal requires explicit confirmation. It removes only locally saved account
|
|
47
|
+
authorization, not GitHub-side access, conversations or shared model preferences.
|
|
48
|
+
Preserve existing canonical/default/in-use removal guards; do not silently choose
|
|
49
|
+
another account.
|
|
50
|
+
|
|
51
|
+
Keep saved-account reauthorization/removal in a separate collapsed management
|
|
52
|
+
disclosure, not in the switching menu. The dropdown remains an account choice,
|
|
53
|
+
not another settings page. Global switching retains its explicit confirmation;
|
|
54
|
+
Chat retains the continuation confirmation when the current policy is off.
|
|
55
|
+
|
|
56
|
+
Model preferences are shared by exact model ID. Availability and capability
|
|
57
|
+
evidence remain account-specific. Missing models retain saved preferences;
|
|
58
|
+
returning models reuse them without becoming selected. Newly discovered models
|
|
59
|
+
are enabled unless excluded, but must satisfy authenticated metadata and admission
|
|
60
|
+
checks. Unknown/stale availability is not verified availability or definitive
|
|
61
|
+
absence. Do not discover every account solely to render a union catalog.
|
|
62
|
+
Fixed unavailable selections require explicit user correction; Auto uses only
|
|
63
|
+
eligible unexcluded models of the admitted account.
|
|
64
|
+
|
|
65
|
+
## Continuation and explicit-off recovery
|
|
66
|
+
|
|
67
|
+
The approved default is lossy visible-history continuation enabled for new
|
|
68
|
+
Sessions, with the loss disclosed beside the control. Existing Sessions and
|
|
69
|
+
seeded/forked histories must not silently inherit a new loss authorization.
|
|
70
|
+
Global changes do not retroactively rewrite a Session's captured initial policy.
|
|
71
|
+
Session overrides, including explicit off, persist and are reversible.
|
|
72
|
+
|
|
73
|
+
Every new admitted turn omits pre-existing encrypted reasoning items and their
|
|
74
|
+
embedded summaries, including on the same account. Visible messages, tool
|
|
75
|
+
calls/results and stored history remain unchanged. Current-turn reasoning stays
|
|
76
|
+
available for tool steps and native retries. This does not solve quota, HTTP 408
|
|
77
|
+
or oversized context and does not guarantee supplier acceptance.
|
|
78
|
+
|
|
79
|
+
When continuation is off and the user switches accounts, stop before saving the
|
|
80
|
+
selection and disclose the potential replay risk. Offer persistent enable and
|
|
81
|
+
switch, keep off and switch, or cancel. Do not offer next-turn-only authorization.
|
|
82
|
+
Account differences alone do not prove supplier rejection. Never guess encrypted
|
|
83
|
+
item origin or silently filter history.
|
|
84
|
+
|
|
85
|
+
After an exact supplier replay rejection, retain the native failed turn and
|
|
86
|
+
surface the same persistent Session policy: when off, disclose loss and offer
|
|
87
|
+
Enable/Cancel; when on, show diagnostic guidance without repeated authorization.
|
|
88
|
+
Do not show duration radios or unavailable Models navigation. Failure-evidence
|
|
89
|
+
expiry does not disable the persistent policy. Authorization never sends or retries. The user explicitly retries
|
|
90
|
+
the task through the native mechanism. Mock assistant answers are demonstrations,
|
|
91
|
+
not evidence of real cross-account success. Do not fabricate durable messages,
|
|
92
|
+
errors, replay or assistant content to imitate the mock.
|
|
93
|
+
|
|
94
|
+
## Theme and accessibility
|
|
95
|
+
|
|
96
|
+
Use native theme tokens for surfaces, text, borders, focus and errors. Native
|
|
97
|
+
select popup options must remain readable in dark and light themes; do not inherit
|
|
98
|
+
light popup backgrounds with dark-theme white text. Dropdowns and long account lists
|
|
99
|
+
must remain keyboard-operable, bounded and usable on narrow viewports. Explicit
|
|
100
|
+
loading, unknown, stale, failed-save and cancellation states are required.
|
|
101
|
+
|
|
102
|
+
## Implementation status
|
|
103
|
+
|
|
104
|
+
This document records the approved target, not a release or runtime attestation.
|
|
105
|
+
Implementation, native gateway/settings persistence, request admission,
|
|
106
|
+
dark/light interaction checks and required CI must qualify it before delivery.
|
package/docs/copilot-accounts.md
CHANGED
|
@@ -13,8 +13,9 @@ publication, installation and loaded runtime state are separate evidence.
|
|
|
13
13
|
- Keep multiple independently authorized GitHub Copilot accounts in one DSH
|
|
14
14
|
profile. Models retains the global default. Sessions without an override
|
|
15
15
|
inherit that default at each new turn; explicit Session choices take priority.
|
|
16
|
-
- Models
|
|
17
|
-
|
|
16
|
+
- Models manages reauthorization/removal and the global default; Credits supports
|
|
17
|
+
add-only authorization without selection. Its compact no-search dropdown
|
|
18
|
+
applies to this Session's subsequent turns. No standalone
|
|
18
19
|
composer selector, one-turn override or DSH application identity replacement.
|
|
19
20
|
- Persist OAuth grants through the existing DSH credentials service. Use
|
|
20
21
|
official pi-ai login, refresh and transport, not copied credentials, a token
|
|
@@ -218,12 +219,19 @@ cannot be named `remove`: official rc.2 reserves that inherited service name
|
|
|
218
219
|
and rejects the entire Client contribution.
|
|
219
220
|
|
|
220
221
|
Credits shows the Session's next-turn account and quota under the existing title.
|
|
221
|
-
Its **Switch
|
|
222
|
-
|
|
222
|
+
Its **Switch** dropdown marks the current choice, scrolls long lists internally
|
|
223
|
+
and offers **Follow global default** plus add-only authorization at the bottom.
|
|
224
|
+
Reauthorization, removal and global
|
|
225
|
+
selection remain in Models. Changing
|
|
223
226
|
the preference while a turn runs leaves that turn's old account pinned; the
|
|
224
227
|
popover identifies it separately. Other Sessions are unchanged. Unknown identity
|
|
225
228
|
is unavailable, not a stale username presented as current.
|
|
226
229
|
|
|
230
|
+
One Models **Manage** groups account management and shared exact-ID model
|
|
231
|
+
preferences. The Credits account panel contains continuation policy; when off,
|
|
232
|
+
an account change pauses for explicit persistent-enable/keep-off/cancel consent.
|
|
233
|
+
See [the approved experience and mock](./account-management-experience.md).
|
|
234
|
+
|
|
227
235
|
Completed managed turns have a compact **Account** disclosure alongside native
|
|
228
236
|
Usage/selection actions through the public assistant-actions slot. This is
|
|
229
237
|
request-account evidence, not billing attribution or a subagent account rollup.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<meta charset="utf-8">
|
|
4
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
5
|
+
<title>账号切换 · Approved Dropdown Mock</title>
|
|
6
|
+
<style>
|
|
7
|
+
:root{color-scheme:dark;--bg:#202020;--panel:#2b2b2b;--popup:#333;--line:#505050;--text:#f2f2f2;--muted:#c0c0c0;--hover:#414141}
|
|
8
|
+
*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font:14px/1.55 system-ui,"Segoe UI",sans-serif;padding:28px}
|
|
9
|
+
button,input,textarea{font:inherit;color:inherit}button{cursor:pointer;background:transparent;border:1px solid var(--line);border-radius:8px;padding:8px 14px}button:hover{background:var(--hover)}button:focus-visible,summary:focus-visible,textarea:focus-visible{outline:2px solid #aacfff;outline-offset:3px}
|
|
10
|
+
button:disabled{opacity:.5;cursor:default}[hidden]{display:none!important}h1{font-size:18px;margin:0}h2{font-size:16px;margin:0 0 12px}p{color:var(--muted);margin:8px 0}small{color:var(--muted);font-size:12px}
|
|
11
|
+
.preview{max-width:840px;margin:auto}.preview-head{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:22px}.tabs{display:flex;gap:6px}.tabs button[aria-pressed=true]{background:var(--hover)}
|
|
12
|
+
.provider{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:22px}.provider-head,.account-row{display:flex;align-items:center;justify-content:space-between;gap:16px}.provider-head strong{font-size:19px}.provider-head small{margin-left:10px}.manage{border-top:1px solid var(--line);margin-top:20px;padding-top:22px}
|
|
13
|
+
.account-row{position:relative;margin:16px 0}.identity strong{font-size:17px;display:block}.identity small{display:block;margin-top:2px}.switch{white-space:nowrap}.caret{font-size:11px;margin-left:9px}.account-menu{position:absolute;right:0;top:calc(100% + 8px);width:min(300px,100%);z-index:5;background:var(--popup);border:1px solid #666;border-radius:10px;box-shadow:0 10px 28px #0006;padding:5px}
|
|
14
|
+
.options{max-height:228px;overflow:auto;overscroll-behavior:contain}.option{width:100%;display:flex;align-items:center;gap:10px;text-align:left;border:0;padding:10px;border-radius:5px;min-height:46px}.check{width:18px;flex-shrink:0;color:#c7ddff}.option .name{flex:1;min-width:0;overflow-wrap:anywhere}.option small{display:block}.add{border-top:1px solid var(--line);margin-top:5px;padding-top:5px}.add button{width:100%;text-align:left;border:0}.account-actions{display:flex;flex-wrap:wrap;gap:8px;margin:16px 0}.quiet{border:0;color:var(--muted);padding-left:0;padding-right:8px}.danger{color:#ffb8b8}
|
|
15
|
+
details{margin-top:18px}summary{cursor:pointer}label{display:flex;align-items:center;gap:9px;margin:12px 0}input{accent-color:#c7ddff}.preferences{border-top:1px solid var(--line);margin-top:24px;padding-top:22px}.model{display:flex;align-items:center;justify-content:space-between;padding:12px 0;border-bottom:1px solid var(--line)}.model button{font-size:12px;padding:5px 10px}.caption{margin-top:20px;font-size:12px}.status{min-height:22px;font-size:12px;color:#c7ddff;margin-top:12px}
|
|
16
|
+
.chat{min-height:490px;display:flex;flex-direction:column}.messages{flex:1;padding:20px 0}.message{max-width:75%;padding:12px 16px;background:var(--panel);border-radius:12px;margin-bottom:20px}.message.user{margin-left:auto;background:#373737}.composer{border:1px solid var(--line);border-radius:12px;padding:14px}.composer textarea{width:100%;min-height:60px;resize:vertical;border:0;background:none;outline-offset:0}.toolbar{display:flex;justify-content:space-between;color:var(--muted)}.credits{display:flex;justify-content:flex-end;margin-top:8px}.chat-panel{width:min(410px,100%);margin:10px 0 0 auto;background:var(--panel);border:1px solid var(--line);border-radius:12px;padding:18px}.chat-panel .account-row{margin-top:0}.chat-panel .account-menu{top:auto;bottom:calc(100% + 8px)}
|
|
17
|
+
dialog{width:min(420px,calc(100% - 32px));background:var(--panel);color:var(--text);border:1px solid var(--line);border-radius:12px;padding:24px}dialog::backdrop{background:#0008}.dialog-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:20px}
|
|
18
|
+
@media(max-width:520px){body{padding:16px}.preview-head{align-items:flex-start;flex-direction:column}.provider{padding:16px}.provider-head{align-items:flex-start}.provider-head small{display:block;margin:4px 0 0}.message{max-width:90%}.account-actions{gap:4px}.chat{min-height:450px}}
|
|
19
|
+
</style>
|
|
20
|
+
<div class="preview">
|
|
21
|
+
<header class="preview-head"><div><h1>账号切换 · 简化版</h1><small>交互 Mock · 全部为虚构数据,不操作真实账号</small></div><nav class="tabs" aria-label="预览页面"><button id="models-tab" aria-pressed="true">Models</button><button id="chat-tab" aria-pressed="false">Chat</button></nav></header>
|
|
22
|
+
<section id="models" class="provider">
|
|
23
|
+
<div class="provider-head"><div><strong>GitHub Copilot</strong><small>Signed in · 19 models</small></div><button id="manage-button" aria-expanded="true">Manage</button></div>
|
|
24
|
+
<div class="manage" id="manage">
|
|
25
|
+
<h2>账号管理</h2><p>选择全局默认账号。已有 Session 的显式选择不变。</p>
|
|
26
|
+
<div class="account-row"><div class="identity"><strong id="global-name">@demo-personal</strong><small>全局默认账号</small></div><button class="switch" id="models-switch" aria-expanded="false" aria-controls="models-menu">切换<span class="caret">▾</span></button>
|
|
27
|
+
<div id="models-menu" class="account-menu" hidden><div class="options" aria-label="全局默认账号"></div><div class="add"><button data-add>+ 添加账号</button></div></div></div>
|
|
28
|
+
<div class="account-actions"><button data-action="刷新账号信息">刷新账号信息</button><button data-action="重新授权">重新授权</button><button class="quiet danger" id="remove">删除账号</button></div>
|
|
29
|
+
<details><summary>新 Session 续聊默认</summary><label><input type="checkbox" checked>默认开启有损续聊</label><p><small>新轮次省略旧加密推理及其内嵌摘要;可见消息、工具记录和磁盘历史不变。仅影响新 Session,不自动发送或重试。</small></p></details>
|
|
30
|
+
<section class="preferences"><h2>模型偏好</h2><p><small>偏好跨账号共享;可用性按当前账号验证。</small></p><div class="model"><span>GPT-6.1 Sol <small>· 可用</small></span><button data-model>排除</button></div><div class="model"><span>Claude Sonnet <small>· 可用</small></span><button data-model>排除</button></div><div class="model"><span>Gemini Pro <small>· 当前账号不可用</small></span><button data-model>排除</button></div></section>
|
|
31
|
+
</div>
|
|
32
|
+
</section>
|
|
33
|
+
<section id="chat" class="chat" hidden>
|
|
34
|
+
<div class="messages"><div class="message user">继续完善账号切换的交互。</div><div class="message">保留当前账号,点击「切换」后用一个紧凑下拉菜单选择,不再展开搜索表单。</div></div>
|
|
35
|
+
<div class="composer"><textarea aria-label="模拟消息" placeholder="输入消息…(仅模拟)"></textarea><div class="toolbar"><span>+ Full access ▾</span><span>Auto ▾ ↑</span></div></div>
|
|
36
|
+
<div class="credits"><button id="credits">Credits · <span id="credits-name">@demo-personal</span> ▾</button></div>
|
|
37
|
+
<div class="chat-panel" id="chat-panel">
|
|
38
|
+
<div class="account-row"><div class="identity"><strong id="session-name">@demo-personal</strong><small>本 Session 账号</small></div><button class="switch" id="chat-switch" aria-expanded="false" aria-controls="chat-menu">切换<span class="caret">▾</span></button>
|
|
39
|
+
<div id="chat-menu" class="account-menu" hidden><div class="options" aria-label="本 Session 账号"></div><div class="add"><button data-add>+ 添加账号</button></div></div></div>
|
|
40
|
+
<details><summary>本 Session 有损续聊 · 开启</summary><label><input id="session-policy" type="checkbox" checked>持续开启</label><p><small>每轮省略旧加密推理及内嵌摘要;可见历史不变。不自动发送或重试。</small></p></details>
|
|
41
|
+
<button class="quiet" id="simulate-rejection">模拟旧推理被拒绝</button>
|
|
42
|
+
</div>
|
|
43
|
+
</section>
|
|
44
|
+
<p id="status" class="status" role="status" aria-live="polite"></p>
|
|
45
|
+
<footer class="caption">点击「切换」查看菜单。无搜索框,无逐账号 Switch 按钮;当前账号打勾,长列表内部滚动。<button class="quiet" id="many">模拟 24 个账号</button></footer>
|
|
46
|
+
</div>
|
|
47
|
+
<dialog id="dialog"><h2 id="dialog-title"></h2><p id="dialog-copy"></p><div id="dialog-actions" class="dialog-actions"></div></dialog>
|
|
48
|
+
<script>
|
|
49
|
+
const $=id=>document.getElementById(id);
|
|
50
|
+
let accounts=['@demo-personal','@demo-work','@demo-backup'],globalAccount=accounts[0],sessionAccount=accounts[0],lastTrigger;
|
|
51
|
+
function notice(text){$('status').textContent=text}
|
|
52
|
+
function closeMenus(){for(const scope of ['models','chat']){$(scope+'-menu').hidden=true;$(scope+'-switch').setAttribute('aria-expanded','false')}}
|
|
53
|
+
function dialog(title,copy,actions){closeMenus();$('dialog-title').textContent=title;$('dialog-copy').textContent=copy;$('dialog-actions').replaceChildren();for(const [label,action] of actions){const b=document.createElement('button');b.textContent=label;b.onclick=()=>{$('dialog').close();action?.()};$('dialog-actions').append(b)}$('dialog').showModal()}
|
|
54
|
+
$('simulate-rejection').onclick=()=>dialog('旧推理回放被拒绝',$('session-policy').checked?'本 Session 已开启降级续聊,请另行使用原生重试。如果仍被拒绝,请查看技术诊断或新建会话;不重复授权或自动重试。':'降级续聊省略旧加密推理及内嵌摘要,保留可见消息、工具记录和磁盘历史;可能损失隐含细节。开启后在本 Session 持续生效,跨账号和重启保留,直到关闭。不会自动重试。',$('session-policy').checked?[['关闭提示']]:[['开启降级续聊',()=>{$('session-policy').checked=true;render();notice('模拟:持久策略已开启,请另行点击原生重试。没有发送消息。')}],['取消']]);
|
|
55
|
+
function render(){for(const scope of ['models','chat']){const list=$(scope+'-menu').querySelector('.options'),current=scope==='models'?globalAccount:sessionAccount;list.replaceChildren();for(const account of accounts){const b=document.createElement('button');b.className='option';b.setAttribute('aria-pressed',String(account===current));const check=document.createElement('span');check.className='check';check.textContent=account===current?'✓':'';check.setAttribute('aria-hidden','true');const name=document.createElement('span');name.className='name';name.textContent=account;b.append(check,name);if(account===current){const tag=document.createElement('small');tag.textContent='当前';b.append(tag)}b.onclick=()=>{if(scope==='chat'&&!$('session-policy').checked&&account!==current){dialog('切换账号前确认','有损续聊会省略旧加密推理及其内嵌摘要。可见消息、工具记录和磁盘历史不变。授权不会自动发送或重试。',[['开启并切换',()=>{$('session-policy').checked=true;choose(scope,account)}],['保持关闭并切换',()=>choose(scope,account)],['取消']])}else choose(scope,account)};list.append(b)}}$('global-name').textContent=globalAccount;$('session-name').textContent=sessionAccount;$('credits-name').textContent=sessionAccount;$('session-policy').closest('details').querySelector('summary').textContent='本 Session 有损续聊 · '+($('session-policy').checked?'开启':'关闭')}
|
|
56
|
+
function choose(scope,account){if(scope==='models')globalAccount=account;else sessionAccount=account;closeMenus();render();notice('模拟:'+(scope==='models'?'全局默认':'本 Session')+'已切换至 '+account+';没有发送消息。');lastTrigger?.focus()}
|
|
57
|
+
for(const scope of ['models','chat'])$(scope+'-switch').onclick=()=>{const open=$(scope+'-menu').hidden;closeMenus();lastTrigger=$(scope+'-switch');$(scope+'-menu').hidden=!open;lastTrigger.setAttribute('aria-expanded',String(open));if(open)$(scope+'-menu').querySelector('.option').focus()};
|
|
58
|
+
document.addEventListener('click',e=>{if(!e.target.closest('.account-row'))closeMenus()});
|
|
59
|
+
document.addEventListener('keydown',e=>{const menu=e.target.closest('.account-menu');if(e.key==='Escape'){closeMenus();lastTrigger?.focus()}if(menu&&['ArrowDown','ArrowUp','Home','End'].includes(e.key)){const buttons=Array.from(menu.querySelectorAll('button'));let index=buttons.indexOf(document.activeElement);index=e.key==='Home'?0:e.key==='End'?buttons.length-1:(index+(e.key==='ArrowDown'?1:-1)+buttons.length)%buttons.length;buttons[index].focus();e.preventDefault()}});
|
|
60
|
+
for(const page of ['models','chat'])$(page+'-tab').onclick=()=>{closeMenus();for(const p of ['models','chat']){$(p).hidden=p!==page;$(p+'-tab').setAttribute('aria-pressed',String(p===page))}notice('')};
|
|
61
|
+
$('manage-button').onclick=()=>{$('manage').hidden=!$('manage').hidden;$('manage-button').setAttribute('aria-expanded',String(!$('manage').hidden))};
|
|
62
|
+
$('credits').onclick=()=>{$('chat-panel').hidden=!$('chat-panel').hidden;closeMenus()};
|
|
63
|
+
$('session-policy').onchange=render;
|
|
64
|
+
$('many').onclick=()=>{accounts=accounts.slice(0,3);for(let n=4;n<=24;n++)accounts.push('@demo-account-'+n);render();notice('已模拟 24 个账号。打开菜单后在内部滚动。')};
|
|
65
|
+
document.querySelectorAll('[data-add]').forEach(b=>b.onclick=()=>dialog('添加账号','正式功能将进入 GitHub 授权。这里仅模拟添加,不访问网络,也不会自动切换账号。',[['模拟授权完成',()=>{accounts.push('@demo-new-'+accounts.length);render();notice('已添加模拟账号,当前账号不变。')}],['取消']]));
|
|
66
|
+
document.querySelectorAll('[data-action]').forEach(b=>b.onclick=()=>notice('模拟:'+b.dataset.action+',未执行网络请求。'));
|
|
67
|
+
document.querySelectorAll('[data-model]').forEach(b=>b.onclick=()=>{b.textContent=b.textContent==='排除'?'恢复':'排除';notice('仅修改模拟偏好。')});
|
|
68
|
+
$('remove').onclick=()=>dialog('删除 '+globalAccount+'?','当前全局默认账号不能直接删除。请先切换至其他账号;这里不会删除真实账号或凭据。',[['知道了']]);
|
|
69
|
+
render();
|
|
70
|
+
</script>
|
|
71
|
+
</html>
|